@tricoteuses/tisseuse 0.21.0 → 0.21.2
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.
- package/README.md +39 -1
- package/dist/{html-jaUHsXKQ.js → html-DWNF_0Ek.js} +5264 -4923
- package/dist/index.js +84 -421
- package/dist/{resolver-CzmDH4S3.js → resolver-BBrU9oGB.js} +39 -28
- package/dist/server-f-legi.js +1 -1
- package/dist/server.js +971 -667
- package/dist/src/lib/extractors/links.d.ts +3 -1
- package/dist/src/lib/extractors/references.d.ts +4 -0
- package/dist/src/lib/index.d.ts +1 -1
- package/dist/src/lib/legi/canutes_root_cid_index.integration.test.d.ts +1 -0
- package/dist/src/lib/linkers/html.d.ts +3 -1
- package/dist/src/lib/linkers/markdown.d.ts +3 -1
- package/dist/src/lib/linkers/reference-mode.test.d.ts +1 -0
- package/dist/src/lib/server/databases/canutes_root_cid_index.d.ts +11 -0
- package/dist/src/lib/server/index.d.ts +2 -0
- package/dist/src/lib/server/jurisprudence_citations.d.ts +46 -0
- package/dist/src/lib/server/jurisprudence_citations.test.d.ts +1 -0
- package/dist/src/lib/server/jurisprudence_consultation.d.ts +55 -0
- package/dist/src/lib/server/jurisprudence_jade.d.ts +57 -0
- package/dist/src/lib/server/jurisprudence_jade.test.d.ts +1 -0
- package/dist/src/lib/server/jurisprudence_store.d.ts +36 -0
- package/dist/src/lib/server/jurisprudence_store.integration.test.d.ts +1 -0
- package/dist/src/lib/server/jurisprudence_store_closed.test.d.ts +1 -0
- package/dist/src/lib/text_parsers/parsers.d.ts +3 -0
- package/dist/src/scripts/alimenter_jurisprudence_pilote.d.ts +1 -0
- package/dist/src/scripts/configure_postgres_root_cid_index.d.ts +1 -0
- package/package.json +4 -1
package/dist/server.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as ge, At as
|
|
3
|
-
import * as
|
|
4
|
-
import { createHash as
|
|
5
|
-
import
|
|
1
|
+
import { A as e, C as t, E as n, F as r, Ft as i, Gt as a, K as o, Kt as s, Mt as c, N as l, Nt as u, O as d, Ot as f, P as p, Pt as m, Rt as h, S as g, T as _, Y as v, _ as ee, at as y, b, c as x, g as S, h as C, ht as w, it as te, j as ne, k as re, lt as ie, m as ae, n as oe, p as se, pt as ce, q as le, s as ue, t as de, tt as T, u as fe, v as pe, w as me, z as he } from "./html-DWNF_0Ek.js";
|
|
2
|
+
import { A as ge, At as E, F as _e, Ft as D, Lt as O, R as ve, St as k, d as ye, ft as be, it as xe, j as Se, jt as A, kt as j, n as Ce, r as we, t as Te, yt as Ee, z as De } from "./resolver-BBrU9oGB.js";
|
|
3
|
+
import * as Oe from "node:crypto";
|
|
4
|
+
import { createHash as M } from "node:crypto";
|
|
5
|
+
import N from "fs-extra";
|
|
6
6
|
import ke from "node:path";
|
|
7
7
|
//#region src/lib/server/assemblee_amendment_search.ts
|
|
8
8
|
function Ae(e, t) {
|
|
@@ -17,7 +17,7 @@ function je(e) {
|
|
|
17
17
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
18
18
|
}
|
|
19
19
|
function Me(e) {
|
|
20
|
-
return je(
|
|
20
|
+
return je(w(e).text());
|
|
21
21
|
}
|
|
22
22
|
function Ne(e) {
|
|
23
23
|
let t = je([
|
|
@@ -52,23 +52,23 @@ function Ne(e) {
|
|
|
52
52
|
}] : []];
|
|
53
53
|
}
|
|
54
54
|
function Pe(e, t) {
|
|
55
|
-
return
|
|
55
|
+
return M("sha256").update(JSON.stringify({
|
|
56
56
|
item: e,
|
|
57
57
|
metadata: t
|
|
58
58
|
})).digest("hex");
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region src/lib/extractors/article_action_targets.ts
|
|
62
|
-
function
|
|
62
|
+
function P(e) {
|
|
63
63
|
switch (e.type) {
|
|
64
|
-
case "reference_et_action": return
|
|
65
|
-
case "enumeration": return [...
|
|
64
|
+
case "reference_et_action": return P(e.reference);
|
|
65
|
+
case "enumeration": return [...P(e.left), ...P(e.right)];
|
|
66
66
|
case "parent-enfant": {
|
|
67
67
|
let t = [...a(e.parent)].filter((e) => e.type === "article");
|
|
68
68
|
return t.length === 1 ? [{
|
|
69
69
|
article: t[0],
|
|
70
70
|
reference: e
|
|
71
|
-
}] : t.length > 1 ? [] :
|
|
71
|
+
}] : t.length > 1 ? [] : P(e.child).map((t) => ({
|
|
72
72
|
article: t.article,
|
|
73
73
|
reference: {
|
|
74
74
|
...e,
|
|
@@ -91,9 +91,9 @@ function M(e) {
|
|
|
91
91
|
//#region src/lib/extractors/article_action_effects.ts
|
|
92
92
|
function Fe(e, t) {
|
|
93
93
|
if (t < 2) return null;
|
|
94
|
-
let n =
|
|
94
|
+
let n = Se(e), r = pe(e);
|
|
95
95
|
if (r.length !== t) return null;
|
|
96
|
-
let i =
|
|
96
|
+
let i = he(new j(n.output)), a = (e) => De(n, [e])[0].position;
|
|
97
97
|
return r.map((t, n) => ({
|
|
98
98
|
sourceText: e,
|
|
99
99
|
referencePosition: a({
|
|
@@ -103,20 +103,20 @@ function Fe(e, t) {
|
|
|
103
103
|
actionPosition: a(t.position)
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
|
-
function Ie(e,
|
|
107
|
-
if (
|
|
108
|
-
let
|
|
109
|
-
if (c.length !==
|
|
110
|
-
let l =
|
|
111
|
-
if (l.length > 0) return
|
|
106
|
+
function Ie(e, n, r) {
|
|
107
|
+
if (n.length < 2) return null;
|
|
108
|
+
let i = Se(e), a = i.output, o = (e) => De(i, [e])[0].position, s = he(new j(a)), c = s.flatMap(P);
|
|
109
|
+
if (c.length !== n.length || c.length < 2) return null;
|
|
110
|
+
let l = t(a);
|
|
111
|
+
if (l.length > 0) return r?.kind !== "replace_portion" || l.length !== c.length || l.some((e, t) => {
|
|
112
112
|
let n = c[t];
|
|
113
|
-
return n.article.num !== e.article.num || n.article.position.start !== e.article.position.start || n.article.position.stop !== e.article.position.stop || !
|
|
114
|
-
}) ? null : c.map((
|
|
115
|
-
targetId:
|
|
113
|
+
return n.article.num !== e.article.num || n.article.position.start !== e.article.position.start || n.article.position.stop !== e.article.position.stop || !ie(n.reference).some((t) => t.kind === "single" && t.steps.some((t) => t.type === "alinéa" && t.index === e.alineaIndex));
|
|
114
|
+
}) ? null : c.map((t, i) => ({
|
|
115
|
+
targetId: n[i],
|
|
116
116
|
directive: {
|
|
117
|
-
...
|
|
118
|
-
reference:
|
|
119
|
-
portionSelectors:
|
|
117
|
+
...r,
|
|
118
|
+
reference: t.reference,
|
|
119
|
+
portionSelectors: ie(t.reference),
|
|
120
120
|
tableTarget: {
|
|
121
121
|
type: "table",
|
|
122
122
|
rowIndex: l[i].rowIndex,
|
|
@@ -125,7 +125,7 @@ function Ie(e, t, n) {
|
|
|
125
125
|
},
|
|
126
126
|
sourceAnnotation: {
|
|
127
127
|
sourceText: e,
|
|
128
|
-
referencePosition:
|
|
128
|
+
referencePosition: o(t.reference.position),
|
|
129
129
|
actionPosition: {
|
|
130
130
|
start: 0,
|
|
131
131
|
stop: e.length
|
|
@@ -134,14 +134,14 @@ function Ie(e, t, n) {
|
|
|
134
134
|
}));
|
|
135
135
|
let u = c.filter(({ reference: e }) => e.type === "parent-enfant" && e.parent.type === "texte" && e.parent.nature !== "CODE");
|
|
136
136
|
if (u.length > 0 && u.length < c.length) {
|
|
137
|
-
let
|
|
138
|
-
if (
|
|
139
|
-
let r =
|
|
140
|
-
return !
|
|
141
|
-
targetId:
|
|
137
|
+
let t = c.filter((e) => !u.includes(e));
|
|
138
|
+
if (t.length !== 1) return null;
|
|
139
|
+
let r = t[0], i = n[c.indexOf(r)], s = g(a);
|
|
140
|
+
return !i || s.length !== 1 || s[0].kind === "compound" ? null : [{
|
|
141
|
+
targetId: i,
|
|
142
142
|
sourceAnnotation: {
|
|
143
143
|
sourceText: e,
|
|
144
|
-
referencePosition:
|
|
144
|
+
referencePosition: o(r.reference.position),
|
|
145
145
|
actionPosition: {
|
|
146
146
|
start: 0,
|
|
147
147
|
stop: e.length
|
|
@@ -152,77 +152,77 @@ function Ie(e, t, n) {
|
|
|
152
152
|
reference: r.reference,
|
|
153
153
|
sourcePosition: {
|
|
154
154
|
start: 0,
|
|
155
|
-
stop:
|
|
155
|
+
stop: a.length
|
|
156
156
|
},
|
|
157
|
-
sourceText:
|
|
157
|
+
sourceText: a
|
|
158
158
|
}
|
|
159
159
|
}];
|
|
160
160
|
}
|
|
161
161
|
let d = [], f = 0;
|
|
162
|
-
for (let e = 1; e <
|
|
163
|
-
let t =
|
|
164
|
-
t.type !== "reference_et_action" ||
|
|
162
|
+
for (let e = 1; e < s.length; e += 1) {
|
|
163
|
+
let t = s[e];
|
|
164
|
+
t.type !== "reference_et_action" || P(t).length === 0 || s.slice(f, e).flatMap(P).length === 0 || g(a.slice(f === 0 ? 0 : s[f].position.start, t.position.start)).length === 1 && g(a.slice(t.position.start)).length === 1 && (d.push(e - 1), f = e);
|
|
165
165
|
}
|
|
166
|
-
d.push(
|
|
166
|
+
d.push(s.length - 1);
|
|
167
167
|
let p = [], m = 0, h = 0;
|
|
168
|
-
for (let
|
|
169
|
-
let r =
|
|
168
|
+
for (let t of d) {
|
|
169
|
+
let r = s.slice(m, t + 1).flatMap(P);
|
|
170
170
|
if (r.length === 0) {
|
|
171
|
-
m =
|
|
171
|
+
m = t + 1;
|
|
172
172
|
continue;
|
|
173
173
|
}
|
|
174
|
-
let
|
|
174
|
+
let i = m === 0 ? 0 : s[m].position.start, c = s[t + 1]?.position.start ?? a.length, l = g(a.slice(i, c));
|
|
175
175
|
if (l.length !== 1 || l[0].kind === "compound") return null;
|
|
176
176
|
let u = l[0];
|
|
177
|
-
for (let
|
|
178
|
-
let r =
|
|
177
|
+
for (let t of r) {
|
|
178
|
+
let r = n[h++];
|
|
179
179
|
if (!r) return null;
|
|
180
180
|
p.push({
|
|
181
181
|
targetId: r,
|
|
182
182
|
sourceAnnotation: {
|
|
183
183
|
sourceText: e,
|
|
184
|
-
referencePosition:
|
|
185
|
-
actionPosition:
|
|
186
|
-
start:
|
|
184
|
+
referencePosition: o(t.reference.position),
|
|
185
|
+
actionPosition: o({
|
|
186
|
+
start: i,
|
|
187
187
|
stop: c
|
|
188
188
|
})
|
|
189
189
|
},
|
|
190
190
|
directive: {
|
|
191
191
|
...u,
|
|
192
|
-
sourceText:
|
|
192
|
+
sourceText: a,
|
|
193
193
|
sourcePosition: {
|
|
194
194
|
start: 0,
|
|
195
|
-
stop:
|
|
195
|
+
stop: a.length
|
|
196
196
|
},
|
|
197
|
-
reference:
|
|
198
|
-
portionSelectors:
|
|
197
|
+
reference: t.reference,
|
|
198
|
+
portionSelectors: ie(t.reference)
|
|
199
199
|
}
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
|
-
m =
|
|
202
|
+
m = t + 1;
|
|
203
203
|
}
|
|
204
|
-
return h ===
|
|
204
|
+
return h === n.length ? p : null;
|
|
205
205
|
}
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/lib/server/parsed_bills.ts
|
|
208
208
|
var Le = /^expos[ée]\s+des\s+motifs\b/iu;
|
|
209
|
-
function
|
|
209
|
+
function F(e) {
|
|
210
210
|
return (e ?? "").replace(/\u00a0/g, " ").replace(/\s+/g, " ").trim();
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
return
|
|
212
|
+
function I(e) {
|
|
213
|
+
return F(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
214
214
|
}
|
|
215
215
|
function Re(e) {
|
|
216
|
-
return
|
|
216
|
+
return c(F(e));
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function L(e) {
|
|
219
219
|
return `_TocArt${Re(e).replace(/\s+/gu, "")}`;
|
|
220
220
|
}
|
|
221
221
|
function ze(e, t) {
|
|
222
222
|
return e(t).closest(".assnatTOC6,.assnatTOC5,.assnatTOC4").length > 0;
|
|
223
223
|
}
|
|
224
224
|
function Be(e) {
|
|
225
|
-
return
|
|
225
|
+
return I(e).replace(/[‐‑‒–—]/gu, "-").replace(/\s*\.\s*/gu, ".");
|
|
226
226
|
}
|
|
227
227
|
function Ve(e) {
|
|
228
228
|
return Be(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
|
|
@@ -245,12 +245,12 @@ function He(e) {
|
|
|
245
245
|
default: return;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
function Ue(
|
|
249
|
-
let
|
|
250
|
-
if (
|
|
248
|
+
function Ue(e) {
|
|
249
|
+
let t = F(e.sourceText), n = /\b(?:ins[ée]r[ée]s?|cr[ée][ée]s?|ajout[ée]s?|compl[ée]t[ée]s?\s+par)\b[\s\S]{0,160}?\barticle\s+(.+?)\s+ainsi\s+r[ée]dig[ée]s?\b/iu.exec(t);
|
|
250
|
+
if (n?.[1] !== void 0) return u(n[1]);
|
|
251
251
|
}
|
|
252
252
|
function We(e) {
|
|
253
|
-
let t = He(e), n =
|
|
253
|
+
let t = He(e), n = f(t ?? "");
|
|
254
254
|
if (n.length > 0 && t !== void 0) return n.map((e, r) => {
|
|
255
255
|
let i = e.start, a = n[r + 1]?.start ?? t.length, o = t.slice(i, a).trim();
|
|
256
256
|
return {
|
|
@@ -283,14 +283,14 @@ function Ke(e) {
|
|
|
283
283
|
return t.type === "bounded-interval" || Object.values(t).some(Ke);
|
|
284
284
|
}
|
|
285
285
|
function qe(e) {
|
|
286
|
-
let t =
|
|
286
|
+
let t = I(e.sourceText);
|
|
287
287
|
return /\b(?:cree|cree[e]?s?|resultant|issu|prevu|mentionne)\b[\s\S]{0,80}\b(?:present|presente|pjl|projet\s+de\s+loi)\b/u.test(t);
|
|
288
288
|
}
|
|
289
289
|
function Je(e) {
|
|
290
|
-
return
|
|
290
|
+
return F(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
|
|
291
291
|
}
|
|
292
292
|
function Ye(e, t) {
|
|
293
|
-
let n = new
|
|
293
|
+
let n = new j(e, t), r = xe(n);
|
|
294
294
|
return typeof r != "string" || n.offset <= t ? null : {
|
|
295
295
|
date: r,
|
|
296
296
|
start: t,
|
|
@@ -328,9 +328,9 @@ function Qe(e) {
|
|
|
328
328
|
return n.length === 1 ? n[0] : void 0;
|
|
329
329
|
}
|
|
330
330
|
function $e(e) {
|
|
331
|
-
return
|
|
331
|
+
return I(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-").replace(/^(?:(?:article\s+[^:]+|[a-z][.)]|[ivxlcdm]+\.|\d+°)\s*(?:-\s*)?)+/iu, "");
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function R(e) {
|
|
334
334
|
return e?.type === "tag";
|
|
335
335
|
}
|
|
336
336
|
function et(e, t) {
|
|
@@ -344,7 +344,7 @@ function tt(e, t) {
|
|
|
344
344
|
let s = o[1] === "articles" ? "article" : o[1] === "sections" ? "division" : "text", c = o[2].replace(/\.md$/u, ""), l = `${s}\0${c}`;
|
|
345
345
|
if (r.has(l)) continue;
|
|
346
346
|
r.add(l);
|
|
347
|
-
let u =
|
|
347
|
+
let u = F(e(i).text());
|
|
348
348
|
n.push({
|
|
349
349
|
id: c,
|
|
350
350
|
...nt(e, t, i) ? { insideFrenchQuotes: !0 } : {},
|
|
@@ -361,27 +361,27 @@ function nt(e, t, n) {
|
|
|
361
361
|
function rt(e, t, n) {
|
|
362
362
|
if (t === n) return "";
|
|
363
363
|
if (t.type === "text") return t.data ?? "";
|
|
364
|
-
if (!
|
|
364
|
+
if (!R(t)) return "";
|
|
365
365
|
let r = "";
|
|
366
366
|
for (let i of e(t).contents().get()) {
|
|
367
367
|
if (i === n) return r;
|
|
368
|
-
if (
|
|
368
|
+
if (R(i) && e.contains(i, n)) return r + rt(e, i, n);
|
|
369
369
|
r += e(i).text();
|
|
370
370
|
}
|
|
371
371
|
return r;
|
|
372
372
|
}
|
|
373
373
|
function it(e, t) {
|
|
374
|
-
return t.map((t) =>
|
|
374
|
+
return t.map((t) => F(e(t).text())).filter(Boolean).join("\n");
|
|
375
375
|
}
|
|
376
|
-
function at(
|
|
377
|
-
let
|
|
378
|
-
return !
|
|
376
|
+
function at(t) {
|
|
377
|
+
let n = I(t);
|
|
378
|
+
return !n || Le.test(n) ? "noise" : e.test(t) ? "directive_candidate" : "context";
|
|
379
379
|
}
|
|
380
380
|
function ot(e, t) {
|
|
381
|
-
return t.tagName === "p" && (/pastille/iu.test(e(t).attr("class") ?? "") || e(t).is("[data-pastille]")) && /^\(\d+\)$/u.test(
|
|
381
|
+
return t.tagName === "p" && (/pastille/iu.test(e(t).attr("class") ?? "") || e(t).is("[data-pastille]")) && /^\(\d+\)$/u.test(F(e(t).text()));
|
|
382
382
|
}
|
|
383
383
|
function st(e) {
|
|
384
|
-
let t =
|
|
384
|
+
let t = w(e, { xml: {
|
|
385
385
|
xmlMode: !1,
|
|
386
386
|
withStartIndices: !0,
|
|
387
387
|
withEndIndices: !0
|
|
@@ -397,7 +397,7 @@ function st(e) {
|
|
|
397
397
|
async function ct(e, t, n, r) {
|
|
398
398
|
if (n === void 0) throw Error("A document date is required to add links to legal references.");
|
|
399
399
|
if (t.legiResolver === void 0 && t.canutesDb === void 0) throw Error("A Canutes database or an explicit legal resolver is required to add links to legal references.");
|
|
400
|
-
let i = t.legiResolver ?? new se(t.canutesDb), { output: a } = await
|
|
400
|
+
let i = t.legiResolver ?? new se(t.canutesDb), { output: a } = await oe({
|
|
401
401
|
date: n,
|
|
402
402
|
excludedHtmlRanges: r,
|
|
403
403
|
html: e,
|
|
@@ -413,14 +413,14 @@ async function ct(e, t, n, r) {
|
|
|
413
413
|
}
|
|
414
414
|
function lt(e, t) {
|
|
415
415
|
let n = e(t).closest("h1,h2,h3,h4,h5,h6,p,td,th").get(0), r = e(t).closest("table").get(0);
|
|
416
|
-
return
|
|
416
|
+
return R(r) && R(n) && e(n).parents("table").get(0) === r ? r : R(n) ? n : t;
|
|
417
417
|
}
|
|
418
418
|
function ut(e, t, n, r, i) {
|
|
419
419
|
if (n.has(i.container)) return;
|
|
420
|
-
let a = i.id ??
|
|
420
|
+
let a = i.id ?? L(i.num ?? i.label);
|
|
421
421
|
if (r.has(a)) return;
|
|
422
422
|
r.add(a), n.add(i.container);
|
|
423
|
-
let o = i.title ? e(i.element).closest("h1,h2,h3,h4,h5,h6,p.assnat9ArticleNum").get(0) : void 0, s =
|
|
423
|
+
let o = i.title ? e(i.element).closest("h1,h2,h3,h4,h5,h6,p.assnat9ArticleNum").get(0) : void 0, s = R(o) ? ft(e, o) : null, c = s ? e(o).text() : "", l = R(o) && s?.label === i.label && s.title === i.title && [`${s.label}${s.title}`, `${s.label} ${s.title}`].some((e) => I(e) === I(c)) ? {
|
|
424
424
|
element: o,
|
|
425
425
|
text: `${s.label}\n${s.title}`
|
|
426
426
|
} : void 0;
|
|
@@ -434,36 +434,36 @@ function ut(e, t, n, r, i) {
|
|
|
434
434
|
splitAtBreak: l
|
|
435
435
|
});
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function dt(e) {
|
|
438
438
|
let t = /* @__PURE__ */ new Map();
|
|
439
439
|
return e("body *").each((e, n) => {
|
|
440
440
|
t.set(n, e);
|
|
441
441
|
}), t;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function z(e, t) {
|
|
444
444
|
return e.get(t) ?? 2 ** 53 - 1;
|
|
445
445
|
}
|
|
446
|
-
function
|
|
447
|
-
if (!e(t).hasClass("assnat9ArticleNum") && !
|
|
446
|
+
function ft(e, t) {
|
|
447
|
+
if (!e(t).hasClass("assnat9ArticleNum") && !mt(e, t) || e(t).find("br").length !== 1) return null;
|
|
448
448
|
let n = "", r = "", i = !1, a = (e) => {
|
|
449
449
|
if (e.type === "text") i ? r += e.data : n += e.data;
|
|
450
|
-
else if (
|
|
450
|
+
else if (R(e)) if (e.tagName.toLowerCase() === "br") i = !0;
|
|
451
451
|
else for (let t of e.children) a(t);
|
|
452
452
|
};
|
|
453
453
|
a(t);
|
|
454
|
-
let o =
|
|
454
|
+
let o = m(F(n)), s = F(r);
|
|
455
455
|
return o && !o.title && s ? {
|
|
456
456
|
...o,
|
|
457
457
|
title: s
|
|
458
458
|
} : null;
|
|
459
459
|
}
|
|
460
|
-
function
|
|
460
|
+
function pt(e) {
|
|
461
461
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
462
462
|
e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
|
|
463
463
|
if (ze(e, a)) return;
|
|
464
|
-
let o =
|
|
464
|
+
let o = F(e(a).text()), s = e(a).attr("id");
|
|
465
465
|
if (!s || r.has(s)) return;
|
|
466
|
-
let c = lt(e, a), l = e(a).closest("h1,h2,h3,h4,h5,h6,p.assnat9ArticleNum").get(0), u =
|
|
466
|
+
let c = lt(e, a), l = e(a).closest("h1,h2,h3,h4,h5,h6,p.assnat9ArticleNum").get(0), u = m(o) ?? (R(l) && (a === l || e(a).find("br").length === 1) ? ft(e, l) : null);
|
|
467
467
|
u && ut(e, t, n, r, {
|
|
468
468
|
id: s,
|
|
469
469
|
...u,
|
|
@@ -472,28 +472,28 @@ function ft(e) {
|
|
|
472
472
|
});
|
|
473
473
|
}), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((i, a) => {
|
|
474
474
|
if (n.has(a)) return;
|
|
475
|
-
let o =
|
|
475
|
+
let o = m(F(e(a).text())) ?? ft(e, a);
|
|
476
476
|
o && ut(e, t, n, r, {
|
|
477
477
|
...o,
|
|
478
478
|
element: a,
|
|
479
479
|
container: a
|
|
480
480
|
});
|
|
481
481
|
});
|
|
482
|
-
let i =
|
|
483
|
-
return t.sort((e, t) =>
|
|
482
|
+
let i = dt(e);
|
|
483
|
+
return t.sort((e, t) => z(i, e.container) - z(i, t.container)), t;
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function mt(e, t) {
|
|
486
486
|
if (ze(e, t)) return !1;
|
|
487
487
|
let n = t.tagName?.toLowerCase();
|
|
488
488
|
if (n !== "p") return /^h[1-6]$/u.test(n ?? "");
|
|
489
489
|
let r = e(t).attr("style") ?? "", i = e(t).html() ?? "";
|
|
490
490
|
return /text-align\s*:\s*center/iu.test(r) && (/font-weight\s*:\s*bold/iu.test(r) || /font-weight\s*:\s*bold/iu.test(i) || /<(?:strong|b)(?:\s|>)/iu.test(i));
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function ht(e) {
|
|
493
493
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
494
494
|
return e("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6,p").each((i, a) => {
|
|
495
|
-
if (ze(e, a) || !e(a).hasClass("assnat9ArticleNum") && !
|
|
496
|
-
let o =
|
|
495
|
+
if (ze(e, a) || !e(a).hasClass("assnat9ArticleNum") && !mt(e, a)) return;
|
|
496
|
+
let o = m(e(a).text()) ?? ft(e, a);
|
|
497
497
|
o && ut(e, t, n, r, {
|
|
498
498
|
...o,
|
|
499
499
|
element: a,
|
|
@@ -501,7 +501,7 @@ function mt(e) {
|
|
|
501
501
|
});
|
|
502
502
|
}), t;
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function gt(e) {
|
|
505
505
|
let t = Re(e ?? "").replace(/[()]/gu, "").trim();
|
|
506
506
|
if (!t || t.toLowerCase() === "liminaire") return;
|
|
507
507
|
if (t.toLowerCase() === "unique") return {
|
|
@@ -511,7 +511,7 @@ function ht(e) {
|
|
|
511
511
|
};
|
|
512
512
|
let n = /^(\d+|premier)(?:\s+([a-z]+))?(?:\s+([A-Z]+))?$/u.exec(t);
|
|
513
513
|
if (!n) return;
|
|
514
|
-
let r = n[1] === "premier" ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 :
|
|
514
|
+
let r = n[1] === "premier" ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 : vt(i);
|
|
515
515
|
if (a !== void 0) return {
|
|
516
516
|
base: r,
|
|
517
517
|
suffixOrder: a,
|
|
@@ -519,7 +519,7 @@ function ht(e) {
|
|
|
519
519
|
text: t
|
|
520
520
|
};
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function _t(e, t) {
|
|
523
523
|
if (t.base !== e.base) return t.base - e.base;
|
|
524
524
|
if (t.suffixOrder !== e.suffixOrder) return t.suffixOrder - e.suffixOrder;
|
|
525
525
|
for (let n = 0; n <= Math.max(e.letters?.length ?? 0, t.letters?.length ?? 0); n++) {
|
|
@@ -528,14 +528,14 @@ function gt(e, t) {
|
|
|
528
528
|
}
|
|
529
529
|
return 0;
|
|
530
530
|
}
|
|
531
|
-
function
|
|
532
|
-
let t = new
|
|
531
|
+
function vt(e) {
|
|
532
|
+
let t = new j(e), n = be(t);
|
|
533
533
|
if (!(n === void 0 || t.offset !== e.length) && !(typeof n != "object" || !n || !("value" in n) || typeof n.value != "number")) return n.value - 1;
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function yt(e) {
|
|
536
536
|
let t = [], n = e.map((e) => ({
|
|
537
537
|
heading: e,
|
|
538
|
-
token:
|
|
538
|
+
token: gt(e.num)
|
|
539
539
|
}));
|
|
540
540
|
n.filter(({ token: e }) => e?.text === "unique").length > 0 && e.length > 1 && t.push({
|
|
541
541
|
code: "article_toc_out_of_order",
|
|
@@ -544,7 +544,7 @@ function vt(e) {
|
|
|
544
544
|
let r;
|
|
545
545
|
for (let { heading: e, token: i } of n) if (!(i === void 0 || i.text === "unique")) {
|
|
546
546
|
if (r !== void 0) {
|
|
547
|
-
let n =
|
|
547
|
+
let n = _t(r, i);
|
|
548
548
|
n === 0 ? t.push({
|
|
549
549
|
code: "article_toc_duplicate_number",
|
|
550
550
|
message: `Article ${e.num ?? e.label} is repeated`,
|
|
@@ -573,60 +573,60 @@ function vt(e) {
|
|
|
573
573
|
}
|
|
574
574
|
return t;
|
|
575
575
|
}
|
|
576
|
-
function
|
|
577
|
-
let t =
|
|
576
|
+
function bt(e) {
|
|
577
|
+
let t = yt(e);
|
|
578
578
|
t.length > 0 && process.env.TISSEUSE_WARN_ASSEMBLEE_HEADING_SEQUENCE === "1" && console.warn("Incoherent Assemblée article heading sequence", { issues: t.map((e) => e.message) });
|
|
579
579
|
}
|
|
580
|
-
function
|
|
581
|
-
let n =
|
|
582
|
-
if (n.length === 0) return t &&
|
|
583
|
-
let i =
|
|
584
|
-
let n = new Set(e.map((e) => e.container)), r = new Set(e.map((e) =>
|
|
580
|
+
function xt(e, { warn: t = !0 } = {}) {
|
|
581
|
+
let n = pt(e), r = ht(e);
|
|
582
|
+
if (n.length === 0) return t && bt(r), r;
|
|
583
|
+
let i = dt(e), a = (e, t) => {
|
|
584
|
+
let n = new Set(e.map((e) => e.container)), r = new Set(e.map((e) => L(e.num ?? e.label)));
|
|
585
585
|
for (let i of t) {
|
|
586
|
-
let t =
|
|
586
|
+
let t = L(i.num ?? i.label);
|
|
587
587
|
n.has(i.container) || r.has(t) || (n.add(i.container), r.add(t), e.push(i));
|
|
588
588
|
}
|
|
589
|
-
return e.sort((e, t) =>
|
|
590
|
-
}, o = r.filter((t) => e(t.element).is("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6")), s = a([...n], o), c = a([...s], r.filter((e) => !o.includes(e))), l = s.length >= 2 &&
|
|
591
|
-
return t &&
|
|
589
|
+
return e.sort((e, t) => z(i, e.container) - z(i, t.container)), e;
|
|
590
|
+
}, o = r.filter((t) => e(t.element).is("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6")), s = a([...n], o), c = a([...s], r.filter((e) => !o.includes(e))), l = s.length >= 2 && yt(c).length > yt(s).length ? s : c;
|
|
591
|
+
return t && bt(l), l;
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function St(e) {
|
|
594
594
|
let t = e.next;
|
|
595
595
|
for (; t !== null;) {
|
|
596
|
-
if (
|
|
596
|
+
if (R(t)) return t;
|
|
597
597
|
t = t.next;
|
|
598
598
|
}
|
|
599
599
|
return null;
|
|
600
600
|
}
|
|
601
|
-
function
|
|
601
|
+
function Ct(e, t, n) {
|
|
602
602
|
let r = e(t.container);
|
|
603
603
|
if (!r.is("p.assnat9ArticleNum")) return;
|
|
604
604
|
let i = r.parent(), a = i.parent();
|
|
605
605
|
if (!i.is("div") || i.children().length !== 1 || !a.is("div")) return;
|
|
606
606
|
let o = a.children().get();
|
|
607
|
-
if (o.length !== 3 && o.length !== 4 || o[0] !== i.get(0) || o[1]?.tagName !== "span" ||
|
|
607
|
+
if (o.length !== 3 && o.length !== 4 || o[0] !== i.get(0) || o[1]?.tagName !== "span" || F(e(o[1]).text()) !== "") return;
|
|
608
608
|
let s = o.length === 4 ? o[2] : void 0;
|
|
609
|
-
if (s !== void 0 && (s.tagName !== "p" || !e(s).hasClass("assnat9ArticleNum") || !/^\(non modifié\)$/iu.test(
|
|
609
|
+
if (s !== void 0 && (s.tagName !== "p" || !e(s).hasClass("assnat9ArticleNum") || !/^\(non modifié\)$/iu.test(F(e(s).text())))) return;
|
|
610
610
|
let c = o.at(-1);
|
|
611
|
-
if (!(c.tagName !== "div" || n !== void 0 && e.contains(c, n.container) || e(c).find("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6").toArray().some((t) =>
|
|
611
|
+
if (!(c.tagName !== "div" || n !== void 0 && e.contains(c, n.container) || e(c).find("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6").toArray().some((t) => m(e(t).text()) !== null))) return [
|
|
612
612
|
t.container,
|
|
613
613
|
...s === void 0 ? [] : [s],
|
|
614
614
|
c
|
|
615
615
|
];
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function wt(e, t, n, r = dt(e)) {
|
|
618
618
|
let i = [t.container], a = n?.container;
|
|
619
|
-
for (let e =
|
|
619
|
+
for (let e = St(t.container); e !== null && e !== a; e = St(e)) i.push(e);
|
|
620
620
|
if (i.length > 1) return i;
|
|
621
|
-
let o =
|
|
621
|
+
let o = Ct(e, t, n);
|
|
622
622
|
if (o !== void 0) return o;
|
|
623
|
-
let s =
|
|
623
|
+
let s = z(r, t.container), c = a ? z(r, a) : -1;
|
|
624
624
|
return e("body > *").get().filter((e) => {
|
|
625
|
-
let t =
|
|
625
|
+
let t = z(r, e);
|
|
626
626
|
return t >= s && (c === -1 || t < c);
|
|
627
627
|
});
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function Tt(e, t) {
|
|
630
630
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
631
631
|
for (let i of t) {
|
|
632
632
|
let t = "p,li,table", a = e(i).is(t) ? [i] : e(i).find(t).get();
|
|
@@ -634,10 +634,10 @@ function wt(e, t) {
|
|
|
634
634
|
}
|
|
635
635
|
return n;
|
|
636
636
|
}
|
|
637
|
-
function
|
|
637
|
+
function Et(e, t, n, r) {
|
|
638
638
|
let i = [], a = !1;
|
|
639
|
-
for (let o of
|
|
640
|
-
let n = e(o).is("table.akn-quoted-table") ?
|
|
639
|
+
for (let o of Tt(e, n)) {
|
|
640
|
+
let n = e(o).is("table.akn-quoted-table") ? xn(e, o) : F(e(o).text());
|
|
641
641
|
if (o === r?.splitAtBreak?.element && (n = r.splitAtBreak.text), !n) continue;
|
|
642
642
|
Le.test(n) && (a = !0);
|
|
643
643
|
let s = a ? "noise" : at(n), c = `${t}-b${i.length + 1}`;
|
|
@@ -652,117 +652,117 @@ function Tt(e, t, n, r) {
|
|
|
652
652
|
}
|
|
653
653
|
return i;
|
|
654
654
|
}
|
|
655
|
-
function
|
|
655
|
+
function Dt(e, t) {
|
|
656
656
|
if (t.length === 0) return e;
|
|
657
657
|
let n = `<div style="display: none;">\n${t.map((e) => `<p class="assnatTOC6"><a href="#${e.id}"><span class="assnatHyperlink" style="font-weight:bold; text-decoration:none; color:#000000">${e.label.toUpperCase()}</span></a></p>`).join("\n")}\n</div>`;
|
|
658
658
|
return e.includes("class=\"assnatSection3\"") ? e.replace(/(<div class="assnatSection3">)/u, `${n}$1`) : e.includes("id=\"formCorrection:panel:1:table\"") ? e.replace(/(<div id="formCorrection:panel:1:table">)/u, `${n}$1`) : `${n}\n${e}`;
|
|
659
659
|
}
|
|
660
|
-
function
|
|
661
|
-
let t =
|
|
662
|
-
for (let e of
|
|
663
|
-
let r =
|
|
660
|
+
function Ot(e) {
|
|
661
|
+
let t = w(e), n = kt(t);
|
|
662
|
+
for (let e of xt(t, { warn: !1 })) {
|
|
663
|
+
let r = L(e.num ?? e.label.replace(/^Article\s+/iu, "")), i = t(e.element), a = i.attr("id");
|
|
664
664
|
if (a !== r) {
|
|
665
|
-
if (a?.startsWith("_Toc") && !
|
|
665
|
+
if (a?.startsWith("_Toc") && !Mt(n, a, e.element)) {
|
|
666
666
|
let e = t("<span></span>").attr("id", a);
|
|
667
667
|
i.before(e);
|
|
668
668
|
let r = e.get(0);
|
|
669
|
-
|
|
669
|
+
R(r) && At(n, a, r);
|
|
670
670
|
}
|
|
671
|
-
a &&
|
|
671
|
+
a && jt(n, a, e.element), i.attr("id", r), At(n, r, e.element);
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
|
-
let r =
|
|
674
|
+
let r = xt(t), i = dt(t);
|
|
675
675
|
for (let [e, a] of r.entries()) {
|
|
676
|
-
let o =
|
|
676
|
+
let o = wt(t, a, r[e + 1], i).flatMap((e) => t(e).is("span.alinea[data-alinea]") ? [e] : t(e).find("span.alinea[data-alinea]").get());
|
|
677
677
|
for (let e of o) {
|
|
678
678
|
let r = t(e).attr("data-alinea")?.trim();
|
|
679
679
|
if (!r) continue;
|
|
680
680
|
let i = `${a.id}-alinea-${r.replace(/\s+/gu, "")}`;
|
|
681
|
-
if (
|
|
681
|
+
if (Mt(n, i, e)) continue;
|
|
682
682
|
let o = t(e).attr("id");
|
|
683
683
|
if (o && o !== i) {
|
|
684
684
|
let r = t("<span></span>").attr("id", i);
|
|
685
685
|
t(e).before(r);
|
|
686
686
|
let a = r.get(0);
|
|
687
|
-
|
|
688
|
-
} else o &&
|
|
687
|
+
R(a) && At(n, i, a);
|
|
688
|
+
} else o && jt(n, o, e), t(e).attr("id", i), At(n, i, e);
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
691
|
return t.html();
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function kt(e) {
|
|
694
694
|
let t = /* @__PURE__ */ new Map();
|
|
695
695
|
for (let n of e("[id]").get()) {
|
|
696
696
|
let r = e(n).attr("id");
|
|
697
|
-
r &&
|
|
697
|
+
r && At(t, r, n);
|
|
698
698
|
}
|
|
699
699
|
return t;
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function At(e, t, n) {
|
|
702
702
|
let r = e.get(t);
|
|
703
703
|
r === void 0 && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
704
704
|
}
|
|
705
|
-
function
|
|
705
|
+
function jt(e, t, n) {
|
|
706
706
|
let r = e.get(t);
|
|
707
707
|
r !== void 0 && (r.delete(n), r.size === 0 && e.delete(t));
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function Mt(e, t, n) {
|
|
710
710
|
for (let r of e.get(t) ?? []) if (r !== n) return !0;
|
|
711
711
|
return !1;
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function Nt(e, t) {
|
|
714
714
|
let n = $e("sourceText" in t ? t.sourceText : "");
|
|
715
715
|
if (n) return e.filter((e) => e.kind === "directive_candidate").find((e) => {
|
|
716
716
|
let t = $e(e.text);
|
|
717
717
|
return t.length > 0 && (n.includes(t) || t.includes(n));
|
|
718
718
|
});
|
|
719
719
|
}
|
|
720
|
-
function
|
|
720
|
+
function Pt(e, t) {
|
|
721
721
|
if (t) return t.blockIds.map((t) => e.get(t)).find((e) => e?.kind === "directive_candidate");
|
|
722
722
|
}
|
|
723
|
-
function
|
|
723
|
+
function Ft(e) {
|
|
724
724
|
return e?.links.filter((t) => !t.insideFrenchQuotes && (t.type === "article" || t.type === "division") && t.id !== e.qualifiedVersion?.modifyingArticleId).map((e) => e.id) ?? [];
|
|
725
725
|
}
|
|
726
|
-
function
|
|
726
|
+
function It(e) {
|
|
727
727
|
if (e.kind === "noise") return !1;
|
|
728
|
-
let t =
|
|
728
|
+
let t = I(e.text.split("«", 1)[0]).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-"), n = /^(?:(?:\d+°|[ivxlcdm]+[.)]|[a-z][.)])\s*)?(?:est|sont)\s+(?:ainsi\s+)?(?:abroge|modifie|complete|supprime|remplace|retabli)\w*\b/u.test(t) ? t : t.split(/\b(?:est|sont|il|elle|ils|elles)\b/iu, 1)[0];
|
|
729
729
|
return /(?:\b(?:articles?|livres?|titres?|sous[- ]?titres?|chapitres?|sections?|sous[- ]?sections?|parties?|paragraphes?|sous[- ]?paragraphes?|annexes?|etats?)\s+(?:[lrda]\s*\.?\s*-?\s*\d|\d|[ivxlcdm]+(?:er|re)?(?=\s|$|[.,;:])|(?:premier|premiere|deuxieme|troisieme|quatrieme|cinquieme|sixieme|septieme|huitieme|neuvieme|dixieme)\b)|\b(?:premier|premiere|deuxieme|troisieme|quatrieme|cinquieme|sixieme|septieme|huitieme|neuvieme|dixieme)\s+(?:article|livre|titre|chapitre|section|sous[- ]?section|partie|paragraphe)\b|\b(?:annexes?|etats?)\s+[a-z](?:\s|$))/iu.test(n);
|
|
730
730
|
}
|
|
731
|
-
function
|
|
732
|
-
if (!
|
|
733
|
-
let
|
|
734
|
-
if (/[«»]/u.test(
|
|
735
|
-
let
|
|
736
|
-
if (!
|
|
737
|
-
let
|
|
738
|
-
if (/^\s*(\d+)°/u.exec(
|
|
739
|
-
let
|
|
740
|
-
if (!
|
|
741
|
-
let
|
|
731
|
+
function Lt(e, t) {
|
|
732
|
+
if (!t || t.articleId !== e.articleId || !/\br[ée]sultent\s+du\s+\d+°/iu.test(e.text)) return;
|
|
733
|
+
let n = (e) => I(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-"), r = n(e.text).replace(/«[^»]*»/gu, "");
|
|
734
|
+
if (/[«»]/u.test(r)) return;
|
|
735
|
+
let i = /\btels? qu['’]ils resultent du (\d+)°/u.exec(r);
|
|
736
|
+
if (!i || he(new j(r)).some((e) => [...a(e)].some((e) => e.type === "texte" && e.relative === void 0))) return;
|
|
737
|
+
let o = n(t.text);
|
|
738
|
+
if (/^\s*(\d+)°/u.exec(I(t.text))?.[1] !== i[1]) return;
|
|
739
|
+
let s = /\bles articles (.+?) deviennent respectivement les articles ([^;]+);?\s*$/u.exec(o);
|
|
740
|
+
if (!s) return;
|
|
741
|
+
let c = (e) => u(e.trim().replace(/^[lrda](?=[.\s\d])/u, (e) => e.toUpperCase())), l = (e) => {
|
|
742
742
|
let t = e.trim().split(/,\s*|\s+et\s+/u);
|
|
743
743
|
if (t.length === 0 || t.length > 64) return;
|
|
744
|
-
let n = t.map(
|
|
744
|
+
let n = t.map(c);
|
|
745
745
|
if (n.some((e) => e === void 0)) return;
|
|
746
746
|
let r = n;
|
|
747
747
|
return new Set(r).size === r.length ? r : void 0;
|
|
748
|
-
},
|
|
749
|
-
if (!
|
|
750
|
-
let
|
|
751
|
-
for (let e = 0; e <
|
|
752
|
-
let
|
|
748
|
+
}, d = l(s[1]), f = l(s[2].replace(/;\s*$/u, ""));
|
|
749
|
+
if (!d || !f || d.length !== f.length) return;
|
|
750
|
+
let p = /* @__PURE__ */ new Map();
|
|
751
|
+
for (let e = 0; e < d.length; e++) {
|
|
752
|
+
let r = t.links.filter((t) => t.type === "article" && !t.insideFrenchQuotes && c(n(t.text ?? "")) === d[e]), i = [...new Set(r.map((e) => e.id))];
|
|
753
753
|
if (i.length !== 1 || !i[0]) return;
|
|
754
|
-
|
|
754
|
+
p.set(f[e], i[0]);
|
|
755
755
|
}
|
|
756
|
-
let
|
|
757
|
-
for (let e of
|
|
758
|
-
let t =
|
|
756
|
+
let m = [];
|
|
757
|
+
for (let e of r.matchAll(/\baux articles (.+?)(?=,?\s+tels? qu|,\s*la reference|;|$)/gu)) {
|
|
758
|
+
let t = l(e[1]);
|
|
759
759
|
if (!t) return;
|
|
760
|
-
|
|
760
|
+
m.push(...t);
|
|
761
761
|
}
|
|
762
|
-
if (!(
|
|
762
|
+
if (!(m.length === 0 || m.some((e) => !p.has(e)))) return [...new Set(m.map((e) => p.get(e)))];
|
|
763
763
|
}
|
|
764
|
-
function
|
|
765
|
-
let t =
|
|
764
|
+
function Rt(e) {
|
|
765
|
+
let t = o(e.text);
|
|
766
766
|
if (t.length !== 1) return;
|
|
767
767
|
let n = e.links.filter((e) => e.type === "article" && !e.insideFrenchQuotes), r = n.filter((n) => {
|
|
768
768
|
let r = n.text ?? "", i = e.text.indexOf(r);
|
|
@@ -776,21 +776,21 @@ function It(e) {
|
|
|
776
776
|
modifyingArticleLabel: i.text ?? ""
|
|
777
777
|
};
|
|
778
778
|
}
|
|
779
|
-
function
|
|
780
|
-
let n =
|
|
779
|
+
function zt(e, t) {
|
|
780
|
+
let n = F(e);
|
|
781
781
|
if (!n) return;
|
|
782
|
-
let r =
|
|
782
|
+
let r = ce(n);
|
|
783
783
|
return r ? r.level : n.endsWith(":") ? (t ?? -1) + 1 : void 0;
|
|
784
784
|
}
|
|
785
|
-
function
|
|
786
|
-
let t = /* @__PURE__ */ new Map(), n = [], r =
|
|
785
|
+
function Bt(e) {
|
|
786
|
+
let t = /* @__PURE__ */ new Map(), n = [], r = S(e.map((e) => e.text)), i = -1;
|
|
787
787
|
for (let [a, o] of e.entries()) {
|
|
788
788
|
let e = r.get(a);
|
|
789
789
|
if (e && (i = e.endIndex), a <= i) {
|
|
790
790
|
t.set(o.id, [...n.map((e) => e.block), o]);
|
|
791
791
|
continue;
|
|
792
792
|
}
|
|
793
|
-
let s =
|
|
793
|
+
let s = zt(o.text, n.at(-1)?.level);
|
|
794
794
|
if (s === void 0) {
|
|
795
795
|
t.set(o.id, [...n.map((e) => e.block), o]);
|
|
796
796
|
continue;
|
|
@@ -803,14 +803,14 @@ function Rt(e) {
|
|
|
803
803
|
}
|
|
804
804
|
return t;
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function Vt(e, t) {
|
|
807
807
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
808
808
|
for (let i of [...e ?? [], ...t]) i !== void 0 && (r.has(i.id) || (r.add(i.id), n.push(i)));
|
|
809
809
|
return n;
|
|
810
810
|
}
|
|
811
|
-
function
|
|
811
|
+
function Ht(e, t, n) {
|
|
812
812
|
if (!t) return;
|
|
813
|
-
let r =
|
|
813
|
+
let r = Vt(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
|
|
814
814
|
if (r.length === 0) return;
|
|
815
815
|
let i = r.map((e) => e.id);
|
|
816
816
|
if (i.length === t.blockIds.length && i.every((e, n) => e === t.blockIds[n])) return;
|
|
@@ -825,7 +825,7 @@ function Bt(e, t, n) {
|
|
|
825
825
|
}
|
|
826
826
|
};
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function Ut(e) {
|
|
829
829
|
let t = [], n = 0;
|
|
830
830
|
for (let r of e.blocks) {
|
|
831
831
|
let i = e.directiveText.indexOf(r.text, n);
|
|
@@ -839,7 +839,7 @@ function Vt(e) {
|
|
|
839
839
|
}
|
|
840
840
|
return t;
|
|
841
841
|
}
|
|
842
|
-
function
|
|
842
|
+
function Wt(e, t, n) {
|
|
843
843
|
let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop > r && e.start < i);
|
|
844
844
|
if (a.length === 0) return;
|
|
845
845
|
let o = a[0], s = a[a.length - 1], c = o.start, l = s.stop;
|
|
@@ -853,7 +853,7 @@ function Ht(e, t, n) {
|
|
|
853
853
|
}
|
|
854
854
|
};
|
|
855
855
|
}
|
|
856
|
-
function
|
|
856
|
+
function Gt(e, t, n) {
|
|
857
857
|
if (!t) return;
|
|
858
858
|
let r = e.directiveText.indexOf(t.text);
|
|
859
859
|
if (r === -1) return;
|
|
@@ -866,11 +866,11 @@ function Ut(e, t, n) {
|
|
|
866
866
|
stop: a
|
|
867
867
|
};
|
|
868
868
|
}
|
|
869
|
-
function
|
|
869
|
+
function Kt(e, t, n) {
|
|
870
870
|
for (let r of [...t.get(e.id) ?? [e]].reverse()) {
|
|
871
871
|
let e = n.get(r.id);
|
|
872
872
|
if (!n.has(r.id)) {
|
|
873
|
-
let t = r.links.filter((e) => e.type === "text" && !e.insideFrenchQuotes), i = t.length > 0 ?
|
|
873
|
+
let t = r.links.filter((e) => e.type === "text" && !e.insideFrenchQuotes), i = t.length > 0 ? le(r.text) : [], a = [], o = !1;
|
|
874
874
|
for (let e of t) {
|
|
875
875
|
let t = e.text, n = t ? r.text.indexOf(t) : -1;
|
|
876
876
|
if (n < 0 || r.text.indexOf(t, n + 1) !== -1) {
|
|
@@ -888,7 +888,7 @@ function Wt(e, t, n) {
|
|
|
888
888
|
function B(e, t) {
|
|
889
889
|
return `${e}\0${Be(t)}`;
|
|
890
890
|
}
|
|
891
|
-
function
|
|
891
|
+
function qt(e) {
|
|
892
892
|
let t = new Map(e.map((e) => [e.id, e])), n = /* @__PURE__ */ new Map();
|
|
893
893
|
return (e, r) => {
|
|
894
894
|
if (r === void 0) return;
|
|
@@ -898,57 +898,57 @@ function Gt(e) {
|
|
|
898
898
|
if (r === void 0) return;
|
|
899
899
|
i = {
|
|
900
900
|
blockById: new Map(r.blocks.map((e) => [e.id, e])),
|
|
901
|
-
contextByBlockId:
|
|
901
|
+
contextByBlockId: Bt(r.blocks),
|
|
902
902
|
textIdsByBlockId: /* @__PURE__ */ new Map()
|
|
903
903
|
}, n.set(e, i);
|
|
904
904
|
}
|
|
905
905
|
let a = i.blockById.get(r);
|
|
906
|
-
return a === void 0 ? void 0 :
|
|
906
|
+
return a === void 0 ? void 0 : Kt(a, i.contextByBlockId, i.textIdsByBlockId);
|
|
907
907
|
};
|
|
908
908
|
}
|
|
909
|
-
function
|
|
910
|
-
let o = /* @__PURE__ */ new Map(),
|
|
909
|
+
function Jt(e, t, n, r, i) {
|
|
910
|
+
let o = /* @__PURE__ */ new Map(), s = new Set(e.blocks.flatMap((e) => {
|
|
911
911
|
if (!e.text.includes("Art.")) return [];
|
|
912
|
-
let t =
|
|
913
|
-
return t === void 0 ? [] :
|
|
912
|
+
let t = Kt(e, i, o);
|
|
913
|
+
return t === void 0 ? [] : f(Se(e.text).output).map(({ num: e }) => B(t, e));
|
|
914
914
|
}));
|
|
915
|
-
if (
|
|
916
|
-
let
|
|
915
|
+
if (s.size === 0) return /* @__PURE__ */ new Map();
|
|
916
|
+
let c = new Set([...s].map((e) => e.slice(e.indexOf("\0") + 1))), l = t.flatMap((t) => {
|
|
917
917
|
if (Ke(t.reference)) return [];
|
|
918
918
|
let s = new Set([...a(t.reference)].filter((e) => e.type === "article" && e.num).map((e) => e.num));
|
|
919
|
-
if (![...s].some((e) =>
|
|
920
|
-
let
|
|
921
|
-
if (!
|
|
922
|
-
let u =
|
|
919
|
+
if (![...s].some((e) => c.has(Be(e)))) return [];
|
|
920
|
+
let l = Pt(n, Wt(e, r, t)) ?? Nt(e.blocks, t);
|
|
921
|
+
if (!l) return [];
|
|
922
|
+
let u = Kt(l, i, o);
|
|
923
923
|
return u === void 0 ? [] : [{
|
|
924
|
-
block:
|
|
924
|
+
block: l,
|
|
925
925
|
directive: t,
|
|
926
926
|
nums: s,
|
|
927
927
|
textId: u
|
|
928
928
|
}];
|
|
929
929
|
});
|
|
930
|
-
if (
|
|
931
|
-
let
|
|
932
|
-
if (![...
|
|
933
|
-
let
|
|
930
|
+
if (l.length === 0) return /* @__PURE__ */ new Map();
|
|
931
|
+
let u = new Set(l.flatMap(({ nums: e, textId: t }) => [...e].map((e) => B(t, e))));
|
|
932
|
+
if (![...u].some((e) => s.has(e))) return /* @__PURE__ */ new Map();
|
|
933
|
+
let d = new Set(t.flatMap((t) => {
|
|
934
934
|
let a = We(t);
|
|
935
935
|
if (a.length === 0) return [];
|
|
936
|
-
let s =
|
|
936
|
+
let s = Pt(n, Wt(e, r, t)) ?? Nt(e.blocks, t);
|
|
937
937
|
if (!s) return [];
|
|
938
|
-
let c =
|
|
939
|
-
return c === void 0 ? [] : a.map(({ num: e }) => B(c, e)).filter((e) =>
|
|
938
|
+
let c = Kt(s, i, o);
|
|
939
|
+
return c === void 0 ? [] : a.map(({ num: e }) => B(c, e)).filter((e) => u.has(e));
|
|
940
940
|
})), p = /* @__PURE__ */ new Map();
|
|
941
|
-
for (let { block: e, directive: t, nums: n, textId: r } of
|
|
942
|
-
if (![...n].some((e) =>
|
|
943
|
-
let i = new Set(
|
|
941
|
+
for (let { block: e, directive: t, nums: n, textId: r } of l) {
|
|
942
|
+
if (![...n].some((e) => s.has(B(r, e)))) continue;
|
|
943
|
+
let i = new Set(he(new j(Se(t.sourceText).output)).flatMap((e) => [...a(e)].filter((e) => e.type === "article" && e.num).map((e) => e.num))), o = [...n].filter((e) => s.has(B(r, e)) && !d.has(B(r, e)) && [...i].some((t) => Be(t) === Be(e)));
|
|
944
944
|
o.length > 0 && p.set(e.id, [...new Set([...p.get(e.id) ?? [], ...o])]);
|
|
945
945
|
}
|
|
946
946
|
return p;
|
|
947
947
|
}
|
|
948
|
-
function
|
|
949
|
-
let n = performance.now(), r = performance.now(), i =
|
|
950
|
-
for (let t of e.blocks) t.qualifiedVersion =
|
|
951
|
-
let l = performance.now() - o, u = performance.now(), d = ee(), f = e.blocks[0], p = e.title !== void 0 && f?.text.startsWith(`${e.label}\n`) && (e.directiveText === f.text || e.directiveText.startsWith(`${f.text}\n`)), m = p && e.text.startsWith(`${e.label} ${e.title}`) ? " " : "", h =
|
|
948
|
+
function Yt(e, t) {
|
|
949
|
+
let n = performance.now(), r = performance.now(), i = Ut(e), a = performance.now() - r, o = performance.now(), s = new Map(e.blocks.map((e) => [e.id, e])), c = Bt(e.blocks);
|
|
950
|
+
for (let t of e.blocks) t.qualifiedVersion = Rt(t);
|
|
951
|
+
let l = performance.now() - o, u = performance.now(), d = ee(), f = e.blocks[0], p = e.title !== void 0 && f?.text.startsWith(`${e.label}\n`) && (e.directiveText === f.text || e.directiveText.startsWith(`${f.text}\n`)), m = p && e.text.startsWith(`${e.label} ${e.title}`) ? " " : "", h = b(p ? `${e.label}${m}${e.title}${e.directiveText.slice(f.text.length)}` : e.directiveText, t === void 0 ? void 0 : d);
|
|
952
952
|
if (p && !m) {
|
|
953
953
|
let t = e.label.length;
|
|
954
954
|
h = h.map((e) => ({
|
|
@@ -959,14 +959,14 @@ function qt(e, t) {
|
|
|
959
959
|
}
|
|
960
960
|
}));
|
|
961
961
|
}
|
|
962
|
-
let g = performance.now() - u, _ = performance.now(), v =
|
|
962
|
+
let g = performance.now() - u, _ = performance.now(), v = Jt(e, h, s, i, c), y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), S = [], C, w;
|
|
963
963
|
for (let t of e.blocks) {
|
|
964
|
-
let e =
|
|
965
|
-
(e.length > 0 || n !== void 0 || t.qualifiedVersion || v.has(t.id) ||
|
|
964
|
+
let e = Ft(t), n = e.length === 0 ? Lt(t, w) : void 0;
|
|
965
|
+
(e.length > 0 || n !== void 0 || t.qualifiedVersion || v.has(t.id) || It(t)) && (S = v.has(t.id) ? [] : n ?? e, C = t.qualifiedVersion), y.set(t.id, S), x.set(t.id, C), w = t;
|
|
966
966
|
}
|
|
967
967
|
l += performance.now() - _;
|
|
968
968
|
let te = performance.now(), ne = h.map((t) => {
|
|
969
|
-
let n =
|
|
969
|
+
let n = Wt(e, i, t), r = Pt(s, n) ?? Nt(e.blocks, t), a = Ft(r), o = r?.id !== void 0 && v.has(r.id) ? [] : a.length > 0 ? a : r?.id === void 0 ? [] : y.get(r.id) ?? [], l = Gt(e, r, t), u = Ht(r?.id === void 0 ? void 0 : c.get(r.id), n, s);
|
|
970
970
|
return {
|
|
971
971
|
articleId: e.id,
|
|
972
972
|
blockId: r?.id,
|
|
@@ -984,14 +984,14 @@ function qt(e, t) {
|
|
|
984
984
|
directive: t,
|
|
985
985
|
...r?.id !== void 0 && v.has(r.id) ? { internallyCreatedTargetNums: v.get(r.id) } : {},
|
|
986
986
|
...o.length > 0 || r?.id !== void 0 && v.has(r.id) ? { targetIds: o } : {},
|
|
987
|
-
...r?.id !== void 0 &&
|
|
987
|
+
...r?.id !== void 0 && x.get(r.id) ? { qualifiedVersion: x.get(r.id) } : {}
|
|
988
988
|
};
|
|
989
989
|
}), re = /* @__PURE__ */ new Set(), ie = /* @__PURE__ */ new Map(), ae = ne.flatMap((e) => {
|
|
990
990
|
let t = e.blockId ? s.get(e.blockId) : void 0;
|
|
991
991
|
if (!t || e.internallyCreatedTargetNums?.length) return [e];
|
|
992
992
|
if (re.has(t.id)) return [];
|
|
993
993
|
let n = ie.get(t.id);
|
|
994
|
-
if (n === void 0 && (n = Ie(t.text,
|
|
994
|
+
if (n === void 0 && (n = Ie(t.text, Ft(t), e.directive), ie.set(t.id, n)), !n) {
|
|
995
995
|
let n = e.directive, r = e.targetIds?.length === 1 && n.kind === "compound" ? Fe(t.text, n.operations.length) : null;
|
|
996
996
|
return [r ? {
|
|
997
997
|
...e,
|
|
@@ -1023,7 +1023,7 @@ function qt(e, t) {
|
|
|
1023
1023
|
totalMs: Math.round((performance.now() - n) * 10) / 10
|
|
1024
1024
|
}), ae;
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1026
|
+
function Xt(e, t) {
|
|
1027
1027
|
let n = /* @__PURE__ */ new Map(), r = [], i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
1028
1028
|
for (let o of e) {
|
|
1029
1029
|
let e = We(o.directive);
|
|
@@ -1063,7 +1063,7 @@ function Jt(e, t) {
|
|
|
1063
1063
|
definitions: r
|
|
1064
1064
|
};
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1066
|
+
function Zt(e, t, n, r) {
|
|
1067
1067
|
if (t.length === 0) return e;
|
|
1068
1068
|
let i = new Map(t.flatMap((e) => {
|
|
1069
1069
|
let t = r(e.articleId, e.blockId);
|
|
@@ -1086,7 +1086,7 @@ function Yt(e, t, n, r) {
|
|
|
1086
1086
|
};
|
|
1087
1087
|
});
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1089
|
+
function Qt(e) {
|
|
1090
1090
|
switch (e.kind) {
|
|
1091
1091
|
case "insert_after":
|
|
1092
1092
|
case "insert_before": return [e.insertText];
|
|
@@ -1104,8 +1104,8 @@ function Xt(e) {
|
|
|
1104
1104
|
default: return [];
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
|
-
function
|
|
1108
|
-
return e.flatMap((e) =>
|
|
1107
|
+
function $t(e) {
|
|
1108
|
+
return e.flatMap((e) => Qt(e.directive).filter((e) => /[«»]/u.test(e)).map((t) => ({
|
|
1109
1109
|
code: "nested_french_quote_in_redaction",
|
|
1110
1110
|
message: "Écart à la règle légistique détecté : une citation imbriquée dans une rédaction devrait utiliser des guillemets anglais et non des guillemets français.",
|
|
1111
1111
|
details: {
|
|
@@ -1117,18 +1117,18 @@ function Zt(e) {
|
|
|
1117
1117
|
}
|
|
1118
1118
|
})));
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1121
|
-
return
|
|
1120
|
+
function en(e) {
|
|
1121
|
+
return Qt(e).map((t) => ({
|
|
1122
1122
|
directiveKind: e.kind,
|
|
1123
1123
|
text: t
|
|
1124
1124
|
}));
|
|
1125
1125
|
}
|
|
1126
|
-
function
|
|
1126
|
+
function tn(e) {
|
|
1127
1127
|
let t = /* @__PURE__ */ new Set();
|
|
1128
1128
|
for (let n of e.matchAll(/«[^«»\n]+»/gu)) t.add(n[0]);
|
|
1129
1129
|
return Array.from(t);
|
|
1130
1130
|
}
|
|
1131
|
-
function
|
|
1131
|
+
function nn(e, t) {
|
|
1132
1132
|
let n = new Map(e.blocks.map((e) => [e.id, e])), r = t.sourceBlockIds ?? e.blocks.map((e) => e.id), i = [], a = 0;
|
|
1133
1133
|
for (let e of r) {
|
|
1134
1134
|
let t = n.get(e);
|
|
@@ -1140,11 +1140,11 @@ function en(e, t) {
|
|
|
1140
1140
|
}
|
|
1141
1141
|
return i;
|
|
1142
1142
|
}
|
|
1143
|
-
function
|
|
1143
|
+
function rn(e, t, n) {
|
|
1144
1144
|
return e.find((e) => t >= e.start && n <= e.stop);
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1147
|
-
let r =
|
|
1146
|
+
function an(e, t, n) {
|
|
1147
|
+
let r = tn(n), i = r.flatMap((t) => {
|
|
1148
1148
|
for (let n of e.blocks) {
|
|
1149
1149
|
let e = n.text.indexOf(t);
|
|
1150
1150
|
if (e !== -1) return [{
|
|
@@ -1163,7 +1163,7 @@ function nn(e, t, n) {
|
|
|
1163
1163
|
e.directiveText
|
|
1164
1164
|
].filter((e) => e !== void 0 && e.length > 0), o = a.find((e) => r.some((t) => e.includes(t))) ?? a[0];
|
|
1165
1165
|
if (!o) return [];
|
|
1166
|
-
let s =
|
|
1166
|
+
let s = nn(e, t);
|
|
1167
1167
|
if (s.length === 0) return [];
|
|
1168
1168
|
let c = [], l = 0;
|
|
1169
1169
|
for (let e of r) {
|
|
@@ -1171,7 +1171,7 @@ function nn(e, t, n) {
|
|
|
1171
1171
|
if (t === -1) continue;
|
|
1172
1172
|
let n = t + e.length;
|
|
1173
1173
|
l = n;
|
|
1174
|
-
let r =
|
|
1174
|
+
let r = rn(s, t, n);
|
|
1175
1175
|
r && c.push({
|
|
1176
1176
|
blockId: r.block.id,
|
|
1177
1177
|
start: t - r.start,
|
|
@@ -1181,15 +1181,15 @@ function nn(e, t, n) {
|
|
|
1181
1181
|
}
|
|
1182
1182
|
return c;
|
|
1183
1183
|
}
|
|
1184
|
-
function
|
|
1184
|
+
function on(e, t) {
|
|
1185
1185
|
let n = new Map(e.map((e) => [e.id, e]));
|
|
1186
1186
|
return t.flatMap((e) => {
|
|
1187
1187
|
let t = n.get(e.articleId);
|
|
1188
|
-
return t ?
|
|
1188
|
+
return t ? en(e.directive).filter(({ text: e }) => /[«»]/u.test(e)).map(({ directiveKind: n, text: r }) => ({
|
|
1189
1189
|
articleId: e.articleId,
|
|
1190
1190
|
code: "nested_french_quote_in_redaction",
|
|
1191
1191
|
message: "Écart à la règle légistique détecté : une citation imbriquée dans une rédaction devrait utiliser des guillemets anglais et non des guillemets français.",
|
|
1192
|
-
ranges:
|
|
1192
|
+
ranges: an(t, e, r),
|
|
1193
1193
|
severity: "warning",
|
|
1194
1194
|
details: {
|
|
1195
1195
|
blockId: e.blockId,
|
|
@@ -1200,8 +1200,8 @@ function rn(e, t) {
|
|
|
1200
1200
|
})) : [];
|
|
1201
1201
|
});
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1204
|
-
let n = new Map(e.flatMap((e) => [...
|
|
1203
|
+
function sn(e, t) {
|
|
1204
|
+
let n = new Map(e.flatMap((e) => [...S(e.blocks.map((e) => e.text))].map(([t, n]) => [e.blocks[t].id, {
|
|
1205
1205
|
articleId: e.id,
|
|
1206
1206
|
blockIds: e.blocks.slice(t - 1, n.endIndex + 1).map((e) => e.id),
|
|
1207
1207
|
...n
|
|
@@ -1223,7 +1223,7 @@ function an(e, t) {
|
|
|
1223
1223
|
}];
|
|
1224
1224
|
});
|
|
1225
1225
|
}
|
|
1226
|
-
function
|
|
1226
|
+
function cn(e, t) {
|
|
1227
1227
|
let n = new Map(e.flatMap((e) => e.blocks.map((e) => [e.id, e]))), r = /* @__PURE__ */ new Set();
|
|
1228
1228
|
return t.flatMap((e) => {
|
|
1229
1229
|
let t = e.blockId, i = e.internallyCreatedTargetNums;
|
|
@@ -1245,13 +1245,13 @@ function on(e, t) {
|
|
|
1245
1245
|
}] : [];
|
|
1246
1246
|
});
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1248
|
+
function ln(e, t, n, r, i, a, o = !0, s) {
|
|
1249
1249
|
let c = new ye("parsedBill.buildParsedDocument"), l = i.reduce((e, t) => e + t.blocks.length, 0), u = c.timeSync("buildDirectiveText", () => i.map((e) => e.directiveText).filter(Boolean).join("\n")), d = {
|
|
1250
1250
|
sourceFormat: e,
|
|
1251
1251
|
documentDate: r,
|
|
1252
1252
|
html: t,
|
|
1253
1253
|
htmlWithLinks: n,
|
|
1254
|
-
tableOfContents: a ?? c.timeSync("extractTableOfContents", () =>
|
|
1254
|
+
tableOfContents: a ?? c.timeSync("extractTableOfContents", () => x(u), { inputSize: u.length }),
|
|
1255
1255
|
articles: i
|
|
1256
1256
|
};
|
|
1257
1257
|
if (!o) {
|
|
@@ -1270,28 +1270,28 @@ function sn(e, t, n, r, i, a, o = !0, s) {
|
|
|
1270
1270
|
let f = c.timeSync("extractGlobalApplicabilityDate", () => Qe(i.map((e) => e.text).join("\n"))), p = [], m = c.timeSync("extractDirectivesFromArticles", () => {
|
|
1271
1271
|
let e = [];
|
|
1272
1272
|
for (let t of i) {
|
|
1273
|
-
let n =
|
|
1273
|
+
let n = Yt(t, c.enabled ? p : void 0);
|
|
1274
1274
|
e.push(...n);
|
|
1275
1275
|
}
|
|
1276
1276
|
return e;
|
|
1277
|
-
}, { count: i.length }), h =
|
|
1278
|
-
...
|
|
1279
|
-
...
|
|
1280
|
-
...
|
|
1277
|
+
}, { count: i.length }), h = qt(i), { createdArticlesByDirective: g, definitions: _ } = c.timeSync("buildInternalArticleDefinitions", () => Xt(m, h), { count: m.length }), v = c.timeSync("attachInternalArticleMetadata", () => Zt(m, _, g, h), { count: m.length }), ee = c.timeSync("collectNestedFrenchQuoteDiagnostics", () => $t(v), { count: v.length }), y = [...s ?? [], ...ee], b = c.timeSync("collectNestedFrenchQuoteAnnotations", () => [
|
|
1278
|
+
...on(i, v),
|
|
1279
|
+
...sn(i, v),
|
|
1280
|
+
...cn(i, v)
|
|
1281
1281
|
], { count: v.length }), S = {
|
|
1282
1282
|
...d,
|
|
1283
1283
|
...f ? { globalApplicabilityDate: f } : {},
|
|
1284
1284
|
..._.length > 0 ? { internalArticleDefinitions: _ } : {},
|
|
1285
1285
|
directives: v,
|
|
1286
|
-
...
|
|
1287
|
-
...
|
|
1286
|
+
...b.length > 0 ? { annotations: b } : {},
|
|
1287
|
+
...y.length > 0 ? { diagnostics: y } : {}
|
|
1288
1288
|
};
|
|
1289
1289
|
return c.log({
|
|
1290
|
-
annotationCount:
|
|
1290
|
+
annotationCount: b.length,
|
|
1291
1291
|
articleCount: i.length,
|
|
1292
1292
|
blockCount: l,
|
|
1293
1293
|
definitionCount: _.length,
|
|
1294
|
-
diagnosticCount:
|
|
1294
|
+
diagnosticCount: y.length,
|
|
1295
1295
|
directiveAnalysisIncluded: !0,
|
|
1296
1296
|
directiveCount: v.length,
|
|
1297
1297
|
actionDirectiveExtractionTotals: p.reduce((e, t) => ({
|
|
@@ -1372,18 +1372,18 @@ function sn(e, t, n, r, i, a, o = !0, s) {
|
|
|
1372
1372
|
slowDirectiveArticles: p.toSorted((e, t) => t.totalMs - e.totalMs).slice(0, 10)
|
|
1373
1373
|
}), S;
|
|
1374
1374
|
}
|
|
1375
|
-
function
|
|
1375
|
+
function un(e) {
|
|
1376
1376
|
return { items: e.map((e) => ({
|
|
1377
1377
|
id: e.id,
|
|
1378
1378
|
line: e.title ? `${e.label} : ${e.title}` : e.label,
|
|
1379
1379
|
type: "article"
|
|
1380
1380
|
})) };
|
|
1381
1381
|
}
|
|
1382
|
-
function
|
|
1383
|
-
return Array.from(
|
|
1382
|
+
function dn(e) {
|
|
1383
|
+
return Array.from(fe(e)).filter((e) => e.type === "article").map((e) => I(e.line.split(/[::]/u)[0]));
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1386
|
-
let i =
|
|
1385
|
+
function fn(e, t, n, r) {
|
|
1386
|
+
let i = yt(e), a = new Set(Array.from(n.matchAll(/\s+id=(?:"([^"]+)"|'([^']+)')/gu), (e) => e[1] ?? e[2])), o = Array.from(fe(t)).filter((e) => e.type === "article"), s = e.map((e) => r === "akoma-ntoso" ? e.num ? L(e.num) : w(e.html)("p.TCNumArticle").first().attr("id") ?? L(e.label) : e.id), c = o.map((e) => e.id);
|
|
1387
1387
|
(c.length !== s.length || c.some((e, t) => e !== s[t])) && i.push({
|
|
1388
1388
|
code: "article_toc_source_heading_mismatch",
|
|
1389
1389
|
message: "The table of contents differs from the parsed article headings",
|
|
@@ -1399,8 +1399,8 @@ function un(e, t, n, r) {
|
|
|
1399
1399
|
});
|
|
1400
1400
|
return i;
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1403
|
-
let r =
|
|
1402
|
+
function pn(e, t, n) {
|
|
1403
|
+
let r = dn(x(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), i = e.map((e) => I(e.label)), a = un(e), o = [...n, ...fn(e, a, t, "assemblee-html")];
|
|
1404
1404
|
if (r.length > 0 && (r.length !== i.length || r.some((e, t) => e !== i[t]))) {
|
|
1405
1405
|
let t = r.findIndex((e, t) => e !== i[t]);
|
|
1406
1406
|
o.push({
|
|
@@ -1424,13 +1424,13 @@ function dn(e, t, n) {
|
|
|
1424
1424
|
tableOfContents: a
|
|
1425
1425
|
};
|
|
1426
1426
|
}
|
|
1427
|
-
async function
|
|
1428
|
-
let n = new ye("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () =>
|
|
1427
|
+
async function mn(e, t) {
|
|
1428
|
+
let n = new ye("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => hn(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => Ot(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => w(i)), o = n.timeSync("extractArticleHeadings", () => xt(a)), s = new Set(o.map((e) => e.id)), c = ht(a).filter((e) => !s.has(L(e.num ?? e.label))).map((e) => e.label), l = c.length > 0 ? [{
|
|
1429
1429
|
code: "article_toc_source_heading_mismatch",
|
|
1430
1430
|
message: "Some structural article headings were not retained",
|
|
1431
1431
|
details: { discardedCandidates: c }
|
|
1432
|
-
}] : [], u =
|
|
1433
|
-
let n =
|
|
1432
|
+
}] : [], u = dt(a), d = n.timeSync("extractArticlesAndBlocks", () => o.map((e, t) => {
|
|
1433
|
+
let n = wt(a, e, o[t + 1], u), r = Et(a, e.id, n, e), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
1434
1434
|
return {
|
|
1435
1435
|
id: e.id,
|
|
1436
1436
|
label: e.label,
|
|
@@ -1441,7 +1441,7 @@ async function fn(e, t) {
|
|
|
1441
1441
|
directiveText: i,
|
|
1442
1442
|
blocks: r
|
|
1443
1443
|
};
|
|
1444
|
-
}), { count: o.length }), f = n.timeSync("injectHiddenArticleSummary", () =>
|
|
1444
|
+
}), { count: o.length }), f = n.timeSync("injectHiddenArticleSummary", () => Dt(a.html(), d)), { diagnostics: p, tableOfContents: m } = n.timeSync("buildAssembleeTableOfContents", () => pn(d, f, l), { count: d.length }), h = n.timeSync("buildParsedDocument", () => ln("assemblee-html", e, f, t.date, d, m, t.includeDirectiveAnalysis, p));
|
|
1445
1445
|
return h.diagnostics?.length && process.env.TISSEUSE_WARN_PARSED_BILL_DIAGNOSTICS === "1" && console.warn("Assemblée bill parsing diagnostics", h.diagnostics), n.log({
|
|
1446
1446
|
articleCount: h.articles.length,
|
|
1447
1447
|
blockCount: h.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -1449,7 +1449,7 @@ async function fn(e, t) {
|
|
|
1449
1449
|
targetDirectiveCount: h.directives.filter((e) => e.targetIds !== void 0).length
|
|
1450
1450
|
}), h;
|
|
1451
1451
|
}
|
|
1452
|
-
async function
|
|
1452
|
+
async function hn(e, t) {
|
|
1453
1453
|
return {
|
|
1454
1454
|
sourceFormat: "assemblee-html",
|
|
1455
1455
|
documentDate: t.date,
|
|
@@ -1460,7 +1460,7 @@ async function pn(e, t) {
|
|
|
1460
1460
|
function V(e) {
|
|
1461
1461
|
return e.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
1462
1462
|
}
|
|
1463
|
-
function
|
|
1463
|
+
function gn(e) {
|
|
1464
1464
|
let t = e;
|
|
1465
1465
|
for (let e = 0; e < 3; e++) {
|
|
1466
1466
|
let e = t;
|
|
@@ -1468,27 +1468,27 @@ function mn(e) {
|
|
|
1468
1468
|
}
|
|
1469
1469
|
return t;
|
|
1470
1470
|
}
|
|
1471
|
-
function
|
|
1471
|
+
function _n(e) {
|
|
1472
1472
|
return /(?:<|&lt;)\/?(?:p|br|span|b|i|u|sup|sub|table|thead|tbody|tr|th|td|ul|ol|li)\b/iu.test(e);
|
|
1473
1473
|
}
|
|
1474
1474
|
function H(e) {
|
|
1475
1475
|
return e.name.replace(/^.*:/u, "");
|
|
1476
1476
|
}
|
|
1477
|
-
function
|
|
1477
|
+
function vn(e, t) {
|
|
1478
1478
|
return t.children.map((t) => U(e, t)).filter(Boolean).join("");
|
|
1479
1479
|
}
|
|
1480
|
-
function
|
|
1481
|
-
return t.children.map((t) => t.type === "text" &&
|
|
1480
|
+
function yn(e, t) {
|
|
1481
|
+
return t.children.map((t) => t.type === "text" && _n(t.data) ? gn(t.data) : U(e, t)).filter(Boolean).join("");
|
|
1482
1482
|
}
|
|
1483
1483
|
function U(e, t) {
|
|
1484
1484
|
if (t.type === "text") {
|
|
1485
1485
|
let e = t.data.replace(/\s+\./gu, ".");
|
|
1486
|
-
return
|
|
1486
|
+
return _n(e) ? gn(e) : V(e);
|
|
1487
1487
|
}
|
|
1488
|
-
if (!
|
|
1489
|
-
let n = H(t), r = () =>
|
|
1488
|
+
if (!R(t)) return "";
|
|
1489
|
+
let n = H(t), r = () => vn(e, t);
|
|
1490
1490
|
switch (n) {
|
|
1491
|
-
case "p": return `<p${
|
|
1491
|
+
case "p": return `<p${Sn(e, t, [
|
|
1492
1492
|
"id",
|
|
1493
1493
|
"class",
|
|
1494
1494
|
"align",
|
|
@@ -1502,13 +1502,13 @@ function U(e, t) {
|
|
|
1502
1502
|
case "u":
|
|
1503
1503
|
case "sup":
|
|
1504
1504
|
case "sub":
|
|
1505
|
-
case "abbr": return `<${n}${
|
|
1505
|
+
case "abbr": return `<${n}${Sn(e, t, [
|
|
1506
1506
|
"id",
|
|
1507
1507
|
"class",
|
|
1508
1508
|
"title",
|
|
1509
1509
|
"style"
|
|
1510
1510
|
])}>${r()}</${n}>`;
|
|
1511
|
-
case "a": return `<a href="${V(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${
|
|
1511
|
+
case "a": return `<a href="${V(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${Sn(e, t, [
|
|
1512
1512
|
"id",
|
|
1513
1513
|
"class",
|
|
1514
1514
|
"title",
|
|
@@ -1519,8 +1519,8 @@ function U(e, t) {
|
|
|
1519
1519
|
case "tbody":
|
|
1520
1520
|
case "tr":
|
|
1521
1521
|
case "th":
|
|
1522
|
-
case "td": return
|
|
1523
|
-
case "caption": return `<caption${
|
|
1522
|
+
case "td": return Cn(e, t, n, r());
|
|
1523
|
+
case "caption": return `<caption${Sn(e, t, [
|
|
1524
1524
|
"id",
|
|
1525
1525
|
"class",
|
|
1526
1526
|
"align",
|
|
@@ -1528,12 +1528,12 @@ function U(e, t) {
|
|
|
1528
1528
|
])}>${r()}</caption>`;
|
|
1529
1529
|
case "num": return `<span class="akn-num">${r()}</span> `;
|
|
1530
1530
|
case "heading": return `<p class="akn-heading">${r()}</p>`;
|
|
1531
|
-
case "content": return
|
|
1532
|
-
case "alinea": return
|
|
1533
|
-
case "article": return
|
|
1531
|
+
case "content": return yn(e, t);
|
|
1532
|
+
case "alinea": return Rn(e, t, "div", "akn-alinea");
|
|
1533
|
+
case "article": return Rn(e, t, "article", "akn-article");
|
|
1534
1534
|
case "blockList":
|
|
1535
1535
|
case "list": return `<div class="akn-list">${r()}</div>`;
|
|
1536
|
-
case "item": return
|
|
1536
|
+
case "item": return Rn(e, t, "div", "akn-item");
|
|
1537
1537
|
case "listIntroduction":
|
|
1538
1538
|
case "listWrapUp":
|
|
1539
1539
|
case "intro":
|
|
@@ -1549,12 +1549,12 @@ function U(e, t) {
|
|
|
1549
1549
|
case "book":
|
|
1550
1550
|
case "tome":
|
|
1551
1551
|
case "subchapter":
|
|
1552
|
-
case "subsection": return
|
|
1552
|
+
case "subsection": return Rn(e, t, "section", `akn-${n}`);
|
|
1553
1553
|
case "crossHeading": return `<p class="akn-cross-heading">${r()}</p>`;
|
|
1554
1554
|
default: return r();
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
|
-
function
|
|
1557
|
+
function bn(e, t) {
|
|
1558
1558
|
let n = e(t).text();
|
|
1559
1559
|
if (!n.includes("«") || !n.includes("»") || e(t).find("table").length > 0) return;
|
|
1560
1560
|
let r = e(t).find("tr").get().filter((n) => e(n).closest("table").get(0) === t);
|
|
@@ -1565,28 +1565,28 @@ function vn(e, t) {
|
|
|
1565
1565
|
let l = s ? o[0] : void 0, u = c ? o.at(-1) : void 0;
|
|
1566
1566
|
if (l) {
|
|
1567
1567
|
let t = Number(e(l).attr("rowspan") ?? "1");
|
|
1568
|
-
if (!Number.isInteger(t) || t < 1 || t > r.length - n || t > 1 &&
|
|
1568
|
+
if (!Number.isInteger(t) || t < 1 || t > r.length - n || t > 1 && F(e(l).text()) !== "«") return [];
|
|
1569
1569
|
i = t - 1;
|
|
1570
1570
|
}
|
|
1571
1571
|
if (u) {
|
|
1572
1572
|
let t = Number(e(u).attr("rowspan") ?? "1");
|
|
1573
|
-
if (!Number.isInteger(t) || t < 1 || t > r.length - n || t > 1 && !/^»\s*;?$/u.test(
|
|
1573
|
+
if (!Number.isInteger(t) || t < 1 || t > r.length - n || t > 1 && !/^»\s*;?$/u.test(F(e(u).text()))) return [];
|
|
1574
1574
|
a = t - 1;
|
|
1575
1575
|
}
|
|
1576
1576
|
return [l, u];
|
|
1577
1577
|
});
|
|
1578
1578
|
if (o.some((e) => e.length !== 2)) return;
|
|
1579
|
-
let s = o.map(([t]) => t ?
|
|
1579
|
+
let s = o.map(([t]) => t ? F(e(t).text()) : ""), c = o.map(([, t]) => t ? F(e(t).text()) : "");
|
|
1580
1580
|
if (!(s.filter((e) => e === "«").length !== 1 || c.filter((e) => /^»\s*;?$/u.test(e)).length !== 1 || s.some((e) => e !== "" && e !== "«") || c.some((e) => e !== "" && !/^»\s*;?$/u.test(e)) || o.some(([t, n]) => [t, n].some((t) => t && e(t).attr("colspan") !== void 0))) && !(s.indexOf("«") > c.findIndex((e) => e.startsWith("»")))) {
|
|
1581
1581
|
e(t).addClass("akn-quoted-table");
|
|
1582
1582
|
for (let [t, n] of o) t && e(t).addClass("akn-quote-column"), n && e(n).addClass("akn-quote-column");
|
|
1583
1583
|
}
|
|
1584
1584
|
}
|
|
1585
|
-
function
|
|
1586
|
-
let n = e(t).find("td,th").get(), r = e(n.find((t) => e(t).hasClass("akn-quote-column") && /^»\s*;?$/u.test(
|
|
1587
|
-
return `« ${n.filter((t) => !e(t).hasClass("akn-quote-column")).map((t) =>
|
|
1585
|
+
function xn(e, t) {
|
|
1586
|
+
let n = e(t).find("td,th").get(), r = e(n.find((t) => e(t).hasClass("akn-quote-column") && /^»\s*;?$/u.test(F(e(t).text())))).text();
|
|
1587
|
+
return `« ${n.filter((t) => !e(t).hasClass("akn-quote-column")).map((t) => F(e(t).text())).filter(Boolean).join(" ")} »${r.includes(";") ? " ;" : ""}`;
|
|
1588
1588
|
}
|
|
1589
|
-
function
|
|
1589
|
+
function Sn(e, t, n, r = {}) {
|
|
1590
1590
|
let i = [];
|
|
1591
1591
|
for (let r of n) {
|
|
1592
1592
|
if (r === "style") continue;
|
|
@@ -1596,8 +1596,8 @@ function bn(e, t, n, r = {}) {
|
|
|
1596
1596
|
let a = r.style ?? e(t).attr("style");
|
|
1597
1597
|
return a && i.push(`style="${V(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
|
|
1598
1598
|
}
|
|
1599
|
-
function
|
|
1600
|
-
return `<${n}${
|
|
1599
|
+
function Cn(e, t, n, r) {
|
|
1600
|
+
return `<${n}${Sn(e, t, [
|
|
1601
1601
|
"id",
|
|
1602
1602
|
"class",
|
|
1603
1603
|
"colspan",
|
|
@@ -1610,105 +1610,105 @@ function xn(e, t, n, r) {
|
|
|
1610
1610
|
"cellspacing",
|
|
1611
1611
|
"cellpadding",
|
|
1612
1612
|
"style"
|
|
1613
|
-
], { style:
|
|
1613
|
+
], { style: wn(e, t, n) })}>${r}</${n}>`;
|
|
1614
1614
|
}
|
|
1615
|
-
function
|
|
1615
|
+
function wn(e, t, n) {
|
|
1616
1616
|
let r = e(t).attr("style") ?? "";
|
|
1617
|
-
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r =
|
|
1617
|
+
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = Tn(r, "text-align", "center")), r || void 0;
|
|
1618
1618
|
}
|
|
1619
|
-
function
|
|
1619
|
+
function Tn(e, t, n) {
|
|
1620
1620
|
let r = e.trim();
|
|
1621
1621
|
return `${r}${r && !r.endsWith(";") ? ";" : ""} ${t}: ${n};`.trim();
|
|
1622
1622
|
}
|
|
1623
|
-
function
|
|
1624
|
-
let n = [
|
|
1623
|
+
function En(e, t) {
|
|
1624
|
+
let n = [F(e(t).children("num").first().text()), F(e(t).children("heading").first().text())].filter(Boolean);
|
|
1625
1625
|
return n.length === 0 ? "" : `<p class="akn-heading">${V(n.join(" "))}</p>`;
|
|
1626
1626
|
}
|
|
1627
|
-
function
|
|
1627
|
+
function Dn(e, t) {
|
|
1628
1628
|
if (!t) return !1;
|
|
1629
|
-
let n = (e) =>
|
|
1630
|
-
return n(
|
|
1629
|
+
let n = (e) => F(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
|
|
1630
|
+
return n(F(e.replace(/<[^>]*>/gu, " ").replace(/ /gu, " ").replace(/ /giu, " ").replace(/–/giu, "–"))).startsWith(n(t));
|
|
1631
1631
|
}
|
|
1632
|
-
function
|
|
1632
|
+
function On(e) {
|
|
1633
1633
|
let t = V(e);
|
|
1634
1634
|
return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}" data-pastille="${t}"></span></p>`;
|
|
1635
1635
|
}
|
|
1636
|
-
function
|
|
1637
|
-
return
|
|
1636
|
+
function kn(e, t) {
|
|
1637
|
+
return An([jn({
|
|
1638
1638
|
content: e,
|
|
1639
1639
|
pastille: t
|
|
1640
1640
|
})]);
|
|
1641
1641
|
}
|
|
1642
|
-
function
|
|
1642
|
+
function An(e) {
|
|
1643
1643
|
return `<table class="fixed-size large akn-pastille-table"><colgroup><col style="width: 5.0%;" class="texte-col-0 texte-col-pastille"><col style="width: 95.0%;" class="texte-col-1"></colgroup><tbody>${e.join("\n")}</tbody></table>`;
|
|
1644
1644
|
}
|
|
1645
|
-
function
|
|
1645
|
+
function jn({ content: e, pastille: t, style: n, contextClass: r }) {
|
|
1646
1646
|
let i = n ? ` style="${V(n)}"` : "", a = r ? ` ${V(r)}` : "";
|
|
1647
|
-
return `<tr${r ? ` class="${V(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${
|
|
1647
|
+
return `<tr${r ? ` class="${V(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${On(t)}</div></td><td style="overflow: hidden; width: 95.0%;" class="texte-col-1 no-right-border"><div class="tableauComparatifCell${a}"${i}>${e}</div></td></tr>`;
|
|
1648
1648
|
}
|
|
1649
|
-
function
|
|
1649
|
+
function Mn({ content: e, style: t, contextClass: n }) {
|
|
1650
1650
|
let r = t ? ` style="${V(t)}"` : "", i = n ? ` ${V(n)}` : "";
|
|
1651
1651
|
return `<tr${n ? ` class="${V(n)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 no-right-border"><div class="tableauComparatifCell${i}"><p class="pastille"><br></p></div></td><td style="overflow: hidden; width: 95.0%;" class="texte-col-1 no-right-border"><div class="tableauComparatifCell${i}"${r}>${e}</div></td></tr>`;
|
|
1652
1652
|
}
|
|
1653
|
-
function
|
|
1653
|
+
function Nn(e, t) {
|
|
1654
1654
|
return e(t).attr("data:pastille") ?? e(t).attr("pastille");
|
|
1655
1655
|
}
|
|
1656
|
-
function
|
|
1656
|
+
function Pn(e, t) {
|
|
1657
1657
|
return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
|
|
1658
1658
|
}
|
|
1659
|
-
function
|
|
1660
|
-
return e(t).children().get().filter((e) =>
|
|
1659
|
+
function Fn(e, t) {
|
|
1660
|
+
return e(t).children().get().filter((e) => R(e) ? H(e) === "content" : !1).map((t) => U(e, t)).filter(Boolean).join("\n");
|
|
1661
1661
|
}
|
|
1662
|
-
function
|
|
1662
|
+
function In(e, t) {
|
|
1663
1663
|
let n = [];
|
|
1664
1664
|
return e(t).children().each((t, r) => {
|
|
1665
|
-
if (!
|
|
1665
|
+
if (!R(r)) return;
|
|
1666
1666
|
let i = H(r);
|
|
1667
1667
|
i === "num" || i === "heading" || i === "content" || n.push(U(e, r));
|
|
1668
1668
|
}), n.filter(Boolean);
|
|
1669
1669
|
}
|
|
1670
|
-
function
|
|
1671
|
-
let n = [], r = H(t), i = r === "alinea" ?
|
|
1670
|
+
function Ln(e, t) {
|
|
1671
|
+
let n = [], r = H(t), i = r === "alinea" ? Nn(e, t) : void 0, a = Fn(e, t), o = zn(e, t, r, i), s = Gn(e, t);
|
|
1672
1672
|
if (i) {
|
|
1673
|
-
let r = [
|
|
1674
|
-
|
|
1673
|
+
let r = [Dn(a, F(e(t).children("num").first().text())) ? "" : En(e, t), a].filter(Boolean).join("\n");
|
|
1674
|
+
F(r) && n.push(jn({
|
|
1675
1675
|
content: r,
|
|
1676
1676
|
pastille: i,
|
|
1677
1677
|
style: o,
|
|
1678
1678
|
contextClass: s
|
|
1679
1679
|
}));
|
|
1680
|
-
} else a && n.push(
|
|
1680
|
+
} else a && n.push(Mn({
|
|
1681
1681
|
content: a,
|
|
1682
1682
|
style: o,
|
|
1683
1683
|
contextClass: s
|
|
1684
1684
|
}));
|
|
1685
1685
|
for (let r of e(t).children().get()) {
|
|
1686
|
-
if (!
|
|
1686
|
+
if (!R(r)) continue;
|
|
1687
1687
|
let t = H(r);
|
|
1688
|
-
t === "num" || t === "heading" || t === "content" || (t === "alinea" ||
|
|
1688
|
+
t === "num" || t === "heading" || t === "content" || (t === "alinea" || Pn(e, r)) && n.push(...Ln(e, r));
|
|
1689
1689
|
}
|
|
1690
1690
|
return n;
|
|
1691
1691
|
}
|
|
1692
|
-
function
|
|
1693
|
-
let i = H(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o =
|
|
1692
|
+
function Rn(e, t, n, r) {
|
|
1693
|
+
let i = H(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = Nn(e, t), s = zn(e, t, i, o), c = [`<${n} ${[
|
|
1694
1694
|
a ? `id="${V(a)}"` : void 0,
|
|
1695
1695
|
`class="${r}"`,
|
|
1696
1696
|
o ? `data-pastille="${V(o)}"` : void 0,
|
|
1697
1697
|
s ? `style="${V(s)}"` : void 0
|
|
1698
1698
|
].filter((e) => e !== void 0).join(" ")}>`];
|
|
1699
1699
|
if (i === "part" || i === "title") {
|
|
1700
|
-
let r =
|
|
1700
|
+
let r = Hn(e, t, i), a = Wn(e, t), o = r ? [Mn({
|
|
1701
1701
|
content: r,
|
|
1702
1702
|
contextClass: a
|
|
1703
1703
|
})] : [], s = () => {
|
|
1704
|
-
o.length !== 0 && (c.push(
|
|
1704
|
+
o.length !== 0 && (c.push(Vn(o)), o = []);
|
|
1705
1705
|
};
|
|
1706
1706
|
return e(t).children().each((t, n) => {
|
|
1707
|
-
if (!
|
|
1707
|
+
if (!R(n)) return;
|
|
1708
1708
|
let r = H(n);
|
|
1709
1709
|
if (!(r === "num" || r === "heading" || r === "content")) {
|
|
1710
1710
|
if (r === "alinea") {
|
|
1711
|
-
o.push(...
|
|
1711
|
+
o.push(...Ln(e, n));
|
|
1712
1712
|
return;
|
|
1713
1713
|
}
|
|
1714
1714
|
s(), c.push(U(e, n));
|
|
@@ -1716,49 +1716,49 @@ function In(e, t, n, r) {
|
|
|
1716
1716
|
}), s(), c.push(`</${n}>`), c.join("\n");
|
|
1717
1717
|
}
|
|
1718
1718
|
if (i === "article") {
|
|
1719
|
-
let r =
|
|
1719
|
+
let r = F(e(t).children("num").first().text()), i = F(e(t).children("heading").first().text()), a = m(r) ?? {
|
|
1720
1720
|
label: r,
|
|
1721
1721
|
num: r
|
|
1722
1722
|
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${V(`_TocArt${(a.num ?? r).replace(/\s+/gu, "")}`)}">${V(a.label)}${i ? ` : ${V(i)}` : ""}</p>`;
|
|
1723
|
-
if (
|
|
1724
|
-
let r = [
|
|
1723
|
+
if (Pn(e, t)) {
|
|
1724
|
+
let r = [Mn({
|
|
1725
1725
|
content: o,
|
|
1726
|
-
contextClass:
|
|
1727
|
-
}), ...
|
|
1728
|
-
c.push(
|
|
1729
|
-
for (let n of
|
|
1726
|
+
contextClass: qn(a.label)
|
|
1727
|
+
}), ...Ln(e, t)];
|
|
1728
|
+
c.push(An(r));
|
|
1729
|
+
for (let n of In(e, t)) n.includes("akn-pastille-table") || c.push(n);
|
|
1730
1730
|
return c.push(`</${n}>`), c.join("\n");
|
|
1731
1731
|
}
|
|
1732
1732
|
c.push(o);
|
|
1733
1733
|
}
|
|
1734
1734
|
let l = [];
|
|
1735
1735
|
for (let n of ["content", "children"]) e(t).children().each((t, r) => {
|
|
1736
|
-
if (!
|
|
1736
|
+
if (!R(r)) return;
|
|
1737
1737
|
let i = H(r);
|
|
1738
1738
|
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(U(e, r));
|
|
1739
1739
|
});
|
|
1740
1740
|
let u = l.join("\n");
|
|
1741
1741
|
if (i !== "article") {
|
|
1742
|
-
let n =
|
|
1742
|
+
let n = Dn(u, F(e(t).children("num").first().text())) ? "" : En(e, t);
|
|
1743
1743
|
n && c.push(n);
|
|
1744
1744
|
}
|
|
1745
|
-
return c.push(o ?
|
|
1745
|
+
return c.push(o ? kn(u, o) : u), c.push(`</${n}>`), c.join("\n");
|
|
1746
1746
|
}
|
|
1747
|
-
function
|
|
1748
|
-
let i =
|
|
1749
|
-
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i =
|
|
1747
|
+
function zn(e, t, n, r) {
|
|
1748
|
+
let i = Bn(e(t).attr("style") ?? "", "font-family");
|
|
1749
|
+
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = Tn(i, "text-align", "center")), i || void 0;
|
|
1750
1750
|
}
|
|
1751
|
-
function
|
|
1751
|
+
function Bn(e, t) {
|
|
1752
1752
|
return e.split(";").map((e) => e.trim()).filter(Boolean).filter((e) => !e.toLowerCase().startsWith(`${t.toLowerCase()}:`)).join(";");
|
|
1753
1753
|
}
|
|
1754
|
-
function
|
|
1754
|
+
function Vn(e) {
|
|
1755
1755
|
return `<table class="fixed-size large akn-section-table"><colgroup><col style="width: 5.0%;" class="texte-col-0 texte-col-pastille"><col style="width: 95.0%;" class="texte-col-1"></colgroup><tbody>${e.join("\n")}</tbody></table>`;
|
|
1756
1756
|
}
|
|
1757
|
-
function
|
|
1758
|
-
let r =
|
|
1757
|
+
function Hn(e, t, n) {
|
|
1758
|
+
let r = F(e(t).children("num").first().text()), i = F(e(t).children("heading").first().text()), a = Un(n), o = [];
|
|
1759
1759
|
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${V(r)}</span></p>`), i && o.push(`<p class="${a.heading} as-text dispositif"><span aria-label="">${V(i)}</span></p>`), o.join("\n");
|
|
1760
1760
|
}
|
|
1761
|
-
function
|
|
1761
|
+
function Un(e) {
|
|
1762
1762
|
switch (e) {
|
|
1763
1763
|
case "part": return {
|
|
1764
1764
|
num: "TCNumPartie",
|
|
@@ -1782,22 +1782,22 @@ function Vn(e) {
|
|
|
1782
1782
|
};
|
|
1783
1783
|
}
|
|
1784
1784
|
}
|
|
1785
|
-
function
|
|
1786
|
-
let n =
|
|
1785
|
+
function Wn(e, t) {
|
|
1786
|
+
let n = Kn(F(e(t).children("num").first().text()));
|
|
1787
1787
|
if (n) return n;
|
|
1788
1788
|
for (let n of e(t).parents().get()) {
|
|
1789
|
-
if (!
|
|
1789
|
+
if (!R(n)) continue;
|
|
1790
1790
|
let t = H(n);
|
|
1791
1791
|
if (t !== "title" && t !== "part") continue;
|
|
1792
|
-
let r =
|
|
1792
|
+
let r = Kn(F(e(n).children("num").first().text()));
|
|
1793
1793
|
if (r) return r;
|
|
1794
1794
|
}
|
|
1795
1795
|
}
|
|
1796
|
-
function
|
|
1797
|
-
return
|
|
1796
|
+
function Gn(e, t) {
|
|
1797
|
+
return Wn(e, t);
|
|
1798
1798
|
}
|
|
1799
|
-
function
|
|
1800
|
-
let [t, ...n] =
|
|
1799
|
+
function Kn(e) {
|
|
1800
|
+
let [t, ...n] = F(e).split(/\s+/u);
|
|
1801
1801
|
if (!t || n.length === 0) return;
|
|
1802
1802
|
let r = t.toLocaleLowerCase("fr-FR");
|
|
1803
1803
|
if ([
|
|
@@ -1807,10 +1807,10 @@ function Wn(e) {
|
|
|
1807
1807
|
"section"
|
|
1808
1808
|
].includes(r)) return `${r}-${n.join("_")}`;
|
|
1809
1809
|
}
|
|
1810
|
-
function
|
|
1811
|
-
return `article-${
|
|
1810
|
+
function qn(e) {
|
|
1811
|
+
return `article-${F(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
|
|
1812
1812
|
}
|
|
1813
|
-
function
|
|
1813
|
+
function Jn(e) {
|
|
1814
1814
|
switch (e) {
|
|
1815
1815
|
case "part": return "partie";
|
|
1816
1816
|
case "book": return "livre";
|
|
@@ -1822,11 +1822,11 @@ function Kn(e) {
|
|
|
1822
1822
|
default: return;
|
|
1823
1823
|
}
|
|
1824
1824
|
}
|
|
1825
|
-
function
|
|
1826
|
-
return [
|
|
1825
|
+
function Yn(e, t) {
|
|
1826
|
+
return [F(e(t).children("num").first().text()), F(e(t).children("heading").first().text())].filter(Boolean).join(" ");
|
|
1827
1827
|
}
|
|
1828
|
-
function
|
|
1829
|
-
let n =
|
|
1828
|
+
function Xn(e, t) {
|
|
1829
|
+
let n = F(e(t).children("num").first().text()), r = F(e(t).children("heading").first().text()), i = m(n) ?? {
|
|
1830
1830
|
label: n,
|
|
1831
1831
|
num: n
|
|
1832
1832
|
};
|
|
@@ -1836,24 +1836,24 @@ function Jn(e, t) {
|
|
|
1836
1836
|
type: "article"
|
|
1837
1837
|
};
|
|
1838
1838
|
}
|
|
1839
|
-
function
|
|
1839
|
+
function Zn(e, t) {
|
|
1840
1840
|
e.items.push(...t.items);
|
|
1841
1841
|
}
|
|
1842
|
-
function
|
|
1842
|
+
function Qn(e, t) {
|
|
1843
1843
|
let n = { items: [] };
|
|
1844
1844
|
return e(t).children().each((t, r) => {
|
|
1845
|
-
if (!
|
|
1845
|
+
if (!R(r)) return;
|
|
1846
1846
|
let i = H(r);
|
|
1847
1847
|
if (i === "article") {
|
|
1848
|
-
n.items.push(
|
|
1848
|
+
n.items.push(Xn(e, r));
|
|
1849
1849
|
return;
|
|
1850
1850
|
}
|
|
1851
|
-
let a =
|
|
1851
|
+
let a = Jn(i);
|
|
1852
1852
|
if (!a) {
|
|
1853
|
-
|
|
1853
|
+
Zn(n, Qn(e, r));
|
|
1854
1854
|
return;
|
|
1855
1855
|
}
|
|
1856
|
-
let o =
|
|
1856
|
+
let o = Yn(e, r), s = Qn(e, r);
|
|
1857
1857
|
!o && s.items.length === 0 || n.items.push({
|
|
1858
1858
|
...s,
|
|
1859
1859
|
id: e(r).attr("eId") ?? e(r).attr("GUID"),
|
|
@@ -1862,27 +1862,27 @@ function Xn(e, t) {
|
|
|
1862
1862
|
});
|
|
1863
1863
|
}), n;
|
|
1864
1864
|
}
|
|
1865
|
-
function
|
|
1865
|
+
function $n(e) {
|
|
1866
1866
|
let t = e("body").first().get(0);
|
|
1867
|
-
return t === void 0 ? { items: [] } :
|
|
1867
|
+
return t === void 0 ? { items: [] } : Qn(e, t);
|
|
1868
1868
|
}
|
|
1869
|
-
function
|
|
1869
|
+
function er(e) {
|
|
1870
1870
|
return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
|
|
1871
1871
|
}
|
|
1872
|
-
function
|
|
1873
|
-
e("table").each((t, n) =>
|
|
1872
|
+
function tr(e) {
|
|
1873
|
+
e("table").each((t, n) => bn(e, n));
|
|
1874
1874
|
let t = e("preamble").first(), n = e("body").first(), r = ["<div class=\"akn-bill\">", "<style>.akn-bill p.pastille span:empty::before{content:attr(data-pastille)}</style>"];
|
|
1875
|
-
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(
|
|
1876
|
-
|
|
1875
|
+
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(vn(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
|
|
1876
|
+
R(n) && r.push(H(n) === "article" ? Rn(e, n, "article", "akn-article") : U(e, n));
|
|
1877
1877
|
}), r.push("</section></div>"), r.join("\n");
|
|
1878
1878
|
}
|
|
1879
|
-
function
|
|
1880
|
-
let t =
|
|
1879
|
+
function nr(e) {
|
|
1880
|
+
let t = w(e, { xml: {
|
|
1881
1881
|
decodeEntities: !1,
|
|
1882
1882
|
lowerCaseTags: !1,
|
|
1883
1883
|
lowerCaseAttributeNames: !1,
|
|
1884
1884
|
xmlMode: !0
|
|
1885
|
-
} }), n =
|
|
1885
|
+
} }), n = er(t), r = tr(t);
|
|
1886
1886
|
return {
|
|
1887
1887
|
sourceFormat: "akoma-ntoso",
|
|
1888
1888
|
documentDate: n,
|
|
@@ -1890,13 +1890,13 @@ function er(e) {
|
|
|
1890
1890
|
linkedHtml: r
|
|
1891
1891
|
};
|
|
1892
1892
|
}
|
|
1893
|
-
function
|
|
1894
|
-
return
|
|
1893
|
+
function rr(e) {
|
|
1894
|
+
return ir(w(e));
|
|
1895
1895
|
}
|
|
1896
|
-
function
|
|
1896
|
+
function ir(e) {
|
|
1897
1897
|
let t = [];
|
|
1898
1898
|
return e("article.akn-article").each((n, r) => {
|
|
1899
|
-
let i = e(r).find("p.TCNumArticle").first().get(0), a =
|
|
1899
|
+
let i = e(r).find("p.TCNumArticle").first().get(0), a = F(i ? e(i).text() : ""), o = m(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = Et(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
1900
1900
|
t.push({
|
|
1901
1901
|
id: s,
|
|
1902
1902
|
label: o.label,
|
|
@@ -1909,23 +1909,23 @@ function nr(e) {
|
|
|
1909
1909
|
});
|
|
1910
1910
|
}), t;
|
|
1911
1911
|
}
|
|
1912
|
-
function
|
|
1913
|
-
let t =
|
|
1912
|
+
function ar(e) {
|
|
1913
|
+
let t = w(e);
|
|
1914
1914
|
return {
|
|
1915
|
-
articles:
|
|
1915
|
+
articles: ir(t),
|
|
1916
1916
|
htmlWithLinks: t.html()
|
|
1917
1917
|
};
|
|
1918
1918
|
}
|
|
1919
|
-
async function
|
|
1920
|
-
let n = new ye("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () =>
|
|
1919
|
+
async function or(e, t) {
|
|
1920
|
+
let n = new ye("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => w(e, { xml: {
|
|
1921
1921
|
decodeEntities: !1,
|
|
1922
1922
|
lowerCaseTags: !1,
|
|
1923
1923
|
lowerCaseAttributeNames: !1,
|
|
1924
1924
|
xmlMode: !0
|
|
1925
|
-
} })), i = t.date ??
|
|
1925
|
+
} })), i = t.date ?? er(r), a = n.timeSync("renderAknHtml", () => tr(r), { inputSize: e.length }), o = t.linkedHtml ?? await n.time("addLinksToRenderedAknHtml", () => ct(a, {
|
|
1926
1926
|
...t,
|
|
1927
1927
|
date: i
|
|
1928
|
-
}, i)), s = n.timeSync("extractRenderedAknArticles", () =>
|
|
1928
|
+
}, i)), s = n.timeSync("extractRenderedAknArticles", () => rr(a)), c = n.timeSync("injectHiddenArticleSummary", () => Dt(o, s)), { articles: l, htmlWithLinks: u } = n.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => ar(c)), d = l.length > 0 ? l : s, f = n.timeSync("extractAknTableOfContents", () => $n(r)), p = n.timeSync("buildParsedDocument", () => ln("akoma-ntoso", a, l.length > 0 ? u : c, i, d, f, t.includeDirectiveAnalysis, fn(d, f, l.length > 0 ? u : c, "akoma-ntoso")));
|
|
1929
1929
|
return n.log({
|
|
1930
1930
|
articleCount: p.articles.length,
|
|
1931
1931
|
blockCount: p.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -1933,8 +1933,8 @@ async function ir(e, t) {
|
|
|
1933
1933
|
targetDirectiveCount: p.directives.filter((e) => e.targetIds !== void 0).length
|
|
1934
1934
|
}), p;
|
|
1935
1935
|
}
|
|
1936
|
-
async function
|
|
1937
|
-
let n =
|
|
1936
|
+
async function sr(e, t) {
|
|
1937
|
+
let n = nr(e), r = t.date ?? n.documentDate;
|
|
1938
1938
|
return {
|
|
1939
1939
|
sourceFormat: "akoma-ntoso",
|
|
1940
1940
|
documentDate: r,
|
|
@@ -1944,14 +1944,14 @@ async function ar(e, t) {
|
|
|
1944
1944
|
}
|
|
1945
1945
|
//#endregion
|
|
1946
1946
|
//#region src/lib/server/assemblee_document_search.ts
|
|
1947
|
-
var
|
|
1948
|
-
function
|
|
1947
|
+
var cr = /\bexpos[ée]\s+des\s+motifs\b/giu, lr = /\barticle\s+(?:premier|1er|\d+)/iu;
|
|
1948
|
+
function ur(e) {
|
|
1949
1949
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1950
1950
|
}
|
|
1951
|
-
function
|
|
1952
|
-
let t =
|
|
1951
|
+
function dr(e) {
|
|
1952
|
+
let t = ur(w(e).text()), n = [...t.matchAll(cr)], r = /* @__PURE__ */ new Set(), i = [];
|
|
1953
1953
|
for (let [e, a] of n.entries()) {
|
|
1954
|
-
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c =
|
|
1954
|
+
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = lr.exec(s), l = ur(s.slice(0, c?.index ?? s.length));
|
|
1955
1955
|
if (l.length < 20 || r.has(l)) continue;
|
|
1956
1956
|
r.add(l);
|
|
1957
1957
|
let u = `expose-des-motifs-${e + 1}`;
|
|
@@ -1967,8 +1967,8 @@ function lr(e) {
|
|
|
1967
1967
|
}
|
|
1968
1968
|
return i;
|
|
1969
1969
|
}
|
|
1970
|
-
async function
|
|
1971
|
-
let i = await
|
|
1970
|
+
async function fr({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
1971
|
+
let i = await mn(t, {
|
|
1972
1972
|
date: e,
|
|
1973
1973
|
includeDirectiveAnalysis: !1,
|
|
1974
1974
|
linkBaseUrl: n,
|
|
@@ -1977,7 +1977,7 @@ async function ur({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1977
1977
|
});
|
|
1978
1978
|
return {
|
|
1979
1979
|
items: [...i.articles.map((e) => {
|
|
1980
|
-
let t =
|
|
1980
|
+
let t = ur(e.directiveText || e.text);
|
|
1981
1981
|
if (t) return {
|
|
1982
1982
|
anchor: e.id,
|
|
1983
1983
|
articleNumber: e.num ?? null,
|
|
@@ -1987,17 +1987,17 @@ async function ur({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1987
1987
|
label: e.label,
|
|
1988
1988
|
title: e.title ?? null
|
|
1989
1989
|
};
|
|
1990
|
-
}).filter((e) => e !== void 0), ...
|
|
1990
|
+
}).filter((e) => e !== void 0), ...dr(t)],
|
|
1991
1991
|
tableOfContents: i.tableOfContents
|
|
1992
1992
|
};
|
|
1993
1993
|
}
|
|
1994
|
-
function
|
|
1995
|
-
return
|
|
1994
|
+
function pr(e, t) {
|
|
1995
|
+
return M("sha256").update(JSON.stringify({
|
|
1996
1996
|
item: e,
|
|
1997
1997
|
metadata: t
|
|
1998
1998
|
})).digest("hex");
|
|
1999
1999
|
}
|
|
2000
|
-
function
|
|
2000
|
+
function mr(e) {
|
|
2001
2001
|
if (typeof e != "object" || !e) return;
|
|
2002
2002
|
let t = e.cycleDeVie?.chrono;
|
|
2003
2003
|
if (t !== void 0) for (let e of [
|
|
@@ -2012,11 +2012,11 @@ function fr(e) {
|
|
|
2012
2012
|
}
|
|
2013
2013
|
//#endregion
|
|
2014
2014
|
//#region src/lib/server/senat_amendment_search.ts
|
|
2015
|
-
function
|
|
2016
|
-
return e?.trim() ?
|
|
2015
|
+
function hr(e) {
|
|
2016
|
+
return e?.trim() ? w(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
|
|
2017
2017
|
}
|
|
2018
|
-
function
|
|
2019
|
-
let n =
|
|
2018
|
+
function gr({ dispositifHtml: e, objetHtml: t }) {
|
|
2019
|
+
let n = hr(e), r = hr(t);
|
|
2020
2020
|
return [...n ? [{
|
|
2021
2021
|
content: n,
|
|
2022
2022
|
itemKind: "dispositif",
|
|
@@ -2027,8 +2027,8 @@ function mr({ dispositifHtml: e, objetHtml: t }) {
|
|
|
2027
2027
|
label: "Objet"
|
|
2028
2028
|
}] : []];
|
|
2029
2029
|
}
|
|
2030
|
-
function
|
|
2031
|
-
return
|
|
2030
|
+
function _r(e, t) {
|
|
2031
|
+
return M("sha256").update(JSON.stringify({
|
|
2032
2032
|
item: e,
|
|
2033
2033
|
metadata: t
|
|
2034
2034
|
})).digest("hex");
|
|
@@ -2042,76 +2042,76 @@ function W(e, t) {
|
|
|
2042
2042
|
type: "amendment_action_directive"
|
|
2043
2043
|
};
|
|
2044
2044
|
}
|
|
2045
|
-
function
|
|
2045
|
+
function vr(e, t) {
|
|
2046
2046
|
return {
|
|
2047
2047
|
type: e === "start" ? "head_of_target" : "tail_after_target",
|
|
2048
|
-
unit: t ?
|
|
2048
|
+
unit: t ? n(t) : "article"
|
|
2049
2049
|
};
|
|
2050
2050
|
}
|
|
2051
|
-
function
|
|
2051
|
+
function yr(e) {
|
|
2052
2052
|
return e === "start" ? "insert_before" : "insert_after";
|
|
2053
2053
|
}
|
|
2054
|
-
var
|
|
2054
|
+
var br = D(O("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), G = E(i, A([O("les?\\s+", { flags: "i" }), h], { value: (e) => e[1] }), h, v), xr = E(A([O("la\\s+fin\\s+de\\s+", { flags: "i" }), G], { value: (e) => {
|
|
2055
2055
|
let t = e[1];
|
|
2056
2056
|
return {
|
|
2057
2057
|
targetReference: t,
|
|
2058
2058
|
targetScope: {
|
|
2059
2059
|
type: "tail_after_target",
|
|
2060
|
-
unit:
|
|
2060
|
+
unit: n(t)
|
|
2061
2061
|
}
|
|
2062
2062
|
};
|
|
2063
|
-
} }),
|
|
2064
|
-
|
|
2065
|
-
|
|
2063
|
+
} }), A([_], { value: (e) => ({ targetScope: e[0] }) })), K = D(A([
|
|
2064
|
+
D(O("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
2065
|
+
D(O("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
2066
2066
|
G,
|
|
2067
|
-
|
|
2067
|
+
D(O("\\s*,?\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*)?", { flags: "i" }), { default: "" })
|
|
2068
2068
|
], { value: (e, t) => ({
|
|
2069
2069
|
reference: e[2],
|
|
2070
2070
|
text: t.text()
|
|
2071
|
-
}) }), { default: null }),
|
|
2071
|
+
}) }), { default: null }), Sr = D(O(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${Ee})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
|
|
2072
2072
|
function q(e) {
|
|
2073
2073
|
return e?.text ?? "";
|
|
2074
2074
|
}
|
|
2075
|
-
function
|
|
2076
|
-
return { citation:
|
|
2075
|
+
function Cr(e) {
|
|
2076
|
+
return { citation: y(e.position()) };
|
|
2077
2077
|
}
|
|
2078
|
-
var J =
|
|
2078
|
+
var J = E(A([T], { value: (e) => ({ citation: e[0] }) }), O("\\S[\\s\\S]*", { value: (e, t) => Cr(t) })), wr = O("\\S[\\s\\S]*", { value: (e, t) => Cr(t) }), Y = O("[^:«“\"]*(?::\\s*)?", { flags: "i" }), Tr = O("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
|
|
2079
2079
|
flags: "i",
|
|
2080
|
-
value: (e, t) =>
|
|
2081
|
-
}),
|
|
2080
|
+
value: (e, t) => Cr(t)
|
|
2081
|
+
}), Er = O("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
|
|
2082
2082
|
flags: "i",
|
|
2083
|
-
value: (e, t) =>
|
|
2084
|
-
}),
|
|
2083
|
+
value: (e, t) => Cr(t)
|
|
2084
|
+
}), Dr = O("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
|
|
2085
2085
|
flags: "i",
|
|
2086
|
-
value: (e, t) =>
|
|
2087
|
-
}),
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
], { value: (e) => e[2] }),
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2086
|
+
value: (e, t) => Cr(t)
|
|
2087
|
+
}), Or = E(A([T], { value: (e) => ({ citation: e[0] }) }), Tr), kr = E(A([T], { value: (e) => ({ citation: e[0] }) }), Dr), Ar = A([O(`${re}s?\\s*:?\\s*`, { flags: "i" }), Or], { value: (e) => e[1] }), jr = A([O(`${d}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), kr], { value: (e) => e[1] }), Mr = E(A([T], { value: (e) => ({ citation: e[0] }) }), Er), Nr = A([
|
|
2088
|
+
Sr,
|
|
2089
|
+
O(`${re}s?\\s*:?\\s*`, { flags: "i" }),
|
|
2090
|
+
Mr
|
|
2091
|
+
], { value: (e) => e[2] }), Pr = A([
|
|
2092
|
+
Sr,
|
|
2093
|
+
O(`${re}s?\\s*:?\\s*`, { flags: "i" }),
|
|
2094
|
+
E(A([T], { value: (e) => ({ citation: e[0] }) }), wr)
|
|
2095
2095
|
], { value: (e) => e[2] });
|
|
2096
2096
|
function X(e) {
|
|
2097
2097
|
return e?.reference;
|
|
2098
2098
|
}
|
|
2099
|
-
var
|
|
2099
|
+
var Fr = A([br, O("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => W(t, {
|
|
2100
2100
|
contextText: e[0],
|
|
2101
2101
|
kind: "delete_article"
|
|
2102
|
-
}) }),
|
|
2102
|
+
}) }), Ir = A([
|
|
2103
2103
|
K,
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2104
|
+
O("supprimer", { flags: "i" }),
|
|
2105
|
+
D(A([k, G], { value: (e) => e[1] }), { default: null }),
|
|
2106
|
+
D(A([k, Pr], { value: (e) => e[1] }), { default: null })
|
|
2107
2107
|
], { value: (e, t) => W(t, {
|
|
2108
2108
|
contextText: q(e[0]),
|
|
2109
2109
|
kind: "delete_portion",
|
|
2110
2110
|
targetCitation: e[3]?.citation ?? void 0,
|
|
2111
2111
|
targetReference: e[2] ?? X(e[0])
|
|
2112
|
-
}) }),
|
|
2112
|
+
}) }), Lr = A([
|
|
2113
2113
|
K,
|
|
2114
|
-
|
|
2114
|
+
E(O("r[eé]diger\\s+ainsi", { flags: "i" }), O("r[eé]tablir", { flags: "i" })),
|
|
2115
2115
|
Y,
|
|
2116
2116
|
J
|
|
2117
2117
|
], { value: (e, t) => W(t, {
|
|
@@ -2119,76 +2119,76 @@ var Nr = k([vr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2119
2119
|
kind: "rewrite_portion",
|
|
2120
2120
|
replacementCitation: e[3].citation,
|
|
2121
2121
|
targetReference: X(e[0])
|
|
2122
|
-
}) }),
|
|
2122
|
+
}) }), Rr = A([
|
|
2123
2123
|
K,
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2124
|
+
E(O("substituer", { flags: "i" }), O("remplacer", { flags: "i" })),
|
|
2125
|
+
k,
|
|
2126
|
+
Sr,
|
|
2127
|
+
Ar,
|
|
2128
|
+
O("\\s*,?\\s*"),
|
|
2129
|
+
D(O("par\\s+", { flags: "i" }), { default: "" }),
|
|
2130
|
+
jr
|
|
2131
2131
|
], { value: (e, t) => W(t, {
|
|
2132
2132
|
contextText: q(e[0]),
|
|
2133
2133
|
kind: "replace",
|
|
2134
2134
|
replacementCitation: e[7].citation,
|
|
2135
2135
|
targetCitation: e[4].citation,
|
|
2136
2136
|
targetReference: X(e[0])
|
|
2137
|
-
}) }),
|
|
2137
|
+
}) }), zr = A([
|
|
2138
2138
|
K,
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2139
|
+
O("substituer", { flags: "i" }),
|
|
2140
|
+
k,
|
|
2141
|
+
D(O("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
|
|
2142
2142
|
G,
|
|
2143
|
-
|
|
2143
|
+
O("[\\s\\S]*?(?=[«“\"]|$)"),
|
|
2144
2144
|
J
|
|
2145
2145
|
], { value: (e, t) => W(t, {
|
|
2146
2146
|
contextText: q(e[0]),
|
|
2147
2147
|
kind: "rewrite_portion",
|
|
2148
2148
|
replacementCitation: e[6].citation,
|
|
2149
2149
|
targetReference: e[4] ?? X(e[0])
|
|
2150
|
-
}) }),
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2150
|
+
}) }), Br = A([
|
|
2151
|
+
p,
|
|
2152
|
+
k,
|
|
2153
|
+
O("l['’ ]article", { flags: "i" }),
|
|
2154
|
+
O("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
2155
|
+
O("ins[eé]rer", { flags: "i" }),
|
|
2156
2156
|
Y,
|
|
2157
2157
|
J
|
|
2158
2158
|
], { value: (e, t) => W(t, {
|
|
2159
2159
|
contextText: "",
|
|
2160
2160
|
insertCitation: e[6].citation,
|
|
2161
2161
|
kind: e[0] === "before" ? "insert_article_before" : "insert_article_after"
|
|
2162
|
-
}) }),
|
|
2163
|
-
|
|
2164
|
-
|
|
2162
|
+
}) }), Vr = A([
|
|
2163
|
+
p,
|
|
2164
|
+
k,
|
|
2165
2165
|
G,
|
|
2166
|
-
|
|
2167
|
-
|
|
2166
|
+
O("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
2167
|
+
E(O("ins[eé]rer", { flags: "i" }), O("ajouter", { flags: "i" })),
|
|
2168
2168
|
Y,
|
|
2169
2169
|
J
|
|
2170
2170
|
], { value: (e, t) => W(t, {
|
|
2171
2171
|
contextText: "",
|
|
2172
2172
|
insertCitation: e[6].citation,
|
|
2173
|
-
kind:
|
|
2173
|
+
kind: l(e[0]),
|
|
2174
2174
|
targetReference: e[2]
|
|
2175
|
-
}) }),
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2175
|
+
}) }), Hr = A([
|
|
2176
|
+
p,
|
|
2177
|
+
k,
|
|
2178
|
+
O("l['’ ]alin[eé]a", { flags: "i" }),
|
|
2179
|
+
O("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
2180
|
+
O("ins[eé]rer", { flags: "i" }),
|
|
2181
2181
|
Y,
|
|
2182
2182
|
J
|
|
2183
2183
|
], { value: (e, t) => W(t, {
|
|
2184
2184
|
contextText: "",
|
|
2185
2185
|
insertCitation: e[6].citation,
|
|
2186
|
-
kind:
|
|
2187
|
-
}) }),
|
|
2186
|
+
kind: l(e[0])
|
|
2187
|
+
}) }), Ur = A([
|
|
2188
2188
|
K,
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2189
|
+
ne,
|
|
2190
|
+
O("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
2191
|
+
E(O("ins[eé]rer", { flags: "i" }), O("ajouter", { flags: "i" })),
|
|
2192
2192
|
Y,
|
|
2193
2193
|
J
|
|
2194
2194
|
], { value: (e, t) => {
|
|
@@ -2196,62 +2196,62 @@ var Nr = k([vr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2196
2196
|
return W(t, {
|
|
2197
2197
|
contextText: q(n),
|
|
2198
2198
|
insertCitation: e[5].citation,
|
|
2199
|
-
kind:
|
|
2199
|
+
kind: yr(i),
|
|
2200
2200
|
targetReference: r,
|
|
2201
|
-
targetScope:
|
|
2201
|
+
targetScope: vr(i, r)
|
|
2202
2202
|
});
|
|
2203
|
-
} }),
|
|
2203
|
+
} }), Wr = A([
|
|
2204
2204
|
K,
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2205
|
+
p,
|
|
2206
|
+
k,
|
|
2207
|
+
Nr,
|
|
2208
|
+
O("[\\s\\S]*?(?=ins[eé]rer)"),
|
|
2209
|
+
O("ins[eé]rer", { flags: "i" }),
|
|
2210
|
+
k,
|
|
2211
|
+
jr
|
|
2212
2212
|
], { value: (e, t) => W(t, {
|
|
2213
2213
|
contextText: q(e[0]),
|
|
2214
2214
|
insertCitation: e[7].citation,
|
|
2215
|
-
kind:
|
|
2215
|
+
kind: l(e[1]),
|
|
2216
2216
|
targetCitation: e[3].citation,
|
|
2217
2217
|
targetReference: X(e[0])
|
|
2218
|
-
}) }),
|
|
2218
|
+
}) }), Gr = A([
|
|
2219
2219
|
K,
|
|
2220
|
-
|
|
2221
|
-
|
|
2220
|
+
p,
|
|
2221
|
+
k,
|
|
2222
2222
|
G,
|
|
2223
|
-
|
|
2224
|
-
|
|
2223
|
+
O("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
2224
|
+
E(O("ins[eé]rer", { flags: "i" }), O("ajouter", { flags: "i" })),
|
|
2225
2225
|
Y,
|
|
2226
2226
|
J
|
|
2227
2227
|
], { value: (e, t) => W(t, {
|
|
2228
2228
|
contextText: q(e[0]),
|
|
2229
2229
|
insertCitation: e[7].citation,
|
|
2230
|
-
kind:
|
|
2230
|
+
kind: l(e[1]),
|
|
2231
2231
|
targetReference: X(e[0]) ?? e[3]
|
|
2232
|
-
}) }),
|
|
2232
|
+
}) }), Kr = E(Ur, Br, Vr, Hr, zr, A([
|
|
2233
2233
|
K,
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2234
|
+
p,
|
|
2235
|
+
k,
|
|
2236
|
+
Nr,
|
|
2237
|
+
O("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
|
|
2238
|
+
E(A([
|
|
2239
|
+
O("supprimer", {
|
|
2240
2240
|
flags: "i",
|
|
2241
2241
|
value: "delete_portion"
|
|
2242
2242
|
}),
|
|
2243
|
-
|
|
2244
|
-
|
|
2243
|
+
k,
|
|
2244
|
+
xr
|
|
2245
2245
|
], { value: (e) => ({
|
|
2246
2246
|
kind: e[0],
|
|
2247
2247
|
...e[2]
|
|
2248
|
-
}) }),
|
|
2249
|
-
|
|
2248
|
+
}) }), A([
|
|
2249
|
+
O("r[eé]diger\\s+ainsi", {
|
|
2250
2250
|
flags: "i",
|
|
2251
2251
|
value: "rewrite_portion"
|
|
2252
2252
|
}),
|
|
2253
|
-
|
|
2254
|
-
|
|
2253
|
+
k,
|
|
2254
|
+
xr,
|
|
2255
2255
|
Y,
|
|
2256
2256
|
J
|
|
2257
2257
|
], { value: (e) => ({
|
|
@@ -2269,24 +2269,24 @@ var Nr = k([vr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2269
2269
|
targetReference: X(e[0]) ?? n.targetReference,
|
|
2270
2270
|
targetScope: n.targetScope
|
|
2271
2271
|
});
|
|
2272
|
-
} }),
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2272
|
+
} }), Wr, Gr, A([
|
|
2273
|
+
br,
|
|
2274
|
+
O("ins[eé]rer", { flags: "i" }),
|
|
2275
|
+
O(`[\\s\\S]*?(?=${r})`, { flags: "i" }),
|
|
2276
|
+
p,
|
|
2277
2277
|
Y,
|
|
2278
|
-
|
|
2278
|
+
T,
|
|
2279
2279
|
Y,
|
|
2280
|
-
|
|
2280
|
+
T
|
|
2281
2281
|
], { value: (e, t) => W(t, {
|
|
2282
2282
|
contextText: e[0],
|
|
2283
2283
|
insertCitation: e[8],
|
|
2284
|
-
kind:
|
|
2284
|
+
kind: l(e[3]),
|
|
2285
2285
|
targetCitation: e[6]
|
|
2286
|
-
}) }),
|
|
2286
|
+
}) }), Rr, Lr, A([
|
|
2287
2287
|
K,
|
|
2288
|
-
|
|
2289
|
-
|
|
2288
|
+
O("compl[eé]ter", { flags: "i" }),
|
|
2289
|
+
D(A([k, G], { value: (e) => e[1] }), { default: null }),
|
|
2290
2290
|
Y,
|
|
2291
2291
|
J
|
|
2292
2292
|
], { value: (e, t) => W(t, {
|
|
@@ -2294,16 +2294,16 @@ var Nr = k([vr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2294
2294
|
insertCitation: e[4].citation,
|
|
2295
2295
|
kind: "insert_after",
|
|
2296
2296
|
targetReference: e[2] ?? X(e[0])
|
|
2297
|
-
}) }),
|
|
2297
|
+
}) }), Fr, Ir);
|
|
2298
2298
|
//#endregion
|
|
2299
2299
|
//#region src/lib/server/parsed_amendments.ts
|
|
2300
|
-
function
|
|
2300
|
+
function qr(e) {
|
|
2301
2301
|
return e.replace(/\s+/gu, " ").trim();
|
|
2302
2302
|
}
|
|
2303
|
-
function
|
|
2304
|
-
return e.split(/\n/gu).map(
|
|
2303
|
+
function Jr(e) {
|
|
2304
|
+
return e.split(/\n/gu).map(qr).filter(Boolean).join("\n");
|
|
2305
2305
|
}
|
|
2306
|
-
function
|
|
2306
|
+
function Yr(e, t) {
|
|
2307
2307
|
let { start: n, stop: r } = t;
|
|
2308
2308
|
for (; n < r && /\s/u.test(e[n]);) n++;
|
|
2309
2309
|
for (; r > n && /\s/u.test(e[r - 1]);) r--;
|
|
@@ -2312,16 +2312,16 @@ function qr(e, t) {
|
|
|
2312
2312
|
stop: r
|
|
2313
2313
|
} : null;
|
|
2314
2314
|
}
|
|
2315
|
-
function
|
|
2315
|
+
function Xr(e, t) {
|
|
2316
2316
|
return ve(_e(e), t);
|
|
2317
2317
|
}
|
|
2318
|
-
function
|
|
2318
|
+
function Zr(e) {
|
|
2319
2319
|
return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
|
|
2320
2320
|
}
|
|
2321
|
-
function
|
|
2321
|
+
function Qr(e) {
|
|
2322
2322
|
return {
|
|
2323
2323
|
articleLabel: e.targetArticleLabel ?? null,
|
|
2324
|
-
targetPosition:
|
|
2324
|
+
targetPosition: Zr(e.targetPosition),
|
|
2325
2325
|
alinea: e.targetAlinea ?? null,
|
|
2326
2326
|
alineaLabel: e.targetAlineaLabel ?? null,
|
|
2327
2327
|
subdivisionSourceId: e.targetSubdivisionSourceId ?? null,
|
|
@@ -2336,36 +2336,36 @@ function Z(e) {
|
|
|
2336
2336
|
sourceText: e.text
|
|
2337
2337
|
};
|
|
2338
2338
|
}
|
|
2339
|
-
function
|
|
2339
|
+
function $r(e) {
|
|
2340
2340
|
return {
|
|
2341
2341
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
2342
2342
|
sourcePosition: e.position,
|
|
2343
2343
|
sourceText: e.text
|
|
2344
2344
|
};
|
|
2345
2345
|
}
|
|
2346
|
-
function
|
|
2346
|
+
function ei(e) {
|
|
2347
2347
|
return {
|
|
2348
2348
|
...e?.originalTransformation === void 0 ? {} : { dispositifOriginalTransformation: e.originalTransformation },
|
|
2349
2349
|
...e === null ? {} : { dispositifPosition: e.position },
|
|
2350
2350
|
dispositifText: e?.text ?? null
|
|
2351
2351
|
};
|
|
2352
2352
|
}
|
|
2353
|
-
function
|
|
2353
|
+
function ti(e, t, n, r = Jr(e.slice(n.start, n.stop))) {
|
|
2354
2354
|
return {
|
|
2355
|
-
originalTransformation:
|
|
2355
|
+
originalTransformation: Xr(t, n),
|
|
2356
2356
|
position: n,
|
|
2357
2357
|
text: r
|
|
2358
2358
|
};
|
|
2359
2359
|
}
|
|
2360
|
-
function
|
|
2360
|
+
function ni(e) {
|
|
2361
2361
|
let t = e.dispositifHtml ?? e.dispositifText;
|
|
2362
2362
|
if (!t) return null;
|
|
2363
|
-
let n = e.dispositifHtml ? ge()(t) :
|
|
2363
|
+
let n = e.dispositifHtml ? ge()(t) : Se(t), r = n.output, i = Yr(r, {
|
|
2364
2364
|
start: 0,
|
|
2365
2365
|
stop: r.length
|
|
2366
2366
|
});
|
|
2367
2367
|
return {
|
|
2368
|
-
dispositif: i === null ? null :
|
|
2368
|
+
dispositif: i === null ? null : ti(r, n, i),
|
|
2369
2369
|
simplifiedText: r,
|
|
2370
2370
|
transformation: n
|
|
2371
2371
|
};
|
|
@@ -2385,7 +2385,7 @@ function Q(e) {
|
|
|
2385
2385
|
for (let t of a(e)) if (t.type === "alinéa" && typeof t.index == "number" && t.index > 0) return [t.index];
|
|
2386
2386
|
return [];
|
|
2387
2387
|
}
|
|
2388
|
-
function
|
|
2388
|
+
function ri(e, t) {
|
|
2389
2389
|
let n = Q(t);
|
|
2390
2390
|
return {
|
|
2391
2391
|
...e,
|
|
@@ -2393,11 +2393,11 @@ function ti(e, t) {
|
|
|
2393
2393
|
...n.length > 0 ? { alineas: n } : {}
|
|
2394
2394
|
};
|
|
2395
2395
|
}
|
|
2396
|
-
function
|
|
2396
|
+
function ii(e) {
|
|
2397
2397
|
return e.replace(/^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*/iu, "").replace(/^\s*(?:\d+°|[a-z]\))\s*/iu, "").trim();
|
|
2398
2398
|
}
|
|
2399
|
-
function
|
|
2400
|
-
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(
|
|
2399
|
+
function ai(e, t) {
|
|
2400
|
+
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(ii(t.text));
|
|
2401
2401
|
if (!n) return null;
|
|
2402
2402
|
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10);
|
|
2403
2403
|
return !Number.isFinite(r) || r < 1 ? null : {
|
|
@@ -2406,25 +2406,25 @@ function ri(e, t) {
|
|
|
2406
2406
|
alineas: [r]
|
|
2407
2407
|
};
|
|
2408
2408
|
}
|
|
2409
|
-
function
|
|
2409
|
+
function oi(e, t) {
|
|
2410
2410
|
if (e) return e.unit === "article" && t.alinea !== null ? {
|
|
2411
2411
|
...e,
|
|
2412
2412
|
unit: "alinéa"
|
|
2413
2413
|
} : e;
|
|
2414
2414
|
}
|
|
2415
|
-
function
|
|
2416
|
-
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(
|
|
2415
|
+
function si(e) {
|
|
2416
|
+
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(ii(e.text));
|
|
2417
2417
|
}
|
|
2418
|
-
function
|
|
2419
|
-
return
|
|
2418
|
+
function ci(e, t, n, r) {
|
|
2419
|
+
return ti(e, t, {
|
|
2420
2420
|
start: n.position.start,
|
|
2421
2421
|
stop: r.position.stop
|
|
2422
2422
|
});
|
|
2423
2423
|
}
|
|
2424
|
-
function
|
|
2424
|
+
function li(e) {
|
|
2425
2425
|
return /^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*(?!alin[eé]a\b)/iu.test(e.text);
|
|
2426
2426
|
}
|
|
2427
|
-
function
|
|
2427
|
+
function ui(e, t) {
|
|
2428
2428
|
let n = { ...t.position };
|
|
2429
2429
|
function r(t) {
|
|
2430
2430
|
let r = t.exec(e.slice(n.start, n.stop));
|
|
@@ -2433,29 +2433,29 @@ function ci(e, t) {
|
|
|
2433
2433
|
stop: n.stop
|
|
2434
2434
|
});
|
|
2435
2435
|
}
|
|
2436
|
-
return r(/^(?:(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*|[a-z]\)\s*(?:[.\-–—]\s*)*|\d+°\s*)/iu), r(/^[.\-–—]\s*/u), r(/^en\s+cons[ée]quence\s*,\s*/iu),
|
|
2436
|
+
return r(/^(?:(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*|[a-z]\)\s*(?:[.\-–—]\s*)*|\d+°\s*)/iu), r(/^[.\-–—]\s*/u), r(/^en\s+cons[ée]quence\s*,\s*/iu), Yr(e, n);
|
|
2437
2437
|
}
|
|
2438
|
-
function
|
|
2439
|
-
return
|
|
2438
|
+
function di(e) {
|
|
2439
|
+
return me(e);
|
|
2440
2440
|
}
|
|
2441
|
-
function
|
|
2442
|
-
return
|
|
2441
|
+
function fi(e, t) {
|
|
2442
|
+
return Kr(new j(e.slice(0, t.stop), t.start)) ?? null;
|
|
2443
2443
|
}
|
|
2444
2444
|
function $(e, t, n) {
|
|
2445
|
-
if (n) return
|
|
2445
|
+
if (n) return ti(e, t, n.position, Jr(te(e, n)));
|
|
2446
2446
|
}
|
|
2447
|
-
function
|
|
2447
|
+
function pi(e, t) {
|
|
2448
2448
|
if (!e) return;
|
|
2449
2449
|
let n = structuredClone(e);
|
|
2450
|
-
for (let e of
|
|
2450
|
+
for (let e of s(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = Xr(t, e.position));
|
|
2451
2451
|
return n;
|
|
2452
2452
|
}
|
|
2453
|
-
function
|
|
2454
|
-
let i =
|
|
2453
|
+
function mi(e, t, n, r) {
|
|
2454
|
+
let i = ui(e, n);
|
|
2455
2455
|
if (!i) return null;
|
|
2456
|
-
let a =
|
|
2456
|
+
let a = fi(e, i);
|
|
2457
2457
|
if (!a) return null;
|
|
2458
|
-
let o =
|
|
2458
|
+
let o = ti(e, t, i), s = pi(a.targetReference, t), c = ri(r, s), l = di(o.text);
|
|
2459
2459
|
if (a.kind === "delete_article") return {
|
|
2460
2460
|
kind: "delete_article",
|
|
2461
2461
|
...Z(o),
|
|
@@ -2473,7 +2473,7 @@ function fi(e, t, n, r) {
|
|
|
2473
2473
|
},
|
|
2474
2474
|
targetOccurrence: l,
|
|
2475
2475
|
targetReference: s,
|
|
2476
|
-
targetScope:
|
|
2476
|
+
targetScope: oi(a.targetScope, c)
|
|
2477
2477
|
};
|
|
2478
2478
|
}
|
|
2479
2479
|
if (a.kind === "rewrite_portion") {
|
|
@@ -2490,7 +2490,7 @@ function fi(e, t, n, r) {
|
|
|
2490
2490
|
},
|
|
2491
2491
|
targetOccurrence: l,
|
|
2492
2492
|
targetReference: s,
|
|
2493
|
-
targetScope:
|
|
2493
|
+
targetScope: oi(a.targetScope, c),
|
|
2494
2494
|
replacementCitation: n,
|
|
2495
2495
|
replacementText: n.text
|
|
2496
2496
|
};
|
|
@@ -2545,19 +2545,19 @@ function fi(e, t, n, r) {
|
|
|
2545
2545
|
targetReference: s,
|
|
2546
2546
|
insertCitation: n,
|
|
2547
2547
|
insertText: n.text,
|
|
2548
|
-
targetScope:
|
|
2548
|
+
targetScope: oi(a.targetScope, c)
|
|
2549
2549
|
};
|
|
2550
2550
|
}
|
|
2551
2551
|
return null;
|
|
2552
2552
|
}
|
|
2553
|
-
function
|
|
2553
|
+
function hi(e, t) {
|
|
2554
2554
|
let n = [], r = 0, i = 0;
|
|
2555
2555
|
function a(r) {
|
|
2556
|
-
let a =
|
|
2556
|
+
let a = Yr(e, {
|
|
2557
2557
|
start: i,
|
|
2558
2558
|
stop: r
|
|
2559
2559
|
});
|
|
2560
|
-
a !== null && n.push(
|
|
2560
|
+
a !== null && n.push(ti(e, t, a));
|
|
2561
2561
|
}
|
|
2562
2562
|
function o(t) {
|
|
2563
2563
|
let n = Math.max(e.lastIndexOf("\n", t - 1), e.lastIndexOf("\r", t - 1));
|
|
@@ -2575,7 +2575,7 @@ function pi(e, t) {
|
|
|
2575
2575
|
continue;
|
|
2576
2576
|
}
|
|
2577
2577
|
if (r > 0) continue;
|
|
2578
|
-
let s = e.slice(t + 1), c = /[\n\r]/u.test(n), l = /[.;]/u.test(n), u = e.slice(i, l ? t + 1 : t), d = /^\s*(?:(?:[IVXLCDM]+)\s*[.\-–—]+\s*|\d+°\s*|[a-z]\)\s*|(?:Supprimer|Après|Avant|Compléter|Rédiger|Substituer|Remplacer)\b)/iu.test(s), f = c && /^\s*(?:R[eé]diger|Ins[eé]rer|Ajouter|Supprimer)\b/iu.test(s) &&
|
|
2578
|
+
let s = e.slice(t + 1), c = /[\n\r]/u.test(n), l = /[.;]/u.test(n), u = e.slice(i, l ? t + 1 : t), d = /^\s*(?:(?:[IVXLCDM]+)\s*[.\-–—]+\s*|\d+°\s*|[a-z]\)\s*|(?:Supprimer|Après|Avant|Compléter|Rédiger|Substituer|Remplacer)\b)/iu.test(s), f = c && /^\s*(?:R[eé]diger|Ins[eé]rer|Ajouter|Supprimer)\b/iu.test(s) && si({
|
|
2579
2579
|
originalTransformation: void 0,
|
|
2580
2580
|
position: {
|
|
2581
2581
|
start: i,
|
|
@@ -2587,8 +2587,8 @@ function pi(e, t) {
|
|
|
2587
2587
|
}
|
|
2588
2588
|
return a(e.length), n;
|
|
2589
2589
|
}
|
|
2590
|
-
function
|
|
2591
|
-
let t =
|
|
2590
|
+
function gi(e) {
|
|
2591
|
+
let t = ni(e), n = t?.dispositif ?? null, r = ei(n), i = [], a = [], o = Qr(e);
|
|
2592
2592
|
if (e.sourceFormat === "senat-ameli" && e.sourceKind === "S") return i.push({
|
|
2593
2593
|
code: "unsupported_sub_amendment",
|
|
2594
2594
|
message: "Les sous-amendements ne sont pas encore projetés."
|
|
@@ -2606,9 +2606,9 @@ function mi(e) {
|
|
|
2606
2606
|
});
|
|
2607
2607
|
else {
|
|
2608
2608
|
let { simplifiedText: e, transformation: r } = t, s = o, c = null;
|
|
2609
|
-
for (let t of
|
|
2610
|
-
|
|
2611
|
-
let n = c ?
|
|
2609
|
+
for (let t of hi(e, r)) {
|
|
2610
|
+
li(t) && (s = o, c = null);
|
|
2611
|
+
let n = c ? ci(e, r, c, t) : t, i = mi(e, r, n, s);
|
|
2612
2612
|
if (i) {
|
|
2613
2613
|
a.push(i), c = null, (i.target.alinea !== null || i.target.alineas) && (s = i.target);
|
|
2614
2614
|
continue;
|
|
@@ -2617,12 +2617,12 @@ function mi(e) {
|
|
|
2617
2617
|
c = n;
|
|
2618
2618
|
continue;
|
|
2619
2619
|
}
|
|
2620
|
-
let l =
|
|
2620
|
+
let l = ai(o, t);
|
|
2621
2621
|
if (l !== null) {
|
|
2622
2622
|
s = l;
|
|
2623
2623
|
continue;
|
|
2624
2624
|
}
|
|
2625
|
-
|
|
2625
|
+
si(t) && (c = t);
|
|
2626
2626
|
}
|
|
2627
2627
|
a.length === 0 && (o.targetPosition === "after_article" || o.targetPosition === "before_article") && a.push({
|
|
2628
2628
|
kind: o.targetPosition === "before_article" ? "insert_article_before" : "insert_article_after",
|
|
@@ -2633,7 +2633,7 @@ function mi(e) {
|
|
|
2633
2633
|
}), a.length === 0 && i.push({
|
|
2634
2634
|
code: "unrecognized_dispositif",
|
|
2635
2635
|
message: "Le dispositif est présent mais aucune directive d'amendement n'a été reconnue.",
|
|
2636
|
-
|
|
2636
|
+
...$r(n)
|
|
2637
2637
|
});
|
|
2638
2638
|
}
|
|
2639
2639
|
return {
|
|
@@ -2647,25 +2647,25 @@ function mi(e) {
|
|
|
2647
2647
|
}
|
|
2648
2648
|
//#endregion
|
|
2649
2649
|
//#region src/lib/server/senat_document_search.ts
|
|
2650
|
-
function
|
|
2650
|
+
function _i(e) {
|
|
2651
2651
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
2652
2652
|
}
|
|
2653
|
-
function
|
|
2654
|
-
let t =
|
|
2653
|
+
function vi(e) {
|
|
2654
|
+
let t = m(e);
|
|
2655
2655
|
if (!t) return {
|
|
2656
2656
|
articleNumber: null,
|
|
2657
2657
|
label: e,
|
|
2658
2658
|
title: null
|
|
2659
2659
|
};
|
|
2660
|
-
let n =
|
|
2660
|
+
let n = _i(t.num ?? "") || null, r = _i(t.title ?? "") || null;
|
|
2661
2661
|
return {
|
|
2662
2662
|
articleNumber: n,
|
|
2663
2663
|
label: t.label,
|
|
2664
2664
|
title: r
|
|
2665
2665
|
};
|
|
2666
2666
|
}
|
|
2667
|
-
function
|
|
2668
|
-
let t =
|
|
2667
|
+
function yi(e) {
|
|
2668
|
+
let t = w(e), n = [], r = _i(t("section.akn-preamble").text());
|
|
2669
2669
|
return r && n.push({
|
|
2670
2670
|
anchor: "senat-expose-des-motifs",
|
|
2671
2671
|
articleNumber: null,
|
|
@@ -2675,9 +2675,9 @@ function _i(e) {
|
|
|
2675
2675
|
label: "Exposé des motifs",
|
|
2676
2676
|
title: null
|
|
2677
2677
|
}), t("article.akn-article").each((e, r) => {
|
|
2678
|
-
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o =
|
|
2678
|
+
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o = _i(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = vi(o || s), l = i.clone();
|
|
2679
2679
|
l.children("p.TCNumArticle").remove();
|
|
2680
|
-
let u =
|
|
2680
|
+
let u = _i(l.text());
|
|
2681
2681
|
u && n.push({
|
|
2682
2682
|
anchor: i.attr("id") || null,
|
|
2683
2683
|
articleNumber: c.articleNumber,
|
|
@@ -2689,40 +2689,40 @@ function _i(e) {
|
|
|
2689
2689
|
});
|
|
2690
2690
|
}), n;
|
|
2691
2691
|
}
|
|
2692
|
-
function
|
|
2693
|
-
return
|
|
2692
|
+
function bi(e, t) {
|
|
2693
|
+
return M("sha256").update(JSON.stringify({
|
|
2694
2694
|
item: e,
|
|
2695
2695
|
metadata: t
|
|
2696
2696
|
})).digest("hex");
|
|
2697
2697
|
}
|
|
2698
2698
|
//#endregion
|
|
2699
2699
|
//#region src/lib/server/senat_document_sources.ts
|
|
2700
|
-
var
|
|
2701
|
-
function
|
|
2700
|
+
var xi = new Set(["senat.fr", "www.senat.fr"]), Si = "https://www.senat.fr";
|
|
2701
|
+
function Ci(e) {
|
|
2702
2702
|
return e?.trim() || void 0;
|
|
2703
2703
|
}
|
|
2704
|
-
function
|
|
2704
|
+
function wi(e) {
|
|
2705
2705
|
try {
|
|
2706
|
-
let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`,
|
|
2707
|
-
return
|
|
2706
|
+
let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`, Si);
|
|
2707
|
+
return xi.has(n.hostname.toLowerCase()) ? n : void 0;
|
|
2708
2708
|
} catch {
|
|
2709
2709
|
return;
|
|
2710
2710
|
}
|
|
2711
2711
|
}
|
|
2712
|
-
function
|
|
2713
|
-
let t =
|
|
2712
|
+
function Ti(e) {
|
|
2713
|
+
let t = Ci(e);
|
|
2714
2714
|
if (t === void 0) return {
|
|
2715
2715
|
publicUrl: null,
|
|
2716
2716
|
status: "no_url"
|
|
2717
2717
|
};
|
|
2718
|
-
let n =
|
|
2718
|
+
let n = wi(t);
|
|
2719
2719
|
if (n === void 0) return {
|
|
2720
2720
|
publicUrl: t,
|
|
2721
2721
|
status: "unsupported_source"
|
|
2722
2722
|
};
|
|
2723
2723
|
let r = n.pathname;
|
|
2724
2724
|
if (/^\/akomantoso\/[^/]+\.akn\.xml$/iu.test(r)) return {
|
|
2725
|
-
akomaNtosoUrl: `${
|
|
2725
|
+
akomaNtosoUrl: `${Si}${r}`,
|
|
2726
2726
|
publicUrl: n.toString(),
|
|
2727
2727
|
status: "available"
|
|
2728
2728
|
};
|
|
@@ -2731,17 +2731,17 @@ function Ci(e) {
|
|
|
2731
2731
|
publicUrl: n.toString(),
|
|
2732
2732
|
status: "unsupported_source"
|
|
2733
2733
|
} : {
|
|
2734
|
-
akomaNtosoUrl: `${
|
|
2734
|
+
akomaNtosoUrl: `${Si}/akomantoso/${i.replace(/\.html$/iu, ".akn.xml")}`,
|
|
2735
2735
|
publicUrl: n.toString(),
|
|
2736
2736
|
status: "available"
|
|
2737
2737
|
};
|
|
2738
2738
|
}
|
|
2739
|
-
function
|
|
2739
|
+
function Ei(e) {
|
|
2740
2740
|
return /^\s*(?:<\?xml\b[^>]*>\s*)?<akomaNtoso[\s/>]/iu.test(e);
|
|
2741
2741
|
}
|
|
2742
2742
|
//#endregion
|
|
2743
2743
|
//#region src/lib/alineas/alineas_numbers.ts
|
|
2744
|
-
var
|
|
2744
|
+
var Di = {
|
|
2745
2745
|
"0150a855548f15a2af52ea057be53f5d": 1,
|
|
2746
2746
|
"039826cf379b94afefe90b25c6045ca0": 1,
|
|
2747
2747
|
"03a7e564b84662f4d957c51018e26244": 1,
|
|
@@ -21715,7 +21715,7 @@ var Ti = {
|
|
|
21715
21715
|
d16d29c923bd60c7b095b66c6058fe60: 1664,
|
|
21716
21716
|
"1c14c2adf5cfda3220b2057160e10e91": 1665,
|
|
21717
21717
|
e44c55ca1ac46ff46420686a466c9fc6: 1665
|
|
21718
|
-
},
|
|
21718
|
+
}, Oi = "\np:has(.alinea) {\n margin: 0.6em 0;\n}\n.alinea {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 1.5em;\n height: 1.5em;\n padding: 0 0.3em;\n margin-right: 0.3em;\n font-size: 0.75em;\n font-weight: bold;\n color: #555;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 1em;\n vertical-align: middle;\n}\n", ki = "\nh1 {\n font-size: 1.8em;\n margin: 1em 0 0.5em 0;\n}\nh2 {\n font-size: 1.5em;\n margin: 0.9em 0 0.4em 0;\n}\nh3 {\n font-size: 1.3em;\n margin: 0.8em 0 0.4em 0;\n}\nh4 {\n font-size: 1.15em;\n margin: 0.7em 0 0.3em 0;\n}\nh5 {\n font-size: 1.05em;\n margin: 0.6em 0 0.3em 0;\n}\nh6 {\n font-size: 1em;\n margin: 0.5em 0 0.3em 0;\n}\n", Ai = "\n.expose-motifs-titre {\n font-size: 1.1em;\n font-weight: bold;\n color: #0070b9;\n margin: 1em 0 0.5em 0;\n}\n.expose-motifs {\n border-left: 3px solid #0070b9;\n padding-left: 1em;\n margin: 0.5em 0 1em 0;\n color: #333;\n}\n.expose-motifs p {\n margin: 0.5em 0;\n}\n", ji = "\nol {\n list-style: none;\n padding-left: 0;\n margin: 0.5em 0;\n counter-reset: list-counter;\n}\nol > li {\n counter-increment: list-counter;\n margin: 0.3em 0;\n padding-left: 2.3em;\n position: relative;\n}\nol > li::before {\n content: counter(list-counter);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 1.5em;\n height: 1.5em;\n padding: 0 0.3em;\n font-size: 0.75em;\n font-weight: bold;\n color: #555;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 1em;\n position: absolute;\n left: 0;\n top: 0.1em;\n}\n", Mi = "\n.cover-title {\n font-size: 1.8em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 1em 0;\n}\n.cover-subtitle {\n font-size: 1.4em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 0.8em 0;\n}\n.cover-info {\n text-align: center;\n margin: 0.3em 0;\n color: #333;\n}\n.cover-year {\n font-size: 2em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 1em 0;\n}\n", Ni = {
|
|
21719
21719
|
assnatetatagr: { bold: !0 },
|
|
21720
21720
|
assnatetatagrgr: { bold: !0 },
|
|
21721
21721
|
assnatetatatr: { bold: !0 },
|
|
@@ -21816,29 +21816,29 @@ var Ti = {
|
|
|
21816
21816
|
assnatxl67: { align: "center" },
|
|
21817
21817
|
assnatenteteequilibre: { align: "center" }
|
|
21818
21818
|
};
|
|
21819
|
-
function
|
|
21820
|
-
let t = Object.keys(
|
|
21821
|
-
for (let n of t) if (e.includes(n)) return
|
|
21819
|
+
function Pi(e) {
|
|
21820
|
+
let t = Object.keys(Ni).sort((e, t) => t.length - e.length);
|
|
21821
|
+
for (let n of t) if (e.includes(n)) return Ni[n];
|
|
21822
21822
|
return null;
|
|
21823
21823
|
}
|
|
21824
|
-
function
|
|
21825
|
-
return
|
|
21824
|
+
function Fi(e) {
|
|
21825
|
+
return Oe.createHash("md5").update(e).digest("hex");
|
|
21826
21826
|
}
|
|
21827
|
-
function
|
|
21827
|
+
function Ii(e) {
|
|
21828
21828
|
return e ? /font-weight\s*:\s*(bold|[6-9]00|1000)/i.test(e) || /font-family\s*:\s*[^;]*\bBold\b/i.test(e) : !1;
|
|
21829
21829
|
}
|
|
21830
|
-
function
|
|
21830
|
+
function Li(e) {
|
|
21831
21831
|
return e ? /font-style\s*:\s*italic/i.test(e) || /font-family\s*:\s*[^;]*\bItalic\b/i.test(e) : !1;
|
|
21832
21832
|
}
|
|
21833
|
-
function
|
|
21833
|
+
function Ri(e) {
|
|
21834
21834
|
if (!e || !/vertical-align\s*:\s*super/i.test(e)) return !1;
|
|
21835
21835
|
let t = e.match(/font-size\s*:\s*([\d.]+)pt/i);
|
|
21836
21836
|
return !(t && parseFloat(t[1]) < 8);
|
|
21837
21837
|
}
|
|
21838
|
-
function
|
|
21838
|
+
function zi(e) {
|
|
21839
21839
|
return e ? /vertical-align\s*:\s*sub/i.test(e) : !1;
|
|
21840
21840
|
}
|
|
21841
|
-
function
|
|
21841
|
+
function Bi(e) {
|
|
21842
21842
|
if (!e) return;
|
|
21843
21843
|
let t = [
|
|
21844
21844
|
"width",
|
|
@@ -21873,15 +21873,15 @@ function Ri(e) {
|
|
|
21873
21873
|
}
|
|
21874
21874
|
return n.length > 0 ? n.join("; ") : void 0;
|
|
21875
21875
|
}
|
|
21876
|
-
function
|
|
21876
|
+
function Vi(e, t) {
|
|
21877
21877
|
return !!(e && /text-align\s*:\s*center/i.test(e) || t && /center/i.test(t));
|
|
21878
21878
|
}
|
|
21879
|
-
function
|
|
21879
|
+
function Hi(e) {
|
|
21880
21880
|
if (!e) return null;
|
|
21881
21881
|
let t = e.match(/text-align\s*:\s*(left|center|right|justify)/i);
|
|
21882
21882
|
return t ? t[1].toLowerCase() : null;
|
|
21883
21883
|
}
|
|
21884
|
-
function
|
|
21884
|
+
function Ui(e) {
|
|
21885
21885
|
if (!e) return null;
|
|
21886
21886
|
for (let [t, n] of [
|
|
21887
21887
|
[/assnat1Tome|assnatAN1PARTIE/i, 1],
|
|
@@ -21893,8 +21893,8 @@ function Vi(e) {
|
|
|
21893
21893
|
]) if (t.test(e)) return n;
|
|
21894
21894
|
return null;
|
|
21895
21895
|
}
|
|
21896
|
-
function
|
|
21897
|
-
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a =
|
|
21896
|
+
function Wi(e, t = {}) {
|
|
21897
|
+
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = w(e, { xml: { decodeEntities: !1 } });
|
|
21898
21898
|
a("style, script, meta, link").remove(), a(".assnatHeader, .assnatFooter, .assnatHeaderLeft, .assnatHeaderandFooter").remove(), a(".assnatFARSautApres, .assnatFARSautAvant, .assnatFARSautPageNiv0, .assnatFARSautPageNiv1, .assnatFARSautPageNiv1PG").remove(), a(".assnatFARTT08Bleu").each((e, t) => {
|
|
21899
21899
|
let n = a(t).closest("table");
|
|
21900
21900
|
n.length > 0 && n.remove();
|
|
@@ -21919,7 +21919,7 @@ function Hi(e, t = {}) {
|
|
|
21919
21919
|
if (i.length !== 0 && !(n.parents("del").length > 0 || n.find("del img").length > 0) && !(i.parent("del").length > 0)) {
|
|
21920
21920
|
let e = i.attr();
|
|
21921
21921
|
if (e && (e.width === "45" && (e.height === "31" || e.height === "30") || parseInt(e.width || "0", 10) < 50 && parseInt(e.height || "0", 10) < 50) && r.includes("position:absolute")) {
|
|
21922
|
-
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ?
|
|
21922
|
+
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? Fi(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
|
|
21923
21923
|
n.replaceWith(`<span class="alinea"${i}></span>`);
|
|
21924
21924
|
return;
|
|
21925
21925
|
}
|
|
@@ -21938,7 +21938,7 @@ function Hi(e, t = {}) {
|
|
|
21938
21938
|
(!r || r === "\xA0") && n.remove();
|
|
21939
21939
|
}), a("span[style*=\"display:block\"][style*=\"position:absolute\"]:not(.alinea)").remove(), a("del").remove();
|
|
21940
21940
|
function o(e) {
|
|
21941
|
-
let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i =
|
|
21941
|
+
let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = Ii(n) || r === "b" || r === "strong", o = Li(n) || r === "i" || r === "em", s = Ri(n) || r === "sup", c = zi(n) || r === "sub", l = t.attr("class") || "";
|
|
21942
21942
|
return /bold/i.test(l) && (i = !0), /strongemphasis/i.test(l) ? i = !0 : /italic|emphasis/i.test(l) && (o = !0), {
|
|
21943
21943
|
bold: i,
|
|
21944
21944
|
italic: o,
|
|
@@ -21972,7 +21972,7 @@ function Hi(e, t = {}) {
|
|
|
21972
21972
|
c = e;
|
|
21973
21973
|
}
|
|
21974
21974
|
for (a("p").each((e, t) => {
|
|
21975
|
-
let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s =
|
|
21975
|
+
let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s = Ui(i);
|
|
21976
21976
|
if (i.includes("assnatFARCouvTitreD")) {
|
|
21977
21977
|
let e = r.html() || "";
|
|
21978
21978
|
r.replaceWith(`<p class="cover-subtitle">${e}</p>`);
|
|
@@ -22005,11 +22005,11 @@ function Hi(e, t = {}) {
|
|
|
22005
22005
|
let c = r.text().trim().startsWith("«");
|
|
22006
22006
|
if (s && !c) {
|
|
22007
22007
|
let e = a(`<h${s}>${r.html() || ""}</h${s}>`);
|
|
22008
|
-
n &&
|
|
22008
|
+
n && Vi(o, i) && e.attr("align", "center"), r.replaceWith(e);
|
|
22009
22009
|
} else {
|
|
22010
|
-
let e =
|
|
22010
|
+
let e = Pi(i), t;
|
|
22011
22011
|
if (n) {
|
|
22012
|
-
let n =
|
|
22012
|
+
let n = Hi(o);
|
|
22013
22013
|
n && n !== "justify" && n !== "left" ? t = n : e?.align && (t = e.align);
|
|
22014
22014
|
}
|
|
22015
22015
|
if (r.removeAttr("style").removeAttr("class"), t && r.attr("align", t), e?.bold) {
|
|
@@ -22019,7 +22019,7 @@ function Hi(e, t = {}) {
|
|
|
22019
22019
|
}
|
|
22020
22020
|
}), a("h1, h2, h3, h4, h5, h6").each((e, t) => {
|
|
22021
22021
|
let r = a(t), i = r.attr("style"), o = r.attr("class");
|
|
22022
|
-
n &&
|
|
22022
|
+
n && Vi(i, o) ? (r.removeAttr("style").removeAttr("class"), r.attr("align", "center")) : r.removeAttr("style").removeAttr("class");
|
|
22023
22023
|
}), a("a").each((e, t) => {
|
|
22024
22024
|
let n = a(t), r = n.attr("href"), i = n.attr("id"), o = { ...t.attribs || {} };
|
|
22025
22025
|
for (let e of Object.keys(o)) e !== "href" && e !== "id" && n.removeAttr(e);
|
|
@@ -22058,7 +22058,7 @@ function Hi(e, t = {}) {
|
|
|
22058
22058
|
}), a("br").each((e, t) => {
|
|
22059
22059
|
a(t).removeAttr("style").removeAttr("class");
|
|
22060
22060
|
}), a("table, tr, td, th, thead, tbody, tfoot").each((e, t) => {
|
|
22061
|
-
let n = a(t), r =
|
|
22061
|
+
let n = a(t), r = Bi(n.attr("style"));
|
|
22062
22062
|
n.removeAttr("style").removeAttr("class"), r && n.attr("style", r);
|
|
22063
22063
|
}), a("td, th").each((e, t) => {
|
|
22064
22064
|
let n = a(t), r = n.children();
|
|
@@ -22076,17 +22076,17 @@ function Hi(e, t = {}) {
|
|
|
22076
22076
|
!isNaN(e) && e > 1 && n.attr("style", `counter-reset: list-counter ${e - 1}`), n.attr("start", r);
|
|
22077
22077
|
}
|
|
22078
22078
|
}), a("li").each((e, t) => {
|
|
22079
|
-
let n = a(t), r =
|
|
22079
|
+
let n = a(t), r = Hi(n.attr("style"));
|
|
22080
22080
|
n.removeAttr("style").removeAttr("class"), r === "center" && n.attr("style", "text-align: center");
|
|
22081
22081
|
let i = n.html() || "", o = i.replace(/^(\s| | |\u00a0)+/, "");
|
|
22082
22082
|
o !== i && n.html(o);
|
|
22083
|
-
}),
|
|
22083
|
+
}), Gi(a), Ki(a, i);
|
|
22084
22084
|
let l = a("body").html() || a.html(), u = l.includes("class=\"alinea"), d = a("ol").length > 0, f = a("h1, h2, h3, h4, h5, h6").length > 0, p = l.includes("class=\"expose-motifs"), m = l.includes("class=\"cover-title\"") || l.includes("class=\"cover-subtitle\"") || l.includes("class=\"cover-info\"") || l.includes("class=\"cover-year\""), h = "";
|
|
22085
|
-
m && (h +=
|
|
22085
|
+
m && (h += Mi), f && (h += ki), p && (h += Ai), u && (h += Oi), d && (h += ji);
|
|
22086
22086
|
let g = h ? `<style>${h}</style>\n${l}` : l;
|
|
22087
|
-
return g = g.replace(/>\s+</g, "> <").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n{3,}/g, "\n\n").split("\n").map((e) => e.trim()).filter((e) => e.length > 0).join("\n"), g = g.replace(/ /g, "\xA0"), r && (g = g.replace(/<p[^>]*>\s*( | | |\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*( | | |\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), g = g.replace(/<span[^>]*>\s*<\/span>/gi, ""), g = g.replace(/ class=""/g, ""), g =
|
|
22087
|
+
return g = g.replace(/>\s+</g, "> <").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n{3,}/g, "\n\n").split("\n").map((e) => e.trim()).filter((e) => e.length > 0).join("\n"), g = g.replace(/ /g, "\xA0"), r && (g = g.replace(/<p[^>]*>\s*( | | |\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*( | | |\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), g = g.replace(/<span[^>]*>\s*<\/span>/gi, ""), g = g.replace(/ class=""/g, ""), g = qi(g), g = g.replace(/<(strong|em|b|i|sup|sub)>\s*( | | |\u00a0|\s)*\s*<\/\1>/gi, "").replace(/<(strong|em|b|i)>( | | |\u00a0)+<\/\1>/gi, " ").replace(/<br\s*\/?>/gi, "<br/>").replace(/ +/g, " ").trim(), g;
|
|
22088
22088
|
}
|
|
22089
|
-
function
|
|
22089
|
+
function Gi(e) {
|
|
22090
22090
|
e("span[id]").each((t, n) => {
|
|
22091
22091
|
let r = e(n), i = r.attr("id"), a = n.attribs || {}, o = Object.keys(a);
|
|
22092
22092
|
if (o.length !== 1 || o[0] !== "id") return;
|
|
@@ -22109,13 +22109,13 @@ function Ui(e) {
|
|
|
22109
22109
|
l.trim() === u.trim() && (s.attr("id", i), r.replaceWith(r.html() || ""));
|
|
22110
22110
|
});
|
|
22111
22111
|
}
|
|
22112
|
-
function
|
|
22112
|
+
function Ki(e, t = !1) {
|
|
22113
22113
|
let n = e("body");
|
|
22114
22114
|
if (n.length === 0) return;
|
|
22115
22115
|
let r = n.find("span.alinea[data-image-hash]"), i = -1;
|
|
22116
22116
|
r.each((n, r) => {
|
|
22117
22117
|
let a = e(r), o = a.attr("data-image-hash"), s;
|
|
22118
|
-
if (o &&
|
|
22118
|
+
if (o && Di[o] !== void 0 && (s = Di[o]), s === void 0) {
|
|
22119
22119
|
if (t) throw Error(`Missing alinea number mapping for image hash: "${o}". Please extract images, review them, and update the mapping in "src/lib/alineas/alineas_numbers.ts".`);
|
|
22120
22120
|
a.remove();
|
|
22121
22121
|
return;
|
|
@@ -22127,11 +22127,11 @@ function Wi(e, t = !1) {
|
|
|
22127
22127
|
i = s, a.attr("data-alinea", String(s)), a.text(String(s)), a.removeAttr("data-image-hash");
|
|
22128
22128
|
});
|
|
22129
22129
|
}
|
|
22130
|
-
function
|
|
22130
|
+
function qi(e) {
|
|
22131
22131
|
let t = e;
|
|
22132
22132
|
return t = t.replace(/<\/strong>(\s*)<strong>/gi, "$1"), t = t.replace(/<\/em>(\s*)<em>/gi, "$1"), t = t.replace(/<\/sup>(\s*)<sup>/gi, "$1"), t = t.replace(/<\/sub>(\s*)<sub>/gi, "$1"), t;
|
|
22133
22133
|
}
|
|
22134
|
-
function
|
|
22134
|
+
function Ji(e, t = {}) {
|
|
22135
22135
|
return `<!DOCTYPE html>
|
|
22136
22136
|
<html lang="fr">
|
|
22137
22137
|
<head>
|
|
@@ -22139,33 +22139,33 @@ function Ki(e, t = {}) {
|
|
|
22139
22139
|
<title>Document simplifié</title>
|
|
22140
22140
|
</head>
|
|
22141
22141
|
<body>
|
|
22142
|
-
${
|
|
22142
|
+
${Wi(e, t)}
|
|
22143
22143
|
</body>
|
|
22144
22144
|
</html>`;
|
|
22145
22145
|
}
|
|
22146
22146
|
//#endregion
|
|
22147
22147
|
//#region src/lib/server/text_parsers/transformers.ts
|
|
22148
|
-
function
|
|
22148
|
+
function Yi(e, t) {
|
|
22149
22149
|
let n = "transformation_", r = {};
|
|
22150
|
-
for (let e of
|
|
22150
|
+
for (let e of N.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
|
|
22151
22151
|
let i = e.slice(15, -5), a = i.split(".").map((e) => parseInt(e) - 1), o = r;
|
|
22152
22152
|
for (let e of a.slice(1)) {
|
|
22153
22153
|
let t = o.transformations ??= [];
|
|
22154
22154
|
for (; e >= t.length;) t.push({});
|
|
22155
22155
|
o = t[e];
|
|
22156
22156
|
}
|
|
22157
|
-
o.output =
|
|
22158
|
-
let { sourceMap: s, title: c } =
|
|
22157
|
+
o.output = N.readFileSync(ke.join(t, `${n}${i}.html`), { encoding: "utf-8" });
|
|
22158
|
+
let { sourceMap: s, title: c } = N.readJsonSync(ke.join(t, e), { encoding: "utf-8" });
|
|
22159
22159
|
o.sourceMap = s ?? [], o.title = c;
|
|
22160
22160
|
}
|
|
22161
|
-
return
|
|
22161
|
+
return Xi(r, e), r;
|
|
22162
22162
|
}
|
|
22163
|
-
function
|
|
22164
|
-
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations)
|
|
22163
|
+
function Xi(e, t) {
|
|
22164
|
+
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) Xi(n, t), t = n.output;
|
|
22165
22165
|
return t;
|
|
22166
22166
|
}
|
|
22167
|
-
function
|
|
22168
|
-
if (
|
|
22167
|
+
function Zi(e, t, n = "1") {
|
|
22168
|
+
if (N.ensureDirSync(t), e.transformations === void 0) N.writeJsonSync(ke.join(t, `transformation_${n}.json`), {
|
|
22169
22169
|
sourceMap: e.sourceMap,
|
|
22170
22170
|
title: e.title
|
|
22171
22171
|
}, {
|
|
@@ -22173,72 +22173,376 @@ function Yi(e, t, n = "1") {
|
|
|
22173
22173
|
spaces: 2
|
|
22174
22174
|
});
|
|
22175
22175
|
else {
|
|
22176
|
-
|
|
22176
|
+
N.writeJsonSync(ke.join(t, `transformation_${n}.json`), { title: e.title }, {
|
|
22177
22177
|
encoding: "utf-8",
|
|
22178
22178
|
spaces: 2
|
|
22179
22179
|
});
|
|
22180
|
-
for (let [r, i] of e.transformations.entries())
|
|
22180
|
+
for (let [r, i] of e.transformations.entries()) Zi(i, t, `${n}.${r + 1}`);
|
|
22181
22181
|
}
|
|
22182
|
-
e.output !== void 0 &&
|
|
22182
|
+
e.output !== void 0 && N.writeFileSync(ke.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
|
|
22183
22183
|
}
|
|
22184
22184
|
//#endregion
|
|
22185
22185
|
//#region src/lib/server/linkers/html.ts
|
|
22186
|
-
async function
|
|
22186
|
+
async function Qi({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, htmlFilePath: i, htmlTransformationsInputDir: a, htmlTransformationsOutputDir: o, htmlWithLinksFilePath: s, htmlWithLinksOrReferencesFilePath: c, htmlWithLinksTransformationsOutputDir: l, htmlWithReferencesFilePath: u, linkBaseUrl: d, linkType: f, logIgnoredReferencesTypes: p, logPartialReferences: m, logReferences: h, referredLegifranceTextsInfosFilePath: g }) {
|
|
22187
22187
|
let _ = t ?? (e === void 0 ? void 0 : new se(e));
|
|
22188
22188
|
if (_ === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
22189
|
-
let v = await
|
|
22190
|
-
a === void 0 ? (
|
|
22191
|
-
let
|
|
22192
|
-
s !== void 0 &&
|
|
22193
|
-
let { outputByType:
|
|
22189
|
+
let v = await N.readFile(i, { encoding: "utf-8" }), ee;
|
|
22190
|
+
a === void 0 ? (ee = ge({ removeAWithHref: !0 })(v), o !== void 0 && Zi(ee, o)) : ee = Yi(v, a);
|
|
22191
|
+
let y = [];
|
|
22192
|
+
s !== void 0 && y.push("links"), c !== void 0 && y.push("links_or_references"), u !== void 0 && y.push("references");
|
|
22193
|
+
let { outputByType: b, referredLegifranceTextCountByCid: x } = await de({
|
|
22194
22194
|
legiResolver: _,
|
|
22195
22195
|
date: n,
|
|
22196
22196
|
defaultTextId: r,
|
|
22197
|
-
htmlTransformation:
|
|
22197
|
+
htmlTransformation: ee,
|
|
22198
22198
|
inputHtml: v,
|
|
22199
22199
|
linkBaseUrl: d,
|
|
22200
22200
|
linkType: f,
|
|
22201
22201
|
logIgnoredReferencesTypes: p,
|
|
22202
22202
|
logPartialReferences: m,
|
|
22203
22203
|
logReferences: h,
|
|
22204
|
-
outputTypes:
|
|
22204
|
+
outputTypes: y,
|
|
22205
22205
|
referredLegifranceTextsInfos: g !== void 0
|
|
22206
22206
|
}), S = {};
|
|
22207
22207
|
s !== void 0 && (S.links = s), c !== void 0 && (S.links_or_references = c), u !== void 0 && (S.references = u);
|
|
22208
|
-
for (let [e, t] of Object.entries(
|
|
22208
|
+
for (let [e, t] of Object.entries(b)) {
|
|
22209
22209
|
let n = S[e];
|
|
22210
|
-
n !== void 0 && await
|
|
22210
|
+
n !== void 0 && await N.writeFile(n, t.html, { encoding: "utf-8" });
|
|
22211
22211
|
}
|
|
22212
|
-
|
|
22212
|
+
b.links !== void 0 && l !== void 0 && Zi(ge()(b.links.html), l), g !== void 0 && await N.writeJson(g, x, {
|
|
22213
22213
|
encoding: "utf-8",
|
|
22214
22214
|
spaces: 2
|
|
22215
22215
|
});
|
|
22216
22216
|
}
|
|
22217
22217
|
//#endregion
|
|
22218
22218
|
//#region src/lib/server/tables_of_contents.ts
|
|
22219
|
-
async function
|
|
22220
|
-
let i =
|
|
22221
|
-
for await (let e of
|
|
22219
|
+
async function $i(e, t, n, r) {
|
|
22220
|
+
let i = Yi(await N.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new j(a), s = await N.readJson(n, { encoding: "utf-8" });
|
|
22221
|
+
for await (let e of ue({
|
|
22222
22222
|
context: o,
|
|
22223
22223
|
tableOfContents: s,
|
|
22224
22224
|
transformation: i
|
|
22225
22225
|
}));
|
|
22226
|
-
await
|
|
22226
|
+
await N.writeJson(r, s, {
|
|
22227
22227
|
encoding: "utf-8",
|
|
22228
22228
|
spaces: 2
|
|
22229
22229
|
});
|
|
22230
22230
|
}
|
|
22231
|
-
async function
|
|
22232
|
-
let r =
|
|
22233
|
-
await
|
|
22231
|
+
async function ea(e, t, n) {
|
|
22232
|
+
let r = Yi(await N.readFile(e, { encoding: "utf-8" }), t).output, i = x(r);
|
|
22233
|
+
await N.writeJson(n, i, {
|
|
22234
22234
|
encoding: "utf-8",
|
|
22235
22235
|
spaces: 2
|
|
22236
22236
|
});
|
|
22237
22237
|
}
|
|
22238
22238
|
//#endregion
|
|
22239
22239
|
//#region src/lib/server/legi/resolvers.ts
|
|
22240
|
-
function
|
|
22240
|
+
function ta({ canutesDb: e }) {
|
|
22241
22241
|
return new se(e);
|
|
22242
22242
|
}
|
|
22243
22243
|
//#endregion
|
|
22244
|
-
|
|
22244
|
+
//#region src/lib/server/jurisprudence_citations.ts
|
|
22245
|
+
async function na({ document: e, resolve: t, textTitlesInfos: n }) {
|
|
22246
|
+
let r = [], i = new j(e.texte);
|
|
22247
|
+
i.textTitlesInfos = n;
|
|
22248
|
+
for (let n of he(i)) {
|
|
22249
|
+
let i = [...a(n)], o = i.filter((e) => e.type === "texte" && e.nature === "CODE" && e.cid !== void 0), s = i.filter((e) => e.type === "article");
|
|
22250
|
+
if (!("position" in n) || n.position === void 0 || s.length === 0) continue;
|
|
22251
|
+
let c = e.texte.slice(n.position.start, n.position.stop);
|
|
22252
|
+
for (let a of s) {
|
|
22253
|
+
let l = o.length === 1 && a.num ? await t({
|
|
22254
|
+
codeId: o[0].cid,
|
|
22255
|
+
numero: a.num
|
|
22256
|
+
}) : [], u = [...new Set(l)];
|
|
22257
|
+
r.push({
|
|
22258
|
+
mention: c,
|
|
22259
|
+
position: {
|
|
22260
|
+
start: n.position.start,
|
|
22261
|
+
stop: n.position.stop
|
|
22262
|
+
},
|
|
22263
|
+
passage: e.texte,
|
|
22264
|
+
articleId: l.length === 1 && s.length === 1 && i.length === 2 ? l[0] : null,
|
|
22265
|
+
candidats: u,
|
|
22266
|
+
selectionPossible: s.length === 1 && i.length === 2 && o.length === 1,
|
|
22267
|
+
redaction: "indéterminée",
|
|
22268
|
+
origine: "indéterminée",
|
|
22269
|
+
relation: "citation"
|
|
22270
|
+
});
|
|
22271
|
+
}
|
|
22272
|
+
}
|
|
22273
|
+
return {
|
|
22274
|
+
document: e,
|
|
22275
|
+
citations: r,
|
|
22276
|
+
perimetre: "citations explicites d'articles de code"
|
|
22277
|
+
};
|
|
22278
|
+
}
|
|
22279
|
+
//#endregion
|
|
22280
|
+
//#region src/lib/server/legifrance_article_search.ts
|
|
22281
|
+
function ra(e) {
|
|
22282
|
+
if (!e) return "";
|
|
22283
|
+
let t = w(e);
|
|
22284
|
+
return t("script, style").remove(), t.text().replace(/\u00a0/g, " ").replace(/\s+/g, " ").trim();
|
|
22285
|
+
}
|
|
22286
|
+
//#endregion
|
|
22287
|
+
//#region src/lib/server/legifrance_jurisprudence_search.ts
|
|
22288
|
+
function ia(e) {
|
|
22289
|
+
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
22290
|
+
}
|
|
22291
|
+
function aa(e) {
|
|
22292
|
+
if (typeof e == "string") return e;
|
|
22293
|
+
let t = ia(e)?.["#text"];
|
|
22294
|
+
return typeof t == "string" ? t : void 0;
|
|
22295
|
+
}
|
|
22296
|
+
function oa(e) {
|
|
22297
|
+
let t = ia(e), n = aa(ia(t?.BLOC_TEXTUEL)?.CONTENU), r = aa(ia(ia(t?.TEXTE)?.BLOC_TEXTUEL)?.CONTENU);
|
|
22298
|
+
return ra(n ?? r);
|
|
22299
|
+
}
|
|
22300
|
+
function sa({ data: e, dataset: t, dateDec: n, id: r, juridiction: i, nature: a, numero: o, path: s, solution: c, titre: l }) {
|
|
22301
|
+
let u = {
|
|
22302
|
+
content: oa(e),
|
|
22303
|
+
dataset: t,
|
|
22304
|
+
dateDec: n,
|
|
22305
|
+
id: r,
|
|
22306
|
+
juridiction: i,
|
|
22307
|
+
nature: a,
|
|
22308
|
+
numero: o,
|
|
22309
|
+
path: s,
|
|
22310
|
+
solution: c,
|
|
22311
|
+
titre: l
|
|
22312
|
+
};
|
|
22313
|
+
return {
|
|
22314
|
+
...u,
|
|
22315
|
+
sourceHash: M("sha256").update(JSON.stringify(u)).digest("hex")
|
|
22316
|
+
};
|
|
22317
|
+
}
|
|
22318
|
+
//#endregion
|
|
22319
|
+
//#region src/lib/server/jurisprudence_jade.ts
|
|
22320
|
+
var ca = class extends Error {}, la = class extends Error {};
|
|
22321
|
+
function ua(e) {
|
|
22322
|
+
if (e.dataset !== "JADE" || !e.path.trim() || !/^CETATEXT\d{12}$/.test(e.id) || !/^conseil d['’]état$/iu.test(e.juridiction.trim()) || !/^\d{4}-\d{2}-\d{2}$/.test(e.dateDec)) throw new ca("Représentation JADE CE invalide");
|
|
22323
|
+
let t = sa({
|
|
22324
|
+
...e,
|
|
22325
|
+
nature: "",
|
|
22326
|
+
numero: "",
|
|
22327
|
+
solution: "",
|
|
22328
|
+
titre: ""
|
|
22329
|
+
});
|
|
22330
|
+
if (!t.content.trim()) throw new ca("Contenu JADE absent");
|
|
22331
|
+
return {
|
|
22332
|
+
dataset: "JADE",
|
|
22333
|
+
path: e.path,
|
|
22334
|
+
id: e.id,
|
|
22335
|
+
publication: `https://www.legifrance.gouv.fr/ceta/id/${e.id}`,
|
|
22336
|
+
dateDecision: e.dateDec,
|
|
22337
|
+
...e.titre?.trim() ? { titre: e.titre } : {},
|
|
22338
|
+
texte: t.content,
|
|
22339
|
+
revision: M("sha256").update(JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e.localeCompare(t))) : t)).digest("hex")
|
|
22340
|
+
};
|
|
22341
|
+
}
|
|
22342
|
+
function da(e) {
|
|
22343
|
+
return async ({ codeId: t, numero: n }) => (await e`
|
|
22344
|
+
SELECT id FROM legifrance.article
|
|
22345
|
+
WHERE data -> 'CONTEXTE' -> 'TEXTE' ->> '@cid' = ${t}
|
|
22346
|
+
AND regexp_replace(upper(num), '[.[:space:]]', '', 'g') =
|
|
22347
|
+
regexp_replace(upper(${n}), '[.[:space:]]', '', 'g')
|
|
22348
|
+
ORDER BY id
|
|
22349
|
+
`).map(({ id: e }) => e);
|
|
22350
|
+
}
|
|
22351
|
+
function fa(e) {
|
|
22352
|
+
if (!e || !/^\d{4}-\d{2}-\d{2}$/.test(e)) return !1;
|
|
22353
|
+
let t = new Date(e);
|
|
22354
|
+
return !Number.isNaN(t.valueOf()) && t.toISOString().slice(0, 10) === e;
|
|
22355
|
+
}
|
|
22356
|
+
async function pa(e, t, n) {
|
|
22357
|
+
let r = n ? Array.isArray(n) ? n : [n] : [];
|
|
22358
|
+
if (r.some((e) => !e || typeof e.dateReference != "string" || !fa(e.dateReference) || typeof e.articleId != "string" || !e.articleId.trim() || Array.isArray(n) && !e.reference || e.reference && (e.reference.dataset !== "JADE" || typeof e.reference.path != "string" || typeof e.reference.revision != "string" || typeof e.reference.mention != "string" || !e.reference.position || !Number.isSafeInteger(e.reference.position.start) || !Number.isSafeInteger(e.reference.position.stop)))) throw Error("Sélection d'article invalide");
|
|
22359
|
+
return C(e, async (e) => {
|
|
22360
|
+
let i = await e`
|
|
22361
|
+
SELECT dataset, path, id, juridiction, date_dec::text AS "dateDec", titre, data
|
|
22362
|
+
FROM legifrance.jurisprudence WHERE dataset = 'JADE' AND path = ${t}
|
|
22363
|
+
`;
|
|
22364
|
+
if (i.length === 0) throw new ca("Représentation JADE absente");
|
|
22365
|
+
if (i.length !== 1) throw new ca("Représentation JADE ambiguë");
|
|
22366
|
+
let a = i[0], o = await ae(e), s = await we(o), c = /* @__PURE__ */ new Set(), l = da(e), u = await ma(a, async (e) => {
|
|
22367
|
+
let t = await l(e);
|
|
22368
|
+
return t.forEach((e) => c.add(e)), t;
|
|
22369
|
+
}, s);
|
|
22370
|
+
for (let e of r) {
|
|
22371
|
+
let t = e.reference;
|
|
22372
|
+
if (t && (t.dataset !== u.document.dataset || t.path !== u.document.path || t.revision !== u.document.revision || !u.citations.some((e) => e.mention === t.mention && e.position.start === t.position.start && e.position.stop === t.position.stop))) throw new la("Sélection de référence obsolète");
|
|
22373
|
+
}
|
|
22374
|
+
for (let e of r) {
|
|
22375
|
+
if (e.reference) continue;
|
|
22376
|
+
let t = u.citations.filter((t) => t.candidats.includes(e.articleId));
|
|
22377
|
+
if (t.length > 1 || t.length === 0 && u.citations.length > 1) throw new la("Sélection sans occurrence ambiguë");
|
|
22378
|
+
}
|
|
22379
|
+
let d = c.size ? await e`SELECT id, data #>> '{META,META_SPEC,META_ARTICLE,DATE_DEBUT}' AS debut,
|
|
22380
|
+
data #>> '{META,META_SPEC,META_ARTICLE,DATE_FIN}' AS fin
|
|
22381
|
+
FROM legifrance.article WHERE id = ANY(${e.array([...c])})` : [], f = r.some((e) => !e.reference && u.citations.some((t) => t.candidats.includes(e.articleId)));
|
|
22382
|
+
for (let e of u.citations) {
|
|
22383
|
+
let t = r.filter((t) => {
|
|
22384
|
+
if (!t.reference) return e.candidats.includes(t.articleId) && u.citations.filter((e) => e.candidats.includes(t.articleId)).length === 1 || !f && u.citations.length === 1;
|
|
22385
|
+
let n = t.reference;
|
|
22386
|
+
return n.dataset === u.document.dataset && n.path === u.document.path && n.revision === u.document.revision && n.mention === e.mention && n.position.start === e.position.start && n.position.stop === e.position.stop;
|
|
22387
|
+
});
|
|
22388
|
+
if (t.length === 0 || (e.articleId = null, t.length !== 1 || !e.selectionPossible)) continue;
|
|
22389
|
+
let n = t[0], i = d.filter((t) => e.candidats.includes(t.id));
|
|
22390
|
+
if (i.length !== e.candidats.length || i.some(({ debut: e, fin: t }) => !fa(e) || !fa(t) || e >= t)) continue;
|
|
22391
|
+
let a = i.filter(({ debut: e, fin: t }) => e <= n.dateReference && n.dateReference < t);
|
|
22392
|
+
a.length === 1 && a[0].id === n.articleId && (e.articleId = n.articleId);
|
|
22393
|
+
}
|
|
22394
|
+
let p = [...c].sort(), m = p.length === 0 ? [] : await e`
|
|
22395
|
+
SELECT id, num, data FROM legifrance.article WHERE id = ANY(${e.array(p)}) ORDER BY id
|
|
22396
|
+
`, h = (e) => JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e.localeCompare(t))) : t), g = M("sha256").update(h({
|
|
22397
|
+
titles: o.map(h).sort(),
|
|
22398
|
+
articles: m
|
|
22399
|
+
})).digest("hex");
|
|
22400
|
+
return {
|
|
22401
|
+
...u,
|
|
22402
|
+
referenceRevision: g,
|
|
22403
|
+
...n ? { selection: n } : {}
|
|
22404
|
+
};
|
|
22405
|
+
});
|
|
22406
|
+
}
|
|
22407
|
+
async function ma(e, t, n) {
|
|
22408
|
+
return na({
|
|
22409
|
+
document: ua(e),
|
|
22410
|
+
resolve: t,
|
|
22411
|
+
textTitlesInfos: n
|
|
22412
|
+
});
|
|
22413
|
+
}
|
|
22414
|
+
//#endregion
|
|
22415
|
+
//#region src/lib/server/jurisprudence_store.ts
|
|
22416
|
+
async function ha(e, t) {
|
|
22417
|
+
if (!t || t.includes("\0")) throw Error("Schéma invalide");
|
|
22418
|
+
await e`CREATE TABLE IF NOT EXISTS ${e(`${t}.citations_jade`)} (path text PRIMARY KEY, extraction jsonb NOT NULL, traite_le timestamptz NOT NULL)`;
|
|
22419
|
+
}
|
|
22420
|
+
async function ga(e, t, n = {}) {
|
|
22421
|
+
if (!t || t.includes("\0")) throw Error("Schéma invalide");
|
|
22422
|
+
let r = process.env.JURISPRUDENCE_MAX_EXTRACTIONS_ARTICLE, i = n.maxExtractionsArticle ?? (r === void 0 ? 100 : Number(r));
|
|
22423
|
+
if (!Number.isSafeInteger(i) || i < 1 || i > 1e3) throw Error("Limite de consultations JADE invalide (1 à 1000)");
|
|
22424
|
+
let a = e(`${t}.citations_jade`);
|
|
22425
|
+
return {
|
|
22426
|
+
async capture(t, n) {
|
|
22427
|
+
let r = await pa(e, t, n), [i] = await e`
|
|
22428
|
+
INSERT INTO ${a} (path, extraction, traite_le)
|
|
22429
|
+
VALUES (${t}, ${e.json(r)}, clock_timestamp())
|
|
22430
|
+
ON CONFLICT (path) DO UPDATE SET extraction = excluded.extraction, traite_le = excluded.traite_le
|
|
22431
|
+
RETURNING traite_le::text AS "traiteLe"`;
|
|
22432
|
+
return {
|
|
22433
|
+
...r,
|
|
22434
|
+
traiteLe: i.traiteLe
|
|
22435
|
+
};
|
|
22436
|
+
},
|
|
22437
|
+
async consultDecision(t) {
|
|
22438
|
+
return C(e, async (e) => {
|
|
22439
|
+
let [n] = await e`
|
|
22440
|
+
SELECT extraction, traite_le::text AS "traiteLe" FROM ${a} WHERE path = ${t}`;
|
|
22441
|
+
return n ? {
|
|
22442
|
+
etat: "capture",
|
|
22443
|
+
resultat: {
|
|
22444
|
+
...n.extraction,
|
|
22445
|
+
traiteLe: n.traiteLe
|
|
22446
|
+
}
|
|
22447
|
+
} : { etat: "non-traite" };
|
|
22448
|
+
});
|
|
22449
|
+
},
|
|
22450
|
+
async consultArticle(t) {
|
|
22451
|
+
return C(e, async (e) => {
|
|
22452
|
+
if ((await e`
|
|
22453
|
+
SELECT path FROM ${a} ORDER BY path LIMIT ${i + 1}`).length > i) throw Error(`Consultation JADE indisponible : limite de ${i} extractions dépassée`);
|
|
22454
|
+
let n = await e`
|
|
22455
|
+
SELECT path, extraction, traite_le::text AS "traiteLe" FROM ${a} ORDER BY path`, r = [], o = [];
|
|
22456
|
+
for (let e of n) {
|
|
22457
|
+
let n = e.extraction.citations.filter((e) => e.articleId === t), i = e.extraction.citations.filter((e) => e.articleId !== t && e.candidats.includes(t));
|
|
22458
|
+
n.length > 0 && r.push({
|
|
22459
|
+
...e.extraction,
|
|
22460
|
+
citations: n,
|
|
22461
|
+
traiteLe: e.traiteLe
|
|
22462
|
+
}), i.length > 0 && o.push({
|
|
22463
|
+
...e.extraction,
|
|
22464
|
+
citations: i,
|
|
22465
|
+
traiteLe: e.traiteLe
|
|
22466
|
+
});
|
|
22467
|
+
}
|
|
22468
|
+
return {
|
|
22469
|
+
resultats: r,
|
|
22470
|
+
resultatsPossibles: o
|
|
22471
|
+
};
|
|
22472
|
+
});
|
|
22473
|
+
},
|
|
22474
|
+
async byDecision(t) {
|
|
22475
|
+
return C(e, async (e) => {
|
|
22476
|
+
let [n] = await e`
|
|
22477
|
+
SELECT extraction, traite_le::text AS "traiteLe" FROM ${a} WHERE path = ${t}`;
|
|
22478
|
+
return n ? {
|
|
22479
|
+
...n.extraction,
|
|
22480
|
+
traiteLe: n.traiteLe
|
|
22481
|
+
} : null;
|
|
22482
|
+
});
|
|
22483
|
+
},
|
|
22484
|
+
async byArticle(t) {
|
|
22485
|
+
return C(e, async (e) => {
|
|
22486
|
+
let n = await e`
|
|
22487
|
+
SELECT path, extraction, traite_le::text AS "traiteLe" FROM ${a} ORDER BY path`, r = [];
|
|
22488
|
+
for (let e of n) e.extraction.citations.some((e) => e.articleId === t) && r.push({
|
|
22489
|
+
...e.extraction,
|
|
22490
|
+
citations: e.extraction.citations.filter((e) => e.articleId === t),
|
|
22491
|
+
traiteLe: e.traiteLe
|
|
22492
|
+
});
|
|
22493
|
+
return r;
|
|
22494
|
+
});
|
|
22495
|
+
}
|
|
22496
|
+
};
|
|
22497
|
+
}
|
|
22498
|
+
//#endregion
|
|
22499
|
+
//#region src/lib/server/jurisprudence_consultation.ts
|
|
22500
|
+
function _a(e) {
|
|
22501
|
+
let { document: t, citations: n, perimetre: r, traiteLe: i, referenceRevision: a } = e;
|
|
22502
|
+
return {
|
|
22503
|
+
decision: {
|
|
22504
|
+
dataset: t.dataset,
|
|
22505
|
+
path: t.path,
|
|
22506
|
+
id: t.id,
|
|
22507
|
+
revision: t.revision,
|
|
22508
|
+
titre: t.titre ?? t.id,
|
|
22509
|
+
titreNature: t.titre ? "source" : "référence",
|
|
22510
|
+
publication: t.publication,
|
|
22511
|
+
dateDecision: t.dateDecision
|
|
22512
|
+
},
|
|
22513
|
+
citations: n,
|
|
22514
|
+
couverture: {
|
|
22515
|
+
perimetre: r,
|
|
22516
|
+
traiteLe: i,
|
|
22517
|
+
fraicheur: "non-verifiee"
|
|
22518
|
+
},
|
|
22519
|
+
referenceRevision: a,
|
|
22520
|
+
...e.selection ? Array.isArray(e.selection) ? { selectionsReference: e.selection } : { selectionReference: e.selection } : {}
|
|
22521
|
+
};
|
|
22522
|
+
}
|
|
22523
|
+
async function va(e, t, n = {}) {
|
|
22524
|
+
let r = await ga(e, t, n);
|
|
22525
|
+
return {
|
|
22526
|
+
async parDecision(e) {
|
|
22527
|
+
if (e.dataset !== "JADE" || !e.path.trim()) throw Error("Identité de décision JADE invalide");
|
|
22528
|
+
let t = await r.consultDecision(e.path);
|
|
22529
|
+
return t.etat === "capture" ? {
|
|
22530
|
+
etat: "capture",
|
|
22531
|
+
resultat: _a(t.resultat)
|
|
22532
|
+
} : t;
|
|
22533
|
+
},
|
|
22534
|
+
async parArticle(e) {
|
|
22535
|
+
if (!e.articleId.trim()) throw Error("Identité d'article invalide");
|
|
22536
|
+
let t = await r.consultArticle(e.articleId);
|
|
22537
|
+
return {
|
|
22538
|
+
...t,
|
|
22539
|
+
resultats: t.resultats.map(_a),
|
|
22540
|
+
resultatsPossibles: t.resultatsPossibles.map(_a),
|
|
22541
|
+
couverture: "inconnue",
|
|
22542
|
+
fraicheur: "non-verifiee"
|
|
22543
|
+
};
|
|
22544
|
+
}
|
|
22545
|
+
};
|
|
22546
|
+
}
|
|
22547
|
+
//#endregion
|
|
22548
|
+
export { Te as LegiResolver, Qi as addLinksOrReferencesToHtmlFile, $i as addPositionsToTableOfContentsFile, Ce as buildAndInstallTextTitlesInfos, we as buildTextTitlesInfos, va as createJurisprudenceConsultation, ga as createJurisprudenceStore, ta as createLegiResolver, Ne as extractAssembleeAmendmentSearchItems, dr as extractAssembleeExposesDesMotifs, gr as extractSenatAmendmentSearchItems, Pe as hashAssembleeAmendmentSearchItem, pr as hashAssembleeSearchItem, _r as hashSenatAmendmentSearchItem, bi as hashSenatSearchItem, ha as initializeJurisprudenceStore, Ei as isAkomaNtosoXml, mr as isoDateFromAssembleeDocument, sr as linkAkomaNtosoBillRaw, hn as linkAssembleeBillRaw, or as parseAkomaNtosoBillRaw, gi as parseAmendment, mn as parseAssembleeBillRaw, fr as parseAssembleeDocumentSearchContent, yi as parseSenatDocumentSearchContent, Yi as readTransformation, nr as renderAkomaNtosoBillRaw, Ti as resolveSenatAkomaNtosoSource, ea as simplifiedHtmlBillFileToTableOfContentsFile, Wi as simplifyWordHtml, Ji as simplifyWordHtmlToDocument, Zi as writeTransformation };
|