@koine/next 1.0.3 → 1.0.8
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/Analytics/AnalyticsGoogle.d.ts +5 -6
- package/Analytics/AnalyticsGoogle.js +37 -0
- package/Analytics/index.d.ts +1 -1
- package/Analytics/index.js +1 -0
- package/Auth/helpers.d.ts +17 -17
- package/Auth/helpers.js +21 -0
- package/Auth/index.d.ts +4 -4
- package/Auth/index.js +4 -0
- package/Auth/useLogin.d.ts +7 -7
- package/Auth/useLogin.js +47 -0
- package/Auth/useLoginUrl.d.ts +1 -1
- package/Auth/useLoginUrl.js +11 -0
- package/Auth/useLogout.d.ts +6 -6
- package/Auth/useLogout.js +52 -0
- package/Favicon/Favicon.d.ts +3 -4
- package/Favicon/Favicon.js +4 -0
- package/Favicon/index.d.ts +1 -1
- package/Favicon/index.js +1 -0
- package/Forms/index.d.ts +2 -2
- package/Forms/index.js +2 -0
- package/Forms/useForm.d.ts +32 -32
- package/Forms/useForm.js +33 -0
- package/Forms/useSubmit.d.ts +24 -24
- package/Forms/useSubmit.js +20 -0
- package/Head/Head.d.ts +1 -1
- package/Head/Head.js +1 -0
- package/Head/index.d.ts +1 -1
- package/Head/index.js +1 -0
- package/I18n/I18n.d.ts +48 -48
- package/I18n/I18n.js +86 -0
- package/I18n/index.d.ts +1 -1
- package/I18n/index.js +1 -0
- package/Img/Img.d.ts +21 -21
- package/Img/Img.js +30 -0
- package/Img/index.d.ts +1 -1
- package/Img/index.js +1 -0
- package/Link/Link.d.ts +8 -8
- package/Link/Link.js +12 -0
- package/Link/index.d.ts +1 -1
- package/Link/index.js +1 -0
- package/NextProgress/NextProgress.d.ts +13 -14
- package/NextProgress/NextProgress.js +38 -0
- package/NextProgress/index.d.ts +1 -1
- package/NextProgress/index.js +1 -0
- package/Seo/Seo.d.ts +3 -3
- package/Seo/Seo.js +8 -0
- package/Seo/SeoDefaults.d.ts +3 -3
- package/Seo/SeoDefaults.js +12 -0
- package/Seo/helpers.d.ts +48 -48
- package/Seo/helpers.js +113 -0
- package/Seo/index.d.ts +12 -12
- package/Seo/index.js +12 -0
- package/Theme/Theme.d.ts +46 -46
- package/Theme/Theme.js +235 -0
- package/Theme/index.d.ts +1 -1
- package/Theme/index.js +1 -0
- package/app/App--emotion.d.ts +10 -10
- package/app/App--emotion.js +11 -0
- package/app/App--sc.d.ts +10 -10
- package/app/App--sc.js +11 -0
- package/app/App--vanilla.d.ts +10 -10
- package/app/App--vanilla.js +11 -0
- package/app/AppAuth--emotion.d.ts +10 -10
- package/app/AppAuth--emotion.js +12 -0
- package/app/AppAuth--sc.d.ts +10 -10
- package/app/AppAuth--sc.js +12 -0
- package/app/AppHead.d.ts +3 -3
- package/app/AppHead.js +5 -0
- package/app/{AppMain.d.ts → AppMain--emotion.d.ts} +34 -34
- package/app/AppMain--emotion.js +27 -0
- package/app/AppMain--sc.d.ts +34 -0
- package/app/AppMain--sc.js +27 -0
- package/app/AppMain--vanilla.d.ts +27 -27
- package/app/AppMain--vanilla.js +11 -0
- package/app/AppTheme--emotion.d.ts +15 -15
- package/app/AppTheme--emotion.js +17 -0
- package/app/AppTheme--sc.d.ts +13 -13
- package/app/AppTheme--sc.js +9 -0
- package/app/AppTheme--vanilla.d.ts +10 -10
- package/app/AppTheme--vanilla.js +12 -0
- package/app/index.d.ts +11 -11
- package/app/index.js +11 -0
- package/app/motion-features.d.ts +2 -2
- package/app/motion-features.js +2 -0
- package/config/index.d.ts +58 -58
- package/config/index.js +144 -0
- package/document/Document--emotion.d.ts +5 -5
- package/document/Document--emotion.js +55 -0
- package/document/Document--sc.d.ts +11 -11
- package/document/Document--sc.js +33 -0
- package/document/Document--vanilla.d.ts +11 -11
- package/document/Document--vanilla.js +20 -0
- package/document/Document.d.ts +10 -10
- package/document/Document.js +14 -0
- package/document/index.d.ts +4 -4
- package/document/index.js +4 -0
- package/index.d.ts +15 -12
- package/index.js +15 -743
- package/index.umd.js +2061 -78
- package/package.json +27 -21
- package/{types.d.ts → typings.d.ts} +0 -0
- package/utils/api.d.ts +55 -55
- package/utils/api.js +33 -0
- package/{document/emotion.d.ts → utils/emotion-cache.d.ts} +5 -5
- package/utils/emotion-cache.js +8 -0
- package/utils/index.d.ts +20 -19
- package/utils/index.js +27 -0
- package/Theme.js +0 -1905
- package/_tslib.js +0 -41
- package/app.js +0 -250
- package/config.js +0 -183
- package/document.js +0 -207
- package/emotion.js +0 -1329
- package/es.object.assign.js +0 -1074
- package/es.string.replace.js +0 -785
- package/es.string.split.js +0 -201
- package/index.esm.js +0 -4600
- package/motion-features.js +0 -10
package/index.umd.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('next/router'), require('next/script'), require('@koine/utils'), require('next-auth/react'), require('date-fns/format'), require('next-translate/useTranslation'), require('@koine/react'), require('next-translate/Trans'), require('next/head'), require('react-hook-form'), require('@hookform/resolvers/yup'), require('react-use'), require('next/image'), require('next/link')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', 'next/router', 'next/script', '@koine/utils', 'next-auth/react', 'date-fns/format', 'next-translate/useTranslation', '@koine/react', 'next-translate/Trans', 'next/head', 'react-hook-form', '@hookform/resolvers/yup', 'react-use', 'next/image', 'next/link'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Next = {}, global.jsxRuntime, global.React, global.router, global.Script, global.utils, global.react$
|
|
5
|
-
})(this, (function (exports, jsxRuntime,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('next/router'), require('next/script'), require('@koine/utils'), require('next-auth/react'), require('date-fns/format'), require('next-translate/useTranslation'), require('@koine/react'), require('next-translate/Trans'), require('next/head'), require('react-hook-form'), require('@hookform/resolvers/yup'), require('react-use'), require('next/image'), require('next/link'), require('@mui/material/styles'), require('@emotion/react'), require('@mui/material/CssBaseline'), require('framer-motion'), require('styled-components'), require('next/document'), require('@emotion/server/create-instance')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', 'next/router', 'next/script', '@koine/utils', 'next-auth/react', 'date-fns/format', 'next-translate/useTranslation', '@koine/react', 'next-translate/Trans', 'next/head', 'react-hook-form', '@hookform/resolvers/yup', 'react-use', 'next/image', 'next/link', '@mui/material/styles', '@emotion/react', '@mui/material/CssBaseline', 'framer-motion', 'styled-components', 'next/document', '@emotion/server/create-instance'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Next = {}, global.jsxRuntime, global.React, global.router, global.Script, global.utils, global.react$1, global.format, global.useTranslation, global.react, global.Trans, global.Head, global.reactHookForm, global.yup, global.reactUse, global.NextImage, global.NextLink, global.styles, global.emotionReact, global.CssBaseline, global.framerMotion, global.styled, global.NextDocument, global.createEmotionServer));
|
|
5
|
+
})(this, (function (exports, jsxRuntime, React, router, Script, utils, react$1, format, useTranslation, react, Trans, Head, reactHookForm, yup, reactUse, NextImage, NextLink, styles, react$2, CssBaseline, framerMotion, styledComponents, NextDocument, createEmotionServer) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
9
10
|
var Script__default = /*#__PURE__*/_interopDefaultLegacy(Script);
|
|
10
11
|
var format__default = /*#__PURE__*/_interopDefaultLegacy(format);
|
|
11
12
|
var useTranslation__default = /*#__PURE__*/_interopDefaultLegacy(useTranslation);
|
|
@@ -13,6 +14,9 @@
|
|
|
13
14
|
var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
|
|
14
15
|
var NextImage__default = /*#__PURE__*/_interopDefaultLegacy(NextImage);
|
|
15
16
|
var NextLink__default = /*#__PURE__*/_interopDefaultLegacy(NextLink);
|
|
17
|
+
var CssBaseline__default = /*#__PURE__*/_interopDefaultLegacy(CssBaseline);
|
|
18
|
+
var NextDocument__default = /*#__PURE__*/_interopDefaultLegacy(NextDocument);
|
|
19
|
+
var createEmotionServer__default = /*#__PURE__*/_interopDefaultLegacy(createEmotionServer);
|
|
16
20
|
|
|
17
21
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
18
22
|
|
|
@@ -202,22 +206,22 @@
|
|
|
202
206
|
var Deno = global$C.Deno;
|
|
203
207
|
var versions = process$4 && process$4.versions || Deno && Deno.version;
|
|
204
208
|
var v8 = versions && versions.v8;
|
|
205
|
-
var match, version;
|
|
209
|
+
var match$1, version;
|
|
206
210
|
|
|
207
211
|
if (v8) {
|
|
208
|
-
match = v8.split('.');
|
|
212
|
+
match$1 = v8.split('.');
|
|
209
213
|
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
210
214
|
// but their correct versions are not interesting for us
|
|
211
|
-
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
215
|
+
version = match$1[0] > 0 && match$1[0] < 4 ? 1 : +(match$1[0] + match$1[1]);
|
|
212
216
|
}
|
|
213
217
|
|
|
214
218
|
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
215
219
|
// so check `userAgent` even if `.v8` exists, but 0
|
|
216
220
|
if (!version && userAgent$3) {
|
|
217
|
-
match = userAgent$3.match(/Edge\/(\d+)/);
|
|
218
|
-
if (!match || match[1] >= 74) {
|
|
219
|
-
match = userAgent$3.match(/Chrome\/(\d+)/);
|
|
220
|
-
if (match) version = +match[1];
|
|
221
|
+
match$1 = userAgent$3.match(/Edge\/(\d+)/);
|
|
222
|
+
if (!match$1 || match$1[1] >= 74) {
|
|
223
|
+
match$1 = userAgent$3.match(/Chrome\/(\d+)/);
|
|
224
|
+
if (match$1) version = +match$1[1];
|
|
221
225
|
}
|
|
222
226
|
}
|
|
223
227
|
|
|
@@ -775,9 +779,9 @@
|
|
|
775
779
|
var isCallable$d = isCallable$k;
|
|
776
780
|
var inspectSource$3 = inspectSource$4;
|
|
777
781
|
|
|
778
|
-
var WeakMap$
|
|
782
|
+
var WeakMap$2 = global$s.WeakMap;
|
|
779
783
|
|
|
780
|
-
var nativeWeakMap = isCallable$d(WeakMap$
|
|
784
|
+
var nativeWeakMap = isCallable$d(WeakMap$2) && /native code/.test(inspectSource$3(WeakMap$2));
|
|
781
785
|
|
|
782
786
|
var createPropertyDescriptor$4 = function (bitmap, value) {
|
|
783
787
|
return {
|
|
@@ -811,7 +815,7 @@
|
|
|
811
815
|
|
|
812
816
|
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
813
817
|
var TypeError$a = global$r.TypeError;
|
|
814
|
-
var WeakMap = global$r.WeakMap;
|
|
818
|
+
var WeakMap$1 = global$r.WeakMap;
|
|
815
819
|
var set$1, get, has;
|
|
816
820
|
|
|
817
821
|
var enforce = function (it) {
|
|
@@ -828,7 +832,7 @@
|
|
|
828
832
|
};
|
|
829
833
|
|
|
830
834
|
if (NATIVE_WEAK_MAP || shared$1.state) {
|
|
831
|
-
var store = shared$1.state || (shared$1.state = new WeakMap());
|
|
835
|
+
var store = shared$1.state || (shared$1.state = new WeakMap$1());
|
|
832
836
|
var wmget = uncurryThis$e(store.get);
|
|
833
837
|
var wmhas = uncurryThis$e(store.has);
|
|
834
838
|
var wmset = uncurryThis$e(store.set);
|
|
@@ -1550,13 +1554,13 @@
|
|
|
1550
1554
|
} : $assign;
|
|
1551
1555
|
|
|
1552
1556
|
var $$4 = _export;
|
|
1553
|
-
var assign = objectAssign;
|
|
1557
|
+
var assign$1 = objectAssign;
|
|
1554
1558
|
|
|
1555
1559
|
// `Object.assign` method
|
|
1556
1560
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
1557
1561
|
// eslint-disable-next-line es/no-object-assign -- required for testing
|
|
1558
|
-
$$4({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
|
|
1559
|
-
assign: assign
|
|
1562
|
+
$$4({ target: 'Object', stat: true, forced: Object.assign !== assign$1 }, {
|
|
1563
|
+
assign: assign$1
|
|
1560
1564
|
});
|
|
1561
1565
|
|
|
1562
1566
|
const AnalyticsGoogle = ({
|
|
@@ -1568,10 +1572,10 @@
|
|
|
1568
1572
|
asPath,
|
|
1569
1573
|
query
|
|
1570
1574
|
} = router.useRouter();
|
|
1571
|
-
const [ready, setReady] =
|
|
1572
|
-
const [routed, setRouted] =
|
|
1575
|
+
const [ready, setReady] = React.useState(false);
|
|
1576
|
+
const [routed, setRouted] = React.useState(false); // const [url, setUrl] = useState("");
|
|
1573
1577
|
|
|
1574
|
-
|
|
1578
|
+
React.useEffect(() => {
|
|
1575
1579
|
const handleRouteChange = () => {
|
|
1576
1580
|
setRouted(true);
|
|
1577
1581
|
};
|
|
@@ -1581,7 +1585,7 @@
|
|
|
1581
1585
|
events.off("routeChangeComplete", handleRouteChange);
|
|
1582
1586
|
};
|
|
1583
1587
|
}, [events]);
|
|
1584
|
-
|
|
1588
|
+
React.useEffect(() => {
|
|
1585
1589
|
if (routed && ready && asPath) {
|
|
1586
1590
|
// const search = query;
|
|
1587
1591
|
utils.pageview(asPath);
|
|
@@ -1830,7 +1834,7 @@
|
|
|
1830
1834
|
var patchedExec = nativeExec;
|
|
1831
1835
|
var charAt$3 = uncurryThis$a(''.charAt);
|
|
1832
1836
|
var indexOf = uncurryThis$a(''.indexOf);
|
|
1833
|
-
var replace$
|
|
1837
|
+
var replace$3 = uncurryThis$a(''.replace);
|
|
1834
1838
|
var stringSlice$5 = uncurryThis$a(''.slice);
|
|
1835
1839
|
|
|
1836
1840
|
var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
@@ -1871,7 +1875,7 @@
|
|
|
1871
1875
|
var strCopy = str;
|
|
1872
1876
|
|
|
1873
1877
|
if (sticky) {
|
|
1874
|
-
flags = replace$
|
|
1878
|
+
flags = replace$3(flags, 'y', '');
|
|
1875
1879
|
if (indexOf(flags, 'g') === -1) {
|
|
1876
1880
|
flags += 'g';
|
|
1877
1881
|
}
|
|
@@ -2463,7 +2467,7 @@
|
|
|
2463
2467
|
// ) as R;
|
|
2464
2468
|
// return typedT;
|
|
2465
2469
|
|
|
2466
|
-
const tMemoized =
|
|
2470
|
+
const tMemoized = React.useMemo(() => (s, q, o) => t(namespace ? `${namespace}:${s}` : s, q === "obj" ? null : q, q === "obj" || o === "obj" ? {
|
|
2467
2471
|
returnObjects: true
|
|
2468
2472
|
} : o // ) as R extends (undefined | never | unknown) ? TranslateReturn<TranslationQuery, TranslationOptions> : R;
|
|
2469
2473
|
), [t, namespace]); // return tMemoized as Translate<N>;
|
|
@@ -2479,7 +2483,7 @@
|
|
|
2479
2483
|
t
|
|
2480
2484
|
} = useTranslation__default["default"](namespace); // return t;
|
|
2481
2485
|
|
|
2482
|
-
const tMemoized =
|
|
2486
|
+
const tMemoized = React.useMemo(() => t, [t]);
|
|
2483
2487
|
return tMemoized;
|
|
2484
2488
|
}
|
|
2485
2489
|
function translationAsOptions(t, i18nKey) {
|
|
@@ -2497,10 +2501,10 @@
|
|
|
2497
2501
|
*/
|
|
2498
2502
|
|
|
2499
2503
|
const useDateFormat = () => {
|
|
2500
|
-
const [formatter, setFormatter] =
|
|
2504
|
+
const [formatter, setFormatter] = React.useState(() => (...args) => format__default["default"](...args));
|
|
2501
2505
|
const router$1 = router.useRouter();
|
|
2502
|
-
const locale = react
|
|
2503
|
-
|
|
2506
|
+
const locale = react.useDateLocale(router$1.locale);
|
|
2507
|
+
React.useEffect(() => {
|
|
2504
2508
|
if (locale) {
|
|
2505
2509
|
const newFormatter = (date, _format, options) => format__default["default"](date, _format, Object.assign(Object.assign({}, options || {}), {
|
|
2506
2510
|
locale
|
|
@@ -2517,12 +2521,12 @@
|
|
|
2517
2521
|
const {
|
|
2518
2522
|
push
|
|
2519
2523
|
} = router.useRouter();
|
|
2520
|
-
const [loading, setLoading] =
|
|
2521
|
-
const [ok, setOk] =
|
|
2522
|
-
const [fail, setFail] =
|
|
2523
|
-
const submit =
|
|
2524
|
+
const [loading, setLoading] = React.useState(false);
|
|
2525
|
+
const [ok, setOk] = React.useState(false);
|
|
2526
|
+
const [fail, setFail] = React.useState(false);
|
|
2527
|
+
const submit = React.useCallback(data => {
|
|
2524
2528
|
setLoading(true);
|
|
2525
|
-
react$
|
|
2529
|
+
react$1.signIn("credentials", Object.assign(Object.assign({}, data), {
|
|
2526
2530
|
redirect: false
|
|
2527
2531
|
})) // @ts-expect-error FIXME: at some point...
|
|
2528
2532
|
.then(({
|
|
@@ -2564,9 +2568,9 @@
|
|
|
2564
2568
|
}
|
|
2565
2569
|
|
|
2566
2570
|
function useLoginUrl() {
|
|
2567
|
-
const [currentUrl, setCurrentUrl] =
|
|
2571
|
+
const [currentUrl, setCurrentUrl] = React.useState("");
|
|
2568
2572
|
const t = useT();
|
|
2569
|
-
|
|
2573
|
+
React.useEffect(() => {
|
|
2570
2574
|
setCurrentUrl(`?callbackUrl=${window.location.href}`);
|
|
2571
2575
|
}, []);
|
|
2572
2576
|
return `${getAuthRoutes(t).login}${currentUrl}`;
|
|
@@ -2624,14 +2628,14 @@
|
|
|
2624
2628
|
const {
|
|
2625
2629
|
push
|
|
2626
2630
|
} = router.useRouter();
|
|
2627
|
-
const [loading, setLoading] =
|
|
2628
|
-
const [ok, setOk] =
|
|
2629
|
-
const [fail] =
|
|
2630
|
-
const submit =
|
|
2631
|
+
const [loading, setLoading] = React.useState(false);
|
|
2632
|
+
const [ok, setOk] = React.useState(false);
|
|
2633
|
+
const [fail] = React.useState(false);
|
|
2634
|
+
const submit = React.useCallback(event => {
|
|
2631
2635
|
event.preventDefault();
|
|
2632
2636
|
event.stopPropagation();
|
|
2633
2637
|
setLoading(true);
|
|
2634
|
-
react$
|
|
2638
|
+
react$1.signOut({
|
|
2635
2639
|
redirect: false
|
|
2636
2640
|
}).then(() => {
|
|
2637
2641
|
setLoading(false);
|
|
@@ -2674,7 +2678,7 @@
|
|
|
2674
2678
|
}
|
|
2675
2679
|
|
|
2676
2680
|
const Favicon = props => jsxRuntime.jsx(Head__default["default"], {
|
|
2677
|
-
children: jsxRuntime.jsx(react
|
|
2681
|
+
children: jsxRuntime.jsx(react.FaviconTags, Object.assign({}, props))
|
|
2678
2682
|
});
|
|
2679
2683
|
|
|
2680
2684
|
function useForm( // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -2701,7 +2705,7 @@
|
|
|
2701
2705
|
// }
|
|
2702
2706
|
|
|
2703
2707
|
|
|
2704
|
-
return
|
|
2708
|
+
return React.useMemo(() => {
|
|
2705
2709
|
const {
|
|
2706
2710
|
control,
|
|
2707
2711
|
register,
|
|
@@ -2761,7 +2765,7 @@
|
|
|
2761
2765
|
|
|
2762
2766
|
var floor = Math.floor;
|
|
2763
2767
|
var charAt = uncurryThis$5(''.charAt);
|
|
2764
|
-
var replace$
|
|
2768
|
+
var replace$2 = uncurryThis$5(''.replace);
|
|
2765
2769
|
var stringSlice$2 = uncurryThis$5(''.slice);
|
|
2766
2770
|
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
|
|
2767
2771
|
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
|
|
@@ -2776,7 +2780,7 @@
|
|
|
2776
2780
|
namedCaptures = toObject(namedCaptures);
|
|
2777
2781
|
symbols = SUBSTITUTION_SYMBOLS;
|
|
2778
2782
|
}
|
|
2779
|
-
return replace$
|
|
2783
|
+
return replace$2(replacement, symbols, function (match, ch) {
|
|
2780
2784
|
var capture;
|
|
2781
2785
|
switch (charAt(ch, 0)) {
|
|
2782
2786
|
case '$': return '$';
|
|
@@ -3320,7 +3324,7 @@
|
|
|
3320
3324
|
var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global$4, 'queueMicrotask');
|
|
3321
3325
|
var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
|
|
3322
3326
|
|
|
3323
|
-
var flush, head, last, notify$1, toggle, node, promise, then;
|
|
3327
|
+
var flush, head, last$1, notify$1, toggle, node$1, promise, then;
|
|
3324
3328
|
|
|
3325
3329
|
// modern engines have queueMicrotask method
|
|
3326
3330
|
if (!queueMicrotask) {
|
|
@@ -3334,10 +3338,10 @@
|
|
|
3334
3338
|
fn();
|
|
3335
3339
|
} catch (error) {
|
|
3336
3340
|
if (head) notify$1();
|
|
3337
|
-
else last = undefined;
|
|
3341
|
+
else last$1 = undefined;
|
|
3338
3342
|
throw error;
|
|
3339
3343
|
}
|
|
3340
|
-
} last = undefined;
|
|
3344
|
+
} last$1 = undefined;
|
|
3341
3345
|
if (parent) parent.enter();
|
|
3342
3346
|
};
|
|
3343
3347
|
|
|
@@ -3345,10 +3349,10 @@
|
|
|
3345
3349
|
// also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
|
|
3346
3350
|
if (!IS_IOS && !IS_NODE$1 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) {
|
|
3347
3351
|
toggle = true;
|
|
3348
|
-
node = document$2.createTextNode('');
|
|
3349
|
-
new MutationObserver(flush).observe(node, { characterData: true });
|
|
3352
|
+
node$1 = document$2.createTextNode('');
|
|
3353
|
+
new MutationObserver(flush).observe(node$1, { characterData: true });
|
|
3350
3354
|
notify$1 = function () {
|
|
3351
|
-
node.data = toggle = !toggle;
|
|
3355
|
+
node$1.data = toggle = !toggle;
|
|
3352
3356
|
};
|
|
3353
3357
|
// environments with maybe non-completely correct, but existent Promise
|
|
3354
3358
|
} else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
|
|
@@ -3382,11 +3386,11 @@
|
|
|
3382
3386
|
|
|
3383
3387
|
var microtask$1 = queueMicrotask || function (fn) {
|
|
3384
3388
|
var task = { fn: fn, next: undefined };
|
|
3385
|
-
if (last) last.next = task;
|
|
3389
|
+
if (last$1) last$1.next = task;
|
|
3386
3390
|
if (!head) {
|
|
3387
3391
|
head = task;
|
|
3388
3392
|
notify$1();
|
|
3389
|
-
} last = task;
|
|
3393
|
+
} last$1 = task;
|
|
3390
3394
|
};
|
|
3391
3395
|
|
|
3392
3396
|
var newPromiseCapability$2 = {};
|
|
@@ -3940,8 +3944,8 @@
|
|
|
3940
3944
|
|
|
3941
3945
|
const NextImg = NextImage__default["default"];
|
|
3942
3946
|
const NextImgSmart = props => {
|
|
3943
|
-
const [$loaded, setLoaded] =
|
|
3944
|
-
const [$error, setError] =
|
|
3947
|
+
const [$loaded, setLoaded] = React.useState(false);
|
|
3948
|
+
const [$error, setError] = React.useState(false);
|
|
3945
3949
|
const {
|
|
3946
3950
|
nextImgProps,
|
|
3947
3951
|
restProps
|
|
@@ -3994,7 +3998,7 @@
|
|
|
3994
3998
|
* @see https://next.js.org/docs/api-reference/next/link
|
|
3995
3999
|
*/
|
|
3996
4000
|
|
|
3997
|
-
const Link = /*#__PURE__*/
|
|
4001
|
+
const Link = /*#__PURE__*/React.forwardRef(function Link(_a, ref) {
|
|
3998
4002
|
var {
|
|
3999
4003
|
href,
|
|
4000
4004
|
prefetch,
|
|
@@ -4013,7 +4017,7 @@
|
|
|
4013
4017
|
locale: locale,
|
|
4014
4018
|
passHref: true
|
|
4015
4019
|
}, {
|
|
4016
|
-
children: jsxRuntime.jsx(react
|
|
4020
|
+
children: jsxRuntime.jsx(react.KoineLink, Object.assign({
|
|
4017
4021
|
ref: ref
|
|
4018
4022
|
}, props))
|
|
4019
4023
|
}));
|
|
@@ -4028,9 +4032,9 @@
|
|
|
4028
4032
|
events
|
|
4029
4033
|
} = router.useRouter(); // const [progress, setProgress] = useState(0);
|
|
4030
4034
|
|
|
4031
|
-
const [running, setRunning] =
|
|
4032
|
-
const timer =
|
|
4033
|
-
const routeChangeStart =
|
|
4035
|
+
const [running, setRunning] = React.useState(false);
|
|
4036
|
+
const timer = React.useRef(null);
|
|
4037
|
+
const routeChangeStart = React.useCallback((_, {
|
|
4034
4038
|
shallow
|
|
4035
4039
|
}) => {
|
|
4036
4040
|
if (!shallow || _showOnShallow) {
|
|
@@ -4038,7 +4042,7 @@
|
|
|
4038
4042
|
setRunning(true);
|
|
4039
4043
|
}
|
|
4040
4044
|
}, [_showOnShallow]);
|
|
4041
|
-
const routeChangeEnd =
|
|
4045
|
+
const routeChangeEnd = React.useCallback((_, {
|
|
4042
4046
|
shallow
|
|
4043
4047
|
}) => {
|
|
4044
4048
|
if (!shallow || _showOnShallow) {
|
|
@@ -4052,7 +4056,7 @@
|
|
|
4052
4056
|
}, _stopDelayMs);
|
|
4053
4057
|
}
|
|
4054
4058
|
}, [_showOnShallow, _stopDelayMs, timer]);
|
|
4055
|
-
|
|
4059
|
+
React.useEffect(() => {
|
|
4056
4060
|
events.on("routeChangeStart", routeChangeStart);
|
|
4057
4061
|
events.on("routeChangeComplete", routeChangeEnd);
|
|
4058
4062
|
events.on("routeChangeError", routeChangeEnd);
|
|
@@ -4062,7 +4066,7 @@
|
|
|
4062
4066
|
events.off("routeChangeError", routeChangeEnd);
|
|
4063
4067
|
};
|
|
4064
4068
|
}, [events, routeChangeStart, routeChangeEnd]);
|
|
4065
|
-
return jsxRuntime.jsx(react
|
|
4069
|
+
return jsxRuntime.jsx(react.ProgressOverlay, {
|
|
4066
4070
|
running: running
|
|
4067
4071
|
});
|
|
4068
4072
|
};
|
|
@@ -4105,7 +4109,7 @@
|
|
|
4105
4109
|
var symbolToString = uncurryThis$1(SymbolPrototype.toString);
|
|
4106
4110
|
var symbolValueOf = uncurryThis$1(SymbolPrototype.valueOf);
|
|
4107
4111
|
var regexp = /^Symbol\((.*)\)[^)]+$/;
|
|
4108
|
-
var replace = uncurryThis$1(''.replace);
|
|
4112
|
+
var replace$1 = uncurryThis$1(''.replace);
|
|
4109
4113
|
var stringSlice = uncurryThis$1(''.slice);
|
|
4110
4114
|
|
|
4111
4115
|
defineProperty(SymbolPrototype, 'description', {
|
|
@@ -4114,7 +4118,7 @@
|
|
|
4114
4118
|
var symbol = symbolValueOf(this);
|
|
4115
4119
|
var string = symbolToString(symbol);
|
|
4116
4120
|
if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
|
|
4117
|
-
var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
|
|
4121
|
+
var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace$1(string, regexp, '$1');
|
|
4118
4122
|
return desc === '' ? undefined : desc;
|
|
4119
4123
|
}
|
|
4120
4124
|
});
|
|
@@ -4282,7 +4286,7 @@
|
|
|
4282
4286
|
});
|
|
4283
4287
|
};
|
|
4284
4288
|
|
|
4285
|
-
const Seo = /*#__PURE__*/
|
|
4289
|
+
const Seo = /*#__PURE__*/React.memo(_Seo);
|
|
4286
4290
|
|
|
4287
4291
|
const _SeoDefaults = props => {
|
|
4288
4292
|
// const router = useRouter();
|
|
@@ -4292,7 +4296,7 @@
|
|
|
4292
4296
|
});
|
|
4293
4297
|
};
|
|
4294
4298
|
|
|
4295
|
-
const SeoDefaults = /*#__PURE__*/
|
|
4299
|
+
const SeoDefaults = /*#__PURE__*/React.memo(_SeoDefaults);
|
|
4296
4300
|
|
|
4297
4301
|
var uncurryThis = functionUncurryThis;
|
|
4298
4302
|
var PROPER_FUNCTION_NAME = functionName.PROPER;
|
|
@@ -4327,12 +4331,12 @@
|
|
|
4327
4331
|
const THEME_STORAGE_KEY = "theme";
|
|
4328
4332
|
const colorSchemes = ["light", "dark"];
|
|
4329
4333
|
const MEDIA = "(prefers-color-scheme: dark)";
|
|
4330
|
-
const ThemeContext = /*#__PURE__*/
|
|
4334
|
+
const ThemeContext = /*#__PURE__*/React.createContext({
|
|
4331
4335
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
4332
4336
|
setTheme: _ => {},
|
|
4333
4337
|
themes: []
|
|
4334
4338
|
});
|
|
4335
|
-
const useTheme = () =>
|
|
4339
|
+
const useTheme = () => React.useContext(ThemeContext);
|
|
4336
4340
|
const ThemeProvider = ({
|
|
4337
4341
|
forcedTheme,
|
|
4338
4342
|
disableTransitionOnChange: _disableTransitionOnChange = false,
|
|
@@ -4345,10 +4349,10 @@
|
|
|
4345
4349
|
children,
|
|
4346
4350
|
nonce
|
|
4347
4351
|
}) => {
|
|
4348
|
-
const [theme, setThemeState] =
|
|
4349
|
-
const [resolvedTheme, setResolvedTheme] =
|
|
4352
|
+
const [theme, setThemeState] = React.useState(() => getTheme(THEME_STORAGE_KEY, _defaultTheme));
|
|
4353
|
+
const [resolvedTheme, setResolvedTheme] = React.useState(() => getTheme(THEME_STORAGE_KEY));
|
|
4350
4354
|
const attrs = !value ? _themes : Object.values(value);
|
|
4351
|
-
const applyTheme =
|
|
4355
|
+
const applyTheme = React.useCallback(theme => {
|
|
4352
4356
|
let resolved = theme;
|
|
4353
4357
|
if (utils.isServer) return; // If theme is system, resolve it before setting theme
|
|
4354
4358
|
|
|
@@ -4379,7 +4383,7 @@
|
|
|
4379
4383
|
|
|
4380
4384
|
enable === null || enable === void 0 ? void 0 : enable();
|
|
4381
4385
|
}, [_attribute, attrs, _defaultTheme, _disableTransitionOnChange, _enableColorScheme, _enableSystem, value]);
|
|
4382
|
-
const setTheme =
|
|
4386
|
+
const setTheme = React.useCallback(theme => {
|
|
4383
4387
|
setThemeState(theme); // Save to storage
|
|
4384
4388
|
|
|
4385
4389
|
try {
|
|
@@ -4387,7 +4391,7 @@
|
|
|
4387
4391
|
} catch (e) {// Unsupported
|
|
4388
4392
|
}
|
|
4389
4393
|
}, []);
|
|
4390
|
-
const handleMediaQuery =
|
|
4394
|
+
const handleMediaQuery = React.useCallback(e => {
|
|
4391
4395
|
const resolved = getSystemTheme(e);
|
|
4392
4396
|
setResolvedTheme(resolved);
|
|
4393
4397
|
|
|
@@ -4396,7 +4400,7 @@
|
|
|
4396
4400
|
}
|
|
4397
4401
|
}, [theme, _enableSystem, forcedTheme, applyTheme]); // Always listen to System preference
|
|
4398
4402
|
|
|
4399
|
-
|
|
4403
|
+
React.useEffect(() => {
|
|
4400
4404
|
const media = window.matchMedia(MEDIA); // Intentionally use deprecated listener methods to support iOS & old browsers
|
|
4401
4405
|
|
|
4402
4406
|
media.addListener(handleMediaQuery);
|
|
@@ -4404,7 +4408,7 @@
|
|
|
4404
4408
|
return () => media.removeListener(handleMediaQuery);
|
|
4405
4409
|
}, [handleMediaQuery]); // localStorage event handling
|
|
4406
4410
|
|
|
4407
|
-
|
|
4411
|
+
React.useEffect(() => {
|
|
4408
4412
|
const handleStorage = e => {
|
|
4409
4413
|
if (e.key !== THEME_STORAGE_KEY) {
|
|
4410
4414
|
return;
|
|
@@ -4419,7 +4423,7 @@
|
|
|
4419
4423
|
return () => window.removeEventListener("storage", handleStorage);
|
|
4420
4424
|
}, [_defaultTheme, setTheme]); // Whenever theme or forcedTheme changes, apply it
|
|
4421
4425
|
|
|
4422
|
-
|
|
4426
|
+
React.useEffect(() => {
|
|
4423
4427
|
applyTheme(forcedTheme !== null && forcedTheme !== void 0 ? forcedTheme : theme);
|
|
4424
4428
|
}, [applyTheme, forcedTheme, theme]);
|
|
4425
4429
|
return jsxRuntime.jsxs(ThemeContext.Provider, Object.assign({
|
|
@@ -4447,7 +4451,7 @@
|
|
|
4447
4451
|
})), children]
|
|
4448
4452
|
}));
|
|
4449
4453
|
};
|
|
4450
|
-
const ThemeScript = /*#__PURE__*/
|
|
4454
|
+
const ThemeScript = /*#__PURE__*/React.memo(({
|
|
4451
4455
|
forcedTheme,
|
|
4452
4456
|
attribute,
|
|
4453
4457
|
enableSystem,
|
|
@@ -4568,6 +4572,1332 @@
|
|
|
4568
4572
|
return utils.isServer ? Buffer.from(str).toString("base64") : btoa(str);
|
|
4569
4573
|
};
|
|
4570
4574
|
|
|
4575
|
+
/*
|
|
4576
|
+
|
|
4577
|
+
Based off glamor's StyleSheet, thanks Sunil ❤️
|
|
4578
|
+
|
|
4579
|
+
high performance StyleSheet for css-in-js systems
|
|
4580
|
+
|
|
4581
|
+
- uses multiple style tags behind the scenes for millions of rules
|
|
4582
|
+
- uses `insertRule` for appending in production for *much* faster performance
|
|
4583
|
+
|
|
4584
|
+
// usage
|
|
4585
|
+
|
|
4586
|
+
import { StyleSheet } from '@emotion/sheet'
|
|
4587
|
+
|
|
4588
|
+
let styleSheet = new StyleSheet({ key: '', container: document.head })
|
|
4589
|
+
|
|
4590
|
+
styleSheet.insert('#box { border: 1px solid red; }')
|
|
4591
|
+
- appends a css rule into the stylesheet
|
|
4592
|
+
|
|
4593
|
+
styleSheet.flush()
|
|
4594
|
+
- empties the stylesheet of all its contents
|
|
4595
|
+
|
|
4596
|
+
*/
|
|
4597
|
+
// $FlowFixMe
|
|
4598
|
+
function sheetForTag(tag) {
|
|
4599
|
+
if (tag.sheet) {
|
|
4600
|
+
// $FlowFixMe
|
|
4601
|
+
return tag.sheet;
|
|
4602
|
+
} // this weirdness brought to you by firefox
|
|
4603
|
+
|
|
4604
|
+
/* istanbul ignore next */
|
|
4605
|
+
|
|
4606
|
+
|
|
4607
|
+
for (var i = 0; i < document.styleSheets.length; i++) {
|
|
4608
|
+
if (document.styleSheets[i].ownerNode === tag) {
|
|
4609
|
+
// $FlowFixMe
|
|
4610
|
+
return document.styleSheets[i];
|
|
4611
|
+
}
|
|
4612
|
+
}
|
|
4613
|
+
}
|
|
4614
|
+
|
|
4615
|
+
function createStyleElement(options) {
|
|
4616
|
+
var tag = document.createElement('style');
|
|
4617
|
+
tag.setAttribute('data-emotion', options.key);
|
|
4618
|
+
|
|
4619
|
+
if (options.nonce !== undefined) {
|
|
4620
|
+
tag.setAttribute('nonce', options.nonce);
|
|
4621
|
+
}
|
|
4622
|
+
|
|
4623
|
+
tag.appendChild(document.createTextNode(''));
|
|
4624
|
+
tag.setAttribute('data-s', '');
|
|
4625
|
+
return tag;
|
|
4626
|
+
}
|
|
4627
|
+
|
|
4628
|
+
var StyleSheet = /*#__PURE__*/function () {
|
|
4629
|
+
function StyleSheet(options) {
|
|
4630
|
+
var _this = this;
|
|
4631
|
+
|
|
4632
|
+
this._insertTag = function (tag) {
|
|
4633
|
+
var before;
|
|
4634
|
+
|
|
4635
|
+
if (_this.tags.length === 0) {
|
|
4636
|
+
if (_this.insertionPoint) {
|
|
4637
|
+
before = _this.insertionPoint.nextSibling;
|
|
4638
|
+
} else if (_this.prepend) {
|
|
4639
|
+
before = _this.container.firstChild;
|
|
4640
|
+
} else {
|
|
4641
|
+
before = _this.before;
|
|
4642
|
+
}
|
|
4643
|
+
} else {
|
|
4644
|
+
before = _this.tags[_this.tags.length - 1].nextSibling;
|
|
4645
|
+
}
|
|
4646
|
+
|
|
4647
|
+
_this.container.insertBefore(tag, before);
|
|
4648
|
+
|
|
4649
|
+
_this.tags.push(tag);
|
|
4650
|
+
};
|
|
4651
|
+
|
|
4652
|
+
this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy;
|
|
4653
|
+
this.tags = [];
|
|
4654
|
+
this.ctr = 0;
|
|
4655
|
+
this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
|
|
4656
|
+
|
|
4657
|
+
this.key = options.key;
|
|
4658
|
+
this.container = options.container;
|
|
4659
|
+
this.prepend = options.prepend;
|
|
4660
|
+
this.insertionPoint = options.insertionPoint;
|
|
4661
|
+
this.before = null;
|
|
4662
|
+
}
|
|
4663
|
+
|
|
4664
|
+
var _proto = StyleSheet.prototype;
|
|
4665
|
+
|
|
4666
|
+
_proto.hydrate = function hydrate(nodes) {
|
|
4667
|
+
nodes.forEach(this._insertTag);
|
|
4668
|
+
};
|
|
4669
|
+
|
|
4670
|
+
_proto.insert = function insert(rule) {
|
|
4671
|
+
// the max length is how many rules we have per style tag, it's 65000 in speedy mode
|
|
4672
|
+
// it's 1 in dev because we insert source maps that map a single rule to a location
|
|
4673
|
+
// and you can only have one source map per style tag
|
|
4674
|
+
if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
|
|
4675
|
+
this._insertTag(createStyleElement(this));
|
|
4676
|
+
}
|
|
4677
|
+
|
|
4678
|
+
var tag = this.tags[this.tags.length - 1];
|
|
4679
|
+
|
|
4680
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4681
|
+
var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;
|
|
4682
|
+
|
|
4683
|
+
if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) {
|
|
4684
|
+
// this would only cause problem in speedy mode
|
|
4685
|
+
// but we don't want enabling speedy to affect the observable behavior
|
|
4686
|
+
// so we report this error at all times
|
|
4687
|
+
console.error("You're attempting to insert the following rule:\n" + rule + '\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.');
|
|
4688
|
+
}
|
|
4689
|
+
this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule;
|
|
4690
|
+
}
|
|
4691
|
+
|
|
4692
|
+
if (this.isSpeedy) {
|
|
4693
|
+
var sheet = sheetForTag(tag);
|
|
4694
|
+
|
|
4695
|
+
try {
|
|
4696
|
+
// this is the ultrafast version, works across browsers
|
|
4697
|
+
// the big drawback is that the css won't be editable in devtools
|
|
4698
|
+
sheet.insertRule(rule, sheet.cssRules.length);
|
|
4699
|
+
} catch (e) {
|
|
4700
|
+
if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear){/.test(rule)) {
|
|
4701
|
+
console.error("There was a problem inserting the following rule: \"" + rule + "\"", e);
|
|
4702
|
+
}
|
|
4703
|
+
}
|
|
4704
|
+
} else {
|
|
4705
|
+
tag.appendChild(document.createTextNode(rule));
|
|
4706
|
+
}
|
|
4707
|
+
|
|
4708
|
+
this.ctr++;
|
|
4709
|
+
};
|
|
4710
|
+
|
|
4711
|
+
_proto.flush = function flush() {
|
|
4712
|
+
// $FlowFixMe
|
|
4713
|
+
this.tags.forEach(function (tag) {
|
|
4714
|
+
return tag.parentNode && tag.parentNode.removeChild(tag);
|
|
4715
|
+
});
|
|
4716
|
+
this.tags = [];
|
|
4717
|
+
this.ctr = 0;
|
|
4718
|
+
|
|
4719
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4720
|
+
this._alreadyInsertedOrderInsensitiveRule = false;
|
|
4721
|
+
}
|
|
4722
|
+
};
|
|
4723
|
+
|
|
4724
|
+
return StyleSheet;
|
|
4725
|
+
}();
|
|
4726
|
+
|
|
4727
|
+
var MS = '-ms-';
|
|
4728
|
+
var MOZ = '-moz-';
|
|
4729
|
+
var WEBKIT = '-webkit-';
|
|
4730
|
+
|
|
4731
|
+
var COMMENT = 'comm';
|
|
4732
|
+
var RULESET = 'rule';
|
|
4733
|
+
var DECLARATION = 'decl';
|
|
4734
|
+
var IMPORT = '@import';
|
|
4735
|
+
var KEYFRAMES = '@keyframes';
|
|
4736
|
+
|
|
4737
|
+
/**
|
|
4738
|
+
* @param {number}
|
|
4739
|
+
* @return {number}
|
|
4740
|
+
*/
|
|
4741
|
+
var abs = Math.abs;
|
|
4742
|
+
|
|
4743
|
+
/**
|
|
4744
|
+
* @param {number}
|
|
4745
|
+
* @return {string}
|
|
4746
|
+
*/
|
|
4747
|
+
var from = String.fromCharCode;
|
|
4748
|
+
|
|
4749
|
+
/**
|
|
4750
|
+
* @param {object}
|
|
4751
|
+
* @return {object}
|
|
4752
|
+
*/
|
|
4753
|
+
var assign = Object.assign;
|
|
4754
|
+
|
|
4755
|
+
/**
|
|
4756
|
+
* @param {string} value
|
|
4757
|
+
* @param {number} length
|
|
4758
|
+
* @return {number}
|
|
4759
|
+
*/
|
|
4760
|
+
function hash (value, length) {
|
|
4761
|
+
return (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3)
|
|
4762
|
+
}
|
|
4763
|
+
|
|
4764
|
+
/**
|
|
4765
|
+
* @param {string} value
|
|
4766
|
+
* @return {string}
|
|
4767
|
+
*/
|
|
4768
|
+
function trim (value) {
|
|
4769
|
+
return value.trim()
|
|
4770
|
+
}
|
|
4771
|
+
|
|
4772
|
+
/**
|
|
4773
|
+
* @param {string} value
|
|
4774
|
+
* @param {RegExp} pattern
|
|
4775
|
+
* @return {string?}
|
|
4776
|
+
*/
|
|
4777
|
+
function match (value, pattern) {
|
|
4778
|
+
return (value = pattern.exec(value)) ? value[0] : value
|
|
4779
|
+
}
|
|
4780
|
+
|
|
4781
|
+
/**
|
|
4782
|
+
* @param {string} value
|
|
4783
|
+
* @param {(string|RegExp)} pattern
|
|
4784
|
+
* @param {string} replacement
|
|
4785
|
+
* @return {string}
|
|
4786
|
+
*/
|
|
4787
|
+
function replace (value, pattern, replacement) {
|
|
4788
|
+
return value.replace(pattern, replacement)
|
|
4789
|
+
}
|
|
4790
|
+
|
|
4791
|
+
/**
|
|
4792
|
+
* @param {string} value
|
|
4793
|
+
* @param {string} search
|
|
4794
|
+
* @return {number}
|
|
4795
|
+
*/
|
|
4796
|
+
function indexof (value, search) {
|
|
4797
|
+
return value.indexOf(search)
|
|
4798
|
+
}
|
|
4799
|
+
|
|
4800
|
+
/**
|
|
4801
|
+
* @param {string} value
|
|
4802
|
+
* @param {number} index
|
|
4803
|
+
* @return {number}
|
|
4804
|
+
*/
|
|
4805
|
+
function charat (value, index) {
|
|
4806
|
+
return value.charCodeAt(index) | 0
|
|
4807
|
+
}
|
|
4808
|
+
|
|
4809
|
+
/**
|
|
4810
|
+
* @param {string} value
|
|
4811
|
+
* @param {number} begin
|
|
4812
|
+
* @param {number} end
|
|
4813
|
+
* @return {string}
|
|
4814
|
+
*/
|
|
4815
|
+
function substr (value, begin, end) {
|
|
4816
|
+
return value.slice(begin, end)
|
|
4817
|
+
}
|
|
4818
|
+
|
|
4819
|
+
/**
|
|
4820
|
+
* @param {string} value
|
|
4821
|
+
* @return {number}
|
|
4822
|
+
*/
|
|
4823
|
+
function strlen (value) {
|
|
4824
|
+
return value.length
|
|
4825
|
+
}
|
|
4826
|
+
|
|
4827
|
+
/**
|
|
4828
|
+
* @param {any[]} value
|
|
4829
|
+
* @return {number}
|
|
4830
|
+
*/
|
|
4831
|
+
function sizeof (value) {
|
|
4832
|
+
return value.length
|
|
4833
|
+
}
|
|
4834
|
+
|
|
4835
|
+
/**
|
|
4836
|
+
* @param {any} value
|
|
4837
|
+
* @param {any[]} array
|
|
4838
|
+
* @return {any}
|
|
4839
|
+
*/
|
|
4840
|
+
function append (value, array) {
|
|
4841
|
+
return array.push(value), value
|
|
4842
|
+
}
|
|
4843
|
+
|
|
4844
|
+
/**
|
|
4845
|
+
* @param {string[]} array
|
|
4846
|
+
* @param {function} callback
|
|
4847
|
+
* @return {string}
|
|
4848
|
+
*/
|
|
4849
|
+
function combine (array, callback) {
|
|
4850
|
+
return array.map(callback).join('')
|
|
4851
|
+
}
|
|
4852
|
+
|
|
4853
|
+
var line = 1;
|
|
4854
|
+
var column = 1;
|
|
4855
|
+
var length = 0;
|
|
4856
|
+
var position = 0;
|
|
4857
|
+
var character = 0;
|
|
4858
|
+
var characters = '';
|
|
4859
|
+
|
|
4860
|
+
/**
|
|
4861
|
+
* @param {string} value
|
|
4862
|
+
* @param {object | null} root
|
|
4863
|
+
* @param {object | null} parent
|
|
4864
|
+
* @param {string} type
|
|
4865
|
+
* @param {string[] | string} props
|
|
4866
|
+
* @param {object[] | string} children
|
|
4867
|
+
* @param {number} length
|
|
4868
|
+
*/
|
|
4869
|
+
function node (value, root, parent, type, props, children, length) {
|
|
4870
|
+
return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}
|
|
4871
|
+
}
|
|
4872
|
+
|
|
4873
|
+
/**
|
|
4874
|
+
* @param {object} root
|
|
4875
|
+
* @param {object} props
|
|
4876
|
+
* @return {object}
|
|
4877
|
+
*/
|
|
4878
|
+
function copy (root, props) {
|
|
4879
|
+
return assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)
|
|
4880
|
+
}
|
|
4881
|
+
|
|
4882
|
+
/**
|
|
4883
|
+
* @return {number}
|
|
4884
|
+
*/
|
|
4885
|
+
function char () {
|
|
4886
|
+
return character
|
|
4887
|
+
}
|
|
4888
|
+
|
|
4889
|
+
/**
|
|
4890
|
+
* @return {number}
|
|
4891
|
+
*/
|
|
4892
|
+
function prev () {
|
|
4893
|
+
character = position > 0 ? charat(characters, --position) : 0;
|
|
4894
|
+
|
|
4895
|
+
if (column--, character === 10)
|
|
4896
|
+
column = 1, line--;
|
|
4897
|
+
|
|
4898
|
+
return character
|
|
4899
|
+
}
|
|
4900
|
+
|
|
4901
|
+
/**
|
|
4902
|
+
* @return {number}
|
|
4903
|
+
*/
|
|
4904
|
+
function next () {
|
|
4905
|
+
character = position < length ? charat(characters, position++) : 0;
|
|
4906
|
+
|
|
4907
|
+
if (column++, character === 10)
|
|
4908
|
+
column = 1, line++;
|
|
4909
|
+
|
|
4910
|
+
return character
|
|
4911
|
+
}
|
|
4912
|
+
|
|
4913
|
+
/**
|
|
4914
|
+
* @return {number}
|
|
4915
|
+
*/
|
|
4916
|
+
function peek () {
|
|
4917
|
+
return charat(characters, position)
|
|
4918
|
+
}
|
|
4919
|
+
|
|
4920
|
+
/**
|
|
4921
|
+
* @return {number}
|
|
4922
|
+
*/
|
|
4923
|
+
function caret () {
|
|
4924
|
+
return position
|
|
4925
|
+
}
|
|
4926
|
+
|
|
4927
|
+
/**
|
|
4928
|
+
* @param {number} begin
|
|
4929
|
+
* @param {number} end
|
|
4930
|
+
* @return {string}
|
|
4931
|
+
*/
|
|
4932
|
+
function slice (begin, end) {
|
|
4933
|
+
return substr(characters, begin, end)
|
|
4934
|
+
}
|
|
4935
|
+
|
|
4936
|
+
/**
|
|
4937
|
+
* @param {number} type
|
|
4938
|
+
* @return {number}
|
|
4939
|
+
*/
|
|
4940
|
+
function token (type) {
|
|
4941
|
+
switch (type) {
|
|
4942
|
+
// \0 \t \n \r \s whitespace token
|
|
4943
|
+
case 0: case 9: case 10: case 13: case 32:
|
|
4944
|
+
return 5
|
|
4945
|
+
// ! + , / > @ ~ isolate token
|
|
4946
|
+
case 33: case 43: case 44: case 47: case 62: case 64: case 126:
|
|
4947
|
+
// ; { } breakpoint token
|
|
4948
|
+
case 59: case 123: case 125:
|
|
4949
|
+
return 4
|
|
4950
|
+
// : accompanied token
|
|
4951
|
+
case 58:
|
|
4952
|
+
return 3
|
|
4953
|
+
// " ' ( [ opening delimit token
|
|
4954
|
+
case 34: case 39: case 40: case 91:
|
|
4955
|
+
return 2
|
|
4956
|
+
// ) ] closing delimit token
|
|
4957
|
+
case 41: case 93:
|
|
4958
|
+
return 1
|
|
4959
|
+
}
|
|
4960
|
+
|
|
4961
|
+
return 0
|
|
4962
|
+
}
|
|
4963
|
+
|
|
4964
|
+
/**
|
|
4965
|
+
* @param {string} value
|
|
4966
|
+
* @return {any[]}
|
|
4967
|
+
*/
|
|
4968
|
+
function alloc (value) {
|
|
4969
|
+
return line = column = 1, length = strlen(characters = value), position = 0, []
|
|
4970
|
+
}
|
|
4971
|
+
|
|
4972
|
+
/**
|
|
4973
|
+
* @param {any} value
|
|
4974
|
+
* @return {any}
|
|
4975
|
+
*/
|
|
4976
|
+
function dealloc (value) {
|
|
4977
|
+
return characters = '', value
|
|
4978
|
+
}
|
|
4979
|
+
|
|
4980
|
+
/**
|
|
4981
|
+
* @param {number} type
|
|
4982
|
+
* @return {string}
|
|
4983
|
+
*/
|
|
4984
|
+
function delimit (type) {
|
|
4985
|
+
return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
|
|
4986
|
+
}
|
|
4987
|
+
|
|
4988
|
+
/**
|
|
4989
|
+
* @param {number} type
|
|
4990
|
+
* @return {string}
|
|
4991
|
+
*/
|
|
4992
|
+
function whitespace (type) {
|
|
4993
|
+
while (character = peek())
|
|
4994
|
+
if (character < 33)
|
|
4995
|
+
next();
|
|
4996
|
+
else
|
|
4997
|
+
break
|
|
4998
|
+
|
|
4999
|
+
return token(type) > 2 || token(character) > 3 ? '' : ' '
|
|
5000
|
+
}
|
|
5001
|
+
|
|
5002
|
+
/**
|
|
5003
|
+
* @param {number} index
|
|
5004
|
+
* @param {number} count
|
|
5005
|
+
* @return {string}
|
|
5006
|
+
*/
|
|
5007
|
+
function escaping (index, count) {
|
|
5008
|
+
while (--count && next())
|
|
5009
|
+
// not 0-9 A-F a-f
|
|
5010
|
+
if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))
|
|
5011
|
+
break
|
|
5012
|
+
|
|
5013
|
+
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))
|
|
5014
|
+
}
|
|
5015
|
+
|
|
5016
|
+
/**
|
|
5017
|
+
* @param {number} type
|
|
5018
|
+
* @return {number}
|
|
5019
|
+
*/
|
|
5020
|
+
function delimiter (type) {
|
|
5021
|
+
while (next())
|
|
5022
|
+
switch (character) {
|
|
5023
|
+
// ] ) " '
|
|
5024
|
+
case type:
|
|
5025
|
+
return position
|
|
5026
|
+
// " '
|
|
5027
|
+
case 34: case 39:
|
|
5028
|
+
if (type !== 34 && type !== 39)
|
|
5029
|
+
delimiter(character);
|
|
5030
|
+
break
|
|
5031
|
+
// (
|
|
5032
|
+
case 40:
|
|
5033
|
+
if (type === 41)
|
|
5034
|
+
delimiter(type);
|
|
5035
|
+
break
|
|
5036
|
+
// \
|
|
5037
|
+
case 92:
|
|
5038
|
+
next();
|
|
5039
|
+
break
|
|
5040
|
+
}
|
|
5041
|
+
|
|
5042
|
+
return position
|
|
5043
|
+
}
|
|
5044
|
+
|
|
5045
|
+
/**
|
|
5046
|
+
* @param {number} type
|
|
5047
|
+
* @param {number} index
|
|
5048
|
+
* @return {number}
|
|
5049
|
+
*/
|
|
5050
|
+
function commenter (type, index) {
|
|
5051
|
+
while (next())
|
|
5052
|
+
// //
|
|
5053
|
+
if (type + character === 47 + 10)
|
|
5054
|
+
break
|
|
5055
|
+
// /*
|
|
5056
|
+
else if (type + character === 42 + 42 && peek() === 47)
|
|
5057
|
+
break
|
|
5058
|
+
|
|
5059
|
+
return '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())
|
|
5060
|
+
}
|
|
5061
|
+
|
|
5062
|
+
/**
|
|
5063
|
+
* @param {number} index
|
|
5064
|
+
* @return {string}
|
|
5065
|
+
*/
|
|
5066
|
+
function identifier (index) {
|
|
5067
|
+
while (!token(peek()))
|
|
5068
|
+
next();
|
|
5069
|
+
|
|
5070
|
+
return slice(index, position)
|
|
5071
|
+
}
|
|
5072
|
+
|
|
5073
|
+
/**
|
|
5074
|
+
* @param {string} value
|
|
5075
|
+
* @return {object[]}
|
|
5076
|
+
*/
|
|
5077
|
+
function compile (value) {
|
|
5078
|
+
return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))
|
|
5079
|
+
}
|
|
5080
|
+
|
|
5081
|
+
/**
|
|
5082
|
+
* @param {string} value
|
|
5083
|
+
* @param {object} root
|
|
5084
|
+
* @param {object?} parent
|
|
5085
|
+
* @param {string[]} rule
|
|
5086
|
+
* @param {string[]} rules
|
|
5087
|
+
* @param {string[]} rulesets
|
|
5088
|
+
* @param {number[]} pseudo
|
|
5089
|
+
* @param {number[]} points
|
|
5090
|
+
* @param {string[]} declarations
|
|
5091
|
+
* @return {object}
|
|
5092
|
+
*/
|
|
5093
|
+
function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
|
|
5094
|
+
var index = 0;
|
|
5095
|
+
var offset = 0;
|
|
5096
|
+
var length = pseudo;
|
|
5097
|
+
var atrule = 0;
|
|
5098
|
+
var property = 0;
|
|
5099
|
+
var previous = 0;
|
|
5100
|
+
var variable = 1;
|
|
5101
|
+
var scanning = 1;
|
|
5102
|
+
var ampersand = 1;
|
|
5103
|
+
var character = 0;
|
|
5104
|
+
var type = '';
|
|
5105
|
+
var props = rules;
|
|
5106
|
+
var children = rulesets;
|
|
5107
|
+
var reference = rule;
|
|
5108
|
+
var characters = type;
|
|
5109
|
+
|
|
5110
|
+
while (scanning)
|
|
5111
|
+
switch (previous = character, character = next()) {
|
|
5112
|
+
// (
|
|
5113
|
+
case 40:
|
|
5114
|
+
if (previous != 108 && characters.charCodeAt(length - 1) == 58) {
|
|
5115
|
+
if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1)
|
|
5116
|
+
ampersand = -1;
|
|
5117
|
+
break
|
|
5118
|
+
}
|
|
5119
|
+
// " ' [
|
|
5120
|
+
case 34: case 39: case 91:
|
|
5121
|
+
characters += delimit(character);
|
|
5122
|
+
break
|
|
5123
|
+
// \t \n \r \s
|
|
5124
|
+
case 9: case 10: case 13: case 32:
|
|
5125
|
+
characters += whitespace(previous);
|
|
5126
|
+
break
|
|
5127
|
+
// \
|
|
5128
|
+
case 92:
|
|
5129
|
+
characters += escaping(caret() - 1, 7);
|
|
5130
|
+
continue
|
|
5131
|
+
// /
|
|
5132
|
+
case 47:
|
|
5133
|
+
switch (peek()) {
|
|
5134
|
+
case 42: case 47:
|
|
5135
|
+
append(comment(commenter(next(), caret()), root, parent), declarations);
|
|
5136
|
+
break
|
|
5137
|
+
default:
|
|
5138
|
+
characters += '/';
|
|
5139
|
+
}
|
|
5140
|
+
break
|
|
5141
|
+
// {
|
|
5142
|
+
case 123 * variable:
|
|
5143
|
+
points[index++] = strlen(characters) * ampersand;
|
|
5144
|
+
// } ; \0
|
|
5145
|
+
case 125 * variable: case 59: case 0:
|
|
5146
|
+
switch (character) {
|
|
5147
|
+
// \0 }
|
|
5148
|
+
case 0: case 125: scanning = 0;
|
|
5149
|
+
// ;
|
|
5150
|
+
case 59 + offset:
|
|
5151
|
+
if (property > 0 && (strlen(characters) - length))
|
|
5152
|
+
append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations);
|
|
5153
|
+
break
|
|
5154
|
+
// @ ;
|
|
5155
|
+
case 59: characters += ';';
|
|
5156
|
+
// { rule/at-rule
|
|
5157
|
+
default:
|
|
5158
|
+
append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets);
|
|
5159
|
+
|
|
5160
|
+
if (character === 123)
|
|
5161
|
+
if (offset === 0)
|
|
5162
|
+
parse(characters, root, reference, reference, props, rulesets, length, points, children);
|
|
5163
|
+
else
|
|
5164
|
+
switch (atrule) {
|
|
5165
|
+
// d m s
|
|
5166
|
+
case 100: case 109: case 115:
|
|
5167
|
+
parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
|
|
5168
|
+
break
|
|
5169
|
+
default:
|
|
5170
|
+
parse(characters, reference, reference, reference, [''], children, 0, points, children);
|
|
5171
|
+
}
|
|
5172
|
+
}
|
|
5173
|
+
|
|
5174
|
+
index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo;
|
|
5175
|
+
break
|
|
5176
|
+
// :
|
|
5177
|
+
case 58:
|
|
5178
|
+
length = 1 + strlen(characters), property = previous;
|
|
5179
|
+
default:
|
|
5180
|
+
if (variable < 1)
|
|
5181
|
+
if (character == 123)
|
|
5182
|
+
--variable;
|
|
5183
|
+
else if (character == 125 && variable++ == 0 && prev() == 125)
|
|
5184
|
+
continue
|
|
5185
|
+
|
|
5186
|
+
switch (characters += from(character), character * variable) {
|
|
5187
|
+
// &
|
|
5188
|
+
case 38:
|
|
5189
|
+
ampersand = offset > 0 ? 1 : (characters += '\f', -1);
|
|
5190
|
+
break
|
|
5191
|
+
// ,
|
|
5192
|
+
case 44:
|
|
5193
|
+
points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1;
|
|
5194
|
+
break
|
|
5195
|
+
// @
|
|
5196
|
+
case 64:
|
|
5197
|
+
// -
|
|
5198
|
+
if (peek() === 45)
|
|
5199
|
+
characters += delimit(next());
|
|
5200
|
+
|
|
5201
|
+
atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++;
|
|
5202
|
+
break
|
|
5203
|
+
// -
|
|
5204
|
+
case 45:
|
|
5205
|
+
if (previous === 45 && strlen(characters) == 2)
|
|
5206
|
+
variable = 0;
|
|
5207
|
+
}
|
|
5208
|
+
}
|
|
5209
|
+
|
|
5210
|
+
return rulesets
|
|
5211
|
+
}
|
|
5212
|
+
|
|
5213
|
+
/**
|
|
5214
|
+
* @param {string} value
|
|
5215
|
+
* @param {object} root
|
|
5216
|
+
* @param {object?} parent
|
|
5217
|
+
* @param {number} index
|
|
5218
|
+
* @param {number} offset
|
|
5219
|
+
* @param {string[]} rules
|
|
5220
|
+
* @param {number[]} points
|
|
5221
|
+
* @param {string} type
|
|
5222
|
+
* @param {string[]} props
|
|
5223
|
+
* @param {string[]} children
|
|
5224
|
+
* @param {number} length
|
|
5225
|
+
* @return {object}
|
|
5226
|
+
*/
|
|
5227
|
+
function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {
|
|
5228
|
+
var post = offset - 1;
|
|
5229
|
+
var rule = offset === 0 ? rules : [''];
|
|
5230
|
+
var size = sizeof(rule);
|
|
5231
|
+
|
|
5232
|
+
for (var i = 0, j = 0, k = 0; i < index; ++i)
|
|
5233
|
+
for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
|
|
5234
|
+
if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x])))
|
|
5235
|
+
props[k++] = z;
|
|
5236
|
+
|
|
5237
|
+
return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length)
|
|
5238
|
+
}
|
|
5239
|
+
|
|
5240
|
+
/**
|
|
5241
|
+
* @param {number} value
|
|
5242
|
+
* @param {object} root
|
|
5243
|
+
* @param {object?} parent
|
|
5244
|
+
* @return {object}
|
|
5245
|
+
*/
|
|
5246
|
+
function comment (value, root, parent) {
|
|
5247
|
+
return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0)
|
|
5248
|
+
}
|
|
5249
|
+
|
|
5250
|
+
/**
|
|
5251
|
+
* @param {string} value
|
|
5252
|
+
* @param {object} root
|
|
5253
|
+
* @param {object?} parent
|
|
5254
|
+
* @param {number} length
|
|
5255
|
+
* @return {object}
|
|
5256
|
+
*/
|
|
5257
|
+
function declaration (value, root, parent, length) {
|
|
5258
|
+
return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length)
|
|
5259
|
+
}
|
|
5260
|
+
|
|
5261
|
+
/**
|
|
5262
|
+
* @param {string} value
|
|
5263
|
+
* @param {number} length
|
|
5264
|
+
* @return {string}
|
|
5265
|
+
*/
|
|
5266
|
+
function prefix (value, length) {
|
|
5267
|
+
switch (hash(value, length)) {
|
|
5268
|
+
// color-adjust
|
|
5269
|
+
case 5103:
|
|
5270
|
+
return WEBKIT + 'print-' + value + value
|
|
5271
|
+
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
|
5272
|
+
case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921:
|
|
5273
|
+
// text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
|
5274
|
+
case 5572: case 6356: case 5844: case 3191: case 6645: case 3005:
|
|
5275
|
+
// mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
|
5276
|
+
case 6391: case 5879: case 5623: case 6135: case 4599: case 4855:
|
|
5277
|
+
// background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
|
5278
|
+
case 4215: case 6389: case 5109: case 5365: case 5621: case 3829:
|
|
5279
|
+
return WEBKIT + value + value
|
|
5280
|
+
// appearance, user-select, transform, hyphens, text-size-adjust
|
|
5281
|
+
case 5349: case 4246: case 4810: case 6968: case 2756:
|
|
5282
|
+
return WEBKIT + value + MOZ + value + MS + value + value
|
|
5283
|
+
// flex, flex-direction
|
|
5284
|
+
case 6828: case 4268:
|
|
5285
|
+
return WEBKIT + value + MS + value + value
|
|
5286
|
+
// order
|
|
5287
|
+
case 6165:
|
|
5288
|
+
return WEBKIT + value + MS + 'flex-' + value + value
|
|
5289
|
+
// align-items
|
|
5290
|
+
case 5187:
|
|
5291
|
+
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value
|
|
5292
|
+
// align-self
|
|
5293
|
+
case 5443:
|
|
5294
|
+
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value
|
|
5295
|
+
// align-content
|
|
5296
|
+
case 4675:
|
|
5297
|
+
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value
|
|
5298
|
+
// flex-shrink
|
|
5299
|
+
case 5548:
|
|
5300
|
+
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value
|
|
5301
|
+
// flex-basis
|
|
5302
|
+
case 5292:
|
|
5303
|
+
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value
|
|
5304
|
+
// flex-grow
|
|
5305
|
+
case 6060:
|
|
5306
|
+
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value
|
|
5307
|
+
// transition
|
|
5308
|
+
case 4554:
|
|
5309
|
+
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value
|
|
5310
|
+
// cursor
|
|
5311
|
+
case 6187:
|
|
5312
|
+
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value
|
|
5313
|
+
// background, background-image
|
|
5314
|
+
case 5495: case 3959:
|
|
5315
|
+
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1')
|
|
5316
|
+
// justify-content
|
|
5317
|
+
case 4968:
|
|
5318
|
+
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value
|
|
5319
|
+
// (margin|padding)-inline-(start|end)
|
|
5320
|
+
case 4095: case 3583: case 4068: case 2532:
|
|
5321
|
+
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value
|
|
5322
|
+
// (min|max)?(width|height|inline-size|block-size)
|
|
5323
|
+
case 8116: case 7059: case 5753: case 5535:
|
|
5324
|
+
case 5445: case 5701: case 4933: case 4677:
|
|
5325
|
+
case 5533: case 5789: case 5021: case 4765:
|
|
5326
|
+
// stretch, max-content, min-content, fill-available
|
|
5327
|
+
if (strlen(value) - 1 - length > 6)
|
|
5328
|
+
switch (charat(value, length + 1)) {
|
|
5329
|
+
// (m)ax-content, (m)in-content
|
|
5330
|
+
case 109:
|
|
5331
|
+
// -
|
|
5332
|
+
if (charat(value, length + 4) !== 45)
|
|
5333
|
+
break
|
|
5334
|
+
// (f)ill-available, (f)it-content
|
|
5335
|
+
case 102:
|
|
5336
|
+
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value
|
|
5337
|
+
// (s)tretch
|
|
5338
|
+
case 115:
|
|
5339
|
+
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value
|
|
5340
|
+
}
|
|
5341
|
+
break
|
|
5342
|
+
// position: sticky
|
|
5343
|
+
case 4949:
|
|
5344
|
+
// (s)ticky?
|
|
5345
|
+
if (charat(value, length + 1) !== 115)
|
|
5346
|
+
break
|
|
5347
|
+
// display: (flex|inline-flex)
|
|
5348
|
+
case 6444:
|
|
5349
|
+
switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
|
|
5350
|
+
// stic(k)y
|
|
5351
|
+
case 107:
|
|
5352
|
+
return replace(value, ':', ':' + WEBKIT) + value
|
|
5353
|
+
// (inline-)?fl(e)x
|
|
5354
|
+
case 101:
|
|
5355
|
+
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value
|
|
5356
|
+
}
|
|
5357
|
+
break
|
|
5358
|
+
// writing-mode
|
|
5359
|
+
case 5936:
|
|
5360
|
+
switch (charat(value, length + 11)) {
|
|
5361
|
+
// vertical-l(r)
|
|
5362
|
+
case 114:
|
|
5363
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value
|
|
5364
|
+
// vertical-r(l)
|
|
5365
|
+
case 108:
|
|
5366
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value
|
|
5367
|
+
// horizontal(-)tb
|
|
5368
|
+
case 45:
|
|
5369
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value
|
|
5370
|
+
}
|
|
5371
|
+
|
|
5372
|
+
return WEBKIT + value + MS + value + value
|
|
5373
|
+
}
|
|
5374
|
+
|
|
5375
|
+
return value
|
|
5376
|
+
}
|
|
5377
|
+
|
|
5378
|
+
/**
|
|
5379
|
+
* @param {object[]} children
|
|
5380
|
+
* @param {function} callback
|
|
5381
|
+
* @return {string}
|
|
5382
|
+
*/
|
|
5383
|
+
function serialize (children, callback) {
|
|
5384
|
+
var output = '';
|
|
5385
|
+
var length = sizeof(children);
|
|
5386
|
+
|
|
5387
|
+
for (var i = 0; i < length; i++)
|
|
5388
|
+
output += callback(children[i], i, children, callback) || '';
|
|
5389
|
+
|
|
5390
|
+
return output
|
|
5391
|
+
}
|
|
5392
|
+
|
|
5393
|
+
/**
|
|
5394
|
+
* @param {object} element
|
|
5395
|
+
* @param {number} index
|
|
5396
|
+
* @param {object[]} children
|
|
5397
|
+
* @param {function} callback
|
|
5398
|
+
* @return {string}
|
|
5399
|
+
*/
|
|
5400
|
+
function stringify (element, index, children, callback) {
|
|
5401
|
+
switch (element.type) {
|
|
5402
|
+
case IMPORT: case DECLARATION: return element.return = element.return || element.value
|
|
5403
|
+
case COMMENT: return ''
|
|
5404
|
+
case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'
|
|
5405
|
+
case RULESET: element.value = element.props.join(',');
|
|
5406
|
+
}
|
|
5407
|
+
|
|
5408
|
+
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
|
|
5409
|
+
}
|
|
5410
|
+
|
|
5411
|
+
/**
|
|
5412
|
+
* @param {function[]} collection
|
|
5413
|
+
* @return {function}
|
|
5414
|
+
*/
|
|
5415
|
+
function middleware (collection) {
|
|
5416
|
+
var length = sizeof(collection);
|
|
5417
|
+
|
|
5418
|
+
return function (element, index, children, callback) {
|
|
5419
|
+
var output = '';
|
|
5420
|
+
|
|
5421
|
+
for (var i = 0; i < length; i++)
|
|
5422
|
+
output += collection[i](element, index, children, callback) || '';
|
|
5423
|
+
|
|
5424
|
+
return output
|
|
5425
|
+
}
|
|
5426
|
+
}
|
|
5427
|
+
|
|
5428
|
+
/**
|
|
5429
|
+
* @param {function} callback
|
|
5430
|
+
* @return {function}
|
|
5431
|
+
*/
|
|
5432
|
+
function rulesheet (callback) {
|
|
5433
|
+
return function (element) {
|
|
5434
|
+
if (!element.root)
|
|
5435
|
+
if (element = element.return)
|
|
5436
|
+
callback(element);
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5439
|
+
|
|
5440
|
+
/**
|
|
5441
|
+
* @param {object} element
|
|
5442
|
+
* @param {number} index
|
|
5443
|
+
* @param {object[]} children
|
|
5444
|
+
* @param {function} callback
|
|
5445
|
+
*/
|
|
5446
|
+
function prefixer (element, index, children, callback) {
|
|
5447
|
+
if (element.length > -1)
|
|
5448
|
+
if (!element.return)
|
|
5449
|
+
switch (element.type) {
|
|
5450
|
+
case DECLARATION: element.return = prefix(element.value, element.length);
|
|
5451
|
+
break
|
|
5452
|
+
case KEYFRAMES:
|
|
5453
|
+
return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)
|
|
5454
|
+
case RULESET:
|
|
5455
|
+
if (element.length)
|
|
5456
|
+
return combine(element.props, function (value) {
|
|
5457
|
+
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
|
5458
|
+
// :read-(only|write)
|
|
5459
|
+
case ':read-only': case ':read-write':
|
|
5460
|
+
return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback)
|
|
5461
|
+
// :placeholder
|
|
5462
|
+
case '::placeholder':
|
|
5463
|
+
return serialize([
|
|
5464
|
+
copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}),
|
|
5465
|
+
copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}),
|
|
5466
|
+
copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]})
|
|
5467
|
+
], callback)
|
|
5468
|
+
}
|
|
5469
|
+
|
|
5470
|
+
return ''
|
|
5471
|
+
})
|
|
5472
|
+
}
|
|
5473
|
+
}
|
|
5474
|
+
|
|
5475
|
+
var weakMemoize = function weakMemoize(func) {
|
|
5476
|
+
// $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps
|
|
5477
|
+
var cache = new WeakMap();
|
|
5478
|
+
return function (arg) {
|
|
5479
|
+
if (cache.has(arg)) {
|
|
5480
|
+
// $FlowFixMe
|
|
5481
|
+
return cache.get(arg);
|
|
5482
|
+
}
|
|
5483
|
+
|
|
5484
|
+
var ret = func(arg);
|
|
5485
|
+
cache.set(arg, ret);
|
|
5486
|
+
return ret;
|
|
5487
|
+
};
|
|
5488
|
+
};
|
|
5489
|
+
|
|
5490
|
+
function memoize(fn) {
|
|
5491
|
+
var cache = Object.create(null);
|
|
5492
|
+
return function (arg) {
|
|
5493
|
+
if (cache[arg] === undefined) cache[arg] = fn(arg);
|
|
5494
|
+
return cache[arg];
|
|
5495
|
+
};
|
|
5496
|
+
}
|
|
5497
|
+
|
|
5498
|
+
var last = function last(arr) {
|
|
5499
|
+
return arr.length ? arr[arr.length - 1] : null;
|
|
5500
|
+
}; // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244
|
|
5501
|
+
|
|
5502
|
+
|
|
5503
|
+
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
|
5504
|
+
var previous = 0;
|
|
5505
|
+
var character = 0;
|
|
5506
|
+
|
|
5507
|
+
while (true) {
|
|
5508
|
+
previous = character;
|
|
5509
|
+
character = peek(); // &\f
|
|
5510
|
+
|
|
5511
|
+
if (previous === 38 && character === 12) {
|
|
5512
|
+
points[index] = 1;
|
|
5513
|
+
}
|
|
5514
|
+
|
|
5515
|
+
if (token(character)) {
|
|
5516
|
+
break;
|
|
5517
|
+
}
|
|
5518
|
+
|
|
5519
|
+
next();
|
|
5520
|
+
}
|
|
5521
|
+
|
|
5522
|
+
return slice(begin, position);
|
|
5523
|
+
};
|
|
5524
|
+
|
|
5525
|
+
var toRules = function toRules(parsed, points) {
|
|
5526
|
+
// pretend we've started with a comma
|
|
5527
|
+
var index = -1;
|
|
5528
|
+
var character = 44;
|
|
5529
|
+
|
|
5530
|
+
do {
|
|
5531
|
+
switch (token(character)) {
|
|
5532
|
+
case 0:
|
|
5533
|
+
// &\f
|
|
5534
|
+
if (character === 38 && peek() === 12) {
|
|
5535
|
+
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
|
5536
|
+
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
|
5537
|
+
// and when it should just concatenate the outer and inner selectors
|
|
5538
|
+
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
|
5539
|
+
points[index] = 1;
|
|
5540
|
+
}
|
|
5541
|
+
|
|
5542
|
+
parsed[index] += identifierWithPointTracking(position - 1, points, index);
|
|
5543
|
+
break;
|
|
5544
|
+
|
|
5545
|
+
case 2:
|
|
5546
|
+
parsed[index] += delimit(character);
|
|
5547
|
+
break;
|
|
5548
|
+
|
|
5549
|
+
case 4:
|
|
5550
|
+
// comma
|
|
5551
|
+
if (character === 44) {
|
|
5552
|
+
// colon
|
|
5553
|
+
parsed[++index] = peek() === 58 ? '&\f' : '';
|
|
5554
|
+
points[index] = parsed[index].length;
|
|
5555
|
+
break;
|
|
5556
|
+
}
|
|
5557
|
+
|
|
5558
|
+
// fallthrough
|
|
5559
|
+
|
|
5560
|
+
default:
|
|
5561
|
+
parsed[index] += from(character);
|
|
5562
|
+
}
|
|
5563
|
+
} while (character = next());
|
|
5564
|
+
|
|
5565
|
+
return parsed;
|
|
5566
|
+
};
|
|
5567
|
+
|
|
5568
|
+
var getRules = function getRules(value, points) {
|
|
5569
|
+
return dealloc(toRules(alloc(value), points));
|
|
5570
|
+
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
|
5571
|
+
|
|
5572
|
+
|
|
5573
|
+
var fixedElements = /* #__PURE__ */new WeakMap();
|
|
5574
|
+
var compat = function compat(element) {
|
|
5575
|
+
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
|
5576
|
+
// negative .length indicates that this rule has been already prefixed
|
|
5577
|
+
element.length < 1) {
|
|
5578
|
+
return;
|
|
5579
|
+
}
|
|
5580
|
+
|
|
5581
|
+
var value = element.value,
|
|
5582
|
+
parent = element.parent;
|
|
5583
|
+
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
|
5584
|
+
|
|
5585
|
+
while (parent.type !== 'rule') {
|
|
5586
|
+
parent = parent.parent;
|
|
5587
|
+
if (!parent) return;
|
|
5588
|
+
} // short-circuit for the simplest case
|
|
5589
|
+
|
|
5590
|
+
|
|
5591
|
+
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
|
5592
|
+
/* colon */
|
|
5593
|
+
&& !fixedElements.get(parent)) {
|
|
5594
|
+
return;
|
|
5595
|
+
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
|
5596
|
+
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
|
5597
|
+
|
|
5598
|
+
|
|
5599
|
+
if (isImplicitRule) {
|
|
5600
|
+
return;
|
|
5601
|
+
}
|
|
5602
|
+
|
|
5603
|
+
fixedElements.set(element, true);
|
|
5604
|
+
var points = [];
|
|
5605
|
+
var rules = getRules(value, points);
|
|
5606
|
+
var parentRules = parent.props;
|
|
5607
|
+
|
|
5608
|
+
for (var i = 0, k = 0; i < rules.length; i++) {
|
|
5609
|
+
for (var j = 0; j < parentRules.length; j++, k++) {
|
|
5610
|
+
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
|
5611
|
+
}
|
|
5612
|
+
}
|
|
5613
|
+
};
|
|
5614
|
+
var removeLabel = function removeLabel(element) {
|
|
5615
|
+
if (element.type === 'decl') {
|
|
5616
|
+
var value = element.value;
|
|
5617
|
+
|
|
5618
|
+
if ( // charcode for l
|
|
5619
|
+
value.charCodeAt(0) === 108 && // charcode for b
|
|
5620
|
+
value.charCodeAt(2) === 98) {
|
|
5621
|
+
// this ignores label
|
|
5622
|
+
element["return"] = '';
|
|
5623
|
+
element.value = '';
|
|
5624
|
+
}
|
|
5625
|
+
}
|
|
5626
|
+
};
|
|
5627
|
+
var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
|
|
5628
|
+
|
|
5629
|
+
var isIgnoringComment = function isIgnoringComment(element) {
|
|
5630
|
+
return !!element && element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
|
|
5631
|
+
};
|
|
5632
|
+
|
|
5633
|
+
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
|
|
5634
|
+
return function (element, index, children) {
|
|
5635
|
+
if (element.type !== 'rule') return;
|
|
5636
|
+
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
|
|
5637
|
+
|
|
5638
|
+
if (unsafePseudoClasses && cache.compat !== true) {
|
|
5639
|
+
var prevElement = index > 0 ? children[index - 1] : null;
|
|
5640
|
+
|
|
5641
|
+
if (prevElement && isIgnoringComment(last(prevElement.children))) {
|
|
5642
|
+
return;
|
|
5643
|
+
}
|
|
5644
|
+
|
|
5645
|
+
unsafePseudoClasses.forEach(function (unsafePseudoClass) {
|
|
5646
|
+
console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
|
|
5647
|
+
});
|
|
5648
|
+
}
|
|
5649
|
+
};
|
|
5650
|
+
};
|
|
5651
|
+
|
|
5652
|
+
var isImportRule = function isImportRule(element) {
|
|
5653
|
+
return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
|
|
5654
|
+
};
|
|
5655
|
+
|
|
5656
|
+
var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
|
|
5657
|
+
for (var i = index - 1; i >= 0; i--) {
|
|
5658
|
+
if (!isImportRule(children[i])) {
|
|
5659
|
+
return true;
|
|
5660
|
+
}
|
|
5661
|
+
}
|
|
5662
|
+
|
|
5663
|
+
return false;
|
|
5664
|
+
}; // use this to remove incorrect elements from further processing
|
|
5665
|
+
// so they don't get handed to the `sheet` (or anything else)
|
|
5666
|
+
// as that could potentially lead to additional logs which in turn could be overhelming to the user
|
|
5667
|
+
|
|
5668
|
+
|
|
5669
|
+
var nullifyElement = function nullifyElement(element) {
|
|
5670
|
+
element.type = '';
|
|
5671
|
+
element.value = '';
|
|
5672
|
+
element["return"] = '';
|
|
5673
|
+
element.children = '';
|
|
5674
|
+
element.props = '';
|
|
5675
|
+
};
|
|
5676
|
+
|
|
5677
|
+
var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
|
|
5678
|
+
if (!isImportRule(element)) {
|
|
5679
|
+
return;
|
|
5680
|
+
}
|
|
5681
|
+
|
|
5682
|
+
if (element.parent) {
|
|
5683
|
+
console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
|
|
5684
|
+
nullifyElement(element);
|
|
5685
|
+
} else if (isPrependedWithRegularRules(index, children)) {
|
|
5686
|
+
console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
|
|
5687
|
+
nullifyElement(element);
|
|
5688
|
+
}
|
|
5689
|
+
};
|
|
5690
|
+
|
|
5691
|
+
var isBrowser = typeof document !== 'undefined';
|
|
5692
|
+
var getServerStylisCache = isBrowser ? undefined : weakMemoize(function () {
|
|
5693
|
+
return memoize(function () {
|
|
5694
|
+
var cache = {};
|
|
5695
|
+
return function (name) {
|
|
5696
|
+
return cache[name];
|
|
5697
|
+
};
|
|
5698
|
+
});
|
|
5699
|
+
});
|
|
5700
|
+
var defaultStylisPlugins = [prefixer];
|
|
5701
|
+
|
|
5702
|
+
var createCache = function createCache(options) {
|
|
5703
|
+
var key = options.key;
|
|
5704
|
+
|
|
5705
|
+
if (process.env.NODE_ENV !== 'production' && !key) {
|
|
5706
|
+
throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements.");
|
|
5707
|
+
}
|
|
5708
|
+
|
|
5709
|
+
if (isBrowser && key === 'css') {
|
|
5710
|
+
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
|
|
5711
|
+
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
|
|
5712
|
+
// note this very very intentionally targets all style elements regardless of the key to ensure
|
|
5713
|
+
// that creating a cache works inside of render of a React component
|
|
5714
|
+
|
|
5715
|
+
Array.prototype.forEach.call(ssrStyles, function (node) {
|
|
5716
|
+
// we want to only move elements which have a space in the data-emotion attribute value
|
|
5717
|
+
// because that indicates that it is an Emotion 11 server-side rendered style elements
|
|
5718
|
+
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
|
|
5719
|
+
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
|
|
5720
|
+
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
|
|
5721
|
+
// will not result in the Emotion 10 styles being destroyed
|
|
5722
|
+
var dataEmotionAttribute = node.getAttribute('data-emotion');
|
|
5723
|
+
|
|
5724
|
+
if (dataEmotionAttribute.indexOf(' ') === -1) {
|
|
5725
|
+
return;
|
|
5726
|
+
}
|
|
5727
|
+
document.head.appendChild(node);
|
|
5728
|
+
node.setAttribute('data-s', '');
|
|
5729
|
+
});
|
|
5730
|
+
}
|
|
5731
|
+
|
|
5732
|
+
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
|
5733
|
+
|
|
5734
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5735
|
+
// $FlowFixMe
|
|
5736
|
+
if (/[^a-z-]/.test(key)) {
|
|
5737
|
+
throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
|
|
5738
|
+
}
|
|
5739
|
+
}
|
|
5740
|
+
|
|
5741
|
+
var inserted = {}; // $FlowFixMe
|
|
5742
|
+
|
|
5743
|
+
var container;
|
|
5744
|
+
var nodesToHydrate = [];
|
|
5745
|
+
|
|
5746
|
+
if (isBrowser) {
|
|
5747
|
+
container = options.container || document.head;
|
|
5748
|
+
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
|
|
5749
|
+
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
|
5750
|
+
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
|
|
5751
|
+
var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe
|
|
5752
|
+
|
|
5753
|
+
for (var i = 1; i < attrib.length; i++) {
|
|
5754
|
+
inserted[attrib[i]] = true;
|
|
5755
|
+
}
|
|
5756
|
+
|
|
5757
|
+
nodesToHydrate.push(node);
|
|
5758
|
+
});
|
|
5759
|
+
}
|
|
5760
|
+
|
|
5761
|
+
var _insert;
|
|
5762
|
+
|
|
5763
|
+
var omnipresentPlugins = [compat, removeLabel];
|
|
5764
|
+
|
|
5765
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5766
|
+
omnipresentPlugins.push(createUnsafeSelectorsAlarm({
|
|
5767
|
+
get compat() {
|
|
5768
|
+
return cache.compat;
|
|
5769
|
+
}
|
|
5770
|
+
|
|
5771
|
+
}), incorrectImportAlarm);
|
|
5772
|
+
}
|
|
5773
|
+
|
|
5774
|
+
if (isBrowser) {
|
|
5775
|
+
var currentSheet;
|
|
5776
|
+
var finalizingPlugins = [stringify, process.env.NODE_ENV !== 'production' ? function (element) {
|
|
5777
|
+
if (!element.root) {
|
|
5778
|
+
if (element["return"]) {
|
|
5779
|
+
currentSheet.insert(element["return"]);
|
|
5780
|
+
} else if (element.value && element.type !== COMMENT) {
|
|
5781
|
+
// insert empty rule in non-production environments
|
|
5782
|
+
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
|
|
5783
|
+
currentSheet.insert(element.value + "{}");
|
|
5784
|
+
}
|
|
5785
|
+
}
|
|
5786
|
+
} : rulesheet(function (rule) {
|
|
5787
|
+
currentSheet.insert(rule);
|
|
5788
|
+
})];
|
|
5789
|
+
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
|
5790
|
+
|
|
5791
|
+
var stylis = function stylis(styles) {
|
|
5792
|
+
return serialize(compile(styles), serializer);
|
|
5793
|
+
};
|
|
5794
|
+
|
|
5795
|
+
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
|
5796
|
+
currentSheet = sheet;
|
|
5797
|
+
|
|
5798
|
+
if (process.env.NODE_ENV !== 'production' && serialized.map !== undefined) {
|
|
5799
|
+
currentSheet = {
|
|
5800
|
+
insert: function insert(rule) {
|
|
5801
|
+
sheet.insert(rule + serialized.map);
|
|
5802
|
+
}
|
|
5803
|
+
};
|
|
5804
|
+
}
|
|
5805
|
+
|
|
5806
|
+
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
5807
|
+
|
|
5808
|
+
if (shouldCache) {
|
|
5809
|
+
cache.inserted[serialized.name] = true;
|
|
5810
|
+
}
|
|
5811
|
+
};
|
|
5812
|
+
} else {
|
|
5813
|
+
var _finalizingPlugins = [stringify];
|
|
5814
|
+
|
|
5815
|
+
var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
|
5816
|
+
|
|
5817
|
+
var _stylis = function _stylis(styles) {
|
|
5818
|
+
return serialize(compile(styles), _serializer);
|
|
5819
|
+
}; // $FlowFixMe
|
|
5820
|
+
|
|
5821
|
+
|
|
5822
|
+
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
|
5823
|
+
|
|
5824
|
+
var getRules = function getRules(selector, serialized) {
|
|
5825
|
+
var name = serialized.name;
|
|
5826
|
+
|
|
5827
|
+
if (serverStylisCache[name] === undefined) {
|
|
5828
|
+
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
5829
|
+
}
|
|
5830
|
+
|
|
5831
|
+
return serverStylisCache[name];
|
|
5832
|
+
};
|
|
5833
|
+
|
|
5834
|
+
_insert = function _insert(selector, serialized, sheet, shouldCache) {
|
|
5835
|
+
var name = serialized.name;
|
|
5836
|
+
var rules = getRules(selector, serialized);
|
|
5837
|
+
|
|
5838
|
+
if (cache.compat === undefined) {
|
|
5839
|
+
// in regular mode, we don't set the styles on the inserted cache
|
|
5840
|
+
// since we don't need to and that would be wasting memory
|
|
5841
|
+
// we return them so that they are rendered in a style tag
|
|
5842
|
+
if (shouldCache) {
|
|
5843
|
+
cache.inserted[name] = true;
|
|
5844
|
+
}
|
|
5845
|
+
|
|
5846
|
+
if ( // using === development instead of !== production
|
|
5847
|
+
// because if people do ssr in tests, the source maps showing up would be annoying
|
|
5848
|
+
process.env.NODE_ENV === 'development' && serialized.map !== undefined) {
|
|
5849
|
+
return rules + serialized.map;
|
|
5850
|
+
}
|
|
5851
|
+
|
|
5852
|
+
return rules;
|
|
5853
|
+
} else {
|
|
5854
|
+
// in compat mode, we put the styles on the inserted cache so
|
|
5855
|
+
// that emotion-server can pull out the styles
|
|
5856
|
+
// except when we don't want to cache it which was in Global but now
|
|
5857
|
+
// is nowhere but we don't want to do a major right now
|
|
5858
|
+
// and just in case we're going to leave the case here
|
|
5859
|
+
// it's also not affecting client side bundle size
|
|
5860
|
+
// so it's really not a big deal
|
|
5861
|
+
if (shouldCache) {
|
|
5862
|
+
cache.inserted[name] = rules;
|
|
5863
|
+
} else {
|
|
5864
|
+
return rules;
|
|
5865
|
+
}
|
|
5866
|
+
}
|
|
5867
|
+
};
|
|
5868
|
+
}
|
|
5869
|
+
|
|
5870
|
+
var cache = {
|
|
5871
|
+
key: key,
|
|
5872
|
+
sheet: new StyleSheet({
|
|
5873
|
+
key: key,
|
|
5874
|
+
container: container,
|
|
5875
|
+
nonce: options.nonce,
|
|
5876
|
+
speedy: options.speedy,
|
|
5877
|
+
prepend: options.prepend,
|
|
5878
|
+
insertionPoint: options.insertionPoint
|
|
5879
|
+
}),
|
|
5880
|
+
nonce: options.nonce,
|
|
5881
|
+
inserted: inserted,
|
|
5882
|
+
registered: {},
|
|
5883
|
+
insert: _insert
|
|
5884
|
+
};
|
|
5885
|
+
cache.sheet.hydrate(nodesToHydrate);
|
|
5886
|
+
return cache;
|
|
5887
|
+
};
|
|
5888
|
+
|
|
5889
|
+
/**
|
|
5890
|
+
* prepend: true moves MUI styles to the top of the <head> so they're loaded first.
|
|
5891
|
+
* It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
|
|
5892
|
+
*/
|
|
5893
|
+
|
|
5894
|
+
function createEmotionCache() {
|
|
5895
|
+
return createCache({
|
|
5896
|
+
key: "css",
|
|
5897
|
+
prepend: true
|
|
5898
|
+
});
|
|
5899
|
+
}
|
|
5900
|
+
|
|
4571
5901
|
const ONE_HOUR = 3600;
|
|
4572
5902
|
const ONE_DAY = 84000;
|
|
4573
5903
|
/**
|
|
@@ -4595,6 +5925,636 @@
|
|
|
4595
5925
|
});
|
|
4596
5926
|
}
|
|
4597
5927
|
|
|
5928
|
+
const AppHead = props => {
|
|
5929
|
+
return jsxRuntime.jsx(Head__default["default"], Object.assign({}, props, {
|
|
5930
|
+
children: jsxRuntime.jsx("meta", {
|
|
5931
|
+
name: "viewport",
|
|
5932
|
+
content: "width=device-width"
|
|
5933
|
+
})
|
|
5934
|
+
}));
|
|
5935
|
+
};
|
|
5936
|
+
|
|
5937
|
+
let _ = t => t,
|
|
5938
|
+
_t;
|
|
5939
|
+
|
|
5940
|
+
const clientSideEmotionCache = createEmotionCache();
|
|
5941
|
+
/**
|
|
5942
|
+
* App theme with `emotion` (good for `@mui`)s
|
|
5943
|
+
*/
|
|
5944
|
+
|
|
5945
|
+
const AppThemeEmotion = ({
|
|
5946
|
+
emotionCache: _emotionCache = clientSideEmotionCache,
|
|
5947
|
+
theme,
|
|
5948
|
+
children
|
|
5949
|
+
}) => {
|
|
5950
|
+
return jsxRuntime.jsx(react$2.CacheProvider, Object.assign({
|
|
5951
|
+
value: _emotionCache
|
|
5952
|
+
}, {
|
|
5953
|
+
children: jsxRuntime.jsxs(styles.ThemeProvider, Object.assign({
|
|
5954
|
+
theme: theme
|
|
5955
|
+
}, {
|
|
5956
|
+
children: [jsxRuntime.jsx(CssBaseline__default["default"], {}), jsxRuntime.jsx(react$2.Global, {
|
|
5957
|
+
styles: react$2.css(_t || (_t = _`
|
|
5958
|
+
${0}
|
|
5959
|
+
`), react.stylesGlobal)
|
|
5960
|
+
}), children]
|
|
5961
|
+
}))
|
|
5962
|
+
}));
|
|
5963
|
+
};
|
|
5964
|
+
|
|
5965
|
+
/**
|
|
5966
|
+
* @see https://www.framer.com/docs/guide-reduce-bundle-size/
|
|
5967
|
+
*/
|
|
5968
|
+
|
|
5969
|
+
const loadMotionFeatures$1 = () => Promise.resolve().then(function () { return motionFeatures; }).then(m => m.default);
|
|
5970
|
+
/**
|
|
5971
|
+
* App main
|
|
5972
|
+
*
|
|
5973
|
+
* It implies a setup for `styled-components` and `framer-motion` libraries.
|
|
5974
|
+
*
|
|
5975
|
+
* About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
|
|
5976
|
+
*/
|
|
5977
|
+
|
|
5978
|
+
|
|
5979
|
+
const AppMainEmotion = ({
|
|
5980
|
+
Component,
|
|
5981
|
+
pageProps,
|
|
5982
|
+
Layout,
|
|
5983
|
+
// theme,
|
|
5984
|
+
seo,
|
|
5985
|
+
transition: _transition = {
|
|
5986
|
+
initial: {
|
|
5987
|
+
opacity: 0
|
|
5988
|
+
},
|
|
5989
|
+
animate: {
|
|
5990
|
+
opacity: 1
|
|
5991
|
+
},
|
|
5992
|
+
exit: {
|
|
5993
|
+
opacity: 0
|
|
5994
|
+
}
|
|
5995
|
+
},
|
|
5996
|
+
pre,
|
|
5997
|
+
post
|
|
5998
|
+
}) => {
|
|
5999
|
+
const {
|
|
6000
|
+
pathname
|
|
6001
|
+
} = router.useRouter();
|
|
6002
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6003
|
+
children: [jsxRuntime.jsx(SeoDefaults, Object.assign({}, seo)), pre, jsxRuntime.jsxs(framerMotion.LazyMotion, Object.assign({
|
|
6004
|
+
features: loadMotionFeatures$1
|
|
6005
|
+
}, {
|
|
6006
|
+
children: [jsxRuntime.jsx(NextProgress, {}), jsxRuntime.jsx(Layout, {
|
|
6007
|
+
children: jsxRuntime.jsx(framerMotion.AnimatePresence, Object.assign({
|
|
6008
|
+
exitBeforeEnter: true,
|
|
6009
|
+
initial: false
|
|
6010
|
+
}, {
|
|
6011
|
+
children: jsxRuntime.jsx(framerMotion.m.div, Object.assign({}, _transition, {
|
|
6012
|
+
children: /*#__PURE__*/React.createElement(Component, Object.assign({}, pageProps, {
|
|
6013
|
+
key: pathname
|
|
6014
|
+
}))
|
|
6015
|
+
}), pathname)
|
|
6016
|
+
}))
|
|
6017
|
+
})]
|
|
6018
|
+
})), post]
|
|
6019
|
+
});
|
|
6020
|
+
};
|
|
6021
|
+
|
|
6022
|
+
/**
|
|
6023
|
+
* App
|
|
6024
|
+
*/
|
|
6025
|
+
|
|
6026
|
+
const AppEmotion = props => {
|
|
6027
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6028
|
+
children: [jsxRuntime.jsx(AppHead, {}), jsxRuntime.jsx(AppThemeEmotion, Object.assign({}, props, {
|
|
6029
|
+
children: jsxRuntime.jsx(AppMainEmotion, Object.assign({}, props))
|
|
6030
|
+
}))]
|
|
6031
|
+
});
|
|
6032
|
+
};
|
|
6033
|
+
|
|
6034
|
+
/**
|
|
6035
|
+
* App theme with `styled-components`
|
|
6036
|
+
*/
|
|
6037
|
+
|
|
6038
|
+
const AppThemeSc = ({
|
|
6039
|
+
theme,
|
|
6040
|
+
children
|
|
6041
|
+
}) => {
|
|
6042
|
+
return jsxRuntime.jsxs(styledComponents.ThemeProvider, Object.assign({
|
|
6043
|
+
theme: theme
|
|
6044
|
+
}, {
|
|
6045
|
+
children: [jsxRuntime.jsx(react.StylesGlobal, {}), children]
|
|
6046
|
+
}));
|
|
6047
|
+
};
|
|
6048
|
+
|
|
6049
|
+
/**
|
|
6050
|
+
* @see https://www.framer.com/docs/guide-reduce-bundle-size/
|
|
6051
|
+
*/
|
|
6052
|
+
|
|
6053
|
+
const loadMotionFeatures = () => Promise.resolve().then(function () { return motionFeatures; }).then(m => m.default);
|
|
6054
|
+
/**
|
|
6055
|
+
* App main
|
|
6056
|
+
*
|
|
6057
|
+
* It implies a setup for `styled-components` and `framer-motion` libraries.
|
|
6058
|
+
*
|
|
6059
|
+
* About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
|
|
6060
|
+
*/
|
|
6061
|
+
|
|
6062
|
+
|
|
6063
|
+
const AppMainSc = ({
|
|
6064
|
+
Component,
|
|
6065
|
+
pageProps,
|
|
6066
|
+
Layout,
|
|
6067
|
+
// theme,
|
|
6068
|
+
seo,
|
|
6069
|
+
transition: _transition = {
|
|
6070
|
+
initial: {
|
|
6071
|
+
opacity: 0
|
|
6072
|
+
},
|
|
6073
|
+
animate: {
|
|
6074
|
+
opacity: 1
|
|
6075
|
+
},
|
|
6076
|
+
exit: {
|
|
6077
|
+
opacity: 0
|
|
6078
|
+
}
|
|
6079
|
+
},
|
|
6080
|
+
pre,
|
|
6081
|
+
post
|
|
6082
|
+
}) => {
|
|
6083
|
+
const {
|
|
6084
|
+
pathname
|
|
6085
|
+
} = router.useRouter();
|
|
6086
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6087
|
+
children: [jsxRuntime.jsx(SeoDefaults, Object.assign({}, seo)), pre, jsxRuntime.jsxs(framerMotion.LazyMotion, Object.assign({
|
|
6088
|
+
features: loadMotionFeatures
|
|
6089
|
+
}, {
|
|
6090
|
+
children: [jsxRuntime.jsx(NextProgress, {}), jsxRuntime.jsx(Layout, {
|
|
6091
|
+
children: jsxRuntime.jsx(framerMotion.AnimatePresence, Object.assign({
|
|
6092
|
+
exitBeforeEnter: true,
|
|
6093
|
+
initial: false
|
|
6094
|
+
}, {
|
|
6095
|
+
children: jsxRuntime.jsx(framerMotion.m.div, Object.assign({}, _transition, {
|
|
6096
|
+
children: /*#__PURE__*/React.createElement(Component, Object.assign({}, pageProps, {
|
|
6097
|
+
key: pathname
|
|
6098
|
+
}))
|
|
6099
|
+
}), pathname)
|
|
6100
|
+
}))
|
|
6101
|
+
})]
|
|
6102
|
+
})), post]
|
|
6103
|
+
});
|
|
6104
|
+
};
|
|
6105
|
+
|
|
6106
|
+
/**
|
|
6107
|
+
* App
|
|
6108
|
+
*/
|
|
6109
|
+
|
|
6110
|
+
const AppSc = props => {
|
|
6111
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6112
|
+
children: [jsxRuntime.jsx(AppHead, {}), jsxRuntime.jsx(AppThemeSc, Object.assign({}, props, {
|
|
6113
|
+
children: jsxRuntime.jsx(AppMainSc, Object.assign({}, props))
|
|
6114
|
+
}))]
|
|
6115
|
+
});
|
|
6116
|
+
};
|
|
6117
|
+
|
|
6118
|
+
/**
|
|
6119
|
+
* App theme with vanilla class based theme (good for `tailwindcss`)
|
|
6120
|
+
*/
|
|
6121
|
+
|
|
6122
|
+
const AppThemeVanilla = ({
|
|
6123
|
+
theme,
|
|
6124
|
+
children
|
|
6125
|
+
}) => {
|
|
6126
|
+
// return (
|
|
6127
|
+
// <ThemeVanillaProvider initialTheme={theme}>{children}</ThemeVanillaProvider>
|
|
6128
|
+
// );
|
|
6129
|
+
return jsxRuntime.jsx(ThemeProvider, Object.assign({
|
|
6130
|
+
defaultTheme: theme,
|
|
6131
|
+
attribute: "class"
|
|
6132
|
+
}, {
|
|
6133
|
+
children: children
|
|
6134
|
+
}));
|
|
6135
|
+
};
|
|
6136
|
+
|
|
6137
|
+
/**
|
|
6138
|
+
* App main
|
|
6139
|
+
*
|
|
6140
|
+
* It does not imply any specific styling or animation solution
|
|
6141
|
+
*/
|
|
6142
|
+
|
|
6143
|
+
const AppMainVanilla = ({
|
|
6144
|
+
Component,
|
|
6145
|
+
pageProps,
|
|
6146
|
+
Layout,
|
|
6147
|
+
seo,
|
|
6148
|
+
pre,
|
|
6149
|
+
post
|
|
6150
|
+
}) => {
|
|
6151
|
+
return jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
6152
|
+
children: [jsxRuntime.jsx(SeoDefaults, Object.assign({}, seo)), pre, jsxRuntime.jsx(Layout, {
|
|
6153
|
+
children: jsxRuntime.jsx(Component, Object.assign({}, pageProps))
|
|
6154
|
+
}), post]
|
|
6155
|
+
});
|
|
6156
|
+
};
|
|
6157
|
+
|
|
6158
|
+
/**
|
|
6159
|
+
* App
|
|
6160
|
+
*/
|
|
6161
|
+
|
|
6162
|
+
const AppVanilla = props => {
|
|
6163
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6164
|
+
children: [jsxRuntime.jsx(AppHead, {}), jsxRuntime.jsx(AppThemeVanilla, Object.assign({}, props, {
|
|
6165
|
+
children: jsxRuntime.jsx(AppMainVanilla, Object.assign({}, props))
|
|
6166
|
+
}))]
|
|
6167
|
+
});
|
|
6168
|
+
};
|
|
6169
|
+
|
|
6170
|
+
/**
|
|
6171
|
+
* App with authentication provided by `next-auth`
|
|
6172
|
+
*/
|
|
6173
|
+
|
|
6174
|
+
const AppAuthEmotion = props => {
|
|
6175
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6176
|
+
children: [jsxRuntime.jsx(AppHead, {}), jsxRuntime.jsx(react$1.SessionProvider, Object.assign({
|
|
6177
|
+
session: props.pageProps.session
|
|
6178
|
+
}, {
|
|
6179
|
+
children: jsxRuntime.jsx(AppThemeEmotion, Object.assign({}, props, {
|
|
6180
|
+
children: jsxRuntime.jsx(AppMainEmotion, Object.assign({}, props))
|
|
6181
|
+
}))
|
|
6182
|
+
}))]
|
|
6183
|
+
});
|
|
6184
|
+
};
|
|
6185
|
+
|
|
6186
|
+
/**
|
|
6187
|
+
* App with authentication provided by `next-auth`
|
|
6188
|
+
*/
|
|
6189
|
+
|
|
6190
|
+
const AppAuthSc = props => {
|
|
6191
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6192
|
+
children: [jsxRuntime.jsx(AppHead, {}), jsxRuntime.jsx(react$1.SessionProvider, Object.assign({
|
|
6193
|
+
session: props.pageProps.session
|
|
6194
|
+
}, {
|
|
6195
|
+
children: jsxRuntime.jsx(AppThemeSc, Object.assign({}, props, {
|
|
6196
|
+
children: jsxRuntime.jsx(AppMainSc, Object.assign({}, props))
|
|
6197
|
+
}))
|
|
6198
|
+
}))]
|
|
6199
|
+
});
|
|
6200
|
+
};
|
|
6201
|
+
|
|
6202
|
+
/**
|
|
6203
|
+
* Normalise pathname
|
|
6204
|
+
*
|
|
6205
|
+
* From a path like `/some//malformed/path///` it returns `some/malformed/path`
|
|
6206
|
+
*
|
|
6207
|
+
* - Removes subsequent slashes
|
|
6208
|
+
* - Removing initial and ending slashes
|
|
6209
|
+
*/
|
|
6210
|
+
|
|
6211
|
+
function normaliseUrlPathname(pathname) {
|
|
6212
|
+
return pathname.replace(/\/+\//g, "/").replace(/^\/+(.*?)\/+$/, "$1");
|
|
6213
|
+
}
|
|
6214
|
+
/**
|
|
6215
|
+
* Clean a pathname and encode each part
|
|
6216
|
+
*
|
|
6217
|
+
* @see {@link normaliseUrlPathname}
|
|
6218
|
+
*/
|
|
6219
|
+
|
|
6220
|
+
function encodePathname(pathname) {
|
|
6221
|
+
const parts = normaliseUrlPathname(pathname).split("/");
|
|
6222
|
+
return parts.filter(part => !!part).map(part => encodeURIComponent(part)).join("/");
|
|
6223
|
+
}
|
|
6224
|
+
/**
|
|
6225
|
+
*/
|
|
6226
|
+
|
|
6227
|
+
function getPathRedirect(locale, localisedPathname, templateName, dynamic, permanent) {
|
|
6228
|
+
const suffix = dynamic ? `/:slug*` : "";
|
|
6229
|
+
return {
|
|
6230
|
+
source: `/${locale}/${encodePathname(localisedPathname)}${suffix}`,
|
|
6231
|
+
destination: `/${encodePathname(templateName)}${suffix}`,
|
|
6232
|
+
permanent: Boolean(permanent),
|
|
6233
|
+
locale: false
|
|
6234
|
+
};
|
|
6235
|
+
}
|
|
6236
|
+
/**
|
|
6237
|
+
*/
|
|
6238
|
+
|
|
6239
|
+
function getPathRewrite(source, destination, dynamic) {
|
|
6240
|
+
const suffix = dynamic ? `/:path*` : "";
|
|
6241
|
+
return {
|
|
6242
|
+
source: `/${encodePathname(source)}${suffix}`,
|
|
6243
|
+
destination: `/${encodePathname(destination)}${suffix}`
|
|
6244
|
+
};
|
|
6245
|
+
}
|
|
6246
|
+
/**
|
|
6247
|
+
*/
|
|
6248
|
+
|
|
6249
|
+
function getRedirects({
|
|
6250
|
+
defaultLocale,
|
|
6251
|
+
routes,
|
|
6252
|
+
dynamicRoutes,
|
|
6253
|
+
permanent
|
|
6254
|
+
}) {
|
|
6255
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6256
|
+
const redirects = [];
|
|
6257
|
+
Object.keys(routes).forEach(page => {
|
|
6258
|
+
const dynamic = dynamicRoutes[page];
|
|
6259
|
+
|
|
6260
|
+
if (routes[page] !== page) {
|
|
6261
|
+
if (dynamic) {
|
|
6262
|
+
redirects.push(getPathRedirect(defaultLocale, page, routes[page], true, permanent));
|
|
6263
|
+
} else {
|
|
6264
|
+
redirects.push(getPathRedirect(defaultLocale, page, routes[page], false, permanent));
|
|
6265
|
+
}
|
|
6266
|
+
}
|
|
6267
|
+
}); // console.log("redirects", redirects);
|
|
6268
|
+
|
|
6269
|
+
return redirects;
|
|
6270
|
+
});
|
|
6271
|
+
}
|
|
6272
|
+
/**
|
|
6273
|
+
*/
|
|
6274
|
+
|
|
6275
|
+
function getRewrites({
|
|
6276
|
+
routes,
|
|
6277
|
+
dynamicRoutes
|
|
6278
|
+
}) {
|
|
6279
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6280
|
+
const rewrites = [];
|
|
6281
|
+
Object.keys(routes).forEach(page => {
|
|
6282
|
+
const dynamic = dynamicRoutes[page];
|
|
6283
|
+
|
|
6284
|
+
if (routes[page] !== page) {
|
|
6285
|
+
if (dynamic) {
|
|
6286
|
+
rewrites.push(getPathRewrite(routes[page], page, true));
|
|
6287
|
+
} else {
|
|
6288
|
+
rewrites.push(getPathRewrite(routes[page], page));
|
|
6289
|
+
}
|
|
6290
|
+
}
|
|
6291
|
+
}); // console.log("rewrites", rewrites);
|
|
6292
|
+
|
|
6293
|
+
return rewrites;
|
|
6294
|
+
});
|
|
6295
|
+
}
|
|
6296
|
+
/**
|
|
6297
|
+
* Get Next.js config with some basic opinionated defaults
|
|
6298
|
+
*/
|
|
6299
|
+
|
|
6300
|
+
function withKoine(_a = {}) {
|
|
6301
|
+
var {
|
|
6302
|
+
nx = true,
|
|
6303
|
+
svg = true,
|
|
6304
|
+
sc = true
|
|
6305
|
+
} = _a,
|
|
6306
|
+
nextConfig = __rest(_a, ["nx", "svg", "sc"]);
|
|
6307
|
+
|
|
6308
|
+
nextConfig = Object.assign({
|
|
6309
|
+
// @see https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directory
|
|
6310
|
+
pageExtensions: ["page.tsx", "page.ts"],
|
|
6311
|
+
eslint: {
|
|
6312
|
+
ignoreDuringBuilds: true // we have this strict check on each commit
|
|
6313
|
+
|
|
6314
|
+
},
|
|
6315
|
+
typescript: {
|
|
6316
|
+
ignoreBuildErrors: true // we have this strict check on each commit
|
|
6317
|
+
|
|
6318
|
+
},
|
|
6319
|
+
poweredByHeader: false,
|
|
6320
|
+
swcMinify: true,
|
|
6321
|
+
experimental: Object.assign({
|
|
6322
|
+
// @see https://github.com/vercel/vercel/discussions/5973#discussioncomment-472618
|
|
6323
|
+
// @see critters error https://github.com/vercel/next.js/issues/20742
|
|
6324
|
+
// optimizeCss: true,
|
|
6325
|
+
// @see https://github.com/vercel/next.js/discussions/30174#discussion-3643870
|
|
6326
|
+
scrollRestoration: true
|
|
6327
|
+
}, nextConfig.experimental || {})
|
|
6328
|
+
}, nextConfig);
|
|
6329
|
+
|
|
6330
|
+
if (svg) {
|
|
6331
|
+
if (nx) {
|
|
6332
|
+
// @see https://github.com/gregberge/svgr
|
|
6333
|
+
nextConfig["nx"] = {
|
|
6334
|
+
svgr: true
|
|
6335
|
+
};
|
|
6336
|
+
} else {
|
|
6337
|
+
nextConfig.webpack = (_config, options) => {
|
|
6338
|
+
const webpackConfig = typeof nextConfig.webpack === "function" ? nextConfig.webpack(_config, options) : _config; // @see https://dev.to/dolearning/importing-svgs-to-next-js-nna#svgr
|
|
6339
|
+
|
|
6340
|
+
webpackConfig.module.rules.push({
|
|
6341
|
+
test: /\.svg$/,
|
|
6342
|
+
use: [{
|
|
6343
|
+
loader: "@svgr/webpack",
|
|
6344
|
+
options: {
|
|
6345
|
+
svgoConfig: {
|
|
6346
|
+
plugins: [{
|
|
6347
|
+
name: "removeViewBox",
|
|
6348
|
+
active: false
|
|
6349
|
+
}]
|
|
6350
|
+
}
|
|
6351
|
+
}
|
|
6352
|
+
}]
|
|
6353
|
+
});
|
|
6354
|
+
return webpackConfig;
|
|
6355
|
+
};
|
|
6356
|
+
}
|
|
6357
|
+
}
|
|
6358
|
+
|
|
6359
|
+
if (sc) {
|
|
6360
|
+
nextConfig.compiler = {
|
|
6361
|
+
styledComponents: true
|
|
6362
|
+
};
|
|
6363
|
+
}
|
|
6364
|
+
|
|
6365
|
+
return nextConfig;
|
|
6366
|
+
}
|
|
6367
|
+
|
|
6368
|
+
/**
|
|
6369
|
+
* For typescript safety of this component
|
|
6370
|
+
*
|
|
6371
|
+
* @see https://bit.ly/3ceuF8m
|
|
6372
|
+
*/
|
|
6373
|
+
|
|
6374
|
+
class Document extends NextDocument__default["default"] {
|
|
6375
|
+
render() {
|
|
6376
|
+
const {
|
|
6377
|
+
locale,
|
|
6378
|
+
defaultLocale
|
|
6379
|
+
} = this.props.__NEXT_DATA__;
|
|
6380
|
+
return jsxRuntime.jsxs(NextDocument.Html, Object.assign({
|
|
6381
|
+
lang: locale || defaultLocale,
|
|
6382
|
+
className: "no-js"
|
|
6383
|
+
}, {
|
|
6384
|
+
children: [jsxRuntime.jsxs(NextDocument.Head, {
|
|
6385
|
+
children: [jsxRuntime.jsx(react.Meta, {}), jsxRuntime.jsx(react.NoJs, {})]
|
|
6386
|
+
}), jsxRuntime.jsxs("body", {
|
|
6387
|
+
children: [jsxRuntime.jsx(NextDocument.Main, {}), jsxRuntime.jsx(NextDocument.NextScript, {})]
|
|
6388
|
+
})]
|
|
6389
|
+
}));
|
|
6390
|
+
}
|
|
6391
|
+
|
|
6392
|
+
}
|
|
6393
|
+
|
|
6394
|
+
class DocumentEmotion extends NextDocument__default["default"] {
|
|
6395
|
+
render() {
|
|
6396
|
+
const {
|
|
6397
|
+
locale,
|
|
6398
|
+
defaultLocale
|
|
6399
|
+
} = this.props.__NEXT_DATA__;
|
|
6400
|
+
return jsxRuntime.jsxs(NextDocument.Html, Object.assign({
|
|
6401
|
+
lang: locale || defaultLocale,
|
|
6402
|
+
className: "no-js"
|
|
6403
|
+
}, {
|
|
6404
|
+
children: [jsxRuntime.jsxs(NextDocument.Head, {
|
|
6405
|
+
children: [jsxRuntime.jsx(react.NoJs, {}), this.props.emotionStyleTags]
|
|
6406
|
+
}), jsxRuntime.jsxs("body", {
|
|
6407
|
+
children: [jsxRuntime.jsx(NextDocument.Main, {}), jsxRuntime.jsx(NextDocument.NextScript, {})]
|
|
6408
|
+
})]
|
|
6409
|
+
}));
|
|
6410
|
+
}
|
|
6411
|
+
|
|
6412
|
+
} // `getInitialProps` belongs to `_document` (instead of `_app`),
|
|
6413
|
+
// it's compatible with static-site generation (SSG).
|
|
6414
|
+
|
|
6415
|
+
DocumentEmotion.getInitialProps = ctx => __awaiter(void 0, void 0, void 0, function* () {
|
|
6416
|
+
// Resolution order
|
|
6417
|
+
//
|
|
6418
|
+
// On the server:
|
|
6419
|
+
// 1. app.getInitialProps
|
|
6420
|
+
// 2. page.getInitialProps
|
|
6421
|
+
// 3. document.getInitialProps
|
|
6422
|
+
// 4. app.render
|
|
6423
|
+
// 5. page.render
|
|
6424
|
+
// 6. document.render
|
|
6425
|
+
//
|
|
6426
|
+
// On the server with error:
|
|
6427
|
+
// 1. document.getInitialProps
|
|
6428
|
+
// 2. app.render
|
|
6429
|
+
// 3. page.render
|
|
6430
|
+
// 4. document.render
|
|
6431
|
+
//
|
|
6432
|
+
// On the client
|
|
6433
|
+
// 1. app.getInitialProps
|
|
6434
|
+
// 2. page.getInitialProps
|
|
6435
|
+
// 3. app.render
|
|
6436
|
+
// 4. page.render
|
|
6437
|
+
const originalRenderPage = ctx.renderPage; // You can consider sharing the same emotion cache between all the SSR requests to speed up performance.
|
|
6438
|
+
// However, be aware that it can have global side effects.
|
|
6439
|
+
|
|
6440
|
+
const cache = createEmotionCache();
|
|
6441
|
+
const {
|
|
6442
|
+
extractCriticalToChunks
|
|
6443
|
+
} = createEmotionServer__default["default"](cache);
|
|
6444
|
+
|
|
6445
|
+
ctx.renderPage = () => originalRenderPage({
|
|
6446
|
+
enhanceApp: App => function EnhanceApp(props) {
|
|
6447
|
+
return jsxRuntime.jsx(App, Object.assign({
|
|
6448
|
+
emotionCache: cache
|
|
6449
|
+
}, props));
|
|
6450
|
+
}
|
|
6451
|
+
});
|
|
6452
|
+
|
|
6453
|
+
const initialProps = yield NextDocument__default["default"].getInitialProps(ctx); // This is important. It prevents emotion to render invalid HTML.
|
|
6454
|
+
// See https://github.com/mui-org/material-ui/issues/26561#issuecomment-855286153
|
|
6455
|
+
|
|
6456
|
+
const emotionStyles = extractCriticalToChunks(initialProps.html);
|
|
6457
|
+
const emotionStyleTags = emotionStyles.styles.map(style => jsxRuntime.jsx("style", {
|
|
6458
|
+
"data-emotion": `${style.key} ${style.ids.join(" ")}`,
|
|
6459
|
+
// eslint-disable-next-line react/no-danger
|
|
6460
|
+
dangerouslySetInnerHTML: {
|
|
6461
|
+
__html: style.css
|
|
6462
|
+
}
|
|
6463
|
+
}, style.key));
|
|
6464
|
+
return Object.assign(Object.assign({}, initialProps), {
|
|
6465
|
+
emotionStyleTags
|
|
6466
|
+
});
|
|
6467
|
+
});
|
|
6468
|
+
|
|
6469
|
+
/**
|
|
6470
|
+
* For typescript safety of this component
|
|
6471
|
+
*
|
|
6472
|
+
* @see https://bit.ly/3ceuF8m
|
|
6473
|
+
*/
|
|
6474
|
+
|
|
6475
|
+
class DocumentSc extends NextDocument__default["default"] {
|
|
6476
|
+
static getInitialProps(ctx) {
|
|
6477
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6478
|
+
const sheet = new styledComponents.ServerStyleSheet();
|
|
6479
|
+
const originalRenderPage = ctx.renderPage;
|
|
6480
|
+
|
|
6481
|
+
try {
|
|
6482
|
+
ctx.renderPage = () => originalRenderPage({
|
|
6483
|
+
enhanceApp: App => props => sheet.collectStyles(jsxRuntime.jsx(App, Object.assign({}, props)))
|
|
6484
|
+
});
|
|
6485
|
+
|
|
6486
|
+
const initialProps = yield NextDocument__default["default"].getInitialProps(ctx);
|
|
6487
|
+
return Object.assign(Object.assign({}, initialProps), {
|
|
6488
|
+
styles: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
6489
|
+
children: [initialProps.styles, sheet.getStyleElement()]
|
|
6490
|
+
})
|
|
6491
|
+
});
|
|
6492
|
+
} finally {
|
|
6493
|
+
sheet.seal();
|
|
6494
|
+
}
|
|
6495
|
+
});
|
|
6496
|
+
}
|
|
6497
|
+
|
|
6498
|
+
render() {
|
|
6499
|
+
const {
|
|
6500
|
+
locale,
|
|
6501
|
+
defaultLocale
|
|
6502
|
+
} = this.props.__NEXT_DATA__;
|
|
6503
|
+
return jsxRuntime.jsxs(NextDocument.Html, Object.assign({
|
|
6504
|
+
lang: locale || defaultLocale,
|
|
6505
|
+
className: "no-js"
|
|
6506
|
+
}, {
|
|
6507
|
+
children: [jsxRuntime.jsxs(NextDocument.Head, {
|
|
6508
|
+
children: [jsxRuntime.jsx(react.Meta, {}), jsxRuntime.jsx(react.NoJs, {})]
|
|
6509
|
+
}), jsxRuntime.jsxs("body", {
|
|
6510
|
+
children: [jsxRuntime.jsx(NextDocument.Main, {}), jsxRuntime.jsx(NextDocument.NextScript, {})]
|
|
6511
|
+
})]
|
|
6512
|
+
}));
|
|
6513
|
+
}
|
|
6514
|
+
|
|
6515
|
+
}
|
|
6516
|
+
|
|
6517
|
+
/**
|
|
6518
|
+
*/
|
|
6519
|
+
|
|
6520
|
+
class DocumentVanilla extends NextDocument__default["default"] {
|
|
6521
|
+
static getInitialProps(ctx) {
|
|
6522
|
+
var _a;
|
|
6523
|
+
|
|
6524
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6525
|
+
const initialProps = yield NextDocument__default["default"].getInitialProps(ctx);
|
|
6526
|
+
return Object.assign(Object.assign({}, initialProps), {
|
|
6527
|
+
theme: react.getInitialThemeFromRequest(((_a = ctx.req) === null || _a === void 0 ? void 0 : _a.headers.cookie
|
|
6528
|
+
/* || document?.cookie */
|
|
6529
|
+
) || "")
|
|
6530
|
+
});
|
|
6531
|
+
});
|
|
6532
|
+
}
|
|
6533
|
+
|
|
6534
|
+
render() {
|
|
6535
|
+
const {
|
|
6536
|
+
locale,
|
|
6537
|
+
defaultLocale
|
|
6538
|
+
} = this.props.__NEXT_DATA__;
|
|
6539
|
+
return jsxRuntime.jsxs(NextDocument.Html, Object.assign({
|
|
6540
|
+
lang: locale || defaultLocale,
|
|
6541
|
+
className: "no-js"
|
|
6542
|
+
}, {
|
|
6543
|
+
children: [jsxRuntime.jsxs(NextDocument.Head, {
|
|
6544
|
+
children: [jsxRuntime.jsx(react.Meta, {}), jsxRuntime.jsx(react.NoJs, {})]
|
|
6545
|
+
}), jsxRuntime.jsxs("body", {
|
|
6546
|
+
children: [jsxRuntime.jsx(NextDocument.Main, {}), jsxRuntime.jsx(NextDocument.NextScript, {})]
|
|
6547
|
+
})]
|
|
6548
|
+
}));
|
|
6549
|
+
}
|
|
6550
|
+
|
|
6551
|
+
}
|
|
6552
|
+
|
|
6553
|
+
var motionFeatures = /*#__PURE__*/Object.freeze({
|
|
6554
|
+
__proto__: null,
|
|
6555
|
+
'default': framerMotion.domMax
|
|
6556
|
+
});
|
|
6557
|
+
|
|
4598
6558
|
Object.defineProperty(exports, 'T', {
|
|
4599
6559
|
enumerable: true,
|
|
4600
6560
|
get: function () { return Trans__default["default"]; }
|
|
@@ -4605,6 +6565,21 @@
|
|
|
4605
6565
|
});
|
|
4606
6566
|
exports.AUTH_ROUTES = AUTH_ROUTES;
|
|
4607
6567
|
exports.AnalyticsGoogle = AnalyticsGoogle;
|
|
6568
|
+
exports.AppAuthEmotion = AppAuthEmotion;
|
|
6569
|
+
exports.AppAuthSc = AppAuthSc;
|
|
6570
|
+
exports.AppEmotion = AppEmotion;
|
|
6571
|
+
exports.AppHead = AppHead;
|
|
6572
|
+
exports.AppMainSc = AppMainSc;
|
|
6573
|
+
exports.AppMainVanilla = AppMainVanilla;
|
|
6574
|
+
exports.AppSc = AppSc;
|
|
6575
|
+
exports.AppThemeEmotion = AppThemeEmotion;
|
|
6576
|
+
exports.AppThemeSc = AppThemeSc;
|
|
6577
|
+
exports.AppThemeVanilla = AppThemeVanilla;
|
|
6578
|
+
exports.AppVanilla = AppVanilla;
|
|
6579
|
+
exports.Document = Document;
|
|
6580
|
+
exports.DocumentEmotion = DocumentEmotion;
|
|
6581
|
+
exports.DocumentSc = DocumentSc;
|
|
6582
|
+
exports.DocumentVanilla = DocumentVanilla;
|
|
4608
6583
|
exports.Favicon = Favicon;
|
|
4609
6584
|
exports.Link = Link;
|
|
4610
6585
|
exports.NextImg = NextImg;
|
|
@@ -4617,11 +6592,18 @@
|
|
|
4617
6592
|
exports.ThemeProvider = ThemeProvider;
|
|
4618
6593
|
exports.api = api;
|
|
4619
6594
|
exports.buildTags = buildTags;
|
|
6595
|
+
exports.createEmotionCache = createEmotionCache;
|
|
6596
|
+
exports.encodePathname = encodePathname;
|
|
4620
6597
|
exports.getAuthRoutes = getAuthRoutes;
|
|
4621
6598
|
exports.getCallbackUrl = getCallbackUrl;
|
|
4622
6599
|
exports.getNextImgProps = getNextImgProps;
|
|
6600
|
+
exports.getPathRedirect = getPathRedirect;
|
|
6601
|
+
exports.getPathRewrite = getPathRewrite;
|
|
6602
|
+
exports.getRedirects = getRedirects;
|
|
6603
|
+
exports.getRewrites = getRewrites;
|
|
4623
6604
|
exports.getSiteUrl = getSiteUrl;
|
|
4624
6605
|
exports.load = load;
|
|
6606
|
+
exports.normaliseUrlPathname = normaliseUrlPathname;
|
|
4625
6607
|
exports.translationAsOptions = translationAsOptions;
|
|
4626
6608
|
exports.useDateFormat = useDateFormat;
|
|
4627
6609
|
exports.useForm = useForm;
|
|
@@ -4632,6 +6614,7 @@
|
|
|
4632
6614
|
exports.useSubmit = useSubmit;
|
|
4633
6615
|
exports.useT = useT;
|
|
4634
6616
|
exports.useTheme = useTheme;
|
|
6617
|
+
exports.withKoine = withKoine;
|
|
4635
6618
|
|
|
4636
6619
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4637
6620
|
|