@drfed/web 0.0.0-stage → 0.1.0-dev.561

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 (126) hide show
  1. package/.output/nitro.json +17 -0
  2. package/.output/public/.vite/manifest.json +483 -0
  3. package/.output/public/_build/assets/ActorDetailQuery.graphql-D96mwq1k.js +60 -0
  4. package/.output/public/_build/assets/ActorDetailQuery.graphql-DrxSNh1X.js +60 -0
  5. package/.output/public/_build/assets/CompleteLoginChallenge.graphql-C5Zq3wNh.js +10 -0
  6. package/.output/public/_build/assets/CopyButton-B2l484wE.js +1 -0
  7. package/.output/public/_build/assets/CopyButton-Bi-ZR8x9.css +1 -0
  8. package/.output/public/_build/assets/CreateInstanceMutation.graphql-B4CRy6cl.js +19 -0
  9. package/.output/public/_build/assets/CreateObjectMutation.graphql-B4A01dgV.js +23 -0
  10. package/.output/public/_build/assets/GenerateActorsMutation.graphql-mlHJNIbe.js +23 -0
  11. package/.output/public/_build/assets/GetHostQuery.graphql-CuzDdOdW.js +17 -0
  12. package/.output/public/_build/assets/GetHostQuery.graphql-o9K0Qkg0.js +17 -0
  13. package/.output/public/_build/assets/HomeViewerQuery.graphql-B903WWKs.js +8 -0
  14. package/.output/public/_build/assets/HttpStatusCode-bgaVzuLy.js +1 -0
  15. package/.output/public/_build/assets/InstanceActorListQuery.graphql-DmNwiEhM.js +24 -0
  16. package/.output/public/_build/assets/InstanceActorListQuery.graphql-paa7teUO.js +24 -0
  17. package/.output/public/_build/assets/InstanceDetailQuery.graphql-B52nR132.js +66 -0
  18. package/.output/public/_build/assets/InstanceDetailQuery.graphql-DSA2BcAV.js +66 -0
  19. package/.output/public/_build/assets/JNCCF6MP-CNMywyiC.js +1 -0
  20. package/.output/public/_build/assets/LP6E37CW-Cwv6G3n1.js +1 -0
  21. package/.output/public/_build/assets/SignInMutation.graphql-BalZYNFu.js +9 -0
  22. package/.output/public/_build/assets/TSB6MOZK-CpiH97G1.js +1 -0
  23. package/.output/public/_build/assets/Toast-3-eXCAKc.css +1 -0
  24. package/.output/public/_build/assets/Toast-C1zr9crB.js +1 -0
  25. package/.output/public/_build/assets/WorkspaceQuery.graphql-UoI7QDs4.js +23 -0
  26. package/.output/public/_build/assets/_...404_-WZ8kAljY.js +1 -0
  27. package/.output/public/_build/assets/_challengeId_-Dk-0l7zl.js +1 -0
  28. package/.output/public/_build/assets/_id_-YcZZShAv.css +1 -0
  29. package/.output/public/_build/assets/_id_-bpxdclBj.js +1 -0
  30. package/.output/public/_build/assets/_slug_-CyTA2aW7.css +1 -0
  31. package/.output/public/_build/assets/_slug_-DXfRknzJ.js +200 -0
  32. package/.output/public/_build/assets/about-DIrbzRsi.js +1 -0
  33. package/.output/public/_build/assets/actors-HfZh_afh.js +24 -0
  34. package/.output/public/_build/assets/client-CGFoRcqH.js +3 -0
  35. package/.output/public/_build/assets/components-5MVu7IcD.js +1 -0
  36. package/.output/public/_build/assets/dist-BrJ_B8nU.js +1 -0
  37. package/.output/public/_build/assets/dist-DVo0HS5G.js +1 -0
  38. package/.output/public/_build/assets/dist-WrlGlK67.js +1 -0
  39. package/.output/public/_build/assets/entry-client-BurSTYr9.css +1 -0
  40. package/.output/public/_build/assets/entry-client-Do7ocrsL.js +8 -0
  41. package/.output/public/_build/assets/form-BxigYd7J.css +1 -0
  42. package/.output/public/_build/assets/form.module-BecmEfV_.js +1 -0
  43. package/.output/public/_build/assets/index-BHn6sAgH.js +23 -0
  44. package/.output/public/_build/assets/index-BSLqnqN7.js +8 -0
  45. package/.output/public/_build/assets/index-B_xLBDOo.css +1 -0
  46. package/.output/public/_build/assets/instance-tpMrvJNZ.js +35 -0
  47. package/.output/public/_build/assets/label-Mv8GZ4jc.js +1 -0
  48. package/.output/public/_build/assets/objects-DPb8DI8A.css +1 -0
  49. package/.output/public/_build/assets/objects-DR9TfL-V.js +25 -0
  50. package/.output/public/_build/assets/relay-runtime-BX3uubtA.js +7 -0
  51. package/.output/public/_build/assets/routing-DMN2NHu6.js +1 -0
  52. package/.output/public/_build/assets/sign-in-B67sv7z8.js +10 -0
  53. package/.output/public/_build/assets/web-DB_Nkq2D.js +1 -0
  54. package/.output/public/apple-touch-icon.png +0 -0
  55. package/.output/public/favicon.ico +0 -0
  56. package/.output/public/icon-192.png +0 -0
  57. package/.output/public/icon-512.png +0 -0
  58. package/.output/public/icon-mask.png +0 -0
  59. package/.output/public/icon.svg +395 -0
  60. package/.output/public/manifest.webmanifest +13 -0
  61. package/.output/server/_...404_-DDEH5apf.mjs +16 -0
  62. package/.output/server/_challengeId_-C_n_Bww9.mjs +100 -0
  63. package/.output/server/_chunks/ssr-renderer.mjs +26 -0
  64. package/.output/server/_id_-DqytvZEf.mjs +505 -0
  65. package/.output/server/_libs/@shikijs/core+[...].mjs +7173 -0
  66. package/.output/server/_libs/@shikijs/engine-javascript+[...].mjs +3110 -0
  67. package/.output/server/_libs/babel__runtime.mjs +243 -0
  68. package/.output/server/_libs/dequal.mjs +25 -0
  69. package/.output/server/_libs/faker-js__faker.mjs +13150 -0
  70. package/.output/server/_libs/fbjs.mjs +115 -0
  71. package/.output/server/_libs/h3+rou3+srvx.mjs +650 -0
  72. package/.output/server/_libs/hookable.mjs +41 -0
  73. package/.output/server/_libs/invariant.mjs +36 -0
  74. package/.output/server/_libs/relay-runtime.mjs +9704 -0
  75. package/.output/server/_libs/seroval-plugins.mjs +563 -0
  76. package/.output/server/_libs/seroval.mjs +2956 -0
  77. package/.output/server/_libs/shikijs__langs.mjs +3 -0
  78. package/.output/server/_libs/shikijs__themes.mjs +7 -0
  79. package/.output/server/_libs/solid-js.mjs +1248 -0
  80. package/.output/server/_libs/solid-relay+tiny-invariant.mjs +1029 -0
  81. package/.output/server/_libs/ufo.mjs +64 -0
  82. package/.output/server/_libs/valibot.mjs +711 -0
  83. package/.output/server/_runtime.mjs +33 -0
  84. package/.output/server/_slug_-CBOaSqoF.mjs +978 -0
  85. package/.output/server/_ssr/ActorDetailQuery.graphql-C1mWRP1B.mjs +283 -0
  86. package/.output/server/_ssr/CompleteLoginChallenge.graphql-CM7o_Md1.mjs +78 -0
  87. package/.output/server/_ssr/CopyButton-CQNR5D1y.mjs +43 -0
  88. package/.output/server/_ssr/CreateInstanceMutation.graphql-C-h2lGxz.mjs +116 -0
  89. package/.output/server/_ssr/CreateObjectMutation.graphql-C393Hp7q.mjs +166 -0
  90. package/.output/server/_ssr/GenerateActorsMutation.graphql-D2ADtn1j.mjs +163 -0
  91. package/.output/server/_ssr/GetHostQuery.graphql-C45XQo1i.mjs +127 -0
  92. package/.output/server/_ssr/HomeViewerQuery.graphql-Dote4Pkz.mjs +81 -0
  93. package/.output/server/_ssr/InstanceActorListQuery.graphql-DgItgN5t.mjs +167 -0
  94. package/.output/server/_ssr/InstanceDetailQuery.graphql-DP5wWWjX.mjs +367 -0
  95. package/.output/server/_ssr/JNCCF6MP-BAZlBnvx.mjs +419 -0
  96. package/.output/server/_ssr/LP6E37CW-D2Ih_b_K.mjs +163 -0
  97. package/.output/server/_ssr/SignInMutation.graphql-BBXmiay6.mjs +72 -0
  98. package/.output/server/_ssr/TSB6MOZK-D06WZb6o.mjs +166 -0
  99. package/.output/server/_ssr/Toast-Bb1gcxED.mjs +947 -0
  100. package/.output/server/_ssr/WorkspaceQuery.graphql-DnCO8t-4.mjs +153 -0
  101. package/.output/server/_ssr/about-CD3QIgf_.mjs +14 -0
  102. package/.output/server/_ssr/actors-CMWf-xQU.mjs +1160 -0
  103. package/.output/server/_ssr/dist-D6rgyh-L.mjs +81 -0
  104. package/.output/server/_ssr/dist-I7KRMRbA.mjs +432 -0
  105. package/.output/server/_ssr/form.module-CTvIl1lm.mjs +192 -0
  106. package/.output/server/_ssr/index-C4crD6q-.mjs +347 -0
  107. package/.output/server/_ssr/index-yuhuc6-X.mjs +111 -0
  108. package/.output/server/_ssr/instance-ZYWGeWd3.mjs +280 -0
  109. package/.output/server/_ssr/label-DAXzanI9.mjs +9 -0
  110. package/.output/server/_ssr/objects-D5MVukzB.mjs +4316 -0
  111. package/.output/server/_ssr/routing-DKTLkkbY.mjs +620 -0
  112. package/.output/server/_ssr/sign-in-CNHZb_zL.mjs +264 -0
  113. package/.output/server/_ssr/ssr.mjs +6121 -0
  114. package/.output/server/index.mjs +684 -0
  115. package/LICENSE +661 -0
  116. package/README.md +143 -2
  117. package/dist/bridge.d.mts +39 -0
  118. package/dist/bridge.mjs +104 -0
  119. package/dist/bridge.mjs.map +1 -0
  120. package/dist/request-policy.d.mts +8 -0
  121. package/dist/request-policy.mjs +94 -0
  122. package/dist/request-policy.mjs.map +1 -0
  123. package/dist/runtime.d.mts +14 -0
  124. package/dist/runtime.mjs +44 -0
  125. package/dist/runtime.mjs.map +1 -0
  126. package/package.json +123 -3
@@ -0,0 +1,620 @@
1
+ import { A as batch, F as createContext, L as createMemo, N as createComponent, R as createRenderEffect, V as createSignal, W as getOwner, X as resetErrorBoundaries, Z as runWithOwner, d as getRequestEvent, et as startTransition, nt as useContext, q as on, tt as untrack } from "../_libs/solid-js.mjs";
2
+ //#region node_modules/.nitro/vite/services/ssr/_build/assets/routing-DKTLkkbY.js
3
+ function createBeforeLeave() {
4
+ let listeners = /* @__PURE__ */ new Set();
5
+ function subscribe(listener) {
6
+ listeners.add(listener);
7
+ return () => listeners.delete(listener);
8
+ }
9
+ let ignore = false;
10
+ function confirm(to, options) {
11
+ if (ignore) return !(ignore = false);
12
+ const e = {
13
+ to,
14
+ options,
15
+ defaultPrevented: false,
16
+ preventDefault: () => e.defaultPrevented = true
17
+ };
18
+ for (const l of listeners) l.listener({
19
+ to,
20
+ options,
21
+ get defaultPrevented() {
22
+ return e.defaultPrevented;
23
+ },
24
+ preventDefault: e.preventDefault,
25
+ from: l.location,
26
+ retry: (force) => {
27
+ force && (ignore = true);
28
+ l.navigate(to, {
29
+ ...options,
30
+ resolve: false
31
+ });
32
+ }
33
+ });
34
+ return !e.defaultPrevented;
35
+ }
36
+ return {
37
+ subscribe,
38
+ confirm
39
+ };
40
+ }
41
+ var depth;
42
+ function saveCurrentDepth() {
43
+ if (!window.history.state || window.history.state._depth == null) window.history.replaceState({
44
+ ...window.history.state,
45
+ _depth: window.history.length - 1
46
+ }, "");
47
+ depth = window.history.state._depth;
48
+ }
49
+ function keepDepth(state) {
50
+ return {
51
+ ...state,
52
+ _depth: window.history.state && window.history.state._depth
53
+ };
54
+ }
55
+ function notifyIfNotBlocked(notify, block) {
56
+ let ignore = false;
57
+ return () => {
58
+ const prevDepth = depth;
59
+ saveCurrentDepth();
60
+ const delta = prevDepth == null ? null : depth - prevDepth;
61
+ if (ignore) {
62
+ ignore = false;
63
+ return;
64
+ }
65
+ if (delta && block(delta)) {
66
+ ignore = true;
67
+ window.history.go(-delta);
68
+ } else notify();
69
+ };
70
+ }
71
+ var hasSchemeRegex = /^(?:[a-z0-9]+:)?\/\//i;
72
+ var trimPathRegex = /^\/+|(\/)\/+$/g;
73
+ var mockBase = "http://sr";
74
+ function normalizePath(path, omitSlash = false) {
75
+ const s = path.replace(trimPathRegex, "$1");
76
+ return s ? omitSlash || /^[?#]/.test(s) ? s : "/" + s : "";
77
+ }
78
+ function resolvePath(base, path, from) {
79
+ if (hasSchemeRegex.test(path)) return;
80
+ const basePath = normalizePath(base);
81
+ const fromPath = from && normalizePath(from);
82
+ let result = "";
83
+ if (!fromPath || path.startsWith("/")) result = basePath;
84
+ else if (fromPath.toLowerCase().indexOf(basePath.toLowerCase()) !== 0) result = basePath + fromPath;
85
+ else result = fromPath;
86
+ return (result || "/") + normalizePath(path, !result);
87
+ }
88
+ function invariant(value, message) {
89
+ if (value == null) throw new Error(message);
90
+ return value;
91
+ }
92
+ function joinPaths(from, to) {
93
+ return normalizePath(from).replace(/\/*(\*.*)?$/g, "") + normalizePath(to);
94
+ }
95
+ function extractSearchParams(url) {
96
+ const params = {};
97
+ url.searchParams.forEach((value, key) => {
98
+ if (key in params) if (Array.isArray(params[key])) params[key].push(value);
99
+ else params[key] = [params[key], value];
100
+ else params[key] = value;
101
+ });
102
+ return params;
103
+ }
104
+ function createMatcher(path, partial, matchFilters) {
105
+ const [pattern, splat] = path.split("/*", 2);
106
+ const segments = pattern.split("/").filter(Boolean);
107
+ const len = segments.length;
108
+ return (location) => {
109
+ const locSegments = location.split("/");
110
+ if (locSegments[0] === "") locSegments.shift();
111
+ if (locSegments.length && locSegments[locSegments.length - 1] === "") locSegments.pop();
112
+ if (locSegments.includes("")) return null;
113
+ const lenDiff = locSegments.length - len;
114
+ if (lenDiff < 0 || lenDiff > 0 && splat === void 0 && !partial) return null;
115
+ const match = {
116
+ path: len ? "" : "/",
117
+ params: {}
118
+ };
119
+ const matchFilter = (s) => matchFilters === void 0 ? void 0 : matchFilters[s];
120
+ for (let i = 0; i < len; i++) {
121
+ const segment = segments[i];
122
+ const dynamic = segment[0] === ":";
123
+ const locSegment = dynamic ? locSegments[i] : locSegments[i].toLowerCase();
124
+ const key = dynamic ? segment.slice(1) : segment.toLowerCase();
125
+ if (dynamic && matchSegment(locSegment, matchFilter(key))) match.params[key] = locSegment;
126
+ else if (dynamic || !matchSegment(locSegment, key)) return null;
127
+ match.path += `/${locSegment}`;
128
+ }
129
+ if (splat) {
130
+ const remainder = lenDiff ? locSegments.slice(-lenDiff).join("/") : "";
131
+ if (matchSegment(remainder, matchFilter(splat))) match.params[splat] = remainder;
132
+ else return null;
133
+ }
134
+ return match;
135
+ };
136
+ }
137
+ function matchSegment(input, filter) {
138
+ const isEqual = (s) => s === input;
139
+ if (filter === void 0) return true;
140
+ else if (typeof filter === "string") return isEqual(filter);
141
+ else if (typeof filter === "function") return filter(input);
142
+ else if (Array.isArray(filter)) return filter.some(isEqual);
143
+ else if (filter instanceof RegExp) return filter.test(input);
144
+ return false;
145
+ }
146
+ function scoreRoute(route) {
147
+ const [pattern, splat] = route.pattern.split("/*", 2);
148
+ const segments = pattern.split("/").filter(Boolean);
149
+ return segments.reduce((score, segment) => score + (segment.startsWith(":") ? 2 : 3), segments.length - (splat === void 0 ? 0 : 1));
150
+ }
151
+ function createMemoObject(fn) {
152
+ const map = /* @__PURE__ */ new Map();
153
+ const owner = getOwner();
154
+ return new Proxy({}, {
155
+ get(_, property) {
156
+ if (!map.has(property)) runWithOwner(owner, () => map.set(property, createMemo(() => fn()[property])));
157
+ return map.get(property)();
158
+ },
159
+ getOwnPropertyDescriptor() {
160
+ return {
161
+ enumerable: true,
162
+ configurable: true
163
+ };
164
+ },
165
+ ownKeys() {
166
+ return Reflect.ownKeys(fn());
167
+ },
168
+ has(_, property) {
169
+ return property in fn();
170
+ }
171
+ });
172
+ }
173
+ function mergeSearchString(search, params) {
174
+ const merged = new URLSearchParams(search);
175
+ Object.entries(params).forEach(([key, value]) => {
176
+ if (value == null || value === "" || value instanceof Array && !value.length) merged.delete(key);
177
+ else if (value instanceof Array) {
178
+ merged.delete(key);
179
+ value.forEach((v) => {
180
+ merged.append(key, String(v));
181
+ });
182
+ } else merged.set(key, String(value));
183
+ });
184
+ const s = merged.toString();
185
+ return s ? `?${s}` : "";
186
+ }
187
+ function expandOptionals(pattern) {
188
+ let match = /(\/?\:[^\/]+)\?/.exec(pattern);
189
+ if (!match) return [pattern];
190
+ let prefix = pattern.slice(0, match.index);
191
+ let suffix = pattern.slice(match.index + match[0].length);
192
+ const prefixes = [prefix, prefix += match[1]];
193
+ while (match = /^(\/\:[^\/]+)\?/.exec(suffix)) {
194
+ prefixes.push(prefix += match[1]);
195
+ suffix = suffix.slice(match[0].length);
196
+ }
197
+ return expandOptionals(suffix).reduce((results, expansion) => [...results, ...prefixes.map((p) => p + expansion)], []);
198
+ }
199
+ function setFunctionName(obj, value) {
200
+ Object.defineProperty(obj, "name", {
201
+ value,
202
+ writable: false,
203
+ configurable: false
204
+ });
205
+ return obj;
206
+ }
207
+ var MAX_REDIRECTS = 100;
208
+ /** Consider this API opaque and internal. It is likely to change in the future. */
209
+ var RouterContextObj = createContext();
210
+ var RouteContextObj = createContext();
211
+ var useRouter = () => invariant(useContext(RouterContextObj), "<A> and 'use' router primitives can be only used inside a Route.");
212
+ var useRoute = () => useContext(RouteContextObj) || useRouter().base;
213
+ var useResolvedPath = (path) => {
214
+ const route = useRoute();
215
+ return createMemo(() => route.resolvePath(path()));
216
+ };
217
+ var useHref = (to) => {
218
+ const router = useRouter();
219
+ return createMemo(() => {
220
+ const to_ = to();
221
+ return to_ !== void 0 ? router.renderPath(to_) : to_;
222
+ });
223
+ };
224
+ /**
225
+ * Retrieves method to do navigation. The method accepts a path to navigate to and an optional object with the following options:
226
+ *
227
+ * - resolve (*boolean*, default `true`): resolve the path against the current route
228
+ * - replace (*boolean*, default `false`): replace the history entry
229
+ * - scroll (*boolean*, default `true`): scroll to top after navigation
230
+ * - state (*any*, default `undefined`): pass custom state to `location.state`
231
+ *
232
+ * **Note**: The state is serialized using the structured clone algorithm which does not support all object types.
233
+ *
234
+ * @example
235
+ * ```js
236
+ * const navigate = useNavigate();
237
+ *
238
+ * if (unauthorized) {
239
+ * navigate("/login", { replace: true });
240
+ * }
241
+ * ```
242
+ */
243
+ var useNavigate = () => useRouter().navigatorFactory();
244
+ /**
245
+ * Retrieves reactive `location` object useful for getting things like `pathname`.
246
+ *
247
+ * @example
248
+ * ```js
249
+ * const location = useLocation();
250
+ *
251
+ * const pathname = createMemo(() => parsePath(location.pathname));
252
+ * ```
253
+ */
254
+ var useLocation = () => useRouter().location;
255
+ /**
256
+ * Retrieves a reactive, store-like object containing the current route path parameters as defined in the Route.
257
+ *
258
+ * @example
259
+ * ```js
260
+ * const params = useParams();
261
+ *
262
+ * // fetch user based on the id path parameter
263
+ * const [user] = createResource(() => params.id, fetchUser);
264
+ * ```
265
+ */
266
+ var useParams = () => useRouter().params;
267
+ /**
268
+ * Retrieves a tuple containing a reactive object to read the current location's query parameters and a method to update them.
269
+ * The object is a proxy so you must access properties to subscribe to reactive updates.
270
+ * **Note** that values will be strings and property names will retain their casing.
271
+ *
272
+ * The setter method accepts an object whose entries will be merged into the current query string.
273
+ * Values `''`, `undefined` and `null` will remove the key from the resulting query string.
274
+ * Updates will behave just like a navigation and the setter accepts the same optional second parameter as `navigate` and auto-scrolling is disabled by default.
275
+ *
276
+ * @examples
277
+ * ```js
278
+ * const [searchParams, setSearchParams] = useSearchParams();
279
+ *
280
+ * return (
281
+ * <div>
282
+ * <span>Page: {searchParams.page}</span>
283
+ * <button
284
+ * onClick={() =>
285
+ * setSearchParams({ page: (parseInt(searchParams.page) || 0) + 1 })
286
+ * }
287
+ * >
288
+ * Next Page
289
+ * </button>
290
+ * </div>
291
+ * );
292
+ * ```
293
+ */
294
+ var useSearchParams = () => {
295
+ const router = useRouter();
296
+ const location = router.location;
297
+ const navigate = useNavigate();
298
+ const setSearchParams = (params, options) => {
299
+ const to = untrack(() => {
300
+ const pending = router.pendingTarget && new URL(router.pendingTarget.value, "http://sr");
301
+ const pathname = pending ? pending.pathname : location.pathname;
302
+ const search = pending ? pending.search : location.search;
303
+ const hash = pending ? pending.hash : location.hash;
304
+ return pathname + mergeSearchString(search, params) + hash;
305
+ });
306
+ navigate(to, {
307
+ scroll: false,
308
+ resolve: false,
309
+ ...options
310
+ });
311
+ };
312
+ return [location.query, setSearchParams];
313
+ };
314
+ var encodeSegment = (s) => encodeURIComponent(s).replace(/%(2B|40|3A|24|26|2C|3B|3D)/g, (m) => decodeURIComponent(m));
315
+ function createRoutes(routeDef, base = "") {
316
+ const { component, preload, load, children, info } = routeDef;
317
+ const isLeaf = !children || Array.isArray(children) && !children.length;
318
+ const shared = {
319
+ key: routeDef,
320
+ component,
321
+ preload: preload || load,
322
+ info
323
+ };
324
+ return asArray(routeDef.path).reduce((acc, originalPath) => {
325
+ for (const expandedPath of expandOptionals(originalPath)) {
326
+ const path = joinPaths(base, expandedPath);
327
+ let pattern = isLeaf ? path : path.split("/*", 1)[0];
328
+ pattern = pattern.split("/").map((s) => {
329
+ return s.startsWith(":") || s.startsWith("*") ? s : encodeSegment(s);
330
+ }).join("/");
331
+ acc.push({
332
+ ...shared,
333
+ originalPath,
334
+ pattern,
335
+ matcher: createMatcher(pattern, !isLeaf, routeDef.matchFilters)
336
+ });
337
+ }
338
+ return acc;
339
+ }, []);
340
+ }
341
+ function createBranch(routes, index = 0) {
342
+ return {
343
+ routes,
344
+ score: scoreRoute(routes[routes.length - 1]) * 1e4 - index,
345
+ matcher(location) {
346
+ const matches = [];
347
+ for (let i = routes.length - 1; i >= 0; i--) {
348
+ const route = routes[i];
349
+ const match = route.matcher(location);
350
+ if (!match) return null;
351
+ matches.unshift({
352
+ ...match,
353
+ route
354
+ });
355
+ }
356
+ return matches;
357
+ }
358
+ };
359
+ }
360
+ function asArray(value) {
361
+ return Array.isArray(value) ? value : [value];
362
+ }
363
+ function createBranches(routeDef, base = "", stack = [], branches = []) {
364
+ const routeDefs = asArray(routeDef);
365
+ for (let i = 0, len = routeDefs.length; i < len; i++) {
366
+ const def = routeDefs[i];
367
+ if (def && typeof def === "object") {
368
+ if (!def.hasOwnProperty("path")) def.path = "";
369
+ const routes = createRoutes(def, base);
370
+ for (const route of routes) {
371
+ stack.push(route);
372
+ const isEmptyArray = Array.isArray(def.children) && def.children.length === 0;
373
+ if (def.children && !isEmptyArray) createBranches(def.children, route.pattern, stack, branches);
374
+ else {
375
+ const branch = createBranch([...stack], branches.length);
376
+ branches.push(branch);
377
+ }
378
+ stack.pop();
379
+ }
380
+ }
381
+ }
382
+ return stack.length ? branches : branches.sort((a, b) => b.score - a.score);
383
+ }
384
+ function getRouteMatches(branches, location) {
385
+ for (let i = 0, len = branches.length; i < len; i++) {
386
+ const match = branches[i].matcher(location);
387
+ if (match) return match;
388
+ }
389
+ return [];
390
+ }
391
+ function createLocation(path, state, queryWrapper) {
392
+ const origin = new URL(mockBase);
393
+ const url = createMemo((prev) => {
394
+ const path_ = path();
395
+ try {
396
+ return new URL(path_[0] === "/" ? mockBase + path_ : path_, origin);
397
+ } catch (err) {
398
+ console.error(`Invalid path ${path_}`);
399
+ return prev;
400
+ }
401
+ }, origin, { equals: (a, b) => a.href === b.href });
402
+ const pathname = createMemo(() => url().pathname);
403
+ const search = createMemo(() => url().search, true);
404
+ const hash = createMemo(() => url().hash);
405
+ const key = () => "";
406
+ const queryFn = on(search, () => extractSearchParams(url()));
407
+ return {
408
+ get pathname() {
409
+ return pathname();
410
+ },
411
+ get search() {
412
+ return search();
413
+ },
414
+ get hash() {
415
+ return hash();
416
+ },
417
+ get state() {
418
+ return state();
419
+ },
420
+ get key() {
421
+ return key();
422
+ },
423
+ query: queryWrapper ? queryWrapper(queryFn) : createMemoObject(queryFn)
424
+ };
425
+ }
426
+ var intent;
427
+ function getIntent() {
428
+ return intent;
429
+ }
430
+ var inPreloadFn = false;
431
+ function getInPreloadFn() {
432
+ return inPreloadFn;
433
+ }
434
+ function setInPreloadFn(value) {
435
+ inPreloadFn = value;
436
+ }
437
+ function createRouterContext(integration, branches, getContext, options = {}) {
438
+ const { signal: [source, setSource], utils = {} } = integration;
439
+ const parsePath = utils.parsePath || ((p) => p);
440
+ const renderPath = utils.renderPath || ((p) => p);
441
+ const beforeLeave = utils.beforeLeave || createBeforeLeave();
442
+ const basePath = resolvePath("", options.base || "");
443
+ if (basePath === void 0) throw new Error(`${basePath} is not a valid base path`);
444
+ else if (basePath && !source().value) setSource({
445
+ value: basePath,
446
+ replace: true,
447
+ scroll: false
448
+ });
449
+ const [isRouting, setIsRouting] = createSignal(false);
450
+ let lastTransitionTarget;
451
+ const transition = (newIntent, newTarget) => {
452
+ if (newTarget.value === reference() && newTarget.state === state()) return;
453
+ if (lastTransitionTarget === void 0) setIsRouting(true);
454
+ intent = newIntent;
455
+ lastTransitionTarget = newTarget;
456
+ startTransition(() => {
457
+ if (lastTransitionTarget !== newTarget) return;
458
+ setReference(lastTransitionTarget.value);
459
+ setState(lastTransitionTarget.state);
460
+ resetErrorBoundaries();
461
+ }).finally(() => {
462
+ if (lastTransitionTarget !== newTarget) return;
463
+ batch(() => {
464
+ intent = void 0;
465
+ if (newIntent === "navigate") navigateEnd(lastTransitionTarget);
466
+ setIsRouting(false);
467
+ lastTransitionTarget = void 0;
468
+ });
469
+ });
470
+ };
471
+ const [reference, setReference] = createSignal(source().value);
472
+ const [state, setState] = createSignal(source().state);
473
+ const location = createLocation(reference, state, utils.queryWrapper);
474
+ const referrers = [];
475
+ const submissions = createSignal(initFromFlash());
476
+ const matches = createMemo(() => {
477
+ if (typeof options.transformUrl === "function") return getRouteMatches(branches(), options.transformUrl(location.pathname));
478
+ return getRouteMatches(branches(), location.pathname);
479
+ });
480
+ const buildParams = () => {
481
+ const m = matches();
482
+ const params = {};
483
+ for (let i = 0; i < m.length; i++) Object.assign(params, m[i].params);
484
+ return params;
485
+ };
486
+ const params = utils.paramsWrapper ? utils.paramsWrapper(buildParams, branches) : createMemoObject(buildParams);
487
+ const baseRoute = {
488
+ pattern: basePath,
489
+ path: () => basePath,
490
+ outlet: () => null,
491
+ resolvePath(to) {
492
+ return resolvePath(basePath, to);
493
+ }
494
+ };
495
+ createRenderEffect(on(source, (source) => transition("native", source), { defer: true }));
496
+ return {
497
+ base: baseRoute,
498
+ location,
499
+ params,
500
+ isRouting,
501
+ get pendingTarget() {
502
+ return lastTransitionTarget;
503
+ },
504
+ renderPath,
505
+ parsePath,
506
+ navigatorFactory,
507
+ matches,
508
+ beforeLeave,
509
+ preloadRoute,
510
+ singleFlight: options.singleFlight === void 0 ? true : options.singleFlight,
511
+ submissions
512
+ };
513
+ function navigateFromRoute(route, to, options) {
514
+ untrack(() => {
515
+ if (typeof to === "number") {
516
+ if (!to) {} else if (utils.go) utils.go(to);
517
+ else console.warn("Router integration does not support relative routing");
518
+ return;
519
+ }
520
+ const queryOnly = !to || to[0] === "?";
521
+ const { replace, resolve, scroll, state: nextState } = {
522
+ replace: false,
523
+ resolve: !queryOnly,
524
+ scroll: true,
525
+ ...options
526
+ };
527
+ const resolvedTo = resolve ? route.resolvePath(to) : resolvePath(queryOnly && location.pathname || "", to);
528
+ if (resolvedTo === void 0) throw new Error(`Path '${to}' is not a routable path`);
529
+ else if (referrers.length >= MAX_REDIRECTS) throw new Error("Too many redirects");
530
+ if (resolvedTo !== reference() || nextState !== state()) {
531
+ const e = getRequestEvent();
532
+ e && (e.response = {
533
+ status: 302,
534
+ headers: new Headers({ Location: resolvedTo })
535
+ });
536
+ setSource({
537
+ value: resolvedTo,
538
+ replace,
539
+ scroll,
540
+ state: nextState
541
+ });
542
+ }
543
+ });
544
+ }
545
+ function navigatorFactory(route) {
546
+ route = route || useContext(RouteContextObj) || baseRoute;
547
+ return (to, options) => navigateFromRoute(route, to, options);
548
+ }
549
+ function navigateEnd(next) {
550
+ const first = referrers[0];
551
+ if (first) {
552
+ setSource({
553
+ ...next,
554
+ replace: first.replace,
555
+ scroll: first.scroll
556
+ });
557
+ referrers.length = 0;
558
+ }
559
+ }
560
+ function preloadRoute(url, preloadData) {
561
+ const matches = getRouteMatches(branches(), url.pathname);
562
+ const prevIntent = intent;
563
+ intent = "preload";
564
+ for (let match in matches) {
565
+ const { route, params } = matches[match];
566
+ route.component && route.component.preload && route.component.preload();
567
+ const { preload } = route;
568
+ inPreloadFn = true;
569
+ preloadData && preload && runWithOwner(getContext(), () => preload({
570
+ params,
571
+ location: {
572
+ pathname: url.pathname,
573
+ search: url.search,
574
+ hash: url.hash,
575
+ query: extractSearchParams(url),
576
+ state: null,
577
+ key: ""
578
+ },
579
+ intent: "preload"
580
+ }));
581
+ inPreloadFn = false;
582
+ }
583
+ intent = prevIntent;
584
+ }
585
+ function initFromFlash() {
586
+ const e = getRequestEvent();
587
+ return e && e.router && e.router.submission ? [e.router.submission] : [];
588
+ }
589
+ }
590
+ function createRouteContext(router, parent, outlet, match) {
591
+ const { base, location, params } = router;
592
+ const { pattern, component, preload } = match().route;
593
+ const path = createMemo(() => match().path);
594
+ component && component.preload && component.preload();
595
+ inPreloadFn = true;
596
+ const data = preload ? preload({
597
+ params,
598
+ location,
599
+ intent: intent || "initial"
600
+ }) : void 0;
601
+ inPreloadFn = false;
602
+ return {
603
+ parent,
604
+ pattern,
605
+ path,
606
+ outlet: () => component ? createComponent(component, {
607
+ params,
608
+ location,
609
+ data,
610
+ get children() {
611
+ return outlet();
612
+ }
613
+ }) : outlet(),
614
+ resolvePath(to) {
615
+ return resolvePath(base.path(), to, path());
616
+ }
617
+ };
618
+ }
619
+ //#endregion
620
+ export { useSearchParams as C, useRouter as S, useHref as _, createRouteContext as a, useParams as b, getIntent as c, mockBase as d, normalizePath as f, setInPreloadFn as g, setFunctionName as h, createBranches as i, getRouteMatches as l, saveCurrentDepth as m, RouterContextObj as n, createRouterContext as o, notifyIfNotBlocked as p, createBeforeLeave as r, getInPreloadFn as s, RouteContextObj as t, keepDepth as u, useLocation as v, useResolvedPath as x, useNavigate as y };