@lssm/lib.design-system 0.0.0-canary-20251217034842 → 0.0.0-canary-20251217050226

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.
Files changed (49) hide show
  1. package/package.json +8 -7
  2. package/dist/node_modules/@swc/helpers/cjs/_interop_require_default.js +0 -14
  3. package/dist/node_modules/@swc/helpers/cjs/_interop_require_wildcard.js +0 -35
  4. package/dist/node_modules/next/dist/client/add-base-path.js +0 -30
  5. package/dist/node_modules/next/dist/client/add-locale.js +0 -29
  6. package/dist/node_modules/next/dist/client/detect-domain-locale.js +0 -26
  7. package/dist/node_modules/next/dist/client/get-domain-locale.js +0 -41
  8. package/dist/node_modules/next/dist/client/has-base-path.js +0 -28
  9. package/dist/node_modules/next/dist/client/link.js +0 -311
  10. package/dist/node_modules/next/dist/client/normalize-locale-path.js +0 -30
  11. package/dist/node_modules/next/dist/client/normalize-trailing-slash.js +0 -34
  12. package/dist/node_modules/next/dist/client/request-idle-callback.js +0 -44
  13. package/dist/node_modules/next/dist/client/resolve-href.js +0 -86
  14. package/dist/node_modules/next/dist/client/use-intersection.js +0 -104
  15. package/dist/node_modules/next/dist/client/use-merged-ref.js +0 -56
  16. package/dist/node_modules/next/dist/compiled/path-to-regexp/index.js +0 -372
  17. package/dist/node_modules/next/dist/lib/constants.js +0 -316
  18. package/dist/node_modules/next/dist/lib/route-pattern-normalizer.js +0 -69
  19. package/dist/node_modules/next/dist/shared/lib/escape-regexp.js +0 -23
  20. package/dist/node_modules/next/dist/shared/lib/i18n/detect-domain-locale.js +0 -22
  21. package/dist/node_modules/next/dist/shared/lib/i18n/normalize-locale-path.js +0 -42
  22. package/dist/node_modules/next/dist/shared/lib/invariant-error.js +0 -23
  23. package/dist/node_modules/next/dist/shared/lib/page-path/ensure-leading-slash.js +0 -23
  24. package/dist/node_modules/next/dist/shared/lib/router/utils/add-locale.js +0 -30
  25. package/dist/node_modules/next/dist/shared/lib/router/utils/add-path-prefix.js +0 -24
  26. package/dist/node_modules/next/dist/shared/lib/router/utils/app-paths.js +0 -41
  27. package/dist/node_modules/next/dist/shared/lib/router/utils/format-url.js +0 -78
  28. package/dist/node_modules/next/dist/shared/lib/router/utils/get-dynamic-param.js +0 -151
  29. package/dist/node_modules/next/dist/shared/lib/router/utils/get-segment-param.js +0 -77
  30. package/dist/node_modules/next/dist/shared/lib/router/utils/index.js +0 -32
  31. package/dist/node_modules/next/dist/shared/lib/router/utils/interception-routes.js +0 -92
  32. package/dist/node_modules/next/dist/shared/lib/router/utils/interpolate-as.js +0 -41
  33. package/dist/node_modules/next/dist/shared/lib/router/utils/is-dynamic.js +0 -26
  34. package/dist/node_modules/next/dist/shared/lib/router/utils/is-local-url.js +0 -31
  35. package/dist/node_modules/next/dist/shared/lib/router/utils/omit.js +0 -24
  36. package/dist/node_modules/next/dist/shared/lib/router/utils/parse-loader-tree.js +0 -33
  37. package/dist/node_modules/next/dist/shared/lib/router/utils/parse-path.js +0 -36
  38. package/dist/node_modules/next/dist/shared/lib/router/utils/path-has-prefix.js +0 -24
  39. package/dist/node_modules/next/dist/shared/lib/router/utils/querystring.js +0 -56
  40. package/dist/node_modules/next/dist/shared/lib/router/utils/remove-trailing-slash.js +0 -26
  41. package/dist/node_modules/next/dist/shared/lib/router/utils/route-match-utils.js +0 -94
  42. package/dist/node_modules/next/dist/shared/lib/router/utils/route-matcher.js +0 -46
  43. package/dist/node_modules/next/dist/shared/lib/router/utils/route-regex.js +0 -203
  44. package/dist/node_modules/next/dist/shared/lib/router/utils/sorted-routes.js +0 -167
  45. package/dist/node_modules/next/dist/shared/lib/router-context.shared-runtime.js +0 -20
  46. package/dist/node_modules/next/dist/shared/lib/segment.js +0 -80
  47. package/dist/node_modules/next/dist/shared/lib/utils/error-once.js +0 -25
  48. package/dist/node_modules/next/dist/shared/lib/utils.js +0 -172
  49. package/dist/node_modules/next/link.js +0 -12
@@ -1,44 +0,0 @@
1
- import { __commonJSMin } from "../../../../_virtual/rolldown_runtime.js";
2
-
3
- //#region ../../../node_modules/next/dist/client/request-idle-callback.js
4
- var require_request_idle_callback = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- function _export(target, all) {
7
- for (var name in all) Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- cancelIdleCallback: function() {
14
- return cancelIdleCallback;
15
- },
16
- requestIdleCallback: function() {
17
- return requestIdleCallback;
18
- }
19
- });
20
- const requestIdleCallback = typeof self !== "undefined" && self.requestIdleCallback && self.requestIdleCallback.bind(window) || function(cb) {
21
- let start = Date.now();
22
- return self.setTimeout(function() {
23
- cb({
24
- didTimeout: false,
25
- timeRemaining: function() {
26
- return Math.max(0, 50 - (Date.now() - start));
27
- }
28
- });
29
- }, 1);
30
- };
31
- const cancelIdleCallback = typeof self !== "undefined" && self.cancelIdleCallback && self.cancelIdleCallback.bind(window) || function(id) {
32
- return clearTimeout(id);
33
- };
34
- if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
35
- Object.defineProperty(exports.default, "__esModule", { value: true });
36
- Object.assign(exports.default, exports);
37
- module.exports = exports.default;
38
- }
39
- }));
40
-
41
- //#endregion
42
- export default require_request_idle_callback();
43
-
44
- export { require_request_idle_callback };
@@ -1,86 +0,0 @@
1
- import { __commonJSMin } from "../../../../_virtual/rolldown_runtime.js";
2
- import { require_querystring } from "../shared/lib/router/utils/querystring.js";
3
- import { require_format_url } from "../shared/lib/router/utils/format-url.js";
4
- import { require_omit } from "../shared/lib/router/utils/omit.js";
5
- import { require_utils } from "../shared/lib/utils.js";
6
- import { require_normalize_trailing_slash } from "./normalize-trailing-slash.js";
7
- import { require_is_local_url } from "../shared/lib/router/utils/is-local-url.js";
8
- import { require_utils as require_utils$1 } from "../shared/lib/router/utils/index.js";
9
- import { require_route_matcher } from "../shared/lib/router/utils/route-matcher.js";
10
- import { require_route_regex } from "../shared/lib/router/utils/route-regex.js";
11
- import { require_interpolate_as } from "../shared/lib/router/utils/interpolate-as.js";
12
-
13
- //#region ../../../node_modules/next/dist/client/resolve-href.js
14
- var require_resolve_href = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- Object.defineProperty(exports, "resolveHref", {
17
- enumerable: true,
18
- get: function() {
19
- return resolveHref;
20
- }
21
- });
22
- const _querystring = require_querystring();
23
- const _formaturl = require_format_url();
24
- const _omit = require_omit();
25
- const _utils = require_utils();
26
- const _normalizetrailingslash = require_normalize_trailing_slash();
27
- const _islocalurl = require_is_local_url();
28
- const _utils1 = require_utils$1();
29
- const _interpolateas = require_interpolate_as();
30
- const _routeregex = require_route_regex();
31
- const _routematcher = require_route_matcher();
32
- function resolveHref(router, href, resolveAs) {
33
- let base;
34
- let urlAsString = typeof href === "string" ? href : (0, _formaturl.formatWithValidation)(href);
35
- const urlProtoMatch = urlAsString.match(/^[a-z][a-z0-9+.-]*:\/\//i);
36
- const urlAsStringNoProto = urlProtoMatch ? urlAsString.slice(urlProtoMatch[0].length) : urlAsString;
37
- if ((urlAsStringNoProto.split("?", 1)[0] || "").match(/(\/\/|\\)/)) {
38
- console.error(`Invalid href '${urlAsString}' passed to next/router in page: '${router.pathname}'. Repeated forward-slashes (//) or backslashes \\ are not valid in the href.`);
39
- const normalizedUrl = (0, _utils.normalizeRepeatedSlashes)(urlAsStringNoProto);
40
- urlAsString = (urlProtoMatch ? urlProtoMatch[0] : "") + normalizedUrl;
41
- }
42
- if (!(0, _islocalurl.isLocalURL)(urlAsString)) return resolveAs ? [urlAsString] : urlAsString;
43
- try {
44
- let baseBase = urlAsString.startsWith("#") ? router.asPath : router.pathname;
45
- if (urlAsString.startsWith("?")) {
46
- baseBase = router.asPath;
47
- if ((0, _utils1.isDynamicRoute)(router.pathname)) {
48
- baseBase = router.pathname;
49
- const routeRegex = (0, _routeregex.getRouteRegex)(router.pathname);
50
- if (!(0, _routematcher.getRouteMatcher)(routeRegex)(router.asPath)) baseBase = router.asPath;
51
- }
52
- }
53
- base = new URL(baseBase, "http://n");
54
- } catch (_) {
55
- base = new URL("/", "http://n");
56
- }
57
- try {
58
- const finalUrl = new URL(urlAsString, base);
59
- finalUrl.pathname = (0, _normalizetrailingslash.normalizePathTrailingSlash)(finalUrl.pathname);
60
- let interpolatedAs = "";
61
- if ((0, _utils1.isDynamicRoute)(finalUrl.pathname) && finalUrl.searchParams && resolveAs) {
62
- const query = (0, _querystring.searchParamsToUrlQuery)(finalUrl.searchParams);
63
- const { result, params } = (0, _interpolateas.interpolateAs)(finalUrl.pathname, finalUrl.pathname, query);
64
- if (result) interpolatedAs = (0, _formaturl.formatWithValidation)({
65
- pathname: result,
66
- hash: finalUrl.hash,
67
- query: (0, _omit.omit)(query, params)
68
- });
69
- }
70
- const resolvedHref = finalUrl.origin === base.origin ? finalUrl.href.slice(finalUrl.origin.length) : finalUrl.href;
71
- return resolveAs ? [resolvedHref, interpolatedAs || resolvedHref] : resolvedHref;
72
- } catch (_) {
73
- return resolveAs ? [urlAsString] : urlAsString;
74
- }
75
- }
76
- if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
77
- Object.defineProperty(exports.default, "__esModule", { value: true });
78
- Object.assign(exports.default, exports);
79
- module.exports = exports.default;
80
- }
81
- }));
82
-
83
- //#endregion
84
- export default require_resolve_href();
85
-
86
- export { require_resolve_href };
@@ -1,104 +0,0 @@
1
- import { __commonJSMin, __require } from "../../../../_virtual/rolldown_runtime.js";
2
- import { require_request_idle_callback } from "./request-idle-callback.js";
3
-
4
- //#region ../../../node_modules/next/dist/client/use-intersection.js
5
- var require_use_intersection = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- Object.defineProperty(exports, "useIntersection", {
8
- enumerable: true,
9
- get: function() {
10
- return useIntersection;
11
- }
12
- });
13
- const _react = __require("react");
14
- const _requestidlecallback = require_request_idle_callback();
15
- const hasIntersectionObserver = typeof IntersectionObserver === "function";
16
- const observers = /* @__PURE__ */ new Map();
17
- const idList = [];
18
- function createObserver(options) {
19
- const id = {
20
- root: options.root || null,
21
- margin: options.rootMargin || ""
22
- };
23
- const existing = idList.find((obj) => obj.root === id.root && obj.margin === id.margin);
24
- let instance;
25
- if (existing) {
26
- instance = observers.get(existing);
27
- if (instance) return instance;
28
- }
29
- const elements = /* @__PURE__ */ new Map();
30
- instance = {
31
- id,
32
- observer: new IntersectionObserver((entries) => {
33
- entries.forEach((entry) => {
34
- const callback = elements.get(entry.target);
35
- const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
36
- if (callback && isVisible) callback(isVisible);
37
- });
38
- }, options),
39
- elements
40
- };
41
- idList.push(id);
42
- observers.set(id, instance);
43
- return instance;
44
- }
45
- function observe(element, callback, options) {
46
- const { id, observer, elements } = createObserver(options);
47
- elements.set(element, callback);
48
- observer.observe(element);
49
- return function unobserve() {
50
- elements.delete(element);
51
- observer.unobserve(element);
52
- if (elements.size === 0) {
53
- observer.disconnect();
54
- observers.delete(id);
55
- const index = idList.findIndex((obj) => obj.root === id.root && obj.margin === id.margin);
56
- if (index > -1) idList.splice(index, 1);
57
- }
58
- };
59
- }
60
- function useIntersection({ rootRef, rootMargin, disabled }) {
61
- const isDisabled = disabled || !hasIntersectionObserver;
62
- const [visible, setVisible] = (0, _react.useState)(false);
63
- const elementRef = (0, _react.useRef)(null);
64
- const setElement = (0, _react.useCallback)((element) => {
65
- elementRef.current = element;
66
- }, []);
67
- (0, _react.useEffect)(() => {
68
- if (hasIntersectionObserver) {
69
- if (isDisabled || visible) return;
70
- const element = elementRef.current;
71
- if (element && element.tagName) return observe(element, (isVisible) => isVisible && setVisible(isVisible), {
72
- root: rootRef?.current,
73
- rootMargin
74
- });
75
- } else if (!visible) {
76
- const idleCallback = (0, _requestidlecallback.requestIdleCallback)(() => setVisible(true));
77
- return () => (0, _requestidlecallback.cancelIdleCallback)(idleCallback);
78
- }
79
- }, [
80
- isDisabled,
81
- rootMargin,
82
- rootRef,
83
- visible,
84
- elementRef.current
85
- ]);
86
- return [
87
- setElement,
88
- visible,
89
- (0, _react.useCallback)(() => {
90
- setVisible(false);
91
- }, [])
92
- ];
93
- }
94
- if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
95
- Object.defineProperty(exports.default, "__esModule", { value: true });
96
- Object.assign(exports.default, exports);
97
- module.exports = exports.default;
98
- }
99
- }));
100
-
101
- //#endregion
102
- export default require_use_intersection();
103
-
104
- export { require_use_intersection };
@@ -1,56 +0,0 @@
1
- import { __commonJSMin, __require } from "../../../../_virtual/rolldown_runtime.js";
2
-
3
- //#region ../../../node_modules/next/dist/client/use-merged-ref.js
4
- var require_use_merged_ref = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- Object.defineProperty(exports, "useMergedRef", {
7
- enumerable: true,
8
- get: function() {
9
- return useMergedRef;
10
- }
11
- });
12
- const _react = __require("react");
13
- function useMergedRef(refA, refB) {
14
- const cleanupA = (0, _react.useRef)(null);
15
- const cleanupB = (0, _react.useRef)(null);
16
- return (0, _react.useCallback)((current) => {
17
- if (current === null) {
18
- const cleanupFnA = cleanupA.current;
19
- if (cleanupFnA) {
20
- cleanupA.current = null;
21
- cleanupFnA();
22
- }
23
- const cleanupFnB = cleanupB.current;
24
- if (cleanupFnB) {
25
- cleanupB.current = null;
26
- cleanupFnB();
27
- }
28
- } else {
29
- if (refA) cleanupA.current = applyRef(refA, current);
30
- if (refB) cleanupB.current = applyRef(refB, current);
31
- }
32
- }, [refA, refB]);
33
- }
34
- function applyRef(refA, current) {
35
- if (typeof refA === "function") {
36
- const cleanup = refA(current);
37
- if (typeof cleanup === "function") return cleanup;
38
- else return () => refA(null);
39
- } else {
40
- refA.current = current;
41
- return () => {
42
- refA.current = null;
43
- };
44
- }
45
- }
46
- if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
47
- Object.defineProperty(exports.default, "__esModule", { value: true });
48
- Object.assign(exports.default, exports);
49
- module.exports = exports.default;
50
- }
51
- }));
52
-
53
- //#endregion
54
- export default require_use_merged_ref();
55
-
56
- export { require_use_merged_ref };
@@ -1,372 +0,0 @@
1
- import { __commonJSMin } from "../../../../../_virtual/rolldown_runtime.js";
2
-
3
- //#region ../../../node_modules/next/dist/compiled/path-to-regexp/index.js
4
- var require_path_to_regexp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
- (() => {
6
- "use strict";
7
- if (typeof __nccwpck_require__ !== "undefined") __nccwpck_require__.ab = __dirname + "/";
8
- var e = {};
9
- (() => {
10
- var n = e;
11
- Object.defineProperty(n, "__esModule", { value: true });
12
- n.pathToRegexp = n.tokensToRegexp = n.regexpToFunction = n.match = n.tokensToFunction = n.compile = n.parse = void 0;
13
- function lexer(e$1) {
14
- var n$1 = [];
15
- var r = 0;
16
- while (r < e$1.length) {
17
- var t = e$1[r];
18
- if (t === "*" || t === "+" || t === "?") {
19
- n$1.push({
20
- type: "MODIFIER",
21
- index: r,
22
- value: e$1[r++]
23
- });
24
- continue;
25
- }
26
- if (t === "\\") {
27
- n$1.push({
28
- type: "ESCAPED_CHAR",
29
- index: r++,
30
- value: e$1[r++]
31
- });
32
- continue;
33
- }
34
- if (t === "{") {
35
- n$1.push({
36
- type: "OPEN",
37
- index: r,
38
- value: e$1[r++]
39
- });
40
- continue;
41
- }
42
- if (t === "}") {
43
- n$1.push({
44
- type: "CLOSE",
45
- index: r,
46
- value: e$1[r++]
47
- });
48
- continue;
49
- }
50
- if (t === ":") {
51
- var a = "";
52
- var i = r + 1;
53
- while (i < e$1.length) {
54
- var o = e$1.charCodeAt(i);
55
- if (o >= 48 && o <= 57 || o >= 65 && o <= 90 || o >= 97 && o <= 122 || o === 95) {
56
- a += e$1[i++];
57
- continue;
58
- }
59
- break;
60
- }
61
- if (!a) throw new TypeError("Missing parameter name at ".concat(r));
62
- n$1.push({
63
- type: "NAME",
64
- index: r,
65
- value: a
66
- });
67
- r = i;
68
- continue;
69
- }
70
- if (t === "(") {
71
- var c = 1;
72
- var f = "";
73
- var i = r + 1;
74
- if (e$1[i] === "?") throw new TypeError("Pattern cannot start with \"?\" at ".concat(i));
75
- while (i < e$1.length) {
76
- if (e$1[i] === "\\") {
77
- f += e$1[i++] + e$1[i++];
78
- continue;
79
- }
80
- if (e$1[i] === ")") {
81
- c--;
82
- if (c === 0) {
83
- i++;
84
- break;
85
- }
86
- } else if (e$1[i] === "(") {
87
- c++;
88
- if (e$1[i + 1] !== "?") throw new TypeError("Capturing groups are not allowed at ".concat(i));
89
- }
90
- f += e$1[i++];
91
- }
92
- if (c) throw new TypeError("Unbalanced pattern at ".concat(r));
93
- if (!f) throw new TypeError("Missing pattern at ".concat(r));
94
- n$1.push({
95
- type: "PATTERN",
96
- index: r,
97
- value: f
98
- });
99
- r = i;
100
- continue;
101
- }
102
- n$1.push({
103
- type: "CHAR",
104
- index: r,
105
- value: e$1[r++]
106
- });
107
- }
108
- n$1.push({
109
- type: "END",
110
- index: r,
111
- value: ""
112
- });
113
- return n$1;
114
- }
115
- function parse(e$1, n$1) {
116
- if (n$1 === void 0) n$1 = {};
117
- var r = lexer(e$1);
118
- var t = n$1.prefixes, a = t === void 0 ? "./" : t, i = n$1.delimiter, o = i === void 0 ? "/#?" : i;
119
- var c = [];
120
- var f = 0;
121
- var u = 0;
122
- var p = "";
123
- var tryConsume = function(e$2) {
124
- if (u < r.length && r[u].type === e$2) return r[u++].value;
125
- };
126
- var mustConsume = function(e$2) {
127
- var n$2 = tryConsume(e$2);
128
- if (n$2 !== void 0) return n$2;
129
- var t$1 = r[u], a$1 = t$1.type, i$1 = t$1.index;
130
- throw new TypeError("Unexpected ".concat(a$1, " at ").concat(i$1, ", expected ").concat(e$2));
131
- };
132
- var consumeText = function() {
133
- var e$2 = "";
134
- var n$2;
135
- while (n$2 = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) e$2 += n$2;
136
- return e$2;
137
- };
138
- var isSafe = function(e$2) {
139
- for (var n$2 = 0, r$1 = o; n$2 < r$1.length; n$2++) {
140
- var t$1 = r$1[n$2];
141
- if (e$2.indexOf(t$1) > -1) return true;
142
- }
143
- return false;
144
- };
145
- var safePattern = function(e$2) {
146
- var n$2 = c[c.length - 1];
147
- var r$1 = e$2 || (n$2 && typeof n$2 === "string" ? n$2 : "");
148
- if (n$2 && !r$1) throw new TypeError("Must have text between two parameters, missing text after \"".concat(n$2.name, "\""));
149
- if (!r$1 || isSafe(r$1)) return "[^".concat(escapeString(o), "]+?");
150
- return "(?:(?!".concat(escapeString(r$1), ")[^").concat(escapeString(o), "])+?");
151
- };
152
- while (u < r.length) {
153
- var v = tryConsume("CHAR");
154
- var s = tryConsume("NAME");
155
- var d = tryConsume("PATTERN");
156
- if (s || d) {
157
- var g = v || "";
158
- if (a.indexOf(g) === -1) {
159
- p += g;
160
- g = "";
161
- }
162
- if (p) {
163
- c.push(p);
164
- p = "";
165
- }
166
- c.push({
167
- name: s || f++,
168
- prefix: g,
169
- suffix: "",
170
- pattern: d || safePattern(g),
171
- modifier: tryConsume("MODIFIER") || ""
172
- });
173
- continue;
174
- }
175
- var x = v || tryConsume("ESCAPED_CHAR");
176
- if (x) {
177
- p += x;
178
- continue;
179
- }
180
- if (p) {
181
- c.push(p);
182
- p = "";
183
- }
184
- if (tryConsume("OPEN")) {
185
- var g = consumeText();
186
- var l = tryConsume("NAME") || "";
187
- var m = tryConsume("PATTERN") || "";
188
- var T = consumeText();
189
- mustConsume("CLOSE");
190
- c.push({
191
- name: l || (m ? f++ : ""),
192
- pattern: l && !m ? safePattern(g) : m,
193
- prefix: g,
194
- suffix: T,
195
- modifier: tryConsume("MODIFIER") || ""
196
- });
197
- continue;
198
- }
199
- mustConsume("END");
200
- }
201
- return c;
202
- }
203
- n.parse = parse;
204
- function compile(e$1, n$1) {
205
- return tokensToFunction(parse(e$1, n$1), n$1);
206
- }
207
- n.compile = compile;
208
- function tokensToFunction(e$1, n$1) {
209
- if (n$1 === void 0) n$1 = {};
210
- var r = flags(n$1);
211
- var t = n$1.encode, a = t === void 0 ? function(e$2) {
212
- return e$2;
213
- } : t, i = n$1.validate, o = i === void 0 ? true : i;
214
- var c = e$1.map((function(e$2) {
215
- if (typeof e$2 === "object") return new RegExp("^(?:".concat(e$2.pattern, ")$"), r);
216
- }));
217
- return function(n$2) {
218
- var r$1 = "";
219
- for (var t$1 = 0; t$1 < e$1.length; t$1++) {
220
- var i$1 = e$1[t$1];
221
- if (typeof i$1 === "string") {
222
- r$1 += i$1;
223
- continue;
224
- }
225
- var f = n$2 ? n$2[i$1.name] : void 0;
226
- var u = i$1.modifier === "?" || i$1.modifier === "*";
227
- var p = i$1.modifier === "*" || i$1.modifier === "+";
228
- if (Array.isArray(f)) {
229
- if (!p) throw new TypeError("Expected \"".concat(i$1.name, "\" to not repeat, but got an array"));
230
- if (f.length === 0) {
231
- if (u) continue;
232
- throw new TypeError("Expected \"".concat(i$1.name, "\" to not be empty"));
233
- }
234
- for (var v = 0; v < f.length; v++) {
235
- var s = a(f[v], i$1);
236
- if (o && !c[t$1].test(s)) throw new TypeError("Expected all \"".concat(i$1.name, "\" to match \"").concat(i$1.pattern, "\", but got \"").concat(s, "\""));
237
- r$1 += i$1.prefix + s + i$1.suffix;
238
- }
239
- continue;
240
- }
241
- if (typeof f === "string" || typeof f === "number") {
242
- var s = a(String(f), i$1);
243
- if (o && !c[t$1].test(s)) throw new TypeError("Expected \"".concat(i$1.name, "\" to match \"").concat(i$1.pattern, "\", but got \"").concat(s, "\""));
244
- r$1 += i$1.prefix + s + i$1.suffix;
245
- continue;
246
- }
247
- if (u) continue;
248
- var d = p ? "an array" : "a string";
249
- throw new TypeError("Expected \"".concat(i$1.name, "\" to be ").concat(d));
250
- }
251
- return r$1;
252
- };
253
- }
254
- n.tokensToFunction = tokensToFunction;
255
- function match(e$1, n$1) {
256
- var r = [];
257
- return regexpToFunction(pathToRegexp(e$1, r, n$1), r, n$1);
258
- }
259
- n.match = match;
260
- function regexpToFunction(e$1, n$1, r) {
261
- if (r === void 0) r = {};
262
- var t = r.decode, a = t === void 0 ? function(e$2) {
263
- return e$2;
264
- } : t;
265
- return function(r$1) {
266
- var t$1 = e$1.exec(r$1);
267
- if (!t$1) return false;
268
- var i = t$1[0], o = t$1.index;
269
- var c = Object.create(null);
270
- var _loop_1 = function(e$2) {
271
- if (t$1[e$2] === void 0) return "continue";
272
- var r$2 = n$1[e$2 - 1];
273
- if (r$2.modifier === "*" || r$2.modifier === "+") c[r$2.name] = t$1[e$2].split(r$2.prefix + r$2.suffix).map((function(e$3) {
274
- return a(e$3, r$2);
275
- }));
276
- else c[r$2.name] = a(t$1[e$2], r$2);
277
- };
278
- for (var f = 1; f < t$1.length; f++) _loop_1(f);
279
- return {
280
- path: i,
281
- index: o,
282
- params: c
283
- };
284
- };
285
- }
286
- n.regexpToFunction = regexpToFunction;
287
- function escapeString(e$1) {
288
- return e$1.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
289
- }
290
- function flags(e$1) {
291
- return e$1 && e$1.sensitive ? "" : "i";
292
- }
293
- function regexpToRegexp(e$1, n$1) {
294
- if (!n$1) return e$1;
295
- var r = /\((?:\?<(.*?)>)?(?!\?)/g;
296
- var t = 0;
297
- var a = r.exec(e$1.source);
298
- while (a) {
299
- n$1.push({
300
- name: a[1] || t++,
301
- prefix: "",
302
- suffix: "",
303
- modifier: "",
304
- pattern: ""
305
- });
306
- a = r.exec(e$1.source);
307
- }
308
- return e$1;
309
- }
310
- function arrayToRegexp(e$1, n$1, r) {
311
- var t = e$1.map((function(e$2) {
312
- return pathToRegexp(e$2, n$1, r).source;
313
- }));
314
- return new RegExp("(?:".concat(t.join("|"), ")"), flags(r));
315
- }
316
- function stringToRegexp(e$1, n$1, r) {
317
- return tokensToRegexp(parse(e$1, r), n$1, r);
318
- }
319
- function tokensToRegexp(e$1, n$1, r) {
320
- if (r === void 0) r = {};
321
- var t = r.strict, a = t === void 0 ? false : t, i = r.start, o = i === void 0 ? true : i, c = r.end, f = c === void 0 ? true : c, u = r.encode, p = u === void 0 ? function(e$2) {
322
- return e$2;
323
- } : u, v = r.delimiter, s = v === void 0 ? "/#?" : v, d = r.endsWith, g = d === void 0 ? "" : d;
324
- var x = "[".concat(escapeString(g), "]|$");
325
- var h = "[".concat(escapeString(s), "]");
326
- var l = o ? "^" : "";
327
- for (var m = 0, T = e$1; m < T.length; m++) {
328
- var E = T[m];
329
- if (typeof E === "string") l += escapeString(p(E));
330
- else {
331
- var w = escapeString(p(E.prefix));
332
- var y = escapeString(p(E.suffix));
333
- if (E.pattern) {
334
- if (n$1) n$1.push(E);
335
- if (w || y) if (E.modifier === "+" || E.modifier === "*") {
336
- var R = E.modifier === "*" ? "?" : "";
337
- l += "(?:".concat(w, "((?:").concat(E.pattern, ")(?:").concat(y).concat(w, "(?:").concat(E.pattern, "))*)").concat(y, ")").concat(R);
338
- } else l += "(?:".concat(w, "(").concat(E.pattern, ")").concat(y, ")").concat(E.modifier);
339
- else {
340
- if (E.modifier === "+" || E.modifier === "*") throw new TypeError("Can not repeat \"".concat(E.name, "\" without a prefix and suffix"));
341
- l += "(".concat(E.pattern, ")").concat(E.modifier);
342
- }
343
- } else l += "(?:".concat(w).concat(y, ")").concat(E.modifier);
344
- }
345
- }
346
- if (f) {
347
- if (!a) l += "".concat(h, "?");
348
- l += !r.endsWith ? "$" : "(?=".concat(x, ")");
349
- } else {
350
- var A = e$1[e$1.length - 1];
351
- var _ = typeof A === "string" ? h.indexOf(A[A.length - 1]) > -1 : A === void 0;
352
- if (!a) l += "(?:".concat(h, "(?=").concat(x, "))?");
353
- if (!_) l += "(?=".concat(h, "|").concat(x, ")");
354
- }
355
- return new RegExp(l, flags(r));
356
- }
357
- n.tokensToRegexp = tokensToRegexp;
358
- function pathToRegexp(e$1, n$1, r) {
359
- if (e$1 instanceof RegExp) return regexpToRegexp(e$1, n$1);
360
- if (Array.isArray(e$1)) return arrayToRegexp(e$1, n$1, r);
361
- return stringToRegexp(e$1, n$1, r);
362
- }
363
- n.pathToRegexp = pathToRegexp;
364
- })();
365
- module.exports = e;
366
- })();
367
- }));
368
-
369
- //#endregion
370
- export default require_path_to_regexp();
371
-
372
- export { require_path_to_regexp };