'use strict'; var React = require('react'); var reactRouterDom = require('react-router-dom'); var jsxRuntime = require('react/jsx-runtime'); function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } var React__default = /*#__PURE__*/_interopDefault(React); var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. __defProp(target, "default", { value: mod, enumerable: true }) , mod )); // node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js var require_kind_of = __commonJS({ "node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js"(exports, module) { var toString = Object.prototype.toString; module.exports = function kindOf(val) { if (val === void 0) return "undefined"; if (val === null) return "null"; var type = typeof val; if (type === "boolean") return "boolean"; if (type === "string") return "string"; if (type === "number") return "number"; if (type === "symbol") return "symbol"; if (type === "function") { return isGeneratorFn(val) ? "generatorfunction" : "function"; } if (isArray(val)) return "array"; if (isBuffer(val)) return "buffer"; if (isArguments(val)) return "arguments"; if (isDate(val)) return "date"; if (isError(val)) return "error"; if (isRegexp(val)) return "regexp"; switch (ctorName(val)) { case "Symbol": return "symbol"; case "Promise": return "promise"; // Set, Map, WeakSet, WeakMap case "WeakMap": return "weakmap"; case "WeakSet": return "weakset"; case "Map": return "map"; case "Set": return "set"; // 8-bit typed arrays case "Int8Array": return "int8array"; case "Uint8Array": return "uint8array"; case "Uint8ClampedArray": return "uint8clampedarray"; // 16-bit typed arrays case "Int16Array": return "int16array"; case "Uint16Array": return "uint16array"; // 32-bit typed arrays case "Int32Array": return "int32array"; case "Uint32Array": return "uint32array"; case "Float32Array": return "float32array"; case "Float64Array": return "float64array"; } if (isGeneratorObj(val)) { return "generator"; } type = toString.call(val); switch (type) { case "[object Object]": return "object"; // iterators case "[object Map Iterator]": return "mapiterator"; case "[object Set Iterator]": return "setiterator"; case "[object String Iterator]": return "stringiterator"; case "[object Array Iterator]": return "arrayiterator"; } return type.slice(8, -1).toLowerCase().replace(/\s/g, ""); }; function ctorName(val) { return typeof val.constructor === "function" ? val.constructor.name : null; } function isArray(val) { if (Array.isArray) return Array.isArray(val); return val instanceof Array; } function isError(val) { return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number"; } function isDate(val) { if (val instanceof Date) return true; return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function"; } function isRegexp(val) { if (val instanceof RegExp) return true; return typeof val.flags === "string" && typeof val.ignoreCase === "boolean" && typeof val.multiline === "boolean" && typeof val.global === "boolean"; } function isGeneratorFn(name, val) { return ctorName(name) === "GeneratorFunction"; } function isGeneratorObj(val) { return typeof val.throw === "function" && typeof val.return === "function" && typeof val.next === "function"; } function isArguments(val) { try { if (typeof val.length === "number" && typeof val.callee === "function") { return true; } } catch (err) { if (err.message.indexOf("callee") !== -1) { return true; } } return false; } function isBuffer(val) { if (val.constructor && typeof val.constructor.isBuffer === "function") { return val.constructor.isBuffer(val); } return false; } } }); // node_modules/.pnpm/shallow-clone@3.0.1/node_modules/shallow-clone/index.js var require_shallow_clone = __commonJS({ "node_modules/.pnpm/shallow-clone@3.0.1/node_modules/shallow-clone/index.js"(exports, module) { var valueOf = Symbol.prototype.valueOf; var typeOf = require_kind_of(); function clone(val, deep) { switch (typeOf(val)) { case "array": return val.slice(); case "object": return Object.assign({}, val); case "date": return new val.constructor(Number(val)); case "map": return new Map(val); case "set": return new Set(val); case "buffer": return cloneBuffer(val); case "symbol": return cloneSymbol(val); case "arraybuffer": return cloneArrayBuffer(val); case "float32array": case "float64array": case "int16array": case "int32array": case "int8array": case "uint16array": case "uint32array": case "uint8clampedarray": case "uint8array": return cloneTypedArray(val); case "regexp": return cloneRegExp(val); case "error": return Object.create(val); default: { return val; } } } function cloneRegExp(val) { const flags = val.flags !== void 0 ? val.flags : /\w+$/.exec(val) || void 0; const re = new val.constructor(val.source, flags); re.lastIndex = val.lastIndex; return re; } function cloneArrayBuffer(val) { const res = new val.constructor(val.byteLength); new Uint8Array(res).set(new Uint8Array(val)); return res; } function cloneTypedArray(val, deep) { return new val.constructor(val.buffer, val.byteOffset, val.length); } function cloneBuffer(val) { const len = val.length; const buf = Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : Buffer.from(len); val.copy(buf); return buf; } function cloneSymbol(val) { return valueOf ? Object(valueOf.call(val)) : {}; } module.exports = clone; } }); // node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js var require_isobject = __commonJS({ "node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports, module) { module.exports = function isObject2(val) { return val != null && typeof val === "object" && Array.isArray(val) === false; }; } }); // node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js var require_is_plain_object = __commonJS({ "node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports, module) { var isObject2 = require_isobject(); function isObjectObject(o) { return isObject2(o) === true && Object.prototype.toString.call(o) === "[object Object]"; } module.exports = function isPlainObject(o) { var ctor, prot; if (isObjectObject(o) === false) return false; ctor = o.constructor; if (typeof ctor !== "function") return false; prot = ctor.prototype; if (isObjectObject(prot) === false) return false; if (prot.hasOwnProperty("isPrototypeOf") === false) { return false; } return true; }; } }); // node_modules/.pnpm/clone-deep@4.0.1/node_modules/clone-deep/index.js var require_clone_deep = __commonJS({ "node_modules/.pnpm/clone-deep@4.0.1/node_modules/clone-deep/index.js"(exports, module) { var clone = require_shallow_clone(); var typeOf = require_kind_of(); var isPlainObject = require_is_plain_object(); function cloneDeep2(val, instanceClone) { switch (typeOf(val)) { case "object": return cloneObjectDeep(val, instanceClone); case "array": return cloneArrayDeep(val, instanceClone); default: { return clone(val); } } } function cloneObjectDeep(val, instanceClone) { if (typeof instanceClone === "function") { return instanceClone(val); } if (instanceClone || isPlainObject(val)) { const res = new val.constructor(); for (let key in val) { res[key] = cloneDeep2(val[key], instanceClone); } return res; } return val; } function cloneArrayDeep(val, instanceClone) { const res = new val.constructor(val.length); for (let i = 0; i < val.length; i++) { res[i] = cloneDeep2(val[i], instanceClone); } return res; } module.exports = cloneDeep2; } }); // node_modules/.pnpm/context-state@3.1.1_react@18.2.0/node_modules/context-state/dist/esm/utils/pick.mjs function _array_like_to_array(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _array_without_holes(arr) { if (Array.isArray(arr)) return _array_like_to_array(arr); } function _define_property(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _iterable_to_array(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _non_iterable_spread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _to_consumable_array(arr) { return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread(); } function _unsupported_iterable_to_array(o, minLen) { if (!o) return; if (typeof o === "string") return _array_like_to_array(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen); } function pick(origin, keys) { var _Object; var empty = {}; if (!origin) { return empty; } return (_Object = Object).assign.apply(_Object, [ empty ].concat(_to_consumable_array(keys.map(function(key) { return _define_property({}, key, origin[key]); })))); } // node_modules/.pnpm/context-state@3.1.1_react@18.2.0/node_modules/context-state/dist/esm/utils/shallow-equal.mjs function _array_like_to_array2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _array_without_holes2(arr) { if (Array.isArray(arr)) return _array_like_to_array2(arr); } function _iterable_to_array2(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _non_iterable_spread2() { throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _to_consumable_array2(arr) { return _array_without_holes2(arr) || _iterable_to_array2(arr) || _unsupported_iterable_to_array2(arr) || _non_iterable_spread2(); } function _type_of(obj) { "@swc/helpers - typeof"; return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } function _unsupported_iterable_to_array2(o, minLen) { if (!o) return; if (typeof o === "string") return _array_like_to_array2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array2(o, minLen); } function shallowEqual(origin, next) { if (Object.is(origin, next)) { return true; } if (origin && (typeof origin === "undefined" ? "undefined" : _type_of(origin)) === "object" && next && (typeof next === "undefined" ? "undefined" : _type_of(next)) === "object") { if (_to_consumable_array2(Object.keys(origin)).concat(_to_consumable_array2(Object.keys(next))).every(function(k) { return origin[k] === next[k] && Object.prototype.hasOwnProperty.call(origin, k) && Object.prototype.hasOwnProperty.call(next, k); })) { return true; } } return false; } var useIsomorphicLayoutEffect = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined" ? React.useLayoutEffect : React.useEffect; function _array_like_to_array3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _array_with_holes(arr) { if (Array.isArray(arr)) return arr; } function _iterable_to_array_limit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _non_iterable_rest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _sliced_to_array(arr, i) { return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array3(arr, i) || _non_iterable_rest(); } function _unsupported_iterable_to_array3(o, minLen) { if (!o) return; if (typeof o === "string") return _array_like_to_array3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array3(o, minLen); } var useUnmountedRef = function() { var unmountedRef = React.useRef(false); React.useEffect(function() { unmountedRef.current = false; return function() { unmountedRef.current = true; }; }, []); return unmountedRef; }; function useSafeState(initialState) { var unmountedRef = useUnmountedRef(); var _useState = _sliced_to_array(React.useState(initialState), 2), state = _useState[0], setState = _useState[1]; var setCurrentState = React.useCallback(function(currentState) { if (unmountedRef.current) return; setState(currentState); }, []); return [ state, setCurrentState ]; } function useMemoFn(fn) { var fnRef = React.useRef(fn); fnRef.current = React.useMemo(function() { return fn; }, [ fn ]); var memoizedFn = React.useRef(); if (!memoizedFn.current) { memoizedFn.current = function() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return fnRef.current.apply(this, args); }; } return memoizedFn.current; } // node_modules/.pnpm/context-state@3.1.1_react@18.2.0/node_modules/context-state/dist/esm/create-container.mjs function _array_like_to_array4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _array_with_holes2(arr) { if (Array.isArray(arr)) return arr; } function _define_property2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _iterable_to_array_limit2(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _non_iterable_rest2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _sliced_to_array2(arr, i) { return _array_with_holes2(arr) || _iterable_to_array_limit2(arr, i) || _unsupported_iterable_to_array4(arr, i) || _non_iterable_rest2(); } function _unsupported_iterable_to_array4(o, minLen) { if (!o) return; if (typeof o === "string") return _array_like_to_array4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array4(o, minLen); } var ErrorText = "[context-state]: Component must be wrapped with "; var CONTEXT_VALUE = Symbol("CONTEXT_VALUE"); var EMPTY = Symbol("EMPTY"); var __ContainerCache__ = /* @__PURE__ */ new WeakMap(); function createContainer(useHook) { var equalityFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : shallowEqual; var _equalityFn = equalityFn; var Context = React.createContext(EMPTY); var Provider = function(param) { var value = param.value, children = param.children; var inHookValue = useHook(value); var valueRef = React.useRef(inHookValue); var contextValue = React.useRef(); if (!contextValue.current) { var listeners = /* @__PURE__ */ new Set(); contextValue.current = _define_property2({}, CONTEXT_VALUE, { /* "v"alue */ v: valueRef, /* "l"isteners */ l: listeners }); } __ContainerCache__.set(useHook, contextValue.current); useIsomorphicLayoutEffect(function() { var _contextValue_current; valueRef.current = inHookValue; (_contextValue_current = contextValue.current) === null || _contextValue_current === void 0 ? void 0 : _contextValue_current[CONTEXT_VALUE].l.forEach(function(listener) { listener(inHookValue); }); }, [ inHookValue ]); return React.createElement(Context.Provider, { value: contextValue.current }, children); }; var Consumer = function(param) { var children = param.children; return children(useSelector(function(state) { return state; })); }; function useSelector(selector, equalityFn2) { var eq = equalityFn2 || _equalityFn; var context = React.useContext(Context); var contextValue = context === null || context === void 0 ? void 0 : context[CONTEXT_VALUE]; if (context === EMPTY) { var __ContainerCache___get; var cached = (__ContainerCache___get = __ContainerCache__.get(useHook)) === null || __ContainerCache___get === void 0 ? void 0 : __ContainerCache___get[CONTEXT_VALUE]; if (!cached) { throw new Error(ErrorText); } else { contextValue = cached; } } var _contextValue_v = contextValue.v, value = _contextValue_v.current, listeners = contextValue.l; var _useSafeState = _sliced_to_array2(useSafeState(0), 2), triggerRender = _useSafeState[1]; var selected = selector(value); var currentRef = React.useRef(); currentRef.current = { value, selected }; useIsomorphicLayoutEffect(function() { var checkForUpdates = function checkForUpdates2(nextValue) { try { if (!currentRef.current) { return; } if (currentRef.current.value === nextValue) { return; } var nextSelected = selector(nextValue); if (eq(currentRef.current.selected, nextSelected, shallowEqual)) { return; } triggerRender(function(n) { return n + 1; }); } catch (e) { } }; listeners.add(checkForUpdates); return function() { listeners["delete"](checkForUpdates); }; }, []); return selected; } function usePicker(selected, equalityFn2) { return useSelector(function(state) { return pick(state, selected); }, equalityFn2); } return { Provider, Consumer, useSelector, usePicker }; } // src/utils.ts function collectMeta(route) { const meta = { route: {} }; if (route.meta) { Object.assign(meta, route.meta); } if (route.id) { Object.assign(meta.route, { id: route.id }); } if (route.index) { Object.assign(meta.route, { index: route.index }); } if (route.path) { Object.assign(meta.route, { pathname: route.path }); } return meta; } // src/route-context.tsx function getMetasFromMatch(routes) { if (!routes) return []; return routes?.map((item) => { const route = item.route; const meta = collectMeta(route); return meta; }); } function useRouteContext({ clientRoutes, basename }) { const location = reactRouterDom.useLocation(); const resolveMetas = useMemoFn(() => { const matchedRoutes = reactRouterDom.matchRoutes(clientRoutes, location, basename); return getMetasFromMatch(matchedRoutes); }); const [metas, setMetas] = React.useState(resolveMetas); const previousPath = React.useRef(); const updateMetas = useMemoFn((path) => { if (previousPath.current === path) return; previousPath.current = path; setMetas(resolveMetas()); }); return { metas, updateMetas }; } var RouteContext = createContainer(useRouteContext); function useMetas() { const { metas } = RouteContext.usePicker(["metas"]); return { metas }; } // src/router.tsx var import_clone_deep = __toESM(require_clone_deep()); // node_modules/.pnpm/p-is-promise@4.0.0/node_modules/p-is-promise/index.js var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function"); function isPromise(value) { return value instanceof Promise || isObject(value) && typeof value.then === "function" && typeof value.catch === "function"; } function useIsomorphicLayoutEffect2(cb, deps) { const isomorphicLayoutEffect = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect; isomorphicLayoutEffect(cb, deps); } function Navigator(props) { const { to, ...rest } = props; const nav = reactRouterDom.useNavigate(); useIsomorphicLayoutEffect2(() => { nav(to, rest); }, []); return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}); } var cache = null; function Guard({ element, meta, onRouteWillMount, onRouteMount, onRouteUnmount }) { const { updateMetas } = RouteContext.usePicker(["updateMetas"]); const location = reactRouterDom.useLocation(); const params = reactRouterDom.useParams(); const navigate = reactRouterDom.useNavigate(); const payload = React.useMemo( () => ({ location, params, meta }), [location, params, meta] ); const fullPath = React.useMemo(() => location.pathname + location.search + location.hash, [location]); useIsomorphicLayoutEffect2(() => { onRouteMount?.(payload); updateMetas(fullPath); return () => { onRouteUnmount?.(payload); }; }, []); if (onRouteWillMount) { if (cache === element) { return element; } const pathRes = onRouteWillMount(payload); if (isPromise(pathRes)) { pathRes.then((res) => { if (res && res !== fullPath) { navigate(res, { replace: true, state: location.state }); } }); } else if (pathRes && pathRes !== fullPath) { element = /* @__PURE__ */ jsxRuntime.jsx(Navigator, { to: pathRes, replace: true, state: location.state }); } } cache = element; return element; } var Router = class { routes; onRouteWillMount; onRouteMount; onRouteUnmount; suspense; constructor(option) { this.routes = option.routes || []; this.onRouteWillMount = option.onRouteWillMount; this.onRouteMount = option.onRouteMount; this.onRouteUnmount = option.onRouteUnmount; this.suspense = option.suspense || /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, {}); } createClientRoutes(_routes) { const clientRoutes = []; (0, import_clone_deep.default)(_routes).forEach(async (route) => { if (route.path === void 0) { return; } const meta = collectMeta(route); if (route.redirect) { route.element = /* @__PURE__ */ jsxRuntime.jsx(Navigator, { to: route.redirect, replace: true }); } else if (route.lazyComponent) { const Component = React__default.default.lazy(route.lazyComponent); const element = /* @__PURE__ */ jsxRuntime.jsx(React__default.default.Suspense, { fallback: this.suspense, children: /* @__PURE__ */ jsxRuntime.jsx(Component, { meta }) }); route.element = this.createGuard(element, meta); } else if (route.element) { if (route.element) { route.element = this.createGuard( React__default.default.cloneElement(route.element, { meta }), meta ); } } if (route.children) { route.children = this.createClientRoutes(route.children); } clientRoutes.push(route); }); return clientRoutes; } createGuard(element, meta) { return /* @__PURE__ */ jsxRuntime.jsx( Guard, { element, meta, onRouteWillMount: this.onRouteWillMount, onRouteMount: this.onRouteMount, onRouteUnmount: this.onRouteUnmount } ); } }; function ConfigurableRouter(props) { const { routes, onRouteWillMount, onRouteMount, onRouteUnmount, render, suspense } = props; const router = new Router({ routes, onRouteWillMount, onRouteMount, onRouteUnmount, suspense }); const clientRoutes = router.createClientRoutes(routes); const elements = reactRouterDom.useRoutes(clientRoutes); return /* @__PURE__ */ jsxRuntime.jsx( RouteContext.Provider, { value: { clientRoutes, ...props }, children: render ? render(elements) : elements } ); } var configurable_router_default = React.memo(ConfigurableRouter); /*! Bundled license information: shallow-clone/index.js: (*! * shallow-clone * * Copyright (c) 2015-present, Jon Schlinkert. * Released under the MIT License. *) isobject/index.js: (*! * isobject * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. *) is-plain-object/index.js: (*! * is-plain-object * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. *) */ exports.ConfigurableRouter = configurable_router_default; exports.useMetas = useMetas;