Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

208 lines
7.3 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: 5d5b47876e53e564.da1ba52a93.js
* Module id: 126379
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e, t, r) => {
"use strict";
Object.defineProperty(r, "__esModule", { value: !0 });
var n = {
getSortedRouteObjects: function () {
return l;
},
getSortedRoutes: function () {
return i;
},
};
for (var o in n) Object.defineProperty(r, o, { enumerable: !0, get: n[o] });
class a {
insert(e) {
this._insert(e.split("/").filter(Boolean), [], !1);
}
smoosh() {
return this._smoosh();
}
_smoosh(e = "/") {
let t = [...this.children.keys()].sort();
null !== this.slugName && t.splice(t.indexOf("[]"), 1),
null !== this.restSlugName && t.splice(t.indexOf("[...]"), 1),
null !== this.optionalRestSlugName &&
t.splice(t.indexOf("[[...]]"), 1);
let r = t
.map((t) => this.children.get(t)._smoosh(`${e}${t}/`))
.reduce((e, t) => [...e, ...t], []);
if (
(null !== this.slugName &&
r.push(
...this.children.get("[]")._smoosh(`${e}[${this.slugName}]/`),
),
!this.placeholder)
) {
let t = "/" === e ? "/" : e.slice(0, -1);
if (null != this.optionalRestSlugName)
throw Object.defineProperty(
Error(
`You cannot define a route with the same specificity as a optional catch-all route ("${t}" and "${t}[[...${this.optionalRestSlugName}]]").`,
),
"__NEXT_ERROR_CODE",
{ value: "E458", enumerable: !1, configurable: !0 },
);
r.unshift(t);
}
return (
null !== this.restSlugName &&
r.push(
...this.children
.get("[...]")
._smoosh(`${e}[...${this.restSlugName}]/`),
),
null !== this.optionalRestSlugName &&
r.push(
...this.children
.get("[[...]]")
._smoosh(`${e}[[...${this.optionalRestSlugName}]]/`),
),
r
);
}
_insert(e, t, r) {
if (0 === e.length) {
this.placeholder = !1;
return;
}
if (r)
throw Object.defineProperty(
Error("Catch-all must be the last part of the URL."),
"__NEXT_ERROR_CODE",
{ value: "E392", enumerable: !1, configurable: !0 },
);
let n = e[0];
if (n.startsWith("[") && n.endsWith("]")) {
let a = n.slice(1, -1),
i = !1;
if (
(a.startsWith("[") &&
a.endsWith("]") &&
((a = a.slice(1, -1)), (i = !0)),
a.startsWith("…"))
)
throw Object.defineProperty(
Error(
`Detected a three-dot character ('…') at ('${a}'). Did you mean ('...')?`,
),
"__NEXT_ERROR_CODE",
{ value: "E147", enumerable: !1, configurable: !0 },
);
if (
(a.startsWith("...") && ((a = a.substring(3)), (r = !0)),
a.startsWith("[") || a.endsWith("]"))
)
throw Object.defineProperty(
Error(
`Segment names may not start or end with extra brackets ('${a}').`,
),
"__NEXT_ERROR_CODE",
{ value: "E421", enumerable: !1, configurable: !0 },
);
if (a.startsWith("."))
throw Object.defineProperty(
Error(
`Segment names may not start with erroneous periods ('${a}').`,
),
"__NEXT_ERROR_CODE",
{ value: "E288", enumerable: !1, configurable: !0 },
);
function o(e, r) {
if (null !== e && e !== r)
throw Object.defineProperty(
Error(
`You cannot use different slug names for the same dynamic path ('${e}' !== '${r}').`,
),
"__NEXT_ERROR_CODE",
{ value: "E337", enumerable: !1, configurable: !0 },
);
t.forEach((e) => {
if (e === r)
throw Object.defineProperty(
Error(
`You cannot have the same slug name "${r}" repeat within a single dynamic path`,
),
"__NEXT_ERROR_CODE",
{ value: "E247", enumerable: !1, configurable: !0 },
);
if (e.replace(/\W/g, "") === n.replace(/\W/g, ""))
throw Object.defineProperty(
Error(
`You cannot have the slug names "${e}" and "${r}" differ only by non-word symbols within a single dynamic path`,
),
"__NEXT_ERROR_CODE",
{ value: "E499", enumerable: !1, configurable: !0 },
);
}),
t.push(r);
}
if (r)
if (i) {
if (null != this.restSlugName)
throw Object.defineProperty(
Error(
`You cannot use both an required and optional catch-all route at the same level ("[...${this.restSlugName}]" and "${e[0]}" ).`,
),
"__NEXT_ERROR_CODE",
{ value: "E299", enumerable: !1, configurable: !0 },
);
o(this.optionalRestSlugName, a),
(this.optionalRestSlugName = a),
(n = "[[...]]");
} else {
if (null != this.optionalRestSlugName)
throw Object.defineProperty(
Error(
`You cannot use both an optional and required catch-all route at the same level ("[[...${this.optionalRestSlugName}]]" and "${e[0]}").`,
),
"__NEXT_ERROR_CODE",
{ value: "E300", enumerable: !1, configurable: !0 },
);
o(this.restSlugName, a), (this.restSlugName = a), (n = "[...]");
}
else {
if (i)
throw Object.defineProperty(
Error(
`Optional route parameters are not yet supported ("${e[0]}").`,
),
"__NEXT_ERROR_CODE",
{ value: "E435", enumerable: !1, configurable: !0 },
);
o(this.slugName, a), (this.slugName = a), (n = "[]");
}
}
this.children.has(n) || this.children.set(n, new a()),
this.children.get(n)._insert(e.slice(1), t, r);
}
constructor() {
(this.placeholder = !0),
(this.children = new Map()),
(this.slugName = null),
(this.restSlugName = null),
(this.optionalRestSlugName = null);
}
}
function i(e) {
let t = new a();
return e.forEach((e) => t.insert(e)), t.smoosh();
}
function l(e, t) {
let r = {},
n = [];
for (let o = 0; o < e.length; o++) {
let a = t(e[o]);
(r[a] = o), (n[o] = a);
}
return i(n).map((t) => e[r[t]]);
}
};
export default moduleFactory;