UNPKG

41.6 kBJavaScriptView Raw
1import { MDXProvider } from '@mdx-js/react';
2import React__default, { useCallback, useEffect, useState, forwardRef, createElement } from 'react';
3
4function cx(...classNames) {
5 return classNames.filter(Boolean).join(' ');
6}
7
8const noLayout = "n13r7o41";
9const grid = "g1u0grto";
10const extendedWidth = cx(noLayout, "ev9kr8h");
11const fullWidth = cx(noLayout, "f1mtt8dd");
12
13/*!
14 * hotkeys-js v3.7.6
15 * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
16 *
17 * Copyright (c) 2020 kenny wong <wowohoo@qq.com>
18 * http://jaywcjlove.github.io/hotkeys
19 *
20 * Licensed under the MIT license.
21 */
22var isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false; // 绑定事件
23
24function addEvent(object, event, method) {
25 if (object.addEventListener) {
26 object.addEventListener(event, method, false);
27 } else if (object.attachEvent) {
28 object.attachEvent("on".concat(event), function () {
29 method(window.event);
30 });
31 }
32} // 修饰键转换成对应的键码
33
34
35function getMods(modifier, key) {
36 var mods = key.slice(0, key.length - 1);
37
38 for (var i = 0; i < mods.length; i++) {
39 mods[i] = modifier[mods[i].toLowerCase()];
40 }
41
42 return mods;
43} // 处理传的key字符串转换成数组
44
45
46function getKeys(key) {
47 if (typeof key !== 'string') key = '';
48 key = key.replace(/\s/g, ''); // 匹配任何空白字符,包括空格、制表符、换页符等等
49
50 var keys = key.split(','); // 同时设置多个快捷键,以','分割
51
52 var index = keys.lastIndexOf(''); // 快捷键可能包含',',需特殊处理
53
54 for (; index >= 0;) {
55 keys[index - 1] += ',';
56 keys.splice(index, 1);
57 index = keys.lastIndexOf('');
58 }
59
60 return keys;
61} // 比较修饰键的数组
62
63
64function compareArray(a1, a2) {
65 var arr1 = a1.length >= a2.length ? a1 : a2;
66 var arr2 = a1.length >= a2.length ? a2 : a1;
67 var isIndex = true;
68
69 for (var i = 0; i < arr1.length; i++) {
70 if (arr2.indexOf(arr1[i]) === -1) isIndex = false;
71 }
72
73 return isIndex;
74}
75
76var _keyMap = {
77 backspace: 8,
78 tab: 9,
79 clear: 12,
80 enter: 13,
81 "return": 13,
82 esc: 27,
83 escape: 27,
84 space: 32,
85 left: 37,
86 up: 38,
87 right: 39,
88 down: 40,
89 del: 46,
90 "delete": 46,
91 ins: 45,
92 insert: 45,
93 home: 36,
94 end: 35,
95 pageup: 33,
96 pagedown: 34,
97 capslock: 20,
98 '⇪': 20,
99 ',': 188,
100 '.': 190,
101 '/': 191,
102 '`': 192,
103 '-': isff ? 173 : 189,
104 '=': isff ? 61 : 187,
105 ';': isff ? 59 : 186,
106 '\'': 222,
107 '[': 219,
108 ']': 221,
109 '\\': 220
110}; // Modifier Keys
111
112var _modifier = {
113 // shiftKey
114 '⇧': 16,
115 shift: 16,
116 // altKey
117 '⌥': 18,
118 alt: 18,
119 option: 18,
120 // ctrlKey
121 '⌃': 17,
122 ctrl: 17,
123 control: 17,
124 // metaKey
125 '⌘': 91,
126 cmd: 91,
127 command: 91
128};
129var modifierMap = {
130 16: 'shiftKey',
131 18: 'altKey',
132 17: 'ctrlKey',
133 91: 'metaKey',
134 shiftKey: 16,
135 ctrlKey: 17,
136 altKey: 18,
137 metaKey: 91
138};
139var _mods = {
140 16: false,
141 18: false,
142 17: false,
143 91: false
144};
145var _handlers = {}; // F1~F12 special key
146
147for (var k = 1; k < 20; k++) {
148 _keyMap["f".concat(k)] = 111 + k;
149}
150
151var _downKeys = []; // 记录摁下的绑定键
152
153var _scope = 'all'; // 默认热键范围
154
155var elementHasBindEvent = []; // 已绑定事件的节点记录
156// 返回键码
157
158var code = function code(x) {
159 return _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);
160}; // 设置获取当前范围(默认为'所有')
161
162
163function setScope(scope) {
164 _scope = scope || 'all';
165} // 获取当前范围
166
167
168function getScope() {
169 return _scope || 'all';
170} // 获取摁下绑定键的键值
171
172
173function getPressedKeyCodes() {
174 return _downKeys.slice(0);
175} // 表单控件控件判断 返回 Boolean
176// hotkey is effective only when filter return true
177
178
179function filter(event) {
180 var target = event.target || event.srcElement;
181 var tagName = target.tagName;
182 var flag = true; // ignore: isContentEditable === 'true', <input> and <textarea> when readOnly state is false, <select>
183
184 if (target.isContentEditable || (tagName === 'INPUT' || tagName === 'TEXTAREA') && !target.readOnly) {
185 flag = false;
186 }
187
188 return flag;
189} // 判断摁下的键是否为某个键,返回true或者false
190
191
192function isPressed(keyCode) {
193 if (typeof keyCode === 'string') {
194 keyCode = code(keyCode); // 转换成键码
195 }
196
197 return _downKeys.indexOf(keyCode) !== -1;
198} // 循环删除handlers中的所有 scope(范围)
199
200
201function deleteScope(scope, newScope) {
202 var handlers;
203 var i; // 没有指定scope,获取scope
204
205 if (!scope) scope = getScope();
206
207 for (var key in _handlers) {
208 if (Object.prototype.hasOwnProperty.call(_handlers, key)) {
209 handlers = _handlers[key];
210
211 for (i = 0; i < handlers.length;) {
212 if (handlers[i].scope === scope) handlers.splice(i, 1);else i++;
213 }
214 }
215 } // 如果scope被删除,将scope重置为all
216
217
218 if (getScope() === scope) setScope(newScope || 'all');
219} // 清除修饰键
220
221
222function clearModifier(event) {
223 var key = event.keyCode || event.which || event.charCode;
224
225 var i = _downKeys.indexOf(key); // 从列表中清除按压过的键
226
227
228 if (i >= 0) {
229 _downKeys.splice(i, 1);
230 } // 特殊处理 cmmand 键,在 cmmand 组合快捷键 keyup 只执行一次的问题
231
232
233 if (event.key && event.key.toLowerCase() === 'meta') {
234 _downKeys.splice(0, _downKeys.length);
235 } // 修饰键 shiftKey altKey ctrlKey (command||metaKey) 清除
236
237
238 if (key === 93 || key === 224) key = 91;
239
240 if (key in _mods) {
241 _mods[key] = false; // 将修饰键重置为false
242
243 for (var k in _modifier) {
244 if (_modifier[k] === key) hotkeys[k] = false;
245 }
246 }
247}
248
249function unbind(keysInfo) {
250 // unbind(), unbind all keys
251 if (!keysInfo) {
252 Object.keys(_handlers).forEach(function (key) {
253 return delete _handlers[key];
254 });
255 } else if (Array.isArray(keysInfo)) {
256 // support like : unbind([{key: 'ctrl+a', scope: 's1'}, {key: 'ctrl-a', scope: 's2', splitKey: '-'}])
257 keysInfo.forEach(function (info) {
258 if (info.key) eachUnbind(info);
259 });
260 } else if (typeof keysInfo === 'object') {
261 // support like unbind({key: 'ctrl+a, ctrl+b', scope:'abc'})
262 if (keysInfo.key) eachUnbind(keysInfo);
263 } else if (typeof keysInfo === 'string') {
264 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
265 args[_key - 1] = arguments[_key];
266 } // support old method
267 // eslint-disable-line
268
269
270 var scope = args[0],
271 method = args[1];
272
273 if (typeof scope === 'function') {
274 method = scope;
275 scope = '';
276 }
277
278 eachUnbind({
279 key: keysInfo,
280 scope: scope,
281 method: method,
282 splitKey: '+'
283 });
284 }
285} // 解除绑定某个范围的快捷键
286
287
288var eachUnbind = function eachUnbind(_ref) {
289 var key = _ref.key,
290 scope = _ref.scope,
291 method = _ref.method,
292 _ref$splitKey = _ref.splitKey,
293 splitKey = _ref$splitKey === void 0 ? '+' : _ref$splitKey;
294 var multipleKeys = getKeys(key);
295 multipleKeys.forEach(function (originKey) {
296 var unbindKeys = originKey.split(splitKey);
297 var len = unbindKeys.length;
298 var lastKey = unbindKeys[len - 1];
299 var keyCode = lastKey === '*' ? '*' : code(lastKey);
300 if (!_handlers[keyCode]) return; // 判断是否传入范围,没有就获取范围
301
302 if (!scope) scope = getScope();
303 var mods = len > 1 ? getMods(_modifier, unbindKeys) : [];
304 _handlers[keyCode] = _handlers[keyCode].map(function (record) {
305 // 通过函数判断,是否解除绑定,函数相等直接返回
306 var isMatchingMethod = method ? record.method === method : true;
307
308 if (isMatchingMethod && record.scope === scope && compareArray(record.mods, mods)) {
309 return {};
310 }
311
312 return record;
313 });
314 });
315}; // 对监听对应快捷键的回调函数进行处理
316
317
318function eventHandler(event, handler, scope) {
319 var modifiersMatch; // 看它是否在当前范围
320
321 if (handler.scope === scope || handler.scope === 'all') {
322 // 检查是否匹配修饰符(如果有返回true)
323 modifiersMatch = handler.mods.length > 0;
324
325 for (var y in _mods) {
326 if (Object.prototype.hasOwnProperty.call(_mods, y)) {
327 if (!_mods[y] && handler.mods.indexOf(+y) > -1 || _mods[y] && handler.mods.indexOf(+y) === -1) {
328 modifiersMatch = false;
329 }
330 }
331 } // 调用处理程序,如果是修饰键不做处理
332
333
334 if (handler.mods.length === 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91] || modifiersMatch || handler.shortcut === '*') {
335 if (handler.method(event, handler) === false) {
336 if (event.preventDefault) event.preventDefault();else event.returnValue = false;
337 if (event.stopPropagation) event.stopPropagation();
338 if (event.cancelBubble) event.cancelBubble = true;
339 }
340 }
341 }
342} // 处理keydown事件
343
344
345function dispatch(event) {
346 var asterisk = _handlers['*'];
347 var key = event.keyCode || event.which || event.charCode; // 表单控件过滤 默认表单控件不触发快捷键
348
349 if (!hotkeys.filter.call(this, event)) return; // Gecko(Firefox)的command键值224,在Webkit(Chrome)中保持一致
350 // Webkit左右 command 键值不一样
351
352 if (key === 93 || key === 224) key = 91;
353 /**
354 * Collect bound keys
355 * If an Input Method Editor is processing key input and the event is keydown, return 229.
356 * https://stackoverflow.com/questions/25043934/is-it-ok-to-ignore-keydown-events-with-keycode-229
357 * http://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html
358 */
359
360 if (_downKeys.indexOf(key) === -1 && key !== 229) _downKeys.push(key);
361 /**
362 * Jest test cases are required.
363 * ===============================
364 */
365
366 ['ctrlKey', 'altKey', 'shiftKey', 'metaKey'].forEach(function (keyName) {
367 var keyNum = modifierMap[keyName];
368
369 if (event[keyName] && _downKeys.indexOf(keyNum) === -1) {
370 _downKeys.push(keyNum);
371 } else if (!event[keyName] && _downKeys.indexOf(keyNum) > -1) {
372 _downKeys.splice(_downKeys.indexOf(keyNum), 1);
373 }
374 });
375 /**
376 * -------------------------------
377 */
378
379 if (key in _mods) {
380 _mods[key] = true; // 将特殊字符的key注册到 hotkeys 上
381
382 for (var k in _modifier) {
383 if (_modifier[k] === key) hotkeys[k] = true;
384 }
385
386 if (!asterisk) return;
387 } // 将 modifierMap 里面的修饰键绑定到 event 中
388
389
390 for (var e in _mods) {
391 if (Object.prototype.hasOwnProperty.call(_mods, e)) {
392 _mods[e] = event[modifierMap[e]];
393 }
394 }
395 /**
396 * https://github.com/jaywcjlove/hotkeys/pull/129
397 * This solves the issue in Firefox on Windows where hotkeys corresponding to special characters would not trigger.
398 * An example of this is ctrl+alt+m on a Swedish keyboard which is used to type μ.
399 * Browser support: https://caniuse.com/#feat=keyboardevent-getmodifierstate
400 */
401
402
403 if (event.getModifierState && !(event.altKey && !event.ctrlKey) && event.getModifierState('AltGraph')) {
404 if (_downKeys.indexOf(17) === -1) {
405 _downKeys.push(17);
406 }
407
408 if (_downKeys.indexOf(18) === -1) {
409 _downKeys.push(18);
410 }
411
412 _mods[17] = true;
413 _mods[18] = true;
414 } // 获取范围 默认为 `all`
415
416
417 var scope = getScope(); // 对任何快捷键都需要做的处理
418
419 if (asterisk) {
420 for (var i = 0; i < asterisk.length; i++) {
421 if (asterisk[i].scope === scope && (event.type === 'keydown' && asterisk[i].keydown || event.type === 'keyup' && asterisk[i].keyup)) {
422 eventHandler(event, asterisk[i], scope);
423 }
424 }
425 } // key 不在 _handlers 中返回
426
427
428 if (!(key in _handlers)) return;
429
430 for (var _i = 0; _i < _handlers[key].length; _i++) {
431 if (event.type === 'keydown' && _handlers[key][_i].keydown || event.type === 'keyup' && _handlers[key][_i].keyup) {
432 if (_handlers[key][_i].key) {
433 var record = _handlers[key][_i];
434 var splitKey = record.splitKey;
435 var keyShortcut = record.key.split(splitKey);
436 var _downKeysCurrent = []; // 记录当前按键键值
437
438 for (var a = 0; a < keyShortcut.length; a++) {
439 _downKeysCurrent.push(code(keyShortcut[a]));
440 }
441
442 if (_downKeysCurrent.sort().join('') === _downKeys.sort().join('')) {
443 // 找到处理内容
444 eventHandler(event, record, scope);
445 }
446 }
447 }
448 }
449} // 判断 element 是否已经绑定事件
450
451
452function isElementBind(element) {
453 return elementHasBindEvent.indexOf(element) > -1;
454}
455
456function hotkeys(key, option, method) {
457 _downKeys = [];
458 var keys = getKeys(key); // 需要处理的快捷键列表
459
460 var mods = [];
461 var scope = 'all'; // scope默认为all,所有范围都有效
462
463 var element = document; // 快捷键事件绑定节点
464
465 var i = 0;
466 var keyup = false;
467 var keydown = true;
468 var splitKey = '+'; // 对为设定范围的判断
469
470 if (method === undefined && typeof option === 'function') {
471 method = option;
472 }
473
474 if (Object.prototype.toString.call(option) === '[object Object]') {
475 if (option.scope) scope = option.scope; // eslint-disable-line
476
477 if (option.element) element = option.element; // eslint-disable-line
478
479 if (option.keyup) keyup = option.keyup; // eslint-disable-line
480
481 if (option.keydown !== undefined) keydown = option.keydown; // eslint-disable-line
482
483 if (typeof option.splitKey === 'string') splitKey = option.splitKey; // eslint-disable-line
484 }
485
486 if (typeof option === 'string') scope = option; // 对于每个快捷键进行处理
487
488 for (; i < keys.length; i++) {
489 key = keys[i].split(splitKey); // 按键列表
490
491 mods = []; // 如果是组合快捷键取得组合快捷键
492
493 if (key.length > 1) mods = getMods(_modifier, key); // 将非修饰键转化为键码
494
495 key = key[key.length - 1];
496 key = key === '*' ? '*' : code(key); // *表示匹配所有快捷键
497 // 判断key是否在_handlers中,不在就赋一个空数组
498
499 if (!(key in _handlers)) _handlers[key] = [];
500
501 _handlers[key].push({
502 keyup: keyup,
503 keydown: keydown,
504 scope: scope,
505 mods: mods,
506 shortcut: keys[i],
507 method: method,
508 key: keys[i],
509 splitKey: splitKey
510 });
511 } // 在全局document上设置快捷键
512
513
514 if (typeof element !== 'undefined' && !isElementBind(element) && window) {
515 elementHasBindEvent.push(element);
516 addEvent(element, 'keydown', function (e) {
517 dispatch(e);
518 });
519 addEvent(window, 'focus', function () {
520 _downKeys = [];
521 });
522 addEvent(element, 'keyup', function (e) {
523 dispatch(e);
524 clearModifier(e);
525 });
526 }
527}
528
529var _api = {
530 setScope: setScope,
531 getScope: getScope,
532 deleteScope: deleteScope,
533 getPressedKeyCodes: getPressedKeyCodes,
534 isPressed: isPressed,
535 filter: filter,
536 unbind: unbind
537};
538
539for (var a in _api) {
540 if (Object.prototype.hasOwnProperty.call(_api, a)) {
541 hotkeys[a] = _api[a];
542 }
543}
544
545if (typeof window !== 'undefined') {
546 var _hotkeys = window.hotkeys;
547
548 hotkeys.noConflict = function (deep) {
549 if (deep && window.hotkeys === hotkeys) {
550 window.hotkeys = _hotkeys;
551 }
552
553 return hotkeys;
554 };
555
556 window.hotkeys = hotkeys;
557}
558
559function useHotkeys(keys, callback, options, deps) {
560 if (options instanceof Array) {
561 deps = options;
562 options = undefined;
563 }
564
565 const {
566 enableOnTags,
567 filter
568 } = options || {};
569 const memoisedCallback = useCallback(callback, deps || []);
570 useEffect(() => {
571 if (options && options.enableOnTags) {
572 hotkeys.filter = ({
573 target,
574 srcElement
575 }) => {
576 // @ts-ignore
577 const targetTagName = target && target.tagName || srcElement && srcElement.tagName;
578 return Boolean(targetTagName && enableOnTags && enableOnTags.includes(targetTagName));
579 };
580 }
581
582 if (filter) hotkeys.filter = filter;
583 hotkeys(keys, options || {}, memoisedCallback);
584 return () => hotkeys.unbind(keys, memoisedCallback);
585 }, [memoisedCallback, options]);
586}
587
588function t(t) {
589 for (var n = arguments.length, r = Array(n > 1 ? n - 1 : 0), e = 1; e < n; e++) r[e - 1] = arguments[e];
590
591 throw Error("[Immer] minified error nr: " + t + (r.length ? " " + r.join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
592}
593
594function n(t) {
595 return !!t && !!t[H];
596}
597
598function r(t) {
599 return !!t && (function (t) {
600 if (!t || "object" != typeof t) return !1;
601 var n = Object.getPrototypeOf(t);
602 return !n || n === Object.prototype;
603 }(t) || Array.isArray(t) || !!t[B] || !!t.constructor[B] || s(t) || p(t));
604}
605
606function i(t, n, r) {
607 void 0 === r && (r = !1), 0 === o(t) ? (r ? Object.keys : V)(t).forEach(function (e) {
608 r && "symbol" == typeof e || n(e, t[e], t);
609 }) : t.forEach(function (r, e) {
610 return n(e, r, t);
611 });
612}
613
614function o(t) {
615 var n = t[H];
616 return n ? n.i > 3 ? n.i - 4 : n.i : Array.isArray(t) ? 1 : s(t) ? 2 : p(t) ? 3 : 0;
617}
618
619function u(t, n) {
620 return 2 === o(t) ? t.has(n) : Object.prototype.hasOwnProperty.call(t, n);
621}
622
623function a$1(t, n) {
624 return 2 === o(t) ? t.get(n) : t[n];
625}
626
627function f(t, n, r) {
628 var e = o(t);
629 2 === e ? t.set(n, r) : 3 === e ? (t.delete(n), t.add(r)) : t[n] = r;
630}
631
632function c(t, n) {
633 return t === n ? 0 !== t || 1 / t == 1 / n : t != t && n != n;
634}
635
636function s(t) {
637 return U && t instanceof Map;
638}
639
640function p(t) {
641 return W && t instanceof Set;
642}
643
644function v(t) {
645 return t.o || t.t;
646}
647
648function l(t) {
649 if (Array.isArray(t)) return t.slice();
650 var n = Object.getOwnPropertyDescriptors(t);
651
652 for (var r in delete n[H], n) {
653 var e = n[r];
654 !1 === e.writable && (e.writable = !0, e.configurable = !0), (e.get || e.set) && (n[r] = {
655 configurable: !0,
656 writable: !0,
657 enumerable: e.enumerable,
658 value: t[r]
659 });
660 }
661
662 return Object.create(Object.getPrototypeOf(t), n);
663}
664
665function d(t, e) {
666 Object.isFrozen(t) || n(t) || !r(t) || (o(t) > 1 && (t.set = t.add = t.clear = t.delete = h), Object.freeze(t), e && i(t, function (t, n) {
667 return d(n, !0);
668 }, !0));
669}
670
671function h() {
672 t(2);
673}
674
675function b(n) {
676 var r = Y[n];
677 return r || t( 19, n), r;
678}
679
680function m() {
681 return $;
682}
683
684function _(t, n) {
685 n && (b("Patches"), t.u = [], t.s = [], t.p = n);
686}
687
688function j(t) {
689 O(t), t.v.forEach(w), t.v = null;
690}
691
692function O(t) {
693 t === $ && ($ = t.l);
694}
695
696function g(t) {
697 return $ = {
698 v: [],
699 l: $,
700 h: t,
701 m: !0,
702 _: 0
703 };
704}
705
706function w(t) {
707 var n = t[H];
708 0 === n.i || 1 === n.i ? n.j() : n.O = !0;
709}
710
711function S(n, e) {
712 e._ = e.v.length;
713 var i = e.v[0],
714 o = void 0 !== n && n !== i;
715 return e.h.g || b("ES5").S(e, n, o), o ? (i[H].P && (j(e), t(4)), r(n) && (n = P(e, n), e.l || A(e, n)), e.u && b("Patches").M(i[H], n, e.u, e.s)) : n = P(e, i, []), j(e), e.u && e.p(e.u, e.s), n !== q ? n : void 0;
716}
717
718function P(t, n, r) {
719 if (null == (e = n) || "object" != typeof e || Object.isFrozen(e)) return n;
720 var e,
721 o = n[H];
722 if (!o) return i(n, function (e, i) {
723 return M(t, o, n, e, i, r);
724 }, !0), n;
725 if (o.A !== t) return n;
726 if (!o.P) return A(t, o.t, !0), o.t;
727
728 if (!o.I) {
729 o.I = !0, o.A._--;
730 var u = 4 === o.i || 5 === o.i ? o.o = l(o.k) : o.o;
731 i(u, function (n, e) {
732 return M(t, o, u, n, e, r);
733 }), A(t, u, !1), r && t.u && b("Patches").R(o, r, t.u, t.s);
734 }
735
736 return o.o;
737}
738
739function M(e, i, o, a, c, s) {
740 if (n(c)) {
741 var p = P(e, c, s && i && 3 !== i.i && !u(i.D, a) ? s.concat(a) : void 0);
742 if (f(o, a, p), !n(p)) return;
743 e.m = !1;
744 }
745
746 if (r(c) && !Object.isFrozen(c)) {
747 if (!e.h.N && e._ < 1) return;
748 P(e, c), i && i.A.l || A(e, c);
749 }
750}
751
752function A(t, n, r) {
753 void 0 === r && (r = !1), t.h.N && t.m && d(n, r);
754}
755
756function x(t, n) {
757 var r = t[H];
758 return (r ? v(r) : t)[n];
759}
760
761function z(t) {
762 t.P || (t.P = !0, t.l && z(t.l));
763}
764
765function I(t) {
766 t.o || (t.o = l(t.t));
767}
768
769function E(t, n, r) {
770 var e = s(n) ? b("MapSet").T(n, r) : p(n) ? b("MapSet").F(n, r) : t.g ? function (t, n) {
771 var r = Array.isArray(t),
772 e = {
773 i: r ? 1 : 0,
774 A: n ? n.A : m(),
775 P: !1,
776 I: !1,
777 D: {},
778 l: n,
779 t: t,
780 k: null,
781 o: null,
782 j: null,
783 C: !1
784 },
785 i = e,
786 o = Z;
787 r && (i = [e], o = tt);
788 var u = Proxy.revocable(i, o),
789 a = u.revoke,
790 f = u.proxy;
791 return e.k = f, e.j = a, f;
792 }(n, r) : b("ES5").J(n, r);
793 return (r ? r.A : m()).v.push(e), e;
794}
795
796function k$1(e) {
797 return n(e) || t(22, e), function t(n) {
798 if (!r(n)) return n;
799 var e,
800 u = n[H],
801 c = o(n);
802
803 if (u) {
804 if (!u.P && (u.i < 4 || !b("ES5").K(u))) return u.t;
805 u.I = !0, e = R(n, c), u.I = !1;
806 } else e = R(n, c);
807
808 return i(e, function (n, r) {
809 u && a$1(u.t, n) === r || f(e, n, t(r));
810 }), 3 === c ? new Set(e) : e;
811 }(e);
812}
813
814function R(t, n) {
815 switch (n) {
816 case 2:
817 return new Map(t);
818
819 case 3:
820 return Array.from(t);
821 }
822
823 return l(t);
824}
825
826var K,
827 $,
828 G = "undefined" != typeof Symbol && "symbol" == typeof Symbol("x"),
829 U = "undefined" != typeof Map,
830 W = "undefined" != typeof Set,
831 X = "undefined" != typeof Proxy && void 0 !== Proxy.revocable && "undefined" != typeof Reflect,
832 q = G ? Symbol("immer-nothing") : ((K = {})["immer-nothing"] = !0, K),
833 B = G ? Symbol("immer-draftable") : "__$immer_draftable",
834 H = G ? Symbol("immer-state") : "__$immer_state",
835 V = "undefined" != typeof Reflect && Reflect.ownKeys ? Reflect.ownKeys : void 0 !== Object.getOwnPropertySymbols ? function (t) {
836 return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t));
837} : Object.getOwnPropertyNames,
838 Y = {},
839 Z = {
840 get: function (t, n) {
841 if (n === H) return t;
842 var e = v(t);
843 if (!u(e, n)) return function (t, n, r) {
844 if (r in n) for (var e = Object.getPrototypeOf(n); e;) {
845 var i,
846 o = Object.getOwnPropertyDescriptor(e, r);
847 if (o) return "value" in o ? o.value : null === (i = o.get) || void 0 === i ? void 0 : i.call(t.k);
848 e = Object.getPrototypeOf(e);
849 }
850 }(t, e, n);
851 var i = e[n];
852 return t.I || !r(i) ? i : i === x(t.t, n) ? (I(t), t.o[n] = E(t.A.h, i, t)) : i;
853 },
854 has: function (t, n) {
855 return n in v(t);
856 },
857 ownKeys: function (t) {
858 return Reflect.ownKeys(v(t));
859 },
860 set: function (t, n, r) {
861 if (t.D[n] = !0, !t.P) {
862 if (c(r, x(v(t), n)) && void 0 !== r) return !0;
863 I(t), z(t);
864 }
865
866 return t.o[n] = r, !0;
867 },
868 deleteProperty: function (t, n) {
869 return void 0 !== x(t.t, n) || n in t.t ? (t.D[n] = !1, I(t), z(t)) : delete t.D[n], t.o && delete t.o[n], !0;
870 },
871 getOwnPropertyDescriptor: function (t, n) {
872 var r = v(t),
873 e = Reflect.getOwnPropertyDescriptor(r, n);
874 return e ? {
875 writable: !0,
876 configurable: 1 !== t.i || "length" !== n,
877 enumerable: e.enumerable,
878 value: r[n]
879 } : e;
880 },
881 defineProperty: function () {
882 t(11);
883 },
884 getPrototypeOf: function (t) {
885 return Object.getPrototypeOf(t.t);
886 },
887 setPrototypeOf: function () {
888 t(12);
889 }
890},
891 tt = {};
892i(Z, function (t, n) {
893 tt[t] = function () {
894 return arguments[0] = arguments[0][0], n.apply(this, arguments);
895 };
896}), tt.deleteProperty = function (n, r) {
897 return Z.deleteProperty.call(this, n[0], r);
898}, tt.set = function (n, r, e) {
899 return Z.set.call(this, n[0], r, e, n[0]);
900};
901
902var nt = function () {
903 function e(t) {
904 this.g = X, this.N = "production" !== "production", "boolean" == typeof (null == t ? void 0 : t.useProxies) && this.setUseProxies(t.useProxies), "boolean" == typeof (null == t ? void 0 : t.autoFreeze) && this.setAutoFreeze(t.autoFreeze), this.produce = this.produce.bind(this), this.produceWithPatches = this.produceWithPatches.bind(this);
905 }
906
907 var i = e.prototype;
908 return i.produce = function (n, e, i) {
909 if ("function" == typeof n && "function" != typeof e) {
910 var o = e;
911 e = n;
912 var u = this;
913 return function (t) {
914 var n = this;
915 void 0 === t && (t = o);
916
917 for (var r = arguments.length, i = Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++) i[a - 1] = arguments[a];
918
919 return u.produce(t, function (t) {
920 var r;
921 return (r = e).call.apply(r, [n, t].concat(i));
922 });
923 };
924 }
925
926 var a;
927
928 if ("function" != typeof e && t(6), void 0 !== i && "function" != typeof i && t(7), r(n)) {
929 var f = g(this),
930 c = E(this, n, void 0),
931 s = !0;
932
933 try {
934 a = e(c), s = !1;
935 } finally {
936 s ? j(f) : O(f);
937 }
938
939 return "undefined" != typeof Promise && a instanceof Promise ? a.then(function (t) {
940 return _(f, i), S(t, f);
941 }, function (t) {
942 throw j(f), t;
943 }) : (_(f, i), S(a, f));
944 }
945
946 if (!n || "object" != typeof n) {
947 if ((a = e(n)) === q) return;
948 return void 0 === a && (a = n), this.N && d(a, !0), a;
949 }
950
951 t(21, n);
952 }, i.produceWithPatches = function (t, n) {
953 var r,
954 e,
955 i = this;
956 return "function" == typeof t ? function (n) {
957 for (var r = arguments.length, e = Array(r > 1 ? r - 1 : 0), o = 1; o < r; o++) e[o - 1] = arguments[o];
958
959 return i.produceWithPatches(n, function (n) {
960 return t.apply(void 0, [n].concat(e));
961 });
962 } : [this.produce(t, n, function (t, n) {
963 r = t, e = n;
964 }), r, e];
965 }, i.createDraft = function (e) {
966 r(e) || t(8), n(e) && (e = k$1(e));
967 var i = g(this),
968 o = E(this, e, void 0);
969 return o[H].C = !0, O(i), o;
970 }, i.finishDraft = function (n, r) {
971 var e = n && n[H];
972 var i = e.A;
973 return _(i, r), S(void 0, i);
974 }, i.setAutoFreeze = function (t) {
975 this.N = t;
976 }, i.setUseProxies = function (n) {
977 n && !X && t(20), this.g = n;
978 }, i.applyPatches = function (t, r) {
979 var e;
980
981 for (e = r.length - 1; e >= 0; e--) {
982 var i = r[e];
983
984 if (0 === i.path.length && "replace" === i.op) {
985 t = i.value;
986 break;
987 }
988 }
989
990 var o = b("Patches").$;
991 return n(t) ? o(t, r) : this.produce(t, function (t) {
992 return o(t, r.slice(e + 1));
993 });
994 }, e;
995}(),
996 rt = new nt(),
997 et = rt.produce,
998 it = rt.produceWithPatches.bind(rt),
999 ot = rt.setAutoFreeze.bind(rt),
1000 ut = rt.setUseProxies.bind(rt),
1001 at = rt.applyPatches.bind(rt),
1002 ft = rt.createDraft.bind(rt),
1003 ct = rt.finishDraft.bind(rt);
1004
1005function u$1(t) {
1006 var i = useState(t),
1007 u = i[1];
1008 return [i[0], useCallback(function (n) {
1009 u(et(n));
1010 }, [])];
1011}
1012
1013/**
1014 * The underlying DOM element which is rendered by this component.
1015 */
1016
1017const Root = "div";
1018
1019function NavigationFooter({
1020 prev,
1021 next,
1022 Link,
1023 className,
1024 ...props
1025}, ref)
1026/* FIXME */
1027{
1028 return /*#__PURE__*/React__default.createElement(Root, {
1029 ref: ref,
1030 ...props,
1031 className: cx(className, "c1yyyu0v")
1032 }, /*#__PURE__*/React__default.createElement("div", {
1033 className: "c1w6f8v5"
1034 }, /*#__PURE__*/React__default.createElement("div", {
1035 className: "cyhmtox"
1036 }, prev && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SecondaryLabel, null, prev.context || "/"), /*#__PURE__*/React__default.createElement(PrimaryLink, {
1037 Link: Link,
1038 href: prev.href
1039 }, prev.label))), /*#__PURE__*/React__default.createElement("div", {
1040 className: "c128724y"
1041 }, next && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SecondaryLabel, null, next.context || "/"), /*#__PURE__*/React__default.createElement(PrimaryLink, {
1042 Link: Link,
1043 href: next.href
1044 }, next.label)))));
1045}
1046
1047var NavigationFooter$1 = React__default.forwardRef(NavigationFooter);
1048
1049const PrimaryLink = ({
1050 href,
1051 Link,
1052 children
1053}) => {
1054 return /*#__PURE__*/React__default.createElement(Link, {
1055 href: href
1056 }, /*#__PURE__*/React__default.createElement("a", {
1057 className: "cuyp32u"
1058 }, children));
1059};
1060
1061const SecondaryLabel = ({
1062 children
1063}) => /*#__PURE__*/React__default.createElement("div", {
1064 className: "c1v3j8yk"
1065}, children);
1066
1067function memoize(fn) {
1068 var cache = {};
1069 return function (arg) {
1070 if (cache[arg] === undefined) cache[arg] = fn(arg);
1071 return cache[arg];
1072 };
1073}
1074
1075var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|default|defer|dir|disabled|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|itemProp|itemScope|itemType|itemID|itemRef|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
1076
1077var index = memoize(function (prop) {
1078 return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
1079 /* o */
1080 && prop.charCodeAt(1) === 110
1081 /* n */
1082 && prop.charCodeAt(2) < 91;
1083}
1084/* Z+1 */
1085);
1086
1087/**
1088 * This file contains an runtime version of `styled` component. Responsibilities of the component are:
1089 * - returns ReactElement based on HTML tag used with `styled` or custom React Component
1090 * - injects classNames for the returned component
1091 * - injects CSS variables used to define dynamic styles based on props
1092 */
1093
1094const warnIfInvalid = (value, componentName) => {
1095}; // If styled wraps custom component, that component should have className property
1096
1097
1098function styled(tag) {
1099 return options => {
1100
1101 const render = (props, ref) => {
1102 const {
1103 as: component = tag,
1104 class: className,
1105 ...rest
1106 } = props;
1107 let filteredProps; // Check if it's an HTML tag and not a custom element
1108
1109 if (typeof component === 'string' && component.indexOf('-') === -1) {
1110 filteredProps = {}; // eslint-disable-next-line guard-for-in
1111
1112 for (const key in rest) {
1113 if (key === 'as' || index(key)) {
1114 // Don't pass through invalid attributes to HTML elements
1115 filteredProps[key] = rest[key];
1116 }
1117 }
1118 } else {
1119 filteredProps = rest;
1120 }
1121
1122 filteredProps.ref = ref;
1123 filteredProps.className = cx(filteredProps.className || className, options.class);
1124 const {
1125 vars
1126 } = options;
1127
1128 if (vars) {
1129 const style = {}; // eslint-disable-next-line guard-for-in
1130
1131 for (const name in vars) {
1132 const variable = vars[name];
1133 const result = variable[0];
1134 const unit = variable[1] || '';
1135 const value = typeof result === 'function' ? result(props) : result;
1136 warnIfInvalid(value, options.name);
1137 style[`--${name}`] = `${value}${unit}`;
1138 }
1139
1140 filteredProps.style = Object.assign(style, filteredProps.style);
1141 }
1142
1143 if (tag.__linaria && tag !== component) {
1144 // If the underlying tag is a styled component, forward the `as` prop
1145 // Otherwise the styles from the underlying component will be ignored
1146 filteredProps.as = component;
1147 return createElement(tag, filteredProps);
1148 }
1149
1150 return createElement(component, filteredProps);
1151 };
1152
1153 const Result = forwardRef ? forwardRef(render) : // React.forwardRef won't available on older React versions and in Preact
1154 // Fallback to a innerRef prop in that case
1155 ({
1156 innerRef,
1157 ...rest
1158 }) => render(rest, innerRef);
1159 Result.displayName = options.name; // These properties will be read by the babel plugin for interpolation
1160
1161 Result.__linaria = {
1162 className: options.class,
1163 extends: tag
1164 };
1165 return Result;
1166 };
1167}
1168
1169var styled$1 = styled;
1170
1171const anchorize = children => {
1172 if (typeof children === "string") {
1173 return children.toLowerCase().replace(/[ _]+/g, "-").replace(/[!:^*./\\]/g, "");
1174 } else {
1175 return undefined;
1176 }
1177};
1178
1179function Heading(Component) {
1180 return props => {
1181 const id = anchorize(props.children);
1182 return /*#__PURE__*/React__default.createElement(Component, {
1183 id: id,
1184 ...props
1185 }, /*#__PURE__*/React__default.createElement("a", {
1186 className: "c4nva9o",
1187 href: id && `#${id}`
1188 }, "#"), props.children);
1189 };
1190}
1191
1192const h1 = /*#__PURE__*/styled$1("h1")({
1193 name: "h1",
1194 class: "h116aw7w"
1195});
1196const h2 = Heading( /*#__PURE__*/styled$1("h2")({
1197 name: "h2",
1198 class: "h17x51iq"
1199}));
1200const h3 = Heading( /*#__PURE__*/styled$1("h3")({
1201 name: "h3",
1202 class: "hcvle6x"
1203}));
1204const h4 = Heading( /*#__PURE__*/styled$1("h4")({
1205 name: "h4",
1206 class: "h21lry4"
1207}));
1208const a$2 = /*#__PURE__*/styled$1("a")({
1209 name: "a",
1210 class: "a1gcc7y8"
1211});
1212const blockquote = /*#__PURE__*/styled$1("blockquote")({
1213 name: "blockquote",
1214 class: "b13523mb"
1215});
1216const hr = /*#__PURE__*/styled$1("hr")({
1217 name: "hr",
1218 class: "hmvh8t2"
1219});
1220
1221var mdxComponentsBase = /*#__PURE__*/Object.freeze({
1222 __proto__: null,
1223 h1: h1,
1224 h2: h2,
1225 h3: h3,
1226 h4: h4,
1227 a: a$2,
1228 blockquote: blockquote,
1229 hr: hr
1230});
1231
1232const Section = ({
1233 location,
1234 Link,
1235 label,
1236 path,
1237 children = []
1238}) => {
1239 const [active, setActive] = React__default.useState(() => {
1240 if (path) {
1241 return location.asPath.startsWith(path);
1242 } else if (children.length > 0) {
1243 return children.some(({
1244 path
1245 }) => path && location.asPath.startsWith(path));
1246 } else {
1247 return false;
1248 }
1249 });
1250 React__default.useEffect(() => {
1251 if (path && location.asPath.startsWith(path)) {
1252 setActive(true);
1253 }
1254 }, [path, location.asPath]);
1255 return /*#__PURE__*/React__default.createElement("section", {
1256 className: "ckwreg6"
1257 }, /*#__PURE__*/React__default.createElement("div", {
1258 "data-active": location.asPath === path
1259 }, path ? /*#__PURE__*/React__default.createElement(Link, {
1260 href: path
1261 }, /*#__PURE__*/React__default.createElement("a", null, label)) : /*#__PURE__*/React__default.createElement("a", {
1262 href: "#",
1263 onClick: () => setActive(x => !x)
1264 }, label)), active && children.map((c, i) => /*#__PURE__*/React__default.createElement(Section, {
1265 key: i,
1266 location: location,
1267 Link: Link,
1268 ...c
1269 })));
1270};
1271
1272function Sidebar({
1273 location,
1274 toc,
1275 Link,
1276 search
1277}) {
1278 return /*#__PURE__*/React__default.createElement("aside", {
1279 className: cx("cd6mam1")
1280 }, /*#__PURE__*/React__default.createElement("div", {
1281 className: "cg1tx3p"
1282 }, search && /*#__PURE__*/React__default.createElement(Search, { ...search
1283 }), /*#__PURE__*/React__default.createElement("nav", null, toc.map((c, i) => /*#__PURE__*/React__default.createElement(Section, {
1284 key: i,
1285 location: location,
1286 Link: Link,
1287 ...c
1288 })))));
1289}
1290
1291const Search = ({
1292 open,
1293 label
1294}) => {
1295 return /*#__PURE__*/React__default.createElement("div", {
1296 className: "c1phyepu"
1297 }, /*#__PURE__*/React__default.createElement("div", {
1298 role: "button",
1299 className: "c1bc00mp",
1300 onClick: open
1301 }, /*#__PURE__*/React__default.createElement("svg", {
1302 x: "0px",
1303 y: "0px",
1304 width: "12px",
1305 height: "12px",
1306 viewBox: "0 0 12 12"
1307 }, /*#__PURE__*/React__default.createElement("path", {
1308 d: "M11.707 10.293l-2.54-2.54a5.015 5.015 0 10-1.414 1.414l2.54 2.54a1 1 0 001.414-1.414zM2 5a3 3 0 113 3 3 3 0 01-3-3z",
1309 fill: "currentColor"
1310 })), label || "Quick Find"));
1311};
1312
1313const theme = "t1upv9l2";
1314
1315/**
1316 * The underlying DOM element which is rendered by this component.
1317 */
1318
1319const Root$1 = "div";
1320
1321function Page({
1322 location,
1323 toc,
1324 Link,
1325 className,
1326 search,
1327 mdxComponents,
1328 children,
1329 ...props
1330}, ref)
1331/* FIXME */
1332{
1333 const [state, mutate] = u$1({
1334 search: {
1335 open: false
1336 }
1337 });
1338 useHotkeys("command+p,escape", (ev, handler) => {
1339 switch (handler.key) {
1340 case "command+p":
1341 {
1342 ev.preventDefault();
1343 mutate(draft => {
1344 draft.search.open = !draft.search.open;
1345 });
1346 return;
1347 }
1348
1349 case "escape":
1350 {
1351 mutate(draft => {
1352 draft.search.open = false;
1353 });
1354 return;
1355 }
1356 }
1357 }, {
1358 enableOnTags: ["BODY", "INPUT"]
1359 });
1360 return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Root$1, {
1361 ref: ref,
1362 ...props,
1363 className: cx(className, theme, "c1w36cte")
1364 }, /*#__PURE__*/React__default.createElement("div", {
1365 className: "c93l4wj"
1366 }, /*#__PURE__*/React__default.createElement(Sidebar, {
1367 location: location,
1368 toc: toc,
1369 Link: Link,
1370 search: search && {
1371 open: () => {
1372 mutate(draft => {
1373 draft.search.open = true;
1374 });
1375 },
1376 ...search
1377 }
1378 })), /*#__PURE__*/React__default.createElement("div", {
1379 className: "chbgjpv"
1380 }, /*#__PURE__*/React__default.createElement("div", {
1381 className: grid
1382 }, /*#__PURE__*/React__default.createElement(MDXProvider, {
1383 components: { ...mdxComponentsBase,
1384 ...mdxComponents
1385 }
1386 }, children)), (() => {
1387 function flatten(n, parents) {
1388 let ret = [];
1389
1390 if (n.path) {
1391 ret.push({
1392 parents,
1393 label: n.label,
1394 path: n.path
1395 });
1396 }
1397
1398 if (n.children) {
1399 ret = [...ret, ...n.children.flatMap(c => flatten(c, [...parents, n]))];
1400 }
1401
1402 return ret;
1403 }
1404
1405 const items = toc.flatMap(n => flatten(n, []));
1406 const index = items.findIndex(v => v.path === location.asPath.replace(/#.*/, ""));
1407
1408 if (index === -1) {
1409 return null;
1410 }
1411
1412 function toLink(index) {
1413 const item = items[index];
1414
1415 if (item === undefined) {
1416 return undefined;
1417 } else {
1418 return {
1419 href: item.path,
1420 label: item.label,
1421 context: item.parents.map(x => x.label).join(" / ")
1422 };
1423 }
1424 }
1425
1426 return /*#__PURE__*/React__default.createElement("div", {
1427 className: "c14ezhf4"
1428 }, /*#__PURE__*/React__default.createElement(NavigationFooter$1, {
1429 Link: Link,
1430 prev: toLink(index - 1),
1431 next: toLink(index + 1)
1432 }));
1433 })())), search && /*#__PURE__*/React__default.createElement(search.Component, { ...state.search
1434 }));
1435}
1436
1437var Page$1 = React__default.forwardRef(Page);
1438
1439export { Page$1 as Page, extendedWidth, fullWidth, theme };