@koine/next 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.umd.js ADDED
@@ -0,0 +1,4626 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@koine/utils'), require('react'), require('next/router'), require('next/script'), require('next/head'), require('@mui/material/styles'), require('@emotion/react'), require('@mui/material/CssBaseline'), require('@koine/react'), require('framer-motion'), require('styled-components'), require('next-auth/react'), require('date-fns/format'), require('next-translate/useTranslation'), require('next-translate/Trans'), require('next/document'), require('@emotion/server/create-instance'), 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', '@koine/utils', 'react', 'next/router', 'next/script', 'next/head', '@mui/material/styles', '@emotion/react', '@mui/material/CssBaseline', '@koine/react', 'framer-motion', 'styled-components', 'next-auth/react', 'date-fns/format', 'next-translate/useTranslation', 'next-translate/Trans', 'next/document', '@emotion/server/create-instance', '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.utils, global.React, global.router, global.Script, global.Head, global.styles, global.emotionReact, global.CssBaseline, global.react$1, global.framerMotion, global.styled, global.react$2, global.format, global.useTranslation, global.Trans, global.NextDocument, global.createEmotionServer, global.reactHookForm, global.yup, global.reactUse, global.NextImage, global.NextLink));
5
+ })(this, (function (exports, utils, React$1, router, Script, Head, styles, react, CssBaseline, react$1, framerMotion, styledComponents, react$2, format, useTranslation, Trans, NextDocument, createEmotionServer, reactHookForm, yup, reactUse, NextImage, NextLink) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React$1);
10
+ var Script__default = /*#__PURE__*/_interopDefaultLegacy(Script);
11
+ var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
12
+ var CssBaseline__default = /*#__PURE__*/_interopDefaultLegacy(CssBaseline);
13
+ var format__default = /*#__PURE__*/_interopDefaultLegacy(format);
14
+ var useTranslation__default = /*#__PURE__*/_interopDefaultLegacy(useTranslation);
15
+ var Trans__default = /*#__PURE__*/_interopDefaultLegacy(Trans);
16
+ var NextDocument__default = /*#__PURE__*/_interopDefaultLegacy(NextDocument);
17
+ var createEmotionServer__default = /*#__PURE__*/_interopDefaultLegacy(createEmotionServer);
18
+ var NextImage__default = /*#__PURE__*/_interopDefaultLegacy(NextImage);
19
+ var NextLink__default = /*#__PURE__*/_interopDefaultLegacy(NextLink);
20
+
21
+ function _arrayLikeToArray$8(arr, len) {
22
+ if (len == null || len > arr.length) len = arr.length;
23
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
24
+ return arr2;
25
+ }
26
+ function _arrayWithHoles$8(arr) {
27
+ if (Array.isArray(arr)) return arr;
28
+ }
29
+ function _iterableToArrayLimit$8(arr, i) {
30
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
31
+ if (_i == null) return;
32
+ var _arr = [];
33
+ var _n = true;
34
+ var _d = false;
35
+ var _s, _e;
36
+ try {
37
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
38
+ _arr.push(_s.value);
39
+ if (i && _arr.length === i) break;
40
+ }
41
+ } catch (err) {
42
+ _d = true;
43
+ _e = err;
44
+ } finally{
45
+ try {
46
+ if (!_n && _i["return"] != null) _i["return"]();
47
+ } finally{
48
+ if (_d) throw _e;
49
+ }
50
+ }
51
+ return _arr;
52
+ }
53
+ function _nonIterableRest$8() {
54
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
55
+ }
56
+ function _slicedToArray$8(arr, i) {
57
+ return _arrayWithHoles$8(arr) || _iterableToArrayLimit$8(arr, i) || _unsupportedIterableToArray$8(arr, i) || _nonIterableRest$8();
58
+ }
59
+ function _unsupportedIterableToArray$8(o, minLen) {
60
+ if (!o) return;
61
+ if (typeof o === "string") return _arrayLikeToArray$8(o, minLen);
62
+ var n = Object.prototype.toString.call(o).slice(8, -1);
63
+ if (n === "Object" && o.constructor) n = o.constructor.name;
64
+ if (n === "Map" || n === "Set") return Array.from(n);
65
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$8(o, minLen);
66
+ }
67
+ var AnalyticsGoogle = function(param) {
68
+ var id = param.id;
69
+ var uid = id || process.env["NEXT_PUBLIC_GTM_ID"];
70
+ var ref = router.useRouter(), events = ref.events, asPath = ref.asPath, query = ref.query;
71
+ var ref1 = _slicedToArray$8(React$1.useState(false), 2), ready = ref1[0], setReady = ref1[1];
72
+ var ref2 = _slicedToArray$8(React$1.useState(false), 2), routed = ref2[0], setRouted = ref2[1];
73
+ // const [url, setUrl] = useState("");
74
+ React$1.useEffect(function() {
75
+ var handleRouteChange = function() {
76
+ setRouted(true);
77
+ };
78
+ events.on("routeChangeComplete", handleRouteChange);
79
+ return function() {
80
+ events.off("routeChangeComplete", handleRouteChange);
81
+ };
82
+ }, [
83
+ events
84
+ ]);
85
+ React$1.useEffect(function() {
86
+ if (routed && ready && asPath) {
87
+ // const search = query;
88
+ utils.pageview(asPath);
89
+ }
90
+ }, [
91
+ asPath,
92
+ query,
93
+ routed,
94
+ ready
95
+ ]);
96
+ if (!uid) {
97
+ return null;
98
+ }
99
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Script__default["default"], {
100
+ id: "google-tagmanager",
101
+ src: "https://www.googletagmanager.com/gtag/js?id=".concat(id),
102
+ strategy: "afterInteractive",
103
+ onLoad: function() {
104
+ return setReady(true);
105
+ }
106
+ }), /*#__PURE__*/ React.createElement(Script__default["default"], {
107
+ id: "google-analytics",
108
+ strategy: "afterInteractive"
109
+ }, "\n window.dataLayer = window.dataLayer || [];\n function gtag(){window.dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', '".concat(id, "', { 'send_page_view': false });\n ")));
110
+ };
111
+
112
+ function _extends$e() {
113
+ _extends$e = Object.assign || function(target) {
114
+ for(var i = 1; i < arguments.length; i++){
115
+ var source = arguments[i];
116
+ for(var key in source){
117
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
118
+ target[key] = source[key];
119
+ }
120
+ }
121
+ }
122
+ return target;
123
+ };
124
+ return _extends$e.apply(this, arguments);
125
+ }
126
+ var AppHead = function(props) {
127
+ return /*#__PURE__*/ React.createElement(Head__default["default"], _extends$e({}, props), /*#__PURE__*/ React.createElement("meta", {
128
+ name: "viewport",
129
+ content: "width=device-width"
130
+ }));
131
+ };
132
+
133
+ /*
134
+
135
+ Based off glamor's StyleSheet, thanks Sunil ❤️
136
+
137
+ high performance StyleSheet for css-in-js systems
138
+
139
+ - uses multiple style tags behind the scenes for millions of rules
140
+ - uses `insertRule` for appending in production for *much* faster performance
141
+
142
+ // usage
143
+
144
+ import { StyleSheet } from '@emotion/sheet'
145
+
146
+ let styleSheet = new StyleSheet({ key: '', container: document.head })
147
+
148
+ styleSheet.insert('#box { border: 1px solid red; }')
149
+ - appends a css rule into the stylesheet
150
+
151
+ styleSheet.flush()
152
+ - empties the stylesheet of all its contents
153
+
154
+ */ // $FlowFixMe
155
+ function sheetForTag(tag) {
156
+ if (tag.sheet) {
157
+ // $FlowFixMe
158
+ return tag.sheet;
159
+ } // this weirdness brought to you by firefox
160
+ /* istanbul ignore next */ for(var i = 0; i < document.styleSheets.length; i++){
161
+ if (document.styleSheets[i].ownerNode === tag) {
162
+ // $FlowFixMe
163
+ return document.styleSheets[i];
164
+ }
165
+ }
166
+ }
167
+ function createStyleElement(options) {
168
+ var tag = document.createElement("style");
169
+ tag.setAttribute("data-emotion", options.key);
170
+ if (options.nonce !== undefined) {
171
+ tag.setAttribute("nonce", options.nonce);
172
+ }
173
+ tag.appendChild(document.createTextNode(""));
174
+ tag.setAttribute("data-s", "");
175
+ return tag;
176
+ }
177
+ var StyleSheet1 = /*#__PURE__*/ function() {
178
+ var StyleSheet = function StyleSheet(options) {
179
+ var _this = this;
180
+ this._insertTag = function(tag) {
181
+ var before;
182
+ if (_this.tags.length === 0) {
183
+ if (_this.insertionPoint) {
184
+ before = _this.insertionPoint.nextSibling;
185
+ } else if (_this.prepend) {
186
+ before = _this.container.firstChild;
187
+ } else {
188
+ before = _this.before;
189
+ }
190
+ } else {
191
+ before = _this.tags[_this.tags.length - 1].nextSibling;
192
+ }
193
+ _this.container.insertBefore(tag, before);
194
+ _this.tags.push(tag);
195
+ };
196
+ this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === "production" : options.speedy;
197
+ this.tags = [];
198
+ this.ctr = 0;
199
+ this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
200
+ this.key = options.key;
201
+ this.container = options.container;
202
+ this.prepend = options.prepend;
203
+ this.insertionPoint = options.insertionPoint;
204
+ this.before = null;
205
+ };
206
+ var _proto = StyleSheet.prototype;
207
+ _proto.hydrate = function hydrate(nodes) {
208
+ nodes.forEach(this._insertTag);
209
+ };
210
+ _proto.insert = function insert(rule) {
211
+ // the max length is how many rules we have per style tag, it's 65000 in speedy mode
212
+ // it's 1 in dev because we insert source maps that map a single rule to a location
213
+ // and you can only have one source map per style tag
214
+ if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
215
+ this._insertTag(createStyleElement(this));
216
+ }
217
+ var tag = this.tags[this.tags.length - 1];
218
+ if (process.env.NODE_ENV !== "production") {
219
+ var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;
220
+ if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) {
221
+ // this would only cause problem in speedy mode
222
+ // but we don't want enabling speedy to affect the observable behavior
223
+ // so we report this error at all times
224
+ 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.");
225
+ }
226
+ this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule;
227
+ }
228
+ if (this.isSpeedy) {
229
+ var sheet = sheetForTag(tag);
230
+ try {
231
+ // this is the ultrafast version, works across browsers
232
+ // the big drawback is that the css won't be editable in devtools
233
+ sheet.insertRule(rule, sheet.cssRules.length);
234
+ } catch (e) {
235
+ 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)) {
236
+ console.error('There was a problem inserting the following rule: "' + rule + '"', e);
237
+ }
238
+ }
239
+ } else {
240
+ tag.appendChild(document.createTextNode(rule));
241
+ }
242
+ this.ctr++;
243
+ };
244
+ _proto.flush = function flush() {
245
+ // $FlowFixMe
246
+ this.tags.forEach(function(tag) {
247
+ return tag.parentNode && tag.parentNode.removeChild(tag);
248
+ });
249
+ this.tags = [];
250
+ this.ctr = 0;
251
+ if (process.env.NODE_ENV !== "production") {
252
+ this._alreadyInsertedOrderInsensitiveRule = false;
253
+ }
254
+ };
255
+ return StyleSheet;
256
+ }();
257
+
258
+ var MS = "-ms-";
259
+ var MOZ = "-moz-";
260
+ var WEBKIT = "-webkit-";
261
+ var COMMENT = "comm";
262
+ var RULESET = "rule";
263
+ var DECLARATION = "decl";
264
+ var IMPORT = "@import";
265
+ var KEYFRAMES = "@keyframes";
266
+
267
+ /**
268
+ * @param {number}
269
+ * @return {number}
270
+ */ var abs = Math.abs;
271
+ /**
272
+ * @param {number}
273
+ * @return {string}
274
+ */ var from = String.fromCharCode;
275
+ /**
276
+ * @param {object}
277
+ * @return {object}
278
+ */ var assign = Object.assign;
279
+ /**
280
+ * @param {string} value
281
+ * @param {number} length
282
+ * @return {number}
283
+ */ function hash(value, length) {
284
+ return (((length << 2 ^ charat(value, 0)) << 2 ^ charat(value, 1)) << 2 ^ charat(value, 2)) << 2 ^ charat(value, 3);
285
+ }
286
+ /**
287
+ * @param {string} value
288
+ * @return {string}
289
+ */ function trim(value) {
290
+ return value.trim();
291
+ }
292
+ /**
293
+ * @param {string} value
294
+ * @param {RegExp} pattern
295
+ * @return {string?}
296
+ */ function match(value, pattern) {
297
+ return (value = pattern.exec(value)) ? value[0] : value;
298
+ }
299
+ /**
300
+ * @param {string} value
301
+ * @param {(string|RegExp)} pattern
302
+ * @param {string} replacement
303
+ * @return {string}
304
+ */ function replace(value, pattern, replacement) {
305
+ return value.replace(pattern, replacement);
306
+ }
307
+ /**
308
+ * @param {string} value
309
+ * @param {string} search
310
+ * @return {number}
311
+ */ function indexof(value, search) {
312
+ return value.indexOf(search);
313
+ }
314
+ /**
315
+ * @param {string} value
316
+ * @param {number} index
317
+ * @return {number}
318
+ */ function charat(value, index) {
319
+ return value.charCodeAt(index) | 0;
320
+ }
321
+ /**
322
+ * @param {string} value
323
+ * @param {number} begin
324
+ * @param {number} end
325
+ * @return {string}
326
+ */ function substr(value, begin, end) {
327
+ return value.slice(begin, end);
328
+ }
329
+ /**
330
+ * @param {string} value
331
+ * @return {number}
332
+ */ function strlen(value) {
333
+ return value.length;
334
+ }
335
+ /**
336
+ * @param {any[]} value
337
+ * @return {number}
338
+ */ function sizeof(value) {
339
+ return value.length;
340
+ }
341
+ /**
342
+ * @param {any} value
343
+ * @param {any[]} array
344
+ * @return {any}
345
+ */ function append(value, array) {
346
+ return array.push(value), value;
347
+ }
348
+ /**
349
+ * @param {string[]} array
350
+ * @param {function} callback
351
+ * @return {string}
352
+ */ function combine(array, callback) {
353
+ return array.map(callback).join("");
354
+ }
355
+
356
+ var line = 1;
357
+ var column = 1;
358
+ var length = 0;
359
+ var position = 0;
360
+ var character = 0;
361
+ var characters = "";
362
+ /**
363
+ * @param {string} value
364
+ * @param {object | null} root
365
+ * @param {object | null} parent
366
+ * @param {string} type
367
+ * @param {string[] | string} props
368
+ * @param {object[] | string} children
369
+ * @param {number} length
370
+ */ function node(value, root, parent, type, props, children, length1) {
371
+ return {
372
+ value: value,
373
+ root: root,
374
+ parent: parent,
375
+ type: type,
376
+ props: props,
377
+ children: children,
378
+ line: line,
379
+ column: column,
380
+ length: length1,
381
+ return: ""
382
+ };
383
+ }
384
+ /**
385
+ * @param {object} root
386
+ * @param {object} props
387
+ * @return {object}
388
+ */ function copy(root, props) {
389
+ return assign(node("", null, null, "", null, null, 0), root, {
390
+ length: -root.length
391
+ }, props);
392
+ }
393
+ /**
394
+ * @return {number}
395
+ */ function char() {
396
+ return character;
397
+ }
398
+ /**
399
+ * @return {number}
400
+ */ function prev() {
401
+ character = position > 0 ? charat(characters, --position) : 0;
402
+ if (column--, character === 10) column = 1, line--;
403
+ return character;
404
+ }
405
+ /**
406
+ * @return {number}
407
+ */ function next() {
408
+ character = position < length ? charat(characters, position++) : 0;
409
+ if (column++, character === 10) column = 1, line++;
410
+ return character;
411
+ }
412
+ /**
413
+ * @return {number}
414
+ */ function peek() {
415
+ return charat(characters, position);
416
+ }
417
+ /**
418
+ * @return {number}
419
+ */ function caret() {
420
+ return position;
421
+ }
422
+ /**
423
+ * @param {number} begin
424
+ * @param {number} end
425
+ * @return {string}
426
+ */ function slice(begin, end) {
427
+ return substr(characters, begin, end);
428
+ }
429
+ /**
430
+ * @param {number} type
431
+ * @return {number}
432
+ */ function token(type) {
433
+ switch(type){
434
+ // \0 \t \n \r \s whitespace token
435
+ case 0:
436
+ case 9:
437
+ case 10:
438
+ case 13:
439
+ case 32:
440
+ return 5;
441
+ // ! + , / > @ ~ isolate token
442
+ case 33:
443
+ case 43:
444
+ case 44:
445
+ case 47:
446
+ case 62:
447
+ case 64:
448
+ case 126:
449
+ // ; { } breakpoint token
450
+ case 59:
451
+ case 123:
452
+ case 125:
453
+ return 4;
454
+ // : accompanied token
455
+ case 58:
456
+ return 3;
457
+ // " ' ( [ opening delimit token
458
+ case 34:
459
+ case 39:
460
+ case 40:
461
+ case 91:
462
+ return 2;
463
+ // ) ] closing delimit token
464
+ case 41:
465
+ case 93:
466
+ return 1;
467
+ }
468
+ return 0;
469
+ }
470
+ /**
471
+ * @param {string} value
472
+ * @return {any[]}
473
+ */ function alloc(value) {
474
+ return line = column = 1, length = strlen(characters = value), position = 0, [];
475
+ }
476
+ /**
477
+ * @param {any} value
478
+ * @return {any}
479
+ */ function dealloc(value) {
480
+ return characters = "", value;
481
+ }
482
+ /**
483
+ * @param {number} type
484
+ * @return {string}
485
+ */ function delimit(type) {
486
+ return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
487
+ }
488
+ /**
489
+ * @param {number} type
490
+ * @return {string}
491
+ */ function whitespace(type) {
492
+ while(character = peek())if (character < 33) next();
493
+ else break;
494
+ return token(type) > 2 || token(character) > 3 ? "" : " ";
495
+ }
496
+ /**
497
+ * @param {number} index
498
+ * @param {number} count
499
+ * @return {string}
500
+ */ function escaping(index, count) {
501
+ while(--count && next())// not 0-9 A-F a-f
502
+ if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97) break;
503
+ return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
504
+ }
505
+ /**
506
+ * @param {number} type
507
+ * @return {number}
508
+ */ function delimiter(type) {
509
+ while(next())switch(character){
510
+ // ] ) " '
511
+ case type:
512
+ return position;
513
+ // " '
514
+ case 34:
515
+ case 39:
516
+ if (type !== 34 && type !== 39) delimiter(character);
517
+ break;
518
+ // (
519
+ case 40:
520
+ if (type === 41) delimiter(type);
521
+ break;
522
+ // \
523
+ case 92:
524
+ next();
525
+ break;
526
+ }
527
+ return position;
528
+ }
529
+ /**
530
+ * @param {number} type
531
+ * @param {number} index
532
+ * @return {number}
533
+ */ function commenter(type, index) {
534
+ while(next())// //
535
+ if (type + character === 47 + 10) break;
536
+ else if (type + character === 42 + 42 && peek() === 47) break;
537
+ return "/*" + slice(index, position - 1) + "*" + from(type === 47 ? type : next());
538
+ }
539
+ /**
540
+ * @param {number} index
541
+ * @return {string}
542
+ */ function identifier(index) {
543
+ while(!token(peek()))next();
544
+ return slice(index, position);
545
+ }
546
+
547
+ /**
548
+ * @param {string} value
549
+ * @return {object[]}
550
+ */ function compile(value) {
551
+ return dealloc(parse("", null, null, null, [
552
+ ""
553
+ ], value = alloc(value), 0, [
554
+ 0
555
+ ], value));
556
+ }
557
+ /**
558
+ * @param {string} value
559
+ * @param {object} root
560
+ * @param {object?} parent
561
+ * @param {string[]} rule
562
+ * @param {string[]} rules
563
+ * @param {string[]} rulesets
564
+ * @param {number[]} pseudo
565
+ * @param {number[]} points
566
+ * @param {string[]} declarations
567
+ * @return {object}
568
+ */ function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
569
+ var index = 0;
570
+ var offset = 0;
571
+ var length = pseudo;
572
+ var atrule = 0;
573
+ var property = 0;
574
+ var previous = 0;
575
+ var variable = 1;
576
+ var scanning = 1;
577
+ var ampersand = 1;
578
+ var character = 0;
579
+ var type = "";
580
+ var props = rules;
581
+ var children = rulesets;
582
+ var reference = rule;
583
+ var characters = type;
584
+ while(scanning)switch(previous = character, character = next()){
585
+ // (
586
+ case 40:
587
+ if (previous != 108 && characters.charCodeAt(length - 1) == 58) {
588
+ if (indexof(characters += replace(delimit(character), "&", "&\f"), "&\f") != -1) ampersand = -1;
589
+ break;
590
+ }
591
+ // " ' [
592
+ case 34:
593
+ case 39:
594
+ case 91:
595
+ characters += delimit(character);
596
+ break;
597
+ // \t \n \r \s
598
+ case 9:
599
+ case 10:
600
+ case 13:
601
+ case 32:
602
+ characters += whitespace(previous);
603
+ break;
604
+ // \
605
+ case 92:
606
+ characters += escaping(caret() - 1, 7);
607
+ continue;
608
+ // /
609
+ case 47:
610
+ switch(peek()){
611
+ case 42:
612
+ case 47:
613
+ append(comment(commenter(next(), caret()), root, parent), declarations);
614
+ break;
615
+ default:
616
+ characters += "/";
617
+ }
618
+ break;
619
+ // {
620
+ case 123 * variable:
621
+ points[index++] = strlen(characters) * ampersand;
622
+ // } ; \0
623
+ case 125 * variable:
624
+ case 59:
625
+ case 0:
626
+ switch(character){
627
+ // \0 }
628
+ case 0:
629
+ case 125:
630
+ scanning = 0;
631
+ // ;
632
+ case 59 + offset:
633
+ if (property > 0 && strlen(characters) - length) append(property > 32 ? declaration(characters + ";", rule, parent, length - 1) : declaration(replace(characters, " ", "") + ";", rule, parent, length - 2), declarations);
634
+ break;
635
+ // @ ;
636
+ case 59:
637
+ characters += ";";
638
+ // { rule/at-rule
639
+ default:
640
+ append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets);
641
+ if (character === 123) if (offset === 0) parse(characters, root, reference, reference, props, rulesets, length, points, children);
642
+ else switch(atrule){
643
+ // d m s
644
+ case 100:
645
+ case 109:
646
+ case 115:
647
+ 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);
648
+ break;
649
+ default:
650
+ parse(characters, reference, reference, reference, [
651
+ ""
652
+ ], children, 0, points, children);
653
+ }
654
+ }
655
+ index = offset = property = 0, variable = ampersand = 1, type = characters = "", length = pseudo;
656
+ break;
657
+ // :
658
+ case 58:
659
+ length = 1 + strlen(characters), property = previous;
660
+ default:
661
+ if (variable < 1) {
662
+ if (character == 123) --variable;
663
+ else if (character == 125 && (variable++) == 0 && prev() == 125) continue;
664
+ }
665
+ switch(characters += from(character), character * variable){
666
+ // &
667
+ case 38:
668
+ ampersand = offset > 0 ? 1 : (characters += "\f", -1);
669
+ break;
670
+ // ,
671
+ case 44:
672
+ points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1;
673
+ break;
674
+ // @
675
+ case 64:
676
+ // -
677
+ if (peek() === 45) characters += delimit(next());
678
+ atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++;
679
+ break;
680
+ // -
681
+ case 45:
682
+ if (previous === 45 && strlen(characters) == 2) variable = 0;
683
+ }
684
+ }
685
+ return rulesets;
686
+ }
687
+ /**
688
+ * @param {string} value
689
+ * @param {object} root
690
+ * @param {object?} parent
691
+ * @param {number} index
692
+ * @param {number} offset
693
+ * @param {string[]} rules
694
+ * @param {number[]} points
695
+ * @param {string} type
696
+ * @param {string[]} props
697
+ * @param {string[]} children
698
+ * @param {number} length
699
+ * @return {object}
700
+ */ function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length) {
701
+ var post = offset - 1;
702
+ var rule = offset === 0 ? rules : [
703
+ ""
704
+ ];
705
+ var size = sizeof(rule);
706
+ for(var i = 0, j = 0, k = 0; i < index; ++i)for(var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)if (z = trim(j > 0 ? rule[x] + " " + y : replace(y, /&\f/g, rule[x]))) props[k++] = z;
707
+ return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length);
708
+ }
709
+ /**
710
+ * @param {number} value
711
+ * @param {object} root
712
+ * @param {object?} parent
713
+ * @return {object}
714
+ */ function comment(value, root, parent) {
715
+ return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0);
716
+ }
717
+ /**
718
+ * @param {string} value
719
+ * @param {object} root
720
+ * @param {object?} parent
721
+ * @param {number} length
722
+ * @return {object}
723
+ */ function declaration(value, root, parent, length) {
724
+ return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length);
725
+ }
726
+
727
+ /**
728
+ * @param {string} value
729
+ * @param {number} length
730
+ * @return {string}
731
+ */ function prefix(value, length) {
732
+ switch(hash(value, length)){
733
+ // color-adjust
734
+ case 5103:
735
+ return WEBKIT + "print-" + value + value;
736
+ // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
737
+ case 5737:
738
+ case 4201:
739
+ case 3177:
740
+ case 3433:
741
+ case 1641:
742
+ case 4457:
743
+ case 2921:
744
+ // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
745
+ case 5572:
746
+ case 6356:
747
+ case 5844:
748
+ case 3191:
749
+ case 6645:
750
+ case 3005:
751
+ // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
752
+ case 6391:
753
+ case 5879:
754
+ case 5623:
755
+ case 6135:
756
+ case 4599:
757
+ case 4855:
758
+ // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
759
+ case 4215:
760
+ case 6389:
761
+ case 5109:
762
+ case 5365:
763
+ case 5621:
764
+ case 3829:
765
+ return WEBKIT + value + value;
766
+ // appearance, user-select, transform, hyphens, text-size-adjust
767
+ case 5349:
768
+ case 4246:
769
+ case 4810:
770
+ case 6968:
771
+ case 2756:
772
+ return WEBKIT + value + MOZ + value + MS + value + value;
773
+ // flex, flex-direction
774
+ case 6828:
775
+ case 4268:
776
+ return WEBKIT + value + MS + value + value;
777
+ // order
778
+ case 6165:
779
+ return WEBKIT + value + MS + "flex-" + value + value;
780
+ // align-items
781
+ case 5187:
782
+ return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + "box-$1$2" + MS + "flex-$1$2") + value;
783
+ // align-self
784
+ case 5443:
785
+ return WEBKIT + value + MS + "flex-item-" + replace(value, /flex-|-self/, "") + value;
786
+ // align-content
787
+ case 4675:
788
+ return WEBKIT + value + MS + "flex-line-pack" + replace(value, /align-content|flex-|-self/, "") + value;
789
+ // flex-shrink
790
+ case 5548:
791
+ return WEBKIT + value + MS + replace(value, "shrink", "negative") + value;
792
+ // flex-basis
793
+ case 5292:
794
+ return WEBKIT + value + MS + replace(value, "basis", "preferred-size") + value;
795
+ // flex-grow
796
+ case 6060:
797
+ return WEBKIT + "box-" + replace(value, "-grow", "") + WEBKIT + value + MS + replace(value, "grow", "positive") + value;
798
+ // transition
799
+ case 4554:
800
+ return WEBKIT + replace(value, /([^-])(transform)/g, "$1" + WEBKIT + "$2") + value;
801
+ // cursor
802
+ case 6187:
803
+ return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + "$1"), /(image-set)/, WEBKIT + "$1"), value, "") + value;
804
+ // background, background-image
805
+ case 5495:
806
+ case 3959:
807
+ return replace(value, /(image-set\([^]*)/, WEBKIT + "$1" + "$`$1");
808
+ // justify-content
809
+ case 4968:
810
+ return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + "box-pack:$3" + MS + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + WEBKIT + value + value;
811
+ // (margin|padding)-inline-(start|end)
812
+ case 4095:
813
+ case 3583:
814
+ case 4068:
815
+ case 2532:
816
+ return replace(value, /(.+)-inline(.+)/, WEBKIT + "$1$2") + value;
817
+ // (min|max)?(width|height|inline-size|block-size)
818
+ case 8116:
819
+ case 7059:
820
+ case 5753:
821
+ case 5535:
822
+ case 5445:
823
+ case 5701:
824
+ case 4933:
825
+ case 4677:
826
+ case 5533:
827
+ case 5789:
828
+ case 5021:
829
+ case 4765:
830
+ // stretch, max-content, min-content, fill-available
831
+ if (strlen(value) - 1 - length > 6) switch(charat(value, length + 1)){
832
+ // (m)ax-content, (m)in-content
833
+ case 109:
834
+ // -
835
+ if (charat(value, length + 4) !== 45) break;
836
+ // (f)ill-available, (f)it-content
837
+ case 102:
838
+ return replace(value, /(.+:)(.+)-([^]+)/, "$1" + WEBKIT + "$2-$3" + "$1" + MOZ + (charat(value, length + 3) == 108 ? "$3" : "$2-$3")) + value;
839
+ // (s)tretch
840
+ case 115:
841
+ return ~indexof(value, "stretch") ? prefix(replace(value, "stretch", "fill-available"), length) + value : value;
842
+ }
843
+ break;
844
+ // position: sticky
845
+ case 4949:
846
+ // (s)ticky?
847
+ if (charat(value, length + 1) !== 115) break;
848
+ // display: (flex|inline-flex)
849
+ case 6444:
850
+ switch(charat(value, strlen(value) - 3 - (~indexof(value, "!important") && 10))){
851
+ // stic(k)y
852
+ case 107:
853
+ return replace(value, ":", ":" + WEBKIT) + value;
854
+ // (inline-)?fl(e)x
855
+ case 101:
856
+ return replace(value, /(.+:)([^;!]+)(;|!.+)?/, "$1" + WEBKIT + (charat(value, 14) === 45 ? "inline-" : "") + "box$3" + "$1" + WEBKIT + "$2$3" + "$1" + MS + "$2box$3") + value;
857
+ }
858
+ break;
859
+ // writing-mode
860
+ case 5936:
861
+ switch(charat(value, length + 11)){
862
+ // vertical-l(r)
863
+ case 114:
864
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb") + value;
865
+ // vertical-r(l)
866
+ case 108:
867
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb-rl") + value;
868
+ // horizontal(-)tb
869
+ case 45:
870
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "lr") + value;
871
+ }
872
+ return WEBKIT + value + MS + value + value;
873
+ }
874
+ return value;
875
+ }
876
+
877
+ /**
878
+ * @param {object[]} children
879
+ * @param {function} callback
880
+ * @return {string}
881
+ */ function serialize(children, callback) {
882
+ var output = "";
883
+ var length = sizeof(children);
884
+ for(var i = 0; i < length; i++)output += callback(children[i], i, children, callback) || "";
885
+ return output;
886
+ }
887
+ /**
888
+ * @param {object} element
889
+ * @param {number} index
890
+ * @param {object[]} children
891
+ * @param {function} callback
892
+ * @return {string}
893
+ */ function stringify(element, index, children, callback) {
894
+ switch(element.type){
895
+ case IMPORT:
896
+ case DECLARATION:
897
+ return element.return = element.return || element.value;
898
+ case COMMENT:
899
+ return "";
900
+ case KEYFRAMES:
901
+ return element.return = element.value + "{" + serialize(element.children, callback) + "}";
902
+ case RULESET:
903
+ element.value = element.props.join(",");
904
+ }
905
+ return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
906
+ }
907
+
908
+ /**
909
+ * @param {function[]} collection
910
+ * @return {function}
911
+ */ function middleware(collection) {
912
+ var length = sizeof(collection);
913
+ return function(element, index, children, callback) {
914
+ var output = "";
915
+ for(var i = 0; i < length; i++)output += collection[i](element, index, children, callback) || "";
916
+ return output;
917
+ };
918
+ }
919
+ /**
920
+ * @param {function} callback
921
+ * @return {function}
922
+ */ function rulesheet(callback) {
923
+ return function(element) {
924
+ if (!element.root) {
925
+ if (element = element.return) callback(element);
926
+ }
927
+ };
928
+ }
929
+ /**
930
+ * @param {object} element
931
+ * @param {number} index
932
+ * @param {object[]} children
933
+ * @param {function} callback
934
+ */ function prefixer(element, index, children, callback) {
935
+ if (element.length > -1) {
936
+ if (!element.return) switch(element.type){
937
+ case DECLARATION:
938
+ element.return = prefix(element.value, element.length);
939
+ break;
940
+ case KEYFRAMES:
941
+ return serialize([
942
+ copy(element, {
943
+ value: replace(element.value, "@", "@" + WEBKIT)
944
+ })
945
+ ], callback);
946
+ case RULESET:
947
+ if (element.length) return combine(element.props, function(value) {
948
+ switch(match(value, /(::plac\w+|:read-\w+)/)){
949
+ // :read-(only|write)
950
+ case ":read-only":
951
+ case ":read-write":
952
+ return serialize([
953
+ copy(element, {
954
+ props: [
955
+ replace(value, /:(read-\w+)/, ":" + MOZ + "$1")
956
+ ]
957
+ })
958
+ ], callback);
959
+ // :placeholder
960
+ case "::placeholder":
961
+ return serialize([
962
+ copy(element, {
963
+ props: [
964
+ replace(value, /:(plac\w+)/, ":" + WEBKIT + "input-$1")
965
+ ]
966
+ }),
967
+ copy(element, {
968
+ props: [
969
+ replace(value, /:(plac\w+)/, ":" + MOZ + "$1")
970
+ ]
971
+ }),
972
+ copy(element, {
973
+ props: [
974
+ replace(value, /:(plac\w+)/, MS + "input-$1")
975
+ ]
976
+ })
977
+ ], callback);
978
+ }
979
+ return "";
980
+ });
981
+ }
982
+ }
983
+ }
984
+
985
+ var weakMemoize = function weakMemoize(func) {
986
+ // $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps
987
+ var cache = new WeakMap();
988
+ return function(arg) {
989
+ if (cache.has(arg)) {
990
+ // $FlowFixMe
991
+ return cache.get(arg);
992
+ }
993
+ var ret = func(arg);
994
+ cache.set(arg, ret);
995
+ return ret;
996
+ };
997
+ };
998
+
999
+ function memoize(fn) {
1000
+ var cache = {};
1001
+ return function(arg) {
1002
+ if (cache[arg] === undefined) cache[arg] = fn(arg);
1003
+ return cache[arg];
1004
+ };
1005
+ }
1006
+
1007
+ var last = function last(arr) {
1008
+ return arr.length ? arr[arr.length - 1] : null;
1009
+ }; // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244
1010
+ var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
1011
+ var previous = 0;
1012
+ var character = 0;
1013
+ while(true){
1014
+ previous = character;
1015
+ character = peek(); // &\f
1016
+ if (previous === 38 && character === 12) {
1017
+ points[index] = 1;
1018
+ }
1019
+ if (token(character)) {
1020
+ break;
1021
+ }
1022
+ next();
1023
+ }
1024
+ return slice(begin, position);
1025
+ };
1026
+ var toRules = function toRules(parsed, points) {
1027
+ // pretend we've started with a comma
1028
+ var index = -1;
1029
+ var character = 44;
1030
+ do {
1031
+ switch(token(character)){
1032
+ case 0:
1033
+ // &\f
1034
+ if (character === 38 && peek() === 12) {
1035
+ // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
1036
+ // stylis inserts \f after & to know when & where it should replace this sequence with the context selector
1037
+ // and when it should just concatenate the outer and inner selectors
1038
+ // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
1039
+ points[index] = 1;
1040
+ }
1041
+ parsed[index] += identifierWithPointTracking(position - 1, points, index);
1042
+ break;
1043
+ case 2:
1044
+ parsed[index] += delimit(character);
1045
+ break;
1046
+ case 4:
1047
+ // comma
1048
+ if (character === 44) {
1049
+ // colon
1050
+ parsed[++index] = peek() === 58 ? "&\f" : "";
1051
+ points[index] = parsed[index].length;
1052
+ break;
1053
+ }
1054
+ // fallthrough
1055
+ default:
1056
+ parsed[index] += from(character);
1057
+ }
1058
+ }while (character = next());
1059
+ return parsed;
1060
+ };
1061
+ var getRules = function getRules(value, points) {
1062
+ return dealloc(toRules(alloc(value), points));
1063
+ }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
1064
+ var fixedElements = /* #__PURE__ */ new WeakMap();
1065
+ var compat = function compat(element) {
1066
+ if (element.type !== "rule" || !element.parent || // negative .length indicates that this rule has been already prefixed
1067
+ element.length < 1) {
1068
+ return;
1069
+ }
1070
+ var value = element.value, parent = element.parent;
1071
+ var isImplicitRule = element.column === parent.column && element.line === parent.line;
1072
+ while(parent.type !== "rule"){
1073
+ parent = parent.parent;
1074
+ if (!parent) return;
1075
+ } // short-circuit for the simplest case
1076
+ if (element.props.length === 1 && value.charCodeAt(0) !== 58 && !fixedElements.get(parent)) {
1077
+ return;
1078
+ } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
1079
+ // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
1080
+ if (isImplicitRule) {
1081
+ return;
1082
+ }
1083
+ fixedElements.set(element, true);
1084
+ var points = [];
1085
+ var rules = getRules(value, points);
1086
+ var parentRules = parent.props;
1087
+ for(var i = 0, k = 0; i < rules.length; i++){
1088
+ for(var j = 0; j < parentRules.length; j++, k++){
1089
+ element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
1090
+ }
1091
+ }
1092
+ };
1093
+ var removeLabel = function removeLabel(element) {
1094
+ if (element.type === "decl") {
1095
+ var value = element.value;
1096
+ if (value.charCodeAt(0) === 108 && value.charCodeAt(2) === 98) {
1097
+ // this ignores label
1098
+ element["return"] = "";
1099
+ element.value = "";
1100
+ }
1101
+ }
1102
+ };
1103
+ var ignoreFlag = "emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason";
1104
+ var isIgnoringComment = function isIgnoringComment(element) {
1105
+ return !!element && element.type === "comm" && element.children.indexOf(ignoreFlag) > -1;
1106
+ };
1107
+ var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
1108
+ return function(element, index, children) {
1109
+ if (element.type !== "rule") return;
1110
+ var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
1111
+ if (unsafePseudoClasses && cache.compat !== true) {
1112
+ var prevElement = index > 0 ? children[index - 1] : null;
1113
+ if (prevElement && isIgnoringComment(last(prevElement.children))) {
1114
+ return;
1115
+ }
1116
+ unsafePseudoClasses.forEach(function(unsafePseudoClass) {
1117
+ console.error('The pseudo class "' + unsafePseudoClass + '" is potentially unsafe when doing server-side rendering. Try changing it to "' + unsafePseudoClass.split("-child")[0] + '-of-type".');
1118
+ });
1119
+ }
1120
+ };
1121
+ };
1122
+ var isImportRule = function isImportRule(element) {
1123
+ return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
1124
+ };
1125
+ var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
1126
+ for(var i = index - 1; i >= 0; i--){
1127
+ if (!isImportRule(children[i])) {
1128
+ return true;
1129
+ }
1130
+ }
1131
+ return false;
1132
+ }; // use this to remove incorrect elements from further processing
1133
+ // so they don't get handed to the `sheet` (or anything else)
1134
+ // as that could potentially lead to additional logs which in turn could be overhelming to the user
1135
+ var nullifyElement = function nullifyElement(element) {
1136
+ element.type = "";
1137
+ element.value = "";
1138
+ element["return"] = "";
1139
+ element.children = "";
1140
+ element.props = "";
1141
+ };
1142
+ var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
1143
+ if (!isImportRule(element)) {
1144
+ return;
1145
+ }
1146
+ if (element.parent) {
1147
+ 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.");
1148
+ nullifyElement(element);
1149
+ } else if (isPrependedWithRegularRules(index, children)) {
1150
+ console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
1151
+ nullifyElement(element);
1152
+ }
1153
+ };
1154
+ var isBrowser = typeof document !== "undefined";
1155
+ var getServerStylisCache = isBrowser ? undefined : weakMemoize(function() {
1156
+ return memoize(function() {
1157
+ var cache = {};
1158
+ return function(name) {
1159
+ return cache[name];
1160
+ };
1161
+ });
1162
+ });
1163
+ var defaultStylisPlugins = [
1164
+ prefixer
1165
+ ];
1166
+ var createCache = function createCache(options) {
1167
+ var key = options.key;
1168
+ if (process.env.NODE_ENV !== "production" && !key) {
1169
+ 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.');
1170
+ }
1171
+ if (isBrowser && key === "css") {
1172
+ var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
1173
+ // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
1174
+ // note this very very intentionally targets all style elements regardless of the key to ensure
1175
+ // that creating a cache works inside of render of a React component
1176
+ Array.prototype.forEach.call(ssrStyles, function(node) {
1177
+ // we want to only move elements which have a space in the data-emotion attribute value
1178
+ // because that indicates that it is an Emotion 11 server-side rendered style elements
1179
+ // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
1180
+ // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
1181
+ // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
1182
+ // will not result in the Emotion 10 styles being destroyed
1183
+ var dataEmotionAttribute = node.getAttribute("data-emotion");
1184
+ if (dataEmotionAttribute.indexOf(" ") === -1) {
1185
+ return;
1186
+ }
1187
+ document.head.appendChild(node);
1188
+ node.setAttribute("data-s", "");
1189
+ });
1190
+ }
1191
+ var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
1192
+ if (process.env.NODE_ENV !== "production") {
1193
+ // $FlowFixMe
1194
+ if (/[^a-z-]/.test(key)) {
1195
+ throw new Error('Emotion key must only contain lower case alphabetical characters and - but "' + key + '" was passed');
1196
+ }
1197
+ }
1198
+ var inserted = {}; // $FlowFixMe
1199
+ var container;
1200
+ var nodesToHydrate = [];
1201
+ if (isBrowser) {
1202
+ container = options.container || document.head;
1203
+ Array.prototype.forEach.call(// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
1204
+ document.querySelectorAll('style[data-emotion^="' + key + ' "]'), function(node) {
1205
+ var attrib = node.getAttribute("data-emotion").split(" "); // $FlowFixMe
1206
+ for(var i = 1; i < attrib.length; i++){
1207
+ inserted[attrib[i]] = true;
1208
+ }
1209
+ nodesToHydrate.push(node);
1210
+ });
1211
+ }
1212
+ var _insert;
1213
+ var omnipresentPlugins = [
1214
+ compat,
1215
+ removeLabel
1216
+ ];
1217
+ if (process.env.NODE_ENV !== "production") {
1218
+ omnipresentPlugins.push(createUnsafeSelectorsAlarm({
1219
+ get compat () {
1220
+ return cache.compat;
1221
+ }
1222
+ }), incorrectImportAlarm);
1223
+ }
1224
+ if (isBrowser) {
1225
+ var currentSheet;
1226
+ var finalizingPlugins = [
1227
+ stringify,
1228
+ process.env.NODE_ENV !== "production" ? function(element) {
1229
+ if (!element.root) {
1230
+ if (element["return"]) {
1231
+ currentSheet.insert(element["return"]);
1232
+ } else if (element.value && element.type !== COMMENT) {
1233
+ // insert empty rule in non-production environments
1234
+ // so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
1235
+ currentSheet.insert(element.value + "{}");
1236
+ }
1237
+ }
1238
+ } : rulesheet(function(rule) {
1239
+ currentSheet.insert(rule);
1240
+ })
1241
+ ];
1242
+ var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
1243
+ var stylis = function stylis(styles) {
1244
+ return serialize(compile(styles), serializer);
1245
+ };
1246
+ _insert = function insert(selector, serialized, sheet, shouldCache) {
1247
+ currentSheet = sheet;
1248
+ if (process.env.NODE_ENV !== "production" && serialized.map !== undefined) {
1249
+ currentSheet = {
1250
+ insert: function insert(rule) {
1251
+ sheet.insert(rule + serialized.map);
1252
+ }
1253
+ };
1254
+ }
1255
+ stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
1256
+ if (shouldCache) {
1257
+ cache.inserted[serialized.name] = true;
1258
+ }
1259
+ };
1260
+ } else {
1261
+ var _finalizingPlugins = [
1262
+ stringify
1263
+ ];
1264
+ var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
1265
+ var _stylis = function _stylis(styles) {
1266
+ return serialize(compile(styles), _serializer);
1267
+ }; // $FlowFixMe
1268
+ var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
1269
+ var getRules1 = function getRules(selector, serialized) {
1270
+ var name = serialized.name;
1271
+ if (serverStylisCache[name] === undefined) {
1272
+ serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
1273
+ }
1274
+ return serverStylisCache[name];
1275
+ };
1276
+ _insert = function _insert(selector, serialized, sheet, shouldCache) {
1277
+ var name = serialized.name;
1278
+ var rules = getRules1(selector, serialized);
1279
+ if (cache.compat === undefined) {
1280
+ // in regular mode, we don't set the styles on the inserted cache
1281
+ // since we don't need to and that would be wasting memory
1282
+ // we return them so that they are rendered in a style tag
1283
+ if (shouldCache) {
1284
+ cache.inserted[name] = true;
1285
+ }
1286
+ if (// because if people do ssr in tests, the source maps showing up would be annoying
1287
+ process.env.NODE_ENV === "development" && serialized.map !== undefined) {
1288
+ return rules + serialized.map;
1289
+ }
1290
+ return rules;
1291
+ } else {
1292
+ // in compat mode, we put the styles on the inserted cache so
1293
+ // that emotion-server can pull out the styles
1294
+ // except when we don't want to cache it which was in Global but now
1295
+ // is nowhere but we don't want to do a major right now
1296
+ // and just in case we're going to leave the case here
1297
+ // it's also not affecting client side bundle size
1298
+ // so it's really not a big deal
1299
+ if (shouldCache) {
1300
+ cache.inserted[name] = rules;
1301
+ } else {
1302
+ return rules;
1303
+ }
1304
+ }
1305
+ };
1306
+ }
1307
+ var cache = {
1308
+ key: key,
1309
+ sheet: new StyleSheet1({
1310
+ key: key,
1311
+ container: container,
1312
+ nonce: options.nonce,
1313
+ speedy: options.speedy,
1314
+ prepend: options.prepend,
1315
+ insertionPoint: options.insertionPoint
1316
+ }),
1317
+ nonce: options.nonce,
1318
+ inserted: inserted,
1319
+ registered: {},
1320
+ insert: _insert
1321
+ };
1322
+ cache.sheet.hydrate(nodesToHydrate);
1323
+ return cache;
1324
+ };
1325
+ var createCache$1 = createCache;
1326
+
1327
+ /**
1328
+ * prepend: true moves MUI styles to the top of the <head> so they're loaded first.
1329
+ * It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
1330
+ */ function createEmotionCache() {
1331
+ return createCache$1({
1332
+ key: "css",
1333
+ prepend: true
1334
+ });
1335
+ }
1336
+
1337
+ function _taggedTemplateLiteral(strings, raw) {
1338
+ if (!raw) {
1339
+ raw = strings.slice(0);
1340
+ }
1341
+ return Object.freeze(Object.defineProperties(strings, {
1342
+ raw: {
1343
+ value: Object.freeze(raw)
1344
+ }
1345
+ }));
1346
+ }
1347
+ function _templateObject() {
1348
+ var data = _taggedTemplateLiteral([
1349
+ "\n ",
1350
+ "\n "
1351
+ ]);
1352
+ _templateObject = function _templateObject() {
1353
+ return data;
1354
+ };
1355
+ return data;
1356
+ }
1357
+ // client-side cache, shared for the whole session of the user in the browser.
1358
+ var clientSideEmotionCache = createEmotionCache();
1359
+ /**
1360
+ * App theme with `emotion` (good for `@mui`)s
1361
+ */ var AppThemeEmotion = function(param) {
1362
+ var _emotionCache = param.emotionCache, emotionCache = _emotionCache === void 0 ? clientSideEmotionCache : _emotionCache, theme = param.theme, children = param.children;
1363
+ return /*#__PURE__*/ React.createElement(react.CacheProvider, {
1364
+ value: emotionCache
1365
+ }, /*#__PURE__*/ React.createElement(styles.ThemeProvider, {
1366
+ theme: theme
1367
+ }, /*#__PURE__*/ React.createElement(CssBaseline__default["default"], null), /*#__PURE__*/ React.createElement(react.Global, {
1368
+ styles: react.css(_templateObject(), react$1.stylesGlobal)
1369
+ }), children));
1370
+ };
1371
+
1372
+ function _extends$d() {
1373
+ _extends$d = Object.assign || function(target) {
1374
+ for(var i = 1; i < arguments.length; i++){
1375
+ var source = arguments[i];
1376
+ for(var key in source){
1377
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1378
+ target[key] = source[key];
1379
+ }
1380
+ }
1381
+ }
1382
+ return target;
1383
+ };
1384
+ return _extends$d.apply(this, arguments);
1385
+ }
1386
+ var defaults = {
1387
+ tplTitle: ""
1388
+ };
1389
+ /**
1390
+ * We do a couple of things in addition while many other are removed.
1391
+ *
1392
+ * - Add `seo` meta object coming from a CMS probably
1393
+ * - Add `ogimage` and `openGraph.image` as single image source
1394
+ * - Add `og` alias to define `openGraph`
1395
+ * - Add check for `title` equale to `templateTitle` to avoid meta titles like
1396
+ * "My site | My site" often happening in homepages
1397
+ * - Remove the open graph videos and images
1398
+ *
1399
+ * - Shorter code
1400
+ *
1401
+ * @returns
1402
+ */ var buildTags = function() {
1403
+ var ref2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, seo = ref2.seo, hidden = ref2.hidden, keywords = ref2.keywords, _title = ref2.title, title = _title === void 0 ? "" : _title, titleTemplate = ref2.titleTemplate, defaultTitle = ref2.defaultTitle, noindex = ref2.noindex, nofollow = ref2.nofollow, description = ref2.description, _languageAlternates = ref2.languageAlternates, languageAlternates = _languageAlternates === void 0 ? [] : _languageAlternates, twitter = ref2.twitter, facebook = ref2.facebook, openGraph = ref2.openGraph, ogAlias = ref2.og, canonical = ref2.canonical, metaTags = ref2.metaTags, linkTags = ref2.linkTags;
1404
+ var render = [];
1405
+ var $names = {};
1406
+ var $properties = {};
1407
+ if (titleTemplate) {
1408
+ defaults.tplTitle = titleTemplate;
1409
+ }
1410
+ title = title || (seo === null || seo === void 0 ? void 0 : seo.title) || "";
1411
+ if (title) {
1412
+ if (defaults.tplTitle && defaults.tplTitle !== title) {
1413
+ title = defaults.tplTitle.replace(/%s/g, title);
1414
+ }
1415
+ } else if (defaultTitle) {
1416
+ title = defaultTitle;
1417
+ }
1418
+ if (title) {
1419
+ render.push(/*#__PURE__*/ React.createElement("title", {
1420
+ key: "title"
1421
+ }, title));
1422
+ $properties["og:title"] = title; // overridden later...
1423
+ }
1424
+ $names["robots"] = "".concat(noindex || hidden ? "noindex" : "index", ",").concat(nofollow || hidden ? "nofollow" : "follow");
1425
+ description = description || (seo === null || seo === void 0 ? void 0 : seo.description);
1426
+ if (description) {
1427
+ $names["description"] = description;
1428
+ $properties["og:description"] = description; // overridden later...
1429
+ }
1430
+ keywords = keywords || (seo === null || seo === void 0 ? void 0 : seo.keywords);
1431
+ if (keywords) {
1432
+ $names["keywords"] = utils.isArray(keywords) ? keywords.join(", ") : keywords;
1433
+ }
1434
+ if ((languageAlternates === null || languageAlternates === void 0 ? void 0 : languageAlternates.length) > 0) {
1435
+ languageAlternates.forEach(function(languageAlternate) {
1436
+ render.push(/*#__PURE__*/ React.createElement("link", {
1437
+ rel: "alternate",
1438
+ key: "languageAlternate-".concat(languageAlternate.hrefLang),
1439
+ hrefLang: languageAlternate.hrefLang,
1440
+ href: languageAlternate.href
1441
+ }));
1442
+ });
1443
+ }
1444
+ if (canonical) {
1445
+ render.push(/*#__PURE__*/ React.createElement("link", {
1446
+ rel: "canonical",
1447
+ href: canonical,
1448
+ key: "canonical"
1449
+ }));
1450
+ $properties["og:url"] = canonical;
1451
+ }
1452
+ if (facebook === null || facebook === void 0 ? void 0 : facebook.appId) $properties["fb:app_id"] = facebook.appId;
1453
+ if (twitter) {
1454
+ if (twitter.cardType) $names["twitter:card"] = twitter.cardType;
1455
+ if (twitter.site) $names["twitter:site"] = twitter.site;
1456
+ if (twitter.handle) $names["twitter:creator"] = twitter.handle;
1457
+ }
1458
+ var og = ogAlias || openGraph;
1459
+ if (og === null || og === void 0 ? void 0 : og.title) $properties["og:title"] = og === null || og === void 0 ? void 0 : og.title;
1460
+ if (og === null || og === void 0 ? void 0 : og.description) $properties["og:description"] = og === null || og === void 0 ? void 0 : og.description;
1461
+ if (og === null || og === void 0 ? void 0 : og.url) $properties["og:url"] = og.url;
1462
+ if (og === null || og === void 0 ? void 0 : og.type) $properties["og:type"] = og.type.toLowerCase();
1463
+ if (og === null || og === void 0 ? void 0 : og.locale) $properties["og:locale"] = og.locale;
1464
+ if (og === null || og === void 0 ? void 0 : og.site_name) $properties["og:site_name"] = og.site_name;
1465
+ var ogimage = (og === null || og === void 0 ? void 0 : og.image) || (seo === null || seo === void 0 ? void 0 : seo.ogimage);
1466
+ if (ogimage) $properties["og:image"] = ogimage;
1467
+ Object.keys($names).forEach(function(key) {
1468
+ render.push(/*#__PURE__*/ React.createElement("meta", {
1469
+ key: key,
1470
+ name: key,
1471
+ content: $names[key]
1472
+ }));
1473
+ });
1474
+ Object.keys($properties).forEach(function(key) {
1475
+ render.push(/*#__PURE__*/ React.createElement("meta", {
1476
+ key: key,
1477
+ property: key,
1478
+ content: $properties[key]
1479
+ }));
1480
+ });
1481
+ if (metaTags && metaTags.length > 0) {
1482
+ metaTags.forEach(function(tag) {
1483
+ var _keyOverride, ref, ref1;
1484
+ render.push(/*#__PURE__*/ React.createElement("meta", _extends$d({
1485
+ key: "meta:".concat((ref1 = (ref = (_keyOverride = tag.keyOverride) !== null && _keyOverride !== void 0 ? _keyOverride : tag.name) !== null && ref !== void 0 ? ref : tag.property) !== null && ref1 !== void 0 ? ref1 : tag.httpEquiv)
1486
+ }, tag)));
1487
+ });
1488
+ }
1489
+ if (linkTags === null || linkTags === void 0 ? void 0 : linkTags.length) {
1490
+ linkTags.forEach(function(tag) {
1491
+ var _keyOverride;
1492
+ render.push(/*#__PURE__*/ React.createElement("link", _extends$d({
1493
+ key: "link".concat((_keyOverride = tag.keyOverride) !== null && _keyOverride !== void 0 ? _keyOverride : tag.href).concat(tag.rel)
1494
+ }, tag)));
1495
+ });
1496
+ }
1497
+ // TODO: alternates and canonical
1498
+ // canonical = 'https://www.domain.com/';
1499
+ // languageAlternates={[{
1500
+ // hrefLang: 'en',
1501
+ // href: 'https://www.domain.com/en',
1502
+ // }]}
1503
+ // <link rel="alternate" hreflang="x-default" href="https://www.domain.com/nl/">
1504
+ // <link rel="alternate" hreflang="nl" href="https://www.domain.com/nl/">
1505
+ // <link rel="alternate" hreflang="en" href="https://www.domain.com/en/">
1506
+ return render;
1507
+ };
1508
+
1509
+ var _Seo = function(props) {
1510
+ return /*#__PURE__*/ React.createElement(Head__default["default"], null, buildTags(props));
1511
+ };
1512
+ var Seo = /*#__PURE__*/ React$1.memo(_Seo);
1513
+
1514
+ var _SeoDefaults = function(props) {
1515
+ // const router = useRouter();
1516
+ // props.openGraph.url = getSiteUrl(router.asPath);
1517
+ return /*#__PURE__*/ React.createElement(Head__default["default"], null, buildTags(props));
1518
+ };
1519
+ var SeoDefaults = /*#__PURE__*/ React$1.memo(_SeoDefaults);
1520
+
1521
+ function _arrayLikeToArray$7(arr, len) {
1522
+ if (len == null || len > arr.length) len = arr.length;
1523
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1524
+ return arr2;
1525
+ }
1526
+ function _arrayWithHoles$7(arr) {
1527
+ if (Array.isArray(arr)) return arr;
1528
+ }
1529
+ function _iterableToArrayLimit$7(arr, i) {
1530
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1531
+ if (_i == null) return;
1532
+ var _arr = [];
1533
+ var _n = true;
1534
+ var _d = false;
1535
+ var _s, _e;
1536
+ try {
1537
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1538
+ _arr.push(_s.value);
1539
+ if (i && _arr.length === i) break;
1540
+ }
1541
+ } catch (err) {
1542
+ _d = true;
1543
+ _e = err;
1544
+ } finally{
1545
+ try {
1546
+ if (!_n && _i["return"] != null) _i["return"]();
1547
+ } finally{
1548
+ if (_d) throw _e;
1549
+ }
1550
+ }
1551
+ return _arr;
1552
+ }
1553
+ function _nonIterableRest$7() {
1554
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1555
+ }
1556
+ function _slicedToArray$7(arr, i) {
1557
+ return _arrayWithHoles$7(arr) || _iterableToArrayLimit$7(arr, i) || _unsupportedIterableToArray$7(arr, i) || _nonIterableRest$7();
1558
+ }
1559
+ function _unsupportedIterableToArray$7(o, minLen) {
1560
+ if (!o) return;
1561
+ if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
1562
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1563
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1564
+ if (n === "Map" || n === "Set") return Array.from(n);
1565
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
1566
+ }
1567
+ var NextProgress = function(param1) {
1568
+ param1.startAt; var _showOnShallow = param1.showOnShallow, showOnShallow = _showOnShallow === void 0 ? true : _showOnShallow, _stopDelayMs = param1.stopDelayMs, stopDelayMs = _stopDelayMs === void 0 ? 200 : _stopDelayMs;
1569
+ var events = router.useRouter().events;
1570
+ // const [progress, setProgress] = useState(0);
1571
+ var ref = _slicedToArray$7(React$1.useState(false), 2), running = ref[0], setRunning = ref[1];
1572
+ var timer = React$1.useRef(null);
1573
+ var routeChangeStart = React$1.useCallback(function(_, param) {
1574
+ var shallow = param.shallow;
1575
+ if (!shallow || showOnShallow) {
1576
+ // setProgress(startAt);
1577
+ setRunning(true);
1578
+ }
1579
+ }, [
1580
+ showOnShallow
1581
+ ]);
1582
+ var routeChangeEnd = React$1.useCallback(function(_, param) {
1583
+ var shallow = param.shallow;
1584
+ if (!shallow || showOnShallow) {
1585
+ if (timer.current) {
1586
+ clearTimeout(timer.current);
1587
+ }
1588
+ timer.current = setTimeout(function() {
1589
+ // setProgress(100);
1590
+ setRunning(false);
1591
+ }, stopDelayMs);
1592
+ }
1593
+ }, [
1594
+ showOnShallow,
1595
+ stopDelayMs,
1596
+ timer
1597
+ ]);
1598
+ React$1.useEffect(function() {
1599
+ events.on("routeChangeStart", routeChangeStart);
1600
+ events.on("routeChangeComplete", routeChangeEnd);
1601
+ events.on("routeChangeError", routeChangeEnd);
1602
+ return function() {
1603
+ events.off("routeChangeStart", routeChangeStart);
1604
+ events.off("routeChangeComplete", routeChangeEnd);
1605
+ events.off("routeChangeError", routeChangeEnd);
1606
+ };
1607
+ }, [
1608
+ events,
1609
+ routeChangeStart,
1610
+ routeChangeEnd
1611
+ ]);
1612
+ return /*#__PURE__*/ React.createElement(react$1.ProgressOverlay, {
1613
+ running: running
1614
+ });
1615
+ };
1616
+
1617
+ function _extends$c() {
1618
+ _extends$c = Object.assign || function(target) {
1619
+ for(var i = 1; i < arguments.length; i++){
1620
+ var source = arguments[i];
1621
+ for(var key in source){
1622
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1623
+ target[key] = source[key];
1624
+ }
1625
+ }
1626
+ }
1627
+ return target;
1628
+ };
1629
+ return _extends$c.apply(this, arguments);
1630
+ }
1631
+ /**
1632
+ * @see https://www.framer.com/docs/guide-reduce-bundle-size/
1633
+ */ var loadMotionFeatures = function() {
1634
+ return Promise.resolve().then(function () { return motionFeatures; }).then(function(m1) {
1635
+ return m1.default;
1636
+ });
1637
+ };
1638
+ /**
1639
+ * App main
1640
+ *
1641
+ * It implies a setup for `styled-components` and `framer-motion` libraries.
1642
+ *
1643
+ * About the page transition [wallis' blog post](https://wallis.dev/blog/nextjs-page-transitions-with-framer-motion)
1644
+ */ var AppMain = function(param) {
1645
+ var Component = param.Component, pageProps = param.pageProps, Layout = param.Layout, // theme,
1646
+ seo = param.seo, _transition = param.transition, transition = _transition === void 0 ? {
1647
+ initial: {
1648
+ opacity: 0
1649
+ },
1650
+ animate: {
1651
+ opacity: 1
1652
+ },
1653
+ exit: {
1654
+ opacity: 0
1655
+ }
1656
+ } : _transition, pre = param.pre, post = param.post;
1657
+ var pathname = router.useRouter().pathname;
1658
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(SeoDefaults, _extends$c({}, seo)), pre, /*#__PURE__*/ React.createElement(framerMotion.LazyMotion, {
1659
+ features: loadMotionFeatures
1660
+ }, /*#__PURE__*/ React.createElement(NextProgress, null), /*#__PURE__*/ React.createElement(Layout, null, /*#__PURE__*/ React.createElement(framerMotion.AnimatePresence, {
1661
+ exitBeforeEnter: true,
1662
+ initial: false
1663
+ }, /*#__PURE__*/ React.createElement(framerMotion.m.div, _extends$c({
1664
+ key: pathname
1665
+ }, transition), /*#__PURE__*/ React.createElement(Component, _extends$c({}, pageProps, {
1666
+ key: pathname
1667
+ })))))), post);
1668
+ };
1669
+
1670
+ function _extends$b() {
1671
+ _extends$b = Object.assign || function(target) {
1672
+ for(var i = 1; i < arguments.length; i++){
1673
+ var source = arguments[i];
1674
+ for(var key in source){
1675
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1676
+ target[key] = source[key];
1677
+ }
1678
+ }
1679
+ }
1680
+ return target;
1681
+ };
1682
+ return _extends$b.apply(this, arguments);
1683
+ }
1684
+ /**
1685
+ * App
1686
+ */ var AppEmotion = function(props) {
1687
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(AppHead, null), /*#__PURE__*/ React.createElement(AppThemeEmotion, _extends$b({}, props), /*#__PURE__*/ React.createElement(AppMain, _extends$b({}, props))));
1688
+ };
1689
+
1690
+ /**
1691
+ * App theme with `styled-components`
1692
+ */ var AppThemeSc = function(param) {
1693
+ var theme = param.theme, children = param.children;
1694
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(react$1.StylesGlobal, null), /*#__PURE__*/ React.createElement(styledComponents.ThemeProvider, {
1695
+ theme: theme
1696
+ }, children));
1697
+ };
1698
+
1699
+ function _extends$a() {
1700
+ _extends$a = Object.assign || function(target) {
1701
+ for(var i = 1; i < arguments.length; i++){
1702
+ var source = arguments[i];
1703
+ for(var key in source){
1704
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1705
+ target[key] = source[key];
1706
+ }
1707
+ }
1708
+ }
1709
+ return target;
1710
+ };
1711
+ return _extends$a.apply(this, arguments);
1712
+ }
1713
+ /**
1714
+ * App
1715
+ */ var AppBase = function(props) {
1716
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(AppHead, null), /*#__PURE__*/ React.createElement(AppThemeSc, _extends$a({}, props), /*#__PURE__*/ React.createElement(AppMain, _extends$a({}, props))));
1717
+ };
1718
+
1719
+ function _arrayLikeToArray$6(arr, len) {
1720
+ if (len == null || len > arr.length) len = arr.length;
1721
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1722
+ return arr2;
1723
+ }
1724
+ function _arrayWithHoles$6(arr) {
1725
+ if (Array.isArray(arr)) return arr;
1726
+ }
1727
+ function _arrayWithoutHoles$1(arr) {
1728
+ if (Array.isArray(arr)) return _arrayLikeToArray$6(arr);
1729
+ }
1730
+ function _extends$9() {
1731
+ _extends$9 = Object.assign || function(target) {
1732
+ for(var i = 1; i < arguments.length; i++){
1733
+ var source = arguments[i];
1734
+ for(var key in source){
1735
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1736
+ target[key] = source[key];
1737
+ }
1738
+ }
1739
+ }
1740
+ return target;
1741
+ };
1742
+ return _extends$9.apply(this, arguments);
1743
+ }
1744
+ function _iterableToArray$1(iter) {
1745
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1746
+ }
1747
+ function _iterableToArrayLimit$6(arr, i) {
1748
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1749
+ if (_i == null) return;
1750
+ var _arr = [];
1751
+ var _n = true;
1752
+ var _d = false;
1753
+ var _s, _e;
1754
+ try {
1755
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1756
+ _arr.push(_s.value);
1757
+ if (i && _arr.length === i) break;
1758
+ }
1759
+ } catch (err) {
1760
+ _d = true;
1761
+ _e = err;
1762
+ } finally{
1763
+ try {
1764
+ if (!_n && _i["return"] != null) _i["return"]();
1765
+ } finally{
1766
+ if (_d) throw _e;
1767
+ }
1768
+ }
1769
+ return _arr;
1770
+ }
1771
+ function _nonIterableRest$6() {
1772
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1773
+ }
1774
+ function _nonIterableSpread$1() {
1775
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1776
+ }
1777
+ function _slicedToArray$6(arr, i) {
1778
+ return _arrayWithHoles$6(arr) || _iterableToArrayLimit$6(arr, i) || _unsupportedIterableToArray$6(arr, i) || _nonIterableRest$6();
1779
+ }
1780
+ function _toConsumableArray$1(arr) {
1781
+ return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$6(arr) || _nonIterableSpread$1();
1782
+ }
1783
+ function _unsupportedIterableToArray$6(o, minLen) {
1784
+ if (!o) return;
1785
+ if (typeof o === "string") return _arrayLikeToArray$6(o, minLen);
1786
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1787
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1788
+ if (n === "Map" || n === "Set") return Array.from(n);
1789
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen);
1790
+ }
1791
+ var THEME_STORAGE_KEY = "theme";
1792
+ var colorSchemes = [
1793
+ "light",
1794
+ "dark"
1795
+ ];
1796
+ var MEDIA = "(prefers-color-scheme: dark)";
1797
+ var ThemeContext = /*#__PURE__*/ React$1.createContext({
1798
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
1799
+ setTheme: function(_) {},
1800
+ themes: []
1801
+ });
1802
+ var useTheme = function() {
1803
+ return React$1.useContext(ThemeContext);
1804
+ };
1805
+ var ThemeProvider = function(param) {
1806
+ var forcedTheme = param.forcedTheme, _disableTransitionOnChange = param.disableTransitionOnChange, disableTransitionOnChange = _disableTransitionOnChange === void 0 ? false : _disableTransitionOnChange, _enableSystem = param.enableSystem, enableSystem = _enableSystem === void 0 ? true : _enableSystem, _enableColorScheme = param.enableColorScheme, enableColorScheme = _enableColorScheme === void 0 ? true : _enableColorScheme, _themes = param.themes, themes = _themes === void 0 ? [
1807
+ "light",
1808
+ "dark"
1809
+ ] : _themes, _defaultTheme = param.defaultTheme, defaultTheme = _defaultTheme === void 0 ? enableSystem ? "system" : "light" : _defaultTheme, _attribute = param.attribute, attribute = _attribute === void 0 ? "data-theme" : _attribute, value = param.value, children = param.children, nonce = param.nonce;
1810
+ var ref = _slicedToArray$6(React$1.useState(function() {
1811
+ return getTheme(THEME_STORAGE_KEY, defaultTheme);
1812
+ }), 2), theme1 = ref[0], setThemeState = ref[1];
1813
+ var ref1 = _slicedToArray$6(React$1.useState(function() {
1814
+ return getTheme(THEME_STORAGE_KEY);
1815
+ }), 2), resolvedTheme = ref1[0], setResolvedTheme = ref1[1];
1816
+ var attrs = !value ? themes : Object.values(value);
1817
+ var applyTheme = React$1.useCallback(function(theme) {
1818
+ var resolved = theme;
1819
+ if (utils.isServer) return;
1820
+ // If theme is system, resolve it before setting theme
1821
+ if (theme === "system" && enableSystem) {
1822
+ resolved = getSystemTheme();
1823
+ }
1824
+ var name = value ? value[resolved] : resolved;
1825
+ var enable = disableTransitionOnChange ? disableAnimation() : null;
1826
+ var d = document.documentElement;
1827
+ if (attribute === "class") {
1828
+ var _classList;
1829
+ (_classList = d.classList).remove.apply(_classList, _toConsumableArray$1(attrs));
1830
+ if (name) d.classList.add(name);
1831
+ } else {
1832
+ if (name) {
1833
+ d.setAttribute(attribute, name);
1834
+ } else {
1835
+ d.removeAttribute(attribute);
1836
+ }
1837
+ }
1838
+ if (enableColorScheme) {
1839
+ var fallback = colorSchemes.includes(defaultTheme) ? defaultTheme : null;
1840
+ var colorScheme = colorSchemes.includes(resolved) ? resolved : fallback;
1841
+ d.style.colorScheme = colorScheme;
1842
+ }
1843
+ enable === null || enable === void 0 ? void 0 : enable();
1844
+ }, [
1845
+ attribute,
1846
+ attrs,
1847
+ defaultTheme,
1848
+ disableTransitionOnChange,
1849
+ enableColorScheme,
1850
+ enableSystem,
1851
+ value,
1852
+ ]);
1853
+ var setTheme = React$1.useCallback(function(theme) {
1854
+ setThemeState(theme);
1855
+ // Save to storage
1856
+ try {
1857
+ localStorage.setItem(THEME_STORAGE_KEY, theme);
1858
+ } catch (e) {
1859
+ // Unsupported
1860
+ }
1861
+ }, []);
1862
+ var handleMediaQuery = React$1.useCallback(function(e) {
1863
+ var resolved = getSystemTheme(e);
1864
+ setResolvedTheme(resolved);
1865
+ if (theme1 === "system" && enableSystem && !forcedTheme) {
1866
+ applyTheme("system");
1867
+ }
1868
+ }, [
1869
+ theme1,
1870
+ enableSystem,
1871
+ forcedTheme,
1872
+ applyTheme
1873
+ ]);
1874
+ // Always listen to System preference
1875
+ React$1.useEffect(function() {
1876
+ var media = window.matchMedia(MEDIA);
1877
+ // Intentionally use deprecated listener methods to support iOS & old browsers
1878
+ media.addListener(handleMediaQuery);
1879
+ handleMediaQuery(media);
1880
+ return function() {
1881
+ return media.removeListener(handleMediaQuery);
1882
+ };
1883
+ }, [
1884
+ handleMediaQuery
1885
+ ]);
1886
+ // localStorage event handling
1887
+ React$1.useEffect(function() {
1888
+ var handleStorage = function(e) {
1889
+ if (e.key !== THEME_STORAGE_KEY) {
1890
+ return;
1891
+ }
1892
+ // If default theme set, use it if localstorage === null (happens on local storage manual deletion)
1893
+ var theme = e.newValue || defaultTheme;
1894
+ setTheme(theme);
1895
+ };
1896
+ window.addEventListener("storage", handleStorage);
1897
+ return function() {
1898
+ return window.removeEventListener("storage", handleStorage);
1899
+ };
1900
+ }, [
1901
+ defaultTheme,
1902
+ setTheme
1903
+ ]);
1904
+ // Whenever theme or forcedTheme changes, apply it
1905
+ React$1.useEffect(function() {
1906
+ applyTheme(forcedTheme !== null && forcedTheme !== void 0 ? forcedTheme : theme1);
1907
+ }, [
1908
+ applyTheme,
1909
+ forcedTheme,
1910
+ theme1
1911
+ ]);
1912
+ return /*#__PURE__*/ React__default["default"].createElement(ThemeContext.Provider, {
1913
+ value: {
1914
+ theme: theme1,
1915
+ setTheme: setTheme,
1916
+ forcedTheme: forcedTheme,
1917
+ resolvedTheme: theme1 === "system" ? resolvedTheme : theme1,
1918
+ themes: enableSystem ? _toConsumableArray$1(themes).concat([
1919
+ "system"
1920
+ ]) : themes,
1921
+ systemTheme: enableSystem ? resolvedTheme : undefined
1922
+ }
1923
+ }, /*#__PURE__*/ React__default["default"].createElement(ThemeScript, _extends$9({}, {
1924
+ forcedTheme: forcedTheme,
1925
+ disableTransitionOnChange: disableTransitionOnChange,
1926
+ enableSystem: enableSystem,
1927
+ enableColorScheme: enableColorScheme,
1928
+ themes: themes,
1929
+ defaultTheme: defaultTheme,
1930
+ attribute: attribute,
1931
+ value: value,
1932
+ children: children,
1933
+ attrs: attrs,
1934
+ nonce: nonce
1935
+ })), children);
1936
+ };
1937
+ var ThemeScript = /*#__PURE__*/ React$1.memo(function(param) {
1938
+ var forcedTheme = param.forcedTheme, attribute = param.attribute, enableSystem = param.enableSystem, enableColorScheme = param.enableColorScheme, defaultTheme = param.defaultTheme, value = param.value, attrs = param.attrs, nonce = param.nonce;
1939
+ var defaultSystem = defaultTheme === "system";
1940
+ // Code-golfing the amount of characters in the script
1941
+ var optimization = function() {
1942
+ var removeClasses = "d.remove(".concat(attrs.map(function(t) {
1943
+ return "'".concat(t, "'");
1944
+ }).join(","), ")");
1945
+ return "var d=document.documentElement.classList;".concat(removeClasses, ";");
1946
+ }();
1947
+ var fallbackColorScheme = function() {
1948
+ if (!enableColorScheme) {
1949
+ return "";
1950
+ }
1951
+ var fallback = colorSchemes.includes(defaultTheme) ? defaultTheme : null;
1952
+ if (fallback) {
1953
+ return "if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'".concat(defaultTheme, "'");
1954
+ } else {
1955
+ return "if(e==='light'||e==='dark')d.style.colorScheme=e";
1956
+ }
1957
+ }();
1958
+ var updateDOM = function(name) {
1959
+ var literal = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, setColorScheme = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
1960
+ var resolvedName = value ? value[name] : name;
1961
+ var val = literal ? name + "|| ''" : "'".concat(resolvedName, "'");
1962
+ var text = "";
1963
+ // MUCH faster to set colorScheme alongside HTML attribute/class
1964
+ // as it only incurs 1 style recalculation rather than 2
1965
+ // This can save over 250ms of work for pages with big DOM
1966
+ if (enableColorScheme && setColorScheme && !literal && colorSchemes.includes(name)) {
1967
+ text += "d.style.colorScheme = '".concat(name, "';");
1968
+ }
1969
+ if (attribute === "class") {
1970
+ if (literal || resolvedName) {
1971
+ text += "d.add(".concat(val, ")");
1972
+ } else {
1973
+ text += "null";
1974
+ }
1975
+ } else {
1976
+ if (resolvedName) {
1977
+ text += "d[s](n, ".concat(val, ")");
1978
+ }
1979
+ }
1980
+ return text;
1981
+ };
1982
+ var scriptSrc = function() {
1983
+ if (forcedTheme) {
1984
+ return "!function(){".concat(optimization).concat(updateDOM(forcedTheme), "}()");
1985
+ }
1986
+ if (enableSystem) {
1987
+ return "!function(){try {".concat(optimization, "var e=localStorage.getItem('").concat(THEME_STORAGE_KEY, '\');if("system"===e||(!e&&').concat(defaultSystem, ')){var t="').concat(MEDIA, '",m=window.matchMedia(t);if(m.media!==t||m.matches){').concat(updateDOM("dark"), "}else{").concat(updateDOM("light"), "}}else if(e){").concat(value ? "var x=".concat(JSON.stringify(value), ";") : "").concat(updateDOM(value ? "x[e]" : "e", true), "}").concat(!defaultSystem ? "else{" + updateDOM(defaultTheme, false, false) + "}" : "").concat(fallbackColorScheme, "}catch(e){}}()");
1988
+ }
1989
+ return "!function(){try{".concat(optimization, 'var e=localStorage.getItem("').concat(THEME_STORAGE_KEY, '");if(e){').concat(value ? "var x=".concat(JSON.stringify(value), ";") : "").concat(updateDOM(value ? "x[e]" : "e", true), "}else{").concat(updateDOM(defaultTheme, false, false), ";}").concat(fallbackColorScheme, "}catch(t){}}();");
1990
+ }();
1991
+ // We MUST use next/script's `beforeInteractive` strategy to avoid flashing on load.
1992
+ // However, it only accepts the `src` prop, not `dangerouslySetInnerHTML` or `children`
1993
+ // But our script cannot be external because it changes at runtime based on React props
1994
+ // so we trick next/script by passing `src` as a base64 JS script
1995
+ var encodedScript = "data:text/javascript;base64,".concat(encodeBase64(scriptSrc));
1996
+ return /*#__PURE__*/ React__default["default"].createElement(Script__default["default"], {
1997
+ id: "next-theme-script",
1998
+ strategy: "beforeInteractive",
1999
+ src: encodedScript,
2000
+ nonce: nonce
2001
+ });
2002
+ }, // Never re-render this component
2003
+ function() {
2004
+ return true;
2005
+ });
2006
+ // Helpers
2007
+ var getTheme = function(key, fallback) {
2008
+ if (utils.isServer) return undefined;
2009
+ var theme;
2010
+ try {
2011
+ theme = localStorage.getItem(key) || undefined;
2012
+ } catch (e) {
2013
+ // Unsupported
2014
+ }
2015
+ return theme || fallback;
2016
+ };
2017
+ var disableAnimation = function() {
2018
+ var css = document.createElement("style");
2019
+ css.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}"));
2020
+ document.head.appendChild(css);
2021
+ return function() {
2022
+ // Force restyle
2023
+ (function() {
2024
+ return window.getComputedStyle(document.body);
2025
+ })();
2026
+ // Wait for next tick before removing
2027
+ setTimeout(function() {
2028
+ document.head.removeChild(css);
2029
+ }, 1);
2030
+ };
2031
+ };
2032
+ var getSystemTheme = function(e) {
2033
+ if (!e) e = window.matchMedia(MEDIA);
2034
+ var isDark = e.matches;
2035
+ var systemTheme = isDark ? "dark" : "light";
2036
+ return systemTheme;
2037
+ };
2038
+ var encodeBase64 = function(str) {
2039
+ return utils.isServer ? Buffer.from(str).toString("base64") : btoa(str);
2040
+ };
2041
+
2042
+ // import { ThemeVanillaProvider, ThemeVanillaValue } from "@koine/react";
2043
+ /**
2044
+ * App theme with vanilla class based theme (good for `tailwindcss`)
2045
+ */ var AppThemeVanilla = function(param) {
2046
+ var theme = param.theme, children = param.children;
2047
+ // return (
2048
+ // <ThemeVanillaProvider initialTheme={theme}>{children}</ThemeVanillaProvider>
2049
+ // );
2050
+ return /*#__PURE__*/ React.createElement(ThemeProvider, {
2051
+ defaultTheme: theme,
2052
+ attribute: "class"
2053
+ }, children);
2054
+ };
2055
+
2056
+ function _extends$8() {
2057
+ _extends$8 = Object.assign || function(target) {
2058
+ for(var i = 1; i < arguments.length; i++){
2059
+ var source = arguments[i];
2060
+ for(var key in source){
2061
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
2062
+ target[key] = source[key];
2063
+ }
2064
+ }
2065
+ }
2066
+ return target;
2067
+ };
2068
+ return _extends$8.apply(this, arguments);
2069
+ }
2070
+ /**
2071
+ * App main
2072
+ *
2073
+ * It does not imply any specific styling or animation solution
2074
+ */ var AppMainVanilla = function(param) {
2075
+ var Component = param.Component, pageProps = param.pageProps, Layout = param.Layout, seo = param.seo, pre = param.pre, post = param.post;
2076
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(SeoDefaults, _extends$8({}, seo)), pre, /*#__PURE__*/ React.createElement(Layout, null, /*#__PURE__*/ React.createElement(Component, _extends$8({}, pageProps))), post);
2077
+ };
2078
+
2079
+ function _extends$7() {
2080
+ _extends$7 = Object.assign || function(target) {
2081
+ for(var i = 1; i < arguments.length; i++){
2082
+ var source = arguments[i];
2083
+ for(var key in source){
2084
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
2085
+ target[key] = source[key];
2086
+ }
2087
+ }
2088
+ }
2089
+ return target;
2090
+ };
2091
+ return _extends$7.apply(this, arguments);
2092
+ }
2093
+ /**
2094
+ * App
2095
+ */ var AppVanilla = function(props) {
2096
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(AppHead, null), /*#__PURE__*/ React.createElement(AppThemeVanilla, _extends$7({}, props), /*#__PURE__*/ React.createElement(AppMainVanilla, _extends$7({}, props))));
2097
+ };
2098
+
2099
+ function _extends$6() {
2100
+ _extends$6 = Object.assign || function(target) {
2101
+ for(var i = 1; i < arguments.length; i++){
2102
+ var source = arguments[i];
2103
+ for(var key in source){
2104
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
2105
+ target[key] = source[key];
2106
+ }
2107
+ }
2108
+ }
2109
+ return target;
2110
+ };
2111
+ return _extends$6.apply(this, arguments);
2112
+ }
2113
+ /**
2114
+ * App with authentication provided by `next-auth`
2115
+ */ var AppAuthEmotion = function(props) {
2116
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(AppHead, null), /*#__PURE__*/ React.createElement(react$2.SessionProvider, {
2117
+ session: props.pageProps.session
2118
+ }, /*#__PURE__*/ React.createElement(AppThemeEmotion, _extends$6({}, props), /*#__PURE__*/ React.createElement(AppMain, _extends$6({}, props)))));
2119
+ };
2120
+
2121
+ function _extends$5() {
2122
+ _extends$5 = Object.assign || function(target) {
2123
+ for(var i = 1; i < arguments.length; i++){
2124
+ var source = arguments[i];
2125
+ for(var key in source){
2126
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
2127
+ target[key] = source[key];
2128
+ }
2129
+ }
2130
+ }
2131
+ return target;
2132
+ };
2133
+ return _extends$5.apply(this, arguments);
2134
+ }
2135
+ /**
2136
+ * App with authentication provided by `next-auth`
2137
+ */ var AppAuthSc = function(props) {
2138
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(AppHead, null), /*#__PURE__*/ React.createElement(react$2.SessionProvider, {
2139
+ session: props.pageProps.session
2140
+ }, /*#__PURE__*/ React.createElement(AppThemeSc, _extends$5({}, props), /*#__PURE__*/ React.createElement(AppMain, _extends$5({}, props)))));
2141
+ };
2142
+
2143
+ var AUTH_ROUTES = {
2144
+ login: process.env["AUTH_ROUTE_LOGIN"],
2145
+ profile: process.env["AUTH_ROUTE_PROFILE"],
2146
+ register: process.env["AUTH_ROUTE_REGISTER"],
2147
+ secured: JSON.parse(process.env["AUTH_ROUTES_SECURED"] || "[]")
2148
+ };
2149
+ function getAuthRoutes(t) {
2150
+ return Object.keys(AUTH_ROUTES).reduce(function(map, name) {
2151
+ var routePage = AUTH_ROUTES[name];
2152
+ // @ts-expect-error cannot remember
2153
+ map[name] = utils.isString(routePage) ? t("~:".concat(AUTH_ROUTES[name])) : routePage;
2154
+ return map;
2155
+ }, {});
2156
+ }
2157
+ /**
2158
+ * @param url e.g. "http://localhost:3000/signin?callbackUrl=http://localhost:3000/profile"
2159
+ */ function getCallbackUrl() {
2160
+ var url = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.location.href;
2161
+ return url.split("callbackUrl=")[1] || "";
2162
+ }
2163
+
2164
+ function _arrayLikeToArray$5(arr, len) {
2165
+ if (len == null || len > arr.length) len = arr.length;
2166
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2167
+ return arr2;
2168
+ }
2169
+ function _arrayWithHoles$5(arr) {
2170
+ if (Array.isArray(arr)) return arr;
2171
+ }
2172
+ function _arrayWithoutHoles(arr) {
2173
+ if (Array.isArray(arr)) return _arrayLikeToArray$5(arr);
2174
+ }
2175
+ function _defineProperty$7(obj, key, value) {
2176
+ if (key in obj) {
2177
+ Object.defineProperty(obj, key, {
2178
+ value: value,
2179
+ enumerable: true,
2180
+ configurable: true,
2181
+ writable: true
2182
+ });
2183
+ } else {
2184
+ obj[key] = value;
2185
+ }
2186
+ return obj;
2187
+ }
2188
+ function _iterableToArray(iter) {
2189
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2190
+ }
2191
+ function _iterableToArrayLimit$5(arr, i) {
2192
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2193
+ if (_i == null) return;
2194
+ var _arr = [];
2195
+ var _n = true;
2196
+ var _d = false;
2197
+ var _s, _e;
2198
+ try {
2199
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
2200
+ _arr.push(_s.value);
2201
+ if (i && _arr.length === i) break;
2202
+ }
2203
+ } catch (err) {
2204
+ _d = true;
2205
+ _e = err;
2206
+ } finally{
2207
+ try {
2208
+ if (!_n && _i["return"] != null) _i["return"]();
2209
+ } finally{
2210
+ if (_d) throw _e;
2211
+ }
2212
+ }
2213
+ return _arr;
2214
+ }
2215
+ function _nonIterableRest$5() {
2216
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2217
+ }
2218
+ function _nonIterableSpread() {
2219
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2220
+ }
2221
+ function _objectSpread$7(target) {
2222
+ for(var i = 1; i < arguments.length; i++){
2223
+ var source = arguments[i] != null ? arguments[i] : {};
2224
+ var ownKeys = Object.keys(source);
2225
+ if (typeof Object.getOwnPropertySymbols === "function") {
2226
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2227
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2228
+ }));
2229
+ }
2230
+ ownKeys.forEach(function(key) {
2231
+ _defineProperty$7(target, key, source[key]);
2232
+ });
2233
+ }
2234
+ return target;
2235
+ }
2236
+ function _slicedToArray$5(arr, i) {
2237
+ return _arrayWithHoles$5(arr) || _iterableToArrayLimit$5(arr, i) || _unsupportedIterableToArray$5(arr, i) || _nonIterableRest$5();
2238
+ }
2239
+ function _toConsumableArray(arr) {
2240
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$5(arr) || _nonIterableSpread();
2241
+ }
2242
+ function _unsupportedIterableToArray$5(o, minLen) {
2243
+ if (!o) return;
2244
+ if (typeof o === "string") return _arrayLikeToArray$5(o, minLen);
2245
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2246
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2247
+ if (n === "Map" || n === "Set") return Array.from(n);
2248
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen);
2249
+ }
2250
+ /**
2251
+ * FIXME: the use of `useMemo` is a hopefully-temporary solution to fix the FOUC
2252
+ * problem of untranslated text during page transitions
2253
+ *
2254
+ * @see https://github.com/vinissimus/next-translate/issues/513#issuecomment-779826418
2255
+ */ function useT(namespace) {
2256
+ var t = useTranslation__default["default"]().t;
2257
+ // const typedT = <
2258
+ // // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
2259
+ // R extends unknown = string,
2260
+ // // Q extends TranslationQuery = TranslationQuery
2261
+ // // O extends TranslationOptions = TranslationOptions
2262
+ // >(
2263
+ // s: N extends TranslateNamespace
2264
+ // ? Paths<Koine.NextTranslations[N]> | AllPaths
2265
+ // : AllPaths,
2266
+ // q?: TranslationQuery,
2267
+ // o?: TranslationOptions
2268
+ // ) =>
2269
+ // // eslint-disable-next-line
2270
+ // t.call(
2271
+ // null,
2272
+ // namespace ? `${namespace}:${s}` : s,
2273
+ // q === "obj" ? null : q,
2274
+ // q === "obj" || o === "obj" ? { returnObjects: true } : o
2275
+ // // ) as R extends (undefined | never | unknown) ? TranslateReturn<TranslationQuery, TranslationOptions> : R;
2276
+ // ) as R;
2277
+ // return typedT;
2278
+ var tMemoized = React$1.useMemo(function() {
2279
+ return function(s, q, o) {
2280
+ return t(namespace ? "".concat(namespace, ":").concat(s) : s, q === "obj" ? null : q, q === "obj" || o === "obj" ? {
2281
+ returnObjects: true
2282
+ } : o);
2283
+ };
2284
+ }, [
2285
+ t,
2286
+ namespace
2287
+ ]);
2288
+ // return tMemoized as Translate<N>;
2289
+ return tMemoized;
2290
+ }
2291
+ /**
2292
+ * @deprecated Not sure whether this will ever be useful
2293
+ */ function useLooseT(namespace) {
2294
+ var t = useTranslation__default["default"](namespace).t;
2295
+ // return t;
2296
+ var tMemoized = React$1.useMemo(function() {
2297
+ return t;
2298
+ }, [
2299
+ t
2300
+ ]);
2301
+ return tMemoized;
2302
+ }
2303
+ function translationAsOptions(t, i18nKey) {
2304
+ var dictionary = t(i18nKey, undefined, {
2305
+ returnObjects: true
2306
+ });
2307
+ return Object.keys(dictionary).map(function(key) {
2308
+ return {
2309
+ value: key,
2310
+ label: dictionary[key]
2311
+ };
2312
+ });
2313
+ }
2314
+ /**
2315
+ * Automatically returns the `date-fns/format` function with the right locale
2316
+ * passed as option (grabbed from next router value).
2317
+ */ var useDateFormat = function() {
2318
+ var ref = _slicedToArray$5(React$1.useState(function() {
2319
+ return function() {
2320
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
2321
+ args[_key] = arguments[_key];
2322
+ }
2323
+ return format__default["default"].apply(void 0, _toConsumableArray(args));
2324
+ };
2325
+ }), 2), formatter = ref[0], setFormatter = ref[1];
2326
+ var router$1 = router.useRouter();
2327
+ var locale = react$1.useDateLocale(router$1.locale);
2328
+ React$1.useEffect(function() {
2329
+ if (locale) {
2330
+ var newFormatter = function(date, _format, options) {
2331
+ return format__default["default"](date, _format, _objectSpread$7({}, options || {}, {
2332
+ locale: locale
2333
+ }));
2334
+ };
2335
+ setFormatter(function() {
2336
+ return function() {
2337
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
2338
+ args[_key] = arguments[_key];
2339
+ }
2340
+ return newFormatter.apply(void 0, _toConsumableArray(args));
2341
+ };
2342
+ });
2343
+ }
2344
+ }, [
2345
+ locale
2346
+ ]);
2347
+ return formatter;
2348
+ };
2349
+
2350
+ function _arrayLikeToArray$4(arr, len) {
2351
+ if (len == null || len > arr.length) len = arr.length;
2352
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2353
+ return arr2;
2354
+ }
2355
+ function _arrayWithHoles$4(arr) {
2356
+ if (Array.isArray(arr)) return arr;
2357
+ }
2358
+ function _defineProperty$6(obj, key, value) {
2359
+ if (key in obj) {
2360
+ Object.defineProperty(obj, key, {
2361
+ value: value,
2362
+ enumerable: true,
2363
+ configurable: true,
2364
+ writable: true
2365
+ });
2366
+ } else {
2367
+ obj[key] = value;
2368
+ }
2369
+ return obj;
2370
+ }
2371
+ function _iterableToArrayLimit$4(arr, i) {
2372
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2373
+ if (_i == null) return;
2374
+ var _arr = [];
2375
+ var _n = true;
2376
+ var _d = false;
2377
+ var _s, _e;
2378
+ try {
2379
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
2380
+ _arr.push(_s.value);
2381
+ if (i && _arr.length === i) break;
2382
+ }
2383
+ } catch (err) {
2384
+ _d = true;
2385
+ _e = err;
2386
+ } finally{
2387
+ try {
2388
+ if (!_n && _i["return"] != null) _i["return"]();
2389
+ } finally{
2390
+ if (_d) throw _e;
2391
+ }
2392
+ }
2393
+ return _arr;
2394
+ }
2395
+ function _nonIterableRest$4() {
2396
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2397
+ }
2398
+ function _objectSpread$6(target) {
2399
+ for(var i = 1; i < arguments.length; i++){
2400
+ var source = arguments[i] != null ? arguments[i] : {};
2401
+ var ownKeys = Object.keys(source);
2402
+ if (typeof Object.getOwnPropertySymbols === "function") {
2403
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2404
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2405
+ }));
2406
+ }
2407
+ ownKeys.forEach(function(key) {
2408
+ _defineProperty$6(target, key, source[key]);
2409
+ });
2410
+ }
2411
+ return target;
2412
+ }
2413
+ function _slicedToArray$4(arr, i) {
2414
+ return _arrayWithHoles$4(arr) || _iterableToArrayLimit$4(arr, i) || _unsupportedIterableToArray$4(arr, i) || _nonIterableRest$4();
2415
+ }
2416
+ function _unsupportedIterableToArray$4(o, minLen) {
2417
+ if (!o) return;
2418
+ if (typeof o === "string") return _arrayLikeToArray$4(o, minLen);
2419
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2420
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2421
+ if (n === "Map" || n === "Set") return Array.from(n);
2422
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen);
2423
+ }
2424
+ function useLogin() {
2425
+ var t = useT();
2426
+ var push = router.useRouter().push;
2427
+ var ref3 = _slicedToArray$4(React$1.useState(false), 2), loading = ref3[0], setLoading = ref3[1];
2428
+ var ref1 = _slicedToArray$4(React$1.useState(false), 2), ok1 = ref1[0], setOk = ref1[1];
2429
+ var ref2 = _slicedToArray$4(React$1.useState(false), 2), fail = ref2[0], setFail = ref2[1];
2430
+ var submit = React$1.useCallback(function(data) {
2431
+ setLoading(true);
2432
+ react$2.signIn("credentials", _objectSpread$6({}, data, {
2433
+ redirect: false
2434
+ }))// @ts-expect-error FIXME: at some point...
2435
+ .then(function(param) {
2436
+ var ok = param.ok;
2437
+ setLoading(false);
2438
+ setOk(ok);
2439
+ setFail(!ok);
2440
+ if (ok) {
2441
+ var redirectUrl = utils.parseURL(getCallbackUrl());
2442
+ var ref = getAuthRoutes(t), login = ref.login, register = ref.register, profile = ref.profile;
2443
+ if (redirectUrl) {
2444
+ var redirectPath = redirectUrl.pathname;
2445
+ if (profile && (redirectPath === login || redirectPath === register)) {
2446
+ push(profile);
2447
+ } else {
2448
+ push(redirectPath + redirectUrl.search);
2449
+ }
2450
+ } else if (profile) {
2451
+ push(profile);
2452
+ }
2453
+ }
2454
+ });
2455
+ }, [
2456
+ t,
2457
+ push
2458
+ ]);
2459
+ // TODO: useMemo ?
2460
+ return {
2461
+ submit: submit,
2462
+ loading: loading,
2463
+ ok: ok1,
2464
+ fail: fail
2465
+ };
2466
+ }
2467
+
2468
+ function _arrayLikeToArray$3(arr, len) {
2469
+ if (len == null || len > arr.length) len = arr.length;
2470
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2471
+ return arr2;
2472
+ }
2473
+ function _arrayWithHoles$3(arr) {
2474
+ if (Array.isArray(arr)) return arr;
2475
+ }
2476
+ function _iterableToArrayLimit$3(arr, i) {
2477
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2478
+ if (_i == null) return;
2479
+ var _arr = [];
2480
+ var _n = true;
2481
+ var _d = false;
2482
+ var _s, _e;
2483
+ try {
2484
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
2485
+ _arr.push(_s.value);
2486
+ if (i && _arr.length === i) break;
2487
+ }
2488
+ } catch (err) {
2489
+ _d = true;
2490
+ _e = err;
2491
+ } finally{
2492
+ try {
2493
+ if (!_n && _i["return"] != null) _i["return"]();
2494
+ } finally{
2495
+ if (_d) throw _e;
2496
+ }
2497
+ }
2498
+ return _arr;
2499
+ }
2500
+ function _nonIterableRest$3() {
2501
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2502
+ }
2503
+ function _slicedToArray$3(arr, i) {
2504
+ return _arrayWithHoles$3(arr) || _iterableToArrayLimit$3(arr, i) || _unsupportedIterableToArray$3(arr, i) || _nonIterableRest$3();
2505
+ }
2506
+ function _unsupportedIterableToArray$3(o, minLen) {
2507
+ if (!o) return;
2508
+ if (typeof o === "string") return _arrayLikeToArray$3(o, minLen);
2509
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2510
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2511
+ if (n === "Map" || n === "Set") return Array.from(n);
2512
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen);
2513
+ }
2514
+ function useLoginUrl() {
2515
+ var ref = _slicedToArray$3(React$1.useState(""), 2), currentUrl = ref[0], setCurrentUrl = ref[1];
2516
+ var t = useT();
2517
+ React$1.useEffect(function() {
2518
+ setCurrentUrl("?callbackUrl=".concat(window.location.href));
2519
+ }, []);
2520
+ return "".concat(getAuthRoutes(t).login).concat(currentUrl);
2521
+ }
2522
+
2523
+ function _arrayLikeToArray$2(arr, len) {
2524
+ if (len == null || len > arr.length) len = arr.length;
2525
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2526
+ return arr2;
2527
+ }
2528
+ function _arrayWithHoles$2(arr) {
2529
+ if (Array.isArray(arr)) return arr;
2530
+ }
2531
+ function _iterableToArrayLimit$2(arr, i) {
2532
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2533
+ if (_i == null) return;
2534
+ var _arr = [];
2535
+ var _n = true;
2536
+ var _d = false;
2537
+ var _s, _e;
2538
+ try {
2539
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
2540
+ _arr.push(_s.value);
2541
+ if (i && _arr.length === i) break;
2542
+ }
2543
+ } catch (err) {
2544
+ _d = true;
2545
+ _e = err;
2546
+ } finally{
2547
+ try {
2548
+ if (!_n && _i["return"] != null) _i["return"]();
2549
+ } finally{
2550
+ if (_d) throw _e;
2551
+ }
2552
+ }
2553
+ return _arr;
2554
+ }
2555
+ function _nonIterableRest$2() {
2556
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2557
+ }
2558
+ function _slicedToArray$2(arr, i) {
2559
+ return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest$2();
2560
+ }
2561
+ function _unsupportedIterableToArray$2(o, minLen) {
2562
+ if (!o) return;
2563
+ if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
2564
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2565
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2566
+ if (n === "Map" || n === "Set") return Array.from(n);
2567
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
2568
+ }
2569
+ function useLogout() {
2570
+ var t = useT();
2571
+ var push = router.useRouter().push;
2572
+ var ref = _slicedToArray$2(React$1.useState(false), 2), loading = ref[0], setLoading = ref[1];
2573
+ var ref1 = _slicedToArray$2(React$1.useState(false), 2), ok = ref1[0], setOk = ref1[1];
2574
+ var ref2 = _slicedToArray$2(React$1.useState(false), 1), fail = ref2[0];
2575
+ var submit = React$1.useCallback(function(event) {
2576
+ event.preventDefault();
2577
+ event.stopPropagation();
2578
+ setLoading(true);
2579
+ react$2.signOut({
2580
+ redirect: false
2581
+ }).then(function() {
2582
+ setLoading(false);
2583
+ setOk(true);
2584
+ var redirectUrl = utils.parseURL(getCallbackUrl());
2585
+ var currentUrl = utils.parseURL(window.location.href);
2586
+ var secured = getAuthRoutes(t).secured;
2587
+ var signin = t("~:/signin");
2588
+ var profile = t("~:/profile");
2589
+ var targetUrl = redirectUrl || currentUrl;
2590
+ var redirect = "";
2591
+ if (targetUrl) {
2592
+ if (targetUrl.pathname === profile) {
2593
+ redirect = signin;
2594
+ } else if (secured) {
2595
+ for(var i = 0; i < secured.length; i++){
2596
+ if (targetUrl.pathname.match(secured[i])) {
2597
+ redirect = signin;
2598
+ break;
2599
+ }
2600
+ }
2601
+ }
2602
+ }
2603
+ if (redirect) {
2604
+ push(redirect);
2605
+ }
2606
+ });
2607
+ }, [
2608
+ t,
2609
+ push
2610
+ ]);
2611
+ // TODO: useMemo ?
2612
+ return {
2613
+ submit: submit,
2614
+ loading: loading,
2615
+ ok: ok,
2616
+ fail: fail
2617
+ };
2618
+ }
2619
+
2620
+ function _assertThisInitialized$3(self) {
2621
+ if (self === void 0) {
2622
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2623
+ }
2624
+ return self;
2625
+ }
2626
+ function _classCallCheck$3(instance, Constructor) {
2627
+ if (!(instance instanceof Constructor)) {
2628
+ throw new TypeError("Cannot call a class as a function");
2629
+ }
2630
+ }
2631
+ function _getPrototypeOf$3(o) {
2632
+ _getPrototypeOf$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
2633
+ return o.__proto__ || Object.getPrototypeOf(o);
2634
+ };
2635
+ return _getPrototypeOf$3(o);
2636
+ }
2637
+ function _inherits$3(subClass, superClass) {
2638
+ if (typeof superClass !== "function" && superClass !== null) {
2639
+ throw new TypeError("Super expression must either be null or a function");
2640
+ }
2641
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
2642
+ constructor: {
2643
+ value: subClass,
2644
+ writable: true,
2645
+ configurable: true
2646
+ }
2647
+ });
2648
+ if (superClass) _setPrototypeOf$3(subClass, superClass);
2649
+ }
2650
+ function _possibleConstructorReturn$3(self, call) {
2651
+ if (call && (_typeof$3(call) === "object" || typeof call === "function")) {
2652
+ return call;
2653
+ }
2654
+ return _assertThisInitialized$3(self);
2655
+ }
2656
+ function _setPrototypeOf$3(o, p) {
2657
+ _setPrototypeOf$3 = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
2658
+ o.__proto__ = p;
2659
+ return o;
2660
+ };
2661
+ return _setPrototypeOf$3(o, p);
2662
+ }
2663
+ var _typeof$3 = function(obj) {
2664
+ "@swc/helpers - typeof";
2665
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
2666
+ };
2667
+ function _isNativeReflectConstruct$3() {
2668
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
2669
+ if (Reflect.construct.sham) return false;
2670
+ if (typeof Proxy === "function") return true;
2671
+ try {
2672
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
2673
+ return true;
2674
+ } catch (e) {
2675
+ return false;
2676
+ }
2677
+ }
2678
+ function _createSuper$3(Derived) {
2679
+ var hasNativeReflectConstruct = _isNativeReflectConstruct$3();
2680
+ return function _createSuperInternal() {
2681
+ var Super = _getPrototypeOf$3(Derived), result;
2682
+ if (hasNativeReflectConstruct) {
2683
+ var NewTarget = _getPrototypeOf$3(this).constructor;
2684
+ result = Reflect.construct(Super, arguments, NewTarget);
2685
+ } else {
2686
+ result = Super.apply(this, arguments);
2687
+ }
2688
+ return _possibleConstructorReturn$3(this, result);
2689
+ };
2690
+ }
2691
+ /**
2692
+ * For typescript safety of this component
2693
+ *
2694
+ * @see https://bit.ly/3ceuF8m
2695
+ */ var Document = /*#__PURE__*/ function(NextDocument1) {
2696
+ _inherits$3(Document, NextDocument1);
2697
+ var _super = _createSuper$3(Document);
2698
+ function Document() {
2699
+ _classCallCheck$3(this, Document);
2700
+ return _super.apply(this, arguments);
2701
+ }
2702
+ var _proto = Document.prototype;
2703
+ _proto.render = function render() {
2704
+ var ___NEXT_DATA__ = this.props.__NEXT_DATA__, locale = ___NEXT_DATA__.locale, defaultLocale = ___NEXT_DATA__.defaultLocale;
2705
+ return /*#__PURE__*/ React.createElement(NextDocument.Html, {
2706
+ lang: locale || defaultLocale,
2707
+ className: "no-js"
2708
+ }, /*#__PURE__*/ React.createElement(NextDocument.Head, null, /*#__PURE__*/ React.createElement(react$1.Meta, null), /*#__PURE__*/ React.createElement(react$1.NoJs, null)), /*#__PURE__*/ React.createElement("body", null, /*#__PURE__*/ React.createElement(NextDocument.Main, null), /*#__PURE__*/ React.createElement(NextDocument.NextScript, null)));
2709
+ };
2710
+ return Document;
2711
+ }(NextDocument__default["default"]);
2712
+
2713
+ var runtime = {
2714
+ exports: {}
2715
+ };
2716
+
2717
+ (function (module) {
2718
+ function _instanceof(left, right) {
2719
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
2720
+ return !!right[Symbol.hasInstance](left);
2721
+ } else {
2722
+ return left instanceof right;
2723
+ }
2724
+ }
2725
+ /**
2726
+ * Copyright (c) 2014-present, Facebook, Inc.
2727
+ *
2728
+ * This source code is licensed under the MIT license found in the
2729
+ * LICENSE file in the root directory of this source tree.
2730
+ */ var runtime = function(exports) {
2731
+ var define = function define(obj, key, value) {
2732
+ Object.defineProperty(obj, key, {
2733
+ value: value,
2734
+ enumerable: true,
2735
+ configurable: true,
2736
+ writable: true
2737
+ });
2738
+ return obj[key];
2739
+ };
2740
+ var wrap = function wrap(innerFn, outerFn, self, tryLocsList) {
2741
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
2742
+ var protoGenerator = outerFn && _instanceof(outerFn.prototype, Generator) ? outerFn : Generator;
2743
+ var generator = Object.create(protoGenerator.prototype);
2744
+ var context = new Context(tryLocsList || []);
2745
+ // The ._invoke method unifies the implementations of the .next,
2746
+ // .throw, and .return methods.
2747
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
2748
+ return generator;
2749
+ };
2750
+ var tryCatch = // Try/catch helper to minimize deoptimizations. Returns a completion
2751
+ // record like context.tryEntries[i].completion. This interface could
2752
+ // have been (and was previously) designed to take a closure to be
2753
+ // invoked without arguments, but in all the cases we care about we
2754
+ // already have an existing method we want to call, so there's no need
2755
+ // to create a new function object. We can even get away with assuming
2756
+ // the method takes exactly one argument, since that happens to be true
2757
+ // in every case, so we don't have to touch the arguments object. The
2758
+ // only additional allocation required is the completion record, which
2759
+ // has a stable shape and so hopefully should be cheap to allocate.
2760
+ function tryCatch(fn, obj, arg) {
2761
+ try {
2762
+ return {
2763
+ type: "normal",
2764
+ arg: fn.call(obj, arg)
2765
+ };
2766
+ } catch (err) {
2767
+ return {
2768
+ type: "throw",
2769
+ arg: err
2770
+ };
2771
+ }
2772
+ };
2773
+ var Generator = // Dummy constructor functions that we use as the .constructor and
2774
+ // .constructor.prototype properties for functions that return Generator
2775
+ // objects. For full spec compliance, you may wish to configure your
2776
+ // minifier not to mangle the names of these two functions.
2777
+ function Generator() {};
2778
+ var GeneratorFunction = function GeneratorFunction() {};
2779
+ var GeneratorFunctionPrototype = function GeneratorFunctionPrototype() {};
2780
+ var defineIteratorMethods = // Helper for defining the .next, .throw, and .return methods of the
2781
+ // Iterator interface in terms of a single ._invoke method.
2782
+ function defineIteratorMethods(prototype) {
2783
+ [
2784
+ "next",
2785
+ "throw",
2786
+ "return"
2787
+ ].forEach(function(method) {
2788
+ define(prototype, method, function(arg) {
2789
+ return this._invoke(method, arg);
2790
+ });
2791
+ });
2792
+ };
2793
+ var AsyncIterator = function AsyncIterator(generator, PromiseImpl) {
2794
+ function invoke(method, arg, resolve, reject) {
2795
+ var record = tryCatch(generator[method], generator, arg);
2796
+ if (record.type === "throw") {
2797
+ reject(record.arg);
2798
+ } else {
2799
+ var result = record.arg;
2800
+ var value1 = result.value;
2801
+ if (value1 && typeof value1 === "object" && hasOwn.call(value1, "__await")) {
2802
+ return PromiseImpl.resolve(value1.__await).then(function(value) {
2803
+ invoke("next", value, resolve, reject);
2804
+ }, function(err) {
2805
+ invoke("throw", err, resolve, reject);
2806
+ });
2807
+ }
2808
+ return PromiseImpl.resolve(value1).then(function(unwrapped) {
2809
+ // When a yielded Promise is resolved, its final value becomes
2810
+ // the .value of the Promise<{value,done}> result for the
2811
+ // current iteration.
2812
+ result.value = unwrapped;
2813
+ resolve(result);
2814
+ }, function(error) {
2815
+ // If a rejected Promise was yielded, throw the rejection back
2816
+ // into the async generator function so it can be handled there.
2817
+ return invoke("throw", error, resolve, reject);
2818
+ });
2819
+ }
2820
+ }
2821
+ var previousPromise;
2822
+ function enqueue(method, arg) {
2823
+ function callInvokeWithMethodAndArg() {
2824
+ return new PromiseImpl(function(resolve, reject) {
2825
+ invoke(method, arg, resolve, reject);
2826
+ });
2827
+ }
2828
+ return previousPromise = // If enqueue has been called before, then we want to wait until
2829
+ // all previous Promises have been resolved before calling invoke,
2830
+ // so that results are always delivered in the correct order. If
2831
+ // enqueue has not been called before, then it is important to
2832
+ // call invoke immediately, without waiting on a callback to fire,
2833
+ // so that the async generator function has the opportunity to do
2834
+ // any necessary setup in a predictable way. This predictability
2835
+ // is why the Promise constructor synchronously invokes its
2836
+ // executor callback, and why async functions synchronously
2837
+ // execute code before the first await. Since we implement simple
2838
+ // async functions in terms of async generators, it is especially
2839
+ // important to get this right, even though it requires care.
2840
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
2841
+ // invocations of the iterator.
2842
+ callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
2843
+ }
2844
+ // Define the unified helper method that is used to implement .next,
2845
+ // .throw, and .return (see defineIteratorMethods).
2846
+ this._invoke = enqueue;
2847
+ };
2848
+ var makeInvokeMethod = function makeInvokeMethod(innerFn, self, context) {
2849
+ var state = GenStateSuspendedStart;
2850
+ return function invoke(method, arg) {
2851
+ if (state === GenStateExecuting) {
2852
+ throw new Error("Generator is already running");
2853
+ }
2854
+ if (state === GenStateCompleted) {
2855
+ if (method === "throw") {
2856
+ throw arg;
2857
+ }
2858
+ // Be forgiving, per 25.3.3.3.3 of the spec:
2859
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
2860
+ return doneResult();
2861
+ }
2862
+ context.method = method;
2863
+ context.arg = arg;
2864
+ while(true){
2865
+ var delegate = context.delegate;
2866
+ if (delegate) {
2867
+ var delegateResult = maybeInvokeDelegate(delegate, context);
2868
+ if (delegateResult) {
2869
+ if (delegateResult === ContinueSentinel) continue;
2870
+ return delegateResult;
2871
+ }
2872
+ }
2873
+ if (context.method === "next") {
2874
+ // Setting context._sent for legacy support of Babel's
2875
+ // function.sent implementation.
2876
+ context.sent = context._sent = context.arg;
2877
+ } else if (context.method === "throw") {
2878
+ if (state === GenStateSuspendedStart) {
2879
+ state = GenStateCompleted;
2880
+ throw context.arg;
2881
+ }
2882
+ context.dispatchException(context.arg);
2883
+ } else if (context.method === "return") {
2884
+ context.abrupt("return", context.arg);
2885
+ }
2886
+ state = GenStateExecuting;
2887
+ var record = tryCatch(innerFn, self, context);
2888
+ if (record.type === "normal") {
2889
+ // If an exception is thrown from innerFn, we leave state ===
2890
+ // GenStateExecuting and loop back for another invocation.
2891
+ state = context.done ? GenStateCompleted : GenStateSuspendedYield;
2892
+ if (record.arg === ContinueSentinel) {
2893
+ continue;
2894
+ }
2895
+ return {
2896
+ value: record.arg,
2897
+ done: context.done
2898
+ };
2899
+ } else if (record.type === "throw") {
2900
+ state = GenStateCompleted;
2901
+ // Dispatch the exception by looping back around to the
2902
+ // context.dispatchException(context.arg) call above.
2903
+ context.method = "throw";
2904
+ context.arg = record.arg;
2905
+ }
2906
+ }
2907
+ };
2908
+ };
2909
+ var pushTryEntry = function pushTryEntry(locs) {
2910
+ var entry = {
2911
+ tryLoc: locs[0]
2912
+ };
2913
+ if (1 in locs) {
2914
+ entry.catchLoc = locs[1];
2915
+ }
2916
+ if (2 in locs) {
2917
+ entry.finallyLoc = locs[2];
2918
+ entry.afterLoc = locs[3];
2919
+ }
2920
+ this.tryEntries.push(entry);
2921
+ };
2922
+ var resetTryEntry = function resetTryEntry(entry) {
2923
+ var record = entry.completion || {};
2924
+ record.type = "normal";
2925
+ delete record.arg;
2926
+ entry.completion = record;
2927
+ };
2928
+ var Context = function Context(tryLocsList) {
2929
+ // The root entry object (effectively a try statement without a catch
2930
+ // or a finally block) gives us a place to store values thrown from
2931
+ // locations where there is no enclosing try statement.
2932
+ this.tryEntries = [
2933
+ {
2934
+ tryLoc: "root"
2935
+ }
2936
+ ];
2937
+ tryLocsList.forEach(pushTryEntry, this);
2938
+ this.reset(true);
2939
+ };
2940
+ var values = function values(iterable) {
2941
+ if (iterable) {
2942
+ var iteratorMethod = iterable[iteratorSymbol];
2943
+ if (iteratorMethod) {
2944
+ return iteratorMethod.call(iterable);
2945
+ }
2946
+ if (typeof iterable.next === "function") {
2947
+ return iterable;
2948
+ }
2949
+ if (!isNaN(iterable.length)) {
2950
+ var i = -1, next1 = function next() {
2951
+ while(++i < iterable.length){
2952
+ if (hasOwn.call(iterable, i)) {
2953
+ next.value = iterable[i];
2954
+ next.done = false;
2955
+ return next;
2956
+ }
2957
+ }
2958
+ next.value = undefined$1;
2959
+ next.done = true;
2960
+ return next;
2961
+ };
2962
+ return next1.next = next1;
2963
+ }
2964
+ }
2965
+ // Return an iterator with no values.
2966
+ return {
2967
+ next: doneResult
2968
+ };
2969
+ };
2970
+ var doneResult = function doneResult() {
2971
+ return {
2972
+ value: undefined$1,
2973
+ done: true
2974
+ };
2975
+ };
2976
+ var Op = Object.prototype;
2977
+ var hasOwn = Op.hasOwnProperty;
2978
+ var undefined$1; // More compressible than void 0.
2979
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
2980
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
2981
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
2982
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
2983
+ try {
2984
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
2985
+ define({}, "");
2986
+ } catch (err) {
2987
+ define = function define(obj, key, value) {
2988
+ return obj[key] = value;
2989
+ };
2990
+ }
2991
+ exports.wrap = wrap;
2992
+ var GenStateSuspendedStart = "suspendedStart";
2993
+ var GenStateSuspendedYield = "suspendedYield";
2994
+ var GenStateExecuting = "executing";
2995
+ var GenStateCompleted = "completed";
2996
+ // Returning this object from the innerFn has the same effect as
2997
+ // breaking out of the dispatch switch statement.
2998
+ var ContinueSentinel = {};
2999
+ // This is a polyfill for %IteratorPrototype% for environments that
3000
+ // don't natively support it.
3001
+ var IteratorPrototype = {};
3002
+ IteratorPrototype[iteratorSymbol] = function() {
3003
+ return this;
3004
+ };
3005
+ var getProto = Object.getPrototypeOf;
3006
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
3007
+ if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
3008
+ // This environment has a native %IteratorPrototype%; use it instead
3009
+ // of the polyfill.
3010
+ IteratorPrototype = NativeIteratorPrototype;
3011
+ }
3012
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
3013
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
3014
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
3015
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
3016
+ exports.isGeneratorFunction = function(genFun) {
3017
+ var ctor = typeof genFun === "function" && genFun.constructor;
3018
+ return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
3019
+ // do is to check its .name property.
3020
+ (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
3021
+ };
3022
+ exports.mark = function(genFun) {
3023
+ if (Object.setPrototypeOf) {
3024
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
3025
+ } else {
3026
+ genFun.__proto__ = GeneratorFunctionPrototype;
3027
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
3028
+ }
3029
+ genFun.prototype = Object.create(Gp);
3030
+ return genFun;
3031
+ };
3032
+ // Within the body of any async function, `await x` is transformed to
3033
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
3034
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
3035
+ // meant to be awaited.
3036
+ exports.awrap = function(arg) {
3037
+ return {
3038
+ __await: arg
3039
+ };
3040
+ };
3041
+ defineIteratorMethods(AsyncIterator.prototype);
3042
+ AsyncIterator.prototype[asyncIteratorSymbol] = function() {
3043
+ return this;
3044
+ };
3045
+ exports.AsyncIterator = AsyncIterator;
3046
+ // Note that simple async functions are implemented on top of
3047
+ // AsyncIterator objects; they just return a Promise for the value of
3048
+ // the final result produced by the iterator.
3049
+ exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
3050
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
3051
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
3052
+ return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
3053
+ : iter.next().then(function(result) {
3054
+ return result.done ? result.value : iter.next();
3055
+ });
3056
+ };
3057
+ // Call delegate.iterator[context.method](context.arg) and handle the
3058
+ // result, either by returning a { value, done } result from the
3059
+ // delegate iterator, or by modifying context.method and context.arg,
3060
+ // setting context.delegate to null, and returning the ContinueSentinel.
3061
+ function maybeInvokeDelegate(delegate, context) {
3062
+ var method = delegate.iterator[context.method];
3063
+ if (method === undefined$1) {
3064
+ // A .throw or .return when the delegate iterator has no .throw
3065
+ // method always terminates the yield* loop.
3066
+ context.delegate = null;
3067
+ if (context.method === "throw") {
3068
+ // Note: ["return"] must be used for ES3 parsing compatibility.
3069
+ if (delegate.iterator["return"]) {
3070
+ // If the delegate iterator has a return method, give it a
3071
+ // chance to clean up.
3072
+ context.method = "return";
3073
+ context.arg = undefined$1;
3074
+ maybeInvokeDelegate(delegate, context);
3075
+ if (context.method === "throw") {
3076
+ // If maybeInvokeDelegate(context) changed context.method from
3077
+ // "return" to "throw", let that override the TypeError below.
3078
+ return ContinueSentinel;
3079
+ }
3080
+ }
3081
+ context.method = "throw";
3082
+ context.arg = new TypeError("The iterator does not provide a 'throw' method");
3083
+ }
3084
+ return ContinueSentinel;
3085
+ }
3086
+ var record = tryCatch(method, delegate.iterator, context.arg);
3087
+ if (record.type === "throw") {
3088
+ context.method = "throw";
3089
+ context.arg = record.arg;
3090
+ context.delegate = null;
3091
+ return ContinueSentinel;
3092
+ }
3093
+ var info = record.arg;
3094
+ if (!info) {
3095
+ context.method = "throw";
3096
+ context.arg = new TypeError("iterator result is not an object");
3097
+ context.delegate = null;
3098
+ return ContinueSentinel;
3099
+ }
3100
+ if (info.done) {
3101
+ // Assign the result of the finished delegate to the temporary
3102
+ // variable specified by delegate.resultName (see delegateYield).
3103
+ context[delegate.resultName] = info.value;
3104
+ // Resume execution at the desired location (see delegateYield).
3105
+ context.next = delegate.nextLoc;
3106
+ // If context.method was "throw" but the delegate handled the
3107
+ // exception, let the outer generator proceed normally. If
3108
+ // context.method was "next", forget context.arg since it has been
3109
+ // "consumed" by the delegate iterator. If context.method was
3110
+ // "return", allow the original .return call to continue in the
3111
+ // outer generator.
3112
+ if (context.method !== "return") {
3113
+ context.method = "next";
3114
+ context.arg = undefined$1;
3115
+ }
3116
+ } else {
3117
+ // Re-yield the result returned by the delegate method.
3118
+ return info;
3119
+ }
3120
+ // The delegate iterator is finished, so forget it and continue with
3121
+ // the outer generator.
3122
+ context.delegate = null;
3123
+ return ContinueSentinel;
3124
+ }
3125
+ // Define Generator.prototype.{next,throw,return} in terms of the
3126
+ // unified ._invoke helper method.
3127
+ defineIteratorMethods(Gp);
3128
+ define(Gp, toStringTagSymbol, "Generator");
3129
+ // A Generator should always return itself as the iterator object when the
3130
+ // @@iterator function is called on it. Some browsers' implementations of the
3131
+ // iterator prototype chain incorrectly implement this, causing the Generator
3132
+ // object to not be returned from this call. This ensures that doesn't happen.
3133
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
3134
+ Gp[iteratorSymbol] = function() {
3135
+ return this;
3136
+ };
3137
+ Gp.toString = function() {
3138
+ return "[object Generator]";
3139
+ };
3140
+ exports.keys = function(object) {
3141
+ var keys = [];
3142
+ for(var key1 in object){
3143
+ keys.push(key1);
3144
+ }
3145
+ keys.reverse();
3146
+ // Rather than returning an object with a next method, we keep
3147
+ // things simple and return the next function itself.
3148
+ return function next() {
3149
+ while(keys.length){
3150
+ var key = keys.pop();
3151
+ if (key in object) {
3152
+ next.value = key;
3153
+ next.done = false;
3154
+ return next;
3155
+ }
3156
+ }
3157
+ // To avoid creating an additional object, we just hang the .value
3158
+ // and .done properties off the next function object itself. This
3159
+ // also ensures that the minifier will not anonymize the function.
3160
+ next.done = true;
3161
+ return next;
3162
+ };
3163
+ };
3164
+ exports.values = values;
3165
+ Context.prototype = {
3166
+ constructor: Context,
3167
+ reset: function reset(skipTempReset) {
3168
+ this.prev = 0;
3169
+ this.next = 0;
3170
+ // Resetting context._sent for legacy support of Babel's
3171
+ // function.sent implementation.
3172
+ this.sent = this._sent = undefined$1;
3173
+ this.done = false;
3174
+ this.delegate = null;
3175
+ this.method = "next";
3176
+ this.arg = undefined$1;
3177
+ this.tryEntries.forEach(resetTryEntry);
3178
+ if (!skipTempReset) {
3179
+ for(var name in this){
3180
+ // Not sure about the optimal order of these conditions:
3181
+ if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
3182
+ this[name] = undefined$1;
3183
+ }
3184
+ }
3185
+ }
3186
+ },
3187
+ stop: function stop() {
3188
+ this.done = true;
3189
+ var rootEntry = this.tryEntries[0];
3190
+ var rootRecord = rootEntry.completion;
3191
+ if (rootRecord.type === "throw") {
3192
+ throw rootRecord.arg;
3193
+ }
3194
+ return this.rval;
3195
+ },
3196
+ dispatchException: function dispatchException(exception) {
3197
+ var handle = function handle(loc, caught) {
3198
+ record.type = "throw";
3199
+ record.arg = exception;
3200
+ context.next = loc;
3201
+ if (caught) {
3202
+ // If the dispatched exception was caught by a catch block,
3203
+ // then let that catch block handle the exception normally.
3204
+ context.method = "next";
3205
+ context.arg = undefined$1;
3206
+ }
3207
+ return !!caught;
3208
+ };
3209
+ if (this.done) {
3210
+ throw exception;
3211
+ }
3212
+ var context = this;
3213
+ for(var i = this.tryEntries.length - 1; i >= 0; --i){
3214
+ var entry = this.tryEntries[i];
3215
+ var record = entry.completion;
3216
+ if (entry.tryLoc === "root") {
3217
+ // Exception thrown outside of any try block that could handle
3218
+ // it, so set the completion value of the entire function to
3219
+ // throw the exception.
3220
+ return handle("end");
3221
+ }
3222
+ if (entry.tryLoc <= this.prev) {
3223
+ var hasCatch = hasOwn.call(entry, "catchLoc");
3224
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
3225
+ if (hasCatch && hasFinally) {
3226
+ if (this.prev < entry.catchLoc) {
3227
+ return handle(entry.catchLoc, true);
3228
+ } else if (this.prev < entry.finallyLoc) {
3229
+ return handle(entry.finallyLoc);
3230
+ }
3231
+ } else if (hasCatch) {
3232
+ if (this.prev < entry.catchLoc) {
3233
+ return handle(entry.catchLoc, true);
3234
+ }
3235
+ } else if (hasFinally) {
3236
+ if (this.prev < entry.finallyLoc) {
3237
+ return handle(entry.finallyLoc);
3238
+ }
3239
+ } else {
3240
+ throw new Error("try statement without catch or finally");
3241
+ }
3242
+ }
3243
+ }
3244
+ },
3245
+ abrupt: function abrupt(type, arg) {
3246
+ for(var i = this.tryEntries.length - 1; i >= 0; --i){
3247
+ var entry = this.tryEntries[i];
3248
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
3249
+ var finallyEntry = entry;
3250
+ break;
3251
+ }
3252
+ }
3253
+ if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
3254
+ // Ignore the finally entry if control is not jumping to a
3255
+ // location outside the try/catch block.
3256
+ finallyEntry = null;
3257
+ }
3258
+ var record = finallyEntry ? finallyEntry.completion : {};
3259
+ record.type = type;
3260
+ record.arg = arg;
3261
+ if (finallyEntry) {
3262
+ this.method = "next";
3263
+ this.next = finallyEntry.finallyLoc;
3264
+ return ContinueSentinel;
3265
+ }
3266
+ return this.complete(record);
3267
+ },
3268
+ complete: function complete(record, afterLoc) {
3269
+ if (record.type === "throw") {
3270
+ throw record.arg;
3271
+ }
3272
+ if (record.type === "break" || record.type === "continue") {
3273
+ this.next = record.arg;
3274
+ } else if (record.type === "return") {
3275
+ this.rval = this.arg = record.arg;
3276
+ this.method = "return";
3277
+ this.next = "end";
3278
+ } else if (record.type === "normal" && afterLoc) {
3279
+ this.next = afterLoc;
3280
+ }
3281
+ return ContinueSentinel;
3282
+ },
3283
+ finish: function finish(finallyLoc) {
3284
+ for(var i = this.tryEntries.length - 1; i >= 0; --i){
3285
+ var entry = this.tryEntries[i];
3286
+ if (entry.finallyLoc === finallyLoc) {
3287
+ this.complete(entry.completion, entry.afterLoc);
3288
+ resetTryEntry(entry);
3289
+ return ContinueSentinel;
3290
+ }
3291
+ }
3292
+ },
3293
+ "catch": function(tryLoc) {
3294
+ for(var i = this.tryEntries.length - 1; i >= 0; --i){
3295
+ var entry = this.tryEntries[i];
3296
+ if (entry.tryLoc === tryLoc) {
3297
+ var record = entry.completion;
3298
+ if (record.type === "throw") {
3299
+ var thrown = record.arg;
3300
+ resetTryEntry(entry);
3301
+ }
3302
+ return thrown;
3303
+ }
3304
+ }
3305
+ // The context.catch method must only be called with a location
3306
+ // argument that corresponds to a known catch block.
3307
+ throw new Error("illegal catch attempt");
3308
+ },
3309
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
3310
+ this.delegate = {
3311
+ iterator: values(iterable),
3312
+ resultName: resultName,
3313
+ nextLoc: nextLoc
3314
+ };
3315
+ if (this.method === "next") {
3316
+ // Deliberately forget the last sent value so that we don't
3317
+ // accidentally pass it on to the delegate.
3318
+ this.arg = undefined$1;
3319
+ }
3320
+ return ContinueSentinel;
3321
+ }
3322
+ };
3323
+ // Regardless of whether this script is executing as a CommonJS module
3324
+ // or not, return the runtime object so that we can declare the variable
3325
+ // regeneratorRuntime in the outer scope, which allows this module to be
3326
+ // injected easily by `bin/regenerator --include-runtime script.js`.
3327
+ return exports;
3328
+ }(// If this script is executing as a CommonJS module, use module.exports
3329
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
3330
+ // object. Either way, the resulting object will be used to initialize
3331
+ // the regeneratorRuntime variable at the top of this file.
3332
+ module.exports );
3333
+ try {
3334
+ regeneratorRuntime = runtime;
3335
+ } catch (accidentalStrictMode) {
3336
+ // This module should not be running in strict mode, so the above
3337
+ // assignment should always work unless something is misconfigured. Just
3338
+ // in case runtime.js accidentally runs in strict mode, we can escape
3339
+ // strict mode using a global Function call. This could conceivably fail
3340
+ // if a Content Security Policy forbids using Function, but in that case
3341
+ // the proper solution is to fix the accidental strict mode problem. If
3342
+ // you've misconfigured your bundler to force strict mode and applied a
3343
+ // CSP to forbid Function, and you're not willing to fix either of those
3344
+ // problems, please detail your unique predicament in a GitHub issue.
3345
+ Function("r", "regeneratorRuntime = r")(runtime);
3346
+ }
3347
+ }(runtime));
3348
+
3349
+ var regeneratorRuntime$1 = runtime.exports;
3350
+
3351
+ function _assertThisInitialized$2(self) {
3352
+ if (self === void 0) {
3353
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3354
+ }
3355
+ return self;
3356
+ }
3357
+ function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
3358
+ try {
3359
+ var info = gen[key](arg);
3360
+ var value = info.value;
3361
+ } catch (error) {
3362
+ reject(error);
3363
+ return;
3364
+ }
3365
+ if (info.done) {
3366
+ resolve(value);
3367
+ } else {
3368
+ Promise.resolve(value).then(_next, _throw);
3369
+ }
3370
+ }
3371
+ function _asyncToGenerator$4(fn) {
3372
+ return function() {
3373
+ var self = this, args = arguments;
3374
+ return new Promise(function(resolve, reject) {
3375
+ var gen = fn.apply(self, args);
3376
+ function _next(value) {
3377
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
3378
+ }
3379
+ function _throw(err) {
3380
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
3381
+ }
3382
+ _next(undefined);
3383
+ });
3384
+ };
3385
+ }
3386
+ function _classCallCheck$2(instance, Constructor) {
3387
+ if (!(instance instanceof Constructor)) {
3388
+ throw new TypeError("Cannot call a class as a function");
3389
+ }
3390
+ }
3391
+ function isNativeReflectConstruct() {
3392
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3393
+ if (Reflect.construct.sham) return false;
3394
+ if (typeof Proxy === "function") return true;
3395
+ try {
3396
+ Date.prototype.toString.call(Reflect.construct(Date, [], function() {}));
3397
+ return true;
3398
+ } catch (e) {
3399
+ return false;
3400
+ }
3401
+ }
3402
+ function _construct(Parent, args, Class) {
3403
+ if (isNativeReflectConstruct()) {
3404
+ _construct = Reflect.construct;
3405
+ } else {
3406
+ _construct = function _construct(Parent, args, Class) {
3407
+ var a = [
3408
+ null
3409
+ ];
3410
+ a.push.apply(a, args);
3411
+ var Constructor = Function.bind.apply(Parent, a);
3412
+ var instance = new Constructor();
3413
+ if (Class) _setPrototypeOf$2(instance, Class.prototype);
3414
+ return instance;
3415
+ };
3416
+ }
3417
+ return _construct.apply(null, arguments);
3418
+ }
3419
+ function _defineProperty$5(obj, key, value) {
3420
+ if (key in obj) {
3421
+ Object.defineProperty(obj, key, {
3422
+ value: value,
3423
+ enumerable: true,
3424
+ configurable: true,
3425
+ writable: true
3426
+ });
3427
+ } else {
3428
+ obj[key] = value;
3429
+ }
3430
+ return obj;
3431
+ }
3432
+ function _extends$4() {
3433
+ _extends$4 = Object.assign || function(target) {
3434
+ for(var i = 1; i < arguments.length; i++){
3435
+ var source = arguments[i];
3436
+ for(var key in source){
3437
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3438
+ target[key] = source[key];
3439
+ }
3440
+ }
3441
+ }
3442
+ return target;
3443
+ };
3444
+ return _extends$4.apply(this, arguments);
3445
+ }
3446
+ function _getPrototypeOf$2(o) {
3447
+ _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
3448
+ return o.__proto__ || Object.getPrototypeOf(o);
3449
+ };
3450
+ return _getPrototypeOf$2(o);
3451
+ }
3452
+ function _inherits$2(subClass, superClass) {
3453
+ if (typeof superClass !== "function" && superClass !== null) {
3454
+ throw new TypeError("Super expression must either be null or a function");
3455
+ }
3456
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
3457
+ constructor: {
3458
+ value: subClass,
3459
+ writable: true,
3460
+ configurable: true
3461
+ }
3462
+ });
3463
+ if (superClass) _setPrototypeOf$2(subClass, superClass);
3464
+ }
3465
+ function _isNativeFunction(fn) {
3466
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
3467
+ }
3468
+ function _objectSpread$5(target) {
3469
+ for(var i = 1; i < arguments.length; i++){
3470
+ var source = arguments[i] != null ? arguments[i] : {};
3471
+ var ownKeys = Object.keys(source);
3472
+ if (typeof Object.getOwnPropertySymbols === "function") {
3473
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
3474
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
3475
+ }));
3476
+ }
3477
+ ownKeys.forEach(function(key) {
3478
+ _defineProperty$5(target, key, source[key]);
3479
+ });
3480
+ }
3481
+ return target;
3482
+ }
3483
+ function _possibleConstructorReturn$2(self, call) {
3484
+ if (call && (_typeof$2(call) === "object" || typeof call === "function")) {
3485
+ return call;
3486
+ }
3487
+ return _assertThisInitialized$2(self);
3488
+ }
3489
+ function _setPrototypeOf$2(o, p) {
3490
+ _setPrototypeOf$2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
3491
+ o.__proto__ = p;
3492
+ return o;
3493
+ };
3494
+ return _setPrototypeOf$2(o, p);
3495
+ }
3496
+ var _typeof$2 = function(obj) {
3497
+ "@swc/helpers - typeof";
3498
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3499
+ };
3500
+ function _wrapNativeSuper(Class) {
3501
+ var _cache = typeof Map === "function" ? new Map() : undefined;
3502
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
3503
+ if (Class === null || !_isNativeFunction(Class)) return Class;
3504
+ if (typeof Class !== "function") {
3505
+ throw new TypeError("Super expression must either be null or a function");
3506
+ }
3507
+ if (typeof _cache !== "undefined") {
3508
+ if (_cache.has(Class)) return _cache.get(Class);
3509
+ _cache.set(Class, Wrapper);
3510
+ }
3511
+ function Wrapper() {
3512
+ return _construct(Class, arguments, _getPrototypeOf$2(this).constructor);
3513
+ }
3514
+ Wrapper.prototype = Object.create(Class.prototype, {
3515
+ constructor: {
3516
+ value: Wrapper,
3517
+ enumerable: false,
3518
+ writable: true,
3519
+ configurable: true
3520
+ }
3521
+ });
3522
+ return _setPrototypeOf$2(Wrapper, Class);
3523
+ };
3524
+ return _wrapNativeSuper(Class);
3525
+ }
3526
+ function _isNativeReflectConstruct$2() {
3527
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3528
+ if (Reflect.construct.sham) return false;
3529
+ if (typeof Proxy === "function") return true;
3530
+ try {
3531
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
3532
+ return true;
3533
+ } catch (e) {
3534
+ return false;
3535
+ }
3536
+ }
3537
+ function _createSuper$2(Derived) {
3538
+ var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
3539
+ return function _createSuperInternal() {
3540
+ var Super = _getPrototypeOf$2(Derived), result;
3541
+ if (hasNativeReflectConstruct) {
3542
+ var NewTarget = _getPrototypeOf$2(this).constructor;
3543
+ result = Reflect.construct(Super, arguments, NewTarget);
3544
+ } else {
3545
+ result = Super.apply(this, arguments);
3546
+ }
3547
+ return _possibleConstructorReturn$2(this, result);
3548
+ };
3549
+ }
3550
+ var DocumentEmotion = /*#__PURE__*/ function(Document1) {
3551
+ _inherits$2(DocumentEmotion, Document1);
3552
+ var _super = _createSuper$2(DocumentEmotion);
3553
+ function DocumentEmotion() {
3554
+ _classCallCheck$2(this, DocumentEmotion);
3555
+ return _super.apply(this, arguments);
3556
+ }
3557
+ var _proto = DocumentEmotion.prototype;
3558
+ _proto.render = function render() {
3559
+ var ___NEXT_DATA__ = this.props.__NEXT_DATA__, locale = ___NEXT_DATA__.locale, defaultLocale = ___NEXT_DATA__.defaultLocale;
3560
+ return /*#__PURE__*/ React.createElement(NextDocument.Html, {
3561
+ lang: locale || defaultLocale,
3562
+ className: "no-js"
3563
+ }, /*#__PURE__*/ React.createElement(NextDocument.Head, null, /*#__PURE__*/ React.createElement(react$1.NoJs, null), this.props.emotionStyleTags), /*#__PURE__*/ React.createElement("body", null, /*#__PURE__*/ React.createElement(NextDocument.Main, null), /*#__PURE__*/ React.createElement(NextDocument.NextScript, null)));
3564
+ };
3565
+ return DocumentEmotion;
3566
+ }(_wrapNativeSuper(NextDocument__default["default"]));
3567
+ // `getInitialProps` belongs to `_document` (instead of `_app`),
3568
+ // it's compatible with static-site generation (SSG).
3569
+ DocumentEmotion.getInitialProps = function() {
3570
+ var _ref = _asyncToGenerator$4(regeneratorRuntime$1.mark(function _callee(ctx) {
3571
+ var originalRenderPage, cache, extractCriticalToChunks, initialProps, emotionStyles, emotionStyleTags;
3572
+ return regeneratorRuntime$1.wrap(function _callee$(_ctx) {
3573
+ while(1)switch(_ctx.prev = _ctx.next){
3574
+ case 0:
3575
+ originalRenderPage = ctx.renderPage;
3576
+ cache = createEmotionCache();
3577
+ extractCriticalToChunks = createEmotionServer__default["default"](cache).extractCriticalToChunks;
3578
+ ctx.renderPage = function() {
3579
+ return originalRenderPage({
3580
+ enhanceApp: function(App) {
3581
+ return function EnhanceApp(props) {
3582
+ return /*#__PURE__*/ React.createElement(App, _extends$4({
3583
+ emotionCache: cache
3584
+ }, props));
3585
+ };
3586
+ }
3587
+ });
3588
+ };
3589
+ _ctx.next = 6;
3590
+ return NextDocument__default["default"].getInitialProps(ctx);
3591
+ case 6:
3592
+ initialProps = _ctx.sent;
3593
+ emotionStyles = extractCriticalToChunks(initialProps.html);
3594
+ emotionStyleTags = emotionStyles.styles.map(function(style) {
3595
+ return /*#__PURE__*/ React.createElement("style", {
3596
+ "data-emotion": "".concat(style.key, " ").concat(style.ids.join(" ")),
3597
+ key: style.key,
3598
+ // eslint-disable-next-line react/no-danger
3599
+ dangerouslySetInnerHTML: {
3600
+ __html: style.css
3601
+ }
3602
+ });
3603
+ });
3604
+ return _ctx.abrupt("return", _objectSpread$5({}, initialProps, {
3605
+ emotionStyleTags: emotionStyleTags
3606
+ }));
3607
+ case 10:
3608
+ case "end":
3609
+ return _ctx.stop();
3610
+ }
3611
+ }, _callee);
3612
+ }));
3613
+ return function(ctx) {
3614
+ return _ref.apply(this, arguments);
3615
+ };
3616
+ }();
3617
+
3618
+ function _assertThisInitialized$1(self) {
3619
+ if (self === void 0) {
3620
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3621
+ }
3622
+ return self;
3623
+ }
3624
+ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
3625
+ try {
3626
+ var info = gen[key](arg);
3627
+ var value = info.value;
3628
+ } catch (error) {
3629
+ reject(error);
3630
+ return;
3631
+ }
3632
+ if (info.done) {
3633
+ resolve(value);
3634
+ } else {
3635
+ Promise.resolve(value).then(_next, _throw);
3636
+ }
3637
+ }
3638
+ function _asyncToGenerator$3(fn) {
3639
+ return function() {
3640
+ var self = this, args = arguments;
3641
+ return new Promise(function(resolve, reject) {
3642
+ var gen = fn.apply(self, args);
3643
+ function _next(value) {
3644
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
3645
+ }
3646
+ function _throw(err) {
3647
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
3648
+ }
3649
+ _next(undefined);
3650
+ });
3651
+ };
3652
+ }
3653
+ function _classCallCheck$1(instance, Constructor) {
3654
+ if (!(instance instanceof Constructor)) {
3655
+ throw new TypeError("Cannot call a class as a function");
3656
+ }
3657
+ }
3658
+ function _defineProperty$4(obj, key, value) {
3659
+ if (key in obj) {
3660
+ Object.defineProperty(obj, key, {
3661
+ value: value,
3662
+ enumerable: true,
3663
+ configurable: true,
3664
+ writable: true
3665
+ });
3666
+ } else {
3667
+ obj[key] = value;
3668
+ }
3669
+ return obj;
3670
+ }
3671
+ function _extends$3() {
3672
+ _extends$3 = Object.assign || function(target) {
3673
+ for(var i = 1; i < arguments.length; i++){
3674
+ var source = arguments[i];
3675
+ for(var key in source){
3676
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3677
+ target[key] = source[key];
3678
+ }
3679
+ }
3680
+ }
3681
+ return target;
3682
+ };
3683
+ return _extends$3.apply(this, arguments);
3684
+ }
3685
+ function _getPrototypeOf$1(o) {
3686
+ _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
3687
+ return o.__proto__ || Object.getPrototypeOf(o);
3688
+ };
3689
+ return _getPrototypeOf$1(o);
3690
+ }
3691
+ function _inherits$1(subClass, superClass) {
3692
+ if (typeof superClass !== "function" && superClass !== null) {
3693
+ throw new TypeError("Super expression must either be null or a function");
3694
+ }
3695
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
3696
+ constructor: {
3697
+ value: subClass,
3698
+ writable: true,
3699
+ configurable: true
3700
+ }
3701
+ });
3702
+ if (superClass) _setPrototypeOf$1(subClass, superClass);
3703
+ }
3704
+ function _objectSpread$4(target) {
3705
+ for(var i = 1; i < arguments.length; i++){
3706
+ var source = arguments[i] != null ? arguments[i] : {};
3707
+ var ownKeys = Object.keys(source);
3708
+ if (typeof Object.getOwnPropertySymbols === "function") {
3709
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
3710
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
3711
+ }));
3712
+ }
3713
+ ownKeys.forEach(function(key) {
3714
+ _defineProperty$4(target, key, source[key]);
3715
+ });
3716
+ }
3717
+ return target;
3718
+ }
3719
+ function _possibleConstructorReturn$1(self, call) {
3720
+ if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
3721
+ return call;
3722
+ }
3723
+ return _assertThisInitialized$1(self);
3724
+ }
3725
+ function _setPrototypeOf$1(o, p) {
3726
+ _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
3727
+ o.__proto__ = p;
3728
+ return o;
3729
+ };
3730
+ return _setPrototypeOf$1(o, p);
3731
+ }
3732
+ var _typeof$1 = function(obj) {
3733
+ "@swc/helpers - typeof";
3734
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3735
+ };
3736
+ function _isNativeReflectConstruct$1() {
3737
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3738
+ if (Reflect.construct.sham) return false;
3739
+ if (typeof Proxy === "function") return true;
3740
+ try {
3741
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
3742
+ return true;
3743
+ } catch (e) {
3744
+ return false;
3745
+ }
3746
+ }
3747
+ function _createSuper$1(Derived) {
3748
+ var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
3749
+ return function _createSuperInternal() {
3750
+ var Super = _getPrototypeOf$1(Derived), result;
3751
+ if (hasNativeReflectConstruct) {
3752
+ var NewTarget = _getPrototypeOf$1(this).constructor;
3753
+ result = Reflect.construct(Super, arguments, NewTarget);
3754
+ } else {
3755
+ result = Super.apply(this, arguments);
3756
+ }
3757
+ return _possibleConstructorReturn$1(this, result);
3758
+ };
3759
+ }
3760
+ /**
3761
+ * For typescript safety of this component
3762
+ *
3763
+ * @see https://bit.ly/3ceuF8m
3764
+ */ var DocumentSc = /*#__PURE__*/ function(NextDocument1) {
3765
+ _inherits$1(DocumentSc, NextDocument1);
3766
+ var _super = _createSuper$1(DocumentSc);
3767
+ function DocumentSc() {
3768
+ _classCallCheck$1(this, DocumentSc);
3769
+ return _super.apply(this, arguments);
3770
+ }
3771
+ var _proto = DocumentSc.prototype;
3772
+ _proto.render = function render() {
3773
+ var ___NEXT_DATA__ = this.props.__NEXT_DATA__, locale = ___NEXT_DATA__.locale, defaultLocale = ___NEXT_DATA__.defaultLocale;
3774
+ return /*#__PURE__*/ React.createElement(NextDocument.Html, {
3775
+ lang: locale || defaultLocale,
3776
+ className: "no-js"
3777
+ }, /*#__PURE__*/ React.createElement(NextDocument.Head, null, /*#__PURE__*/ React.createElement(react$1.Meta, null), /*#__PURE__*/ React.createElement(react$1.NoJs, null)), /*#__PURE__*/ React.createElement("body", null, /*#__PURE__*/ React.createElement(NextDocument.Main, null), /*#__PURE__*/ React.createElement(NextDocument.NextScript, null)));
3778
+ };
3779
+ DocumentSc.getInitialProps = function getInitialProps(ctx) {
3780
+ return _asyncToGenerator$3(regeneratorRuntime$1.mark(function _callee() {
3781
+ var sheet, originalRenderPage, initialProps;
3782
+ return regeneratorRuntime$1.wrap(function _callee$(_ctx) {
3783
+ while(1)switch(_ctx.prev = _ctx.next){
3784
+ case 0:
3785
+ sheet = new styledComponents.ServerStyleSheet();
3786
+ originalRenderPage = ctx.renderPage;
3787
+ _ctx.prev = 2;
3788
+ ctx.renderPage = function() {
3789
+ return originalRenderPage({
3790
+ enhanceApp: function(App) {
3791
+ return function(props) {
3792
+ return sheet.collectStyles(/*#__PURE__*/ React.createElement(App, _extends$3({}, props)));
3793
+ };
3794
+ }
3795
+ });
3796
+ };
3797
+ _ctx.next = 6;
3798
+ return NextDocument__default["default"].getInitialProps(ctx);
3799
+ case 6:
3800
+ initialProps = _ctx.sent;
3801
+ return _ctx.abrupt("return", _objectSpread$4({}, initialProps, {
3802
+ styles: /*#__PURE__*/ React.createElement(React.Fragment, null, initialProps.styles, sheet.getStyleElement())
3803
+ }));
3804
+ case 8:
3805
+ _ctx.prev = 8;
3806
+ sheet.seal();
3807
+ return _ctx.finish(8);
3808
+ case 11:
3809
+ case "end":
3810
+ return _ctx.stop();
3811
+ }
3812
+ }, _callee, null, [
3813
+ [
3814
+ 2,
3815
+ ,
3816
+ 8,
3817
+ 11
3818
+ ]
3819
+ ]);
3820
+ }))();
3821
+ };
3822
+ return DocumentSc;
3823
+ }(NextDocument__default["default"]);
3824
+
3825
+ function _assertThisInitialized(self) {
3826
+ if (self === void 0) {
3827
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3828
+ }
3829
+ return self;
3830
+ }
3831
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
3832
+ try {
3833
+ var info = gen[key](arg);
3834
+ var value = info.value;
3835
+ } catch (error) {
3836
+ reject(error);
3837
+ return;
3838
+ }
3839
+ if (info.done) {
3840
+ resolve(value);
3841
+ } else {
3842
+ Promise.resolve(value).then(_next, _throw);
3843
+ }
3844
+ }
3845
+ function _asyncToGenerator$2(fn) {
3846
+ return function() {
3847
+ var self = this, args = arguments;
3848
+ return new Promise(function(resolve, reject) {
3849
+ var gen = fn.apply(self, args);
3850
+ function _next(value) {
3851
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
3852
+ }
3853
+ function _throw(err) {
3854
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
3855
+ }
3856
+ _next(undefined);
3857
+ });
3858
+ };
3859
+ }
3860
+ function _classCallCheck(instance, Constructor) {
3861
+ if (!(instance instanceof Constructor)) {
3862
+ throw new TypeError("Cannot call a class as a function");
3863
+ }
3864
+ }
3865
+ function _defineProperty$3(obj, key, value) {
3866
+ if (key in obj) {
3867
+ Object.defineProperty(obj, key, {
3868
+ value: value,
3869
+ enumerable: true,
3870
+ configurable: true,
3871
+ writable: true
3872
+ });
3873
+ } else {
3874
+ obj[key] = value;
3875
+ }
3876
+ return obj;
3877
+ }
3878
+ function _getPrototypeOf(o) {
3879
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
3880
+ return o.__proto__ || Object.getPrototypeOf(o);
3881
+ };
3882
+ return _getPrototypeOf(o);
3883
+ }
3884
+ function _inherits(subClass, superClass) {
3885
+ if (typeof superClass !== "function" && superClass !== null) {
3886
+ throw new TypeError("Super expression must either be null or a function");
3887
+ }
3888
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
3889
+ constructor: {
3890
+ value: subClass,
3891
+ writable: true,
3892
+ configurable: true
3893
+ }
3894
+ });
3895
+ if (superClass) _setPrototypeOf(subClass, superClass);
3896
+ }
3897
+ function _objectSpread$3(target) {
3898
+ for(var i = 1; i < arguments.length; i++){
3899
+ var source = arguments[i] != null ? arguments[i] : {};
3900
+ var ownKeys = Object.keys(source);
3901
+ if (typeof Object.getOwnPropertySymbols === "function") {
3902
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
3903
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
3904
+ }));
3905
+ }
3906
+ ownKeys.forEach(function(key) {
3907
+ _defineProperty$3(target, key, source[key]);
3908
+ });
3909
+ }
3910
+ return target;
3911
+ }
3912
+ function _possibleConstructorReturn(self, call) {
3913
+ if (call && (_typeof(call) === "object" || typeof call === "function")) {
3914
+ return call;
3915
+ }
3916
+ return _assertThisInitialized(self);
3917
+ }
3918
+ function _setPrototypeOf(o, p) {
3919
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
3920
+ o.__proto__ = p;
3921
+ return o;
3922
+ };
3923
+ return _setPrototypeOf(o, p);
3924
+ }
3925
+ var _typeof = function(obj) {
3926
+ "@swc/helpers - typeof";
3927
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3928
+ };
3929
+ function _isNativeReflectConstruct() {
3930
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3931
+ if (Reflect.construct.sham) return false;
3932
+ if (typeof Proxy === "function") return true;
3933
+ try {
3934
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
3935
+ return true;
3936
+ } catch (e) {
3937
+ return false;
3938
+ }
3939
+ }
3940
+ function _createSuper(Derived) {
3941
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
3942
+ return function _createSuperInternal() {
3943
+ var Super = _getPrototypeOf(Derived), result;
3944
+ if (hasNativeReflectConstruct) {
3945
+ var NewTarget = _getPrototypeOf(this).constructor;
3946
+ result = Reflect.construct(Super, arguments, NewTarget);
3947
+ } else {
3948
+ result = Super.apply(this, arguments);
3949
+ }
3950
+ return _possibleConstructorReturn(this, result);
3951
+ };
3952
+ }
3953
+ /**
3954
+ */ var DocumentVanilla = /*#__PURE__*/ function(NextDocument1) {
3955
+ _inherits(DocumentVanilla, NextDocument1);
3956
+ var _super = _createSuper(DocumentVanilla);
3957
+ function DocumentVanilla() {
3958
+ _classCallCheck(this, DocumentVanilla);
3959
+ return _super.apply(this, arguments);
3960
+ }
3961
+ var _proto = DocumentVanilla.prototype;
3962
+ _proto.render = function render() {
3963
+ var ___NEXT_DATA__ = this.props.__NEXT_DATA__, locale = ___NEXT_DATA__.locale, defaultLocale = ___NEXT_DATA__.defaultLocale;
3964
+ return /*#__PURE__*/ React.createElement(NextDocument.Html, {
3965
+ lang: locale || defaultLocale,
3966
+ className: "no-js"
3967
+ }, /*#__PURE__*/ React.createElement(NextDocument.Head, null, /*#__PURE__*/ React.createElement(react$1.Meta, null), /*#__PURE__*/ React.createElement(react$1.NoJs, null)), /*#__PURE__*/ React.createElement("body", null, /*#__PURE__*/ React.createElement(NextDocument.Main, null), /*#__PURE__*/ React.createElement(NextDocument.NextScript, null)));
3968
+ };
3969
+ DocumentVanilla.getInitialProps = function getInitialProps(ctx) {
3970
+ return _asyncToGenerator$2(regeneratorRuntime$1.mark(function _callee() {
3971
+ var ref, initialProps;
3972
+ return regeneratorRuntime$1.wrap(function _callee$(_ctx) {
3973
+ while(1)switch(_ctx.prev = _ctx.next){
3974
+ case 0:
3975
+ _ctx.next = 3;
3976
+ return NextDocument__default["default"].getInitialProps(ctx);
3977
+ case 3:
3978
+ initialProps = _ctx.sent;
3979
+ return _ctx.abrupt("return", _objectSpread$3({}, initialProps, {
3980
+ theme: react$1.getInitialThemeFromRequest(((ref = ctx.req) === null || ref === void 0 ? void 0 : ref.headers.cookie /* || document?.cookie */ ) || "")
3981
+ }));
3982
+ case 5:
3983
+ case "end":
3984
+ return _ctx.stop();
3985
+ }
3986
+ }, _callee);
3987
+ }))();
3988
+ };
3989
+ return DocumentVanilla;
3990
+ }(NextDocument__default["default"]);
3991
+
3992
+ function _extends$2() {
3993
+ _extends$2 = Object.assign || function(target) {
3994
+ for(var i = 1; i < arguments.length; i++){
3995
+ var source = arguments[i];
3996
+ for(var key in source){
3997
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3998
+ target[key] = source[key];
3999
+ }
4000
+ }
4001
+ }
4002
+ return target;
4003
+ };
4004
+ return _extends$2.apply(this, arguments);
4005
+ }
4006
+ var Favicon = function(props) {
4007
+ return /*#__PURE__*/ React.createElement(Head__default["default"], null, /*#__PURE__*/ React.createElement(react$1.FaviconTags, _extends$2({}, props)));
4008
+ };
4009
+
4010
+ function _defineProperty$2(obj, key, value) {
4011
+ if (key in obj) {
4012
+ Object.defineProperty(obj, key, {
4013
+ value: value,
4014
+ enumerable: true,
4015
+ configurable: true,
4016
+ writable: true
4017
+ });
4018
+ } else {
4019
+ obj[key] = value;
4020
+ }
4021
+ return obj;
4022
+ }
4023
+ function _objectSpread$2(target) {
4024
+ for(var i = 1; i < arguments.length; i++){
4025
+ var source = arguments[i] != null ? arguments[i] : {};
4026
+ var ownKeys = Object.keys(source);
4027
+ if (typeof Object.getOwnPropertySymbols === "function") {
4028
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
4029
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
4030
+ }));
4031
+ }
4032
+ ownKeys.forEach(function(key) {
4033
+ _defineProperty$2(target, key, source[key]);
4034
+ });
4035
+ }
4036
+ return target;
4037
+ }
4038
+ function useForm(// eslint-disable-next-line @typescript-eslint/no-explicit-any
4039
+ schema, i18nNamespace) {
4040
+ var formProps = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
4041
+ var t = useT(i18nNamespace);
4042
+ // const form = _useForm<InferType<ObjectSchema<T, object>>>({
4043
+ var form = reactHookForm.useForm(_objectSpread$2({
4044
+ // @ts-expect-error FIXME:
4045
+ resolver: yup.yupResolver(schema)
4046
+ }, formProps));
4047
+ // const { control, register, setValue } = form;
4048
+ // const field = { control, register, setValue, t };
4049
+ // if ("production" !== process.env["NODE_ENV"]) {
4050
+ // if (debug) {
4051
+ // console.log(
4052
+ // `Form ${i18nNamespace} data`,
4053
+ // form.watch(),
4054
+ // `errors: `,
4055
+ // form.formState.errors
4056
+ // );
4057
+ // }
4058
+ // }
4059
+ // if (formProps.mode === "onChange") {
4060
+ // return { field, ...form };
4061
+ // }
4062
+ return React$1.useMemo(function() {
4063
+ var control = form.control, register = form.register, setValue = form.setValue;
4064
+ var field = {
4065
+ control: control,
4066
+ register: register,
4067
+ setValue: setValue,
4068
+ t: t
4069
+ };
4070
+ return _objectSpread$2({
4071
+ field: field
4072
+ }, form);
4073
+ }, [
4074
+ t,
4075
+ form
4076
+ ]);
4077
+ }
4078
+
4079
+ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
4080
+ try {
4081
+ var info = gen[key](arg);
4082
+ var value = info.value;
4083
+ } catch (error) {
4084
+ reject(error);
4085
+ return;
4086
+ }
4087
+ if (info.done) {
4088
+ resolve(value);
4089
+ } else {
4090
+ Promise.resolve(value).then(_next, _throw);
4091
+ }
4092
+ }
4093
+ function _asyncToGenerator$1(fn) {
4094
+ return function() {
4095
+ var self = this, args = arguments;
4096
+ return new Promise(function(resolve, reject) {
4097
+ var gen = fn.apply(self, args);
4098
+ function _next(value) {
4099
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
4100
+ }
4101
+ function _throw(err) {
4102
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
4103
+ }
4104
+ _next(undefined);
4105
+ });
4106
+ };
4107
+ }
4108
+ function _defineProperty$1(obj, key, value) {
4109
+ if (key in obj) {
4110
+ Object.defineProperty(obj, key, {
4111
+ value: value,
4112
+ enumerable: true,
4113
+ configurable: true,
4114
+ writable: true
4115
+ });
4116
+ } else {
4117
+ obj[key] = value;
4118
+ }
4119
+ return obj;
4120
+ }
4121
+ function _objectSpread$1(target) {
4122
+ for(var i = 1; i < arguments.length; i++){
4123
+ var source = arguments[i] != null ? arguments[i] : {};
4124
+ var ownKeys = Object.keys(source);
4125
+ if (typeof Object.getOwnPropertySymbols === "function") {
4126
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
4127
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
4128
+ }));
4129
+ }
4130
+ ownKeys.forEach(function(key) {
4131
+ _defineProperty$1(target, key, source[key]);
4132
+ });
4133
+ }
4134
+ return target;
4135
+ }
4136
+ var api = [
4137
+ "get",
4138
+ "post",
4139
+ "put",
4140
+ "patch",
4141
+ "delete"
4142
+ ].reduce(function(api1, method) {
4143
+ api1[method] = function() {
4144
+ var _ref = _asyncToGenerator$1(regeneratorRuntime$1.mark(function _callee(endpoint) {
4145
+ var options, _json, json, params, _headers, headers, _timeout, timeout, requestInit, timeoutNumber, controller, timeoutId, url, response, result, _args = arguments;
4146
+ return regeneratorRuntime$1.wrap(function _callee$(_ctx) {
4147
+ while(1)switch(_ctx.prev = _ctx.next){
4148
+ case 0:
4149
+ options = _args.length > 1 && _args[1] !== void 0 ? _args[1] : {};
4150
+ _json = options.json, json = _json === void 0 ? {} : _json, params = options.params, _headers = options.headers, headers = _headers === void 0 ? {} : _headers, _timeout = options.timeout, timeout = _timeout === void 0 ? 10000 : _timeout;
4151
+ requestInit = {
4152
+ method: method.toUpperCase(),
4153
+ headers: _objectSpread$1({
4154
+ "content-type": "application/json"
4155
+ }, headers)
4156
+ };
4157
+ timeoutNumber = Number(timeout);
4158
+ url = "/api/".concat(endpoint.replace(/^\/*/, ""));
4159
+ if (method !== "get") {
4160
+ requestInit.body = JSON.stringify(json);
4161
+ }
4162
+ if (timeoutNumber > 0) {
4163
+ controller = new AbortController();
4164
+ timeoutId = setTimeout(function() {
4165
+ return controller.abort();
4166
+ }, timeoutNumber);
4167
+ requestInit.signal = controller.signal;
4168
+ }
4169
+ if (params) {
4170
+ url += utils.buildUrlQueryString(params);
4171
+ }
4172
+ _ctx.next = 12;
4173
+ return fetch(url, requestInit);
4174
+ case 12:
4175
+ response = _ctx.sent;
4176
+ if (timeoutId) {
4177
+ clearTimeout(timeoutId);
4178
+ }
4179
+ _ctx.next = 16;
4180
+ return response.json();
4181
+ case 16:
4182
+ result = _ctx.sent;
4183
+ return _ctx.abrupt("return", result);
4184
+ case 18:
4185
+ case "end":
4186
+ return _ctx.stop();
4187
+ }
4188
+ }, _callee);
4189
+ }));
4190
+ return function(endpoint) {
4191
+ return _ref.apply(this, arguments);
4192
+ };
4193
+ }();
4194
+ return api1;
4195
+ }, {});
4196
+
4197
+ function _arrayLikeToArray$1(arr, len) {
4198
+ if (len == null || len > arr.length) len = arr.length;
4199
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4200
+ return arr2;
4201
+ }
4202
+ function _arrayWithHoles$1(arr) {
4203
+ if (Array.isArray(arr)) return arr;
4204
+ }
4205
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
4206
+ try {
4207
+ var info = gen[key](arg);
4208
+ var value = info.value;
4209
+ } catch (error) {
4210
+ reject(error);
4211
+ return;
4212
+ }
4213
+ if (info.done) {
4214
+ resolve(value);
4215
+ } else {
4216
+ Promise.resolve(value).then(_next, _throw);
4217
+ }
4218
+ }
4219
+ function _asyncToGenerator(fn) {
4220
+ return function() {
4221
+ var self = this, args = arguments;
4222
+ return new Promise(function(resolve, reject) {
4223
+ var gen = fn.apply(self, args);
4224
+ function _next(value) {
4225
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
4226
+ }
4227
+ function _throw(err) {
4228
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
4229
+ }
4230
+ _next(undefined);
4231
+ });
4232
+ };
4233
+ }
4234
+ function _defineProperty(obj, key, value) {
4235
+ if (key in obj) {
4236
+ Object.defineProperty(obj, key, {
4237
+ value: value,
4238
+ enumerable: true,
4239
+ configurable: true,
4240
+ writable: true
4241
+ });
4242
+ } else {
4243
+ obj[key] = value;
4244
+ }
4245
+ return obj;
4246
+ }
4247
+ function _iterableToArrayLimit$1(arr, i) {
4248
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
4249
+ if (_i == null) return;
4250
+ var _arr = [];
4251
+ var _n = true;
4252
+ var _d = false;
4253
+ var _s, _e;
4254
+ try {
4255
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
4256
+ _arr.push(_s.value);
4257
+ if (i && _arr.length === i) break;
4258
+ }
4259
+ } catch (err) {
4260
+ _d = true;
4261
+ _e = err;
4262
+ } finally{
4263
+ try {
4264
+ if (!_n && _i["return"] != null) _i["return"]();
4265
+ } finally{
4266
+ if (_d) throw _e;
4267
+ }
4268
+ }
4269
+ return _arr;
4270
+ }
4271
+ function _nonIterableRest$1() {
4272
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4273
+ }
4274
+ function _objectSpread(target) {
4275
+ for(var i = 1; i < arguments.length; i++){
4276
+ var source = arguments[i] != null ? arguments[i] : {};
4277
+ var ownKeys = Object.keys(source);
4278
+ if (typeof Object.getOwnPropertySymbols === "function") {
4279
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
4280
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
4281
+ }));
4282
+ }
4283
+ ownKeys.forEach(function(key) {
4284
+ _defineProperty(target, key, source[key]);
4285
+ });
4286
+ }
4287
+ return target;
4288
+ }
4289
+ function _slicedToArray$1(arr, i) {
4290
+ return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
4291
+ }
4292
+ function _unsupportedIterableToArray$1(o, minLen) {
4293
+ if (!o) return;
4294
+ if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
4295
+ var n = Object.prototype.toString.call(o).slice(8, -1);
4296
+ if (n === "Object" && o.constructor) n = o.constructor.name;
4297
+ if (n === "Map" || n === "Set") return Array.from(n);
4298
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
4299
+ }
4300
+ function useSubmit(url, transformData) {
4301
+ var ref = _slicedToArray$1(reactUse.useAsyncFn(function() {
4302
+ var _ref = _asyncToGenerator(regeneratorRuntime$1.mark(function _callee(json) {
4303
+ var response;
4304
+ return regeneratorRuntime$1.wrap(function _callee$(_ctx) {
4305
+ while(1)switch(_ctx.prev = _ctx.next){
4306
+ case 0:
4307
+ if (transformData) json = transformData(json);
4308
+ _ctx.next = 3;
4309
+ return api.post(url, {
4310
+ json: json
4311
+ });
4312
+ case 3:
4313
+ response = _ctx.sent;
4314
+ if ("production" !== process.env["NODE_ENV"]) {
4315
+ console.log("[@koine/next] useSubmit response", response);
4316
+ }
4317
+ return _ctx.abrupt("return", response);
4318
+ case 6:
4319
+ case "end":
4320
+ return _ctx.stop();
4321
+ }
4322
+ }, _callee);
4323
+ }));
4324
+ return function(json) {
4325
+ return _ref.apply(this, arguments);
4326
+ };
4327
+ }(), [
4328
+ url,
4329
+ transformData
4330
+ ]), 2), state = ref[0], submit = ref[1];
4331
+ var loading = state.loading, error = state.error, value = state.value;
4332
+ var fail = !loading && (!!error || (value === null || value === void 0 ? void 0 : value.fail));
4333
+ return _objectSpread({
4334
+ submit: submit,
4335
+ loading: loading
4336
+ }, value || {}, {
4337
+ fail: fail
4338
+ });
4339
+ }
4340
+
4341
+ function _arrayLikeToArray(arr, len) {
4342
+ if (len == null || len > arr.length) len = arr.length;
4343
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4344
+ return arr2;
4345
+ }
4346
+ function _arrayWithHoles(arr) {
4347
+ if (Array.isArray(arr)) return arr;
4348
+ }
4349
+ function _extends$1() {
4350
+ _extends$1 = Object.assign || function(target) {
4351
+ for(var i = 1; i < arguments.length; i++){
4352
+ var source = arguments[i];
4353
+ for(var key in source){
4354
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
4355
+ target[key] = source[key];
4356
+ }
4357
+ }
4358
+ }
4359
+ return target;
4360
+ };
4361
+ return _extends$1.apply(this, arguments);
4362
+ }
4363
+ function _iterableToArrayLimit(arr, i) {
4364
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
4365
+ if (_i == null) return;
4366
+ var _arr = [];
4367
+ var _n = true;
4368
+ var _d = false;
4369
+ var _s, _e;
4370
+ try {
4371
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
4372
+ _arr.push(_s.value);
4373
+ if (i && _arr.length === i) break;
4374
+ }
4375
+ } catch (err) {
4376
+ _d = true;
4377
+ _e = err;
4378
+ } finally{
4379
+ try {
4380
+ if (!_n && _i["return"] != null) _i["return"]();
4381
+ } finally{
4382
+ if (_d) throw _e;
4383
+ }
4384
+ }
4385
+ return _arr;
4386
+ }
4387
+ function _nonIterableRest() {
4388
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4389
+ }
4390
+ function _objectWithoutProperties$1(source, excluded) {
4391
+ if (source == null) return {};
4392
+ var target = _objectWithoutPropertiesLoose$1(source, excluded);
4393
+ var key, i;
4394
+ if (Object.getOwnPropertySymbols) {
4395
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
4396
+ for(i = 0; i < sourceSymbolKeys.length; i++){
4397
+ key = sourceSymbolKeys[i];
4398
+ if (excluded.indexOf(key) >= 0) continue;
4399
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
4400
+ target[key] = source[key];
4401
+ }
4402
+ }
4403
+ return target;
4404
+ }
4405
+ function _objectWithoutPropertiesLoose$1(source, excluded) {
4406
+ if (source == null) return {};
4407
+ var target = {};
4408
+ var sourceKeys = Object.keys(source);
4409
+ var key, i;
4410
+ for(i = 0; i < sourceKeys.length; i++){
4411
+ key = sourceKeys[i];
4412
+ if (excluded.indexOf(key) >= 0) continue;
4413
+ target[key] = source[key];
4414
+ }
4415
+ return target;
4416
+ }
4417
+ function _slicedToArray(arr, i) {
4418
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
4419
+ }
4420
+ function _unsupportedIterableToArray(o, minLen) {
4421
+ if (!o) return;
4422
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
4423
+ var n = Object.prototype.toString.call(o).slice(8, -1);
4424
+ if (n === "Object" && o.constructor) n = o.constructor.name;
4425
+ if (n === "Map" || n === "Set") return Array.from(n);
4426
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
4427
+ }
4428
+ var NextImg = function(props) {
4429
+ return /*#__PURE__*/ React.createElement(NextImage__default["default"], _extends$1({}, props));
4430
+ };
4431
+ var NextImgSmart = function(props) {
4432
+ var ref = _slicedToArray(React$1.useState(false), 2), $loaded = ref[0], setLoaded = ref[1];
4433
+ var ref1 = _slicedToArray(React$1.useState(false), 2), $error = ref1[0], setError = ref1[1];
4434
+ var ref2 = getNextImgProps(props), nextImgProps = ref2.nextImgProps, restProps = ref2.restProps;
4435
+ var Wrap = restProps.Wrap;
4436
+ return nextImgProps.priority ? /*#__PURE__*/ React.createElement(NextImage__default["default"], _extends$1({}, nextImgProps)) : /*#__PURE__*/ React.createElement(Wrap, _extends$1({}, restProps, {
4437
+ $loaded: $loaded,
4438
+ $error: $error
4439
+ }), /*#__PURE__*/ React.createElement(NextImage__default["default"], _extends$1({}, nextImgProps, {
4440
+ onLoadingComplete: function() {
4441
+ return setLoaded(true);
4442
+ },
4443
+ onError: function() {
4444
+ return setError(true);
4445
+ }
4446
+ })));
4447
+ };
4448
+ function getNextImgProps(_param) {
4449
+ var src = _param.src, alt = _param.alt, layout = _param.layout, blurDataURL = _param.blurDataURL, width = _param.width, height = _param.height, priority = _param.priority, objectFit = _param.objectFit, objectPosition = _param.objectPosition, restProps = _objectWithoutProperties$1(_param, [
4450
+ "src",
4451
+ "alt",
4452
+ "layout",
4453
+ "blurDataURL",
4454
+ "width",
4455
+ "height",
4456
+ "priority",
4457
+ "objectFit",
4458
+ "objectPosition"
4459
+ ]);
4460
+ var nextImgProps = {
4461
+ src: src,
4462
+ alt: alt,
4463
+ layout: layout,
4464
+ blurDataURL: blurDataURL,
4465
+ width: width,
4466
+ height: height,
4467
+ priority: priority,
4468
+ objectFit: objectFit,
4469
+ objectPosition: objectPosition
4470
+ };
4471
+ return {
4472
+ nextImgProps: nextImgProps,
4473
+ restProps: restProps
4474
+ };
4475
+ }
4476
+
4477
+ function _extends() {
4478
+ _extends = Object.assign || function(target) {
4479
+ for(var i = 1; i < arguments.length; i++){
4480
+ var source = arguments[i];
4481
+ for(var key in source){
4482
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
4483
+ target[key] = source[key];
4484
+ }
4485
+ }
4486
+ }
4487
+ return target;
4488
+ };
4489
+ return _extends.apply(this, arguments);
4490
+ }
4491
+ function _objectWithoutProperties(source, excluded) {
4492
+ if (source == null) return {};
4493
+ var target = _objectWithoutPropertiesLoose(source, excluded);
4494
+ var key, i;
4495
+ if (Object.getOwnPropertySymbols) {
4496
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
4497
+ for(i = 0; i < sourceSymbolKeys.length; i++){
4498
+ key = sourceSymbolKeys[i];
4499
+ if (excluded.indexOf(key) >= 0) continue;
4500
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
4501
+ target[key] = source[key];
4502
+ }
4503
+ }
4504
+ return target;
4505
+ }
4506
+ function _objectWithoutPropertiesLoose(source, excluded) {
4507
+ if (source == null) return {};
4508
+ var target = {};
4509
+ var sourceKeys = Object.keys(source);
4510
+ var key, i;
4511
+ for(i = 0; i < sourceKeys.length; i++){
4512
+ key = sourceKeys[i];
4513
+ if (excluded.indexOf(key) >= 0) continue;
4514
+ target[key] = source[key];
4515
+ }
4516
+ return target;
4517
+ }
4518
+ var Link = /*#__PURE__*/ React$1.forwardRef(function Link(_param, ref) {
4519
+ var href = _param.href; _param.prefetch; var replace = _param.replace, scroll = _param.scroll, shallow = _param.shallow, locale = _param.locale, props = _objectWithoutProperties(_param, [
4520
+ "href",
4521
+ "prefetch",
4522
+ "replace",
4523
+ "scroll",
4524
+ "shallow",
4525
+ "locale"
4526
+ ]);
4527
+ return /*#__PURE__*/ React.createElement(NextLink__default["default"], {
4528
+ href: href,
4529
+ replace: replace,
4530
+ scroll: scroll,
4531
+ shallow: shallow,
4532
+ locale: locale,
4533
+ passHref: true
4534
+ }, /*#__PURE__*/ React.createElement(react$1.KoineLink, _extends({
4535
+ ref: ref
4536
+ }, props)));
4537
+ });
4538
+
4539
+ var ONE_HOUR = 3600;
4540
+ var ONE_DAY = 84000;
4541
+ /**
4542
+ * Get site absolute url with the given path
4543
+ *
4544
+ * - It uses the `NEXT_PUBLIC_APP_URL` env variable
4545
+ * - It removes the trailing slashes
4546
+ */ function getSiteUrl() {
4547
+ var path = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
4548
+ return utils.normaliseUrl("".concat(process.env["NEXT_PUBLIC_APP_URL"], "/").concat(path));
4549
+ }
4550
+ /**
4551
+ * Utility to load a component with an optional pre-determined delay.
4552
+ *
4553
+ * This was designed to improve anti spam wit async form loading.
4554
+ *
4555
+ * @see https://github.com/vercel/next.js/blob/main/packages/next/next-server/lib/dynamic.tsx
4556
+ * @see https://github.com/vercel/next.js/blob/canary/examples/with-dynamic-import/pages/index.js
4557
+ */ function load(component, milliseconds) {
4558
+ return new Promise(function(resolve) {
4559
+ setTimeout(function() {
4560
+ return resolve(component);
4561
+ }, milliseconds);
4562
+ });
4563
+ }
4564
+
4565
+ var motionFeatures = /*#__PURE__*/Object.freeze({
4566
+ __proto__: null,
4567
+ 'default': framerMotion.domMax
4568
+ });
4569
+
4570
+ Object.defineProperty(exports, 'Head', {
4571
+ enumerable: true,
4572
+ get: function () { return Head__default["default"]; }
4573
+ });
4574
+ Object.defineProperty(exports, 'T', {
4575
+ enumerable: true,
4576
+ get: function () { return Trans__default["default"]; }
4577
+ });
4578
+ exports.AUTH_ROUTES = AUTH_ROUTES;
4579
+ exports.AnalyticsGoogle = AnalyticsGoogle;
4580
+ exports.AppAuthEmotion = AppAuthEmotion;
4581
+ exports.AppAuthSc = AppAuthSc;
4582
+ exports.AppBase = AppBase;
4583
+ exports.AppEmotion = AppEmotion;
4584
+ exports.AppHead = AppHead;
4585
+ exports.AppMain = AppMain;
4586
+ exports.AppMainVanilla = AppMainVanilla;
4587
+ exports.AppThemeEmotion = AppThemeEmotion;
4588
+ exports.AppThemeSc = AppThemeSc;
4589
+ exports.AppThemeVanilla = AppThemeVanilla;
4590
+ exports.AppVanilla = AppVanilla;
4591
+ exports.Document = Document;
4592
+ exports.DocumentEmotion = DocumentEmotion;
4593
+ exports.DocumentSc = DocumentSc;
4594
+ exports.DocumentVanilla = DocumentVanilla;
4595
+ exports.Favicon = Favicon;
4596
+ exports.Link = Link;
4597
+ exports.NextImg = NextImg;
4598
+ exports.NextImgSmart = NextImgSmart;
4599
+ exports.NextProgress = NextProgress;
4600
+ exports.ONE_DAY = ONE_DAY;
4601
+ exports.ONE_HOUR = ONE_HOUR;
4602
+ exports.Seo = Seo;
4603
+ exports.SeoDefaults = SeoDefaults;
4604
+ exports.ThemeProvider = ThemeProvider;
4605
+ exports.api = api;
4606
+ exports.buildTags = buildTags;
4607
+ exports.createEmotionCache = createEmotionCache;
4608
+ exports.getAuthRoutes = getAuthRoutes;
4609
+ exports.getCallbackUrl = getCallbackUrl;
4610
+ exports.getNextImgProps = getNextImgProps;
4611
+ exports.getSiteUrl = getSiteUrl;
4612
+ exports.load = load;
4613
+ exports.translationAsOptions = translationAsOptions;
4614
+ exports.useDateFormat = useDateFormat;
4615
+ exports.useForm = useForm;
4616
+ exports.useLogin = useLogin;
4617
+ exports.useLoginUrl = useLoginUrl;
4618
+ exports.useLogout = useLogout;
4619
+ exports.useLooseT = useLooseT;
4620
+ exports.useSubmit = useSubmit;
4621
+ exports.useT = useT;
4622
+ exports.useTheme = useTheme;
4623
+
4624
+ Object.defineProperty(exports, '__esModule', { value: true });
4625
+
4626
+ }));