@tricoteuses/tisseuse 0.18.0 → 0.19.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/{html-B0V8X0v6.js → html-EuDDYMr2.js} +5156 -5098
- package/dist/index.js +116 -116
- package/dist/{resolver-cn-qJE70.js → resolver-tBQRf8TL.js} +332 -307
- package/dist/server-f-legi.js +18 -12
- package/dist/server.js +343 -343
- package/dist/src/lib/assemblee_document_date.d.ts +5 -0
- package/dist/src/lib/assemblee_document_date.test.d.ts +1 -0
- package/dist/src/lib/extractors/links.code_titles.test.d.ts +1 -0
- package/dist/src/lib/index.d.ts +1 -0
- package/dist/src/lib/legi/text_titles_infos.d.ts +7 -1
- package/dist/src/lib/text_parsers/action_words.d.ts +1 -1
- package/dist/src/lib/text_parsers/articles.d.ts +16 -21
- package/dist/src/lib/text_parsers/ast.d.ts +2 -0
- package/dist/src/lib/text_parsers/texts.d.ts +2 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $ as e,
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
4
|
-
import { createHash as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { $ as e, At as t, B as n, Bt as r, C as i, Ct as a, D as o, Dt as s, E as c, H as l, L as u, M as d, N as f, Nt as p, O as m, Ot as h, S as g, Vt as _, X as v, b as y, c as b, ct as x, et as ee, g as S, h as te, it as ne, j as C, k as re, kt as w, m as ie, n as ae, p as oe, s as se, t as ce, u as le, ut as T, v as ue, w as de, x as fe } from "./html-EuDDYMr2.js";
|
|
2
|
+
import { A as pe, Dt as E, Ft as D, I as me, L as he, Nt as O, Ot as k, P as ge, _t as _e, bt as A, jt as ve, k as ye, kt as j, n as be, nt as xe, o as Se, r as Ce, t as we, ut as Te } from "./resolver-tBQRf8TL.js";
|
|
3
|
+
import * as Ee from "node:crypto";
|
|
4
|
+
import { createHash as De } from "node:crypto";
|
|
5
|
+
import M from "fs-extra";
|
|
6
|
+
import Oe from "node:path";
|
|
7
7
|
//#region src/lib/server/assemblee_amendment_search.ts
|
|
8
8
|
function ke(e, t) {
|
|
9
9
|
let n = e;
|
|
@@ -17,7 +17,7 @@ function Ae(e) {
|
|
|
17
17
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
18
18
|
}
|
|
19
19
|
function je(e) {
|
|
20
|
-
return Ae(
|
|
20
|
+
return Ae(T(e).text());
|
|
21
21
|
}
|
|
22
22
|
function Me(e) {
|
|
23
23
|
let t = Ae([
|
|
@@ -52,7 +52,7 @@ function Me(e) {
|
|
|
52
52
|
}] : []];
|
|
53
53
|
}
|
|
54
54
|
function Ne(e, t) {
|
|
55
|
-
return
|
|
55
|
+
return De("sha256").update(JSON.stringify({
|
|
56
56
|
item: e,
|
|
57
57
|
metadata: t
|
|
58
58
|
})).digest("hex");
|
|
@@ -64,7 +64,7 @@ function N(e) {
|
|
|
64
64
|
case "reference_et_action": return N(e.reference);
|
|
65
65
|
case "enumeration": return [...N(e.left), ...N(e.right)];
|
|
66
66
|
case "parent-enfant": {
|
|
67
|
-
let t = [...
|
|
67
|
+
let t = [...r(e.parent)].filter((e) => e.type === "article");
|
|
68
68
|
return t.length === 1 ? [{
|
|
69
69
|
article: t[0],
|
|
70
70
|
reference: e
|
|
@@ -91,9 +91,9 @@ function N(e) {
|
|
|
91
91
|
//#region src/lib/extractors/article_action_effects.ts
|
|
92
92
|
function Pe(e, t) {
|
|
93
93
|
if (t < 2) return null;
|
|
94
|
-
let n =
|
|
94
|
+
let n = pe(e), r = S(e);
|
|
95
95
|
if (r.length !== t) return null;
|
|
96
|
-
let i =
|
|
96
|
+
let i = u(new E(n.output)), a = (e) => he(n, [e])[0].position;
|
|
97
97
|
return r.map((t, n) => ({
|
|
98
98
|
sourceText: e,
|
|
99
99
|
referencePosition: a({
|
|
@@ -105,22 +105,22 @@ function Pe(e, t) {
|
|
|
105
105
|
}
|
|
106
106
|
function Fe(e, t, n) {
|
|
107
107
|
if (t.length < 2) return null;
|
|
108
|
-
let r =
|
|
108
|
+
let r = pe(e), i = r.output, a = (e) => he(r, [e])[0].position, o = u(new E(i)), s = o.flatMap(N);
|
|
109
109
|
if (s.length !== t.length || s.length < 2) return null;
|
|
110
|
-
let
|
|
111
|
-
if (
|
|
110
|
+
let c = fe(i);
|
|
111
|
+
if (c.length > 0) return n?.kind !== "replace_portion" || c.length !== s.length || c.some((e, t) => {
|
|
112
112
|
let n = s[t];
|
|
113
|
-
return n.article.num !== e.article.num || n.article.position.start !== e.article.position.start || n.article.position.stop !== e.article.position.stop || !
|
|
113
|
+
return n.article.num !== e.article.num || n.article.position.start !== e.article.position.start || n.article.position.stop !== e.article.position.stop || !ne(n.reference).some((t) => t.kind === "single" && t.steps.some((t) => t.type === "alinéa" && t.index === e.alineaIndex));
|
|
114
114
|
}) ? null : s.map((r, i) => ({
|
|
115
115
|
targetId: t[i],
|
|
116
116
|
directive: {
|
|
117
117
|
...n,
|
|
118
118
|
reference: r.reference,
|
|
119
|
-
portionSelectors:
|
|
119
|
+
portionSelectors: ne(r.reference),
|
|
120
120
|
tableTarget: {
|
|
121
121
|
type: "table",
|
|
122
|
-
rowIndex:
|
|
123
|
-
rowEndIndex:
|
|
122
|
+
rowIndex: c[i].rowIndex,
|
|
123
|
+
rowEndIndex: c[i].rowEndIndex
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
126
|
sourceAnnotation: {
|
|
@@ -132,11 +132,11 @@ function Fe(e, t, n) {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
}));
|
|
135
|
-
let
|
|
136
|
-
if (
|
|
137
|
-
let n = s.filter((e) => !
|
|
135
|
+
let l = s.filter(({ reference: e }) => e.type === "parent-enfant" && e.parent.type === "texte" && e.parent.nature !== "CODE");
|
|
136
|
+
if (l.length > 0 && l.length < s.length) {
|
|
137
|
+
let n = s.filter((e) => !l.includes(e));
|
|
138
138
|
if (n.length !== 1) return null;
|
|
139
|
-
let r = n[0], o = t[s.indexOf(r)], c =
|
|
139
|
+
let r = n[0], o = t[s.indexOf(r)], c = y(i);
|
|
140
140
|
return !o || c.length !== 1 || c[0].kind === "compound" ? null : [{
|
|
141
141
|
targetId: o,
|
|
142
142
|
sourceAnnotation: {
|
|
@@ -161,7 +161,7 @@ function Fe(e, t, n) {
|
|
|
161
161
|
let d = [], f = 0;
|
|
162
162
|
for (let e = 1; e < o.length; e += 1) {
|
|
163
163
|
let t = o[e];
|
|
164
|
-
t.type !== "reference_et_action" || N(t).length === 0 || o.slice(f, e).flatMap(N).length === 0 ||
|
|
164
|
+
t.type !== "reference_et_action" || N(t).length === 0 || o.slice(f, e).flatMap(N).length === 0 || y(i.slice(f === 0 ? 0 : o[f].position.start, t.position.start)).length === 1 && y(i.slice(t.position.start)).length === 1 && (d.push(e - 1), f = e);
|
|
165
165
|
}
|
|
166
166
|
d.push(o.length - 1);
|
|
167
167
|
let p = [], m = 0, h = 0;
|
|
@@ -171,7 +171,7 @@ function Fe(e, t, n) {
|
|
|
171
171
|
m = n + 1;
|
|
172
172
|
continue;
|
|
173
173
|
}
|
|
174
|
-
let s = m === 0 ? 0 : o[m].position.start, c = o[n + 1]?.position.start ?? i.length, l =
|
|
174
|
+
let s = m === 0 ? 0 : o[m].position.start, c = o[n + 1]?.position.start ?? i.length, l = y(i.slice(s, c));
|
|
175
175
|
if (l.length !== 1 || l[0].kind === "compound") return null;
|
|
176
176
|
let u = l[0];
|
|
177
177
|
for (let n of r) {
|
|
@@ -195,7 +195,7 @@ function Fe(e, t, n) {
|
|
|
195
195
|
stop: i.length
|
|
196
196
|
},
|
|
197
197
|
reference: n.reference,
|
|
198
|
-
portionSelectors:
|
|
198
|
+
portionSelectors: ne(n.reference)
|
|
199
199
|
}
|
|
200
200
|
});
|
|
201
201
|
}
|
|
@@ -203,20 +203,20 @@ function Fe(e, t, n) {
|
|
|
203
203
|
}
|
|
204
204
|
return h === t.length ? p : null;
|
|
205
205
|
}
|
|
206
|
-
var Ie =
|
|
206
|
+
var Ie = ve("dans sa rédaction", j([j([D("dans sa rédaction ", { flags: "i" }), k(D("issue ", { flags: "i" }), D("résultante ", { flags: "i" }), D("résultant ", { flags: "i" }))], { value: "qualified-version-redaction" }), k(j([D("de l'", { flags: "i" }), l], { value: (e) => e[1] }), n)], { value: (e) => e[1] }));
|
|
207
207
|
//#endregion
|
|
208
208
|
//#region src/lib/extractors/qualified_versions.ts
|
|
209
209
|
function Le(e) {
|
|
210
|
-
let t =
|
|
211
|
-
for (let e of Ie.extract(new E(t.output), { jumpExact: !0 })) for (let i of
|
|
210
|
+
let t = pe(e), n = [];
|
|
211
|
+
for (let e of Ie.extract(new E(t.output), { jumpExact: !0 })) for (let i of _(e)) {
|
|
212
212
|
if (i.type !== "parent-enfant" || i.parent.type !== "texte" || i.parent.nature !== "LOI") continue;
|
|
213
|
-
let e = [...
|
|
213
|
+
let e = [...r(i.child)].filter((e) => e.type === "article" && e.position.start < i.parent.position.start);
|
|
214
214
|
if (e.length === 1) {
|
|
215
|
-
|
|
215
|
+
n.push(he(t, [e[0].position])[0].position);
|
|
216
216
|
break;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
return
|
|
219
|
+
return n;
|
|
220
220
|
}
|
|
221
221
|
//#endregion
|
|
222
222
|
//#region src/lib/server/parsed_bills.ts
|
|
@@ -262,10 +262,10 @@ function Ue(e) {
|
|
|
262
262
|
}
|
|
263
263
|
function We(e) {
|
|
264
264
|
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);
|
|
265
|
-
if (n?.[1] !== void 0) return
|
|
265
|
+
if (n?.[1] !== void 0) return h(n[1]);
|
|
266
266
|
}
|
|
267
267
|
function Ge(e) {
|
|
268
|
-
let t = Ue(e), n =
|
|
268
|
+
let t = Ue(e), n = a(t ?? "");
|
|
269
269
|
if (n.length > 0 && t !== void 0) return n.map((e, r) => {
|
|
270
270
|
let i = e.start, a = n[r + 1]?.start ?? t.length, o = t.slice(i, a).trim();
|
|
271
271
|
return {
|
|
@@ -299,7 +299,7 @@ function Je(e) {
|
|
|
299
299
|
return P(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
|
|
300
300
|
}
|
|
301
301
|
function Ye(e, t) {
|
|
302
|
-
let n = new E(e, t), r =
|
|
302
|
+
let n = new E(e, t), r = xe(n);
|
|
303
303
|
return typeof r != "string" || n.offset <= t ? null : {
|
|
304
304
|
date: r,
|
|
305
305
|
start: t,
|
|
@@ -384,12 +384,12 @@ function it(e, t) {
|
|
|
384
384
|
}
|
|
385
385
|
function at(e) {
|
|
386
386
|
let t = F(e);
|
|
387
|
-
return !t || Re.test(t) ? "noise" :
|
|
387
|
+
return !t || Re.test(t) ? "noise" : m.test(e) ? "directive_candidate" : "context";
|
|
388
388
|
}
|
|
389
389
|
async function ot(e, t, n) {
|
|
390
390
|
if (n === void 0) throw Error("A document date is required to add links to legal references.");
|
|
391
391
|
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.");
|
|
392
|
-
let r = t.legiResolver ?? new
|
|
392
|
+
let r = t.legiResolver ?? new oe(t.canutesDb), { output: i } = await ae({
|
|
393
393
|
date: n,
|
|
394
394
|
html: e,
|
|
395
395
|
includeInternalArticleLinks: t.includeInternalArticleLinks,
|
|
@@ -418,20 +418,20 @@ function ct(e, t, n, r) {
|
|
|
418
418
|
container: r.container
|
|
419
419
|
}));
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function R(e) {
|
|
422
422
|
let t = /* @__PURE__ */ new Map();
|
|
423
423
|
return e("body *").each((e, n) => {
|
|
424
424
|
t.set(n, e);
|
|
425
425
|
}), t;
|
|
426
426
|
}
|
|
427
|
-
function
|
|
427
|
+
function z(e, t) {
|
|
428
428
|
return e.get(t) ?? 2 ** 53 - 1;
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function lt(e) {
|
|
431
431
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
432
432
|
e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
|
|
433
433
|
if (Be(e, a)) return;
|
|
434
|
-
let o =
|
|
434
|
+
let o = w(P(e(a).text()));
|
|
435
435
|
if (!o) return;
|
|
436
436
|
let s = e(a).attr("id");
|
|
437
437
|
if (!s || r.has(s)) return;
|
|
@@ -444,28 +444,28 @@ function ut(e) {
|
|
|
444
444
|
});
|
|
445
445
|
}), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((i, a) => {
|
|
446
446
|
if (n.has(a)) return;
|
|
447
|
-
let o =
|
|
447
|
+
let o = w(P(e(a).text()));
|
|
448
448
|
o && ct(t, n, r, {
|
|
449
449
|
...o,
|
|
450
450
|
element: a,
|
|
451
451
|
container: a
|
|
452
452
|
});
|
|
453
453
|
});
|
|
454
|
-
let i =
|
|
455
|
-
return t.sort((e, t) =>
|
|
454
|
+
let i = R(e);
|
|
455
|
+
return t.sort((e, t) => z(i, e.container) - z(i, t.container)), t;
|
|
456
456
|
}
|
|
457
|
-
function
|
|
457
|
+
function ut(e, t) {
|
|
458
458
|
if (Be(e, t)) return !1;
|
|
459
459
|
let n = t.tagName?.toLowerCase();
|
|
460
460
|
if (n !== "p") return /^h[1-6]$/u.test(n ?? "");
|
|
461
461
|
let r = e(t).attr("style") ?? "", i = e(t).html() ?? "";
|
|
462
462
|
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));
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function dt(e) {
|
|
465
465
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
466
466
|
return e("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6,p").each((i, a) => {
|
|
467
|
-
if (Be(e, a) || !e(a).hasClass("assnat9ArticleNum") && !
|
|
468
|
-
let o =
|
|
467
|
+
if (Be(e, a) || !e(a).hasClass("assnat9ArticleNum") && !ut(e, a)) return;
|
|
468
|
+
let o = w(e(a).text());
|
|
469
469
|
o && ct(t, n, r, {
|
|
470
470
|
...o,
|
|
471
471
|
element: a,
|
|
@@ -473,7 +473,7 @@ function ft(e) {
|
|
|
473
473
|
});
|
|
474
474
|
}), t;
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function ft(e) {
|
|
477
477
|
let t = ze(e ?? "").replace(/[()]/gu, "").trim();
|
|
478
478
|
if (!t || t.toLowerCase() === "liminaire") return;
|
|
479
479
|
if (t.toLowerCase() === "unique") return {
|
|
@@ -483,7 +483,7 @@ function pt(e) {
|
|
|
483
483
|
};
|
|
484
484
|
let n = /^(\d+|premier)(?:\s+([a-z]+))?(?:\s+([A-Z]+))?$/u.exec(t);
|
|
485
485
|
if (!n) return;
|
|
486
|
-
let r = n[1] === "premier" ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 :
|
|
486
|
+
let r = n[1] === "premier" ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 : mt(i);
|
|
487
487
|
if (a !== void 0) return {
|
|
488
488
|
base: r,
|
|
489
489
|
suffixOrder: a,
|
|
@@ -491,7 +491,7 @@ function pt(e) {
|
|
|
491
491
|
text: t
|
|
492
492
|
};
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function pt(e, t) {
|
|
495
495
|
if (t.base !== e.base) return t.base - e.base;
|
|
496
496
|
if (t.suffixOrder !== e.suffixOrder) return t.suffixOrder - e.suffixOrder;
|
|
497
497
|
for (let n = 0; n <= Math.max(e.letters?.length ?? 0, t.letters?.length ?? 0); n++) {
|
|
@@ -500,14 +500,14 @@ function mt(e, t) {
|
|
|
500
500
|
}
|
|
501
501
|
return 0;
|
|
502
502
|
}
|
|
503
|
-
function
|
|
504
|
-
let t = new E(e), n =
|
|
503
|
+
function mt(e) {
|
|
504
|
+
let t = new E(e), n = Te(t);
|
|
505
505
|
if (!(n === void 0 || t.offset !== e.length) && !(typeof n != "object" || !n || !("value" in n) || typeof n.value != "number")) return n.value - 1;
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function ht(e) {
|
|
508
508
|
let t = [], n = e.map((e) => ({
|
|
509
509
|
heading: e,
|
|
510
|
-
token:
|
|
510
|
+
token: ft(e.num)
|
|
511
511
|
}));
|
|
512
512
|
n.filter(({ token: e }) => e?.text === "unique").length > 0 && e.length > 1 && t.push({
|
|
513
513
|
code: "article_toc_out_of_order",
|
|
@@ -516,7 +516,7 @@ function gt(e) {
|
|
|
516
516
|
let r;
|
|
517
517
|
for (let { heading: e, token: i } of n) if (!(i === void 0 || i.text === "unique")) {
|
|
518
518
|
if (r !== void 0) {
|
|
519
|
-
let n =
|
|
519
|
+
let n = pt(r, i);
|
|
520
520
|
n === 0 ? t.push({
|
|
521
521
|
code: "article_toc_duplicate_number",
|
|
522
522
|
message: `Article ${e.num ?? e.label} is repeated`,
|
|
@@ -545,24 +545,24 @@ function gt(e) {
|
|
|
545
545
|
}
|
|
546
546
|
return t;
|
|
547
547
|
}
|
|
548
|
-
function
|
|
549
|
-
let t =
|
|
548
|
+
function gt(e) {
|
|
549
|
+
let t = ht(e);
|
|
550
550
|
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) });
|
|
551
551
|
}
|
|
552
|
-
function
|
|
553
|
-
let n =
|
|
554
|
-
if (n.length === 0) return t &&
|
|
555
|
-
let i =
|
|
552
|
+
function _t(e, { warn: t = !0 } = {}) {
|
|
553
|
+
let n = lt(e), r = dt(e);
|
|
554
|
+
if (n.length === 0) return t && gt(r), r;
|
|
555
|
+
let i = R(e), a = (e, t) => {
|
|
556
556
|
let n = new Set(e.map((e) => e.container)), r = new Set(e.map((e) => I(e.num ?? e.label)));
|
|
557
557
|
for (let i of t) {
|
|
558
558
|
let t = I(i.num ?? i.label);
|
|
559
559
|
n.has(i.container) || r.has(t) || (n.add(i.container), r.add(t), e.push(i));
|
|
560
560
|
}
|
|
561
|
-
return e.sort((e, t) =>
|
|
562
|
-
}, 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 &&
|
|
563
|
-
return t &&
|
|
561
|
+
return e.sort((e, t) => z(i, e.container) - z(i, t.container)), e;
|
|
562
|
+
}, 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 && ht(c).length > ht(s).length ? s : c;
|
|
563
|
+
return t && gt(l), l;
|
|
564
564
|
}
|
|
565
|
-
function
|
|
565
|
+
function vt(e) {
|
|
566
566
|
let t = e.next;
|
|
567
567
|
for (; t !== null;) {
|
|
568
568
|
if (L(t)) return t;
|
|
@@ -570,7 +570,7 @@ function yt(e) {
|
|
|
570
570
|
}
|
|
571
571
|
return null;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function yt(e, t, n) {
|
|
574
574
|
let r = e(t.container);
|
|
575
575
|
if (!r.is("p.assnat9ArticleNum")) return;
|
|
576
576
|
let i = r.parent(), a = i.parent();
|
|
@@ -580,25 +580,25 @@ function bt(e, t, n) {
|
|
|
580
580
|
let s = o.length === 4 ? o[2] : void 0;
|
|
581
581
|
if (s !== void 0 && (s.tagName !== "p" || !e(s).hasClass("assnat9ArticleNum") || !/^\(non modifié\)$/iu.test(P(e(s).text())))) return;
|
|
582
582
|
let c = o.at(-1);
|
|
583
|
-
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) =>
|
|
583
|
+
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) => w(e(t).text()) !== null))) return [
|
|
584
584
|
t.container,
|
|
585
585
|
...s === void 0 ? [] : [s],
|
|
586
586
|
c
|
|
587
587
|
];
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function bt(e, t, n, r = R(e)) {
|
|
590
590
|
let i = [t.container], a = n?.container;
|
|
591
|
-
for (let e =
|
|
591
|
+
for (let e = vt(t.container); e !== null && e !== a; e = vt(e)) i.push(e);
|
|
592
592
|
if (i.length > 1) return i;
|
|
593
|
-
let o =
|
|
593
|
+
let o = yt(e, t, n);
|
|
594
594
|
if (o !== void 0) return o;
|
|
595
|
-
let s =
|
|
595
|
+
let s = z(r, t.container), c = a ? z(r, a) : -1;
|
|
596
596
|
return e("body > *").get().filter((e) => {
|
|
597
|
-
let t =
|
|
597
|
+
let t = z(r, e);
|
|
598
598
|
return t >= s && (c === -1 || t < c);
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
|
-
function
|
|
601
|
+
function xt(e, t) {
|
|
602
602
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
603
603
|
for (let i of t) {
|
|
604
604
|
let t = "p,li,table", a = e(i).is(t) ? [i] : e(i).find(t).get();
|
|
@@ -606,10 +606,10 @@ function St(e, t) {
|
|
|
606
606
|
}
|
|
607
607
|
return n;
|
|
608
608
|
}
|
|
609
|
-
function
|
|
609
|
+
function St(e, t, n) {
|
|
610
610
|
let r = [], i = !1;
|
|
611
|
-
for (let a of
|
|
612
|
-
let n = e(a).is("table.akn-quoted-table") ?
|
|
611
|
+
for (let a of xt(e, n)) {
|
|
612
|
+
let n = e(a).is("table.akn-quoted-table") ? un(e, a) : P(e(a).text());
|
|
613
613
|
if (!n) continue;
|
|
614
614
|
Re.test(n) && (i = !0);
|
|
615
615
|
let o = i ? "noise" : at(n), s = `${t}-b${r.length + 1}`;
|
|
@@ -624,78 +624,78 @@ function Ct(e, t, n) {
|
|
|
624
624
|
}
|
|
625
625
|
return r;
|
|
626
626
|
}
|
|
627
|
-
function
|
|
627
|
+
function Ct(e, t) {
|
|
628
628
|
if (t.length === 0) return e;
|
|
629
629
|
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>`;
|
|
630
630
|
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}`;
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
let t =
|
|
634
|
-
for (let e of
|
|
632
|
+
function wt(e) {
|
|
633
|
+
let t = T(e), n = Tt(t);
|
|
634
|
+
for (let e of _t(t, { warn: !1 })) {
|
|
635
635
|
let r = I(e.num ?? e.label.replace(/^Article\s+/iu, "")), i = t(e.element), a = i.attr("id");
|
|
636
636
|
if (a !== r) {
|
|
637
|
-
if (a?.startsWith("_Toc") && !
|
|
637
|
+
if (a?.startsWith("_Toc") && !Dt(n, a, e.element)) {
|
|
638
638
|
let e = t("<span></span>").attr("id", a);
|
|
639
639
|
i.before(e);
|
|
640
640
|
let r = e.get(0);
|
|
641
|
-
L(r) &&
|
|
641
|
+
L(r) && B(n, a, r);
|
|
642
642
|
}
|
|
643
|
-
a &&
|
|
643
|
+
a && Et(n, a, e.element), i.attr("id", r), B(n, r, e.element);
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
|
-
let r =
|
|
646
|
+
let r = _t(t), i = R(t);
|
|
647
647
|
for (let [e, a] of r.entries()) {
|
|
648
|
-
let o =
|
|
648
|
+
let o = bt(t, a, r[e + 1], i).flatMap((e) => t(e).is("span.alinea[data-alinea]") ? [e] : t(e).find("span.alinea[data-alinea]").get());
|
|
649
649
|
for (let e of o) {
|
|
650
650
|
let r = t(e).attr("data-alinea")?.trim();
|
|
651
651
|
if (!r) continue;
|
|
652
652
|
let i = `${a.id}-alinea-${r.replace(/\s+/gu, "")}`;
|
|
653
|
-
if (
|
|
653
|
+
if (Dt(n, i, e)) continue;
|
|
654
654
|
let o = t(e).attr("id");
|
|
655
655
|
if (o && o !== i) {
|
|
656
656
|
let r = t("<span></span>").attr("id", i);
|
|
657
657
|
t(e).before(r);
|
|
658
658
|
let a = r.get(0);
|
|
659
|
-
L(a) &&
|
|
660
|
-
} else o &&
|
|
659
|
+
L(a) && B(n, i, a);
|
|
660
|
+
} else o && Et(n, o, e), t(e).attr("id", i), B(n, i, e);
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
663
|
return t.html();
|
|
664
664
|
}
|
|
665
|
-
function
|
|
665
|
+
function Tt(e) {
|
|
666
666
|
let t = /* @__PURE__ */ new Map();
|
|
667
667
|
for (let n of e("[id]").get()) {
|
|
668
668
|
let r = e(n).attr("id");
|
|
669
|
-
r &&
|
|
669
|
+
r && B(t, r, n);
|
|
670
670
|
}
|
|
671
671
|
return t;
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function B(e, t, n) {
|
|
674
674
|
let r = e.get(t);
|
|
675
675
|
r === void 0 && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function Et(e, t, n) {
|
|
678
678
|
let r = e.get(t);
|
|
679
679
|
r !== void 0 && (r.delete(n), r.size === 0 && e.delete(t));
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function Dt(e, t, n) {
|
|
682
682
|
for (let r of e.get(t) ?? []) if (r !== n) return !0;
|
|
683
683
|
return !1;
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function Ot(e, t) {
|
|
686
686
|
let n = $e("sourceText" in t ? t.sourceText : "");
|
|
687
687
|
if (n) return e.filter((e) => e.kind === "directive_candidate").find((e) => {
|
|
688
688
|
let t = $e(e.text);
|
|
689
689
|
return t.length > 0 && (n.includes(t) || t.includes(n));
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function kt(e, t) {
|
|
693
693
|
if (t) return t.blockIds.map((t) => e.get(t)).find((e) => e?.kind === "directive_candidate");
|
|
694
694
|
}
|
|
695
|
-
function
|
|
695
|
+
function At(e) {
|
|
696
696
|
return e?.links.filter((t) => !t.insideFrenchQuotes && (t.type === "article" || t.type === "division") && t.id !== e.qualifiedVersion?.modifyingArticleId).map((e) => e.id) ?? [];
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function jt(e) {
|
|
699
699
|
let t = Le(e.text);
|
|
700
700
|
if (t.length !== 1) return;
|
|
701
701
|
let n = e.links.filter((e) => e.type === "article" && !e.insideFrenchQuotes), r = n.filter((n) => {
|
|
@@ -710,21 +710,21 @@ function Mt(e) {
|
|
|
710
710
|
modifyingArticleLabel: i.text ?? ""
|
|
711
711
|
};
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function Mt(e, t) {
|
|
714
714
|
let n = P(e);
|
|
715
715
|
if (!n) return;
|
|
716
|
-
let r =
|
|
716
|
+
let r = x(n);
|
|
717
717
|
return r ? r.level : n.endsWith(":") ? (t ?? -1) + 1 : void 0;
|
|
718
718
|
}
|
|
719
|
-
function
|
|
720
|
-
let t = /* @__PURE__ */ new Map(), n = [], r =
|
|
719
|
+
function Nt(e) {
|
|
720
|
+
let t = /* @__PURE__ */ new Map(), n = [], r = ie(e.map((e) => e.text)), i = -1;
|
|
721
721
|
for (let [a, o] of e.entries()) {
|
|
722
722
|
let e = r.get(a);
|
|
723
723
|
if (e && (i = e.endIndex), a <= i) {
|
|
724
724
|
t.set(o.id, [...n.map((e) => e.block), o]);
|
|
725
725
|
continue;
|
|
726
726
|
}
|
|
727
|
-
let s =
|
|
727
|
+
let s = Mt(o.text, n.at(-1)?.level);
|
|
728
728
|
if (s === void 0) {
|
|
729
729
|
t.set(o.id, [...n.map((e) => e.block), o]);
|
|
730
730
|
continue;
|
|
@@ -737,14 +737,14 @@ function Pt(e) {
|
|
|
737
737
|
}
|
|
738
738
|
return t;
|
|
739
739
|
}
|
|
740
|
-
function
|
|
740
|
+
function Pt(e, t) {
|
|
741
741
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
742
742
|
for (let i of [...e ?? [], ...t]) i !== void 0 && (r.has(i.id) || (r.add(i.id), n.push(i)));
|
|
743
743
|
return n;
|
|
744
744
|
}
|
|
745
|
-
function
|
|
745
|
+
function Ft(e, t, n) {
|
|
746
746
|
if (!t) return;
|
|
747
|
-
let r =
|
|
747
|
+
let r = Pt(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
|
|
748
748
|
if (r.length === 0) return;
|
|
749
749
|
let i = r.map((e) => e.id);
|
|
750
750
|
if (i.length === t.blockIds.length && i.every((e, n) => e === t.blockIds[n])) return;
|
|
@@ -759,7 +759,7 @@ function It(e, t, n) {
|
|
|
759
759
|
}
|
|
760
760
|
};
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function It(e) {
|
|
763
763
|
let t = [], n = 0;
|
|
764
764
|
for (let r of e.blocks) {
|
|
765
765
|
let i = e.directiveText.indexOf(r.text, n);
|
|
@@ -773,7 +773,7 @@ function Lt(e) {
|
|
|
773
773
|
}
|
|
774
774
|
return t;
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function Lt(e, t, n) {
|
|
777
777
|
let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop > r && e.start < i);
|
|
778
778
|
if (a.length === 0) return;
|
|
779
779
|
let o = a[0], s = a[a.length - 1], c = o.start, l = s.stop;
|
|
@@ -787,7 +787,7 @@ function Rt(e, t, n) {
|
|
|
787
787
|
}
|
|
788
788
|
};
|
|
789
789
|
}
|
|
790
|
-
function
|
|
790
|
+
function Rt(e, t, n) {
|
|
791
791
|
if (!t) return;
|
|
792
792
|
let r = e.directiveText.indexOf(t.text);
|
|
793
793
|
if (r === -1) return;
|
|
@@ -800,15 +800,15 @@ function zt(e, t, n) {
|
|
|
800
800
|
stop: a
|
|
801
801
|
};
|
|
802
802
|
}
|
|
803
|
-
function
|
|
804
|
-
let n = performance.now(), r = performance.now(), i =
|
|
803
|
+
function zt(e, t) {
|
|
804
|
+
let n = performance.now(), r = performance.now(), i = It(e), a = performance.now() - r, o = performance.now(), s = new Map(e.blocks.map((e) => [e.id, e])), c = Nt(e.blocks), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = [], f;
|
|
805
805
|
for (let t of e.blocks) {
|
|
806
|
-
t.qualifiedVersion =
|
|
807
|
-
let e =
|
|
806
|
+
t.qualifiedVersion = jt(t);
|
|
807
|
+
let e = At(t);
|
|
808
808
|
(e.length > 0 || t.qualifiedVersion) && (d = e, f = t.qualifiedVersion), l.set(t.id, d), u.set(t.id, f);
|
|
809
809
|
}
|
|
810
|
-
let p = performance.now() - o, m = performance.now(), h =
|
|
811
|
-
let n =
|
|
810
|
+
let p = performance.now() - o, m = performance.now(), h = te(), g = ue(e.directiveText, t === void 0 ? void 0 : h), _ = performance.now() - m, v = performance.now(), y = g.map((t) => {
|
|
811
|
+
let n = Lt(e, i, t), r = kt(s, n) ?? Ot(e.blocks, t), a = At(r), o = a.length > 0 ? a : r?.id === void 0 ? [] : l.get(r.id) ?? [], d = Rt(e, r, t), f = Ft(r?.id === void 0 ? void 0 : c.get(r.id), n, s);
|
|
812
812
|
return {
|
|
813
813
|
articleId: e.id,
|
|
814
814
|
blockId: r?.id,
|
|
@@ -827,12 +827,12 @@ function Bt(e, t) {
|
|
|
827
827
|
...o.length > 0 ? { targetIds: o } : {},
|
|
828
828
|
...r?.id !== void 0 && u.get(r.id) ? { qualifiedVersion: u.get(r.id) } : {}
|
|
829
829
|
};
|
|
830
|
-
}), b = /* @__PURE__ */ new Set(),
|
|
830
|
+
}), b = /* @__PURE__ */ new Set(), x = /* @__PURE__ */ new Map(), ee = y.flatMap((e) => {
|
|
831
831
|
let t = e.blockId ? s.get(e.blockId) : void 0;
|
|
832
832
|
if (!t) return [e];
|
|
833
833
|
if (b.has(t.id)) return [];
|
|
834
|
-
let n =
|
|
835
|
-
if (n === void 0 && (n = Fe(t.text,
|
|
834
|
+
let n = x.get(t.id);
|
|
835
|
+
if (n === void 0 && (n = Fe(t.text, At(t), e.directive), x.set(t.id, n)), !n) {
|
|
836
836
|
let n = e.directive, r = e.targetIds?.length === 1 && n.kind === "compound" ? Pe(t.text, n.operations.length) : null;
|
|
837
837
|
return [r ? {
|
|
838
838
|
...e,
|
|
@@ -850,21 +850,21 @@ function Bt(e, t) {
|
|
|
850
850
|
}
|
|
851
851
|
}))
|
|
852
852
|
}];
|
|
853
|
-
}),
|
|
853
|
+
}), S = performance.now() - v;
|
|
854
854
|
return t?.push({
|
|
855
855
|
actionDirectiveExtraction: h,
|
|
856
856
|
articleId: e.id,
|
|
857
857
|
blockCount: e.blocks.length,
|
|
858
858
|
buildRangesMs: Math.round(a * 10) / 10,
|
|
859
|
-
directiveCount:
|
|
859
|
+
directiveCount: ee.length,
|
|
860
860
|
directiveTextSize: e.directiveText.length,
|
|
861
861
|
extractActionDirectivesMs: Math.round(_ * 10) / 10,
|
|
862
|
-
mapDirectivesMs: Math.round(
|
|
862
|
+
mapDirectivesMs: Math.round(S * 10) / 10,
|
|
863
863
|
prepareBlockIndexesMs: Math.round(p * 10) / 10,
|
|
864
864
|
totalMs: Math.round((performance.now() - n) * 10) / 10
|
|
865
|
-
}),
|
|
865
|
+
}), ee;
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function Bt(e) {
|
|
868
868
|
let t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Set();
|
|
869
869
|
for (let i of e) {
|
|
870
870
|
let e = Ge(i.directive);
|
|
@@ -893,7 +893,7 @@ function Vt(e) {
|
|
|
893
893
|
definitions: n
|
|
894
894
|
};
|
|
895
895
|
}
|
|
896
|
-
function
|
|
896
|
+
function Vt(e, t, n) {
|
|
897
897
|
let r = new Map(t.map((e) => [Ve(e.num), e]));
|
|
898
898
|
return e.map((e) => {
|
|
899
899
|
let t = n.get(e), i = t?.[0], a = [...Ke(e.directive.reference)].map((e) => r.get(Ve(e))).filter((e) => e !== void 0 && e.definitionId !== i?.definitionId)[0], o = a === void 0 ? void 0 : {
|
|
@@ -912,7 +912,7 @@ function Ht(e, t, n) {
|
|
|
912
912
|
};
|
|
913
913
|
});
|
|
914
914
|
}
|
|
915
|
-
function
|
|
915
|
+
function Ht(e) {
|
|
916
916
|
switch (e.kind) {
|
|
917
917
|
case "insert_after":
|
|
918
918
|
case "insert_before": return [e.insertText];
|
|
@@ -930,8 +930,8 @@ function Ut(e) {
|
|
|
930
930
|
default: return [];
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
return e.flatMap((e) =>
|
|
933
|
+
function Ut(e) {
|
|
934
|
+
return e.flatMap((e) => Ht(e.directive).filter((e) => /[«»]/u.test(e)).map((t) => ({
|
|
935
935
|
code: "nested_french_quote_in_redaction",
|
|
936
936
|
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.",
|
|
937
937
|
details: {
|
|
@@ -943,18 +943,18 @@ function Wt(e) {
|
|
|
943
943
|
}
|
|
944
944
|
})));
|
|
945
945
|
}
|
|
946
|
-
function
|
|
947
|
-
return
|
|
946
|
+
function Wt(e) {
|
|
947
|
+
return Ht(e).map((t) => ({
|
|
948
948
|
directiveKind: e.kind,
|
|
949
949
|
text: t
|
|
950
950
|
}));
|
|
951
951
|
}
|
|
952
|
-
function
|
|
952
|
+
function Gt(e) {
|
|
953
953
|
let t = /* @__PURE__ */ new Set();
|
|
954
954
|
for (let n of e.matchAll(/«[^«»\n]+»/gu)) t.add(n[0]);
|
|
955
955
|
return Array.from(t);
|
|
956
956
|
}
|
|
957
|
-
function
|
|
957
|
+
function Kt(e, t) {
|
|
958
958
|
let n = new Map(e.blocks.map((e) => [e.id, e])), r = t.sourceBlockIds ?? e.blocks.map((e) => e.id), i = [], a = 0;
|
|
959
959
|
for (let e of r) {
|
|
960
960
|
let t = n.get(e);
|
|
@@ -966,11 +966,11 @@ function qt(e, t) {
|
|
|
966
966
|
}
|
|
967
967
|
return i;
|
|
968
968
|
}
|
|
969
|
-
function
|
|
969
|
+
function qt(e, t, n) {
|
|
970
970
|
return e.find((e) => t >= e.start && n <= e.stop);
|
|
971
971
|
}
|
|
972
|
-
function
|
|
973
|
-
let r =
|
|
972
|
+
function Jt(e, t, n) {
|
|
973
|
+
let r = Gt(n), i = r.flatMap((t) => {
|
|
974
974
|
for (let n of e.blocks) {
|
|
975
975
|
let e = n.text.indexOf(t);
|
|
976
976
|
if (e !== -1) return [{
|
|
@@ -989,7 +989,7 @@ function Yt(e, t, n) {
|
|
|
989
989
|
e.directiveText
|
|
990
990
|
].filter((e) => e !== void 0 && e.length > 0), o = a.find((e) => r.some((t) => e.includes(t))) ?? a[0];
|
|
991
991
|
if (!o) return [];
|
|
992
|
-
let s =
|
|
992
|
+
let s = Kt(e, t);
|
|
993
993
|
if (s.length === 0) return [];
|
|
994
994
|
let c = [], l = 0;
|
|
995
995
|
for (let e of r) {
|
|
@@ -997,7 +997,7 @@ function Yt(e, t, n) {
|
|
|
997
997
|
if (t === -1) continue;
|
|
998
998
|
let n = t + e.length;
|
|
999
999
|
l = n;
|
|
1000
|
-
let r =
|
|
1000
|
+
let r = qt(s, t, n);
|
|
1001
1001
|
r && c.push({
|
|
1002
1002
|
blockId: r.block.id,
|
|
1003
1003
|
start: t - r.start,
|
|
@@ -1007,15 +1007,15 @@ function Yt(e, t, n) {
|
|
|
1007
1007
|
}
|
|
1008
1008
|
return c;
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1010
|
+
function Yt(e, t) {
|
|
1011
1011
|
let n = new Map(e.map((e) => [e.id, e]));
|
|
1012
1012
|
return t.flatMap((e) => {
|
|
1013
1013
|
let t = n.get(e.articleId);
|
|
1014
|
-
return t ?
|
|
1014
|
+
return t ? Wt(e.directive).filter(({ text: e }) => /[«»]/u.test(e)).map(({ directiveKind: n, text: r }) => ({
|
|
1015
1015
|
articleId: e.articleId,
|
|
1016
1016
|
code: "nested_french_quote_in_redaction",
|
|
1017
1017
|
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.",
|
|
1018
|
-
ranges:
|
|
1018
|
+
ranges: Jt(t, e, r),
|
|
1019
1019
|
severity: "warning",
|
|
1020
1020
|
details: {
|
|
1021
1021
|
blockId: e.blockId,
|
|
@@ -1026,8 +1026,8 @@ function Xt(e, t) {
|
|
|
1026
1026
|
})) : [];
|
|
1027
1027
|
});
|
|
1028
1028
|
}
|
|
1029
|
-
function
|
|
1030
|
-
let n = new Map(e.flatMap((e) => [...
|
|
1029
|
+
function Xt(e, t) {
|
|
1030
|
+
let n = new Map(e.flatMap((e) => [...ie(e.blocks.map((e) => e.text))].map(([t, n]) => [e.blocks[t].id, {
|
|
1031
1031
|
articleId: e.id,
|
|
1032
1032
|
blockIds: e.blocks.slice(t - 1, n.endIndex + 1).map((e) => e.id),
|
|
1033
1033
|
...n
|
|
@@ -1049,13 +1049,13 @@ function Zt(e, t) {
|
|
|
1049
1049
|
}];
|
|
1050
1050
|
});
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1053
|
-
let c = new
|
|
1052
|
+
function Zt(e, t, n, r, i, a, o = !0, s) {
|
|
1053
|
+
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 = {
|
|
1054
1054
|
sourceFormat: e,
|
|
1055
1055
|
documentDate: r,
|
|
1056
1056
|
html: t,
|
|
1057
1057
|
htmlWithLinks: n,
|
|
1058
|
-
tableOfContents: a ?? c.timeSync("extractTableOfContents", () =>
|
|
1058
|
+
tableOfContents: a ?? c.timeSync("extractTableOfContents", () => b(u), { inputSize: u.length }),
|
|
1059
1059
|
articles: i
|
|
1060
1060
|
};
|
|
1061
1061
|
if (!o) {
|
|
@@ -1074,24 +1074,24 @@ function Qt(e, t, n, r, i, a, o = !0, s) {
|
|
|
1074
1074
|
let f = c.timeSync("extractGlobalApplicabilityDate", () => Qe(i.map((e) => e.text).join("\n"))), p = [], m = c.timeSync("extractDirectivesFromArticles", () => {
|
|
1075
1075
|
let e = [];
|
|
1076
1076
|
for (let t of i) {
|
|
1077
|
-
let n =
|
|
1077
|
+
let n = zt(t, c.enabled ? p : void 0);
|
|
1078
1078
|
e.push(...n);
|
|
1079
1079
|
}
|
|
1080
1080
|
return e;
|
|
1081
|
-
}, { count: i.length }), { createdArticlesByDirective: h, definitions: g } = c.timeSync("buildInternalArticleDefinitions", () =>
|
|
1081
|
+
}, { count: i.length }), { createdArticlesByDirective: h, definitions: g } = c.timeSync("buildInternalArticleDefinitions", () => Bt(m), { count: m.length }), _ = c.timeSync("attachInternalArticleMetadata", () => Vt(m, g, h), { count: m.length }), v = c.timeSync("collectNestedFrenchQuoteDiagnostics", () => Ut(_), { count: _.length }), y = [...s ?? [], ...v], x = c.timeSync("collectNestedFrenchQuoteAnnotations", () => [...Yt(i, _), ...Xt(i, _)], { count: _.length }), ee = {
|
|
1082
1082
|
...d,
|
|
1083
1083
|
...f ? { globalApplicabilityDate: f } : {},
|
|
1084
1084
|
...g.length > 0 ? { internalArticleDefinitions: g } : {},
|
|
1085
1085
|
directives: _,
|
|
1086
1086
|
...x.length > 0 ? { annotations: x } : {},
|
|
1087
|
-
...
|
|
1087
|
+
...y.length > 0 ? { diagnostics: y } : {}
|
|
1088
1088
|
};
|
|
1089
1089
|
return c.log({
|
|
1090
1090
|
annotationCount: x.length,
|
|
1091
1091
|
articleCount: i.length,
|
|
1092
1092
|
blockCount: l,
|
|
1093
1093
|
definitionCount: g.length,
|
|
1094
|
-
diagnosticCount:
|
|
1094
|
+
diagnosticCount: y.length,
|
|
1095
1095
|
directiveAnalysisIncluded: !0,
|
|
1096
1096
|
directiveCount: _.length,
|
|
1097
1097
|
actionDirectiveExtractionTotals: p.reduce((e, t) => ({
|
|
@@ -1170,20 +1170,20 @@ function Qt(e, t, n, r, i, a, o = !0, s) {
|
|
|
1170
1170
|
}),
|
|
1171
1171
|
directiveTextSize: u.length,
|
|
1172
1172
|
slowDirectiveArticles: p.toSorted((e, t) => t.totalMs - e.totalMs).slice(0, 10)
|
|
1173
|
-
}),
|
|
1173
|
+
}), ee;
|
|
1174
1174
|
}
|
|
1175
|
-
function
|
|
1175
|
+
function Qt(e) {
|
|
1176
1176
|
return { items: e.map((e) => ({
|
|
1177
1177
|
id: e.id,
|
|
1178
1178
|
line: e.title ? `${e.label} : ${e.title}` : e.label,
|
|
1179
1179
|
type: "article"
|
|
1180
1180
|
})) };
|
|
1181
1181
|
}
|
|
1182
|
-
function
|
|
1183
|
-
return Array.from(
|
|
1182
|
+
function $t(e) {
|
|
1183
|
+
return Array.from(le(e)).filter((e) => e.type === "article").map((e) => F(e.line.split(/[::]/u)[0]));
|
|
1184
1184
|
}
|
|
1185
|
-
function
|
|
1186
|
-
let i =
|
|
1185
|
+
function en(e, t, n, r) {
|
|
1186
|
+
let i = ht(e), a = new Set(Array.from(n.matchAll(/\s+id=(?:"([^"]+)"|'([^']+)')/gu), (e) => e[1] ?? e[2])), o = Array.from(le(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);
|
|
1187
1187
|
(c.length !== s.length || c.some((e, t) => e !== s[t])) && i.push({
|
|
1188
1188
|
code: "article_toc_source_heading_mismatch",
|
|
1189
1189
|
message: "The table of contents differs from the parsed article headings",
|
|
@@ -1199,8 +1199,8 @@ function tn(e, t, n, r) {
|
|
|
1199
1199
|
});
|
|
1200
1200
|
return i;
|
|
1201
1201
|
}
|
|
1202
|
-
function
|
|
1203
|
-
let r =
|
|
1202
|
+
function tn(e, t, n) {
|
|
1203
|
+
let r = $t(b(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), i = e.map((e) => F(e.label)), a = Qt(e), o = [...n, ...en(e, a, t, "assemblee-html")];
|
|
1204
1204
|
if (r.length > 0 && (r.length !== i.length || r.some((e, t) => e !== i[t]))) {
|
|
1205
1205
|
let t = r.findIndex((e, t) => e !== i[t]);
|
|
1206
1206
|
o.push({
|
|
@@ -1224,13 +1224,13 @@ function nn(e, t, n) {
|
|
|
1224
1224
|
tableOfContents: a
|
|
1225
1225
|
};
|
|
1226
1226
|
}
|
|
1227
|
-
async function
|
|
1228
|
-
let n = new
|
|
1227
|
+
async function nn(e, t) {
|
|
1228
|
+
let n = new Se("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => rn(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => wt(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => T(i)), o = n.timeSync("extractArticleHeadings", () => _t(a)), s = new Set(o.map((e) => e.id)), c = dt(a).filter((e) => !s.has(I(e.num ?? e.label))).map((e) => e.label), l = c.length > 0 ? [{
|
|
1229
1229
|
code: "article_toc_source_heading_mismatch",
|
|
1230
1230
|
message: "Some structural article headings were not retained",
|
|
1231
1231
|
details: { discardedCandidates: c }
|
|
1232
|
-
}] : [], u =
|
|
1233
|
-
let n =
|
|
1232
|
+
}] : [], u = R(a), d = n.timeSync("extractArticlesAndBlocks", () => o.map((e, t) => {
|
|
1233
|
+
let n = bt(a, e, o[t + 1], u), r = St(a, e.id, n), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
1234
1234
|
return {
|
|
1235
1235
|
id: e.id,
|
|
1236
1236
|
label: e.label,
|
|
@@ -1241,7 +1241,7 @@ async function rn(e, t) {
|
|
|
1241
1241
|
directiveText: i,
|
|
1242
1242
|
blocks: r
|
|
1243
1243
|
};
|
|
1244
|
-
}), { count: o.length }), f = n.timeSync("injectHiddenArticleSummary", () =>
|
|
1244
|
+
}), { count: o.length }), f = n.timeSync("injectHiddenArticleSummary", () => Ct(a.html(), d)), { diagnostics: p, tableOfContents: m } = n.timeSync("buildAssembleeTableOfContents", () => tn(d, f, l), { count: d.length }), h = n.timeSync("buildParsedDocument", () => Zt("assemblee-html", e, f, t.date, d, m, t.includeDirectiveAnalysis, p));
|
|
1245
1245
|
return h.diagnostics?.length && process.env.TISSEUSE_WARN_PARSED_BILL_DIAGNOSTICS === "1" && console.warn("Assemblée bill parsing diagnostics", h.diagnostics), n.log({
|
|
1246
1246
|
articleCount: h.articles.length,
|
|
1247
1247
|
blockCount: h.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -1249,7 +1249,7 @@ async function rn(e, t) {
|
|
|
1249
1249
|
targetDirectiveCount: h.directives.filter((e) => e.targetIds !== void 0).length
|
|
1250
1250
|
}), h;
|
|
1251
1251
|
}
|
|
1252
|
-
async function
|
|
1252
|
+
async function rn(e, t) {
|
|
1253
1253
|
return {
|
|
1254
1254
|
sourceFormat: "assemblee-html",
|
|
1255
1255
|
documentDate: t.date,
|
|
@@ -1257,10 +1257,10 @@ async function an(e, t) {
|
|
|
1257
1257
|
linkedHtml: await ot(e, t, t.date)
|
|
1258
1258
|
};
|
|
1259
1259
|
}
|
|
1260
|
-
function
|
|
1260
|
+
function V(e) {
|
|
1261
1261
|
return e.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1263
|
+
function an(e) {
|
|
1264
1264
|
let t = e;
|
|
1265
1265
|
for (let e = 0; e < 3; e++) {
|
|
1266
1266
|
let e = t;
|
|
@@ -1268,27 +1268,27 @@ function on(e) {
|
|
|
1268
1268
|
}
|
|
1269
1269
|
return t;
|
|
1270
1270
|
}
|
|
1271
|
-
function
|
|
1271
|
+
function on(e) {
|
|
1272
1272
|
return /(?:<|&lt;)\/?(?:p|br|span|b|i|u|sup|sub|table|thead|tbody|tr|th|td|ul|ol|li)\b/iu.test(e);
|
|
1273
1273
|
}
|
|
1274
|
-
function
|
|
1274
|
+
function H(e) {
|
|
1275
1275
|
return e.name.replace(/^.*:/u, "");
|
|
1276
1276
|
}
|
|
1277
|
-
function
|
|
1278
|
-
return t.children.map((t) =>
|
|
1277
|
+
function sn(e, t) {
|
|
1278
|
+
return t.children.map((t) => U(e, t)).filter(Boolean).join("");
|
|
1279
1279
|
}
|
|
1280
|
-
function
|
|
1281
|
-
return t.children.map((t) => t.type === "text" &&
|
|
1280
|
+
function cn(e, t) {
|
|
1281
|
+
return t.children.map((t) => t.type === "text" && on(t.data) ? an(t.data) : U(e, t)).filter(Boolean).join("");
|
|
1282
1282
|
}
|
|
1283
|
-
function
|
|
1283
|
+
function U(e, t) {
|
|
1284
1284
|
if (t.type === "text") {
|
|
1285
1285
|
let e = t.data.replace(/\s+\./gu, ".");
|
|
1286
|
-
return
|
|
1286
|
+
return on(e) ? an(e) : V(e);
|
|
1287
1287
|
}
|
|
1288
1288
|
if (!L(t)) return "";
|
|
1289
|
-
let n =
|
|
1289
|
+
let n = H(t), r = sn(e, t);
|
|
1290
1290
|
switch (n) {
|
|
1291
|
-
case "p": return `<p${
|
|
1291
|
+
case "p": return `<p${dn(e, t, [
|
|
1292
1292
|
"id",
|
|
1293
1293
|
"class",
|
|
1294
1294
|
"align",
|
|
@@ -1302,13 +1302,13 @@ function H(e, t) {
|
|
|
1302
1302
|
case "u":
|
|
1303
1303
|
case "sup":
|
|
1304
1304
|
case "sub":
|
|
1305
|
-
case "abbr": return `<${n}${
|
|
1305
|
+
case "abbr": return `<${n}${dn(e, t, [
|
|
1306
1306
|
"id",
|
|
1307
1307
|
"class",
|
|
1308
1308
|
"title",
|
|
1309
1309
|
"style"
|
|
1310
1310
|
])}>${r}</${n}>`;
|
|
1311
|
-
case "a": return `<a href="${
|
|
1311
|
+
case "a": return `<a href="${V(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${dn(e, t, [
|
|
1312
1312
|
"id",
|
|
1313
1313
|
"class",
|
|
1314
1314
|
"title",
|
|
@@ -1320,7 +1320,7 @@ function H(e, t) {
|
|
|
1320
1320
|
case "tr":
|
|
1321
1321
|
case "th":
|
|
1322
1322
|
case "td": return fn(e, t, n, r);
|
|
1323
|
-
case "caption": return `<caption${
|
|
1323
|
+
case "caption": return `<caption${dn(e, t, [
|
|
1324
1324
|
"id",
|
|
1325
1325
|
"class",
|
|
1326
1326
|
"align",
|
|
@@ -1328,7 +1328,7 @@ function H(e, t) {
|
|
|
1328
1328
|
])}>${r}</caption>`;
|
|
1329
1329
|
case "num": return `<span class="akn-num">${r}</span> `;
|
|
1330
1330
|
case "heading": return `<p class="akn-heading">${r}</p>`;
|
|
1331
|
-
case "content": return
|
|
1331
|
+
case "content": return cn(e, t);
|
|
1332
1332
|
case "alinea": return Dn(e, t, "div", "akn-alinea");
|
|
1333
1333
|
case "article": return Dn(e, t, "article", "akn-article");
|
|
1334
1334
|
case "blockList":
|
|
@@ -1354,7 +1354,7 @@ function H(e, t) {
|
|
|
1354
1354
|
default: return r;
|
|
1355
1355
|
}
|
|
1356
1356
|
}
|
|
1357
|
-
function
|
|
1357
|
+
function ln(e, t) {
|
|
1358
1358
|
let n = e(t).text();
|
|
1359
1359
|
if (!n.includes("«") || !n.includes("»") || e(t).find("table").length > 0) return;
|
|
1360
1360
|
let r = e(t).find("tr").get().filter((n) => e(n).closest("table").get(0) === t);
|
|
@@ -1382,22 +1382,22 @@ function un(e, t) {
|
|
|
1382
1382
|
for (let [t, n] of o) t && e(t).addClass("akn-quote-column"), n && e(n).addClass("akn-quote-column");
|
|
1383
1383
|
}
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1385
|
+
function un(e, t) {
|
|
1386
1386
|
let n = e(t).find("td,th").get(), r = e(n.find((t) => e(t).hasClass("akn-quote-column") && /^»\s*;?$/u.test(P(e(t).text())))).text();
|
|
1387
1387
|
return `« ${n.filter((t) => !e(t).hasClass("akn-quote-column")).map((t) => P(e(t).text())).filter(Boolean).join(" ")} »${r.includes(";") ? " ;" : ""}`;
|
|
1388
1388
|
}
|
|
1389
|
-
function
|
|
1389
|
+
function dn(e, t, n, r = {}) {
|
|
1390
1390
|
let i = [];
|
|
1391
1391
|
for (let r of n) {
|
|
1392
1392
|
if (r === "style") continue;
|
|
1393
1393
|
let n = e(t).attr(r);
|
|
1394
|
-
n !== void 0 && i.push(`${r}="${
|
|
1394
|
+
n !== void 0 && i.push(`${r}="${V(n)}"`);
|
|
1395
1395
|
}
|
|
1396
1396
|
let a = r.style ?? e(t).attr("style");
|
|
1397
|
-
return a && i.push(`style="${
|
|
1397
|
+
return a && i.push(`style="${V(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
|
|
1398
1398
|
}
|
|
1399
1399
|
function fn(e, t, n, r) {
|
|
1400
|
-
return `<${n}${
|
|
1400
|
+
return `<${n}${dn(e, t, [
|
|
1401
1401
|
"id",
|
|
1402
1402
|
"class",
|
|
1403
1403
|
"colspan",
|
|
@@ -1422,7 +1422,7 @@ function mn(e, t, n) {
|
|
|
1422
1422
|
}
|
|
1423
1423
|
function hn(e, t) {
|
|
1424
1424
|
let n = [P(e(t).children("num").first().text()), P(e(t).children("heading").first().text())].filter(Boolean);
|
|
1425
|
-
return n.length === 0 ? "" : `<p class="akn-heading">${
|
|
1425
|
+
return n.length === 0 ? "" : `<p class="akn-heading">${V(n.join(" "))}</p>`;
|
|
1426
1426
|
}
|
|
1427
1427
|
function gn(e, t) {
|
|
1428
1428
|
if (!t) return !1;
|
|
@@ -1430,7 +1430,7 @@ function gn(e, t) {
|
|
|
1430
1430
|
return n(P(e.replace(/<[^>]*>/gu, " ").replace(/ /gu, " ").replace(/ /giu, " ").replace(/–/giu, "–"))).startsWith(n(t));
|
|
1431
1431
|
}
|
|
1432
1432
|
function _n(e) {
|
|
1433
|
-
let t =
|
|
1433
|
+
let t = V(e);
|
|
1434
1434
|
return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}" data-pastille="${t}"></span></p>`;
|
|
1435
1435
|
}
|
|
1436
1436
|
function vn(e, t) {
|
|
@@ -1443,12 +1443,12 @@ function yn(e) {
|
|
|
1443
1443
|
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>`;
|
|
1444
1444
|
}
|
|
1445
1445
|
function bn({ content: e, pastille: t, style: n, contextClass: r }) {
|
|
1446
|
-
let i = n ? ` style="${
|
|
1447
|
-
return `<tr${r ? ` class="${
|
|
1446
|
+
let i = n ? ` style="${V(n)}"` : "", a = r ? ` ${V(r)}` : "";
|
|
1447
|
+
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}">${_n(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>`;
|
|
1448
1448
|
}
|
|
1449
1449
|
function xn({ content: e, style: t, contextClass: n }) {
|
|
1450
|
-
let r = t ? ` style="${
|
|
1451
|
-
return `<tr${n ? ` class="${
|
|
1450
|
+
let r = t ? ` style="${V(t)}"` : "", i = n ? ` ${V(n)}` : "";
|
|
1451
|
+
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>`;
|
|
1452
1452
|
}
|
|
1453
1453
|
function Sn(e, t) {
|
|
1454
1454
|
return e(t).attr("data:pastille") ?? e(t).attr("pastille");
|
|
@@ -1457,18 +1457,18 @@ function Cn(e, t) {
|
|
|
1457
1457
|
return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
|
|
1458
1458
|
}
|
|
1459
1459
|
function wn(e, t) {
|
|
1460
|
-
return e(t).children().get().filter((e) => L(e) ?
|
|
1460
|
+
return e(t).children().get().filter((e) => L(e) ? H(e) === "content" : !1).map((t) => U(e, t)).filter(Boolean).join("\n");
|
|
1461
1461
|
}
|
|
1462
1462
|
function Tn(e, t) {
|
|
1463
1463
|
let n = [];
|
|
1464
1464
|
return e(t).children().each((t, r) => {
|
|
1465
1465
|
if (!L(r)) return;
|
|
1466
|
-
let i =
|
|
1467
|
-
i === "num" || i === "heading" || i === "content" || n.push(
|
|
1466
|
+
let i = H(r);
|
|
1467
|
+
i === "num" || i === "heading" || i === "content" || n.push(U(e, r));
|
|
1468
1468
|
}), n.filter(Boolean);
|
|
1469
1469
|
}
|
|
1470
1470
|
function En(e, t) {
|
|
1471
|
-
let n = [], r =
|
|
1471
|
+
let n = [], r = H(t), i = r === "alinea" ? Sn(e, t) : void 0, a = wn(e, t), o = On(e, t, r, i), s = Pn(e, t);
|
|
1472
1472
|
if (i) {
|
|
1473
1473
|
let r = [gn(a, P(e(t).children("num").first().text())) ? "" : hn(e, t), a].filter(Boolean).join("\n");
|
|
1474
1474
|
P(r) && n.push(bn({
|
|
@@ -1484,17 +1484,17 @@ function En(e, t) {
|
|
|
1484
1484
|
}));
|
|
1485
1485
|
for (let r of e(t).children().get()) {
|
|
1486
1486
|
if (!L(r)) continue;
|
|
1487
|
-
let t =
|
|
1487
|
+
let t = H(r);
|
|
1488
1488
|
t === "num" || t === "heading" || t === "content" || (t === "alinea" || Cn(e, r)) && n.push(...En(e, r));
|
|
1489
1489
|
}
|
|
1490
1490
|
return n;
|
|
1491
1491
|
}
|
|
1492
1492
|
function Dn(e, t, n, r) {
|
|
1493
|
-
let i =
|
|
1494
|
-
a ? `id="${
|
|
1493
|
+
let i = H(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = Sn(e, t), s = On(e, t, i, o), c = [`<${n} ${[
|
|
1494
|
+
a ? `id="${V(a)}"` : void 0,
|
|
1495
1495
|
`class="${r}"`,
|
|
1496
|
-
o ? `data-pastille="${
|
|
1497
|
-
s ? `style="${
|
|
1496
|
+
o ? `data-pastille="${V(o)}"` : void 0,
|
|
1497
|
+
s ? `style="${V(s)}"` : void 0
|
|
1498
1498
|
].filter((e) => e !== void 0).join(" ")}>`];
|
|
1499
1499
|
if (i === "part" || i === "title") {
|
|
1500
1500
|
let r = jn(e, t, i), a = Nn(e, t), o = r ? [xn({
|
|
@@ -1505,21 +1505,21 @@ function Dn(e, t, n, r) {
|
|
|
1505
1505
|
};
|
|
1506
1506
|
return e(t).children().each((t, n) => {
|
|
1507
1507
|
if (!L(n)) return;
|
|
1508
|
-
let r =
|
|
1508
|
+
let r = H(n);
|
|
1509
1509
|
if (!(r === "num" || r === "heading" || r === "content")) {
|
|
1510
1510
|
if (r === "alinea") {
|
|
1511
1511
|
o.push(...En(e, n));
|
|
1512
1512
|
return;
|
|
1513
1513
|
}
|
|
1514
|
-
s(), c.push(
|
|
1514
|
+
s(), c.push(U(e, n));
|
|
1515
1515
|
}
|
|
1516
1516
|
}), s(), c.push(`</${n}>`), c.join("\n");
|
|
1517
1517
|
}
|
|
1518
1518
|
if (i === "article") {
|
|
1519
|
-
let r = P(e(t).children("num").first().text()), i = P(e(t).children("heading").first().text()), a =
|
|
1519
|
+
let r = P(e(t).children("num").first().text()), i = P(e(t).children("heading").first().text()), a = w(r) ?? {
|
|
1520
1520
|
label: r,
|
|
1521
1521
|
num: r
|
|
1522
|
-
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${
|
|
1522
|
+
}, 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>`;
|
|
1523
1523
|
if (Cn(e, t)) {
|
|
1524
1524
|
let r = [xn({
|
|
1525
1525
|
content: o,
|
|
@@ -1534,8 +1534,8 @@ function Dn(e, t, n, r) {
|
|
|
1534
1534
|
let l = [];
|
|
1535
1535
|
for (let n of ["content", "children"]) e(t).children().each((t, r) => {
|
|
1536
1536
|
if (!L(r)) return;
|
|
1537
|
-
let i =
|
|
1538
|
-
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(
|
|
1537
|
+
let i = H(r);
|
|
1538
|
+
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(U(e, r));
|
|
1539
1539
|
});
|
|
1540
1540
|
let u = l.join("\n");
|
|
1541
1541
|
if (i !== "article") {
|
|
@@ -1556,7 +1556,7 @@ function An(e) {
|
|
|
1556
1556
|
}
|
|
1557
1557
|
function jn(e, t, n) {
|
|
1558
1558
|
let r = P(e(t).children("num").first().text()), i = P(e(t).children("heading").first().text()), a = Mn(n), o = [];
|
|
1559
|
-
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${
|
|
1559
|
+
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");
|
|
1560
1560
|
}
|
|
1561
1561
|
function Mn(e) {
|
|
1562
1562
|
switch (e) {
|
|
@@ -1587,7 +1587,7 @@ function Nn(e, t) {
|
|
|
1587
1587
|
if (n) return n;
|
|
1588
1588
|
for (let n of e(t).parents().get()) {
|
|
1589
1589
|
if (!L(n)) continue;
|
|
1590
|
-
let t =
|
|
1590
|
+
let t = H(n);
|
|
1591
1591
|
if (t !== "title" && t !== "part") continue;
|
|
1592
1592
|
let r = Fn(P(e(n).children("num").first().text()));
|
|
1593
1593
|
if (r) return r;
|
|
@@ -1626,7 +1626,7 @@ function Rn(e, t) {
|
|
|
1626
1626
|
return [P(e(t).children("num").first().text()), P(e(t).children("heading").first().text())].filter(Boolean).join(" ");
|
|
1627
1627
|
}
|
|
1628
1628
|
function zn(e, t) {
|
|
1629
|
-
let n = P(e(t).children("num").first().text()), r = P(e(t).children("heading").first().text()), i =
|
|
1629
|
+
let n = P(e(t).children("num").first().text()), r = P(e(t).children("heading").first().text()), i = w(n) ?? {
|
|
1630
1630
|
label: n,
|
|
1631
1631
|
num: n
|
|
1632
1632
|
};
|
|
@@ -1643,7 +1643,7 @@ function Vn(e, t) {
|
|
|
1643
1643
|
let n = { items: [] };
|
|
1644
1644
|
return e(t).children().each((t, r) => {
|
|
1645
1645
|
if (!L(r)) return;
|
|
1646
|
-
let i =
|
|
1646
|
+
let i = H(r);
|
|
1647
1647
|
if (i === "article") {
|
|
1648
1648
|
n.items.push(zn(e, r));
|
|
1649
1649
|
return;
|
|
@@ -1670,14 +1670,14 @@ function Un(e) {
|
|
|
1670
1670
|
return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
|
|
1671
1671
|
}
|
|
1672
1672
|
function Wn(e) {
|
|
1673
|
-
e("table").each((t, n) =>
|
|
1673
|
+
e("table").each((t, n) => ln(e, n));
|
|
1674
1674
|
let t = e("preamble").first(), n = e("body").first(), r = ["<div class=\"akn-bill\">", "<style>.akn-bill p.pastille span:empty::before{content:attr(data-pastille)}</style>"];
|
|
1675
|
-
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(
|
|
1676
|
-
L(n) && r.push(
|
|
1675
|
+
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(sn(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
|
|
1676
|
+
L(n) && r.push(H(n) === "article" ? Dn(e, n, "article", "akn-article") : U(e, n));
|
|
1677
1677
|
}), r.push("</section></div>"), r.join("\n");
|
|
1678
1678
|
}
|
|
1679
1679
|
function Gn(e) {
|
|
1680
|
-
let t =
|
|
1680
|
+
let t = T(e, { xml: {
|
|
1681
1681
|
decodeEntities: !1,
|
|
1682
1682
|
lowerCaseTags: !1,
|
|
1683
1683
|
lowerCaseAttributeNames: !1,
|
|
@@ -1691,12 +1691,12 @@ function Gn(e) {
|
|
|
1691
1691
|
};
|
|
1692
1692
|
}
|
|
1693
1693
|
function Kn(e) {
|
|
1694
|
-
return qn(
|
|
1694
|
+
return qn(T(e));
|
|
1695
1695
|
}
|
|
1696
1696
|
function qn(e) {
|
|
1697
1697
|
let t = [];
|
|
1698
1698
|
return e("article.akn-article").each((n, r) => {
|
|
1699
|
-
let i = e(r).find("p.TCNumArticle").first().get(0), a = P(i ? e(i).text() : ""), o =
|
|
1699
|
+
let i = e(r).find("p.TCNumArticle").first().get(0), a = P(i ? e(i).text() : ""), o = w(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = St(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
1700
1700
|
t.push({
|
|
1701
1701
|
id: s,
|
|
1702
1702
|
label: o.label,
|
|
@@ -1710,14 +1710,14 @@ function qn(e) {
|
|
|
1710
1710
|
}), t;
|
|
1711
1711
|
}
|
|
1712
1712
|
function Jn(e) {
|
|
1713
|
-
let t =
|
|
1713
|
+
let t = T(e);
|
|
1714
1714
|
return {
|
|
1715
1715
|
articles: qn(t),
|
|
1716
1716
|
htmlWithLinks: t.html()
|
|
1717
1717
|
};
|
|
1718
1718
|
}
|
|
1719
1719
|
async function Yn(e, t) {
|
|
1720
|
-
let n = new
|
|
1720
|
+
let n = new Se("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => T(e, { xml: {
|
|
1721
1721
|
decodeEntities: !1,
|
|
1722
1722
|
lowerCaseTags: !1,
|
|
1723
1723
|
lowerCaseAttributeNames: !1,
|
|
@@ -1725,7 +1725,7 @@ async function Yn(e, t) {
|
|
|
1725
1725
|
} })), i = t.date ?? Un(r), a = n.timeSync("renderAknHtml", () => Wn(r), { inputSize: e.length }), o = t.linkedHtml ?? await n.time("addLinksToRenderedAknHtml", () => ot(a, {
|
|
1726
1726
|
...t,
|
|
1727
1727
|
date: i
|
|
1728
|
-
}, i)), s = n.timeSync("extractRenderedAknArticles", () => Kn(a)), c = n.timeSync("injectHiddenArticleSummary", () =>
|
|
1728
|
+
}, i)), s = n.timeSync("extractRenderedAknArticles", () => Kn(a)), c = n.timeSync("injectHiddenArticleSummary", () => Ct(o, s)), { articles: l, htmlWithLinks: u } = n.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => Jn(c)), d = l.length > 0 ? l : s, f = n.timeSync("extractAknTableOfContents", () => Hn(r)), p = n.timeSync("buildParsedDocument", () => Zt("akoma-ntoso", a, l.length > 0 ? u : c, i, d, f, t.includeDirectiveAnalysis, en(d, f, l.length > 0 ? u : c, "akoma-ntoso")));
|
|
1729
1729
|
return n.log({
|
|
1730
1730
|
articleCount: p.articles.length,
|
|
1731
1731
|
blockCount: p.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -1749,7 +1749,7 @@ function $n(e) {
|
|
|
1749
1749
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1750
1750
|
}
|
|
1751
1751
|
function er(e) {
|
|
1752
|
-
let t = $n(
|
|
1752
|
+
let t = $n(T(e).text()), n = [...t.matchAll(Zn)], r = /* @__PURE__ */ new Set(), i = [];
|
|
1753
1753
|
for (let [e, a] of n.entries()) {
|
|
1754
1754
|
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = Qn.exec(s), l = $n(s.slice(0, c?.index ?? s.length));
|
|
1755
1755
|
if (l.length < 20 || r.has(l)) continue;
|
|
@@ -1768,7 +1768,7 @@ function er(e) {
|
|
|
1768
1768
|
return i;
|
|
1769
1769
|
}
|
|
1770
1770
|
async function tr({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
1771
|
-
let i = await
|
|
1771
|
+
let i = await nn(t, {
|
|
1772
1772
|
date: e,
|
|
1773
1773
|
includeDirectiveAnalysis: !1,
|
|
1774
1774
|
linkBaseUrl: n,
|
|
@@ -1792,7 +1792,7 @@ async function tr({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1792
1792
|
};
|
|
1793
1793
|
}
|
|
1794
1794
|
function nr(e, t) {
|
|
1795
|
-
return
|
|
1795
|
+
return De("sha256").update(JSON.stringify({
|
|
1796
1796
|
item: e,
|
|
1797
1797
|
metadata: t
|
|
1798
1798
|
})).digest("hex");
|
|
@@ -1813,7 +1813,7 @@ function rr(e) {
|
|
|
1813
1813
|
//#endregion
|
|
1814
1814
|
//#region src/lib/server/senat_amendment_search.ts
|
|
1815
1815
|
function ir(e) {
|
|
1816
|
-
return e?.trim() ?
|
|
1816
|
+
return e?.trim() ? T(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
|
|
1817
1817
|
}
|
|
1818
1818
|
function ar({ dispositifHtml: e, objetHtml: t }) {
|
|
1819
1819
|
let n = ir(e), r = ir(t);
|
|
@@ -1828,7 +1828,7 @@ function ar({ dispositifHtml: e, objetHtml: t }) {
|
|
|
1828
1828
|
}] : []];
|
|
1829
1829
|
}
|
|
1830
1830
|
function or(e, t) {
|
|
1831
|
-
return
|
|
1831
|
+
return De("sha256").update(JSON.stringify({
|
|
1832
1832
|
item: e,
|
|
1833
1833
|
metadata: t
|
|
1834
1834
|
})).digest("hex");
|
|
@@ -1845,73 +1845,73 @@ function W(e, t) {
|
|
|
1845
1845
|
function sr(e, t) {
|
|
1846
1846
|
return {
|
|
1847
1847
|
type: e === "start" ? "head_of_target" : "tail_after_target",
|
|
1848
|
-
unit: t ?
|
|
1848
|
+
unit: t ? de(t) : "article"
|
|
1849
1849
|
};
|
|
1850
1850
|
}
|
|
1851
1851
|
function cr(e) {
|
|
1852
1852
|
return e === "start" ? "insert_before" : "insert_after";
|
|
1853
1853
|
}
|
|
1854
|
-
var lr = D(
|
|
1854
|
+
var lr = O(D("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), G = k(t, j([D("les?\\s+", { flags: "i" }), p], { value: (e) => e[1] }), p, n), ur = k(j([D("la\\s+fin\\s+de\\s+", { flags: "i" }), G], { value: (e) => {
|
|
1855
1855
|
let t = e[1];
|
|
1856
1856
|
return {
|
|
1857
1857
|
targetReference: t,
|
|
1858
1858
|
targetScope: {
|
|
1859
1859
|
type: "tail_after_target",
|
|
1860
|
-
unit:
|
|
1860
|
+
unit: de(t)
|
|
1861
1861
|
}
|
|
1862
1862
|
};
|
|
1863
|
-
} }),
|
|
1864
|
-
D(
|
|
1865
|
-
D(
|
|
1863
|
+
} }), j([i], { value: (e) => ({ targetScope: e[0] }) })), K = O(j([
|
|
1864
|
+
O(D("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1865
|
+
O(D("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1866
1866
|
G,
|
|
1867
|
-
D(
|
|
1867
|
+
O(D("\\s*,?\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*)?", { flags: "i" }), { default: "" })
|
|
1868
1868
|
], { value: (e, t) => ({
|
|
1869
1869
|
reference: e[2],
|
|
1870
1870
|
text: t.text()
|
|
1871
|
-
}) }), { default: null }), dr = D(
|
|
1871
|
+
}) }), { default: null }), dr = O(D(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${_e})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
|
|
1872
1872
|
function q(e) {
|
|
1873
1873
|
return e?.text ?? "";
|
|
1874
1874
|
}
|
|
1875
|
-
function fr(
|
|
1876
|
-
return { citation: e
|
|
1875
|
+
function fr(e) {
|
|
1876
|
+
return { citation: ee(e.position()) };
|
|
1877
1877
|
}
|
|
1878
|
-
var J =
|
|
1878
|
+
var J = k(j([v], { value: (e) => ({ citation: e[0] }) }), D("\\S[\\s\\S]*", { value: (e, t) => fr(t) })), pr = D("\\S[\\s\\S]*", { value: (e, t) => fr(t) }), Y = D("[^:«“\"]*(?::\\s*)?", { flags: "i" }), mr = D("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
|
|
1879
1879
|
flags: "i",
|
|
1880
1880
|
value: (e, t) => fr(t)
|
|
1881
|
-
}), hr =
|
|
1881
|
+
}), hr = D("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
|
|
1882
1882
|
flags: "i",
|
|
1883
1883
|
value: (e, t) => fr(t)
|
|
1884
|
-
}), gr =
|
|
1884
|
+
}), gr = D("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
|
|
1885
1885
|
flags: "i",
|
|
1886
1886
|
value: (e, t) => fr(t)
|
|
1887
|
-
}), _r =
|
|
1887
|
+
}), _r = k(j([v], { value: (e) => ({ citation: e[0] }) }), mr), vr = k(j([v], { value: (e) => ({ citation: e[0] }) }), gr), yr = j([D(`${o}s?\\s*:?\\s*`, { flags: "i" }), _r], { value: (e) => e[1] }), br = j([D(`${c}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), vr], { value: (e) => e[1] }), xr = k(j([v], { value: (e) => ({ citation: e[0] }) }), hr), Sr = j([
|
|
1888
1888
|
dr,
|
|
1889
|
-
|
|
1889
|
+
D(`${o}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1890
1890
|
xr
|
|
1891
|
-
], { value: (e) => e[2] }), Cr =
|
|
1891
|
+
], { value: (e) => e[2] }), Cr = j([
|
|
1892
1892
|
dr,
|
|
1893
|
-
|
|
1894
|
-
|
|
1893
|
+
D(`${o}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1894
|
+
k(j([v], { value: (e) => ({ citation: e[0] }) }), pr)
|
|
1895
1895
|
], { value: (e) => e[2] });
|
|
1896
1896
|
function X(e) {
|
|
1897
1897
|
return e?.reference;
|
|
1898
1898
|
}
|
|
1899
|
-
var wr =
|
|
1899
|
+
var wr = j([lr, D("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => W(t, {
|
|
1900
1900
|
contextText: e[0],
|
|
1901
1901
|
kind: "delete_article"
|
|
1902
|
-
}) }), Tr =
|
|
1902
|
+
}) }), Tr = j([
|
|
1903
1903
|
K,
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1904
|
+
D("supprimer", { flags: "i" }),
|
|
1905
|
+
O(j([A, G], { value: (e) => e[1] }), { default: null }),
|
|
1906
|
+
O(j([A, Cr], { value: (e) => e[1] }), { default: null })
|
|
1907
1907
|
], { value: (e, t) => W(t, {
|
|
1908
1908
|
contextText: q(e[0]),
|
|
1909
1909
|
kind: "delete_portion",
|
|
1910
1910
|
targetCitation: e[3]?.citation ?? void 0,
|
|
1911
1911
|
targetReference: e[2] ?? X(e[0])
|
|
1912
|
-
}) }), Er =
|
|
1912
|
+
}) }), Er = j([
|
|
1913
1913
|
K,
|
|
1914
|
-
|
|
1914
|
+
k(D("r[eé]diger\\s+ainsi", { flags: "i" }), D("r[eé]tablir", { flags: "i" })),
|
|
1915
1915
|
Y,
|
|
1916
1916
|
J
|
|
1917
1917
|
], { value: (e, t) => W(t, {
|
|
@@ -1919,14 +1919,14 @@ var wr = O([lr, k("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1919
1919
|
kind: "rewrite_portion",
|
|
1920
1920
|
replacementCitation: e[3].citation,
|
|
1921
1921
|
targetReference: X(e[0])
|
|
1922
|
-
}) }), Dr =
|
|
1922
|
+
}) }), Dr = j([
|
|
1923
1923
|
K,
|
|
1924
|
-
|
|
1924
|
+
k(D("substituer", { flags: "i" }), D("remplacer", { flags: "i" })),
|
|
1925
1925
|
A,
|
|
1926
1926
|
dr,
|
|
1927
1927
|
yr,
|
|
1928
|
-
|
|
1929
|
-
D(
|
|
1928
|
+
D("\\s*,?\\s*"),
|
|
1929
|
+
O(D("par\\s+", { flags: "i" }), { default: "" }),
|
|
1930
1930
|
br
|
|
1931
1931
|
], { value: (e, t) => W(t, {
|
|
1932
1932
|
contextText: q(e[0]),
|
|
@@ -1934,61 +1934,61 @@ var wr = O([lr, k("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1934
1934
|
replacementCitation: e[7].citation,
|
|
1935
1935
|
targetCitation: e[4].citation,
|
|
1936
1936
|
targetReference: X(e[0])
|
|
1937
|
-
}) }), Or =
|
|
1937
|
+
}) }), Or = j([
|
|
1938
1938
|
K,
|
|
1939
|
-
|
|
1939
|
+
D("substituer", { flags: "i" }),
|
|
1940
1940
|
A,
|
|
1941
|
-
D(
|
|
1941
|
+
O(D("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
|
|
1942
1942
|
G,
|
|
1943
|
-
|
|
1943
|
+
D("[\\s\\S]*?(?=[«“\"]|$)"),
|
|
1944
1944
|
J
|
|
1945
1945
|
], { value: (e, t) => W(t, {
|
|
1946
1946
|
contextText: q(e[0]),
|
|
1947
1947
|
kind: "rewrite_portion",
|
|
1948
1948
|
replacementCitation: e[6].citation,
|
|
1949
1949
|
targetReference: e[4] ?? X(e[0])
|
|
1950
|
-
}) }), kr =
|
|
1951
|
-
|
|
1950
|
+
}) }), kr = j([
|
|
1951
|
+
d,
|
|
1952
1952
|
A,
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1953
|
+
D("l['’ ]article", { flags: "i" }),
|
|
1954
|
+
D("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1955
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
1956
1956
|
Y,
|
|
1957
1957
|
J
|
|
1958
1958
|
], { value: (e, t) => W(t, {
|
|
1959
1959
|
contextText: "",
|
|
1960
1960
|
insertCitation: e[6].citation,
|
|
1961
1961
|
kind: e[0] === "before" ? "insert_article_before" : "insert_article_after"
|
|
1962
|
-
}) }), Ar =
|
|
1963
|
-
|
|
1962
|
+
}) }), Ar = j([
|
|
1963
|
+
d,
|
|
1964
1964
|
A,
|
|
1965
1965
|
G,
|
|
1966
|
-
|
|
1967
|
-
|
|
1966
|
+
D("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1967
|
+
k(D("ins[eé]rer", { flags: "i" }), D("ajouter", { flags: "i" })),
|
|
1968
1968
|
Y,
|
|
1969
1969
|
J
|
|
1970
|
-
], { value: (e,
|
|
1970
|
+
], { value: (e, t) => W(t, {
|
|
1971
1971
|
contextText: "",
|
|
1972
1972
|
insertCitation: e[6].citation,
|
|
1973
|
-
kind:
|
|
1973
|
+
kind: C(e[0]),
|
|
1974
1974
|
targetReference: e[2]
|
|
1975
|
-
}) }), jr =
|
|
1976
|
-
|
|
1975
|
+
}) }), jr = j([
|
|
1976
|
+
d,
|
|
1977
1977
|
A,
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1978
|
+
D("l['’ ]alin[eé]a", { flags: "i" }),
|
|
1979
|
+
D("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1980
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
1981
1981
|
Y,
|
|
1982
1982
|
J
|
|
1983
|
-
], { value: (e,
|
|
1983
|
+
], { value: (e, t) => W(t, {
|
|
1984
1984
|
contextText: "",
|
|
1985
1985
|
insertCitation: e[6].citation,
|
|
1986
|
-
kind:
|
|
1987
|
-
}) }), Mr =
|
|
1986
|
+
kind: C(e[0])
|
|
1987
|
+
}) }), Mr = j([
|
|
1988
1988
|
K,
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1989
|
+
re,
|
|
1990
|
+
D("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1991
|
+
k(D("ins[eé]rer", { flags: "i" }), D("ajouter", { flags: "i" })),
|
|
1992
1992
|
Y,
|
|
1993
1993
|
J
|
|
1994
1994
|
], { value: (e, t) => {
|
|
@@ -2000,43 +2000,43 @@ var wr = O([lr, k("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2000
2000
|
targetReference: r,
|
|
2001
2001
|
targetScope: sr(i, r)
|
|
2002
2002
|
});
|
|
2003
|
-
} }), Nr =
|
|
2003
|
+
} }), Nr = j([
|
|
2004
2004
|
K,
|
|
2005
|
-
|
|
2005
|
+
d,
|
|
2006
2006
|
A,
|
|
2007
2007
|
Sr,
|
|
2008
|
-
|
|
2009
|
-
|
|
2008
|
+
D("[\\s\\S]*?(?=ins[eé]rer)"),
|
|
2009
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
2010
2010
|
A,
|
|
2011
2011
|
br
|
|
2012
|
-
], { value: (e,
|
|
2012
|
+
], { value: (e, t) => W(t, {
|
|
2013
2013
|
contextText: q(e[0]),
|
|
2014
2014
|
insertCitation: e[7].citation,
|
|
2015
|
-
kind:
|
|
2015
|
+
kind: C(e[1]),
|
|
2016
2016
|
targetCitation: e[3].citation,
|
|
2017
2017
|
targetReference: X(e[0])
|
|
2018
|
-
}) }), Pr =
|
|
2018
|
+
}) }), Pr = j([
|
|
2019
2019
|
K,
|
|
2020
|
-
|
|
2020
|
+
d,
|
|
2021
2021
|
A,
|
|
2022
2022
|
G,
|
|
2023
|
-
|
|
2024
|
-
|
|
2023
|
+
D("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
2024
|
+
k(D("ins[eé]rer", { flags: "i" }), D("ajouter", { flags: "i" })),
|
|
2025
2025
|
Y,
|
|
2026
2026
|
J
|
|
2027
|
-
], { value: (e,
|
|
2027
|
+
], { value: (e, t) => W(t, {
|
|
2028
2028
|
contextText: q(e[0]),
|
|
2029
2029
|
insertCitation: e[7].citation,
|
|
2030
|
-
kind:
|
|
2030
|
+
kind: C(e[1]),
|
|
2031
2031
|
targetReference: X(e[0]) ?? e[3]
|
|
2032
|
-
}) }), Fr =
|
|
2032
|
+
}) }), Fr = k(Mr, kr, Ar, jr, Or, j([
|
|
2033
2033
|
K,
|
|
2034
|
-
|
|
2034
|
+
d,
|
|
2035
2035
|
A,
|
|
2036
2036
|
Sr,
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2037
|
+
D("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
|
|
2038
|
+
k(j([
|
|
2039
|
+
D("supprimer", {
|
|
2040
2040
|
flags: "i",
|
|
2041
2041
|
value: "delete_portion"
|
|
2042
2042
|
}),
|
|
@@ -2045,8 +2045,8 @@ var wr = O([lr, k("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2045
2045
|
], { value: (e) => ({
|
|
2046
2046
|
kind: e[0],
|
|
2047
2047
|
...e[2]
|
|
2048
|
-
}) }),
|
|
2049
|
-
|
|
2048
|
+
}) }), j([
|
|
2049
|
+
D("r[eé]diger\\s+ainsi", {
|
|
2050
2050
|
flags: "i",
|
|
2051
2051
|
value: "rewrite_portion"
|
|
2052
2052
|
}),
|
|
@@ -2069,24 +2069,24 @@ var wr = O([lr, k("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2069
2069
|
targetReference: X(e[0]) ?? n.targetReference,
|
|
2070
2070
|
targetScope: n.targetScope
|
|
2071
2071
|
});
|
|
2072
|
-
} }), Nr, Pr,
|
|
2072
|
+
} }), Nr, Pr, j([
|
|
2073
2073
|
lr,
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2074
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
2075
|
+
D(`[\\s\\S]*?(?=${f})`, { flags: "i" }),
|
|
2076
|
+
d,
|
|
2077
2077
|
Y,
|
|
2078
|
-
|
|
2078
|
+
v,
|
|
2079
2079
|
Y,
|
|
2080
|
-
|
|
2081
|
-
], { value: (e,
|
|
2080
|
+
v
|
|
2081
|
+
], { value: (e, t) => W(t, {
|
|
2082
2082
|
contextText: e[0],
|
|
2083
2083
|
insertCitation: e[8],
|
|
2084
|
-
kind:
|
|
2084
|
+
kind: C(e[3]),
|
|
2085
2085
|
targetCitation: e[6]
|
|
2086
|
-
}) }), Dr, Er,
|
|
2086
|
+
}) }), Dr, Er, j([
|
|
2087
2087
|
K,
|
|
2088
|
-
|
|
2089
|
-
|
|
2088
|
+
D("compl[eé]ter", { flags: "i" }),
|
|
2089
|
+
O(j([A, G], { value: (e) => e[1] }), { default: null }),
|
|
2090
2090
|
Y,
|
|
2091
2091
|
J
|
|
2092
2092
|
], { value: (e, t) => W(t, {
|
|
@@ -2113,7 +2113,7 @@ function Rr(e, t) {
|
|
|
2113
2113
|
} : null;
|
|
2114
2114
|
}
|
|
2115
2115
|
function zr(e, t) {
|
|
2116
|
-
return
|
|
2116
|
+
return me(ge(e), t);
|
|
2117
2117
|
}
|
|
2118
2118
|
function Br(e) {
|
|
2119
2119
|
return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
|
|
@@ -2160,7 +2160,7 @@ function Wr(e, t, n, r = Lr(e.slice(n.start, n.stop))) {
|
|
|
2160
2160
|
function Gr(e) {
|
|
2161
2161
|
let t = e.dispositifHtml ?? e.dispositifText;
|
|
2162
2162
|
if (!t) return null;
|
|
2163
|
-
let n = e.dispositifHtml ?
|
|
2163
|
+
let n = e.dispositifHtml ? ye()(t) : pe(t), r = n.output, i = Rr(r, {
|
|
2164
2164
|
start: 0,
|
|
2165
2165
|
stop: r.length
|
|
2166
2166
|
});
|
|
@@ -2182,7 +2182,7 @@ function Q(e) {
|
|
|
2182
2182
|
return t === void 0 ? [] : Array.from({ length: e.count }, (e, n) => t + n);
|
|
2183
2183
|
}
|
|
2184
2184
|
if (e.type === "exclusion") return Q(e.left);
|
|
2185
|
-
for (let t of
|
|
2185
|
+
for (let t of r(e)) if (t.type === "alinéa" && typeof t.index == "number" && t.index > 0) return [t.index];
|
|
2186
2186
|
return [];
|
|
2187
2187
|
}
|
|
2188
2188
|
function Kr(e, t) {
|
|
@@ -2236,19 +2236,19 @@ function $r(e, t) {
|
|
|
2236
2236
|
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), Rr(e, n);
|
|
2237
2237
|
}
|
|
2238
2238
|
function ei(e) {
|
|
2239
|
-
return
|
|
2239
|
+
return g(e);
|
|
2240
2240
|
}
|
|
2241
2241
|
function ti(e, t) {
|
|
2242
2242
|
return Fr(new E(e.slice(0, t.stop), t.start)) ?? null;
|
|
2243
2243
|
}
|
|
2244
|
-
function $(
|
|
2245
|
-
if (
|
|
2244
|
+
function $(t, n, r) {
|
|
2245
|
+
if (r) return Wr(t, n, r.position, Lr(e(t, r)));
|
|
2246
2246
|
}
|
|
2247
2247
|
function ni(e, t) {
|
|
2248
2248
|
if (!e) return;
|
|
2249
|
-
let
|
|
2250
|
-
for (let e of n
|
|
2251
|
-
return
|
|
2249
|
+
let n = structuredClone(e);
|
|
2250
|
+
for (let e of _(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = zr(t, e.position));
|
|
2251
|
+
return n;
|
|
2252
2252
|
}
|
|
2253
2253
|
function ri(e, t, n, r) {
|
|
2254
2254
|
let i = $r(e, n);
|
|
@@ -2451,7 +2451,7 @@ function oi(e) {
|
|
|
2451
2451
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
2452
2452
|
}
|
|
2453
2453
|
function si(e) {
|
|
2454
|
-
let t =
|
|
2454
|
+
let t = w(e);
|
|
2455
2455
|
if (!t) return {
|
|
2456
2456
|
articleNumber: null,
|
|
2457
2457
|
label: e,
|
|
@@ -2465,7 +2465,7 @@ function si(e) {
|
|
|
2465
2465
|
};
|
|
2466
2466
|
}
|
|
2467
2467
|
function ci(e) {
|
|
2468
|
-
let t =
|
|
2468
|
+
let t = T(e), n = [], r = oi(t("section.akn-preamble").text());
|
|
2469
2469
|
return r && n.push({
|
|
2470
2470
|
anchor: "senat-expose-des-motifs",
|
|
2471
2471
|
articleNumber: null,
|
|
@@ -2490,7 +2490,7 @@ function ci(e) {
|
|
|
2490
2490
|
}), n;
|
|
2491
2491
|
}
|
|
2492
2492
|
function li(e, t) {
|
|
2493
|
-
return
|
|
2493
|
+
return De("sha256").update(JSON.stringify({
|
|
2494
2494
|
item: e,
|
|
2495
2495
|
metadata: t
|
|
2496
2496
|
})).digest("hex");
|
|
@@ -21622,7 +21622,7 @@ function Ci(e) {
|
|
|
21622
21622
|
return null;
|
|
21623
21623
|
}
|
|
21624
21624
|
function wi(e) {
|
|
21625
|
-
return
|
|
21625
|
+
return Ee.createHash("md5").update(e).digest("hex");
|
|
21626
21626
|
}
|
|
21627
21627
|
function Ti(e) {
|
|
21628
21628
|
return e ? /font-weight\s*:\s*(bold|[6-9]00|1000)/i.test(e) || /font-family\s*:\s*[^;]*\bBold\b/i.test(e) : !1;
|
|
@@ -21694,7 +21694,7 @@ function Mi(e) {
|
|
|
21694
21694
|
return null;
|
|
21695
21695
|
}
|
|
21696
21696
|
function Ni(e, t = {}) {
|
|
21697
|
-
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a =
|
|
21697
|
+
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = T(e, { xml: { decodeEntities: !1 } });
|
|
21698
21698
|
a("style, script, meta, link").remove(), a(".assnatHeader, .assnatFooter, .assnatHeaderLeft, .assnatHeaderandFooter").remove(), a(".assnatFARSautApres, .assnatFARSautAvant, .assnatFARSautPageNiv0, .assnatFARSautPageNiv1, .assnatFARSautPageNiv1PG").remove(), a(".assnatFARTT08Bleu").each((e, t) => {
|
|
21699
21699
|
let n = a(t).closest("table");
|
|
21700
21700
|
n.length > 0 && n.remove();
|
|
@@ -21947,15 +21947,15 @@ ${Ni(e, t)}
|
|
|
21947
21947
|
//#region src/lib/server/text_parsers/transformers.ts
|
|
21948
21948
|
function Ri(e, t) {
|
|
21949
21949
|
let n = "transformation_", r = {};
|
|
21950
|
-
for (let e of
|
|
21950
|
+
for (let e of M.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
|
|
21951
21951
|
let i = e.slice(15, -5), a = i.split(".").map((e) => parseInt(e) - 1), o = r;
|
|
21952
21952
|
for (let e of a.slice(1)) {
|
|
21953
21953
|
let t = o.transformations ??= [];
|
|
21954
21954
|
for (; e >= t.length;) t.push({});
|
|
21955
21955
|
o = t[e];
|
|
21956
21956
|
}
|
|
21957
|
-
o.output =
|
|
21958
|
-
let { sourceMap: s, title: c } =
|
|
21957
|
+
o.output = M.readFileSync(Oe.join(t, `${n}${i}.html`), { encoding: "utf-8" });
|
|
21958
|
+
let { sourceMap: s, title: c } = M.readJsonSync(Oe.join(t, e), { encoding: "utf-8" });
|
|
21959
21959
|
o.sourceMap = s ?? [], o.title = c;
|
|
21960
21960
|
}
|
|
21961
21961
|
return zi(r, e), r;
|
|
@@ -21965,7 +21965,7 @@ function zi(e, t) {
|
|
|
21965
21965
|
return t;
|
|
21966
21966
|
}
|
|
21967
21967
|
function Bi(e, t, n = "1") {
|
|
21968
|
-
if (
|
|
21968
|
+
if (M.ensureDirSync(t), e.transformations === void 0) M.writeJsonSync(Oe.join(t, `transformation_${n}.json`), {
|
|
21969
21969
|
sourceMap: e.sourceMap,
|
|
21970
21970
|
title: e.title
|
|
21971
21971
|
}, {
|
|
@@ -21973,24 +21973,24 @@ function Bi(e, t, n = "1") {
|
|
|
21973
21973
|
spaces: 2
|
|
21974
21974
|
});
|
|
21975
21975
|
else {
|
|
21976
|
-
|
|
21976
|
+
M.writeJsonSync(Oe.join(t, `transformation_${n}.json`), { title: e.title }, {
|
|
21977
21977
|
encoding: "utf-8",
|
|
21978
21978
|
spaces: 2
|
|
21979
21979
|
});
|
|
21980
21980
|
for (let [r, i] of e.transformations.entries()) Bi(i, t, `${n}.${r + 1}`);
|
|
21981
21981
|
}
|
|
21982
|
-
e.output !== void 0 &&
|
|
21982
|
+
e.output !== void 0 && M.writeFileSync(Oe.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
|
|
21983
21983
|
}
|
|
21984
21984
|
//#endregion
|
|
21985
21985
|
//#region src/lib/server/linkers/html.ts
|
|
21986
21986
|
async function Vi({ 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 }) {
|
|
21987
|
-
let _ = t ?? (e === void 0 ? void 0 : new
|
|
21987
|
+
let _ = t ?? (e === void 0 ? void 0 : new oe(e));
|
|
21988
21988
|
if (_ === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
21989
|
-
let v = await
|
|
21990
|
-
a === void 0 ? (y =
|
|
21989
|
+
let v = await M.readFile(i, { encoding: "utf-8" }), y;
|
|
21990
|
+
a === void 0 ? (y = ye({ removeAWithHref: !0 })(v), o !== void 0 && Bi(y, o)) : y = Ri(v, a);
|
|
21991
21991
|
let b = [];
|
|
21992
21992
|
s !== void 0 && b.push("links"), c !== void 0 && b.push("links_or_references"), u !== void 0 && b.push("references");
|
|
21993
|
-
let { outputByType: x, referredLegifranceTextCountByCid:
|
|
21993
|
+
let { outputByType: x, referredLegifranceTextCountByCid: ee } = await ce({
|
|
21994
21994
|
legiResolver: _,
|
|
21995
21995
|
date: n,
|
|
21996
21996
|
defaultTextId: r,
|
|
@@ -22003,13 +22003,13 @@ async function Vi({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
22003
22003
|
logReferences: h,
|
|
22004
22004
|
outputTypes: b,
|
|
22005
22005
|
referredLegifranceTextsInfos: g !== void 0
|
|
22006
|
-
}),
|
|
22007
|
-
s !== void 0 && (
|
|
22006
|
+
}), S = {};
|
|
22007
|
+
s !== void 0 && (S.links = s), c !== void 0 && (S.links_or_references = c), u !== void 0 && (S.references = u);
|
|
22008
22008
|
for (let [e, t] of Object.entries(x)) {
|
|
22009
|
-
let n =
|
|
22010
|
-
n !== void 0 && await
|
|
22009
|
+
let n = S[e];
|
|
22010
|
+
n !== void 0 && await M.writeFile(n, t.html, { encoding: "utf-8" });
|
|
22011
22011
|
}
|
|
22012
|
-
x.links !== void 0 && l !== void 0 && Bi(
|
|
22012
|
+
x.links !== void 0 && l !== void 0 && Bi(ye()(x.links.html), l), g !== void 0 && await M.writeJson(g, ee, {
|
|
22013
22013
|
encoding: "utf-8",
|
|
22014
22014
|
spaces: 2
|
|
22015
22015
|
});
|
|
@@ -22017,20 +22017,20 @@ async function Vi({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
22017
22017
|
//#endregion
|
|
22018
22018
|
//#region src/lib/server/tables_of_contents.ts
|
|
22019
22019
|
async function Hi(e, t, n, r) {
|
|
22020
|
-
let i = Ri(await
|
|
22021
|
-
for await (let e of
|
|
22020
|
+
let i = Ri(await M.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new E(a), s = await M.readJson(n, { encoding: "utf-8" });
|
|
22021
|
+
for await (let e of se({
|
|
22022
22022
|
context: o,
|
|
22023
22023
|
tableOfContents: s,
|
|
22024
22024
|
transformation: i
|
|
22025
22025
|
}));
|
|
22026
|
-
await
|
|
22026
|
+
await M.writeJson(r, s, {
|
|
22027
22027
|
encoding: "utf-8",
|
|
22028
22028
|
spaces: 2
|
|
22029
22029
|
});
|
|
22030
22030
|
}
|
|
22031
22031
|
async function Ui(e, t, n) {
|
|
22032
|
-
let r = Ri(await
|
|
22033
|
-
await
|
|
22032
|
+
let r = Ri(await M.readFile(e, { encoding: "utf-8" }), t).output, i = b(r);
|
|
22033
|
+
await M.writeJson(n, i, {
|
|
22034
22034
|
encoding: "utf-8",
|
|
22035
22035
|
spaces: 2
|
|
22036
22036
|
});
|
|
@@ -22038,7 +22038,7 @@ async function Ui(e, t, n) {
|
|
|
22038
22038
|
//#endregion
|
|
22039
22039
|
//#region src/lib/server/legi/resolvers.ts
|
|
22040
22040
|
function Wi({ canutesDb: e }) {
|
|
22041
|
-
return new
|
|
22041
|
+
return new oe(e);
|
|
22042
22042
|
}
|
|
22043
22043
|
//#endregion
|
|
22044
|
-
export {
|
|
22044
|
+
export { we as LegiResolver, Vi as addLinksOrReferencesToHtmlFile, Hi as addPositionsToTableOfContentsFile, be as buildAndInstallTextTitlesInfos, Ce as buildTextTitlesInfos, Wi as createLegiResolver, Me as extractAssembleeAmendmentSearchItems, er as extractAssembleeExposesDesMotifs, ar as extractSenatAmendmentSearchItems, Ne as hashAssembleeAmendmentSearchItem, nr as hashAssembleeSearchItem, or as hashSenatAmendmentSearchItem, li as hashSenatSearchItem, hi as isAkomaNtosoXml, rr as isoDateFromAssembleeDocument, Xn as linkAkomaNtosoBillRaw, rn as linkAssembleeBillRaw, Yn as parseAkomaNtosoBillRaw, ai as parseAmendment, nn as parseAssembleeBillRaw, tr as parseAssembleeDocumentSearchContent, ci as parseSenatDocumentSearchContent, Ri as readTransformation, Gn as renderAkomaNtosoBillRaw, mi as resolveSenatAkomaNtosoSource, Ui as simplifiedHtmlBillFileToTableOfContentsFile, Ni as simplifyWordHtml, Li as simplifyWordHtmlToDocument, Bi as writeTransformation };
|