PageSourceSearch

https://coalicionfloresta.org/assets/origins-ByfoDIK7.js

js coalicionfloresta.org collected 2026-10-07 18:57:13 UTC 2,555 bytes, 89 lines download raw bytes

1//#region js/legal/origins.js
2function readOrigin(viteValue, globalKey) {
3	if (typeof viteValue === "string") return viteValue;
4	return typeof globalThis !== "undefined" && typeof globalThis[globalKey] === "string" ? globalThis[globalKey] : "";
5}
6var META_ORIGIN = readOrigin((() => {
7	try {
8		return "https://meta.coalicionfloresta.org";
9	} catch {
10		return;
11	}
12})(), "__META_ORIGIN__");
13var DOCS_ORIGIN = readOrigin((() => {
14	try {
15		return "https://docs.coalicionfloresta.org";
16	} catch {
17		return;
18	}
19})(), "__DOCS_ORIGIN__");
20var LAWS_ORIGIN = readOrigin((() => {
21	try {
22		return "https://law.coalicionfloresta.org";
23	} catch {
24		return;
25	}
26})(), "__LAWS_ORIGIN__");
27var LEYES_ORIGIN = readOrigin((() => {
28	try {
29		return "https://ley.coalicionfloresta.org";
30	} catch {
31		return;
32	}
33})(), "__LEYES_ORIGIN__");
34readOrigin((() => {
35	try {
36		return "";
37	} catch {
38		return;
39	}
40})(), "__API_ORIGIN__");
41var CORPUS_ORIGIN = readOrigin((() => {
42	try {
43		return "";
44	} catch {
45		return;
46	}
47})(), "__CORPUS_ORIGIN__");
48function docHref(id) {
49	const safe = encodeURIComponent(id);
50	if (DOCS_ORIGIN) return `${DOCS_ORIGIN}/${safe}`;
51	return `/legal/doc.html?id=${safe}`;
52}
53function topicHref(id) {
54	return `/legal/topics/${encodeURIComponent(id)}`;
55}
56function crimeHref(id) {
57	return `/legal/crimes/${encodeURIComponent(id)}`;
58}
59function principleHref(id) {
60	return `/legal/principles/${encodeURIComponent(id)}`;
61}
62function cartaHref(cartaId) {
63	return `/legal/opinions/${encodeURIComponent(cartaId)}`;
64}
65function pagefindUrls(lang, descriptor = null) {
66	if (CORPUS_ORIGIN) {
67		if (!descriptor || !/^[a-f0-9]{32}$/.test(descriptor.release) || descriptor.origin !== CORPUS_ORIGIN) throw new Error("Missing or invalid pinned legal corpus release");
68		const origin = lang === "es" ? LEYES_ORIGIN : LAWS_ORIGIN;
69		return {
70			importUrl: `${CORPUS_ORIGIN}/releases/${descriptor.release}/search/${lang}/pagefind.js`,
71			baseUrl: `${origin}/`
72		};
73	}
74	const targetOrigin = lang === "es" ? LEYES_ORIGIN : LAWS_ORIGIN;
75	if (!targetOrigin) return {
76		importUrl: `/data/legal/pagefind-${lang}/pagefind.js`,
77		baseUrl: "/"
78	};
79	if (typeof window !== "undefined" && window.location.origin === targetOrigin) return {
80		importUrl: `/data/legal/pagefind-${lang}/pagefind.js`,
81		baseUrl: "/"
82	};
83	return {
84		importUrl: `${targetOrigin}/data/legal/pagefind-${lang}/pagefind.js`,
85		baseUrl: `${targetOrigin}/`
86	};
87}
88//#endregion
89export { docHref as a, topicHref as c, crimeHref as i, META_ORIGIN as n, pagefindUrls as o, cartaHref as r, principleHref as s, CORPUS_ORIGIN as t };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.