@inventreedb/ui 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/.vite/manifest.json +444 -1
  3. package/dist/components/Boundary.d.ts +10 -0
  4. package/dist/components/Boundary.js +37 -0
  5. package/dist/components/Boundary.js.map +1 -0
  6. package/dist/components/CopyButton.d.ts +13 -0
  7. package/dist/components/CopyButton.js +51 -0
  8. package/dist/components/CopyButton.js.map +1 -0
  9. package/dist/components/CopyableCell.d.ts +11 -0
  10. package/dist/components/CopyableCell.js +24 -0
  11. package/dist/components/CopyableCell.js.map +1 -0
  12. package/dist/components/InvenTreeTable.d.ts +17 -0
  13. package/dist/components/InvenTreeTable.js +41 -0
  14. package/dist/components/InvenTreeTable.js.map +1 -0
  15. package/dist/components/TableColumnSelect.d.ts +4 -0
  16. package/dist/components/TableColumnSelect.js +38 -0
  17. package/dist/components/TableColumnSelect.js.map +1 -0
  18. package/dist/enums/ApiEndpoints.d.ts +1 -1
  19. package/dist/enums/ApiEndpoints.js +1 -1
  20. package/dist/enums/ApiEndpoints.js.map +1 -1
  21. package/dist/enums/ModelInformation.js +17 -0
  22. package/dist/enums/ModelInformation.js.map +1 -1
  23. package/dist/enums/ModelType.d.ts +1 -0
  24. package/dist/enums/ModelType.js +1 -0
  25. package/dist/enums/ModelType.js.map +1 -1
  26. package/dist/functions/Forms.d.ts +11 -0
  27. package/dist/functions/Forms.js +27 -0
  28. package/dist/functions/Forms.js.map +1 -0
  29. package/dist/functions/Notification.d.ts +16 -0
  30. package/dist/functions/Notification.js +82 -0
  31. package/dist/functions/Notification.js.map +1 -0
  32. package/dist/functions/String.d.ts +13 -0
  33. package/dist/functions/String.js +25 -0
  34. package/dist/functions/String.js.map +1 -0
  35. package/dist/hooks/UseFilterSet.d.ts +2 -0
  36. package/dist/hooks/UseFilterSet.js +35 -0
  37. package/dist/hooks/UseFilterSet.js.map +1 -0
  38. package/dist/hooks/UseTable.d.ts +12 -0
  39. package/dist/hooks/UseTable.js +92 -0
  40. package/dist/hooks/UseTable.js.map +1 -0
  41. package/dist/index.d.ts +13 -2
  42. package/dist/index.js +32 -4
  43. package/dist/index.js.map +1 -1
  44. package/dist/node_modules/@mantine/hooks/esm/use-local-storage/create-storage.js +129 -0
  45. package/dist/node_modules/@mantine/hooks/esm/use-local-storage/create-storage.js.map +1 -0
  46. package/dist/node_modules/@mantine/hooks/esm/use-local-storage/use-local-storage.js +8 -0
  47. package/dist/node_modules/@mantine/hooks/esm/use-local-storage/use-local-storage.js.map +1 -0
  48. package/dist/node_modules/@mantine/hooks/esm/use-window-event/use-window-event.js +11 -0
  49. package/dist/node_modules/@mantine/hooks/esm/use-window-event/use-window-event.js.map +1 -0
  50. package/dist/node_modules/@mantine/hooks/esm/utils/random-id/random-id.js +7 -0
  51. package/dist/node_modules/@mantine/hooks/esm/utils/random-id/random-id.js.map +1 -0
  52. package/dist/node_modules/@remix-run/router/dist/router.js +272 -0
  53. package/dist/node_modules/@remix-run/router/dist/router.js.map +1 -0
  54. package/dist/node_modules/@sentry/browser/build/npm/esm/prod/debug-build.js +5 -0
  55. package/dist/node_modules/@sentry/browser/build/npm/esm/prod/debug-build.js.map +1 -0
  56. package/dist/node_modules/@sentry/browser/build/npm/esm/prod/helpers.js +6 -0
  57. package/dist/node_modules/@sentry/browser/build/npm/esm/prod/helpers.js.map +1 -0
  58. package/dist/node_modules/@sentry/browser/build/npm/esm/prod/report-dialog.js +54 -0
  59. package/dist/node_modules/@sentry/browser/build/npm/esm/prod/report-dialog.js.map +1 -0
  60. package/dist/node_modules/@sentry/core/build/esm/api.js +41 -0
  61. package/dist/node_modules/@sentry/core/build/esm/api.js.map +1 -0
  62. package/dist/node_modules/@sentry/core/build/esm/asyncContext/index.js +13 -0
  63. package/dist/node_modules/@sentry/core/build/esm/asyncContext/index.js.map +1 -0
  64. package/dist/node_modules/@sentry/core/build/esm/asyncContext/stackStrategy.js +124 -0
  65. package/dist/node_modules/@sentry/core/build/esm/asyncContext/stackStrategy.js.map +1 -0
  66. package/dist/node_modules/@sentry/core/build/esm/carrier.js +22 -0
  67. package/dist/node_modules/@sentry/core/build/esm/carrier.js.map +1 -0
  68. package/dist/node_modules/@sentry/core/build/esm/currentScopes.js +34 -0
  69. package/dist/node_modules/@sentry/core/build/esm/currentScopes.js.map +1 -0
  70. package/dist/node_modules/@sentry/core/build/esm/debug-build.js +5 -0
  71. package/dist/node_modules/@sentry/core/build/esm/debug-build.js.map +1 -0
  72. package/dist/node_modules/@sentry/core/build/esm/defaultScopes.js +13 -0
  73. package/dist/node_modules/@sentry/core/build/esm/defaultScopes.js.map +1 -0
  74. package/dist/node_modules/@sentry/core/build/esm/exports.js +13 -0
  75. package/dist/node_modules/@sentry/core/build/esm/exports.js.map +1 -0
  76. package/dist/node_modules/@sentry/core/build/esm/scope.js +577 -0
  77. package/dist/node_modules/@sentry/core/build/esm/scope.js.map +1 -0
  78. package/dist/node_modules/@sentry/core/build/esm/session.js +61 -0
  79. package/dist/node_modules/@sentry/core/build/esm/session.js.map +1 -0
  80. package/dist/node_modules/@sentry/core/build/esm/utils/chain-and-copy-promiselike.js +39 -0
  81. package/dist/node_modules/@sentry/core/build/esm/utils/chain-and-copy-promiselike.js.map +1 -0
  82. package/dist/node_modules/@sentry/core/build/esm/utils/debug-logger.js +79 -0
  83. package/dist/node_modules/@sentry/core/build/esm/utils/debug-logger.js.map +1 -0
  84. package/dist/node_modules/@sentry/core/build/esm/utils/dsn.js +88 -0
  85. package/dist/node_modules/@sentry/core/build/esm/utils/dsn.js.map +1 -0
  86. package/dist/node_modules/@sentry/core/build/esm/utils/is.js +35 -0
  87. package/dist/node_modules/@sentry/core/build/esm/utils/is.js.map +1 -0
  88. package/dist/node_modules/@sentry/core/build/esm/utils/merge.js +19 -0
  89. package/dist/node_modules/@sentry/core/build/esm/utils/merge.js.map +1 -0
  90. package/dist/node_modules/@sentry/core/build/esm/utils/misc.js +32 -0
  91. package/dist/node_modules/@sentry/core/build/esm/utils/misc.js.map +1 -0
  92. package/dist/node_modules/@sentry/core/build/esm/utils/object.js +18 -0
  93. package/dist/node_modules/@sentry/core/build/esm/utils/object.js.map +1 -0
  94. package/dist/node_modules/@sentry/core/build/esm/utils/prepareEvent.js +34 -0
  95. package/dist/node_modules/@sentry/core/build/esm/utils/prepareEvent.js.map +1 -0
  96. package/dist/node_modules/@sentry/core/build/esm/utils/propagationContext.js +8 -0
  97. package/dist/node_modules/@sentry/core/build/esm/utils/propagationContext.js.map +1 -0
  98. package/dist/node_modules/@sentry/core/build/esm/utils/randomSafeContext.js +27 -0
  99. package/dist/node_modules/@sentry/core/build/esm/utils/randomSafeContext.js.map +1 -0
  100. package/dist/node_modules/@sentry/core/build/esm/utils/spanOnScope.js +17 -0
  101. package/dist/node_modules/@sentry/core/build/esm/utils/spanOnScope.js.map +1 -0
  102. package/dist/node_modules/@sentry/core/build/esm/utils/string.js +10 -0
  103. package/dist/node_modules/@sentry/core/build/esm/utils/string.js.map +1 -0
  104. package/dist/node_modules/@sentry/core/build/esm/utils/time.js +26 -0
  105. package/dist/node_modules/@sentry/core/build/esm/utils/time.js.map +1 -0
  106. package/dist/node_modules/@sentry/core/build/esm/utils/version.js +5 -0
  107. package/dist/node_modules/@sentry/core/build/esm/utils/version.js.map +1 -0
  108. package/dist/node_modules/@sentry/core/build/esm/utils/worldwide.js +5 -0
  109. package/dist/node_modules/@sentry/core/build/esm/utils/worldwide.js.map +1 -0
  110. package/dist/node_modules/@sentry/react/build/esm/debug-build.js +5 -0
  111. package/dist/node_modules/@sentry/react/build/esm/debug-build.js.map +1 -0
  112. package/dist/node_modules/@sentry/react/build/esm/error.js +40 -0
  113. package/dist/node_modules/@sentry/react/build/esm/error.js.map +1 -0
  114. package/dist/node_modules/@sentry/react/build/esm/errorboundary.js +103 -0
  115. package/dist/node_modules/@sentry/react/build/esm/errorboundary.js.map +1 -0
  116. package/dist/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js +0 -6
  117. package/dist/node_modules/@tabler/icons-react/dist/esm/createReactComponent.js.map +1 -1
  118. package/dist/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js +0 -6
  119. package/dist/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.js.map +1 -1
  120. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustments.js +8 -0
  121. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustments.js.map +1 -0
  122. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js +0 -6
  123. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowRight.js.map +1 -1
  124. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js +8 -0
  125. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.js.map +1 -0
  126. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheck.js +0 -6
  127. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheck.js.map +1 -1
  128. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleX.js +0 -6
  129. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleX.js.map +1 -1
  130. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js +0 -6
  131. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.js.map +1 -1
  132. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.js +0 -6
  133. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.js.map +1 -1
  134. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.js +0 -6
  135. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.js.map +1 -1
  136. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconExclamationCircle.js +0 -6
  137. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconExclamationCircle.js.map +1 -1
  138. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.js +0 -6
  139. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.js.map +1 -1
  140. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js +0 -6
  141. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.js.map +1 -1
  142. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js +0 -6
  143. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.js.map +1 -1
  144. package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +1 -10
  145. package/dist/node_modules/react/cjs/react-jsx-runtime.development.js.map +1 -1
  146. package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +1 -10
  147. package/dist/node_modules/react/cjs/react-jsx-runtime.production.js.map +1 -1
  148. package/dist/node_modules/react-router/dist/index.js +377 -0
  149. package/dist/node_modules/react-router/dist/index.js.map +1 -0
  150. package/dist/node_modules/react-router-dom/dist/index.js +560 -0
  151. package/dist/node_modules/react-router-dom/dist/index.js.map +1 -0
  152. package/dist/node_modules/zustand/esm/middleware.js +202 -0
  153. package/dist/node_modules/zustand/esm/middleware.js.map +1 -0
  154. package/dist/node_modules/zustand/esm/react.js +24 -0
  155. package/dist/node_modules/zustand/esm/react.js.map +1 -0
  156. package/dist/node_modules/zustand/esm/vanilla.js +26 -0
  157. package/dist/node_modules/zustand/esm/vanilla.js.map +1 -0
  158. package/dist/states/StoredTableState.d.ts +37 -0
  159. package/dist/states/StoredTableState.js +58 -0
  160. package/dist/states/StoredTableState.js.map +1 -0
  161. package/dist/types/Forms.d.ts +2 -0
  162. package/dist/types/Plugins.d.ts +14 -7
  163. package/dist/types/Plugins.js +1 -1
  164. package/dist/types/Plugins.js.map +1 -1
  165. package/dist/types/Tables.d.ts +10 -0
  166. package/lib/components/Boundary.tsx +46 -0
  167. package/lib/components/CopyButton.tsx +76 -0
  168. package/lib/components/CopyableCell.tsx +51 -0
  169. package/lib/components/InvenTreeTable.tsx +63 -0
  170. package/lib/components/TableColumnSelect.tsx +40 -0
  171. package/lib/enums/ApiEndpoints.tsx +1 -1
  172. package/lib/enums/ModelInformation.tsx +7 -0
  173. package/lib/enums/ModelType.tsx +1 -0
  174. package/lib/functions/Forms.tsx +47 -0
  175. package/lib/functions/Notification.tsx +50 -0
  176. package/lib/functions/String.tsx +38 -0
  177. package/lib/hooks/UseFilterSet.tsx +47 -0
  178. package/lib/hooks/UseTable.tsx +160 -0
  179. package/lib/index.ts +49 -1
  180. package/lib/states/StoredTableState.tsx +91 -0
  181. package/lib/types/Forms.tsx +2 -0
  182. package/lib/types/Plugins.tsx +15 -7
  183. package/lib/types/Tables.tsx +11 -0
  184. package/package.json +2 -2
@@ -0,0 +1,272 @@
1
+ function _extends() {
2
+ _extends = Object.assign ? Object.assign.bind() : function(target) {
3
+ for (var i = 1; i < arguments.length; i++) {
4
+ var source = arguments[i];
5
+ for (var key in source) {
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+ var Action;
16
+ (function(Action2) {
17
+ Action2["Pop"] = "POP";
18
+ Action2["Push"] = "PUSH";
19
+ Action2["Replace"] = "REPLACE";
20
+ })(Action || (Action = {}));
21
+ function invariant(value, message) {
22
+ if (value === false || value === null || typeof value === "undefined") {
23
+ throw new Error(message);
24
+ }
25
+ }
26
+ function warning(cond, message) {
27
+ if (!cond) {
28
+ if (typeof console !== "undefined") console.warn(message);
29
+ try {
30
+ throw new Error(message);
31
+ } catch (e) {
32
+ }
33
+ }
34
+ }
35
+ function createPath(_ref) {
36
+ let {
37
+ pathname = "/",
38
+ search = "",
39
+ hash = ""
40
+ } = _ref;
41
+ if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search;
42
+ if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
43
+ return pathname;
44
+ }
45
+ function parsePath(path) {
46
+ let parsedPath = {};
47
+ if (path) {
48
+ let hashIndex = path.indexOf("#");
49
+ if (hashIndex >= 0) {
50
+ parsedPath.hash = path.substr(hashIndex);
51
+ path = path.substr(0, hashIndex);
52
+ }
53
+ let searchIndex = path.indexOf("?");
54
+ if (searchIndex >= 0) {
55
+ parsedPath.search = path.substr(searchIndex);
56
+ path = path.substr(0, searchIndex);
57
+ }
58
+ if (path) {
59
+ parsedPath.pathname = path;
60
+ }
61
+ }
62
+ return parsedPath;
63
+ }
64
+ var ResultType;
65
+ (function(ResultType2) {
66
+ ResultType2["data"] = "data";
67
+ ResultType2["deferred"] = "deferred";
68
+ ResultType2["redirect"] = "redirect";
69
+ ResultType2["error"] = "error";
70
+ })(ResultType || (ResultType = {}));
71
+ function matchPath(pattern, pathname) {
72
+ if (typeof pattern === "string") {
73
+ pattern = {
74
+ path: pattern,
75
+ caseSensitive: false,
76
+ end: true
77
+ };
78
+ }
79
+ let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);
80
+ let match = pathname.match(matcher);
81
+ if (!match) return null;
82
+ let matchedPathname = match[0];
83
+ let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
84
+ let captureGroups = match.slice(1);
85
+ let params = compiledParams.reduce((memo, _ref, index) => {
86
+ let {
87
+ paramName,
88
+ isOptional
89
+ } = _ref;
90
+ if (paramName === "*") {
91
+ let splatValue = captureGroups[index] || "";
92
+ pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
93
+ }
94
+ const value = captureGroups[index];
95
+ if (isOptional && !value) {
96
+ memo[paramName] = void 0;
97
+ } else {
98
+ memo[paramName] = (value || "").replace(/%2F/g, "/");
99
+ }
100
+ return memo;
101
+ }, {});
102
+ return {
103
+ params,
104
+ pathname: matchedPathname,
105
+ pathnameBase,
106
+ pattern
107
+ };
108
+ }
109
+ function compilePath(path, caseSensitive, end) {
110
+ if (caseSensitive === void 0) {
111
+ caseSensitive = false;
112
+ }
113
+ if (end === void 0) {
114
+ end = true;
115
+ }
116
+ warning(path === "*" || !path.endsWith("*") || path.endsWith("/*"), 'Route path "' + path + '" will be treated as if it were ' + ('"' + path.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + path.replace(/\*$/, "/*") + '".'));
117
+ let params = [];
118
+ let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (_, paramName, isOptional) => {
119
+ params.push({
120
+ paramName,
121
+ isOptional: isOptional != null
122
+ });
123
+ return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
124
+ });
125
+ if (path.endsWith("*")) {
126
+ params.push({
127
+ paramName: "*"
128
+ });
129
+ regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
130
+ } else if (end) {
131
+ regexpSource += "\\/*$";
132
+ } else if (path !== "" && path !== "/") {
133
+ regexpSource += "(?:(?=\\/|$))";
134
+ } else ;
135
+ let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
136
+ return [matcher, params];
137
+ }
138
+ function stripBasename(pathname, basename) {
139
+ if (basename === "/") return pathname;
140
+ if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
141
+ return null;
142
+ }
143
+ let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
144
+ let nextChar = pathname.charAt(startIndex);
145
+ if (nextChar && nextChar !== "/") {
146
+ return null;
147
+ }
148
+ return pathname.slice(startIndex) || "/";
149
+ }
150
+ const ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
151
+ const isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX$1.test(url);
152
+ function resolvePath(to, fromPathname) {
153
+ if (fromPathname === void 0) {
154
+ fromPathname = "/";
155
+ }
156
+ let {
157
+ pathname: toPathname,
158
+ search = "",
159
+ hash = ""
160
+ } = typeof to === "string" ? parsePath(to) : to;
161
+ let pathname;
162
+ if (toPathname) {
163
+ if (isAbsoluteUrl(toPathname)) {
164
+ pathname = toPathname;
165
+ } else {
166
+ if (toPathname.includes("//")) {
167
+ let oldPathname = toPathname;
168
+ toPathname = toPathname.replace(/\/\/+/g, "/");
169
+ warning(false, "Pathnames cannot have embedded double slashes - normalizing " + (oldPathname + " -> " + toPathname));
170
+ }
171
+ if (toPathname.startsWith("/")) {
172
+ pathname = resolvePathname(toPathname.substring(1), "/");
173
+ } else {
174
+ pathname = resolvePathname(toPathname, fromPathname);
175
+ }
176
+ }
177
+ } else {
178
+ pathname = fromPathname;
179
+ }
180
+ return {
181
+ pathname,
182
+ search: normalizeSearch(search),
183
+ hash: normalizeHash(hash)
184
+ };
185
+ }
186
+ function resolvePathname(relativePath, fromPathname) {
187
+ let segments = fromPathname.replace(/\/+$/, "").split("/");
188
+ let relativeSegments = relativePath.split("/");
189
+ relativeSegments.forEach((segment) => {
190
+ if (segment === "..") {
191
+ if (segments.length > 1) segments.pop();
192
+ } else if (segment !== ".") {
193
+ segments.push(segment);
194
+ }
195
+ });
196
+ return segments.length > 1 ? segments.join("/") : "/";
197
+ }
198
+ function getInvalidPathError(char, field, dest, path) {
199
+ return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
200
+ }
201
+ function getPathContributingMatches(matches) {
202
+ return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);
203
+ }
204
+ function getResolveToMatches(matches, v7_relativeSplatPath) {
205
+ let pathMatches = getPathContributingMatches(matches);
206
+ if (v7_relativeSplatPath) {
207
+ return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);
208
+ }
209
+ return pathMatches.map((match) => match.pathnameBase);
210
+ }
211
+ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {
212
+ if (isPathRelative === void 0) {
213
+ isPathRelative = false;
214
+ }
215
+ let to;
216
+ if (typeof toArg === "string") {
217
+ to = parsePath(toArg);
218
+ } else {
219
+ to = _extends({}, toArg);
220
+ invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to));
221
+ invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to));
222
+ invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to));
223
+ }
224
+ let isEmptyPath = toArg === "" || to.pathname === "";
225
+ let toPathname = isEmptyPath ? "/" : to.pathname;
226
+ let from;
227
+ if (toPathname == null) {
228
+ from = locationPathname;
229
+ } else {
230
+ let routePathnameIndex = routePathnames.length - 1;
231
+ if (!isPathRelative && toPathname.startsWith("..")) {
232
+ let toSegments = toPathname.split("/");
233
+ while (toSegments[0] === "..") {
234
+ toSegments.shift();
235
+ routePathnameIndex -= 1;
236
+ }
237
+ to.pathname = toSegments.join("/");
238
+ }
239
+ from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
240
+ }
241
+ let path = resolvePath(to, from);
242
+ let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
243
+ let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
244
+ if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
245
+ path.pathname += "/";
246
+ }
247
+ return path;
248
+ }
249
+ const joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
250
+ const normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
251
+ const normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
252
+ class AbortedDeferredError extends Error {
253
+ }
254
+ const validMutationMethodsArr = ["post", "put", "patch", "delete"];
255
+ new Set(validMutationMethodsArr);
256
+ const validRequestMethodsArr = ["get", ...validMutationMethodsArr];
257
+ new Set(validRequestMethodsArr);
258
+ export {
259
+ AbortedDeferredError,
260
+ Action,
261
+ getResolveToMatches as UNSAFE_getResolveToMatches,
262
+ invariant as UNSAFE_invariant,
263
+ warning as UNSAFE_warning,
264
+ createPath,
265
+ joinPaths,
266
+ matchPath,
267
+ parsePath,
268
+ resolvePath,
269
+ resolveTo,
270
+ stripBasename
271
+ };
272
+ //# sourceMappingURL=router.js.map