@tricoteuses/tisseuse 0.15.3 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.js +774 -742
- package/dist/src/lib/extractors/qualified_versions.d.ts +3 -0
- package/dist/src/lib/extractors/qualified_versions.test.d.ts +1 -0
- package/dist/src/lib/server/index.d.ts +1 -1
- package/dist/src/lib/server/parsed_bills.d.ts +8 -0
- package/dist/src/lib/text_parsers/qualified_versions.d.ts +6 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as e,
|
|
2
|
-
import { Dt as
|
|
1
|
+
import { A as e, B as t, C as n, Ct as r, D as i, E as a, Et as o, F as s, It as c, J as l, Lt as u, O as d, Q as f, R as p, S as m, T as h, Tt as g, Z as _, b as v, c as y, g as b, h as x, it as S, j as C, k as w, kt as ee, m as te, n as ne, nt as re, ot as T, p as ie, s as ae, t as oe, u as se, v as ce, wt as le, x as ue, yt as de } from "./html-BDmDxEJF.js";
|
|
2
|
+
import { Dt as E, Et as D, F as fe, I as pe, N as me, Nt as O, O as he, Tt as k, ct as ge, et as _e, ht as ve, jt as A, k as ye, kt as be, n as xe, o as Se, r as Ce, t as we, vt as j } from "./resolver-CuP8arVX.js";
|
|
3
3
|
import * as Te from "node:crypto";
|
|
4
4
|
import { createHash as Ee } from "node:crypto";
|
|
5
|
-
import
|
|
5
|
+
import M from "fs-extra";
|
|
6
6
|
import De from "node:path";
|
|
7
7
|
//#region src/lib/server/assemblee_amendment_search.ts
|
|
8
8
|
function Oe(e, t) {
|
|
@@ -17,7 +17,7 @@ function ke(e) {
|
|
|
17
17
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
18
18
|
}
|
|
19
19
|
function Ae(e) {
|
|
20
|
-
return ke(
|
|
20
|
+
return ke(T(e).text());
|
|
21
21
|
}
|
|
22
22
|
function je(e) {
|
|
23
23
|
let t = ke([
|
|
@@ -59,16 +59,16 @@ function Me(e, t) {
|
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region src/lib/extractors/article_action_targets.ts
|
|
62
|
-
function
|
|
62
|
+
function N(e) {
|
|
63
63
|
switch (e.type) {
|
|
64
|
-
case "reference_et_action": return
|
|
65
|
-
case "enumeration": return [...
|
|
64
|
+
case "reference_et_action": return N(e.reference);
|
|
65
|
+
case "enumeration": return [...N(e.left), ...N(e.right)];
|
|
66
66
|
case "parent-enfant": {
|
|
67
|
-
let t = [...
|
|
67
|
+
let t = [...c(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 ? [] : N(e.child).map((t) => ({
|
|
72
72
|
article: t.article,
|
|
73
73
|
reference: {
|
|
74
74
|
...e,
|
|
@@ -91,9 +91,9 @@ function j(e) {
|
|
|
91
91
|
//#region src/lib/extractors/article_action_effects.ts
|
|
92
92
|
function Ne(e, t) {
|
|
93
93
|
if (t < 2) return null;
|
|
94
|
-
let n =
|
|
94
|
+
let n = ye(e), r = b(e);
|
|
95
95
|
if (r.length !== t) return null;
|
|
96
|
-
let i =
|
|
96
|
+
let i = s(new k(n.output)), a = (e) => pe(n, [e])[0].position;
|
|
97
97
|
return r.map((t, n) => ({
|
|
98
98
|
sourceText: e,
|
|
99
99
|
referencePosition: a({
|
|
@@ -105,15 +105,15 @@ function Ne(e, t) {
|
|
|
105
105
|
}
|
|
106
106
|
function Pe(e, t) {
|
|
107
107
|
if (t.length < 2) return null;
|
|
108
|
-
let n =
|
|
109
|
-
if (
|
|
110
|
-
let c =
|
|
111
|
-
if (c.length > 0 && c.length <
|
|
112
|
-
let n =
|
|
108
|
+
let n = ye(e), r = n.output, i = (e) => pe(n, [e])[0].position, a = s(new k(r)), o = a.flatMap(N);
|
|
109
|
+
if (o.length !== t.length || o.length < 2) return null;
|
|
110
|
+
let c = o.filter(({ reference: e }) => e.type === "parent-enfant" && e.parent.type === "texte" && e.parent.nature !== "CODE");
|
|
111
|
+
if (c.length > 0 && c.length < o.length) {
|
|
112
|
+
let n = o.filter((e) => !c.includes(e));
|
|
113
113
|
if (n.length !== 1) return null;
|
|
114
|
-
let a = n[0],
|
|
115
|
-
return !
|
|
116
|
-
targetId:
|
|
114
|
+
let a = n[0], s = t[o.indexOf(a)], l = v(r);
|
|
115
|
+
return !s || l.length !== 1 || l[0].kind === "compound" ? null : [{
|
|
116
|
+
targetId: s,
|
|
117
117
|
sourceAnnotation: {
|
|
118
118
|
sourceText: e,
|
|
119
119
|
referencePosition: i(a.reference.position),
|
|
@@ -136,17 +136,17 @@ function Pe(e, t) {
|
|
|
136
136
|
let l = [], u = 0;
|
|
137
137
|
for (let e = 1; e < a.length; e += 1) {
|
|
138
138
|
let t = a[e];
|
|
139
|
-
t.type !== "reference_et_action" ||
|
|
139
|
+
t.type !== "reference_et_action" || N(t).length === 0 || a.slice(u, e).flatMap(N).length === 0 || v(r.slice(u === 0 ? 0 : a[u].position.start, t.position.start)).length === 1 && v(r.slice(t.position.start)).length === 1 && (l.push(e - 1), u = e);
|
|
140
140
|
}
|
|
141
141
|
l.push(a.length - 1);
|
|
142
142
|
let d = [], f = 0, p = 0;
|
|
143
143
|
for (let n of l) {
|
|
144
|
-
let o = a.slice(f, n + 1).flatMap(
|
|
144
|
+
let o = a.slice(f, n + 1).flatMap(N);
|
|
145
145
|
if (o.length === 0) {
|
|
146
146
|
f = n + 1;
|
|
147
147
|
continue;
|
|
148
148
|
}
|
|
149
|
-
let s = f === 0 ? 0 : a[f].position.start, c = a[n + 1]?.position.start ?? r.length, l =
|
|
149
|
+
let s = f === 0 ? 0 : a[f].position.start, c = a[n + 1]?.position.start ?? r.length, l = v(r.slice(s, c));
|
|
150
150
|
if (l.length !== 1 || l[0].kind === "compound") return null;
|
|
151
151
|
let u = l[0];
|
|
152
152
|
for (let n of o) {
|
|
@@ -170,7 +170,7 @@ function Pe(e, t) {
|
|
|
170
170
|
stop: r.length
|
|
171
171
|
},
|
|
172
172
|
reference: n.reference,
|
|
173
|
-
portionSelectors:
|
|
173
|
+
portionSelectors: re(n.reference)
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
176
|
}
|
|
@@ -178,31 +178,46 @@ function Pe(e, t) {
|
|
|
178
178
|
}
|
|
179
179
|
return p === t.length ? d : null;
|
|
180
180
|
}
|
|
181
|
+
var Fe = be("dans sa rédaction", E([E([O("dans sa rédaction ", { flags: "i" }), D(O("issue ", { flags: "i" }), O("résultante ", { flags: "i" }), O("résultant ", { flags: "i" }))], { value: "qualified-version-redaction" }), D(E([O("de l'", { flags: "i" }), t], { value: (e) => e[1] }), p)], { value: (e) => e[1] }));
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/lib/extractors/qualified_versions.ts
|
|
184
|
+
function Ie(e) {
|
|
185
|
+
let t = ye(e), n = [];
|
|
186
|
+
for (let e of Fe.extract(new k(t.output), { jumpExact: !0 })) for (let r of u(e)) {
|
|
187
|
+
if (r.type !== "parent-enfant" || r.parent.type !== "texte" || r.parent.nature !== "LOI") continue;
|
|
188
|
+
let e = [...c(r.child)].filter((e) => e.type === "article" && e.position.start < r.parent.position.start);
|
|
189
|
+
if (e.length === 1) {
|
|
190
|
+
n.push(pe(t, [e[0].position])[0].position);
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return n;
|
|
195
|
+
}
|
|
181
196
|
//#endregion
|
|
182
197
|
//#region src/lib/server/parsed_bills.ts
|
|
183
|
-
var
|
|
184
|
-
function
|
|
198
|
+
var Le = /^expos[ée]\s+des\s+motifs\b/iu;
|
|
199
|
+
function P(e) {
|
|
185
200
|
return (e ?? "").replace(/\u00a0/g, " ").replace(/\s+/g, " ").trim();
|
|
186
201
|
}
|
|
187
|
-
function
|
|
188
|
-
return
|
|
202
|
+
function F(e) {
|
|
203
|
+
return P(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
189
204
|
}
|
|
190
|
-
function
|
|
191
|
-
return
|
|
205
|
+
function Re(e) {
|
|
206
|
+
return r(P(e));
|
|
192
207
|
}
|
|
193
|
-
function
|
|
194
|
-
return `_TocArt${
|
|
208
|
+
function I(e) {
|
|
209
|
+
return `_TocArt${Re(e).replace(/\s+/gu, "")}`;
|
|
195
210
|
}
|
|
196
|
-
function
|
|
211
|
+
function ze(e, t) {
|
|
197
212
|
return e(t).closest(".assnatTOC6,.assnatTOC5,.assnatTOC4").length > 0;
|
|
198
213
|
}
|
|
199
|
-
function
|
|
200
|
-
return
|
|
214
|
+
function Be(e) {
|
|
215
|
+
return F(e).replace(/[‐‑‒–—]/gu, "-").replace(/\s*\.\s*/gu, ".");
|
|
201
216
|
}
|
|
202
|
-
function
|
|
203
|
-
return
|
|
217
|
+
function Ve(e) {
|
|
218
|
+
return Be(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
|
|
204
219
|
}
|
|
205
|
-
function
|
|
220
|
+
function He(e) {
|
|
206
221
|
switch (e.kind) {
|
|
207
222
|
case "insert_after":
|
|
208
223
|
case "insert_before": return e.insertText;
|
|
@@ -220,12 +235,12 @@ function Be(e) {
|
|
|
220
235
|
default: return;
|
|
221
236
|
}
|
|
222
237
|
}
|
|
223
|
-
function
|
|
224
|
-
let t =
|
|
225
|
-
if (n?.[1] !== void 0) return
|
|
238
|
+
function Ue(e) {
|
|
239
|
+
let t = P(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);
|
|
240
|
+
if (n?.[1] !== void 0) return le(n[1]);
|
|
226
241
|
}
|
|
227
|
-
function
|
|
228
|
-
let t =
|
|
242
|
+
function We(e) {
|
|
243
|
+
let t = He(e), n = de(t ?? "");
|
|
229
244
|
if (n.length > 0 && t !== void 0) return n.map((e, r) => {
|
|
230
245
|
let i = e.start, a = n[r + 1]?.start ?? t.length, o = t.slice(i, a).trim();
|
|
231
246
|
return {
|
|
@@ -233,58 +248,58 @@ function He(e) {
|
|
|
233
248
|
text: o
|
|
234
249
|
};
|
|
235
250
|
});
|
|
236
|
-
let r =
|
|
251
|
+
let r = Ue(e);
|
|
237
252
|
return r === void 0 ? [] : [{
|
|
238
253
|
num: r,
|
|
239
254
|
text: t ?? e.sourceText
|
|
240
255
|
}];
|
|
241
256
|
}
|
|
242
|
-
function
|
|
257
|
+
function Ge(e, t = /* @__PURE__ */ new Set()) {
|
|
243
258
|
if (e == null) return t;
|
|
244
259
|
if (Array.isArray(e)) {
|
|
245
|
-
for (let n of e)
|
|
260
|
+
for (let n of e) Ge(n, t);
|
|
246
261
|
return t;
|
|
247
262
|
}
|
|
248
263
|
if (typeof e != "object") return t;
|
|
249
264
|
let n = e;
|
|
250
265
|
n.type === "article" && typeof n.num == "string" && t.add(n.num);
|
|
251
|
-
for (let e of Object.values(n))
|
|
266
|
+
for (let e of Object.values(n)) Ge(e, t);
|
|
252
267
|
return t;
|
|
253
268
|
}
|
|
254
|
-
function
|
|
255
|
-
let t =
|
|
269
|
+
function Ke(e) {
|
|
270
|
+
let t = F(e.sourceText);
|
|
256
271
|
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);
|
|
257
272
|
}
|
|
258
|
-
function
|
|
259
|
-
return
|
|
273
|
+
function qe(e) {
|
|
274
|
+
return P(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
|
|
260
275
|
}
|
|
261
|
-
function
|
|
262
|
-
let n = new
|
|
276
|
+
function Je(e, t) {
|
|
277
|
+
let n = new k(e, t), r = _e(n);
|
|
263
278
|
return typeof r != "string" || n.offset <= t ? null : {
|
|
264
279
|
date: r,
|
|
265
280
|
start: t,
|
|
266
281
|
stop: n.offset
|
|
267
282
|
};
|
|
268
283
|
}
|
|
269
|
-
function
|
|
284
|
+
function Ye(e, t) {
|
|
270
285
|
let n = /\d/u.exec(e.slice(t));
|
|
271
286
|
if (!n) return null;
|
|
272
287
|
let r = t + n.index;
|
|
273
|
-
return e.slice(t, r).trim().length > 0 ? null :
|
|
288
|
+
return e.slice(t, r).trim().length > 0 ? null : Je(e, r);
|
|
274
289
|
}
|
|
275
|
-
function
|
|
290
|
+
function Xe(e) {
|
|
276
291
|
let t = /^la présente loi (?:s['’]appli(?:que|quent)|entr(?:e|ent) en vigueur) (?:[aà] compter (?:du|de|d['’])|au|le)\s*/u, n = /^la présente loi s['’]appli(?:que|quent)\s*:\s*/u, r = /\b[aà] compter (?:du|de|d['’])\s*/gu, i = [], a = "la présente loi", o = e.indexOf(a);
|
|
277
292
|
for (; o !== -1;) {
|
|
278
293
|
let s = e.indexOf(a, o + 15), c = e.slice(o, o + 1400), l = t.exec(c);
|
|
279
294
|
if (l) {
|
|
280
|
-
let e =
|
|
295
|
+
let e = Ye(c, l[0].length);
|
|
281
296
|
e && i.push(e.date);
|
|
282
297
|
}
|
|
283
298
|
let u = n.exec(c);
|
|
284
299
|
if (u) {
|
|
285
300
|
let e = /\barticle\s+\w/iu.exec(c), t = e === null ? c.slice(u[0].length) : c.slice(u[0].length, e.index);
|
|
286
301
|
for (r.lastIndex = 0; r.exec(t) !== null;) {
|
|
287
|
-
let e =
|
|
302
|
+
let e = Ye(t, r.lastIndex);
|
|
288
303
|
e && /^\s+pour\s+les\s+autres\s+dispositions\s+fiscales\b/iu.test(t.slice(e.stop)) && i.push(e.date);
|
|
289
304
|
}
|
|
290
305
|
}
|
|
@@ -292,20 +307,20 @@ function Je(e) {
|
|
|
292
307
|
}
|
|
293
308
|
return i;
|
|
294
309
|
}
|
|
295
|
-
function
|
|
296
|
-
let t =
|
|
310
|
+
function Ze(e) {
|
|
311
|
+
let t = Xe(qe(e).toLowerCase()), n = Array.from(new Set(t));
|
|
297
312
|
return n.length === 1 ? n[0] : void 0;
|
|
298
313
|
}
|
|
299
|
-
function
|
|
300
|
-
return
|
|
314
|
+
function Qe(e) {
|
|
315
|
+
return F(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-").replace(/^(?:(?:article\s+[^:]+|[a-z][.)]|[ivxlcdm]+\.|\d+°)\s*(?:-\s*)?)+/iu, "");
|
|
301
316
|
}
|
|
302
|
-
function
|
|
317
|
+
function L(e) {
|
|
303
318
|
return e?.type === "tag";
|
|
304
319
|
}
|
|
305
|
-
function
|
|
320
|
+
function $e(e, t) {
|
|
306
321
|
return e.html(t) ?? "";
|
|
307
322
|
}
|
|
308
|
-
function
|
|
323
|
+
function et(e, t) {
|
|
309
324
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
310
325
|
for (let i of e(t).find("a").get()) {
|
|
311
326
|
let a = e(i).attr("href") ?? "", o = /\/legifrance\/(articles|sections|textes)\/([^?#"]+)/u.exec(a);
|
|
@@ -313,46 +328,46 @@ function Qe(e, t) {
|
|
|
313
328
|
let s = o[1] === "articles" ? "article" : o[1] === "sections" ? "division" : "text", c = o[2].replace(/\.md$/u, ""), l = `${s}\0${c}`;
|
|
314
329
|
if (r.has(l)) continue;
|
|
315
330
|
r.add(l);
|
|
316
|
-
let u =
|
|
331
|
+
let u = P(e(i).text());
|
|
317
332
|
n.push({
|
|
318
333
|
id: c,
|
|
319
|
-
|
|
334
|
+
...tt(e, t, i) ? { insideFrenchQuotes: !0 } : {},
|
|
320
335
|
...u ? { text: u } : {},
|
|
321
336
|
type: s
|
|
322
337
|
});
|
|
323
338
|
}
|
|
324
339
|
return n;
|
|
325
340
|
}
|
|
326
|
-
function
|
|
327
|
-
let r =
|
|
341
|
+
function tt(e, t, n) {
|
|
342
|
+
let r = nt(e, t, n);
|
|
328
343
|
return (r.match(/«/gu) ?? []).length > (r.match(/»/gu) ?? []).length;
|
|
329
344
|
}
|
|
330
|
-
function
|
|
345
|
+
function nt(e, t, n) {
|
|
331
346
|
if (t === n) return "";
|
|
332
347
|
if (t.type === "text") return t.data ?? "";
|
|
333
|
-
if (!
|
|
348
|
+
if (!L(t)) return "";
|
|
334
349
|
let r = "";
|
|
335
350
|
for (let i of e(t).contents().get()) {
|
|
336
351
|
if (i === n) return r;
|
|
337
|
-
if (
|
|
352
|
+
if (L(i) && e.contains(i, n)) return r + nt(e, i, n);
|
|
338
353
|
r += e(i).text();
|
|
339
354
|
}
|
|
340
355
|
return r;
|
|
341
356
|
}
|
|
342
|
-
function
|
|
343
|
-
return t.map((t) =>
|
|
357
|
+
function rt(e, t) {
|
|
358
|
+
return t.map((t) => P(e(t).text())).filter(Boolean).join("\n");
|
|
344
359
|
}
|
|
345
|
-
function
|
|
346
|
-
let t =
|
|
347
|
-
return !t ||
|
|
360
|
+
function it(e) {
|
|
361
|
+
let t = F(e);
|
|
362
|
+
return !t || Le.test(t) ? "noise" : i.test(e) ? "directive_candidate" : "context";
|
|
348
363
|
}
|
|
349
|
-
async function
|
|
364
|
+
async function at(e, t, n) {
|
|
350
365
|
if (n === void 0) throw Error("A document date is required to add links to legal references.");
|
|
351
366
|
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.");
|
|
352
|
-
let { output: r } = await
|
|
367
|
+
let { output: r } = await ne({
|
|
353
368
|
date: n,
|
|
354
369
|
html: e,
|
|
355
|
-
legiResolver: t.legiResolver ?? new
|
|
370
|
+
legiResolver: t.legiResolver ?? new ie(t.canutesDb),
|
|
356
371
|
linkBaseUrl: t.linkBaseUrl,
|
|
357
372
|
linkType: t.linkType,
|
|
358
373
|
logIgnoredReferencesTypes: t.logIgnoredReferencesTypes,
|
|
@@ -361,13 +376,13 @@ async function rt(e, t, n) {
|
|
|
361
376
|
});
|
|
362
377
|
return r ?? e;
|
|
363
378
|
}
|
|
364
|
-
function
|
|
379
|
+
function ot(e, t) {
|
|
365
380
|
let n = e(t).closest("h1,h2,h3,h4,h5,h6,p,td,th").get(0), r = e(t).closest("table").get(0);
|
|
366
|
-
return
|
|
381
|
+
return L(r) && L(n) && e(n).parents("table").get(0) === r ? r : L(n) ? n : t;
|
|
367
382
|
}
|
|
368
|
-
function
|
|
383
|
+
function st(e, t, n, r) {
|
|
369
384
|
if (t.has(r.container)) return;
|
|
370
|
-
let i = r.id ??
|
|
385
|
+
let i = r.id ?? I(r.num ?? r.label);
|
|
371
386
|
n.has(i) || (n.add(i), t.add(r.container), e.push({
|
|
372
387
|
id: i,
|
|
373
388
|
label: r.label,
|
|
@@ -377,25 +392,25 @@ function at(e, t, n, r) {
|
|
|
377
392
|
container: r.container
|
|
378
393
|
}));
|
|
379
394
|
}
|
|
380
|
-
function
|
|
395
|
+
function R(e) {
|
|
381
396
|
let t = /* @__PURE__ */ new Map();
|
|
382
397
|
return e("body *").each((e, n) => {
|
|
383
398
|
t.set(n, e);
|
|
384
399
|
}), t;
|
|
385
400
|
}
|
|
386
|
-
function
|
|
401
|
+
function z(e, t) {
|
|
387
402
|
return e.get(t) ?? 2 ** 53 - 1;
|
|
388
403
|
}
|
|
389
|
-
function
|
|
404
|
+
function ct(e) {
|
|
390
405
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
391
406
|
e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
|
|
392
|
-
if (
|
|
393
|
-
let o =
|
|
407
|
+
if (ze(e, a)) return;
|
|
408
|
+
let o = g(P(e(a).text()));
|
|
394
409
|
if (!o) return;
|
|
395
410
|
let s = e(a).attr("id");
|
|
396
411
|
if (!s || r.has(s)) return;
|
|
397
|
-
let c =
|
|
398
|
-
|
|
412
|
+
let c = ot(e, a);
|
|
413
|
+
st(t, n, r, {
|
|
399
414
|
id: s,
|
|
400
415
|
...o,
|
|
401
416
|
element: a,
|
|
@@ -403,37 +418,37 @@ function st(e) {
|
|
|
403
418
|
});
|
|
404
419
|
}), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((i, a) => {
|
|
405
420
|
if (n.has(a)) return;
|
|
406
|
-
let o =
|
|
407
|
-
o &&
|
|
421
|
+
let o = g(P(e(a).text()));
|
|
422
|
+
o && st(t, n, r, {
|
|
408
423
|
...o,
|
|
409
424
|
element: a,
|
|
410
425
|
container: a
|
|
411
426
|
});
|
|
412
427
|
});
|
|
413
|
-
let i =
|
|
414
|
-
return t.sort((e, t) =>
|
|
428
|
+
let i = R(e);
|
|
429
|
+
return t.sort((e, t) => z(i, e.container) - z(i, t.container)), t;
|
|
415
430
|
}
|
|
416
|
-
function
|
|
417
|
-
if (
|
|
431
|
+
function lt(e, t) {
|
|
432
|
+
if (ze(e, t)) return !1;
|
|
418
433
|
let n = t.tagName?.toLowerCase();
|
|
419
434
|
if (n !== "p") return /^h[1-6]$/u.test(n ?? "");
|
|
420
435
|
let r = e(t).attr("style") ?? "", i = e(t).html() ?? "";
|
|
421
436
|
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));
|
|
422
437
|
}
|
|
423
|
-
function
|
|
438
|
+
function ut(e) {
|
|
424
439
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
425
440
|
return e("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6,p").each((i, a) => {
|
|
426
|
-
if (
|
|
427
|
-
let o =
|
|
428
|
-
o &&
|
|
441
|
+
if (ze(e, a) || !e(a).hasClass("assnat9ArticleNum") && !lt(e, a)) return;
|
|
442
|
+
let o = g(e(a).text());
|
|
443
|
+
o && st(t, n, r, {
|
|
429
444
|
...o,
|
|
430
445
|
element: a,
|
|
431
446
|
container: a
|
|
432
447
|
});
|
|
433
448
|
}), t;
|
|
434
449
|
}
|
|
435
|
-
function
|
|
436
|
-
let t =
|
|
450
|
+
function dt(e) {
|
|
451
|
+
let t = Re(e ?? "").replace(/[()]/gu, "").trim();
|
|
437
452
|
if (!t || t.toLowerCase() === "liminaire") return;
|
|
438
453
|
if (t.toLowerCase() === "unique") return {
|
|
439
454
|
base: 1,
|
|
@@ -442,7 +457,7 @@ function ut(e) {
|
|
|
442
457
|
};
|
|
443
458
|
let n = /^(\d+|premier)(?:\s+([a-z]+))?(?:\s+([A-Z]+))?$/u.exec(t);
|
|
444
459
|
if (!n) return;
|
|
445
|
-
let r = n[1] === "premier" ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 :
|
|
460
|
+
let r = n[1] === "premier" ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 : pt(i);
|
|
446
461
|
if (a !== void 0) return {
|
|
447
462
|
base: r,
|
|
448
463
|
suffixOrder: a,
|
|
@@ -450,7 +465,7 @@ function ut(e) {
|
|
|
450
465
|
text: t
|
|
451
466
|
};
|
|
452
467
|
}
|
|
453
|
-
function
|
|
468
|
+
function ft(e, t) {
|
|
454
469
|
if (t.base !== e.base) return t.base - e.base;
|
|
455
470
|
if (t.suffixOrder !== e.suffixOrder) return t.suffixOrder - e.suffixOrder;
|
|
456
471
|
for (let n = 0; n <= Math.max(e.letters?.length ?? 0, t.letters?.length ?? 0); n++) {
|
|
@@ -459,14 +474,14 @@ function dt(e, t) {
|
|
|
459
474
|
}
|
|
460
475
|
return 0;
|
|
461
476
|
}
|
|
462
|
-
function
|
|
463
|
-
let t = new
|
|
477
|
+
function pt(e) {
|
|
478
|
+
let t = new k(e), n = ge(t);
|
|
464
479
|
if (!(n === void 0 || t.offset !== e.length) && !(typeof n != "object" || !n || !("value" in n) || typeof n.value != "number")) return n.value - 1;
|
|
465
480
|
}
|
|
466
|
-
function
|
|
481
|
+
function mt(e) {
|
|
467
482
|
let t = [], n = e.map((e) => ({
|
|
468
483
|
heading: e,
|
|
469
|
-
token:
|
|
484
|
+
token: dt(e.num)
|
|
470
485
|
}));
|
|
471
486
|
n.filter(({ token: e }) => e?.text === "unique").length > 0 && e.length > 1 && t.push({
|
|
472
487
|
code: "article_toc_out_of_order",
|
|
@@ -475,7 +490,7 @@ function pt(e) {
|
|
|
475
490
|
let r;
|
|
476
491
|
for (let { heading: e, token: i } of n) if (!(i === void 0 || i.text === "unique")) {
|
|
477
492
|
if (r !== void 0) {
|
|
478
|
-
let n =
|
|
493
|
+
let n = ft(r, i);
|
|
479
494
|
n === 0 ? t.push({
|
|
480
495
|
code: "article_toc_duplicate_number",
|
|
481
496
|
message: `Article ${e.num ?? e.label} is repeated`,
|
|
@@ -504,60 +519,60 @@ function pt(e) {
|
|
|
504
519
|
}
|
|
505
520
|
return t;
|
|
506
521
|
}
|
|
507
|
-
function
|
|
508
|
-
let t =
|
|
522
|
+
function ht(e) {
|
|
523
|
+
let t = mt(e);
|
|
509
524
|
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) });
|
|
510
525
|
}
|
|
511
|
-
function
|
|
512
|
-
let n =
|
|
513
|
-
if (n.length === 0) return t &&
|
|
514
|
-
let i =
|
|
515
|
-
let n = new Set(e.map((e) => e.container)), r = new Set(e.map((e) =>
|
|
526
|
+
function gt(e, { warn: t = !0 } = {}) {
|
|
527
|
+
let n = ct(e), r = ut(e);
|
|
528
|
+
if (n.length === 0) return t && ht(r), r;
|
|
529
|
+
let i = R(e), a = (e, t) => {
|
|
530
|
+
let n = new Set(e.map((e) => e.container)), r = new Set(e.map((e) => I(e.num ?? e.label)));
|
|
516
531
|
for (let i of t) {
|
|
517
|
-
let t =
|
|
532
|
+
let t = I(i.num ?? i.label);
|
|
518
533
|
n.has(i.container) || r.has(t) || (n.add(i.container), r.add(t), e.push(i));
|
|
519
534
|
}
|
|
520
|
-
return e.sort((e, t) =>
|
|
521
|
-
}, 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 &&
|
|
522
|
-
return t &&
|
|
535
|
+
return e.sort((e, t) => z(i, e.container) - z(i, t.container)), e;
|
|
536
|
+
}, 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 && mt(c).length > mt(s).length ? s : c;
|
|
537
|
+
return t && ht(l), l;
|
|
523
538
|
}
|
|
524
|
-
function
|
|
539
|
+
function _t(e) {
|
|
525
540
|
let t = e.next;
|
|
526
541
|
for (; t !== null;) {
|
|
527
|
-
if (
|
|
542
|
+
if (L(t)) return t;
|
|
528
543
|
t = t.next;
|
|
529
544
|
}
|
|
530
545
|
return null;
|
|
531
546
|
}
|
|
532
|
-
function
|
|
547
|
+
function vt(e, t, n) {
|
|
533
548
|
let r = e(t.container);
|
|
534
549
|
if (!r.is("p.assnat9ArticleNum")) return;
|
|
535
550
|
let i = r.parent(), a = i.parent();
|
|
536
551
|
if (!i.is("div") || i.children().length !== 1 || !a.is("div")) return;
|
|
537
552
|
let o = a.children().get();
|
|
538
|
-
if (o.length !== 3 && o.length !== 4 || o[0] !== i.get(0) || o[1]?.tagName !== "span" ||
|
|
553
|
+
if (o.length !== 3 && o.length !== 4 || o[0] !== i.get(0) || o[1]?.tagName !== "span" || P(e(o[1]).text()) !== "") return;
|
|
539
554
|
let s = o.length === 4 ? o[2] : void 0;
|
|
540
|
-
if (s !== void 0 && (s.tagName !== "p" || !e(s).hasClass("assnat9ArticleNum") || !/^\(non modifié\)$/iu.test(
|
|
555
|
+
if (s !== void 0 && (s.tagName !== "p" || !e(s).hasClass("assnat9ArticleNum") || !/^\(non modifié\)$/iu.test(P(e(s).text())))) return;
|
|
541
556
|
let c = o.at(-1);
|
|
542
|
-
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) =>
|
|
557
|
+
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) => g(e(t).text()) !== null))) return [
|
|
543
558
|
t.container,
|
|
544
559
|
...s === void 0 ? [] : [s],
|
|
545
560
|
c
|
|
546
561
|
];
|
|
547
562
|
}
|
|
548
|
-
function
|
|
563
|
+
function yt(e, t, n, r = R(e)) {
|
|
549
564
|
let i = [t.container], a = n?.container;
|
|
550
|
-
for (let e =
|
|
565
|
+
for (let e = _t(t.container); e !== null && e !== a; e = _t(e)) i.push(e);
|
|
551
566
|
if (i.length > 1) return i;
|
|
552
|
-
let o =
|
|
567
|
+
let o = vt(e, t, n);
|
|
553
568
|
if (o !== void 0) return o;
|
|
554
|
-
let s =
|
|
569
|
+
let s = z(r, t.container), c = a ? z(r, a) : -1;
|
|
555
570
|
return e("body > *").get().filter((e) => {
|
|
556
|
-
let t =
|
|
571
|
+
let t = z(r, e);
|
|
557
572
|
return t >= s && (c === -1 || t < c);
|
|
558
573
|
});
|
|
559
574
|
}
|
|
560
|
-
function
|
|
575
|
+
function bt(e, t) {
|
|
561
576
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
562
577
|
for (let i of t) {
|
|
563
578
|
let t = "p,li,table", a = e(i).is(t) ? [i] : e(i).find(t).get();
|
|
@@ -565,110 +580,125 @@ function yt(e, t) {
|
|
|
565
580
|
}
|
|
566
581
|
return n;
|
|
567
582
|
}
|
|
568
|
-
function
|
|
583
|
+
function xt(e, t, n) {
|
|
569
584
|
let r = [], i = !1;
|
|
570
|
-
for (let a of
|
|
571
|
-
let n =
|
|
585
|
+
for (let a of bt(e, n)) {
|
|
586
|
+
let n = P(e(a).text());
|
|
572
587
|
if (!n) continue;
|
|
573
|
-
|
|
574
|
-
let o = i ? "noise" :
|
|
588
|
+
Le.test(n) && (i = !0);
|
|
589
|
+
let o = i ? "noise" : it(n), s = `${t}-b${r.length + 1}`;
|
|
575
590
|
e(a).attr("data-pjl-parsed-article-id", t), e(a).attr("data-pjl-parsed-block-id", s), r.push({
|
|
576
591
|
id: s,
|
|
577
592
|
articleId: t,
|
|
578
593
|
kind: o,
|
|
579
|
-
links:
|
|
594
|
+
links: et(e, a),
|
|
580
595
|
text: n,
|
|
581
|
-
html:
|
|
596
|
+
html: $e(e, a)
|
|
582
597
|
});
|
|
583
598
|
}
|
|
584
599
|
return r;
|
|
585
600
|
}
|
|
586
|
-
function
|
|
601
|
+
function St(e, t) {
|
|
587
602
|
if (t.length === 0) return e;
|
|
588
603
|
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>`;
|
|
589
604
|
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}`;
|
|
590
605
|
}
|
|
591
|
-
function
|
|
592
|
-
let t =
|
|
593
|
-
for (let e of
|
|
594
|
-
let r =
|
|
606
|
+
function Ct(e) {
|
|
607
|
+
let t = T(e), n = wt(t);
|
|
608
|
+
for (let e of gt(t, { warn: !1 })) {
|
|
609
|
+
let r = I(e.num ?? e.label.replace(/^Article\s+/iu, "")), i = t(e.element), a = i.attr("id");
|
|
595
610
|
if (a !== r) {
|
|
596
|
-
if (a?.startsWith("_Toc") && !
|
|
611
|
+
if (a?.startsWith("_Toc") && !Et(n, a, e.element)) {
|
|
597
612
|
let e = t("<span></span>").attr("id", a);
|
|
598
613
|
i.before(e);
|
|
599
614
|
let r = e.get(0);
|
|
600
|
-
|
|
615
|
+
L(r) && B(n, a, r);
|
|
601
616
|
}
|
|
602
|
-
a &&
|
|
617
|
+
a && Tt(n, a, e.element), i.attr("id", r), B(n, r, e.element);
|
|
603
618
|
}
|
|
604
619
|
}
|
|
605
|
-
let r =
|
|
620
|
+
let r = gt(t), i = R(t);
|
|
606
621
|
for (let [e, a] of r.entries()) {
|
|
607
|
-
let o =
|
|
622
|
+
let o = yt(t, a, r[e + 1], i).flatMap((e) => t(e).is("span.alinea[data-alinea]") ? [e] : t(e).find("span.alinea[data-alinea]").get());
|
|
608
623
|
for (let e of o) {
|
|
609
624
|
let r = t(e).attr("data-alinea")?.trim();
|
|
610
625
|
if (!r) continue;
|
|
611
626
|
let i = `${a.id}-alinea-${r.replace(/\s+/gu, "")}`;
|
|
612
|
-
if (
|
|
627
|
+
if (Et(n, i, e)) continue;
|
|
613
628
|
let o = t(e).attr("id");
|
|
614
629
|
if (o && o !== i) {
|
|
615
630
|
let r = t("<span></span>").attr("id", i);
|
|
616
631
|
t(e).before(r);
|
|
617
632
|
let a = r.get(0);
|
|
618
|
-
|
|
619
|
-
} else o &&
|
|
633
|
+
L(a) && B(n, i, a);
|
|
634
|
+
} else o && Tt(n, o, e), t(e).attr("id", i), B(n, i, e);
|
|
620
635
|
}
|
|
621
636
|
}
|
|
622
637
|
return t.html();
|
|
623
638
|
}
|
|
624
|
-
function
|
|
639
|
+
function wt(e) {
|
|
625
640
|
let t = /* @__PURE__ */ new Map();
|
|
626
641
|
for (let n of e("[id]").get()) {
|
|
627
642
|
let r = e(n).attr("id");
|
|
628
|
-
r &&
|
|
643
|
+
r && B(t, r, n);
|
|
629
644
|
}
|
|
630
645
|
return t;
|
|
631
646
|
}
|
|
632
|
-
function
|
|
647
|
+
function B(e, t, n) {
|
|
633
648
|
let r = e.get(t);
|
|
634
649
|
r === void 0 && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
635
650
|
}
|
|
636
|
-
function
|
|
651
|
+
function Tt(e, t, n) {
|
|
637
652
|
let r = e.get(t);
|
|
638
653
|
r !== void 0 && (r.delete(n), r.size === 0 && e.delete(t));
|
|
639
654
|
}
|
|
640
|
-
function
|
|
655
|
+
function Et(e, t, n) {
|
|
641
656
|
for (let r of e.get(t) ?? []) if (r !== n) return !0;
|
|
642
657
|
return !1;
|
|
643
658
|
}
|
|
644
|
-
function
|
|
645
|
-
let n =
|
|
659
|
+
function Dt(e, t) {
|
|
660
|
+
let n = Qe("sourceText" in t ? t.sourceText : "");
|
|
646
661
|
if (n) return e.filter((e) => e.kind === "directive_candidate").find((e) => {
|
|
647
|
-
let t =
|
|
662
|
+
let t = Qe(e.text);
|
|
648
663
|
return t.length > 0 && (n.includes(t) || t.includes(n));
|
|
649
664
|
});
|
|
650
665
|
}
|
|
651
|
-
function
|
|
666
|
+
function Ot(e, t) {
|
|
652
667
|
if (t) return t.blockIds.map((t) => e.get(t)).find((e) => e?.kind === "directive_candidate");
|
|
653
668
|
}
|
|
654
|
-
function
|
|
655
|
-
return e?.links.filter((
|
|
669
|
+
function kt(e) {
|
|
670
|
+
return e?.links.filter((t) => !t.insideFrenchQuotes && (t.type === "article" || t.type === "division") && t.id !== e.qualifiedVersion?.modifyingArticleId).map((e) => e.id) ?? [];
|
|
671
|
+
}
|
|
672
|
+
function At(e) {
|
|
673
|
+
let t = Ie(e.text);
|
|
674
|
+
if (t.length !== 1) return;
|
|
675
|
+
let n = e.links.filter((e) => e.type === "article" && !e.insideFrenchQuotes), r = n.filter((n) => {
|
|
676
|
+
let r = n.text ?? "", i = e.text.indexOf(r);
|
|
677
|
+
return r.length > 0 && i >= 0 && i <= t[0].start && t[0].stop <= i + r.length;
|
|
678
|
+
});
|
|
679
|
+
if (r.length !== 1) return;
|
|
680
|
+
let i = r[0], a = n.filter((e) => e.id !== i.id);
|
|
681
|
+
if (!(a.length > 1)) return {
|
|
682
|
+
...a.length === 1 ? { targetArticleId: a[0].id } : {},
|
|
683
|
+
modifyingArticleId: i.id,
|
|
684
|
+
modifyingArticleLabel: i.text ?? ""
|
|
685
|
+
};
|
|
656
686
|
}
|
|
657
|
-
function
|
|
658
|
-
let n =
|
|
687
|
+
function jt(e, t) {
|
|
688
|
+
let n = P(e);
|
|
659
689
|
if (!n) return;
|
|
660
|
-
let r =
|
|
690
|
+
let r = S(n);
|
|
661
691
|
return r ? r.level : n.endsWith(":") ? (t ?? -1) + 1 : void 0;
|
|
662
692
|
}
|
|
663
|
-
function
|
|
664
|
-
let t = /* @__PURE__ */ new Map(), n = [], r =
|
|
693
|
+
function Mt(e) {
|
|
694
|
+
let t = /* @__PURE__ */ new Map(), n = [], r = te(e.map((e) => e.text)), i = -1;
|
|
665
695
|
for (let [a, o] of e.entries()) {
|
|
666
696
|
let e = r.get(a);
|
|
667
697
|
if (e && (i = e.endIndex), a <= i) {
|
|
668
698
|
t.set(o.id, [...n.map((e) => e.block), o]);
|
|
669
699
|
continue;
|
|
670
700
|
}
|
|
671
|
-
let s =
|
|
701
|
+
let s = jt(o.text, n.at(-1)?.level);
|
|
672
702
|
if (s === void 0) {
|
|
673
703
|
t.set(o.id, [...n.map((e) => e.block), o]);
|
|
674
704
|
continue;
|
|
@@ -681,14 +711,14 @@ function At(e) {
|
|
|
681
711
|
}
|
|
682
712
|
return t;
|
|
683
713
|
}
|
|
684
|
-
function
|
|
714
|
+
function Nt(e, t) {
|
|
685
715
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
686
716
|
for (let i of [...e ?? [], ...t]) i !== void 0 && (r.has(i.id) || (r.add(i.id), n.push(i)));
|
|
687
717
|
return n;
|
|
688
718
|
}
|
|
689
|
-
function
|
|
719
|
+
function Pt(e, t, n) {
|
|
690
720
|
if (!t) return;
|
|
691
|
-
let r =
|
|
721
|
+
let r = Nt(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
|
|
692
722
|
if (r.length === 0) return;
|
|
693
723
|
let i = r.map((e) => e.id);
|
|
694
724
|
if (i.length === t.blockIds.length && i.every((e, n) => e === t.blockIds[n])) return;
|
|
@@ -703,7 +733,7 @@ function Mt(e, t, n) {
|
|
|
703
733
|
}
|
|
704
734
|
};
|
|
705
735
|
}
|
|
706
|
-
function
|
|
736
|
+
function Ft(e) {
|
|
707
737
|
let t = [], n = 0;
|
|
708
738
|
for (let r of e.blocks) {
|
|
709
739
|
let i = e.directiveText.indexOf(r.text, n);
|
|
@@ -717,7 +747,7 @@ function Nt(e) {
|
|
|
717
747
|
}
|
|
718
748
|
return t;
|
|
719
749
|
}
|
|
720
|
-
function
|
|
750
|
+
function It(e, t, n) {
|
|
721
751
|
let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop > r && e.start < i);
|
|
722
752
|
if (a.length === 0) return;
|
|
723
753
|
let o = a[0], s = a[a.length - 1], c = o.start, l = s.stop;
|
|
@@ -731,7 +761,7 @@ function Pt(e, t, n) {
|
|
|
731
761
|
}
|
|
732
762
|
};
|
|
733
763
|
}
|
|
734
|
-
function
|
|
764
|
+
function Lt(e, t, n) {
|
|
735
765
|
if (!t) return;
|
|
736
766
|
let r = e.directiveText.indexOf(t.text);
|
|
737
767
|
if (r === -1) return;
|
|
@@ -744,44 +774,46 @@ function Ft(e, t, n) {
|
|
|
744
774
|
stop: a
|
|
745
775
|
};
|
|
746
776
|
}
|
|
747
|
-
function
|
|
748
|
-
let n = performance.now(), r = performance.now(), i =
|
|
777
|
+
function Rt(e, t) {
|
|
778
|
+
let n = performance.now(), r = performance.now(), i = Ft(e), a = performance.now() - r, o = performance.now(), s = new Map(e.blocks.map((e) => [e.id, e])), c = Mt(e.blocks), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = [], f;
|
|
749
779
|
for (let t of e.blocks) {
|
|
750
|
-
|
|
751
|
-
e
|
|
780
|
+
t.qualifiedVersion = At(t);
|
|
781
|
+
let e = kt(t);
|
|
782
|
+
(e.length > 0 || t.qualifiedVersion) && (d = e, f = t.qualifiedVersion), l.set(t.id, d), u.set(t.id, f);
|
|
752
783
|
}
|
|
753
|
-
let
|
|
754
|
-
let n =
|
|
784
|
+
let p = performance.now() - o, m = performance.now(), h = x(), g = ce(e.directiveText, t === void 0 ? void 0 : h), _ = performance.now() - m, v = performance.now(), y = g.map((t) => {
|
|
785
|
+
let n = It(e, i, t), r = Ot(s, n) ?? Dt(e.blocks, t), a = kt(r), o = a.length > 0 ? a : r?.id === void 0 ? [] : l.get(r.id) ?? [], d = Lt(e, r, t), f = Pt(r?.id === void 0 ? void 0 : c.get(r.id), n, s);
|
|
755
786
|
return {
|
|
756
787
|
articleId: e.id,
|
|
757
788
|
blockId: r?.id,
|
|
758
|
-
...
|
|
789
|
+
...d === void 0 ? {} : { sourceBlockPosition: d },
|
|
759
790
|
...n === void 0 ? {} : {
|
|
760
791
|
sourceBlockIds: n.blockIds,
|
|
761
792
|
sourceBlockText: n.text,
|
|
762
793
|
sourceBlockHtml: n.html,
|
|
763
794
|
sourceBlockPosition: n.position
|
|
764
795
|
},
|
|
765
|
-
...
|
|
766
|
-
sourceContextBlockIds:
|
|
767
|
-
sourceContextPosition:
|
|
796
|
+
...f === void 0 ? {} : {
|
|
797
|
+
sourceContextBlockIds: f.blockIds,
|
|
798
|
+
sourceContextPosition: f.position
|
|
768
799
|
},
|
|
769
800
|
directive: t,
|
|
770
|
-
...o.length > 0 ? { targetIds: o } : {}
|
|
801
|
+
...o.length > 0 ? { targetIds: o } : {},
|
|
802
|
+
...r?.id !== void 0 && u.get(r.id) ? { qualifiedVersion: u.get(r.id) } : {}
|
|
771
803
|
};
|
|
772
|
-
}),
|
|
804
|
+
}), b = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Map(), C = y.flatMap((e) => {
|
|
773
805
|
let t = e.blockId ? s.get(e.blockId) : void 0;
|
|
774
806
|
if (!t) return [e];
|
|
775
|
-
if (
|
|
776
|
-
let n =
|
|
777
|
-
if (n === void 0 && (n = Pe(t.text,
|
|
807
|
+
if (b.has(t.id)) return [];
|
|
808
|
+
let n = S.get(t.id);
|
|
809
|
+
if (n === void 0 && (n = Pe(t.text, kt(t)), S.set(t.id, n)), !n) {
|
|
778
810
|
let n = e.directive, r = e.targetIds?.length === 1 && n.kind === "compound" ? Ne(t.text, n.operations.length) : null;
|
|
779
811
|
return [r ? {
|
|
780
812
|
...e,
|
|
781
813
|
sourceAnnotations: r
|
|
782
814
|
} : e];
|
|
783
815
|
}
|
|
784
|
-
return
|
|
816
|
+
return b.add(t.id), [{
|
|
785
817
|
...e,
|
|
786
818
|
effects: n.map((t) => ({
|
|
787
819
|
...t,
|
|
@@ -792,27 +824,27 @@ function It(e, t) {
|
|
|
792
824
|
}
|
|
793
825
|
}))
|
|
794
826
|
}];
|
|
795
|
-
}),
|
|
827
|
+
}), w = performance.now() - v;
|
|
796
828
|
return t?.push({
|
|
797
|
-
actionDirectiveExtraction:
|
|
829
|
+
actionDirectiveExtraction: h,
|
|
798
830
|
articleId: e.id,
|
|
799
831
|
blockCount: e.blocks.length,
|
|
800
832
|
buildRangesMs: Math.round(a * 10) / 10,
|
|
801
|
-
directiveCount:
|
|
833
|
+
directiveCount: C.length,
|
|
802
834
|
directiveTextSize: e.directiveText.length,
|
|
803
|
-
extractActionDirectivesMs: Math.round(
|
|
804
|
-
mapDirectivesMs: Math.round(
|
|
805
|
-
prepareBlockIndexesMs: Math.round(
|
|
835
|
+
extractActionDirectivesMs: Math.round(_ * 10) / 10,
|
|
836
|
+
mapDirectivesMs: Math.round(w * 10) / 10,
|
|
837
|
+
prepareBlockIndexesMs: Math.round(p * 10) / 10,
|
|
806
838
|
totalMs: Math.round((performance.now() - n) * 10) / 10
|
|
807
|
-
}),
|
|
839
|
+
}), C;
|
|
808
840
|
}
|
|
809
|
-
function
|
|
841
|
+
function zt(e) {
|
|
810
842
|
let t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Set();
|
|
811
843
|
for (let i of e) {
|
|
812
|
-
let e =
|
|
844
|
+
let e = We(i.directive);
|
|
813
845
|
if (e.length === 0) continue;
|
|
814
846
|
let a = e.map(({ num: e }) => ({
|
|
815
|
-
definitionId: `${i.articleId}:article:${
|
|
847
|
+
definitionId: `${i.articleId}:article:${Ve(e)}`,
|
|
816
848
|
num: e
|
|
817
849
|
}));
|
|
818
850
|
t.set(i, a);
|
|
@@ -835,13 +867,13 @@ function Lt(e) {
|
|
|
835
867
|
definitions: n
|
|
836
868
|
};
|
|
837
869
|
}
|
|
838
|
-
function
|
|
839
|
-
let r = new Map(t.map((e) => [
|
|
870
|
+
function Bt(e, t, n) {
|
|
871
|
+
let r = new Map(t.map((e) => [Be(e.num), e]));
|
|
840
872
|
return e.map((e) => {
|
|
841
|
-
let t = n.get(e), i = t?.[0], a = [...
|
|
873
|
+
let t = n.get(e), i = t?.[0], a = [...Ge(e.directive.reference)].map((e) => r.get(Be(e))).filter((e) => e !== void 0 && e.definitionId !== i?.definitionId)[0], o = a === void 0 ? void 0 : {
|
|
842
874
|
definitionId: a.definitionId,
|
|
843
875
|
num: a.num
|
|
844
|
-
}, s =
|
|
876
|
+
}, s = Ke(e.directive), c = (e.targetIds?.length ?? 0) > 0;
|
|
845
877
|
return {
|
|
846
878
|
...e,
|
|
847
879
|
...i === void 0 ? {} : { createdArticle: i },
|
|
@@ -854,7 +886,7 @@ function Rt(e, t, n) {
|
|
|
854
886
|
};
|
|
855
887
|
});
|
|
856
888
|
}
|
|
857
|
-
function
|
|
889
|
+
function Vt(e) {
|
|
858
890
|
switch (e.kind) {
|
|
859
891
|
case "insert_after":
|
|
860
892
|
case "insert_before": return [e.insertText];
|
|
@@ -872,8 +904,8 @@ function zt(e) {
|
|
|
872
904
|
default: return [];
|
|
873
905
|
}
|
|
874
906
|
}
|
|
875
|
-
function
|
|
876
|
-
return e.flatMap((e) =>
|
|
907
|
+
function Ht(e) {
|
|
908
|
+
return e.flatMap((e) => Vt(e.directive).filter((e) => /[«»]/u.test(e)).map((t) => ({
|
|
877
909
|
code: "nested_french_quote_in_redaction",
|
|
878
910
|
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.",
|
|
879
911
|
details: {
|
|
@@ -885,18 +917,18 @@ function Bt(e) {
|
|
|
885
917
|
}
|
|
886
918
|
})));
|
|
887
919
|
}
|
|
888
|
-
function
|
|
889
|
-
return
|
|
920
|
+
function Ut(e) {
|
|
921
|
+
return Vt(e).map((t) => ({
|
|
890
922
|
directiveKind: e.kind,
|
|
891
923
|
text: t
|
|
892
924
|
}));
|
|
893
925
|
}
|
|
894
|
-
function
|
|
926
|
+
function Wt(e) {
|
|
895
927
|
let t = /* @__PURE__ */ new Set();
|
|
896
928
|
for (let n of e.matchAll(/«[^«»\n]+»/gu)) t.add(n[0]);
|
|
897
929
|
return Array.from(t);
|
|
898
930
|
}
|
|
899
|
-
function
|
|
931
|
+
function Gt(e, t) {
|
|
900
932
|
let n = new Map(e.blocks.map((e) => [e.id, e])), r = t.sourceBlockIds ?? e.blocks.map((e) => e.id), i = [], a = 0;
|
|
901
933
|
for (let e of r) {
|
|
902
934
|
let t = n.get(e);
|
|
@@ -908,11 +940,11 @@ function Ut(e, t) {
|
|
|
908
940
|
}
|
|
909
941
|
return i;
|
|
910
942
|
}
|
|
911
|
-
function
|
|
943
|
+
function Kt(e, t, n) {
|
|
912
944
|
return e.find((e) => t >= e.start && n <= e.stop);
|
|
913
945
|
}
|
|
914
|
-
function
|
|
915
|
-
let r =
|
|
946
|
+
function qt(e, t, n) {
|
|
947
|
+
let r = Wt(n), i = r.flatMap((t) => {
|
|
916
948
|
for (let n of e.blocks) {
|
|
917
949
|
let e = n.text.indexOf(t);
|
|
918
950
|
if (e !== -1) return [{
|
|
@@ -931,7 +963,7 @@ function Gt(e, t, n) {
|
|
|
931
963
|
e.directiveText
|
|
932
964
|
].filter((e) => e !== void 0 && e.length > 0), o = a.find((e) => r.some((t) => e.includes(t))) ?? a[0];
|
|
933
965
|
if (!o) return [];
|
|
934
|
-
let s =
|
|
966
|
+
let s = Gt(e, t);
|
|
935
967
|
if (s.length === 0) return [];
|
|
936
968
|
let c = [], l = 0;
|
|
937
969
|
for (let e of r) {
|
|
@@ -939,7 +971,7 @@ function Gt(e, t, n) {
|
|
|
939
971
|
if (t === -1) continue;
|
|
940
972
|
let n = t + e.length;
|
|
941
973
|
l = n;
|
|
942
|
-
let r =
|
|
974
|
+
let r = Kt(s, t, n);
|
|
943
975
|
r && c.push({
|
|
944
976
|
blockId: r.block.id,
|
|
945
977
|
start: t - r.start,
|
|
@@ -949,15 +981,15 @@ function Gt(e, t, n) {
|
|
|
949
981
|
}
|
|
950
982
|
return c;
|
|
951
983
|
}
|
|
952
|
-
function
|
|
984
|
+
function Jt(e, t) {
|
|
953
985
|
let n = new Map(e.map((e) => [e.id, e]));
|
|
954
986
|
return t.flatMap((e) => {
|
|
955
987
|
let t = n.get(e.articleId);
|
|
956
|
-
return t ?
|
|
988
|
+
return t ? Ut(e.directive).filter(({ text: e }) => /[«»]/u.test(e)).map(({ directiveKind: n, text: r }) => ({
|
|
957
989
|
articleId: e.articleId,
|
|
958
990
|
code: "nested_french_quote_in_redaction",
|
|
959
991
|
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.",
|
|
960
|
-
ranges:
|
|
992
|
+
ranges: qt(t, e, r),
|
|
961
993
|
severity: "warning",
|
|
962
994
|
details: {
|
|
963
995
|
blockId: e.blockId,
|
|
@@ -968,8 +1000,8 @@ function Kt(e, t) {
|
|
|
968
1000
|
})) : [];
|
|
969
1001
|
});
|
|
970
1002
|
}
|
|
971
|
-
function
|
|
972
|
-
let n = new Map(e.flatMap((e) => [...
|
|
1003
|
+
function Yt(e, t) {
|
|
1004
|
+
let n = new Map(e.flatMap((e) => [...te(e.blocks.map((e) => e.text))].map(([t, n]) => [e.blocks[t].id, {
|
|
973
1005
|
articleId: e.id,
|
|
974
1006
|
blockIds: e.blocks.slice(t - 1, n.endIndex + 1).map((e) => e.id),
|
|
975
1007
|
...n
|
|
@@ -991,13 +1023,13 @@ function qt(e, t) {
|
|
|
991
1023
|
}];
|
|
992
1024
|
});
|
|
993
1025
|
}
|
|
994
|
-
function
|
|
1026
|
+
function Xt(e, t, n, r, i, a, o = !0, s) {
|
|
995
1027
|
let c = new Se("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 = {
|
|
996
1028
|
sourceFormat: e,
|
|
997
1029
|
documentDate: r,
|
|
998
1030
|
html: t,
|
|
999
1031
|
htmlWithLinks: n,
|
|
1000
|
-
tableOfContents: a ?? c.timeSync("extractTableOfContents", () =>
|
|
1032
|
+
tableOfContents: a ?? c.timeSync("extractTableOfContents", () => y(u), { inputSize: u.length }),
|
|
1001
1033
|
articles: i
|
|
1002
1034
|
};
|
|
1003
1035
|
if (!o) {
|
|
@@ -1013,14 +1045,14 @@ function Jt(e, t, n, r, i, a, o = !0, s) {
|
|
|
1013
1045
|
directiveTextSize: u.length
|
|
1014
1046
|
}), e;
|
|
1015
1047
|
}
|
|
1016
|
-
let f = c.timeSync("extractGlobalApplicabilityDate", () =>
|
|
1048
|
+
let f = c.timeSync("extractGlobalApplicabilityDate", () => Ze(i.map((e) => e.text).join("\n"))), p = [], m = c.timeSync("extractDirectivesFromArticles", () => {
|
|
1017
1049
|
let e = [];
|
|
1018
1050
|
for (let t of i) {
|
|
1019
|
-
let n =
|
|
1051
|
+
let n = Rt(t, c.enabled ? p : void 0);
|
|
1020
1052
|
e.push(...n);
|
|
1021
1053
|
}
|
|
1022
1054
|
return e;
|
|
1023
|
-
}, { count: i.length }), { createdArticlesByDirective: h, definitions: g } = c.timeSync("buildInternalArticleDefinitions", () =>
|
|
1055
|
+
}, { count: i.length }), { createdArticlesByDirective: h, definitions: g } = c.timeSync("buildInternalArticleDefinitions", () => zt(m), { count: m.length }), _ = c.timeSync("attachInternalArticleMetadata", () => Bt(m, g, h), { count: m.length }), v = c.timeSync("collectNestedFrenchQuoteDiagnostics", () => Ht(_), { count: _.length }), b = [...s ?? [], ...v], x = c.timeSync("collectNestedFrenchQuoteAnnotations", () => [...Jt(i, _), ...Yt(i, _)], { count: _.length }), S = {
|
|
1024
1056
|
...d,
|
|
1025
1057
|
...f ? { globalApplicabilityDate: f } : {},
|
|
1026
1058
|
...g.length > 0 ? { internalArticleDefinitions: g } : {},
|
|
@@ -1112,20 +1144,20 @@ function Jt(e, t, n, r, i, a, o = !0, s) {
|
|
|
1112
1144
|
}),
|
|
1113
1145
|
directiveTextSize: u.length,
|
|
1114
1146
|
slowDirectiveArticles: p.toSorted((e, t) => t.totalMs - e.totalMs).slice(0, 10)
|
|
1115
|
-
}),
|
|
1147
|
+
}), S;
|
|
1116
1148
|
}
|
|
1117
|
-
function
|
|
1149
|
+
function Zt(e) {
|
|
1118
1150
|
return { items: e.map((e) => ({
|
|
1119
1151
|
id: e.id,
|
|
1120
1152
|
line: e.title ? `${e.label} : ${e.title}` : e.label,
|
|
1121
1153
|
type: "article"
|
|
1122
1154
|
})) };
|
|
1123
1155
|
}
|
|
1124
|
-
function
|
|
1125
|
-
return Array.from(
|
|
1156
|
+
function Qt(e) {
|
|
1157
|
+
return Array.from(se(e)).filter((e) => e.type === "article").map((e) => F(e.line.split(/[::]/u)[0]));
|
|
1126
1158
|
}
|
|
1127
|
-
function
|
|
1128
|
-
let i =
|
|
1159
|
+
function $t(e, t, n, r) {
|
|
1160
|
+
let i = mt(e), a = new Set(Array.from(n.matchAll(/\s+id=(?:"([^"]+)"|'([^']+)')/gu), (e) => e[1] ?? e[2])), o = Array.from(se(t)).filter((e) => e.type === "article"), s = e.map((e) => r === "akoma-ntoso" ? e.num ? I(e.num) : T(e.html)("p.TCNumArticle").first().attr("id") ?? I(e.label) : e.id), c = o.map((e) => e.id);
|
|
1129
1161
|
(c.length !== s.length || c.some((e, t) => e !== s[t])) && i.push({
|
|
1130
1162
|
code: "article_toc_source_heading_mismatch",
|
|
1131
1163
|
message: "The table of contents differs from the parsed article headings",
|
|
@@ -1141,8 +1173,8 @@ function Zt(e, t, n, r) {
|
|
|
1141
1173
|
});
|
|
1142
1174
|
return i;
|
|
1143
1175
|
}
|
|
1144
|
-
function
|
|
1145
|
-
let r =
|
|
1176
|
+
function en(e, t, n) {
|
|
1177
|
+
let r = Qt(y(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), i = e.map((e) => F(e.label)), a = Zt(e), o = [...n, ...$t(e, a, t, "assemblee-html")];
|
|
1146
1178
|
if (r.length > 0 && (r.length !== i.length || r.some((e, t) => e !== i[t]))) {
|
|
1147
1179
|
let t = r.findIndex((e, t) => e !== i[t]);
|
|
1148
1180
|
o.push({
|
|
@@ -1166,24 +1198,24 @@ function Qt(e, t, n) {
|
|
|
1166
1198
|
tableOfContents: a
|
|
1167
1199
|
};
|
|
1168
1200
|
}
|
|
1169
|
-
async function
|
|
1170
|
-
let n = new Se("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () =>
|
|
1201
|
+
async function tn(e, t) {
|
|
1202
|
+
let n = new Se("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => nn(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => Ct(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => T(i)), o = n.timeSync("extractArticleHeadings", () => gt(a)), s = new Set(o.map((e) => e.id)), c = ut(a).filter((e) => !s.has(I(e.num ?? e.label))).map((e) => e.label), l = c.length > 0 ? [{
|
|
1171
1203
|
code: "article_toc_source_heading_mismatch",
|
|
1172
1204
|
message: "Some structural article headings were not retained",
|
|
1173
1205
|
details: { discardedCandidates: c }
|
|
1174
|
-
}] : [], u =
|
|
1175
|
-
let n =
|
|
1206
|
+
}] : [], u = R(a), d = n.timeSync("extractArticlesAndBlocks", () => o.map((e, t) => {
|
|
1207
|
+
let n = yt(a, e, o[t + 1], u), r = xt(a, e.id, n), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
1176
1208
|
return {
|
|
1177
1209
|
id: e.id,
|
|
1178
1210
|
label: e.label,
|
|
1179
1211
|
num: e.num,
|
|
1180
1212
|
title: e.title,
|
|
1181
|
-
text:
|
|
1182
|
-
html: n.map((e) =>
|
|
1213
|
+
text: rt(a, n),
|
|
1214
|
+
html: n.map((e) => $e(a, e)).join("\n"),
|
|
1183
1215
|
directiveText: i,
|
|
1184
1216
|
blocks: r
|
|
1185
1217
|
};
|
|
1186
|
-
}), { count: o.length }), f = n.timeSync("injectHiddenArticleSummary", () =>
|
|
1218
|
+
}), { count: o.length }), f = n.timeSync("injectHiddenArticleSummary", () => St(a.html(), d)), { diagnostics: p, tableOfContents: m } = n.timeSync("buildAssembleeTableOfContents", () => en(d, f, l), { count: d.length }), h = n.timeSync("buildParsedDocument", () => Xt("assemblee-html", e, f, t.date, d, m, t.includeDirectiveAnalysis, p));
|
|
1187
1219
|
return h.diagnostics?.length && process.env.TISSEUSE_WARN_PARSED_BILL_DIAGNOSTICS === "1" && console.warn("Assemblée bill parsing diagnostics", h.diagnostics), n.log({
|
|
1188
1220
|
articleCount: h.articles.length,
|
|
1189
1221
|
blockCount: h.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -1191,18 +1223,18 @@ async function $t(e, t) {
|
|
|
1191
1223
|
targetDirectiveCount: h.directives.filter((e) => e.targetIds !== void 0).length
|
|
1192
1224
|
}), h;
|
|
1193
1225
|
}
|
|
1194
|
-
async function
|
|
1226
|
+
async function nn(e, t) {
|
|
1195
1227
|
return {
|
|
1196
1228
|
sourceFormat: "assemblee-html",
|
|
1197
1229
|
documentDate: t.date,
|
|
1198
1230
|
html: e,
|
|
1199
|
-
linkedHtml: await
|
|
1231
|
+
linkedHtml: await at(e, t, t.date)
|
|
1200
1232
|
};
|
|
1201
1233
|
}
|
|
1202
|
-
function
|
|
1234
|
+
function V(e) {
|
|
1203
1235
|
return e.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
1204
1236
|
}
|
|
1205
|
-
function
|
|
1237
|
+
function rn(e) {
|
|
1206
1238
|
let t = e;
|
|
1207
1239
|
for (let e = 0; e < 3; e++) {
|
|
1208
1240
|
let e = t;
|
|
@@ -1210,27 +1242,27 @@ function tn(e) {
|
|
|
1210
1242
|
}
|
|
1211
1243
|
return t;
|
|
1212
1244
|
}
|
|
1213
|
-
function
|
|
1245
|
+
function an(e) {
|
|
1214
1246
|
return /(?:<|&lt;)\/?(?:p|br|span|b|i|u|sup|sub|table|thead|tbody|tr|th|td|ul|ol|li)\b/iu.test(e);
|
|
1215
1247
|
}
|
|
1216
|
-
function
|
|
1248
|
+
function H(e) {
|
|
1217
1249
|
return e.name.replace(/^.*:/u, "");
|
|
1218
1250
|
}
|
|
1219
|
-
function
|
|
1220
|
-
return t.children.map((t) =>
|
|
1251
|
+
function on(e, t) {
|
|
1252
|
+
return t.children.map((t) => U(e, t)).filter(Boolean).join("");
|
|
1221
1253
|
}
|
|
1222
|
-
function
|
|
1223
|
-
return t.children.map((t) => t.type === "text" &&
|
|
1254
|
+
function sn(e, t) {
|
|
1255
|
+
return t.children.map((t) => t.type === "text" && an(t.data) ? rn(t.data) : U(e, t)).filter(Boolean).join("");
|
|
1224
1256
|
}
|
|
1225
|
-
function
|
|
1257
|
+
function U(e, t) {
|
|
1226
1258
|
if (t.type === "text") {
|
|
1227
1259
|
let e = t.data.replace(/\s+\./gu, ".");
|
|
1228
|
-
return
|
|
1260
|
+
return an(e) ? rn(e) : V(e);
|
|
1229
1261
|
}
|
|
1230
|
-
if (!
|
|
1231
|
-
let n =
|
|
1262
|
+
if (!L(t)) return "";
|
|
1263
|
+
let n = H(t), r = on(e, t);
|
|
1232
1264
|
switch (n) {
|
|
1233
|
-
case "p": return `<p${
|
|
1265
|
+
case "p": return `<p${cn(e, t, [
|
|
1234
1266
|
"id",
|
|
1235
1267
|
"class",
|
|
1236
1268
|
"align",
|
|
@@ -1244,13 +1276,13 @@ function B(e, t) {
|
|
|
1244
1276
|
case "u":
|
|
1245
1277
|
case "sup":
|
|
1246
1278
|
case "sub":
|
|
1247
|
-
case "abbr": return `<${n}${
|
|
1279
|
+
case "abbr": return `<${n}${cn(e, t, [
|
|
1248
1280
|
"id",
|
|
1249
1281
|
"class",
|
|
1250
1282
|
"title",
|
|
1251
1283
|
"style"
|
|
1252
1284
|
])}>${r}</${n}>`;
|
|
1253
|
-
case "a": return `<a href="${
|
|
1285
|
+
case "a": return `<a href="${V(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${cn(e, t, [
|
|
1254
1286
|
"id",
|
|
1255
1287
|
"class",
|
|
1256
1288
|
"title",
|
|
@@ -1261,8 +1293,8 @@ function B(e, t) {
|
|
|
1261
1293
|
case "tbody":
|
|
1262
1294
|
case "tr":
|
|
1263
1295
|
case "th":
|
|
1264
|
-
case "td": return
|
|
1265
|
-
case "caption": return `<caption${
|
|
1296
|
+
case "td": return ln(e, t, n, r);
|
|
1297
|
+
case "caption": return `<caption${cn(e, t, [
|
|
1266
1298
|
"id",
|
|
1267
1299
|
"class",
|
|
1268
1300
|
"align",
|
|
@@ -1270,12 +1302,12 @@ function B(e, t) {
|
|
|
1270
1302
|
])}>${r}</caption>`;
|
|
1271
1303
|
case "num": return `<span class="akn-num">${r}</span> `;
|
|
1272
1304
|
case "heading": return `<p class="akn-heading">${r}</p>`;
|
|
1273
|
-
case "content": return
|
|
1274
|
-
case "alinea": return
|
|
1275
|
-
case "article": return
|
|
1305
|
+
case "content": return sn(e, t);
|
|
1306
|
+
case "alinea": return wn(e, t, "div", "akn-alinea");
|
|
1307
|
+
case "article": return wn(e, t, "article", "akn-article");
|
|
1276
1308
|
case "blockList":
|
|
1277
1309
|
case "list": return `<div class="akn-list">${r}</div>`;
|
|
1278
|
-
case "item": return
|
|
1310
|
+
case "item": return wn(e, t, "div", "akn-item");
|
|
1279
1311
|
case "listIntroduction":
|
|
1280
1312
|
case "listWrapUp":
|
|
1281
1313
|
case "intro":
|
|
@@ -1291,23 +1323,23 @@ function B(e, t) {
|
|
|
1291
1323
|
case "book":
|
|
1292
1324
|
case "tome":
|
|
1293
1325
|
case "subchapter":
|
|
1294
|
-
case "subsection": return
|
|
1326
|
+
case "subsection": return wn(e, t, "section", `akn-${n}`);
|
|
1295
1327
|
case "crossHeading": return `<p class="akn-cross-heading">${r}</p>`;
|
|
1296
1328
|
default: return r;
|
|
1297
1329
|
}
|
|
1298
1330
|
}
|
|
1299
|
-
function
|
|
1331
|
+
function cn(e, t, n, r = {}) {
|
|
1300
1332
|
let i = [];
|
|
1301
1333
|
for (let r of n) {
|
|
1302
1334
|
if (r === "style") continue;
|
|
1303
1335
|
let n = e(t).attr(r);
|
|
1304
|
-
n !== void 0 && i.push(`${r}="${
|
|
1336
|
+
n !== void 0 && i.push(`${r}="${V(n)}"`);
|
|
1305
1337
|
}
|
|
1306
1338
|
let a = r.style ?? e(t).attr("style");
|
|
1307
|
-
return a && i.push(`style="${
|
|
1339
|
+
return a && i.push(`style="${V(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
|
|
1308
1340
|
}
|
|
1309
|
-
function
|
|
1310
|
-
return `<${n}${
|
|
1341
|
+
function ln(e, t, n, r) {
|
|
1342
|
+
return `<${n}${cn(e, t, [
|
|
1311
1343
|
"id",
|
|
1312
1344
|
"class",
|
|
1313
1345
|
"colspan",
|
|
@@ -1320,155 +1352,155 @@ function on(e, t, n, r) {
|
|
|
1320
1352
|
"cellspacing",
|
|
1321
1353
|
"cellpadding",
|
|
1322
1354
|
"style"
|
|
1323
|
-
], { style:
|
|
1355
|
+
], { style: un(e, t, n) })}>${r}</${n}>`;
|
|
1324
1356
|
}
|
|
1325
|
-
function
|
|
1357
|
+
function un(e, t, n) {
|
|
1326
1358
|
let r = e(t).attr("style") ?? "";
|
|
1327
|
-
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r =
|
|
1359
|
+
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = dn(r, "text-align", "center")), r || void 0;
|
|
1328
1360
|
}
|
|
1329
|
-
function
|
|
1361
|
+
function dn(e, t, n) {
|
|
1330
1362
|
let r = e.trim();
|
|
1331
1363
|
return `${r}${r && !r.endsWith(";") ? ";" : ""} ${t}: ${n};`.trim();
|
|
1332
1364
|
}
|
|
1333
|
-
function
|
|
1334
|
-
let n = [
|
|
1335
|
-
return n.length === 0 ? "" : `<p class="akn-heading">${
|
|
1365
|
+
function fn(e, t) {
|
|
1366
|
+
let n = [P(e(t).children("num").first().text()), P(e(t).children("heading").first().text())].filter(Boolean);
|
|
1367
|
+
return n.length === 0 ? "" : `<p class="akn-heading">${V(n.join(" "))}</p>`;
|
|
1336
1368
|
}
|
|
1337
|
-
function
|
|
1369
|
+
function pn(e, t) {
|
|
1338
1370
|
if (!t) return !1;
|
|
1339
|
-
let n = (e) =>
|
|
1340
|
-
return n(
|
|
1371
|
+
let n = (e) => P(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
|
|
1372
|
+
return n(P(e.replace(/<[^>]*>/gu, " ").replace(/ /gu, " ").replace(/ /giu, " ").replace(/–/giu, "–"))).startsWith(n(t));
|
|
1341
1373
|
}
|
|
1342
|
-
function
|
|
1343
|
-
let t =
|
|
1374
|
+
function mn(e) {
|
|
1375
|
+
let t = V(e);
|
|
1344
1376
|
return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}">${t}</span></p>`;
|
|
1345
1377
|
}
|
|
1346
|
-
function
|
|
1347
|
-
return
|
|
1378
|
+
function hn(e, t) {
|
|
1379
|
+
return gn([_n({
|
|
1348
1380
|
content: e,
|
|
1349
1381
|
pastille: t
|
|
1350
1382
|
})]);
|
|
1351
1383
|
}
|
|
1352
|
-
function
|
|
1384
|
+
function gn(e) {
|
|
1353
1385
|
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>`;
|
|
1354
1386
|
}
|
|
1355
|
-
function
|
|
1356
|
-
let i = n ? ` style="${
|
|
1357
|
-
return `<tr${r ? ` class="${
|
|
1387
|
+
function _n({ content: e, pastille: t, style: n, contextClass: r }) {
|
|
1388
|
+
let i = n ? ` style="${V(n)}"` : "", a = r ? ` ${V(r)}` : "";
|
|
1389
|
+
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}">${mn(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>`;
|
|
1358
1390
|
}
|
|
1359
|
-
function
|
|
1360
|
-
let r = t ? ` style="${
|
|
1361
|
-
return `<tr${n ? ` class="${
|
|
1391
|
+
function vn({ content: e, style: t, contextClass: n }) {
|
|
1392
|
+
let r = t ? ` style="${V(t)}"` : "", i = n ? ` ${V(n)}` : "";
|
|
1393
|
+
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>`;
|
|
1362
1394
|
}
|
|
1363
|
-
function
|
|
1395
|
+
function yn(e, t) {
|
|
1364
1396
|
return e(t).attr("data:pastille") ?? e(t).attr("pastille");
|
|
1365
1397
|
}
|
|
1366
|
-
function
|
|
1398
|
+
function bn(e, t) {
|
|
1367
1399
|
return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
|
|
1368
1400
|
}
|
|
1369
|
-
function
|
|
1370
|
-
return e(t).children().get().filter((e) =>
|
|
1401
|
+
function xn(e, t) {
|
|
1402
|
+
return e(t).children().get().filter((e) => L(e) ? H(e) === "content" : !1).map((t) => U(e, t)).filter(Boolean).join("\n");
|
|
1371
1403
|
}
|
|
1372
|
-
function
|
|
1404
|
+
function Sn(e, t) {
|
|
1373
1405
|
let n = [];
|
|
1374
1406
|
return e(t).children().each((t, r) => {
|
|
1375
|
-
if (!
|
|
1376
|
-
let i =
|
|
1377
|
-
i === "num" || i === "heading" || i === "content" || n.push(
|
|
1407
|
+
if (!L(r)) return;
|
|
1408
|
+
let i = H(r);
|
|
1409
|
+
i === "num" || i === "heading" || i === "content" || n.push(U(e, r));
|
|
1378
1410
|
}), n.filter(Boolean);
|
|
1379
1411
|
}
|
|
1380
|
-
function
|
|
1381
|
-
let n = [], r =
|
|
1412
|
+
function Cn(e, t) {
|
|
1413
|
+
let n = [], r = H(t), i = r === "alinea" ? yn(e, t) : void 0, a = xn(e, t), o = Tn(e, t, r, i), s = jn(e, t);
|
|
1382
1414
|
if (i) {
|
|
1383
|
-
let r = [
|
|
1384
|
-
|
|
1415
|
+
let r = [pn(a, P(e(t).children("num").first().text())) ? "" : fn(e, t), a].filter(Boolean).join("\n");
|
|
1416
|
+
P(r) && n.push(_n({
|
|
1385
1417
|
content: r,
|
|
1386
1418
|
pastille: i,
|
|
1387
1419
|
style: o,
|
|
1388
1420
|
contextClass: s
|
|
1389
1421
|
}));
|
|
1390
|
-
} else a && n.push(
|
|
1422
|
+
} else a && n.push(vn({
|
|
1391
1423
|
content: a,
|
|
1392
1424
|
style: o,
|
|
1393
1425
|
contextClass: s
|
|
1394
1426
|
}));
|
|
1395
1427
|
for (let r of e(t).children().get()) {
|
|
1396
|
-
if (!
|
|
1397
|
-
let t =
|
|
1398
|
-
t === "num" || t === "heading" || t === "content" || (t === "alinea" ||
|
|
1428
|
+
if (!L(r)) continue;
|
|
1429
|
+
let t = H(r);
|
|
1430
|
+
t === "num" || t === "heading" || t === "content" || (t === "alinea" || bn(e, r)) && n.push(...Cn(e, r));
|
|
1399
1431
|
}
|
|
1400
1432
|
return n;
|
|
1401
1433
|
}
|
|
1402
|
-
function
|
|
1403
|
-
let i =
|
|
1404
|
-
a ? `id="${
|
|
1434
|
+
function wn(e, t, n, r) {
|
|
1435
|
+
let i = H(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = yn(e, t), s = Tn(e, t, i, o), c = [`<${n} ${[
|
|
1436
|
+
a ? `id="${V(a)}"` : void 0,
|
|
1405
1437
|
`class="${r}"`,
|
|
1406
|
-
o ? `data-pastille="${
|
|
1407
|
-
s ? `style="${
|
|
1438
|
+
o ? `data-pastille="${V(o)}"` : void 0,
|
|
1439
|
+
s ? `style="${V(s)}"` : void 0
|
|
1408
1440
|
].filter((e) => e !== void 0).join(" ")}>`];
|
|
1409
1441
|
if (i === "part" || i === "title") {
|
|
1410
|
-
let r =
|
|
1442
|
+
let r = On(e, t, i), a = An(e, t), o = r ? [vn({
|
|
1411
1443
|
content: r,
|
|
1412
1444
|
contextClass: a
|
|
1413
1445
|
})] : [], s = () => {
|
|
1414
|
-
o.length !== 0 && (c.push(
|
|
1446
|
+
o.length !== 0 && (c.push(Dn(o)), o = []);
|
|
1415
1447
|
};
|
|
1416
1448
|
return e(t).children().each((t, n) => {
|
|
1417
|
-
if (!
|
|
1418
|
-
let r =
|
|
1449
|
+
if (!L(n)) return;
|
|
1450
|
+
let r = H(n);
|
|
1419
1451
|
if (!(r === "num" || r === "heading" || r === "content")) {
|
|
1420
1452
|
if (r === "alinea") {
|
|
1421
|
-
o.push(...
|
|
1453
|
+
o.push(...Cn(e, n));
|
|
1422
1454
|
return;
|
|
1423
1455
|
}
|
|
1424
|
-
s(), c.push(
|
|
1456
|
+
s(), c.push(U(e, n));
|
|
1425
1457
|
}
|
|
1426
1458
|
}), s(), c.push(`</${n}>`), c.join("\n");
|
|
1427
1459
|
}
|
|
1428
1460
|
if (i === "article") {
|
|
1429
|
-
let r =
|
|
1461
|
+
let r = P(e(t).children("num").first().text()), i = P(e(t).children("heading").first().text()), a = g(r) ?? {
|
|
1430
1462
|
label: r,
|
|
1431
1463
|
num: r
|
|
1432
|
-
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${
|
|
1433
|
-
if (
|
|
1434
|
-
let r = [
|
|
1464
|
+
}, 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>`;
|
|
1465
|
+
if (bn(e, t)) {
|
|
1466
|
+
let r = [vn({
|
|
1435
1467
|
content: o,
|
|
1436
|
-
contextClass:
|
|
1437
|
-
}), ...
|
|
1438
|
-
c.push(
|
|
1439
|
-
for (let n of
|
|
1468
|
+
contextClass: Nn(a.label)
|
|
1469
|
+
}), ...Cn(e, t)];
|
|
1470
|
+
c.push(gn(r));
|
|
1471
|
+
for (let n of Sn(e, t)) n.includes("akn-pastille-table") || c.push(n);
|
|
1440
1472
|
return c.push(`</${n}>`), c.join("\n");
|
|
1441
1473
|
}
|
|
1442
1474
|
c.push(o);
|
|
1443
1475
|
}
|
|
1444
1476
|
let l = [];
|
|
1445
1477
|
for (let n of ["content", "children"]) e(t).children().each((t, r) => {
|
|
1446
|
-
if (!
|
|
1447
|
-
let i =
|
|
1448
|
-
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(
|
|
1478
|
+
if (!L(r)) return;
|
|
1479
|
+
let i = H(r);
|
|
1480
|
+
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(U(e, r));
|
|
1449
1481
|
});
|
|
1450
1482
|
let u = l.join("\n");
|
|
1451
1483
|
if (i !== "article") {
|
|
1452
|
-
let n =
|
|
1484
|
+
let n = pn(u, P(e(t).children("num").first().text())) ? "" : fn(e, t);
|
|
1453
1485
|
n && c.push(n);
|
|
1454
1486
|
}
|
|
1455
|
-
return c.push(o ?
|
|
1487
|
+
return c.push(o ? hn(u, o) : u), c.push(`</${n}>`), c.join("\n");
|
|
1456
1488
|
}
|
|
1457
|
-
function
|
|
1458
|
-
let i =
|
|
1459
|
-
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i =
|
|
1489
|
+
function Tn(e, t, n, r) {
|
|
1490
|
+
let i = En(e(t).attr("style") ?? "", "font-family");
|
|
1491
|
+
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = dn(i, "text-align", "center")), i || void 0;
|
|
1460
1492
|
}
|
|
1461
|
-
function
|
|
1493
|
+
function En(e, t) {
|
|
1462
1494
|
return e.split(";").map((e) => e.trim()).filter(Boolean).filter((e) => !e.toLowerCase().startsWith(`${t.toLowerCase()}:`)).join(";");
|
|
1463
1495
|
}
|
|
1464
|
-
function
|
|
1496
|
+
function Dn(e) {
|
|
1465
1497
|
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>`;
|
|
1466
1498
|
}
|
|
1467
|
-
function
|
|
1468
|
-
let r =
|
|
1469
|
-
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${
|
|
1499
|
+
function On(e, t, n) {
|
|
1500
|
+
let r = P(e(t).children("num").first().text()), i = P(e(t).children("heading").first().text()), a = kn(n), o = [];
|
|
1501
|
+
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");
|
|
1470
1502
|
}
|
|
1471
|
-
function
|
|
1503
|
+
function kn(e) {
|
|
1472
1504
|
switch (e) {
|
|
1473
1505
|
case "part": return {
|
|
1474
1506
|
num: "TCNumPartie",
|
|
@@ -1492,22 +1524,22 @@ function Tn(e) {
|
|
|
1492
1524
|
};
|
|
1493
1525
|
}
|
|
1494
1526
|
}
|
|
1495
|
-
function
|
|
1496
|
-
let n =
|
|
1527
|
+
function An(e, t) {
|
|
1528
|
+
let n = Mn(P(e(t).children("num").first().text()));
|
|
1497
1529
|
if (n) return n;
|
|
1498
1530
|
for (let n of e(t).parents().get()) {
|
|
1499
|
-
if (!
|
|
1500
|
-
let t =
|
|
1531
|
+
if (!L(n)) continue;
|
|
1532
|
+
let t = H(n);
|
|
1501
1533
|
if (t !== "title" && t !== "part") continue;
|
|
1502
|
-
let r =
|
|
1534
|
+
let r = Mn(P(e(n).children("num").first().text()));
|
|
1503
1535
|
if (r) return r;
|
|
1504
1536
|
}
|
|
1505
1537
|
}
|
|
1506
|
-
function
|
|
1507
|
-
return
|
|
1538
|
+
function jn(e, t) {
|
|
1539
|
+
return An(e, t);
|
|
1508
1540
|
}
|
|
1509
|
-
function
|
|
1510
|
-
let [t, ...n] =
|
|
1541
|
+
function Mn(e) {
|
|
1542
|
+
let [t, ...n] = P(e).split(/\s+/u);
|
|
1511
1543
|
if (!t || n.length === 0) return;
|
|
1512
1544
|
let r = t.toLocaleLowerCase("fr-FR");
|
|
1513
1545
|
if ([
|
|
@@ -1517,10 +1549,10 @@ function On(e) {
|
|
|
1517
1549
|
"section"
|
|
1518
1550
|
].includes(r)) return `${r}-${n.join("_")}`;
|
|
1519
1551
|
}
|
|
1520
|
-
function
|
|
1521
|
-
return `article-${
|
|
1552
|
+
function Nn(e) {
|
|
1553
|
+
return `article-${P(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
|
|
1522
1554
|
}
|
|
1523
|
-
function
|
|
1555
|
+
function Pn(e) {
|
|
1524
1556
|
switch (e) {
|
|
1525
1557
|
case "part": return "partie";
|
|
1526
1558
|
case "book": return "livre";
|
|
@@ -1532,11 +1564,11 @@ function An(e) {
|
|
|
1532
1564
|
default: return;
|
|
1533
1565
|
}
|
|
1534
1566
|
}
|
|
1535
|
-
function
|
|
1536
|
-
return [
|
|
1567
|
+
function Fn(e, t) {
|
|
1568
|
+
return [P(e(t).children("num").first().text()), P(e(t).children("heading").first().text())].filter(Boolean).join(" ");
|
|
1537
1569
|
}
|
|
1538
|
-
function
|
|
1539
|
-
let n =
|
|
1570
|
+
function In(e, t) {
|
|
1571
|
+
let n = P(e(t).children("num").first().text()), r = P(e(t).children("heading").first().text()), i = g(n) ?? {
|
|
1540
1572
|
label: n,
|
|
1541
1573
|
num: n
|
|
1542
1574
|
};
|
|
@@ -1546,24 +1578,24 @@ function Mn(e, t) {
|
|
|
1546
1578
|
type: "article"
|
|
1547
1579
|
};
|
|
1548
1580
|
}
|
|
1549
|
-
function
|
|
1581
|
+
function Ln(e, t) {
|
|
1550
1582
|
e.items.push(...t.items);
|
|
1551
1583
|
}
|
|
1552
|
-
function
|
|
1584
|
+
function Rn(e, t) {
|
|
1553
1585
|
let n = { items: [] };
|
|
1554
1586
|
return e(t).children().each((t, r) => {
|
|
1555
|
-
if (!
|
|
1556
|
-
let i =
|
|
1587
|
+
if (!L(r)) return;
|
|
1588
|
+
let i = H(r);
|
|
1557
1589
|
if (i === "article") {
|
|
1558
|
-
n.items.push(
|
|
1590
|
+
n.items.push(In(e, r));
|
|
1559
1591
|
return;
|
|
1560
1592
|
}
|
|
1561
|
-
let a =
|
|
1593
|
+
let a = Pn(i);
|
|
1562
1594
|
if (!a) {
|
|
1563
|
-
|
|
1595
|
+
Ln(n, Rn(e, r));
|
|
1564
1596
|
return;
|
|
1565
1597
|
}
|
|
1566
|
-
let o =
|
|
1598
|
+
let o = Fn(e, r), s = Rn(e, r);
|
|
1567
1599
|
!o && s.items.length === 0 || n.items.push({
|
|
1568
1600
|
...s,
|
|
1569
1601
|
id: e(r).attr("eId") ?? e(r).attr("GUID"),
|
|
@@ -1572,26 +1604,26 @@ function Pn(e, t) {
|
|
|
1572
1604
|
});
|
|
1573
1605
|
}), n;
|
|
1574
1606
|
}
|
|
1575
|
-
function
|
|
1607
|
+
function zn(e) {
|
|
1576
1608
|
let t = e("body").first().get(0);
|
|
1577
|
-
return t === void 0 ? { items: [] } :
|
|
1609
|
+
return t === void 0 ? { items: [] } : Rn(e, t);
|
|
1578
1610
|
}
|
|
1579
|
-
function
|
|
1611
|
+
function Bn(e) {
|
|
1580
1612
|
return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
|
|
1581
1613
|
}
|
|
1582
|
-
function
|
|
1614
|
+
function Vn(e) {
|
|
1583
1615
|
let t = e("preamble").first(), n = e("body").first(), r = ["<div class=\"akn-bill\">"];
|
|
1584
|
-
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(
|
|
1585
|
-
|
|
1616
|
+
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(on(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
|
|
1617
|
+
L(n) && r.push(H(n) === "article" ? wn(e, n, "article", "akn-article") : U(e, n));
|
|
1586
1618
|
}), r.push("</section></div>"), r.join("\n");
|
|
1587
1619
|
}
|
|
1588
|
-
function
|
|
1589
|
-
let t =
|
|
1620
|
+
function Hn(e) {
|
|
1621
|
+
let t = T(e, { xml: {
|
|
1590
1622
|
decodeEntities: !1,
|
|
1591
1623
|
lowerCaseTags: !1,
|
|
1592
1624
|
lowerCaseAttributeNames: !1,
|
|
1593
1625
|
xmlMode: !0
|
|
1594
|
-
} }), n =
|
|
1626
|
+
} }), n = Bn(t), r = Vn(t);
|
|
1595
1627
|
return {
|
|
1596
1628
|
sourceFormat: "akoma-ntoso",
|
|
1597
1629
|
documentDate: n,
|
|
@@ -1599,42 +1631,42 @@ function Rn(e) {
|
|
|
1599
1631
|
linkedHtml: r
|
|
1600
1632
|
};
|
|
1601
1633
|
}
|
|
1602
|
-
function
|
|
1603
|
-
return
|
|
1634
|
+
function Un(e) {
|
|
1635
|
+
return Wn(T(e));
|
|
1604
1636
|
}
|
|
1605
|
-
function
|
|
1637
|
+
function Wn(e) {
|
|
1606
1638
|
let t = [];
|
|
1607
1639
|
return e("article.akn-article").each((n, r) => {
|
|
1608
|
-
let i = e(r).find("p.TCNumArticle").first().get(0), a =
|
|
1640
|
+
let i = e(r).find("p.TCNumArticle").first().get(0), a = P(i ? e(i).text() : ""), o = g(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = xt(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
1609
1641
|
t.push({
|
|
1610
1642
|
id: s,
|
|
1611
1643
|
label: o.label,
|
|
1612
1644
|
num: o.num,
|
|
1613
1645
|
title: o.title,
|
|
1614
|
-
text:
|
|
1615
|
-
html:
|
|
1646
|
+
text: rt(e, c),
|
|
1647
|
+
html: $e(e, r),
|
|
1616
1648
|
directiveText: u,
|
|
1617
1649
|
blocks: l
|
|
1618
1650
|
});
|
|
1619
1651
|
}), t;
|
|
1620
1652
|
}
|
|
1621
|
-
function
|
|
1622
|
-
let t =
|
|
1653
|
+
function Gn(e) {
|
|
1654
|
+
let t = T(e);
|
|
1623
1655
|
return {
|
|
1624
|
-
articles:
|
|
1656
|
+
articles: Wn(t),
|
|
1625
1657
|
htmlWithLinks: t.html()
|
|
1626
1658
|
};
|
|
1627
1659
|
}
|
|
1628
|
-
async function
|
|
1629
|
-
let n = new Se("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () =>
|
|
1660
|
+
async function Kn(e, t) {
|
|
1661
|
+
let n = new Se("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => T(e, { xml: {
|
|
1630
1662
|
decodeEntities: !1,
|
|
1631
1663
|
lowerCaseTags: !1,
|
|
1632
1664
|
lowerCaseAttributeNames: !1,
|
|
1633
1665
|
xmlMode: !0
|
|
1634
|
-
} })), i = t.date ??
|
|
1666
|
+
} })), i = t.date ?? Bn(r), a = n.timeSync("renderAknHtml", () => Vn(r), { inputSize: e.length }), o = t.linkedHtml ?? await n.time("addLinksToRenderedAknHtml", () => at(a, {
|
|
1635
1667
|
...t,
|
|
1636
1668
|
date: i
|
|
1637
|
-
}, i)), s = n.timeSync("extractRenderedAknArticles", () =>
|
|
1669
|
+
}, i)), s = n.timeSync("extractRenderedAknArticles", () => Un(a)), c = n.timeSync("injectHiddenArticleSummary", () => St(o, s)), { articles: l, htmlWithLinks: u } = n.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => Gn(c)), d = l.length > 0 ? l : s, f = n.timeSync("extractAknTableOfContents", () => zn(r)), p = n.timeSync("buildParsedDocument", () => Xt("akoma-ntoso", a, l.length > 0 ? u : c, i, d, f, t.includeDirectiveAnalysis, $t(d, f, l.length > 0 ? u : c, "akoma-ntoso")));
|
|
1638
1670
|
return n.log({
|
|
1639
1671
|
articleCount: p.articles.length,
|
|
1640
1672
|
blockCount: p.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -1642,25 +1674,25 @@ async function Hn(e, t) {
|
|
|
1642
1674
|
targetDirectiveCount: p.directives.filter((e) => e.targetIds !== void 0).length
|
|
1643
1675
|
}), p;
|
|
1644
1676
|
}
|
|
1645
|
-
async function
|
|
1646
|
-
let n =
|
|
1677
|
+
async function qn(e, t) {
|
|
1678
|
+
let n = Hn(e), r = t.date ?? n.documentDate;
|
|
1647
1679
|
return {
|
|
1648
1680
|
sourceFormat: "akoma-ntoso",
|
|
1649
1681
|
documentDate: r,
|
|
1650
1682
|
html: n.html,
|
|
1651
|
-
linkedHtml: await
|
|
1683
|
+
linkedHtml: await at(n.html, t, r)
|
|
1652
1684
|
};
|
|
1653
1685
|
}
|
|
1654
1686
|
//#endregion
|
|
1655
1687
|
//#region src/lib/server/assemblee_document_search.ts
|
|
1656
|
-
var
|
|
1657
|
-
function
|
|
1688
|
+
var Jn = /\bexpos[ée]\s+des\s+motifs\b/giu, Yn = /\barticle\s+(?:premier|1er|\d+)/iu;
|
|
1689
|
+
function Xn(e) {
|
|
1658
1690
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1659
1691
|
}
|
|
1660
|
-
function
|
|
1661
|
-
let t =
|
|
1692
|
+
function Zn(e) {
|
|
1693
|
+
let t = Xn(T(e).text()), n = [...t.matchAll(Jn)], r = /* @__PURE__ */ new Set(), i = [];
|
|
1662
1694
|
for (let [e, a] of n.entries()) {
|
|
1663
|
-
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c =
|
|
1695
|
+
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = Yn.exec(s), l = Xn(s.slice(0, c?.index ?? s.length));
|
|
1664
1696
|
if (l.length < 20 || r.has(l)) continue;
|
|
1665
1697
|
r.add(l);
|
|
1666
1698
|
let u = `expose-des-motifs-${e + 1}`;
|
|
@@ -1676,8 +1708,8 @@ function qn(e) {
|
|
|
1676
1708
|
}
|
|
1677
1709
|
return i;
|
|
1678
1710
|
}
|
|
1679
|
-
async function
|
|
1680
|
-
let i = await
|
|
1711
|
+
async function Qn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
1712
|
+
let i = await tn(t, {
|
|
1681
1713
|
date: e,
|
|
1682
1714
|
includeDirectiveAnalysis: !1,
|
|
1683
1715
|
linkBaseUrl: n,
|
|
@@ -1686,7 +1718,7 @@ async function Jn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1686
1718
|
});
|
|
1687
1719
|
return {
|
|
1688
1720
|
items: [...i.articles.map((e) => {
|
|
1689
|
-
let t =
|
|
1721
|
+
let t = Xn(e.directiveText || e.text);
|
|
1690
1722
|
if (t) return {
|
|
1691
1723
|
anchor: e.id,
|
|
1692
1724
|
articleNumber: e.num ?? null,
|
|
@@ -1696,17 +1728,17 @@ async function Jn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1696
1728
|
label: e.label,
|
|
1697
1729
|
title: e.title ?? null
|
|
1698
1730
|
};
|
|
1699
|
-
}).filter((e) => e !== void 0), ...
|
|
1731
|
+
}).filter((e) => e !== void 0), ...Zn(t)],
|
|
1700
1732
|
tableOfContents: i.tableOfContents
|
|
1701
1733
|
};
|
|
1702
1734
|
}
|
|
1703
|
-
function
|
|
1735
|
+
function $n(e, t) {
|
|
1704
1736
|
return Ee("sha256").update(JSON.stringify({
|
|
1705
1737
|
item: e,
|
|
1706
1738
|
metadata: t
|
|
1707
1739
|
})).digest("hex");
|
|
1708
1740
|
}
|
|
1709
|
-
function
|
|
1741
|
+
function er(e) {
|
|
1710
1742
|
if (typeof e != "object" || !e) return;
|
|
1711
1743
|
let t = e.cycleDeVie?.chrono;
|
|
1712
1744
|
if (t !== void 0) for (let e of [
|
|
@@ -1721,11 +1753,11 @@ function Xn(e) {
|
|
|
1721
1753
|
}
|
|
1722
1754
|
//#endregion
|
|
1723
1755
|
//#region src/lib/server/senat_amendment_search.ts
|
|
1724
|
-
function
|
|
1725
|
-
return e?.trim() ?
|
|
1756
|
+
function tr(e) {
|
|
1757
|
+
return e?.trim() ? T(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
|
|
1726
1758
|
}
|
|
1727
|
-
function
|
|
1728
|
-
let n =
|
|
1759
|
+
function nr({ dispositifHtml: e, objetHtml: t }) {
|
|
1760
|
+
let n = tr(e), r = tr(t);
|
|
1729
1761
|
return [...n ? [{
|
|
1730
1762
|
content: n,
|
|
1731
1763
|
itemKind: "dispositif",
|
|
@@ -1736,7 +1768,7 @@ function Qn({ dispositifHtml: e, objetHtml: t }) {
|
|
|
1736
1768
|
label: "Objet"
|
|
1737
1769
|
}] : []];
|
|
1738
1770
|
}
|
|
1739
|
-
function
|
|
1771
|
+
function rr(e, t) {
|
|
1740
1772
|
return Ee("sha256").update(JSON.stringify({
|
|
1741
1773
|
item: e,
|
|
1742
1774
|
metadata: t
|
|
@@ -1744,225 +1776,225 @@ function $n(e, t) {
|
|
|
1744
1776
|
}
|
|
1745
1777
|
//#endregion
|
|
1746
1778
|
//#region src/lib/text_parsers/amendment_action_directives.ts
|
|
1747
|
-
function
|
|
1779
|
+
function W(e, t) {
|
|
1748
1780
|
return {
|
|
1749
1781
|
...t,
|
|
1750
1782
|
position: e.position(),
|
|
1751
1783
|
type: "amendment_action_directive"
|
|
1752
1784
|
};
|
|
1753
1785
|
}
|
|
1754
|
-
function
|
|
1786
|
+
function ir(e, t) {
|
|
1755
1787
|
return {
|
|
1756
1788
|
type: e === "start" ? "head_of_target" : "tail_after_target",
|
|
1757
|
-
unit:
|
|
1789
|
+
unit: t ? n(t) : "article"
|
|
1758
1790
|
};
|
|
1759
1791
|
}
|
|
1760
|
-
function
|
|
1792
|
+
function ar(e) {
|
|
1761
1793
|
return e === "start" ? "insert_before" : "insert_after";
|
|
1762
1794
|
}
|
|
1763
|
-
var
|
|
1764
|
-
let
|
|
1795
|
+
var or = A(O("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), G = D(o, E([O("les?\\s+", { flags: "i" }), ee], { value: (e) => e[1] }), ee, p), sr = D(E([O("la\\s+fin\\s+de\\s+", { flags: "i" }), G], { value: (e) => {
|
|
1796
|
+
let t = e[1];
|
|
1765
1797
|
return {
|
|
1766
|
-
targetReference:
|
|
1798
|
+
targetReference: t,
|
|
1767
1799
|
targetScope: {
|
|
1768
1800
|
type: "tail_after_target",
|
|
1769
|
-
unit: t
|
|
1801
|
+
unit: n(t)
|
|
1770
1802
|
}
|
|
1771
1803
|
};
|
|
1772
|
-
} }),
|
|
1773
|
-
O(
|
|
1774
|
-
O(
|
|
1775
|
-
|
|
1776
|
-
O(
|
|
1804
|
+
} }), E([m], { value: (e) => ({ targetScope: e[0] }) })), K = A(E([
|
|
1805
|
+
A(O("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1806
|
+
A(O("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1807
|
+
G,
|
|
1808
|
+
A(O("\\s*,?\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*)?", { flags: "i" }), { default: "" })
|
|
1777
1809
|
], { value: (e, t) => ({
|
|
1778
1810
|
reference: e[2],
|
|
1779
1811
|
text: t.text()
|
|
1780
|
-
}) }), { default: null }),
|
|
1781
|
-
function
|
|
1812
|
+
}) }), { default: null }), cr = A(O(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${ve})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
|
|
1813
|
+
function q(e) {
|
|
1782
1814
|
return e?.text ?? "";
|
|
1783
1815
|
}
|
|
1784
|
-
function
|
|
1785
|
-
return { citation:
|
|
1816
|
+
function lr(e) {
|
|
1817
|
+
return { citation: f(e.position()) };
|
|
1786
1818
|
}
|
|
1787
|
-
var
|
|
1819
|
+
var J = D(E([l], { value: (e) => ({ citation: e[0] }) }), O("\\S[\\s\\S]*", { value: (e, t) => lr(t) })), ur = O("\\S[\\s\\S]*", { value: (e, t) => lr(t) }), Y = O("[^:«“\"]*(?::\\s*)?", { flags: "i" }), dr = O("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
|
|
1788
1820
|
flags: "i",
|
|
1789
|
-
value: (e, t) =>
|
|
1790
|
-
}),
|
|
1821
|
+
value: (e, t) => lr(t)
|
|
1822
|
+
}), fr = O("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
|
|
1791
1823
|
flags: "i",
|
|
1792
|
-
value: (e, t) =>
|
|
1793
|
-
}),
|
|
1824
|
+
value: (e, t) => lr(t)
|
|
1825
|
+
}), pr = O("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
|
|
1794
1826
|
flags: "i",
|
|
1795
|
-
value: (e, t) =>
|
|
1796
|
-
}),
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
], { value: (e) => e[2] }),
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1827
|
+
value: (e, t) => lr(t)
|
|
1828
|
+
}), mr = D(E([l], { value: (e) => ({ citation: e[0] }) }), dr), hr = D(E([l], { value: (e) => ({ citation: e[0] }) }), pr), gr = E([O(`${a}s?\\s*:?\\s*`, { flags: "i" }), mr], { value: (e) => e[1] }), _r = E([O(`${h}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), hr], { value: (e) => e[1] }), vr = D(E([l], { value: (e) => ({ citation: e[0] }) }), fr), yr = E([
|
|
1829
|
+
cr,
|
|
1830
|
+
O(`${a}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1831
|
+
vr
|
|
1832
|
+
], { value: (e) => e[2] }), br = E([
|
|
1833
|
+
cr,
|
|
1834
|
+
O(`${a}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1835
|
+
D(E([l], { value: (e) => ({ citation: e[0] }) }), ur)
|
|
1804
1836
|
], { value: (e) => e[2] });
|
|
1805
|
-
function
|
|
1837
|
+
function X(e) {
|
|
1806
1838
|
return e?.reference;
|
|
1807
1839
|
}
|
|
1808
|
-
var
|
|
1840
|
+
var xr = E([or, O("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => W(t, {
|
|
1809
1841
|
contextText: e[0],
|
|
1810
1842
|
kind: "delete_article"
|
|
1811
|
-
}) }),
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
], { value: (e, t) =>
|
|
1817
|
-
contextText:
|
|
1843
|
+
}) }), Sr = E([
|
|
1844
|
+
K,
|
|
1845
|
+
O("supprimer", { flags: "i" }),
|
|
1846
|
+
A(E([j, G], { value: (e) => e[1] }), { default: null }),
|
|
1847
|
+
A(E([j, br], { value: (e) => e[1] }), { default: null })
|
|
1848
|
+
], { value: (e, t) => W(t, {
|
|
1849
|
+
contextText: q(e[0]),
|
|
1818
1850
|
kind: "delete_portion",
|
|
1819
1851
|
targetCitation: e[3]?.citation ?? void 0,
|
|
1820
|
-
targetReference: e[2] ??
|
|
1821
|
-
}) }),
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
], { value: (e, t) =>
|
|
1827
|
-
contextText:
|
|
1852
|
+
targetReference: e[2] ?? X(e[0])
|
|
1853
|
+
}) }), Cr = E([
|
|
1854
|
+
K,
|
|
1855
|
+
D(O("r[eé]diger\\s+ainsi", { flags: "i" }), O("r[eé]tablir", { flags: "i" })),
|
|
1856
|
+
Y,
|
|
1857
|
+
J
|
|
1858
|
+
], { value: (e, t) => W(t, {
|
|
1859
|
+
contextText: q(e[0]),
|
|
1828
1860
|
kind: "rewrite_portion",
|
|
1829
1861
|
replacementCitation: e[3].citation,
|
|
1830
|
-
targetReference:
|
|
1831
|
-
}) }),
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
O(
|
|
1839
|
-
|
|
1840
|
-
], { value: (e, t) =>
|
|
1841
|
-
contextText:
|
|
1862
|
+
targetReference: X(e[0])
|
|
1863
|
+
}) }), wr = E([
|
|
1864
|
+
K,
|
|
1865
|
+
D(O("substituer", { flags: "i" }), O("remplacer", { flags: "i" })),
|
|
1866
|
+
j,
|
|
1867
|
+
cr,
|
|
1868
|
+
gr,
|
|
1869
|
+
O("\\s*,?\\s*"),
|
|
1870
|
+
A(O("par\\s+", { flags: "i" }), { default: "" }),
|
|
1871
|
+
_r
|
|
1872
|
+
], { value: (e, t) => W(t, {
|
|
1873
|
+
contextText: q(e[0]),
|
|
1842
1874
|
kind: "replace",
|
|
1843
1875
|
replacementCitation: e[7].citation,
|
|
1844
1876
|
targetCitation: e[4].citation,
|
|
1845
|
-
targetReference:
|
|
1846
|
-
}) }),
|
|
1877
|
+
targetReference: X(e[0])
|
|
1878
|
+
}) }), Tr = E([
|
|
1879
|
+
K,
|
|
1880
|
+
O("substituer", { flags: "i" }),
|
|
1881
|
+
j,
|
|
1882
|
+
A(O("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
|
|
1847
1883
|
G,
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
E("[\\s\\S]*?(?=[«“\"]|$)"),
|
|
1853
|
-
q
|
|
1854
|
-
], { value: (e, t) => U(t, {
|
|
1855
|
-
contextText: K(e[0]),
|
|
1884
|
+
O("[\\s\\S]*?(?=[«“\"]|$)"),
|
|
1885
|
+
J
|
|
1886
|
+
], { value: (e, t) => W(t, {
|
|
1887
|
+
contextText: q(e[0]),
|
|
1856
1888
|
kind: "rewrite_portion",
|
|
1857
1889
|
replacementCitation: e[6].citation,
|
|
1858
|
-
targetReference: e[4] ??
|
|
1859
|
-
}) }),
|
|
1890
|
+
targetReference: e[4] ?? X(e[0])
|
|
1891
|
+
}) }), Er = E([
|
|
1860
1892
|
e,
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
], { value: (e, t) =>
|
|
1893
|
+
j,
|
|
1894
|
+
O("l['’ ]article", { flags: "i" }),
|
|
1895
|
+
O("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1896
|
+
O("ins[eé]rer", { flags: "i" }),
|
|
1897
|
+
Y,
|
|
1898
|
+
J
|
|
1899
|
+
], { value: (e, t) => W(t, {
|
|
1868
1900
|
contextText: "",
|
|
1869
1901
|
insertCitation: e[6].citation,
|
|
1870
1902
|
kind: e[0] === "before" ? "insert_article_before" : "insert_article_after"
|
|
1871
|
-
}) }),
|
|
1903
|
+
}) }), Dr = E([
|
|
1872
1904
|
e,
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
], { value: (e, t) =>
|
|
1905
|
+
j,
|
|
1906
|
+
G,
|
|
1907
|
+
O("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1908
|
+
D(O("ins[eé]rer", { flags: "i" }), O("ajouter", { flags: "i" })),
|
|
1909
|
+
Y,
|
|
1910
|
+
J
|
|
1911
|
+
], { value: (e, t) => W(t, {
|
|
1880
1912
|
contextText: "",
|
|
1881
1913
|
insertCitation: e[6].citation,
|
|
1882
|
-
kind:
|
|
1914
|
+
kind: w(e[0]),
|
|
1883
1915
|
targetReference: e[2]
|
|
1884
|
-
}) }),
|
|
1916
|
+
}) }), Or = E([
|
|
1885
1917
|
e,
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
], { value: (e, t) =>
|
|
1918
|
+
j,
|
|
1919
|
+
O("l['’ ]alin[eé]a", { flags: "i" }),
|
|
1920
|
+
O("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1921
|
+
O("ins[eé]rer", { flags: "i" }),
|
|
1922
|
+
Y,
|
|
1923
|
+
J
|
|
1924
|
+
], { value: (e, t) => W(t, {
|
|
1893
1925
|
contextText: "",
|
|
1894
1926
|
insertCitation: e[6].citation,
|
|
1895
|
-
kind:
|
|
1896
|
-
}) }),
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1927
|
+
kind: w(e[0])
|
|
1928
|
+
}) }), kr = E([
|
|
1929
|
+
K,
|
|
1930
|
+
d,
|
|
1931
|
+
O("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1932
|
+
D(O("ins[eé]rer", { flags: "i" }), O("ajouter", { flags: "i" })),
|
|
1933
|
+
Y,
|
|
1934
|
+
J
|
|
1903
1935
|
], { value: (e, t) => {
|
|
1904
|
-
let n = e[0], r =
|
|
1905
|
-
return
|
|
1906
|
-
contextText:
|
|
1936
|
+
let n = e[0], r = X(n), i = e[1];
|
|
1937
|
+
return W(t, {
|
|
1938
|
+
contextText: q(n),
|
|
1907
1939
|
insertCitation: e[5].citation,
|
|
1908
|
-
kind:
|
|
1940
|
+
kind: ar(i),
|
|
1909
1941
|
targetReference: r,
|
|
1910
|
-
targetScope:
|
|
1942
|
+
targetScope: ir(i, r)
|
|
1911
1943
|
});
|
|
1912
|
-
} }),
|
|
1913
|
-
|
|
1944
|
+
} }), Ar = E([
|
|
1945
|
+
K,
|
|
1914
1946
|
e,
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
], { value: (e, t) =>
|
|
1922
|
-
contextText:
|
|
1947
|
+
j,
|
|
1948
|
+
yr,
|
|
1949
|
+
O("[\\s\\S]*?(?=ins[eé]rer)"),
|
|
1950
|
+
O("ins[eé]rer", { flags: "i" }),
|
|
1951
|
+
j,
|
|
1952
|
+
_r
|
|
1953
|
+
], { value: (e, t) => W(t, {
|
|
1954
|
+
contextText: q(e[0]),
|
|
1923
1955
|
insertCitation: e[7].citation,
|
|
1924
|
-
kind:
|
|
1956
|
+
kind: w(e[1]),
|
|
1925
1957
|
targetCitation: e[3].citation,
|
|
1926
|
-
targetReference:
|
|
1927
|
-
}) }),
|
|
1928
|
-
|
|
1958
|
+
targetReference: X(e[0])
|
|
1959
|
+
}) }), jr = E([
|
|
1960
|
+
K,
|
|
1929
1961
|
e,
|
|
1930
|
-
|
|
1931
|
-
W,
|
|
1932
|
-
E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1933
|
-
T(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
|
|
1934
|
-
J,
|
|
1935
|
-
q
|
|
1936
|
-
], { value: (e, t) => U(t, {
|
|
1937
|
-
contextText: K(e[0]),
|
|
1938
|
-
insertCitation: e[7].citation,
|
|
1939
|
-
kind: S(e[1]),
|
|
1940
|
-
targetReference: Y(e[0]) ?? e[3]
|
|
1941
|
-
}) }), Or = T(Tr, Sr, Cr, wr, xr, w([
|
|
1962
|
+
j,
|
|
1942
1963
|
G,
|
|
1964
|
+
O("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1965
|
+
D(O("ins[eé]rer", { flags: "i" }), O("ajouter", { flags: "i" })),
|
|
1966
|
+
Y,
|
|
1967
|
+
J
|
|
1968
|
+
], { value: (e, t) => W(t, {
|
|
1969
|
+
contextText: q(e[0]),
|
|
1970
|
+
insertCitation: e[7].citation,
|
|
1971
|
+
kind: w(e[1]),
|
|
1972
|
+
targetReference: X(e[0]) ?? e[3]
|
|
1973
|
+
}) }), Mr = D(kr, Er, Dr, Or, Tr, E([
|
|
1974
|
+
K,
|
|
1943
1975
|
e,
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1976
|
+
j,
|
|
1977
|
+
yr,
|
|
1978
|
+
O("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
|
|
1979
|
+
D(E([
|
|
1980
|
+
O("supprimer", {
|
|
1949
1981
|
flags: "i",
|
|
1950
1982
|
value: "delete_portion"
|
|
1951
1983
|
}),
|
|
1952
|
-
|
|
1953
|
-
|
|
1984
|
+
j,
|
|
1985
|
+
sr
|
|
1954
1986
|
], { value: (e) => ({
|
|
1955
1987
|
kind: e[0],
|
|
1956
1988
|
...e[2]
|
|
1957
|
-
}) }),
|
|
1958
|
-
|
|
1989
|
+
}) }), E([
|
|
1990
|
+
O("r[eé]diger\\s+ainsi", {
|
|
1959
1991
|
flags: "i",
|
|
1960
1992
|
value: "rewrite_portion"
|
|
1961
1993
|
}),
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1994
|
+
j,
|
|
1995
|
+
sr,
|
|
1996
|
+
Y,
|
|
1997
|
+
J
|
|
1966
1998
|
], { value: (e) => ({
|
|
1967
1999
|
kind: e[0],
|
|
1968
2000
|
replacementCitation: e[4].citation,
|
|
@@ -1970,49 +2002,49 @@ var _r = w([nr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1970
2002
|
}) }))
|
|
1971
2003
|
], { value: (e, t) => {
|
|
1972
2004
|
let n = e[5];
|
|
1973
|
-
return
|
|
1974
|
-
contextText:
|
|
2005
|
+
return W(t, {
|
|
2006
|
+
contextText: q(e[0]),
|
|
1975
2007
|
kind: n.kind,
|
|
1976
2008
|
replacementCitation: n.replacementCitation,
|
|
1977
2009
|
targetCitation: e[3].citation,
|
|
1978
|
-
targetReference:
|
|
2010
|
+
targetReference: X(e[0]) ?? n.targetReference,
|
|
1979
2011
|
targetScope: n.targetScope
|
|
1980
2012
|
});
|
|
1981
|
-
} }),
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
2013
|
+
} }), Ar, jr, E([
|
|
2014
|
+
or,
|
|
2015
|
+
O("ins[eé]rer", { flags: "i" }),
|
|
2016
|
+
O(`[\\s\\S]*?(?=${C})`, { flags: "i" }),
|
|
1985
2017
|
e,
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
], { value: (e, t) =>
|
|
2018
|
+
Y,
|
|
2019
|
+
l,
|
|
2020
|
+
Y,
|
|
2021
|
+
l
|
|
2022
|
+
], { value: (e, t) => W(t, {
|
|
1991
2023
|
contextText: e[0],
|
|
1992
2024
|
insertCitation: e[8],
|
|
1993
|
-
kind:
|
|
2025
|
+
kind: w(e[3]),
|
|
1994
2026
|
targetCitation: e[6]
|
|
1995
|
-
}) }),
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
], { value: (e, t) =>
|
|
2002
|
-
contextText:
|
|
2027
|
+
}) }), wr, Cr, E([
|
|
2028
|
+
K,
|
|
2029
|
+
O("compl[eé]ter", { flags: "i" }),
|
|
2030
|
+
A(E([j, G], { value: (e) => e[1] }), { default: null }),
|
|
2031
|
+
Y,
|
|
2032
|
+
J
|
|
2033
|
+
], { value: (e, t) => W(t, {
|
|
2034
|
+
contextText: q(e[0]),
|
|
2003
2035
|
insertCitation: e[4].citation,
|
|
2004
2036
|
kind: "insert_after",
|
|
2005
|
-
targetReference: e[2] ??
|
|
2006
|
-
}) }),
|
|
2037
|
+
targetReference: e[2] ?? X(e[0])
|
|
2038
|
+
}) }), xr, Sr);
|
|
2007
2039
|
//#endregion
|
|
2008
2040
|
//#region src/lib/server/parsed_amendments.ts
|
|
2009
|
-
function
|
|
2041
|
+
function Nr(e) {
|
|
2010
2042
|
return e.replace(/\s+/gu, " ").trim();
|
|
2011
2043
|
}
|
|
2012
|
-
function
|
|
2013
|
-
return e.split(/\n/gu).map(
|
|
2044
|
+
function Pr(e) {
|
|
2045
|
+
return e.split(/\n/gu).map(Nr).filter(Boolean).join("\n");
|
|
2014
2046
|
}
|
|
2015
|
-
function
|
|
2047
|
+
function Fr(e, t) {
|
|
2016
2048
|
let { start: n, stop: r } = t;
|
|
2017
2049
|
for (; n < r && /\s/u.test(e[n]);) n++;
|
|
2018
2050
|
for (; r > n && /\s/u.test(e[r - 1]);) r--;
|
|
@@ -2021,16 +2053,16 @@ function jr(e, t) {
|
|
|
2021
2053
|
stop: r
|
|
2022
2054
|
} : null;
|
|
2023
2055
|
}
|
|
2024
|
-
function
|
|
2025
|
-
return
|
|
2056
|
+
function Ir(e, t) {
|
|
2057
|
+
return fe(me(e), t);
|
|
2026
2058
|
}
|
|
2027
|
-
function
|
|
2059
|
+
function Lr(e) {
|
|
2028
2060
|
return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
|
|
2029
2061
|
}
|
|
2030
|
-
function
|
|
2062
|
+
function Rr(e) {
|
|
2031
2063
|
return {
|
|
2032
2064
|
articleLabel: e.targetArticleLabel ?? null,
|
|
2033
|
-
targetPosition:
|
|
2065
|
+
targetPosition: Lr(e.targetPosition),
|
|
2034
2066
|
alinea: e.targetAlinea ?? null,
|
|
2035
2067
|
alineaLabel: e.targetAlineaLabel ?? null,
|
|
2036
2068
|
subdivisionSourceId: e.targetSubdivisionSourceId ?? null,
|
|
@@ -2038,75 +2070,75 @@ function Pr(e) {
|
|
|
2038
2070
|
subpos: e.targetSubpos ?? null
|
|
2039
2071
|
};
|
|
2040
2072
|
}
|
|
2041
|
-
function
|
|
2073
|
+
function Z(e) {
|
|
2042
2074
|
return {
|
|
2043
2075
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
2044
2076
|
sourcePosition: e.position,
|
|
2045
2077
|
sourceText: e.text
|
|
2046
2078
|
};
|
|
2047
2079
|
}
|
|
2048
|
-
function
|
|
2080
|
+
function zr(e) {
|
|
2049
2081
|
return {
|
|
2050
2082
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
2051
2083
|
sourcePosition: e.position,
|
|
2052
2084
|
sourceText: e.text
|
|
2053
2085
|
};
|
|
2054
2086
|
}
|
|
2055
|
-
function
|
|
2087
|
+
function Br(e) {
|
|
2056
2088
|
return {
|
|
2057
2089
|
...e?.originalTransformation === void 0 ? {} : { dispositifOriginalTransformation: e.originalTransformation },
|
|
2058
2090
|
...e === null ? {} : { dispositifPosition: e.position },
|
|
2059
2091
|
dispositifText: e?.text ?? null
|
|
2060
2092
|
};
|
|
2061
2093
|
}
|
|
2062
|
-
function
|
|
2094
|
+
function Vr(e, t, n, r = Pr(e.slice(n.start, n.stop))) {
|
|
2063
2095
|
return {
|
|
2064
|
-
originalTransformation:
|
|
2096
|
+
originalTransformation: Ir(t, n),
|
|
2065
2097
|
position: n,
|
|
2066
2098
|
text: r
|
|
2067
2099
|
};
|
|
2068
2100
|
}
|
|
2069
|
-
function
|
|
2101
|
+
function Hr(e) {
|
|
2070
2102
|
let t = e.dispositifHtml ?? e.dispositifText;
|
|
2071
2103
|
if (!t) return null;
|
|
2072
|
-
let n = e.dispositifHtml ?
|
|
2104
|
+
let n = e.dispositifHtml ? he()(t) : ye(t), r = n.output, i = Fr(r, {
|
|
2073
2105
|
start: 0,
|
|
2074
2106
|
stop: r.length
|
|
2075
2107
|
});
|
|
2076
2108
|
return {
|
|
2077
|
-
dispositif: i === null ? null :
|
|
2109
|
+
dispositif: i === null ? null : Vr(r, n, i),
|
|
2078
2110
|
simplifiedText: r,
|
|
2079
2111
|
transformation: n
|
|
2080
2112
|
};
|
|
2081
2113
|
}
|
|
2082
|
-
function
|
|
2114
|
+
function Q(e) {
|
|
2083
2115
|
if (!e) return [];
|
|
2084
|
-
if (e.type === "enumeration") return [...
|
|
2116
|
+
if (e.type === "enumeration") return [...Q(e.left), ...Q(e.right)];
|
|
2085
2117
|
if (e.type === "bounded-interval") {
|
|
2086
|
-
let t =
|
|
2118
|
+
let t = Q(e.first)[0], n = Q(e.last)[0];
|
|
2087
2119
|
return t !== void 0 && n !== void 0 && n >= t ? Array.from({ length: n - t + 1 }, (e, n) => t + n) : [t, n].filter((e) => e !== void 0);
|
|
2088
2120
|
}
|
|
2089
2121
|
if (e.type === "counted-interval") {
|
|
2090
|
-
let t =
|
|
2122
|
+
let t = Q(e.first)[0];
|
|
2091
2123
|
return t === void 0 ? [] : Array.from({ length: e.count }, (e, n) => t + n);
|
|
2092
2124
|
}
|
|
2093
|
-
if (e.type === "exclusion") return
|
|
2094
|
-
for (let t of
|
|
2125
|
+
if (e.type === "exclusion") return Q(e.left);
|
|
2126
|
+
for (let t of c(e)) if (t.type === "alinéa" && typeof t.index == "number" && t.index > 0) return [t.index];
|
|
2095
2127
|
return [];
|
|
2096
2128
|
}
|
|
2097
|
-
function
|
|
2098
|
-
let n =
|
|
2129
|
+
function Ur(e, t) {
|
|
2130
|
+
let n = Q(t);
|
|
2099
2131
|
return {
|
|
2100
2132
|
...e,
|
|
2101
2133
|
alinea: n[0] ?? e.alinea ?? null,
|
|
2102
2134
|
...n.length > 0 ? { alineas: n } : {}
|
|
2103
2135
|
};
|
|
2104
2136
|
}
|
|
2105
|
-
function
|
|
2137
|
+
function Wr(e) {
|
|
2106
2138
|
return e.replace(/^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*/iu, "").replace(/^\s*(?:\d+°|[a-z]\))\s*/iu, "").trim();
|
|
2107
2139
|
}
|
|
2108
|
-
function
|
|
2109
|
-
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(
|
|
2140
|
+
function Gr(e, t) {
|
|
2141
|
+
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(Wr(t.text));
|
|
2110
2142
|
if (!n) return null;
|
|
2111
2143
|
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10);
|
|
2112
2144
|
return !Number.isFinite(r) || r < 1 ? null : {
|
|
@@ -2115,25 +2147,25 @@ function Vr(e, t) {
|
|
|
2115
2147
|
alineas: [r]
|
|
2116
2148
|
};
|
|
2117
2149
|
}
|
|
2118
|
-
function
|
|
2150
|
+
function Kr(e, t) {
|
|
2119
2151
|
if (e) return e.unit === "article" && t.alinea !== null ? {
|
|
2120
2152
|
...e,
|
|
2121
2153
|
unit: "alinéa"
|
|
2122
2154
|
} : e;
|
|
2123
2155
|
}
|
|
2124
|
-
function
|
|
2125
|
-
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(
|
|
2156
|
+
function qr(e) {
|
|
2157
|
+
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(Wr(e.text));
|
|
2126
2158
|
}
|
|
2127
|
-
function
|
|
2128
|
-
return
|
|
2159
|
+
function Jr(e, t, n, r) {
|
|
2160
|
+
return Vr(e, t, {
|
|
2129
2161
|
start: n.position.start,
|
|
2130
2162
|
stop: r.position.stop
|
|
2131
2163
|
});
|
|
2132
2164
|
}
|
|
2133
|
-
function
|
|
2165
|
+
function Yr(e) {
|
|
2134
2166
|
return /^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*(?!alin[eé]a\b)/iu.test(e.text);
|
|
2135
2167
|
}
|
|
2136
|
-
function
|
|
2168
|
+
function Xr(e, t) {
|
|
2137
2169
|
let n = { ...t.position };
|
|
2138
2170
|
function r(t) {
|
|
2139
2171
|
let r = t.exec(e.slice(n.start, n.stop));
|
|
@@ -2142,39 +2174,39 @@ function Kr(e, t) {
|
|
|
2142
2174
|
stop: n.stop
|
|
2143
2175
|
});
|
|
2144
2176
|
}
|
|
2145
|
-
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),
|
|
2177
|
+
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), Fr(e, n);
|
|
2146
2178
|
}
|
|
2147
|
-
function
|
|
2148
|
-
return
|
|
2179
|
+
function Zr(e) {
|
|
2180
|
+
return ue(e);
|
|
2149
2181
|
}
|
|
2150
|
-
function
|
|
2151
|
-
return
|
|
2182
|
+
function Qr(e, t) {
|
|
2183
|
+
return Mr(new k(e.slice(0, t.stop), t.start)) ?? null;
|
|
2152
2184
|
}
|
|
2153
|
-
function
|
|
2154
|
-
if (n) return
|
|
2185
|
+
function $(e, t, n) {
|
|
2186
|
+
if (n) return Vr(e, t, n.position, Pr(_(e, n)));
|
|
2155
2187
|
}
|
|
2156
|
-
function
|
|
2188
|
+
function $r(e, t) {
|
|
2157
2189
|
if (!e) return;
|
|
2158
2190
|
let n = structuredClone(e);
|
|
2159
|
-
for (let e of
|
|
2191
|
+
for (let e of u(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = Ir(t, e.position));
|
|
2160
2192
|
return n;
|
|
2161
2193
|
}
|
|
2162
|
-
function
|
|
2163
|
-
let i =
|
|
2194
|
+
function ei(e, t, n, r) {
|
|
2195
|
+
let i = Xr(e, n);
|
|
2164
2196
|
if (!i) return null;
|
|
2165
|
-
let a =
|
|
2197
|
+
let a = Qr(e, i);
|
|
2166
2198
|
if (!a) return null;
|
|
2167
|
-
let o =
|
|
2199
|
+
let o = Vr(e, t, i), s = $r(a.targetReference, t), c = Ur(r, s), l = Zr(o.text);
|
|
2168
2200
|
if (a.kind === "delete_article") return {
|
|
2169
2201
|
kind: "delete_article",
|
|
2170
|
-
...
|
|
2202
|
+
...Z(o),
|
|
2171
2203
|
target: c
|
|
2172
2204
|
};
|
|
2173
2205
|
if (a.kind === "delete_portion") {
|
|
2174
|
-
let n =
|
|
2206
|
+
let n = $(e, t, a.targetCitation);
|
|
2175
2207
|
return {
|
|
2176
2208
|
kind: "delete_portion",
|
|
2177
|
-
...
|
|
2209
|
+
...Z(o),
|
|
2178
2210
|
target: c,
|
|
2179
2211
|
...n === void 0 ? {} : {
|
|
2180
2212
|
targetCitation: n,
|
|
@@ -2182,16 +2214,16 @@ function Xr(e, t, n, r) {
|
|
|
2182
2214
|
},
|
|
2183
2215
|
targetOccurrence: l,
|
|
2184
2216
|
targetReference: s,
|
|
2185
|
-
targetScope:
|
|
2217
|
+
targetScope: Kr(a.targetScope, c)
|
|
2186
2218
|
};
|
|
2187
2219
|
}
|
|
2188
2220
|
if (a.kind === "rewrite_portion") {
|
|
2189
|
-
let n =
|
|
2221
|
+
let n = $(e, t, a.replacementCitation);
|
|
2190
2222
|
if (!n) return null;
|
|
2191
|
-
let r =
|
|
2223
|
+
let r = $(e, t, a.targetCitation);
|
|
2192
2224
|
return {
|
|
2193
2225
|
kind: "rewrite_portion",
|
|
2194
|
-
...
|
|
2226
|
+
...Z(o),
|
|
2195
2227
|
target: c,
|
|
2196
2228
|
...r === void 0 ? {} : {
|
|
2197
2229
|
targetCitation: r,
|
|
@@ -2199,16 +2231,16 @@ function Xr(e, t, n, r) {
|
|
|
2199
2231
|
},
|
|
2200
2232
|
targetOccurrence: l,
|
|
2201
2233
|
targetReference: s,
|
|
2202
|
-
targetScope:
|
|
2234
|
+
targetScope: Kr(a.targetScope, c),
|
|
2203
2235
|
replacementCitation: n,
|
|
2204
2236
|
replacementText: n.text
|
|
2205
2237
|
};
|
|
2206
2238
|
}
|
|
2207
2239
|
if (a.kind === "replace") {
|
|
2208
|
-
let n =
|
|
2240
|
+
let n = $(e, t, a.replacementCitation), r = $(e, t, a.targetCitation);
|
|
2209
2241
|
return !n || !r ? null : {
|
|
2210
2242
|
kind: "replace",
|
|
2211
|
-
...
|
|
2243
|
+
...Z(o),
|
|
2212
2244
|
target: c,
|
|
2213
2245
|
targetCitation: r,
|
|
2214
2246
|
targetText: r.text,
|
|
@@ -2219,32 +2251,32 @@ function Xr(e, t, n, r) {
|
|
|
2219
2251
|
};
|
|
2220
2252
|
}
|
|
2221
2253
|
if (a.kind === "insert_article_after") {
|
|
2222
|
-
let n =
|
|
2254
|
+
let n = $(e, t, a.insertCitation);
|
|
2223
2255
|
return n ? {
|
|
2224
2256
|
kind: "insert_article_after",
|
|
2225
|
-
...
|
|
2257
|
+
...Z(o),
|
|
2226
2258
|
target: c,
|
|
2227
2259
|
insertCitation: n,
|
|
2228
2260
|
insertText: n.text
|
|
2229
2261
|
} : null;
|
|
2230
2262
|
}
|
|
2231
2263
|
if (a.kind === "insert_article_before") {
|
|
2232
|
-
let n =
|
|
2264
|
+
let n = $(e, t, a.insertCitation);
|
|
2233
2265
|
return n ? {
|
|
2234
2266
|
kind: "insert_article_before",
|
|
2235
|
-
...
|
|
2267
|
+
...Z(o),
|
|
2236
2268
|
target: c,
|
|
2237
2269
|
insertCitation: n,
|
|
2238
2270
|
insertText: n.text
|
|
2239
2271
|
} : null;
|
|
2240
2272
|
}
|
|
2241
2273
|
if (a.kind === "insert_after" || a.kind === "insert_before") {
|
|
2242
|
-
let n =
|
|
2274
|
+
let n = $(e, t, a.insertCitation);
|
|
2243
2275
|
if (!n) return null;
|
|
2244
|
-
let r =
|
|
2276
|
+
let r = $(e, t, a.targetCitation);
|
|
2245
2277
|
return {
|
|
2246
2278
|
kind: a.kind,
|
|
2247
|
-
...
|
|
2279
|
+
...Z(o),
|
|
2248
2280
|
target: c,
|
|
2249
2281
|
...r === void 0 ? {} : {
|
|
2250
2282
|
targetCitation: r,
|
|
@@ -2254,19 +2286,19 @@ function Xr(e, t, n, r) {
|
|
|
2254
2286
|
targetReference: s,
|
|
2255
2287
|
insertCitation: n,
|
|
2256
2288
|
insertText: n.text,
|
|
2257
|
-
targetScope:
|
|
2289
|
+
targetScope: Kr(a.targetScope, c)
|
|
2258
2290
|
};
|
|
2259
2291
|
}
|
|
2260
2292
|
return null;
|
|
2261
2293
|
}
|
|
2262
|
-
function
|
|
2294
|
+
function ti(e, t) {
|
|
2263
2295
|
let n = [], r = 0, i = 0;
|
|
2264
2296
|
function a(r) {
|
|
2265
|
-
let a =
|
|
2297
|
+
let a = Fr(e, {
|
|
2266
2298
|
start: i,
|
|
2267
2299
|
stop: r
|
|
2268
2300
|
});
|
|
2269
|
-
a !== null && n.push(
|
|
2301
|
+
a !== null && n.push(Vr(e, t, a));
|
|
2270
2302
|
}
|
|
2271
2303
|
function o(t) {
|
|
2272
2304
|
let n = Math.max(e.lastIndexOf("\n", t - 1), e.lastIndexOf("\r", t - 1));
|
|
@@ -2284,7 +2316,7 @@ function Zr(e, t) {
|
|
|
2284
2316
|
continue;
|
|
2285
2317
|
}
|
|
2286
2318
|
if (r > 0) continue;
|
|
2287
|
-
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) &&
|
|
2319
|
+
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) && qr({
|
|
2288
2320
|
originalTransformation: void 0,
|
|
2289
2321
|
position: {
|
|
2290
2322
|
start: i,
|
|
@@ -2296,8 +2328,8 @@ function Zr(e, t) {
|
|
|
2296
2328
|
}
|
|
2297
2329
|
return a(e.length), n;
|
|
2298
2330
|
}
|
|
2299
|
-
function
|
|
2300
|
-
let t =
|
|
2331
|
+
function ni(e) {
|
|
2332
|
+
let t = Hr(e), n = t?.dispositif ?? null, r = Br(n), i = [], a = [], o = Rr(e);
|
|
2301
2333
|
if (e.sourceFormat === "senat-ameli" && e.sourceKind === "S") return i.push({
|
|
2302
2334
|
code: "unsupported_sub_amendment",
|
|
2303
2335
|
message: "Les sous-amendements ne sont pas encore projetés."
|
|
@@ -2315,9 +2347,9 @@ function Qr(e) {
|
|
|
2315
2347
|
});
|
|
2316
2348
|
else {
|
|
2317
2349
|
let { simplifiedText: e, transformation: r } = t, s = o, c = null;
|
|
2318
|
-
for (let t of
|
|
2319
|
-
|
|
2320
|
-
let n = c ?
|
|
2350
|
+
for (let t of ti(e, r)) {
|
|
2351
|
+
Yr(t) && (s = o, c = null);
|
|
2352
|
+
let n = c ? Jr(e, r, c, t) : t, i = ei(e, r, n, s);
|
|
2321
2353
|
if (i) {
|
|
2322
2354
|
a.push(i), c = null, (i.target.alinea !== null || i.target.alineas) && (s = i.target);
|
|
2323
2355
|
continue;
|
|
@@ -2326,23 +2358,23 @@ function Qr(e) {
|
|
|
2326
2358
|
c = n;
|
|
2327
2359
|
continue;
|
|
2328
2360
|
}
|
|
2329
|
-
let l =
|
|
2361
|
+
let l = Gr(o, t);
|
|
2330
2362
|
if (l !== null) {
|
|
2331
2363
|
s = l;
|
|
2332
2364
|
continue;
|
|
2333
2365
|
}
|
|
2334
|
-
|
|
2366
|
+
qr(t) && (c = t);
|
|
2335
2367
|
}
|
|
2336
2368
|
a.length === 0 && (o.targetPosition === "after_article" || o.targetPosition === "before_article") && a.push({
|
|
2337
2369
|
kind: o.targetPosition === "before_article" ? "insert_article_before" : "insert_article_after",
|
|
2338
|
-
...
|
|
2370
|
+
...Z(n),
|
|
2339
2371
|
target: o,
|
|
2340
2372
|
insertCitation: n,
|
|
2341
2373
|
insertText: n.text
|
|
2342
2374
|
}), a.length === 0 && i.push({
|
|
2343
2375
|
code: "unrecognized_dispositif",
|
|
2344
2376
|
message: "Le dispositif est présent mais aucune directive d'amendement n'a été reconnue.",
|
|
2345
|
-
...
|
|
2377
|
+
...zr(n)
|
|
2346
2378
|
});
|
|
2347
2379
|
}
|
|
2348
2380
|
return {
|
|
@@ -2356,25 +2388,25 @@ function Qr(e) {
|
|
|
2356
2388
|
}
|
|
2357
2389
|
//#endregion
|
|
2358
2390
|
//#region src/lib/server/senat_document_search.ts
|
|
2359
|
-
function
|
|
2391
|
+
function ri(e) {
|
|
2360
2392
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
2361
2393
|
}
|
|
2362
|
-
function
|
|
2363
|
-
let t =
|
|
2394
|
+
function ii(e) {
|
|
2395
|
+
let t = g(e);
|
|
2364
2396
|
if (!t) return {
|
|
2365
2397
|
articleNumber: null,
|
|
2366
2398
|
label: e,
|
|
2367
2399
|
title: null
|
|
2368
2400
|
};
|
|
2369
|
-
let n =
|
|
2401
|
+
let n = ri(t.num ?? "") || null, r = ri(t.title ?? "") || null;
|
|
2370
2402
|
return {
|
|
2371
2403
|
articleNumber: n,
|
|
2372
2404
|
label: t.label,
|
|
2373
2405
|
title: r
|
|
2374
2406
|
};
|
|
2375
2407
|
}
|
|
2376
|
-
function
|
|
2377
|
-
let t =
|
|
2408
|
+
function ai(e) {
|
|
2409
|
+
let t = T(e), n = [], r = ri(t("section.akn-preamble").text());
|
|
2378
2410
|
return r && n.push({
|
|
2379
2411
|
anchor: "senat-expose-des-motifs",
|
|
2380
2412
|
articleNumber: null,
|
|
@@ -2384,9 +2416,9 @@ function ei(e) {
|
|
|
2384
2416
|
label: "Exposé des motifs",
|
|
2385
2417
|
title: null
|
|
2386
2418
|
}), t("article.akn-article").each((e, r) => {
|
|
2387
|
-
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o =
|
|
2419
|
+
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o = ri(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = ii(o || s), l = i.clone();
|
|
2388
2420
|
l.children("p.TCNumArticle").remove();
|
|
2389
|
-
let u =
|
|
2421
|
+
let u = ri(l.text());
|
|
2390
2422
|
u && n.push({
|
|
2391
2423
|
anchor: i.attr("id") || null,
|
|
2392
2424
|
articleNumber: c.articleNumber,
|
|
@@ -2398,7 +2430,7 @@ function ei(e) {
|
|
|
2398
2430
|
});
|
|
2399
2431
|
}), n;
|
|
2400
2432
|
}
|
|
2401
|
-
function
|
|
2433
|
+
function oi(e, t) {
|
|
2402
2434
|
return Ee("sha256").update(JSON.stringify({
|
|
2403
2435
|
item: e,
|
|
2404
2436
|
metadata: t
|
|
@@ -2406,32 +2438,32 @@ function ti(e, t) {
|
|
|
2406
2438
|
}
|
|
2407
2439
|
//#endregion
|
|
2408
2440
|
//#region src/lib/server/senat_document_sources.ts
|
|
2409
|
-
var
|
|
2410
|
-
function
|
|
2441
|
+
var si = new Set(["senat.fr", "www.senat.fr"]), ci = "https://www.senat.fr";
|
|
2442
|
+
function li(e) {
|
|
2411
2443
|
return e?.trim() || void 0;
|
|
2412
2444
|
}
|
|
2413
|
-
function
|
|
2445
|
+
function ui(e) {
|
|
2414
2446
|
try {
|
|
2415
|
-
let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`,
|
|
2416
|
-
return
|
|
2447
|
+
let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`, ci);
|
|
2448
|
+
return si.has(n.hostname.toLowerCase()) ? n : void 0;
|
|
2417
2449
|
} catch {
|
|
2418
2450
|
return;
|
|
2419
2451
|
}
|
|
2420
2452
|
}
|
|
2421
|
-
function
|
|
2422
|
-
let t =
|
|
2453
|
+
function di(e) {
|
|
2454
|
+
let t = li(e);
|
|
2423
2455
|
if (t === void 0) return {
|
|
2424
2456
|
publicUrl: null,
|
|
2425
2457
|
status: "no_url"
|
|
2426
2458
|
};
|
|
2427
|
-
let n =
|
|
2459
|
+
let n = ui(t);
|
|
2428
2460
|
if (n === void 0) return {
|
|
2429
2461
|
publicUrl: t,
|
|
2430
2462
|
status: "unsupported_source"
|
|
2431
2463
|
};
|
|
2432
2464
|
let r = n.pathname;
|
|
2433
2465
|
if (/^\/akomantoso\/[^/]+\.akn\.xml$/iu.test(r)) return {
|
|
2434
|
-
akomaNtosoUrl: `${
|
|
2466
|
+
akomaNtosoUrl: `${ci}${r}`,
|
|
2435
2467
|
publicUrl: n.toString(),
|
|
2436
2468
|
status: "available"
|
|
2437
2469
|
};
|
|
@@ -2440,17 +2472,17 @@ function oi(e) {
|
|
|
2440
2472
|
publicUrl: n.toString(),
|
|
2441
2473
|
status: "unsupported_source"
|
|
2442
2474
|
} : {
|
|
2443
|
-
akomaNtosoUrl: `${
|
|
2475
|
+
akomaNtosoUrl: `${ci}/akomantoso/${i.replace(/\.html$/iu, ".akn.xml")}`,
|
|
2444
2476
|
publicUrl: n.toString(),
|
|
2445
2477
|
status: "available"
|
|
2446
2478
|
};
|
|
2447
2479
|
}
|
|
2448
|
-
function
|
|
2480
|
+
function fi(e) {
|
|
2449
2481
|
return /^\s*(?:<\?xml\b[^>]*>\s*)?<akomaNtoso[\s/>]/iu.test(e);
|
|
2450
2482
|
}
|
|
2451
2483
|
//#endregion
|
|
2452
2484
|
//#region src/lib/alineas/alineas_numbers.ts
|
|
2453
|
-
var
|
|
2485
|
+
var pi = {
|
|
2454
2486
|
"0150a855548f15a2af52ea057be53f5d": 1,
|
|
2455
2487
|
"039826cf379b94afefe90b25c6045ca0": 1,
|
|
2456
2488
|
"03a7e564b84662f4d957c51018e26244": 1,
|
|
@@ -21424,7 +21456,7 @@ var ci = {
|
|
|
21424
21456
|
d16d29c923bd60c7b095b66c6058fe60: 1664,
|
|
21425
21457
|
"1c14c2adf5cfda3220b2057160e10e91": 1665,
|
|
21426
21458
|
e44c55ca1ac46ff46420686a466c9fc6: 1665
|
|
21427
|
-
},
|
|
21459
|
+
}, mi = "\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", hi = "\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", gi = "\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", _i = "\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", vi = "\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", yi = {
|
|
21428
21460
|
assnatetatagr: { bold: !0 },
|
|
21429
21461
|
assnatetatagrgr: { bold: !0 },
|
|
21430
21462
|
assnatetatatr: { bold: !0 },
|
|
@@ -21525,29 +21557,29 @@ var ci = {
|
|
|
21525
21557
|
assnatxl67: { align: "center" },
|
|
21526
21558
|
assnatenteteequilibre: { align: "center" }
|
|
21527
21559
|
};
|
|
21528
|
-
function
|
|
21529
|
-
let t = Object.keys(
|
|
21530
|
-
for (let n of t) if (e.includes(n)) return
|
|
21560
|
+
function bi(e) {
|
|
21561
|
+
let t = Object.keys(yi).sort((e, t) => t.length - e.length);
|
|
21562
|
+
for (let n of t) if (e.includes(n)) return yi[n];
|
|
21531
21563
|
return null;
|
|
21532
21564
|
}
|
|
21533
|
-
function
|
|
21565
|
+
function xi(e) {
|
|
21534
21566
|
return Te.createHash("md5").update(e).digest("hex");
|
|
21535
21567
|
}
|
|
21536
|
-
function
|
|
21568
|
+
function Si(e) {
|
|
21537
21569
|
return e ? /font-weight\s*:\s*(bold|[6-9]00|1000)/i.test(e) || /font-family\s*:\s*[^;]*\bBold\b/i.test(e) : !1;
|
|
21538
21570
|
}
|
|
21539
|
-
function
|
|
21571
|
+
function Ci(e) {
|
|
21540
21572
|
return e ? /font-style\s*:\s*italic/i.test(e) || /font-family\s*:\s*[^;]*\bItalic\b/i.test(e) : !1;
|
|
21541
21573
|
}
|
|
21542
|
-
function
|
|
21574
|
+
function wi(e) {
|
|
21543
21575
|
if (!e || !/vertical-align\s*:\s*super/i.test(e)) return !1;
|
|
21544
21576
|
let t = e.match(/font-size\s*:\s*([\d.]+)pt/i);
|
|
21545
21577
|
return !(t && parseFloat(t[1]) < 8);
|
|
21546
21578
|
}
|
|
21547
|
-
function
|
|
21579
|
+
function Ti(e) {
|
|
21548
21580
|
return e ? /vertical-align\s*:\s*sub/i.test(e) : !1;
|
|
21549
21581
|
}
|
|
21550
|
-
function
|
|
21582
|
+
function Ei(e) {
|
|
21551
21583
|
if (!e) return;
|
|
21552
21584
|
let t = [
|
|
21553
21585
|
"width",
|
|
@@ -21582,15 +21614,15 @@ function xi(e) {
|
|
|
21582
21614
|
}
|
|
21583
21615
|
return n.length > 0 ? n.join("; ") : void 0;
|
|
21584
21616
|
}
|
|
21585
|
-
function
|
|
21617
|
+
function Di(e, t) {
|
|
21586
21618
|
return !!(e && /text-align\s*:\s*center/i.test(e) || t && /center/i.test(t));
|
|
21587
21619
|
}
|
|
21588
|
-
function
|
|
21620
|
+
function Oi(e) {
|
|
21589
21621
|
if (!e) return null;
|
|
21590
21622
|
let t = e.match(/text-align\s*:\s*(left|center|right|justify)/i);
|
|
21591
21623
|
return t ? t[1].toLowerCase() : null;
|
|
21592
21624
|
}
|
|
21593
|
-
function
|
|
21625
|
+
function ki(e) {
|
|
21594
21626
|
if (!e) return null;
|
|
21595
21627
|
for (let [t, n] of [
|
|
21596
21628
|
[/assnat1Tome|assnatAN1PARTIE/i, 1],
|
|
@@ -21602,8 +21634,8 @@ function wi(e) {
|
|
|
21602
21634
|
]) if (t.test(e)) return n;
|
|
21603
21635
|
return null;
|
|
21604
21636
|
}
|
|
21605
|
-
function
|
|
21606
|
-
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a =
|
|
21637
|
+
function Ai(e, t = {}) {
|
|
21638
|
+
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = T(e, { xml: { decodeEntities: !1 } });
|
|
21607
21639
|
a("style, script, meta, link").remove(), a(".assnatHeader, .assnatFooter, .assnatHeaderLeft, .assnatHeaderandFooter").remove(), a(".assnatFARSautApres, .assnatFARSautAvant, .assnatFARSautPageNiv0, .assnatFARSautPageNiv1, .assnatFARSautPageNiv1PG").remove(), a(".assnatFARTT08Bleu").each((e, t) => {
|
|
21608
21640
|
let n = a(t).closest("table");
|
|
21609
21641
|
n.length > 0 && n.remove();
|
|
@@ -21628,7 +21660,7 @@ function Ti(e, t = {}) {
|
|
|
21628
21660
|
if (i.length !== 0 && !(n.parents("del").length > 0 || n.find("del img").length > 0) && !(i.parent("del").length > 0)) {
|
|
21629
21661
|
let e = i.attr();
|
|
21630
21662
|
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")) {
|
|
21631
|
-
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ?
|
|
21663
|
+
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? xi(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
|
|
21632
21664
|
n.replaceWith(`<span class="alinea"${i}></span>`);
|
|
21633
21665
|
return;
|
|
21634
21666
|
}
|
|
@@ -21647,7 +21679,7 @@ function Ti(e, t = {}) {
|
|
|
21647
21679
|
(!r || r === "\xA0") && n.remove();
|
|
21648
21680
|
}), a("span[style*=\"display:block\"][style*=\"position:absolute\"]:not(.alinea)").remove(), a("del").remove();
|
|
21649
21681
|
function o(e) {
|
|
21650
|
-
let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i =
|
|
21682
|
+
let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = Si(n) || r === "b" || r === "strong", o = Ci(n) || r === "i" || r === "em", s = wi(n) || r === "sup", c = Ti(n) || r === "sub", l = t.attr("class") || "";
|
|
21651
21683
|
return /bold/i.test(l) && (i = !0), /strongemphasis/i.test(l) ? i = !0 : /italic|emphasis/i.test(l) && (o = !0), {
|
|
21652
21684
|
bold: i,
|
|
21653
21685
|
italic: o,
|
|
@@ -21681,7 +21713,7 @@ function Ti(e, t = {}) {
|
|
|
21681
21713
|
c = e;
|
|
21682
21714
|
}
|
|
21683
21715
|
for (a("p").each((e, t) => {
|
|
21684
|
-
let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s =
|
|
21716
|
+
let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s = ki(i);
|
|
21685
21717
|
if (i.includes("assnatFARCouvTitreD")) {
|
|
21686
21718
|
let e = r.html() || "";
|
|
21687
21719
|
r.replaceWith(`<p class="cover-subtitle">${e}</p>`);
|
|
@@ -21714,11 +21746,11 @@ function Ti(e, t = {}) {
|
|
|
21714
21746
|
let c = r.text().trim().startsWith("«");
|
|
21715
21747
|
if (s && !c) {
|
|
21716
21748
|
let e = a(`<h${s}>${r.html() || ""}</h${s}>`);
|
|
21717
|
-
n &&
|
|
21749
|
+
n && Di(o, i) && e.attr("align", "center"), r.replaceWith(e);
|
|
21718
21750
|
} else {
|
|
21719
|
-
let e =
|
|
21751
|
+
let e = bi(i), t;
|
|
21720
21752
|
if (n) {
|
|
21721
|
-
let n =
|
|
21753
|
+
let n = Oi(o);
|
|
21722
21754
|
n && n !== "justify" && n !== "left" ? t = n : e?.align && (t = e.align);
|
|
21723
21755
|
}
|
|
21724
21756
|
if (r.removeAttr("style").removeAttr("class"), t && r.attr("align", t), e?.bold) {
|
|
@@ -21728,7 +21760,7 @@ function Ti(e, t = {}) {
|
|
|
21728
21760
|
}
|
|
21729
21761
|
}), a("h1, h2, h3, h4, h5, h6").each((e, t) => {
|
|
21730
21762
|
let r = a(t), i = r.attr("style"), o = r.attr("class");
|
|
21731
|
-
n &&
|
|
21763
|
+
n && Di(i, o) ? (r.removeAttr("style").removeAttr("class"), r.attr("align", "center")) : r.removeAttr("style").removeAttr("class");
|
|
21732
21764
|
}), a("a").each((e, t) => {
|
|
21733
21765
|
let n = a(t), r = n.attr("href"), i = n.attr("id"), o = { ...t.attribs || {} };
|
|
21734
21766
|
for (let e of Object.keys(o)) e !== "href" && e !== "id" && n.removeAttr(e);
|
|
@@ -21767,7 +21799,7 @@ function Ti(e, t = {}) {
|
|
|
21767
21799
|
}), a("br").each((e, t) => {
|
|
21768
21800
|
a(t).removeAttr("style").removeAttr("class");
|
|
21769
21801
|
}), a("table, tr, td, th, thead, tbody, tfoot").each((e, t) => {
|
|
21770
|
-
let n = a(t), r =
|
|
21802
|
+
let n = a(t), r = Ei(n.attr("style"));
|
|
21771
21803
|
n.removeAttr("style").removeAttr("class"), r && n.attr("style", r);
|
|
21772
21804
|
}), a("td, th").each((e, t) => {
|
|
21773
21805
|
let n = a(t), r = n.children();
|
|
@@ -21785,17 +21817,17 @@ function Ti(e, t = {}) {
|
|
|
21785
21817
|
!isNaN(e) && e > 1 && n.attr("style", `counter-reset: list-counter ${e - 1}`), n.attr("start", r);
|
|
21786
21818
|
}
|
|
21787
21819
|
}), a("li").each((e, t) => {
|
|
21788
|
-
let n = a(t), r =
|
|
21820
|
+
let n = a(t), r = Oi(n.attr("style"));
|
|
21789
21821
|
n.removeAttr("style").removeAttr("class"), r === "center" && n.attr("style", "text-align: center");
|
|
21790
21822
|
let i = n.html() || "", o = i.replace(/^(\s| | |\u00a0)+/, "");
|
|
21791
21823
|
o !== i && n.html(o);
|
|
21792
|
-
}),
|
|
21824
|
+
}), ji(a), Mi(a, i);
|
|
21793
21825
|
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 = "";
|
|
21794
|
-
m && (h +=
|
|
21826
|
+
m && (h += vi), f && (h += hi), p && (h += gi), u && (h += mi), d && (h += _i);
|
|
21795
21827
|
let g = h ? `<style>${h}</style>\n${l}` : l;
|
|
21796
|
-
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 =
|
|
21828
|
+
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 = Ni(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;
|
|
21797
21829
|
}
|
|
21798
|
-
function
|
|
21830
|
+
function ji(e) {
|
|
21799
21831
|
e("span[id]").each((t, n) => {
|
|
21800
21832
|
let r = e(n), i = r.attr("id"), a = n.attribs || {}, o = Object.keys(a);
|
|
21801
21833
|
if (o.length !== 1 || o[0] !== "id") return;
|
|
@@ -21818,13 +21850,13 @@ function Ei(e) {
|
|
|
21818
21850
|
l.trim() === u.trim() && (s.attr("id", i), r.replaceWith(r.html() || ""));
|
|
21819
21851
|
});
|
|
21820
21852
|
}
|
|
21821
|
-
function
|
|
21853
|
+
function Mi(e, t = !1) {
|
|
21822
21854
|
let n = e("body");
|
|
21823
21855
|
if (n.length === 0) return;
|
|
21824
21856
|
let r = n.find("span.alinea[data-image-hash]"), i = -1;
|
|
21825
21857
|
r.each((n, r) => {
|
|
21826
21858
|
let a = e(r), o = a.attr("data-image-hash"), s;
|
|
21827
|
-
if (o &&
|
|
21859
|
+
if (o && pi[o] !== void 0 && (s = pi[o]), s === void 0) {
|
|
21828
21860
|
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".`);
|
|
21829
21861
|
a.remove();
|
|
21830
21862
|
return;
|
|
@@ -21836,11 +21868,11 @@ function Di(e, t = !1) {
|
|
|
21836
21868
|
i = s, a.attr("data-alinea", String(s)), a.text(String(s)), a.removeAttr("data-image-hash");
|
|
21837
21869
|
});
|
|
21838
21870
|
}
|
|
21839
|
-
function
|
|
21871
|
+
function Ni(e) {
|
|
21840
21872
|
let t = e;
|
|
21841
21873
|
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;
|
|
21842
21874
|
}
|
|
21843
|
-
function
|
|
21875
|
+
function Pi(e, t = {}) {
|
|
21844
21876
|
return `<!DOCTYPE html>
|
|
21845
21877
|
<html lang="fr">
|
|
21846
21878
|
<head>
|
|
@@ -21848,33 +21880,33 @@ function ki(e, t = {}) {
|
|
|
21848
21880
|
<title>Document simplifié</title>
|
|
21849
21881
|
</head>
|
|
21850
21882
|
<body>
|
|
21851
|
-
${
|
|
21883
|
+
${Ai(e, t)}
|
|
21852
21884
|
</body>
|
|
21853
21885
|
</html>`;
|
|
21854
21886
|
}
|
|
21855
21887
|
//#endregion
|
|
21856
21888
|
//#region src/lib/server/text_parsers/transformers.ts
|
|
21857
|
-
function
|
|
21889
|
+
function Fi(e, t) {
|
|
21858
21890
|
let n = "transformation_", r = {};
|
|
21859
|
-
for (let e of
|
|
21891
|
+
for (let e of M.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
|
|
21860
21892
|
let i = e.slice(15, -5), a = i.split(".").map((e) => parseInt(e) - 1), o = r;
|
|
21861
21893
|
for (let e of a.slice(1)) {
|
|
21862
21894
|
let t = o.transformations ??= [];
|
|
21863
21895
|
for (; e >= t.length;) t.push({});
|
|
21864
21896
|
o = t[e];
|
|
21865
21897
|
}
|
|
21866
|
-
o.output =
|
|
21867
|
-
let { sourceMap: s, title: c } =
|
|
21898
|
+
o.output = M.readFileSync(De.join(t, `${n}${i}.html`), { encoding: "utf-8" });
|
|
21899
|
+
let { sourceMap: s, title: c } = M.readJsonSync(De.join(t, e), { encoding: "utf-8" });
|
|
21868
21900
|
o.sourceMap = s ?? [], o.title = c;
|
|
21869
21901
|
}
|
|
21870
|
-
return
|
|
21902
|
+
return Ii(r, e), r;
|
|
21871
21903
|
}
|
|
21872
|
-
function
|
|
21873
|
-
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations)
|
|
21904
|
+
function Ii(e, t) {
|
|
21905
|
+
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) Ii(n, t), t = n.output;
|
|
21874
21906
|
return t;
|
|
21875
21907
|
}
|
|
21876
|
-
function
|
|
21877
|
-
if (
|
|
21908
|
+
function Li(e, t, n = "1") {
|
|
21909
|
+
if (M.ensureDirSync(t), e.transformations === void 0) M.writeJsonSync(De.join(t, `transformation_${n}.json`), {
|
|
21878
21910
|
sourceMap: e.sourceMap,
|
|
21879
21911
|
title: e.title
|
|
21880
21912
|
}, {
|
|
@@ -21882,24 +21914,24 @@ function Mi(e, t, n = "1") {
|
|
|
21882
21914
|
spaces: 2
|
|
21883
21915
|
});
|
|
21884
21916
|
else {
|
|
21885
|
-
|
|
21917
|
+
M.writeJsonSync(De.join(t, `transformation_${n}.json`), { title: e.title }, {
|
|
21886
21918
|
encoding: "utf-8",
|
|
21887
21919
|
spaces: 2
|
|
21888
21920
|
});
|
|
21889
|
-
for (let [r, i] of e.transformations.entries())
|
|
21921
|
+
for (let [r, i] of e.transformations.entries()) Li(i, t, `${n}.${r + 1}`);
|
|
21890
21922
|
}
|
|
21891
|
-
e.output !== void 0 &&
|
|
21923
|
+
e.output !== void 0 && M.writeFileSync(De.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
|
|
21892
21924
|
}
|
|
21893
21925
|
//#endregion
|
|
21894
21926
|
//#region src/lib/server/linkers/html.ts
|
|
21895
|
-
async function
|
|
21896
|
-
let _ = t ?? (e === void 0 ? void 0 : new
|
|
21927
|
+
async function Ri({ 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 }) {
|
|
21928
|
+
let _ = t ?? (e === void 0 ? void 0 : new ie(e));
|
|
21897
21929
|
if (_ === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
21898
|
-
let v = await
|
|
21899
|
-
a === void 0 ? (y =
|
|
21930
|
+
let v = await M.readFile(i, { encoding: "utf-8" }), y;
|
|
21931
|
+
a === void 0 ? (y = he({ removeAWithHref: !0 })(v), o !== void 0 && Li(y, o)) : y = Fi(v, a);
|
|
21900
21932
|
let b = [];
|
|
21901
21933
|
s !== void 0 && b.push("links"), c !== void 0 && b.push("links_or_references"), u !== void 0 && b.push("references");
|
|
21902
|
-
let { outputByType: x, referredLegifranceTextCountByCid:
|
|
21934
|
+
let { outputByType: x, referredLegifranceTextCountByCid: S } = await oe({
|
|
21903
21935
|
legiResolver: _,
|
|
21904
21936
|
date: n,
|
|
21905
21937
|
defaultTextId: r,
|
|
@@ -21912,42 +21944,42 @@ async function Ni({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
21912
21944
|
logReferences: h,
|
|
21913
21945
|
outputTypes: b,
|
|
21914
21946
|
referredLegifranceTextsInfos: g !== void 0
|
|
21915
|
-
}),
|
|
21916
|
-
s !== void 0 && (
|
|
21947
|
+
}), C = {};
|
|
21948
|
+
s !== void 0 && (C.links = s), c !== void 0 && (C.links_or_references = c), u !== void 0 && (C.references = u);
|
|
21917
21949
|
for (let [e, t] of Object.entries(x)) {
|
|
21918
|
-
let n =
|
|
21919
|
-
n !== void 0 && await
|
|
21950
|
+
let n = C[e];
|
|
21951
|
+
n !== void 0 && await M.writeFile(n, t.html, { encoding: "utf-8" });
|
|
21920
21952
|
}
|
|
21921
|
-
x.links !== void 0 && l !== void 0 &&
|
|
21953
|
+
x.links !== void 0 && l !== void 0 && Li(he()(x.links.html), l), g !== void 0 && await M.writeJson(g, S, {
|
|
21922
21954
|
encoding: "utf-8",
|
|
21923
21955
|
spaces: 2
|
|
21924
21956
|
});
|
|
21925
21957
|
}
|
|
21926
21958
|
//#endregion
|
|
21927
21959
|
//#region src/lib/server/tables_of_contents.ts
|
|
21928
|
-
async function
|
|
21929
|
-
let i =
|
|
21930
|
-
for await (let e of
|
|
21960
|
+
async function zi(e, t, n, r) {
|
|
21961
|
+
let i = Fi(await M.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new k(a), s = await M.readJson(n, { encoding: "utf-8" });
|
|
21962
|
+
for await (let e of ae({
|
|
21931
21963
|
context: o,
|
|
21932
21964
|
tableOfContents: s,
|
|
21933
21965
|
transformation: i
|
|
21934
21966
|
}));
|
|
21935
|
-
await
|
|
21967
|
+
await M.writeJson(r, s, {
|
|
21936
21968
|
encoding: "utf-8",
|
|
21937
21969
|
spaces: 2
|
|
21938
21970
|
});
|
|
21939
21971
|
}
|
|
21940
|
-
async function
|
|
21941
|
-
let r =
|
|
21942
|
-
await
|
|
21972
|
+
async function Bi(e, t, n) {
|
|
21973
|
+
let r = Fi(await M.readFile(e, { encoding: "utf-8" }), t).output, i = y(r);
|
|
21974
|
+
await M.writeJson(n, i, {
|
|
21943
21975
|
encoding: "utf-8",
|
|
21944
21976
|
spaces: 2
|
|
21945
21977
|
});
|
|
21946
21978
|
}
|
|
21947
21979
|
//#endregion
|
|
21948
21980
|
//#region src/lib/server/legi/resolvers.ts
|
|
21949
|
-
function
|
|
21950
|
-
return new
|
|
21981
|
+
function Vi({ canutesDb: e }) {
|
|
21982
|
+
return new ie(e);
|
|
21951
21983
|
}
|
|
21952
21984
|
//#endregion
|
|
21953
|
-
export { we as LegiResolver,
|
|
21985
|
+
export { we as LegiResolver, Ri as addLinksOrReferencesToHtmlFile, zi as addPositionsToTableOfContentsFile, xe as buildAndInstallTextTitlesInfos, Ce as buildTextTitlesInfos, Vi as createLegiResolver, je as extractAssembleeAmendmentSearchItems, Zn as extractAssembleeExposesDesMotifs, nr as extractSenatAmendmentSearchItems, Me as hashAssembleeAmendmentSearchItem, $n as hashAssembleeSearchItem, rr as hashSenatAmendmentSearchItem, oi as hashSenatSearchItem, fi as isAkomaNtosoXml, er as isoDateFromAssembleeDocument, qn as linkAkomaNtosoBillRaw, nn as linkAssembleeBillRaw, Kn as parseAkomaNtosoBillRaw, ni as parseAmendment, tn as parseAssembleeBillRaw, Qn as parseAssembleeDocumentSearchContent, ai as parseSenatDocumentSearchContent, Fi as readTransformation, Hn as renderAkomaNtosoBillRaw, di as resolveSenatAkomaNtosoSource, Bi as simplifiedHtmlBillFileToTableOfContentsFile, Ai as simplifyWordHtml, Pi as simplifyWordHtmlToDocument, Li as writeTransformation };
|