@tricoteuses/tisseuse 0.14.12 → 0.14.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -5
- package/dist/{html-Bos7PYtS.js → html-CnfkCnJt.js} +5459 -5056
- package/dist/index.js +116 -116
- package/dist/{resolver-D5TCkLkD.js → resolver-CuP8arVX.js} +189 -131
- package/dist/server-f-legi.js +242 -122
- package/dist/server.js +883 -734
- package/dist/src/lib/extractors/action_directives.d.ts +33 -1
- package/dist/src/lib/extractors/links.d.ts +41 -1
- package/dist/src/lib/extractors/references.d.ts +12 -3
- package/dist/src/lib/f_legi/resolver.d.ts +7 -1
- package/dist/src/lib/legi/text_titles_infos.d.ts +3 -0
- package/dist/src/lib/text_parsers/parsers.d.ts +20 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { C as e, D as t, E as n, I as r, K as i, Mt as a, Nt as o, O as s, St as c, T as l, Tt as u, X as d, Y as f, b as p, bt as m, et as h, f as g, g as _, ht as v, k as y, l as b, n as x, nt as S, o as ee, p as C, s as te, t as ne, w as re, x as ie, xt as w, y as ae, yt as oe } from "./html-CnfkCnJt.js";
|
|
2
|
+
import { Dt as T, Et as E, F as se, N as ce, Nt as D, O as le, Tt as ue, ct as de, et as fe, ht as pe, jt as O, k as me, n as he, o as ge, r as _e, t as ve, vt as k } from "./resolver-CuP8arVX.js";
|
|
3
3
|
import * as ye from "node:crypto";
|
|
4
|
-
import { createHash as
|
|
4
|
+
import { createHash as be } from "node:crypto";
|
|
5
5
|
import A from "fs-extra";
|
|
6
6
|
import j from "node:path";
|
|
7
7
|
//#region src/lib/server/assemblee_amendment_search.ts
|
|
8
|
-
function
|
|
8
|
+
function xe(e, t) {
|
|
9
9
|
let n = e;
|
|
10
10
|
for (let e of t) {
|
|
11
11
|
if (typeof n != "object" || !n) return null;
|
|
@@ -13,34 +13,34 @@ function M(e, t) {
|
|
|
13
13
|
}
|
|
14
14
|
return typeof n == "string" && n.trim() ? n.trim() : null;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function Se(e) {
|
|
17
17
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
19
|
+
function Ce(e) {
|
|
20
|
+
return Se(S(e).text());
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
let t =
|
|
24
|
-
|
|
22
|
+
function we(e) {
|
|
23
|
+
let t = Se([
|
|
24
|
+
xe(e, [
|
|
25
25
|
"corps",
|
|
26
26
|
"contenuAuteur",
|
|
27
27
|
"dispositif"
|
|
28
28
|
]),
|
|
29
|
-
|
|
29
|
+
xe(e, [
|
|
30
30
|
"corps",
|
|
31
31
|
"contenuAuteur",
|
|
32
32
|
"dispositifAmdtCreditPLF"
|
|
33
33
|
]),
|
|
34
|
-
|
|
34
|
+
xe(e, [
|
|
35
35
|
"corps",
|
|
36
36
|
"contenuAuteur",
|
|
37
37
|
"dispositifAmdtCreditPLFR"
|
|
38
38
|
])
|
|
39
|
-
].filter((e) => e !== null).map((e) =>
|
|
39
|
+
].filter((e) => e !== null).map((e) => Ce(e)).join("\n")), n = xe(e, [
|
|
40
40
|
"corps",
|
|
41
41
|
"contenuAuteur",
|
|
42
42
|
"exposeSommaire"
|
|
43
|
-
]), r = n === null ? "" :
|
|
43
|
+
]), r = n === null ? "" : Ce(n);
|
|
44
44
|
return [...t ? [{
|
|
45
45
|
content: t,
|
|
46
46
|
itemKind: "dispositif",
|
|
@@ -51,37 +51,37 @@ function Se(e) {
|
|
|
51
51
|
label: "Exposé sommaire"
|
|
52
52
|
}] : []];
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
54
|
+
function Te(e, t) {
|
|
55
|
+
return be("sha256").update(JSON.stringify({
|
|
56
56
|
item: e,
|
|
57
57
|
metadata: t
|
|
58
58
|
})).digest("hex");
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region src/lib/server/parsed_bills.ts
|
|
62
|
-
var
|
|
63
|
-
function
|
|
62
|
+
var Ee = /^expos[ée]\s+des\s+motifs\b/iu;
|
|
63
|
+
function M(e) {
|
|
64
64
|
return (e ?? "").replace(/\u00a0/g, " ").replace(/\s+/g, " ").trim();
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
66
|
+
function N(e) {
|
|
67
|
+
return M(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
69
|
+
function De(e) {
|
|
70
|
+
return oe(M(e));
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
return `_TocArt${
|
|
72
|
+
function Oe(e) {
|
|
73
|
+
return `_TocArt${De(e).replace(/\s+/gu, "")}`;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function ke(e, t) {
|
|
76
76
|
return e(t).closest(".assnatTOC6,.assnatTOC5,.assnatTOC4").length > 0;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
78
|
+
function Ae(e) {
|
|
79
|
+
return N(e).replace(/[‐‑‒–—]/gu, "-").replace(/\s*\.\s*/gu, ".");
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
81
|
+
function je(e) {
|
|
82
|
+
return Ae(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function Me(e) {
|
|
85
85
|
switch (e.kind) {
|
|
86
86
|
case "insert_after":
|
|
87
87
|
case "insert_before": return e.insertText;
|
|
@@ -99,12 +99,12 @@ function Ae(e) {
|
|
|
99
99
|
default: return;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
let t =
|
|
104
|
-
if (n?.[1] !== void 0) return
|
|
102
|
+
function Ne(e) {
|
|
103
|
+
let t = M(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);
|
|
104
|
+
if (n?.[1] !== void 0) return m(n[1]);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
let t =
|
|
106
|
+
function Pe(e) {
|
|
107
|
+
let t = Me(e), n = v(t ?? "");
|
|
108
108
|
if (n.length > 0 && t !== void 0) return n.map((e, r) => {
|
|
109
109
|
let i = e.start, a = n[r + 1]?.start ?? t.length, o = t.slice(i, a).trim();
|
|
110
110
|
return {
|
|
@@ -112,58 +112,58 @@ function Me(e) {
|
|
|
112
112
|
text: o
|
|
113
113
|
};
|
|
114
114
|
});
|
|
115
|
-
let r =
|
|
115
|
+
let r = Ne(e);
|
|
116
116
|
return r === void 0 ? [] : [{
|
|
117
117
|
num: r,
|
|
118
118
|
text: t ?? e.sourceText
|
|
119
119
|
}];
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function Fe(e, t = /* @__PURE__ */ new Set()) {
|
|
122
122
|
if (e == null) return t;
|
|
123
123
|
if (Array.isArray(e)) {
|
|
124
|
-
for (let n of e)
|
|
124
|
+
for (let n of e) Fe(n, t);
|
|
125
125
|
return t;
|
|
126
126
|
}
|
|
127
127
|
if (typeof e != "object") return t;
|
|
128
128
|
let n = e;
|
|
129
129
|
n.type === "article" && typeof n.num == "string" && t.add(n.num);
|
|
130
|
-
for (let e of Object.values(n))
|
|
130
|
+
for (let e of Object.values(n)) Fe(e, t);
|
|
131
131
|
return t;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
let t =
|
|
133
|
+
function Ie(e) {
|
|
134
|
+
let t = N(e.sourceText);
|
|
135
135
|
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);
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
return
|
|
137
|
+
function Le(e) {
|
|
138
|
+
return M(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
let n = new
|
|
140
|
+
function Re(e, t) {
|
|
141
|
+
let n = new ue(e, t), r = fe(n);
|
|
142
142
|
return typeof r != "string" || n.offset <= t ? null : {
|
|
143
143
|
date: r,
|
|
144
144
|
start: t,
|
|
145
145
|
stop: n.offset
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function ze(e, t) {
|
|
149
149
|
let n = /\d/u.exec(e.slice(t));
|
|
150
150
|
if (!n) return null;
|
|
151
151
|
let r = t + n.index;
|
|
152
|
-
return e.slice(t, r).trim().length > 0 ? null :
|
|
152
|
+
return e.slice(t, r).trim().length > 0 ? null : Re(e, r);
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function Be(e) {
|
|
155
155
|
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);
|
|
156
156
|
for (; o !== -1;) {
|
|
157
157
|
let s = e.indexOf(a, o + 15), c = e.slice(o, o + 1400), l = t.exec(c);
|
|
158
158
|
if (l) {
|
|
159
|
-
let e =
|
|
159
|
+
let e = ze(c, l[0].length);
|
|
160
160
|
e && i.push(e.date);
|
|
161
161
|
}
|
|
162
162
|
let u = n.exec(c);
|
|
163
163
|
if (u) {
|
|
164
164
|
let e = /\barticle\s+\w/iu.exec(c), t = e === null ? c.slice(u[0].length) : c.slice(u[0].length, e.index);
|
|
165
165
|
for (r.lastIndex = 0; r.exec(t) !== null;) {
|
|
166
|
-
let e =
|
|
166
|
+
let e = ze(t, r.lastIndex);
|
|
167
167
|
e && /^\s+pour\s+les\s+autres\s+dispositions\s+fiscales\b/iu.test(t.slice(e.stop)) && i.push(e.date);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
@@ -171,20 +171,20 @@ function Re(e) {
|
|
|
171
171
|
}
|
|
172
172
|
return i;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
let t =
|
|
174
|
+
function Ve(e) {
|
|
175
|
+
let t = Be(Le(e).toLowerCase()), n = Array.from(new Set(t));
|
|
176
176
|
return n.length === 1 ? n[0] : void 0;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
return
|
|
178
|
+
function He(e) {
|
|
179
|
+
return N(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-").replace(/^(?:(?:article\s+[^:]+|[a-z][.)]|[ivxlcdm]+\.|\d+°)\s*(?:-\s*)?)+/iu, "");
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function P(e) {
|
|
182
182
|
return e?.type === "tag";
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function Ue(e, t) {
|
|
185
185
|
return e.html(t) ?? "";
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function We(e, t) {
|
|
188
188
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
189
189
|
for (let i of e(t).find("a").get()) {
|
|
190
190
|
let a = e(i).attr("href") ?? "", o = /\/legifrance\/(articles|sections|textes)\/([^?#"]+)/u.exec(a);
|
|
@@ -192,46 +192,46 @@ function He(e, t) {
|
|
|
192
192
|
let s = o[1] === "articles" ? "article" : o[1] === "sections" ? "division" : "text", c = o[2].replace(/\.md$/u, ""), l = `${s}\0${c}`;
|
|
193
193
|
if (r.has(l)) continue;
|
|
194
194
|
r.add(l);
|
|
195
|
-
let u =
|
|
195
|
+
let u = M(e(i).text());
|
|
196
196
|
n.push({
|
|
197
197
|
id: c,
|
|
198
|
-
...
|
|
198
|
+
...Ge(e, t, i) ? { insideFrenchQuotes: !0 } : {},
|
|
199
199
|
...u ? { text: u } : {},
|
|
200
200
|
type: s
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
return n;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
let r =
|
|
205
|
+
function Ge(e, t, n) {
|
|
206
|
+
let r = Ke(e, t, n);
|
|
207
207
|
return (r.match(/«/gu) ?? []).length > (r.match(/»/gu) ?? []).length;
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function Ke(e, t, n) {
|
|
210
210
|
if (t === n) return "";
|
|
211
211
|
if (t.type === "text") return t.data ?? "";
|
|
212
|
-
if (!
|
|
212
|
+
if (!P(t)) return "";
|
|
213
213
|
let r = "";
|
|
214
214
|
for (let i of e(t).contents().get()) {
|
|
215
215
|
if (i === n) return r;
|
|
216
|
-
if (
|
|
216
|
+
if (P(i) && e.contains(i, n)) return r + Ke(e, i, n);
|
|
217
217
|
r += e(i).text();
|
|
218
218
|
}
|
|
219
219
|
return r;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
return t.map((t) =>
|
|
221
|
+
function qe(e, t) {
|
|
222
|
+
return t.map((t) => M(e(t).text())).filter(Boolean).join("\n");
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
let t =
|
|
226
|
-
return !t ||
|
|
224
|
+
function Je(e) {
|
|
225
|
+
let t = N(e);
|
|
226
|
+
return !t || Ee.test(t) ? "noise" : l.test(e) ? "directive_candidate" : "context";
|
|
227
227
|
}
|
|
228
|
-
async function
|
|
228
|
+
async function Ye(e, t, n) {
|
|
229
229
|
if (n === void 0) throw Error("A document date is required to add links to legal references.");
|
|
230
230
|
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.");
|
|
231
|
-
let { output: r } = await
|
|
231
|
+
let { output: r } = await x({
|
|
232
232
|
date: n,
|
|
233
233
|
html: e,
|
|
234
|
-
legiResolver: t.legiResolver ?? new
|
|
234
|
+
legiResolver: t.legiResolver ?? new g(t.canutesDb),
|
|
235
235
|
linkBaseUrl: t.linkBaseUrl,
|
|
236
236
|
linkType: t.linkType,
|
|
237
237
|
logIgnoredReferencesTypes: t.logIgnoredReferencesTypes,
|
|
@@ -240,13 +240,13 @@ async function qe(e, t, n) {
|
|
|
240
240
|
});
|
|
241
241
|
return r ?? e;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function Xe(e, t) {
|
|
244
244
|
let n = e(t).closest("h1,h2,h3,h4,h5,h6,p,td,th").get(0), r = e(t).closest("table").get(0);
|
|
245
|
-
return
|
|
245
|
+
return P(r) && P(n) && e(n).parents("table").get(0) === r ? r : P(n) ? n : t;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Ze(e, t, n, r) {
|
|
248
248
|
if (t.has(r.container)) return;
|
|
249
|
-
let i = r.id ??
|
|
249
|
+
let i = r.id ?? Oe(r.num ?? r.label);
|
|
250
250
|
n.has(i) || (n.add(i), t.add(r.container), e.push({
|
|
251
251
|
id: i,
|
|
252
252
|
label: r.label,
|
|
@@ -256,16 +256,25 @@ function Ye(e, t, n, r) {
|
|
|
256
256
|
container: r.container
|
|
257
257
|
}));
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function Qe(e) {
|
|
260
|
+
let t = /* @__PURE__ */ new Map();
|
|
261
|
+
return e("body *").each((e, n) => {
|
|
262
|
+
t.set(n, e);
|
|
263
|
+
}), t;
|
|
264
|
+
}
|
|
265
|
+
function F(e, t) {
|
|
266
|
+
return e.get(t) ?? 2 ** 53 - 1;
|
|
267
|
+
}
|
|
268
|
+
function $e(e) {
|
|
260
269
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
261
270
|
e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
|
|
262
|
-
if (
|
|
263
|
-
let o =
|
|
271
|
+
if (ke(e, a)) return;
|
|
272
|
+
let o = w(M(e(a).text()));
|
|
264
273
|
if (!o) return;
|
|
265
274
|
let s = e(a).attr("id");
|
|
266
275
|
if (!s || r.has(s)) return;
|
|
267
|
-
let c =
|
|
268
|
-
|
|
276
|
+
let c = Xe(e, a);
|
|
277
|
+
Ze(t, n, r, {
|
|
269
278
|
id: s,
|
|
270
279
|
...o,
|
|
271
280
|
element: a,
|
|
@@ -273,37 +282,37 @@ function Xe(e) {
|
|
|
273
282
|
});
|
|
274
283
|
}), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((i, a) => {
|
|
275
284
|
if (n.has(a)) return;
|
|
276
|
-
let o =
|
|
277
|
-
o &&
|
|
285
|
+
let o = w(M(e(a).text()));
|
|
286
|
+
o && Ze(t, n, r, {
|
|
278
287
|
...o,
|
|
279
288
|
element: a,
|
|
280
289
|
container: a
|
|
281
290
|
});
|
|
282
291
|
});
|
|
283
|
-
let i = e
|
|
284
|
-
return t.sort((e, t) => i
|
|
292
|
+
let i = Qe(e);
|
|
293
|
+
return t.sort((e, t) => F(i, e.container) - F(i, t.container)), t;
|
|
285
294
|
}
|
|
286
|
-
function
|
|
287
|
-
if (
|
|
295
|
+
function et(e, t) {
|
|
296
|
+
if (ke(e, t)) return !1;
|
|
288
297
|
let n = t.tagName?.toLowerCase();
|
|
289
298
|
if (n !== "p") return /^h[1-6]$/u.test(n ?? "");
|
|
290
299
|
let r = e(t).attr("style") ?? "", i = e(t).html() ?? "";
|
|
291
300
|
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));
|
|
292
301
|
}
|
|
293
|
-
function
|
|
302
|
+
function tt(e) {
|
|
294
303
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
295
304
|
return e("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6,p").each((i, a) => {
|
|
296
|
-
if (
|
|
297
|
-
let o =
|
|
298
|
-
o &&
|
|
305
|
+
if (ke(e, a) || !e(a).hasClass("assnat9ArticleNum") && !et(e, a)) return;
|
|
306
|
+
let o = w(e(a).text());
|
|
307
|
+
o && Ze(t, n, r, {
|
|
299
308
|
...o,
|
|
300
309
|
element: a,
|
|
301
310
|
container: a
|
|
302
311
|
});
|
|
303
312
|
}), t;
|
|
304
313
|
}
|
|
305
|
-
function
|
|
306
|
-
let t =
|
|
314
|
+
function nt(e) {
|
|
315
|
+
let t = N(De(e ?? "")).replace(/[()]/gu, "").trim();
|
|
307
316
|
if (!t || t === "liminaire") return;
|
|
308
317
|
if (t === "unique") return {
|
|
309
318
|
base: 1,
|
|
@@ -312,21 +321,21 @@ function $e(e) {
|
|
|
312
321
|
};
|
|
313
322
|
let n = /^(?:(\d+)|1er|premier)(?:\s+([a-z]+))?$/u.exec(t);
|
|
314
323
|
if (!n) return;
|
|
315
|
-
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 :
|
|
324
|
+
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 : rt(i);
|
|
316
325
|
if (a !== void 0) return {
|
|
317
326
|
base: r,
|
|
318
327
|
suffixOrder: a,
|
|
319
328
|
text: t
|
|
320
329
|
};
|
|
321
330
|
}
|
|
322
|
-
function
|
|
323
|
-
let t = new
|
|
331
|
+
function rt(e) {
|
|
332
|
+
let t = new ue(e), n = de(t);
|
|
324
333
|
if (!(n === void 0 || t.offset !== e.length) && !(typeof n != "object" || !n || !("value" in n) || typeof n.value != "number")) return n.value - 1;
|
|
325
334
|
}
|
|
326
|
-
function
|
|
335
|
+
function it(e) {
|
|
327
336
|
let t = [], n = e.map((e) => ({
|
|
328
337
|
heading: e,
|
|
329
|
-
token:
|
|
338
|
+
token: nt(e.num)
|
|
330
339
|
}));
|
|
331
340
|
n.filter(({ token: e }) => e?.text === "unique").length > 0 && e.length > 1 && t.push("Article unique appears with other articles");
|
|
332
341
|
let r;
|
|
@@ -339,31 +348,31 @@ function tt(e) {
|
|
|
339
348
|
}
|
|
340
349
|
t.length > 0 && process.env.TISSEUSE_WARN_ASSEMBLEE_HEADING_SEQUENCE === "1" && console.warn("Incoherent Assemblée article heading sequence", { issues: t });
|
|
341
350
|
}
|
|
342
|
-
function
|
|
343
|
-
let n =
|
|
344
|
-
if (n.length > 0) return t &&
|
|
345
|
-
let r =
|
|
346
|
-
return t &&
|
|
351
|
+
function at(e, { warn: t = !0 } = {}) {
|
|
352
|
+
let n = $e(e);
|
|
353
|
+
if (n.length > 0) return t && it(n), n;
|
|
354
|
+
let r = tt(e);
|
|
355
|
+
return t && it(r), r;
|
|
347
356
|
}
|
|
348
|
-
function
|
|
357
|
+
function ot(e) {
|
|
349
358
|
let t = e.next;
|
|
350
359
|
for (; t !== null;) {
|
|
351
|
-
if (
|
|
360
|
+
if (P(t)) return t;
|
|
352
361
|
t = t.next;
|
|
353
362
|
}
|
|
354
363
|
return null;
|
|
355
364
|
}
|
|
356
|
-
function
|
|
357
|
-
let
|
|
358
|
-
for (let e =
|
|
359
|
-
if (
|
|
360
|
-
let
|
|
361
|
-
return e("body > *").get().filter((
|
|
362
|
-
let
|
|
363
|
-
return
|
|
365
|
+
function st(e, t, n, r = Qe(e)) {
|
|
366
|
+
let i = [t.container], a = n?.container;
|
|
367
|
+
for (let e = ot(t.container); e !== null && e !== a; e = ot(e)) i.push(e);
|
|
368
|
+
if (i.length > 1) return i;
|
|
369
|
+
let o = F(r, t.container), s = a ? F(r, a) : -1;
|
|
370
|
+
return e("body > *").get().filter((e) => {
|
|
371
|
+
let t = F(r, e);
|
|
372
|
+
return t >= o && (s === -1 || t < s);
|
|
364
373
|
});
|
|
365
374
|
}
|
|
366
|
-
function
|
|
375
|
+
function ct(e, t) {
|
|
367
376
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
368
377
|
for (let i of t) {
|
|
369
378
|
let t = "p,li,table", a = e(i).is(t) ? [i] : e(i).find(t).get();
|
|
@@ -371,76 +380,105 @@ function at(e, t) {
|
|
|
371
380
|
}
|
|
372
381
|
return n;
|
|
373
382
|
}
|
|
374
|
-
function
|
|
383
|
+
function lt(e, t, n) {
|
|
375
384
|
let r = [], i = !1;
|
|
376
|
-
for (let a of
|
|
377
|
-
let n =
|
|
385
|
+
for (let a of ct(e, n)) {
|
|
386
|
+
let n = M(e(a).text());
|
|
378
387
|
if (!n) continue;
|
|
379
|
-
|
|
380
|
-
let o = i ? "noise" :
|
|
388
|
+
Ee.test(n) && (i = !0);
|
|
389
|
+
let o = i ? "noise" : Je(n), s = `${t}-b${r.length + 1}`;
|
|
381
390
|
e(a).attr("data-pjl-parsed-article-id", t), e(a).attr("data-pjl-parsed-block-id", s), r.push({
|
|
382
391
|
id: s,
|
|
383
392
|
articleId: t,
|
|
384
393
|
kind: o,
|
|
385
|
-
links:
|
|
394
|
+
links: We(e, a),
|
|
386
395
|
text: n,
|
|
387
|
-
html:
|
|
396
|
+
html: Ue(e, a)
|
|
388
397
|
});
|
|
389
398
|
}
|
|
390
399
|
return r;
|
|
391
400
|
}
|
|
392
|
-
function
|
|
401
|
+
function ut(e, t) {
|
|
393
402
|
if (t.length === 0) return e;
|
|
394
403
|
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>`;
|
|
395
404
|
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}`;
|
|
396
405
|
}
|
|
397
|
-
function
|
|
398
|
-
let t =
|
|
399
|
-
for (let e of
|
|
400
|
-
let
|
|
401
|
-
|
|
406
|
+
function dt(e) {
|
|
407
|
+
let t = S(e), n = ft(t);
|
|
408
|
+
for (let e of at(t, { warn: !1 })) {
|
|
409
|
+
let r = Oe(e.num ?? e.label.replace(/^Article\s+/iu, "")), i = t(e.element), a = i.attr("id");
|
|
410
|
+
if (a !== r) {
|
|
411
|
+
if (a?.startsWith("_Toc") && !mt(n, a, e.element)) {
|
|
412
|
+
let e = t("<span></span>").attr("id", a);
|
|
413
|
+
i.before(e);
|
|
414
|
+
let r = e.get(0);
|
|
415
|
+
P(r) && I(n, a, r);
|
|
416
|
+
}
|
|
417
|
+
a && pt(n, a, e.element), i.attr("id", r), I(n, r, e.element);
|
|
418
|
+
}
|
|
402
419
|
}
|
|
403
|
-
let
|
|
404
|
-
for (let [e,
|
|
405
|
-
let
|
|
406
|
-
for (let e of
|
|
407
|
-
let
|
|
408
|
-
if (!
|
|
409
|
-
let i = `${
|
|
410
|
-
if (
|
|
411
|
-
let
|
|
412
|
-
|
|
420
|
+
let r = at(t), i = Qe(t);
|
|
421
|
+
for (let [e, a] of r.entries()) {
|
|
422
|
+
let o = st(t, a, r[e + 1], i).flatMap((e) => t(e).is("span.alinea[data-alinea]") ? [e] : t(e).find("span.alinea[data-alinea]").get());
|
|
423
|
+
for (let e of o) {
|
|
424
|
+
let r = t(e).attr("data-alinea")?.trim();
|
|
425
|
+
if (!r) continue;
|
|
426
|
+
let i = `${a.id}-alinea-${r.replace(/\s+/gu, "")}`;
|
|
427
|
+
if (mt(n, i, e)) continue;
|
|
428
|
+
let o = t(e).attr("id");
|
|
429
|
+
if (o && o !== i) {
|
|
430
|
+
let r = t("<span></span>").attr("id", i);
|
|
431
|
+
t(e).before(r);
|
|
432
|
+
let a = r.get(0);
|
|
433
|
+
P(a) && I(n, i, a);
|
|
434
|
+
} else o && pt(n, o, e), t(e).attr("id", i), I(n, i, e);
|
|
413
435
|
}
|
|
414
436
|
}
|
|
415
437
|
return t.html();
|
|
416
438
|
}
|
|
417
|
-
function
|
|
418
|
-
|
|
439
|
+
function ft(e) {
|
|
440
|
+
let t = /* @__PURE__ */ new Map();
|
|
441
|
+
for (let n of e("[id]").get()) {
|
|
442
|
+
let r = e(n).attr("id");
|
|
443
|
+
r && I(t, r, n);
|
|
444
|
+
}
|
|
445
|
+
return t;
|
|
446
|
+
}
|
|
447
|
+
function I(e, t, n) {
|
|
448
|
+
let r = e.get(t);
|
|
449
|
+
r === void 0 && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
450
|
+
}
|
|
451
|
+
function pt(e, t, n) {
|
|
452
|
+
let r = e.get(t);
|
|
453
|
+
r !== void 0 && (r.delete(n), r.size === 0 && e.delete(t));
|
|
454
|
+
}
|
|
455
|
+
function mt(e, t, n) {
|
|
456
|
+
for (let r of e.get(t) ?? []) if (r !== n) return !0;
|
|
419
457
|
return !1;
|
|
420
458
|
}
|
|
421
|
-
function
|
|
422
|
-
let n =
|
|
459
|
+
function ht(e, t) {
|
|
460
|
+
let n = He("sourceText" in t ? t.sourceText : "");
|
|
423
461
|
if (n) return e.filter((e) => e.kind === "directive_candidate").find((e) => {
|
|
424
|
-
let t =
|
|
462
|
+
let t = He(e.text);
|
|
425
463
|
return t.length > 0 && (n.includes(t) || t.includes(n));
|
|
426
464
|
});
|
|
427
465
|
}
|
|
428
|
-
function
|
|
466
|
+
function gt(e, t) {
|
|
429
467
|
if (t) return t.blockIds.map((t) => e.get(t)).find((e) => e?.kind === "directive_candidate");
|
|
430
468
|
}
|
|
431
|
-
function
|
|
469
|
+
function _t(e) {
|
|
432
470
|
return e?.links.filter((e) => !e.insideFrenchQuotes && (e.type === "article" || e.type === "division")).map((e) => e.id) ?? [];
|
|
433
471
|
}
|
|
434
|
-
function
|
|
435
|
-
let
|
|
436
|
-
if (!
|
|
437
|
-
let
|
|
438
|
-
return
|
|
472
|
+
function vt(e) {
|
|
473
|
+
let t = M(e);
|
|
474
|
+
if (!t) return;
|
|
475
|
+
let n = h(t);
|
|
476
|
+
return n ? n.level : t.endsWith(":") ? 0 : void 0;
|
|
439
477
|
}
|
|
440
|
-
function
|
|
478
|
+
function yt(e) {
|
|
441
479
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
442
480
|
for (let r of e) {
|
|
443
|
-
let e =
|
|
481
|
+
let e = vt(r.text);
|
|
444
482
|
if (e === void 0) {
|
|
445
483
|
t.set(r.id, [...n.map((e) => e.block), r]);
|
|
446
484
|
continue;
|
|
@@ -453,14 +491,14 @@ function mt(e) {
|
|
|
453
491
|
}
|
|
454
492
|
return t;
|
|
455
493
|
}
|
|
456
|
-
function
|
|
494
|
+
function bt(e, t) {
|
|
457
495
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
458
496
|
for (let i of [...e ?? [], ...t]) i !== void 0 && (r.has(i.id) || (r.add(i.id), n.push(i)));
|
|
459
497
|
return n;
|
|
460
498
|
}
|
|
461
|
-
function
|
|
499
|
+
function xt(e, t, n) {
|
|
462
500
|
if (!t) return;
|
|
463
|
-
let r =
|
|
501
|
+
let r = bt(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
|
|
464
502
|
if (r.length === 0) return;
|
|
465
503
|
let i = r.map((e) => e.id);
|
|
466
504
|
if (i.length === t.blockIds.length && i.every((e, n) => e === t.blockIds[n])) return;
|
|
@@ -475,7 +513,7 @@ function gt(e, t, n) {
|
|
|
475
513
|
}
|
|
476
514
|
};
|
|
477
515
|
}
|
|
478
|
-
function
|
|
516
|
+
function St(e) {
|
|
479
517
|
let t = [], n = 0;
|
|
480
518
|
for (let r of e.blocks) {
|
|
481
519
|
let i = e.directiveText.indexOf(r.text, n);
|
|
@@ -489,7 +527,7 @@ function _t(e) {
|
|
|
489
527
|
}
|
|
490
528
|
return t;
|
|
491
529
|
}
|
|
492
|
-
function
|
|
530
|
+
function Ct(e, t, n) {
|
|
493
531
|
let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop >= r && e.start <= i);
|
|
494
532
|
if (a.length === 0) return;
|
|
495
533
|
let o = a[0], s = a[a.length - 1], c = o.start, l = s.stop;
|
|
@@ -503,7 +541,7 @@ function vt(e, t, n) {
|
|
|
503
541
|
}
|
|
504
542
|
};
|
|
505
543
|
}
|
|
506
|
-
function
|
|
544
|
+
function wt(e, t, n) {
|
|
507
545
|
if (!t) return;
|
|
508
546
|
let r = e.directiveText.indexOf(t.text);
|
|
509
547
|
if (r === -1) return;
|
|
@@ -516,40 +554,52 @@ function yt(e, t, n) {
|
|
|
516
554
|
stop: a
|
|
517
555
|
};
|
|
518
556
|
}
|
|
519
|
-
function
|
|
520
|
-
let
|
|
557
|
+
function Tt(e, t) {
|
|
558
|
+
let n = performance.now(), r = performance.now(), i = St(e), a = performance.now() - r, o = performance.now(), s = new Map(e.blocks.map((e) => [e.id, e])), c = yt(e.blocks), l = /* @__PURE__ */ new Map(), u = [];
|
|
521
559
|
for (let t of e.blocks) {
|
|
522
|
-
let e =
|
|
523
|
-
e.length > 0 && (
|
|
560
|
+
let e = _t(t);
|
|
561
|
+
e.length > 0 && (u = e), l.set(t.id, u);
|
|
524
562
|
}
|
|
525
|
-
|
|
526
|
-
let
|
|
563
|
+
let d = performance.now() - o, f = performance.now(), p = C(), m = _(e.directiveText, t === void 0 ? void 0 : p), h = performance.now() - f, g = performance.now(), v = m.map((t) => {
|
|
564
|
+
let n = Ct(e, i, t), r = gt(s, n) ?? ht(e.blocks, t), a = _t(r), o = a.length > 0 ? a : r?.id === void 0 ? [] : l.get(r.id) ?? [], u = wt(e, r, t), d = xt(r?.id === void 0 ? void 0 : c.get(r.id), n, s);
|
|
527
565
|
return {
|
|
528
566
|
articleId: e.id,
|
|
529
|
-
blockId:
|
|
567
|
+
blockId: r?.id,
|
|
530
568
|
...u === void 0 ? {} : { sourceBlockPosition: u },
|
|
531
|
-
...
|
|
532
|
-
sourceBlockIds:
|
|
533
|
-
sourceBlockText:
|
|
534
|
-
sourceBlockHtml:
|
|
535
|
-
sourceBlockPosition:
|
|
569
|
+
...n === void 0 ? {} : {
|
|
570
|
+
sourceBlockIds: n.blockIds,
|
|
571
|
+
sourceBlockText: n.text,
|
|
572
|
+
sourceBlockHtml: n.html,
|
|
573
|
+
sourceBlockPosition: n.position
|
|
536
574
|
},
|
|
537
575
|
...d === void 0 ? {} : {
|
|
538
576
|
sourceContextBlockIds: d.blockIds,
|
|
539
577
|
sourceContextPosition: d.position
|
|
540
578
|
},
|
|
541
|
-
directive:
|
|
542
|
-
...
|
|
579
|
+
directive: t,
|
|
580
|
+
...o.length > 0 ? { targetIds: o } : {}
|
|
543
581
|
};
|
|
544
|
-
});
|
|
582
|
+
}), y = performance.now() - g;
|
|
583
|
+
return t?.push({
|
|
584
|
+
actionDirectiveExtraction: p,
|
|
585
|
+
articleId: e.id,
|
|
586
|
+
blockCount: e.blocks.length,
|
|
587
|
+
buildRangesMs: Math.round(a * 10) / 10,
|
|
588
|
+
directiveCount: v.length,
|
|
589
|
+
directiveTextSize: e.directiveText.length,
|
|
590
|
+
extractActionDirectivesMs: Math.round(h * 10) / 10,
|
|
591
|
+
mapDirectivesMs: Math.round(y * 10) / 10,
|
|
592
|
+
prepareBlockIndexesMs: Math.round(d * 10) / 10,
|
|
593
|
+
totalMs: Math.round((performance.now() - n) * 10) / 10
|
|
594
|
+
}), v;
|
|
545
595
|
}
|
|
546
|
-
function
|
|
596
|
+
function Et(e) {
|
|
547
597
|
let t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Set();
|
|
548
598
|
for (let i of e) {
|
|
549
|
-
let e =
|
|
599
|
+
let e = Pe(i.directive);
|
|
550
600
|
if (e.length === 0) continue;
|
|
551
601
|
let a = e.map(({ num: e }) => ({
|
|
552
|
-
definitionId: `${i.articleId}:article:${
|
|
602
|
+
definitionId: `${i.articleId}:article:${je(e)}`,
|
|
553
603
|
num: e
|
|
554
604
|
}));
|
|
555
605
|
t.set(i, a);
|
|
@@ -572,13 +622,13 @@ function xt(e) {
|
|
|
572
622
|
definitions: n
|
|
573
623
|
};
|
|
574
624
|
}
|
|
575
|
-
function
|
|
576
|
-
let r = new Map(t.map((e) => [
|
|
625
|
+
function Dt(e, t, n) {
|
|
626
|
+
let r = new Map(t.map((e) => [Ae(e.num), e]));
|
|
577
627
|
return e.map((e) => {
|
|
578
|
-
let t = n.get(e), i = t?.[0], a = [...
|
|
628
|
+
let t = n.get(e), i = t?.[0], a = [...Fe(e.directive.reference)].map((e) => r.get(Ae(e))).filter((e) => e !== void 0 && e.definitionId !== i?.definitionId)[0], o = a === void 0 ? void 0 : {
|
|
579
629
|
definitionId: a.definitionId,
|
|
580
630
|
num: a.num
|
|
581
|
-
}, s =
|
|
631
|
+
}, s = Ie(e.directive), c = (e.targetIds?.length ?? 0) > 0;
|
|
582
632
|
return {
|
|
583
633
|
...e,
|
|
584
634
|
...i === void 0 ? {} : { createdArticle: i },
|
|
@@ -591,7 +641,7 @@ function St(e, t, n) {
|
|
|
591
641
|
};
|
|
592
642
|
});
|
|
593
643
|
}
|
|
594
|
-
function
|
|
644
|
+
function Ot(e) {
|
|
595
645
|
switch (e.kind) {
|
|
596
646
|
case "insert_after":
|
|
597
647
|
case "insert_before": return [e.insertText];
|
|
@@ -609,8 +659,8 @@ function Ct(e) {
|
|
|
609
659
|
default: return [];
|
|
610
660
|
}
|
|
611
661
|
}
|
|
612
|
-
function
|
|
613
|
-
return e.flatMap((e) =>
|
|
662
|
+
function kt(e) {
|
|
663
|
+
return e.flatMap((e) => Ot(e.directive).filter((e) => /[«»]/u.test(e)).map((t) => ({
|
|
614
664
|
code: "nested_french_quote_in_redaction",
|
|
615
665
|
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.",
|
|
616
666
|
details: {
|
|
@@ -622,18 +672,18 @@ function wt(e) {
|
|
|
622
672
|
}
|
|
623
673
|
})));
|
|
624
674
|
}
|
|
625
|
-
function
|
|
626
|
-
return
|
|
675
|
+
function At(e) {
|
|
676
|
+
return Ot(e).map((t) => ({
|
|
627
677
|
directiveKind: e.kind,
|
|
628
678
|
text: t
|
|
629
679
|
}));
|
|
630
680
|
}
|
|
631
|
-
function
|
|
681
|
+
function jt(e) {
|
|
632
682
|
let t = /* @__PURE__ */ new Set();
|
|
633
683
|
for (let n of e.matchAll(/«[^«»\n]+»/gu)) t.add(n[0]);
|
|
634
684
|
return Array.from(t);
|
|
635
685
|
}
|
|
636
|
-
function
|
|
686
|
+
function Mt(e, t) {
|
|
637
687
|
let n = new Map(e.blocks.map((e) => [e.id, e])), r = t.sourceBlockIds ?? e.blocks.map((e) => e.id), i = [], a = 0;
|
|
638
688
|
for (let e of r) {
|
|
639
689
|
let t = n.get(e);
|
|
@@ -645,11 +695,11 @@ function Dt(e, t) {
|
|
|
645
695
|
}
|
|
646
696
|
return i;
|
|
647
697
|
}
|
|
648
|
-
function
|
|
698
|
+
function Nt(e, t, n) {
|
|
649
699
|
return e.find((e) => t >= e.start && n <= e.stop);
|
|
650
700
|
}
|
|
651
|
-
function
|
|
652
|
-
let r =
|
|
701
|
+
function Pt(e, t, n) {
|
|
702
|
+
let r = jt(n), i = r.flatMap((t) => {
|
|
653
703
|
for (let n of e.blocks) {
|
|
654
704
|
let e = n.text.indexOf(t);
|
|
655
705
|
if (e !== -1) return [{
|
|
@@ -668,7 +718,7 @@ function kt(e, t, n) {
|
|
|
668
718
|
e.directiveText
|
|
669
719
|
].filter((e) => e !== void 0 && e.length > 0), o = a.find((e) => r.some((t) => e.includes(t))) ?? a[0];
|
|
670
720
|
if (!o) return [];
|
|
671
|
-
let s =
|
|
721
|
+
let s = Mt(e, t);
|
|
672
722
|
if (s.length === 0) return [];
|
|
673
723
|
let c = [], l = 0;
|
|
674
724
|
for (let e of r) {
|
|
@@ -676,7 +726,7 @@ function kt(e, t, n) {
|
|
|
676
726
|
if (t === -1) continue;
|
|
677
727
|
let n = t + e.length;
|
|
678
728
|
l = n;
|
|
679
|
-
let r =
|
|
729
|
+
let r = Nt(s, t, n);
|
|
680
730
|
r && c.push({
|
|
681
731
|
blockId: r.block.id,
|
|
682
732
|
start: t - r.start,
|
|
@@ -686,15 +736,15 @@ function kt(e, t, n) {
|
|
|
686
736
|
}
|
|
687
737
|
return c;
|
|
688
738
|
}
|
|
689
|
-
function
|
|
739
|
+
function Ft(e, t) {
|
|
690
740
|
let n = new Map(e.map((e) => [e.id, e]));
|
|
691
741
|
return t.flatMap((e) => {
|
|
692
742
|
let t = n.get(e.articleId);
|
|
693
|
-
return t ?
|
|
743
|
+
return t ? At(e.directive).filter(({ text: e }) => /[«»]/u.test(e)).map(({ directiveKind: n, text: r }) => ({
|
|
694
744
|
articleId: e.articleId,
|
|
695
745
|
code: "nested_french_quote_in_redaction",
|
|
696
746
|
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.",
|
|
697
|
-
ranges:
|
|
747
|
+
ranges: Pt(t, e, r),
|
|
698
748
|
severity: "warning",
|
|
699
749
|
details: {
|
|
700
750
|
blockId: e.blockId,
|
|
@@ -705,41 +755,140 @@ function At(e, t) {
|
|
|
705
755
|
})) : [];
|
|
706
756
|
});
|
|
707
757
|
}
|
|
708
|
-
function
|
|
709
|
-
let c = i.map((e) => e.directiveText).filter(Boolean).join("\n"),
|
|
758
|
+
function It(e, t, n, r, i, a, o = !0, s) {
|
|
759
|
+
let c = new ge("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 = {
|
|
710
760
|
sourceFormat: e,
|
|
711
761
|
documentDate: r,
|
|
712
762
|
html: t,
|
|
713
763
|
htmlWithLinks: n,
|
|
714
|
-
tableOfContents: a ??
|
|
764
|
+
tableOfContents: a ?? c.timeSync("extractTableOfContents", () => te(u), { inputSize: u.length }),
|
|
715
765
|
articles: i
|
|
716
766
|
};
|
|
717
|
-
if (!o)
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
767
|
+
if (!o) {
|
|
768
|
+
let e = {
|
|
769
|
+
...d,
|
|
770
|
+
directives: []
|
|
771
|
+
};
|
|
772
|
+
return c.log({
|
|
773
|
+
articleCount: i.length,
|
|
774
|
+
blockCount: l,
|
|
775
|
+
directiveAnalysisIncluded: !1,
|
|
776
|
+
directiveTextSize: u.length
|
|
777
|
+
}), e;
|
|
778
|
+
}
|
|
779
|
+
let f = c.timeSync("extractGlobalApplicabilityDate", () => Ve(i.map((e) => e.text).join("\n"))), p = [], m = c.timeSync("extractDirectivesFromArticles", () => {
|
|
780
|
+
let e = [];
|
|
781
|
+
for (let t of i) {
|
|
782
|
+
let n = Tt(t, c.enabled ? p : void 0);
|
|
783
|
+
e.push(...n);
|
|
784
|
+
}
|
|
785
|
+
return e;
|
|
786
|
+
}, { count: i.length }), { createdArticlesByDirective: h, definitions: g } = c.timeSync("buildInternalArticleDefinitions", () => Et(m), { count: m.length }), _ = c.timeSync("attachInternalArticleMetadata", () => Dt(m, g, h), { count: m.length }), v = c.timeSync("collectNestedFrenchQuoteDiagnostics", () => kt(_), { count: _.length }), y = [...s ?? [], ...v], b = c.timeSync("collectNestedFrenchQuoteAnnotations", () => Ft(i, _), { count: _.length }), x = {
|
|
787
|
+
...d,
|
|
788
|
+
...f ? { globalApplicabilityDate: f } : {},
|
|
789
|
+
...g.length > 0 ? { internalArticleDefinitions: g } : {},
|
|
790
|
+
directives: _,
|
|
791
|
+
...b.length > 0 ? { annotations: b } : {},
|
|
792
|
+
...y.length > 0 ? { diagnostics: y } : {}
|
|
729
793
|
};
|
|
794
|
+
return c.log({
|
|
795
|
+
annotationCount: b.length,
|
|
796
|
+
articleCount: i.length,
|
|
797
|
+
blockCount: l,
|
|
798
|
+
definitionCount: g.length,
|
|
799
|
+
diagnosticCount: y.length,
|
|
800
|
+
directiveAnalysisIncluded: !0,
|
|
801
|
+
directiveCount: _.length,
|
|
802
|
+
actionDirectiveExtractionTotals: p.reduce((e, t) => ({
|
|
803
|
+
applyApplicabilityDatesMs: e.applyApplicabilityDatesMs + t.actionDirectiveExtraction.applyApplicabilityDatesMs,
|
|
804
|
+
buildListItemTreeMs: e.buildListItemTreeMs + t.actionDirectiveExtraction.buildListItemTreeMs,
|
|
805
|
+
buildDirectivesMs: e.buildDirectivesMs + t.actionDirectiveExtraction.buildDirectivesMs,
|
|
806
|
+
canonicalizeMs: e.canonicalizeMs + t.actionDirectiveExtraction.canonicalizeMs,
|
|
807
|
+
collectApplicabilityScopesMs: e.collectApplicabilityScopesMs + t.actionDirectiveExtraction.collectApplicabilityScopesMs,
|
|
808
|
+
directiveCount: e.directiveCount + t.actionDirectiveExtraction.directiveCount,
|
|
809
|
+
extractReferencesMs: e.extractReferencesMs + t.actionDirectiveExtraction.extractReferencesMs,
|
|
810
|
+
fallbackReferencesMs: e.fallbackReferencesMs + t.actionDirectiveExtraction.fallbackReferencesMs,
|
|
811
|
+
filterReferencesMs: e.filterReferencesMs + t.actionDirectiveExtraction.filterReferencesMs,
|
|
812
|
+
findBaseReferenceMs: e.findBaseReferenceMs + t.actionDirectiveExtraction.findBaseReferenceMs,
|
|
813
|
+
listActionIndexCacheHitCount: e.listActionIndexCacheHitCount + t.actionDirectiveExtraction.listActionIndexCacheHitCount,
|
|
814
|
+
listActionIndexCacheMissCount: e.listActionIndexCacheMissCount + t.actionDirectiveExtraction.listActionIndexCacheMissCount,
|
|
815
|
+
listActionItemCount: e.listActionItemCount + t.actionDirectiveExtraction.listActionItemCount,
|
|
816
|
+
listBuildActionDirectiveMs: e.listBuildActionDirectiveMs + t.actionDirectiveExtraction.listBuildActionDirectiveMs,
|
|
817
|
+
listChildProcessingMs: e.listChildProcessingMs + t.actionDirectiveExtraction.listChildProcessingMs,
|
|
818
|
+
listExtractionMs: e.listExtractionMs + t.actionDirectiveExtraction.listExtractionMs,
|
|
819
|
+
listFindActionIndexMs: e.listFindActionIndexMs + t.actionDirectiveExtraction.listFindActionIndexMs,
|
|
820
|
+
listItemCount: e.listItemCount + t.actionDirectiveExtraction.listItemCount,
|
|
821
|
+
listPickLineReferenceMs: e.listPickLineReferenceMs + t.actionDirectiveExtraction.listPickLineReferenceMs,
|
|
822
|
+
listPickLocalReferenceMs: e.listPickLocalReferenceMs + t.actionDirectiveExtraction.listPickLocalReferenceMs,
|
|
823
|
+
listQuoteRangeCacheHitCount: e.listQuoteRangeCacheHitCount + t.actionDirectiveExtraction.listQuoteRangeCacheHitCount,
|
|
824
|
+
listQuoteRangeCacheMissCount: e.listQuoteRangeCacheMissCount + t.actionDirectiveExtraction.listQuoteRangeCacheMissCount,
|
|
825
|
+
listReferenceCacheHitCount: e.listReferenceCacheHitCount + t.actionDirectiveExtraction.listReferenceCacheHitCount,
|
|
826
|
+
listReferenceCacheMissCount: e.listReferenceCacheMissCount + t.actionDirectiveExtraction.listReferenceCacheMissCount,
|
|
827
|
+
prepareRangesMs: e.prepareRangesMs + t.actionDirectiveExtraction.prepareRangesMs,
|
|
828
|
+
processListItemNodesMs: e.processListItemNodesMs + t.actionDirectiveExtraction.processListItemNodesMs,
|
|
829
|
+
refineReferencesMs: e.refineReferencesMs + t.actionDirectiveExtraction.refineReferencesMs,
|
|
830
|
+
referenceCount: e.referenceCount + t.actionDirectiveExtraction.referenceCount,
|
|
831
|
+
simplifyMs: e.simplifyMs + t.actionDirectiveExtraction.simplifyMs
|
|
832
|
+
}), {
|
|
833
|
+
applyApplicabilityDatesMs: 0,
|
|
834
|
+
buildListItemTreeMs: 0,
|
|
835
|
+
buildDirectivesMs: 0,
|
|
836
|
+
canonicalizeMs: 0,
|
|
837
|
+
collectApplicabilityScopesMs: 0,
|
|
838
|
+
directiveCount: 0,
|
|
839
|
+
extractReferencesMs: 0,
|
|
840
|
+
fallbackReferencesMs: 0,
|
|
841
|
+
filterReferencesMs: 0,
|
|
842
|
+
findBaseReferenceMs: 0,
|
|
843
|
+
listActionIndexCacheHitCount: 0,
|
|
844
|
+
listActionIndexCacheMissCount: 0,
|
|
845
|
+
listActionItemCount: 0,
|
|
846
|
+
listBuildActionDirectiveMs: 0,
|
|
847
|
+
listChildProcessingMs: 0,
|
|
848
|
+
listExtractionMs: 0,
|
|
849
|
+
listFindActionIndexMs: 0,
|
|
850
|
+
listItemCount: 0,
|
|
851
|
+
listPickLineReferenceMs: 0,
|
|
852
|
+
listPickLocalReferenceMs: 0,
|
|
853
|
+
listQuoteRangeCacheHitCount: 0,
|
|
854
|
+
listQuoteRangeCacheMissCount: 0,
|
|
855
|
+
listReferenceCacheHitCount: 0,
|
|
856
|
+
listReferenceCacheMissCount: 0,
|
|
857
|
+
prepareRangesMs: 0,
|
|
858
|
+
processListItemNodesMs: 0,
|
|
859
|
+
refineReferencesMs: 0,
|
|
860
|
+
referenceCount: 0,
|
|
861
|
+
simplifyMs: 0
|
|
862
|
+
}),
|
|
863
|
+
directiveExtractionTotals: p.reduce((e, t) => ({
|
|
864
|
+
buildRangesMs: e.buildRangesMs + t.buildRangesMs,
|
|
865
|
+
extractActionDirectivesMs: e.extractActionDirectivesMs + t.extractActionDirectivesMs,
|
|
866
|
+
mapDirectivesMs: e.mapDirectivesMs + t.mapDirectivesMs,
|
|
867
|
+
prepareBlockIndexesMs: e.prepareBlockIndexesMs + t.prepareBlockIndexesMs,
|
|
868
|
+
totalMs: e.totalMs + t.totalMs
|
|
869
|
+
}), {
|
|
870
|
+
buildRangesMs: 0,
|
|
871
|
+
extractActionDirectivesMs: 0,
|
|
872
|
+
mapDirectivesMs: 0,
|
|
873
|
+
prepareBlockIndexesMs: 0,
|
|
874
|
+
totalMs: 0
|
|
875
|
+
}),
|
|
876
|
+
directiveTextSize: u.length,
|
|
877
|
+
slowDirectiveArticles: p.toSorted((e, t) => t.totalMs - e.totalMs).slice(0, 10)
|
|
878
|
+
}), x;
|
|
730
879
|
}
|
|
731
|
-
function
|
|
880
|
+
function Lt(e) {
|
|
732
881
|
return { items: e.map((e) => ({
|
|
733
882
|
id: e.id,
|
|
734
883
|
line: e.title ? `${e.label} : ${e.title}` : e.label,
|
|
735
884
|
type: "article"
|
|
736
885
|
})) };
|
|
737
886
|
}
|
|
738
|
-
function
|
|
739
|
-
return Array.from(
|
|
887
|
+
function Rt(e) {
|
|
888
|
+
return Array.from(b(e)).filter((e) => e.type === "article").map((e) => N(e.line.split(/[::]/u)[0]));
|
|
740
889
|
}
|
|
741
|
-
function
|
|
742
|
-
let t =
|
|
890
|
+
function zt(e) {
|
|
891
|
+
let t = Rt(te(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), n = e.map((e) => N(e.label)), r = [];
|
|
743
892
|
if (t.length > 0 && (t.length !== n.length || t.some((e, t) => e !== n[t]))) {
|
|
744
893
|
let i = t.findIndex((e, t) => e !== n[t]);
|
|
745
894
|
r.push({
|
|
@@ -760,42 +909,42 @@ function Pt(e) {
|
|
|
760
909
|
}
|
|
761
910
|
return {
|
|
762
911
|
diagnostics: r,
|
|
763
|
-
tableOfContents:
|
|
912
|
+
tableOfContents: Lt(e)
|
|
764
913
|
};
|
|
765
914
|
}
|
|
766
|
-
async function
|
|
767
|
-
let n = new
|
|
768
|
-
let n =
|
|
915
|
+
async function Bt(e, t) {
|
|
916
|
+
let n = new ge("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => Vt(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => dt(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => S(i)), o = n.timeSync("extractArticleHeadings", () => at(a)), s = Qe(a), c = n.timeSync("extractArticlesAndBlocks", () => o.map((e, t) => {
|
|
917
|
+
let n = st(a, e, o[t + 1], s), r = lt(a, e.id, n), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
769
918
|
return {
|
|
770
919
|
id: e.id,
|
|
771
920
|
label: e.label,
|
|
772
921
|
num: e.num,
|
|
773
922
|
title: e.title,
|
|
774
|
-
text:
|
|
775
|
-
html: n.map((e) =>
|
|
923
|
+
text: qe(a, n),
|
|
924
|
+
html: n.map((e) => Ue(a, e)).join("\n"),
|
|
776
925
|
directiveText: i,
|
|
777
926
|
blocks: r
|
|
778
927
|
};
|
|
779
|
-
}), { count: o.length }),
|
|
780
|
-
return
|
|
781
|
-
articleCount:
|
|
782
|
-
blockCount:
|
|
783
|
-
directiveCount:
|
|
784
|
-
targetDirectiveCount:
|
|
785
|
-
}),
|
|
928
|
+
}), { count: o.length }), l = n.timeSync("injectHiddenArticleSummary", () => ut(a.html(), c)), { diagnostics: u, tableOfContents: d } = n.timeSync("buildAssembleeTableOfContents", () => zt(c), { count: c.length }), f = n.timeSync("buildParsedDocument", () => It("assemblee-html", e, l, t.date, c, d, t.includeDirectiveAnalysis, u));
|
|
929
|
+
return f.diagnostics?.length && process.env.TISSEUSE_WARN_PARSED_BILL_DIAGNOSTICS === "1" && console.warn("Assemblée bill parsing diagnostics", f.diagnostics), n.log({
|
|
930
|
+
articleCount: f.articles.length,
|
|
931
|
+
blockCount: f.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
932
|
+
directiveCount: f.directives.length,
|
|
933
|
+
targetDirectiveCount: f.directives.filter((e) => e.targetIds !== void 0).length
|
|
934
|
+
}), f;
|
|
786
935
|
}
|
|
787
|
-
async function
|
|
936
|
+
async function Vt(e, t) {
|
|
788
937
|
return {
|
|
789
938
|
sourceFormat: "assemblee-html",
|
|
790
939
|
documentDate: t.date,
|
|
791
940
|
html: e,
|
|
792
|
-
linkedHtml: await
|
|
941
|
+
linkedHtml: await Ye(e, t, t.date)
|
|
793
942
|
};
|
|
794
943
|
}
|
|
795
|
-
function
|
|
944
|
+
function L(e) {
|
|
796
945
|
return e.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
797
946
|
}
|
|
798
|
-
function
|
|
947
|
+
function Ht(e) {
|
|
799
948
|
let t = e;
|
|
800
949
|
for (let e = 0; e < 3; e++) {
|
|
801
950
|
let e = t;
|
|
@@ -803,27 +952,27 @@ function Lt(e) {
|
|
|
803
952
|
}
|
|
804
953
|
return t;
|
|
805
954
|
}
|
|
806
|
-
function
|
|
955
|
+
function Ut(e) {
|
|
807
956
|
return /(?:<|&lt;)\/?(?:p|br|span|b|i|u|sup|sub|table|thead|tbody|tr|th|td|ul|ol|li)\b/iu.test(e);
|
|
808
957
|
}
|
|
809
|
-
function
|
|
958
|
+
function R(e) {
|
|
810
959
|
return e.name.replace(/^.*:/u, "");
|
|
811
960
|
}
|
|
812
|
-
function
|
|
813
|
-
return t.children.map((t) =>
|
|
961
|
+
function Wt(e, t) {
|
|
962
|
+
return t.children.map((t) => z(e, t)).filter(Boolean).join("");
|
|
814
963
|
}
|
|
815
|
-
function
|
|
816
|
-
return t.children.map((t) => t.type === "text" &&
|
|
964
|
+
function Gt(e, t) {
|
|
965
|
+
return t.children.map((t) => t.type === "text" && Ut(t.data) ? Ht(t.data) : z(e, t)).filter(Boolean).join("");
|
|
817
966
|
}
|
|
818
|
-
function
|
|
967
|
+
function z(e, t) {
|
|
819
968
|
if (t.type === "text") {
|
|
820
969
|
let e = t.data.replace(/\s+\./gu, ".");
|
|
821
|
-
return
|
|
970
|
+
return Ut(e) ? Ht(e) : L(e);
|
|
822
971
|
}
|
|
823
|
-
if (!
|
|
824
|
-
let n =
|
|
972
|
+
if (!P(t)) return "";
|
|
973
|
+
let n = R(t), r = Wt(e, t);
|
|
825
974
|
switch (n) {
|
|
826
|
-
case "p": return `<p${
|
|
975
|
+
case "p": return `<p${B(e, t, [
|
|
827
976
|
"id",
|
|
828
977
|
"class",
|
|
829
978
|
"align",
|
|
@@ -837,13 +986,13 @@ function R(e, t) {
|
|
|
837
986
|
case "u":
|
|
838
987
|
case "sup":
|
|
839
988
|
case "sub":
|
|
840
|
-
case "abbr": return `<${n}${
|
|
989
|
+
case "abbr": return `<${n}${B(e, t, [
|
|
841
990
|
"id",
|
|
842
991
|
"class",
|
|
843
992
|
"title",
|
|
844
993
|
"style"
|
|
845
994
|
])}>${r}</${n}>`;
|
|
846
|
-
case "a": return `<a href="${
|
|
995
|
+
case "a": return `<a href="${L(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${B(e, t, [
|
|
847
996
|
"id",
|
|
848
997
|
"class",
|
|
849
998
|
"title",
|
|
@@ -854,8 +1003,8 @@ function R(e, t) {
|
|
|
854
1003
|
case "tbody":
|
|
855
1004
|
case "tr":
|
|
856
1005
|
case "th":
|
|
857
|
-
case "td": return
|
|
858
|
-
case "caption": return `<caption${
|
|
1006
|
+
case "td": return Kt(e, t, n, r);
|
|
1007
|
+
case "caption": return `<caption${B(e, t, [
|
|
859
1008
|
"id",
|
|
860
1009
|
"class",
|
|
861
1010
|
"align",
|
|
@@ -863,12 +1012,12 @@ function R(e, t) {
|
|
|
863
1012
|
])}>${r}</caption>`;
|
|
864
1013
|
case "num": return `<span class="akn-num">${r}</span> `;
|
|
865
1014
|
case "heading": return `<p class="akn-heading">${r}</p>`;
|
|
866
|
-
case "content": return
|
|
867
|
-
case "alinea": return
|
|
868
|
-
case "article": return
|
|
1015
|
+
case "content": return Gt(e, t);
|
|
1016
|
+
case "alinea": return V(e, t, "div", "akn-alinea");
|
|
1017
|
+
case "article": return V(e, t, "article", "akn-article");
|
|
869
1018
|
case "blockList":
|
|
870
1019
|
case "list": return `<div class="akn-list">${r}</div>`;
|
|
871
|
-
case "item": return
|
|
1020
|
+
case "item": return V(e, t, "div", "akn-item");
|
|
872
1021
|
case "listIntroduction":
|
|
873
1022
|
case "listWrapUp":
|
|
874
1023
|
case "intro":
|
|
@@ -884,23 +1033,23 @@ function R(e, t) {
|
|
|
884
1033
|
case "book":
|
|
885
1034
|
case "tome":
|
|
886
1035
|
case "subchapter":
|
|
887
|
-
case "subsection": return
|
|
1036
|
+
case "subsection": return V(e, t, "section", `akn-${n}`);
|
|
888
1037
|
case "crossHeading": return `<p class="akn-cross-heading">${r}</p>`;
|
|
889
1038
|
default: return r;
|
|
890
1039
|
}
|
|
891
1040
|
}
|
|
892
|
-
function
|
|
1041
|
+
function B(e, t, n, r = {}) {
|
|
893
1042
|
let i = [];
|
|
894
1043
|
for (let r of n) {
|
|
895
1044
|
if (r === "style") continue;
|
|
896
1045
|
let n = e(t).attr(r);
|
|
897
|
-
n !== void 0 && i.push(`${r}="${
|
|
1046
|
+
n !== void 0 && i.push(`${r}="${L(n)}"`);
|
|
898
1047
|
}
|
|
899
1048
|
let a = r.style ?? e(t).attr("style");
|
|
900
|
-
return a && i.push(`style="${
|
|
1049
|
+
return a && i.push(`style="${L(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
|
|
901
1050
|
}
|
|
902
|
-
function
|
|
903
|
-
return `<${n}${
|
|
1051
|
+
function Kt(e, t, n, r) {
|
|
1052
|
+
return `<${n}${B(e, t, [
|
|
904
1053
|
"id",
|
|
905
1054
|
"class",
|
|
906
1055
|
"colspan",
|
|
@@ -913,155 +1062,155 @@ function Vt(e, t, n, r) {
|
|
|
913
1062
|
"cellspacing",
|
|
914
1063
|
"cellpadding",
|
|
915
1064
|
"style"
|
|
916
|
-
], { style:
|
|
1065
|
+
], { style: qt(e, t, n) })}>${r}</${n}>`;
|
|
917
1066
|
}
|
|
918
|
-
function
|
|
1067
|
+
function qt(e, t, n) {
|
|
919
1068
|
let r = e(t).attr("style") ?? "";
|
|
920
|
-
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r =
|
|
1069
|
+
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = Jt(r, "text-align", "center")), r || void 0;
|
|
921
1070
|
}
|
|
922
|
-
function
|
|
1071
|
+
function Jt(e, t, n) {
|
|
923
1072
|
let r = e.trim();
|
|
924
1073
|
return `${r}${r && !r.endsWith(";") ? ";" : ""} ${t}: ${n};`.trim();
|
|
925
1074
|
}
|
|
926
|
-
function
|
|
927
|
-
let n = [
|
|
928
|
-
return n.length === 0 ? "" : `<p class="akn-heading">${
|
|
1075
|
+
function Yt(e, t) {
|
|
1076
|
+
let n = [M(e(t).children("num").first().text()), M(e(t).children("heading").first().text())].filter(Boolean);
|
|
1077
|
+
return n.length === 0 ? "" : `<p class="akn-heading">${L(n.join(" "))}</p>`;
|
|
929
1078
|
}
|
|
930
|
-
function
|
|
1079
|
+
function Xt(e, t) {
|
|
931
1080
|
if (!t) return !1;
|
|
932
|
-
let n = (e) =>
|
|
933
|
-
return n(
|
|
1081
|
+
let n = (e) => M(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
|
|
1082
|
+
return n(M(e.replace(/<[^>]*>/gu, " ").replace(/ /gu, " ").replace(/ /giu, " ").replace(/–/giu, "–"))).startsWith(n(t));
|
|
934
1083
|
}
|
|
935
|
-
function
|
|
936
|
-
let t =
|
|
1084
|
+
function Zt(e) {
|
|
1085
|
+
let t = L(e);
|
|
937
1086
|
return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}">${t}</span></p>`;
|
|
938
1087
|
}
|
|
939
|
-
function
|
|
940
|
-
return
|
|
1088
|
+
function Qt(e, t) {
|
|
1089
|
+
return $t([en({
|
|
941
1090
|
content: e,
|
|
942
1091
|
pastille: t
|
|
943
1092
|
})]);
|
|
944
1093
|
}
|
|
945
|
-
function
|
|
1094
|
+
function $t(e) {
|
|
946
1095
|
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>`;
|
|
947
1096
|
}
|
|
948
|
-
function
|
|
949
|
-
let i = n ? ` style="${
|
|
950
|
-
return `<tr${r ? ` class="${
|
|
1097
|
+
function en({ content: e, pastille: t, style: n, contextClass: r }) {
|
|
1098
|
+
let i = n ? ` style="${L(n)}"` : "", a = r ? ` ${L(r)}` : "";
|
|
1099
|
+
return `<tr${r ? ` class="${L(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${Zt(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>`;
|
|
951
1100
|
}
|
|
952
|
-
function
|
|
953
|
-
let r = t ? ` style="${
|
|
954
|
-
return `<tr${n ? ` class="${
|
|
1101
|
+
function tn({ content: e, style: t, contextClass: n }) {
|
|
1102
|
+
let r = t ? ` style="${L(t)}"` : "", i = n ? ` ${L(n)}` : "";
|
|
1103
|
+
return `<tr${n ? ` class="${L(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>`;
|
|
955
1104
|
}
|
|
956
|
-
function
|
|
1105
|
+
function nn(e, t) {
|
|
957
1106
|
return e(t).attr("data:pastille") ?? e(t).attr("pastille");
|
|
958
1107
|
}
|
|
959
|
-
function
|
|
1108
|
+
function rn(e, t) {
|
|
960
1109
|
return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
|
|
961
1110
|
}
|
|
962
|
-
function
|
|
963
|
-
return e(t).children().get().filter((e) =>
|
|
1111
|
+
function an(e, t) {
|
|
1112
|
+
return e(t).children().get().filter((e) => P(e) ? R(e) === "content" : !1).map((t) => z(e, t)).filter(Boolean).join("\n");
|
|
964
1113
|
}
|
|
965
|
-
function
|
|
1114
|
+
function on(e, t) {
|
|
966
1115
|
let n = [];
|
|
967
1116
|
return e(t).children().each((t, r) => {
|
|
968
|
-
if (!
|
|
969
|
-
let i =
|
|
970
|
-
i === "num" || i === "heading" || i === "content" || n.push(
|
|
1117
|
+
if (!P(r)) return;
|
|
1118
|
+
let i = R(r);
|
|
1119
|
+
i === "num" || i === "heading" || i === "content" || n.push(z(e, r));
|
|
971
1120
|
}), n.filter(Boolean);
|
|
972
1121
|
}
|
|
973
|
-
function
|
|
974
|
-
let n = [], r =
|
|
1122
|
+
function sn(e, t) {
|
|
1123
|
+
let n = [], r = R(t), i = r === "alinea" ? nn(e, t) : void 0, a = an(e, t), o = cn(e, t, r, i), s = mn(e, t);
|
|
975
1124
|
if (i) {
|
|
976
|
-
let r = [
|
|
977
|
-
|
|
1125
|
+
let r = [Xt(a, M(e(t).children("num").first().text())) ? "" : Yt(e, t), a].filter(Boolean).join("\n");
|
|
1126
|
+
M(r) && n.push(en({
|
|
978
1127
|
content: r,
|
|
979
1128
|
pastille: i,
|
|
980
1129
|
style: o,
|
|
981
1130
|
contextClass: s
|
|
982
1131
|
}));
|
|
983
|
-
} else a && n.push(
|
|
1132
|
+
} else a && n.push(tn({
|
|
984
1133
|
content: a,
|
|
985
1134
|
style: o,
|
|
986
1135
|
contextClass: s
|
|
987
1136
|
}));
|
|
988
1137
|
for (let r of e(t).children().get()) {
|
|
989
|
-
if (!
|
|
990
|
-
let t =
|
|
991
|
-
t === "num" || t === "heading" || t === "content" || (t === "alinea" ||
|
|
1138
|
+
if (!P(r)) continue;
|
|
1139
|
+
let t = R(r);
|
|
1140
|
+
t === "num" || t === "heading" || t === "content" || (t === "alinea" || rn(e, r)) && n.push(...sn(e, r));
|
|
992
1141
|
}
|
|
993
1142
|
return n;
|
|
994
1143
|
}
|
|
995
|
-
function
|
|
996
|
-
let i =
|
|
997
|
-
a ? `id="${
|
|
1144
|
+
function V(e, t, n, r) {
|
|
1145
|
+
let i = R(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = nn(e, t), s = cn(e, t, i, o), c = [`<${n} ${[
|
|
1146
|
+
a ? `id="${L(a)}"` : void 0,
|
|
998
1147
|
`class="${r}"`,
|
|
999
|
-
o ? `data-pastille="${
|
|
1000
|
-
s ? `style="${
|
|
1148
|
+
o ? `data-pastille="${L(o)}"` : void 0,
|
|
1149
|
+
s ? `style="${L(s)}"` : void 0
|
|
1001
1150
|
].filter((e) => e !== void 0).join(" ")}>`];
|
|
1002
1151
|
if (i === "part" || i === "title") {
|
|
1003
|
-
let r =
|
|
1152
|
+
let r = dn(e, t, i), a = pn(e, t), o = r ? [tn({
|
|
1004
1153
|
content: r,
|
|
1005
1154
|
contextClass: a
|
|
1006
1155
|
})] : [], s = () => {
|
|
1007
|
-
o.length !== 0 && (c.push(
|
|
1156
|
+
o.length !== 0 && (c.push(un(o)), o = []);
|
|
1008
1157
|
};
|
|
1009
1158
|
return e(t).children().each((t, n) => {
|
|
1010
|
-
if (!
|
|
1011
|
-
let r =
|
|
1159
|
+
if (!P(n)) return;
|
|
1160
|
+
let r = R(n);
|
|
1012
1161
|
if (!(r === "num" || r === "heading" || r === "content")) {
|
|
1013
1162
|
if (r === "alinea") {
|
|
1014
|
-
o.push(...
|
|
1163
|
+
o.push(...sn(e, n));
|
|
1015
1164
|
return;
|
|
1016
1165
|
}
|
|
1017
|
-
s(), c.push(
|
|
1166
|
+
s(), c.push(z(e, n));
|
|
1018
1167
|
}
|
|
1019
1168
|
}), s(), c.push(`</${n}>`), c.join("\n");
|
|
1020
1169
|
}
|
|
1021
1170
|
if (i === "article") {
|
|
1022
|
-
let r =
|
|
1171
|
+
let r = M(e(t).children("num").first().text()), i = M(e(t).children("heading").first().text()), a = w(r) ?? {
|
|
1023
1172
|
label: r,
|
|
1024
1173
|
num: r
|
|
1025
|
-
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${
|
|
1026
|
-
if (
|
|
1027
|
-
let r = [
|
|
1174
|
+
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${L(`_TocArt${(a.num ?? r).replace(/\s+/gu, "")}`)}">${L(a.label)}${i ? ` : ${L(i)}` : ""}</p>`;
|
|
1175
|
+
if (rn(e, t)) {
|
|
1176
|
+
let r = [tn({
|
|
1028
1177
|
content: o,
|
|
1029
|
-
contextClass:
|
|
1030
|
-
}), ...
|
|
1031
|
-
c.push(
|
|
1032
|
-
for (let n of
|
|
1178
|
+
contextClass: gn(a.label)
|
|
1179
|
+
}), ...sn(e, t)];
|
|
1180
|
+
c.push($t(r));
|
|
1181
|
+
for (let n of on(e, t)) n.includes("akn-pastille-table") || c.push(n);
|
|
1033
1182
|
return c.push(`</${n}>`), c.join("\n");
|
|
1034
1183
|
}
|
|
1035
1184
|
c.push(o);
|
|
1036
1185
|
}
|
|
1037
1186
|
let l = [];
|
|
1038
1187
|
for (let n of ["content", "children"]) e(t).children().each((t, r) => {
|
|
1039
|
-
if (!
|
|
1040
|
-
let i =
|
|
1041
|
-
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(
|
|
1188
|
+
if (!P(r)) return;
|
|
1189
|
+
let i = R(r);
|
|
1190
|
+
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(z(e, r));
|
|
1042
1191
|
});
|
|
1043
1192
|
let u = l.join("\n");
|
|
1044
1193
|
if (i !== "article") {
|
|
1045
|
-
let n =
|
|
1194
|
+
let n = Xt(u, M(e(t).children("num").first().text())) ? "" : Yt(e, t);
|
|
1046
1195
|
n && c.push(n);
|
|
1047
1196
|
}
|
|
1048
|
-
return c.push(o ?
|
|
1197
|
+
return c.push(o ? Qt(u, o) : u), c.push(`</${n}>`), c.join("\n");
|
|
1049
1198
|
}
|
|
1050
|
-
function
|
|
1051
|
-
let i =
|
|
1052
|
-
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i =
|
|
1199
|
+
function cn(e, t, n, r) {
|
|
1200
|
+
let i = ln(e(t).attr("style") ?? "", "font-family");
|
|
1201
|
+
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = Jt(i, "text-align", "center")), i || void 0;
|
|
1053
1202
|
}
|
|
1054
|
-
function
|
|
1203
|
+
function ln(e, t) {
|
|
1055
1204
|
return e.split(";").map((e) => e.trim()).filter(Boolean).filter((e) => !e.toLowerCase().startsWith(`${t.toLowerCase()}:`)).join(";");
|
|
1056
1205
|
}
|
|
1057
|
-
function
|
|
1206
|
+
function un(e) {
|
|
1058
1207
|
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>`;
|
|
1059
1208
|
}
|
|
1060
|
-
function
|
|
1061
|
-
let r =
|
|
1062
|
-
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${
|
|
1209
|
+
function dn(e, t, n) {
|
|
1210
|
+
let r = M(e(t).children("num").first().text()), i = M(e(t).children("heading").first().text()), a = fn(n), o = [];
|
|
1211
|
+
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${L(r)}</span></p>`), i && o.push(`<p class="${a.heading} as-text dispositif"><span aria-label="">${L(i)}</span></p>`), o.join("\n");
|
|
1063
1212
|
}
|
|
1064
|
-
function
|
|
1213
|
+
function fn(e) {
|
|
1065
1214
|
switch (e) {
|
|
1066
1215
|
case "part": return {
|
|
1067
1216
|
num: "TCNumPartie",
|
|
@@ -1085,22 +1234,22 @@ function sn(e) {
|
|
|
1085
1234
|
};
|
|
1086
1235
|
}
|
|
1087
1236
|
}
|
|
1088
|
-
function
|
|
1089
|
-
let n =
|
|
1237
|
+
function pn(e, t) {
|
|
1238
|
+
let n = hn(M(e(t).children("num").first().text()));
|
|
1090
1239
|
if (n) return n;
|
|
1091
1240
|
for (let n of e(t).parents().get()) {
|
|
1092
|
-
if (!
|
|
1093
|
-
let t =
|
|
1241
|
+
if (!P(n)) continue;
|
|
1242
|
+
let t = R(n);
|
|
1094
1243
|
if (t !== "title" && t !== "part") continue;
|
|
1095
|
-
let r =
|
|
1244
|
+
let r = hn(M(e(n).children("num").first().text()));
|
|
1096
1245
|
if (r) return r;
|
|
1097
1246
|
}
|
|
1098
1247
|
}
|
|
1099
|
-
function
|
|
1100
|
-
return
|
|
1248
|
+
function mn(e, t) {
|
|
1249
|
+
return pn(e, t);
|
|
1101
1250
|
}
|
|
1102
|
-
function
|
|
1103
|
-
let [t, ...n] =
|
|
1251
|
+
function hn(e) {
|
|
1252
|
+
let [t, ...n] = M(e).split(/\s+/u);
|
|
1104
1253
|
if (!t || n.length === 0) return;
|
|
1105
1254
|
let r = t.toLocaleLowerCase("fr-FR");
|
|
1106
1255
|
if ([
|
|
@@ -1110,10 +1259,10 @@ function un(e) {
|
|
|
1110
1259
|
"section"
|
|
1111
1260
|
].includes(r)) return `${r}-${n.join("_")}`;
|
|
1112
1261
|
}
|
|
1113
|
-
function
|
|
1114
|
-
return `article-${
|
|
1262
|
+
function gn(e) {
|
|
1263
|
+
return `article-${M(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
|
|
1115
1264
|
}
|
|
1116
|
-
function
|
|
1265
|
+
function _n(e) {
|
|
1117
1266
|
switch (e) {
|
|
1118
1267
|
case "part": return "partie";
|
|
1119
1268
|
case "book": return "livre";
|
|
@@ -1125,11 +1274,11 @@ function fn(e) {
|
|
|
1125
1274
|
default: return;
|
|
1126
1275
|
}
|
|
1127
1276
|
}
|
|
1128
|
-
function
|
|
1129
|
-
return [
|
|
1277
|
+
function vn(e, t) {
|
|
1278
|
+
return [M(e(t).children("num").first().text()), M(e(t).children("heading").first().text())].filter(Boolean).join(" ");
|
|
1130
1279
|
}
|
|
1131
|
-
function
|
|
1132
|
-
let n =
|
|
1280
|
+
function yn(e, t) {
|
|
1281
|
+
let n = M(e(t).children("num").first().text()), r = M(e(t).children("heading").first().text()), i = w(n) ?? {
|
|
1133
1282
|
label: n,
|
|
1134
1283
|
num: n
|
|
1135
1284
|
};
|
|
@@ -1139,24 +1288,24 @@ function mn(e, t) {
|
|
|
1139
1288
|
type: "article"
|
|
1140
1289
|
};
|
|
1141
1290
|
}
|
|
1142
|
-
function
|
|
1291
|
+
function bn(e, t) {
|
|
1143
1292
|
e.items.push(...t.items);
|
|
1144
1293
|
}
|
|
1145
|
-
function
|
|
1294
|
+
function xn(e, t) {
|
|
1146
1295
|
let n = { items: [] };
|
|
1147
1296
|
return e(t).children().each((t, r) => {
|
|
1148
|
-
if (!
|
|
1149
|
-
let i =
|
|
1297
|
+
if (!P(r)) return;
|
|
1298
|
+
let i = R(r);
|
|
1150
1299
|
if (i === "article") {
|
|
1151
|
-
n.items.push(
|
|
1300
|
+
n.items.push(yn(e, r));
|
|
1152
1301
|
return;
|
|
1153
1302
|
}
|
|
1154
|
-
let a =
|
|
1303
|
+
let a = _n(i);
|
|
1155
1304
|
if (!a) {
|
|
1156
|
-
|
|
1305
|
+
bn(n, xn(e, r));
|
|
1157
1306
|
return;
|
|
1158
1307
|
}
|
|
1159
|
-
let o =
|
|
1308
|
+
let o = vn(e, r), s = xn(e, r);
|
|
1160
1309
|
!o && s.items.length === 0 || n.items.push({
|
|
1161
1310
|
...s,
|
|
1162
1311
|
id: e(r).attr("eId") ?? e(r).attr("GUID"),
|
|
@@ -1165,26 +1314,26 @@ function gn(e, t) {
|
|
|
1165
1314
|
});
|
|
1166
1315
|
}), n;
|
|
1167
1316
|
}
|
|
1168
|
-
function
|
|
1317
|
+
function Sn(e) {
|
|
1169
1318
|
let t = e("body").first().get(0);
|
|
1170
|
-
return t === void 0 ? { items: [] } :
|
|
1319
|
+
return t === void 0 ? { items: [] } : xn(e, t);
|
|
1171
1320
|
}
|
|
1172
|
-
function
|
|
1321
|
+
function Cn(e) {
|
|
1173
1322
|
return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
|
|
1174
1323
|
}
|
|
1175
|
-
function
|
|
1324
|
+
function wn(e) {
|
|
1176
1325
|
let t = e("preamble").first(), n = e("body").first(), r = ["<div class=\"akn-bill\">"];
|
|
1177
|
-
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(
|
|
1178
|
-
|
|
1326
|
+
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(Wt(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
|
|
1327
|
+
P(n) && r.push(R(n) === "article" ? V(e, n, "article", "akn-article") : z(e, n));
|
|
1179
1328
|
}), r.push("</section></div>"), r.join("\n");
|
|
1180
1329
|
}
|
|
1181
|
-
function
|
|
1182
|
-
let t =
|
|
1330
|
+
function Tn(e) {
|
|
1331
|
+
let t = S(e, { xml: {
|
|
1183
1332
|
decodeEntities: !1,
|
|
1184
1333
|
lowerCaseTags: !1,
|
|
1185
1334
|
lowerCaseAttributeNames: !1,
|
|
1186
1335
|
xmlMode: !0
|
|
1187
|
-
} }), n =
|
|
1336
|
+
} }), n = Cn(t), r = wn(t);
|
|
1188
1337
|
return {
|
|
1189
1338
|
sourceFormat: "akoma-ntoso",
|
|
1190
1339
|
documentDate: n,
|
|
@@ -1192,42 +1341,42 @@ function bn(e) {
|
|
|
1192
1341
|
linkedHtml: r
|
|
1193
1342
|
};
|
|
1194
1343
|
}
|
|
1195
|
-
function
|
|
1196
|
-
return
|
|
1344
|
+
function En(e) {
|
|
1345
|
+
return Dn(S(e));
|
|
1197
1346
|
}
|
|
1198
|
-
function
|
|
1347
|
+
function Dn(e) {
|
|
1199
1348
|
let t = [];
|
|
1200
1349
|
return e("article.akn-article").each((n, r) => {
|
|
1201
|
-
let i = e(r).children("p.TCNumArticle").first().get(0), a =
|
|
1350
|
+
let i = e(r).children("p.TCNumArticle").first().get(0), a = M(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 = lt(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
1202
1351
|
t.push({
|
|
1203
1352
|
id: s,
|
|
1204
1353
|
label: o.label,
|
|
1205
1354
|
num: o.num,
|
|
1206
1355
|
title: o.title,
|
|
1207
|
-
text:
|
|
1208
|
-
html:
|
|
1356
|
+
text: qe(e, c),
|
|
1357
|
+
html: Ue(e, r),
|
|
1209
1358
|
directiveText: u,
|
|
1210
1359
|
blocks: l
|
|
1211
1360
|
});
|
|
1212
1361
|
}), t;
|
|
1213
1362
|
}
|
|
1214
|
-
function
|
|
1215
|
-
let t =
|
|
1363
|
+
function On(e) {
|
|
1364
|
+
let t = S(e);
|
|
1216
1365
|
return {
|
|
1217
|
-
articles:
|
|
1366
|
+
articles: Dn(t),
|
|
1218
1367
|
htmlWithLinks: t.html()
|
|
1219
1368
|
};
|
|
1220
1369
|
}
|
|
1221
|
-
async function
|
|
1222
|
-
let n = new
|
|
1370
|
+
async function kn(e, t) {
|
|
1371
|
+
let n = new ge("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => S(e, { xml: {
|
|
1223
1372
|
decodeEntities: !1,
|
|
1224
1373
|
lowerCaseTags: !1,
|
|
1225
1374
|
lowerCaseAttributeNames: !1,
|
|
1226
1375
|
xmlMode: !0
|
|
1227
|
-
} })), i = t.date ??
|
|
1376
|
+
} })), i = t.date ?? Cn(r), a = n.timeSync("renderAknHtml", () => wn(r), { inputSize: e.length }), o = t.linkedHtml ?? await n.time("addLinksToRenderedAknHtml", () => Ye(a, {
|
|
1228
1377
|
...t,
|
|
1229
1378
|
date: i
|
|
1230
|
-
}, i)), s = n.timeSync("extractRenderedAknArticles", () =>
|
|
1379
|
+
}, i)), s = n.timeSync("extractRenderedAknArticles", () => En(a)), c = n.timeSync("injectHiddenArticleSummary", () => ut(o, s)), { articles: l, htmlWithLinks: u } = n.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => On(c)), d = l.length > 0 ? l : s, f = n.timeSync("extractAknTableOfContents", () => Sn(r)), p = n.timeSync("buildParsedDocument", () => It("akoma-ntoso", a, l.length > 0 ? u : c, i, d, f, t.includeDirectiveAnalysis));
|
|
1231
1380
|
return n.log({
|
|
1232
1381
|
articleCount: p.articles.length,
|
|
1233
1382
|
blockCount: p.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -1235,25 +1384,25 @@ async function wn(e, t) {
|
|
|
1235
1384
|
targetDirectiveCount: p.directives.filter((e) => e.targetIds !== void 0).length
|
|
1236
1385
|
}), p;
|
|
1237
1386
|
}
|
|
1238
|
-
async function
|
|
1239
|
-
let n =
|
|
1387
|
+
async function An(e, t) {
|
|
1388
|
+
let n = Tn(e), r = t.date ?? n.documentDate;
|
|
1240
1389
|
return {
|
|
1241
1390
|
sourceFormat: "akoma-ntoso",
|
|
1242
1391
|
documentDate: r,
|
|
1243
1392
|
html: n.html,
|
|
1244
|
-
linkedHtml: await
|
|
1393
|
+
linkedHtml: await Ye(n.html, t, r)
|
|
1245
1394
|
};
|
|
1246
1395
|
}
|
|
1247
1396
|
//#endregion
|
|
1248
1397
|
//#region src/lib/server/assemblee_document_search.ts
|
|
1249
|
-
var
|
|
1250
|
-
function
|
|
1398
|
+
var jn = /\bexpos[ée]\s+des\s+motifs\b/giu, Mn = /\barticle\s+(?:premier|1er|\d+)/iu;
|
|
1399
|
+
function Nn(e) {
|
|
1251
1400
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1252
1401
|
}
|
|
1253
|
-
function
|
|
1254
|
-
let t =
|
|
1402
|
+
function Pn(e) {
|
|
1403
|
+
let t = Nn(S(e).text()), n = [...t.matchAll(jn)], r = /* @__PURE__ */ new Set(), i = [];
|
|
1255
1404
|
for (let [e, a] of n.entries()) {
|
|
1256
|
-
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c =
|
|
1405
|
+
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = Mn.exec(s), l = Nn(s.slice(0, c?.index ?? s.length));
|
|
1257
1406
|
if (l.length < 20 || r.has(l)) continue;
|
|
1258
1407
|
r.add(l);
|
|
1259
1408
|
let u = `expose-des-motifs-${e + 1}`;
|
|
@@ -1269,8 +1418,8 @@ function kn(e) {
|
|
|
1269
1418
|
}
|
|
1270
1419
|
return i;
|
|
1271
1420
|
}
|
|
1272
|
-
async function
|
|
1273
|
-
let i = await
|
|
1421
|
+
async function Fn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
1422
|
+
let i = await Bt(t, {
|
|
1274
1423
|
date: e,
|
|
1275
1424
|
includeDirectiveAnalysis: !1,
|
|
1276
1425
|
linkBaseUrl: n,
|
|
@@ -1279,7 +1428,7 @@ async function An({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1279
1428
|
});
|
|
1280
1429
|
return {
|
|
1281
1430
|
items: [...i.articles.map((e) => {
|
|
1282
|
-
let t =
|
|
1431
|
+
let t = Nn(e.directiveText || e.text);
|
|
1283
1432
|
if (t) return {
|
|
1284
1433
|
anchor: e.id,
|
|
1285
1434
|
articleNumber: e.num ?? null,
|
|
@@ -1289,17 +1438,17 @@ async function An({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1289
1438
|
label: e.label,
|
|
1290
1439
|
title: e.title ?? null
|
|
1291
1440
|
};
|
|
1292
|
-
}).filter((e) => e !== void 0), ...
|
|
1441
|
+
}).filter((e) => e !== void 0), ...Pn(t)],
|
|
1293
1442
|
tableOfContents: i.tableOfContents
|
|
1294
1443
|
};
|
|
1295
1444
|
}
|
|
1296
|
-
function
|
|
1297
|
-
return
|
|
1445
|
+
function In(e, t) {
|
|
1446
|
+
return be("sha256").update(JSON.stringify({
|
|
1298
1447
|
item: e,
|
|
1299
1448
|
metadata: t
|
|
1300
1449
|
})).digest("hex");
|
|
1301
1450
|
}
|
|
1302
|
-
function
|
|
1451
|
+
function Ln(e) {
|
|
1303
1452
|
if (typeof e != "object" || !e) return;
|
|
1304
1453
|
let t = e.cycleDeVie?.chrono;
|
|
1305
1454
|
if (t !== void 0) for (let e of [
|
|
@@ -1314,11 +1463,11 @@ function Mn(e) {
|
|
|
1314
1463
|
}
|
|
1315
1464
|
//#endregion
|
|
1316
1465
|
//#region src/lib/server/senat_amendment_search.ts
|
|
1317
|
-
function
|
|
1318
|
-
return e?.trim() ?
|
|
1466
|
+
function Rn(e) {
|
|
1467
|
+
return e?.trim() ? S(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
|
|
1319
1468
|
}
|
|
1320
|
-
function
|
|
1321
|
-
let n =
|
|
1469
|
+
function zn({ dispositifHtml: e, objetHtml: t }) {
|
|
1470
|
+
let n = Rn(e), r = Rn(t);
|
|
1322
1471
|
return [...n ? [{
|
|
1323
1472
|
content: n,
|
|
1324
1473
|
itemKind: "dispositif",
|
|
@@ -1329,233 +1478,233 @@ function Pn({ dispositifHtml: e, objetHtml: t }) {
|
|
|
1329
1478
|
label: "Objet"
|
|
1330
1479
|
}] : []];
|
|
1331
1480
|
}
|
|
1332
|
-
function
|
|
1333
|
-
return
|
|
1481
|
+
function Bn(e, t) {
|
|
1482
|
+
return be("sha256").update(JSON.stringify({
|
|
1334
1483
|
item: e,
|
|
1335
1484
|
metadata: t
|
|
1336
1485
|
})).digest("hex");
|
|
1337
1486
|
}
|
|
1338
1487
|
//#endregion
|
|
1339
1488
|
//#region src/lib/text_parsers/amendment_action_directives.ts
|
|
1340
|
-
function
|
|
1489
|
+
function H(e, t) {
|
|
1341
1490
|
return {
|
|
1342
1491
|
...t,
|
|
1343
1492
|
position: e.position(),
|
|
1344
1493
|
type: "amendment_action_directive"
|
|
1345
1494
|
};
|
|
1346
1495
|
}
|
|
1347
|
-
function
|
|
1496
|
+
function Vn(e, t) {
|
|
1348
1497
|
return {
|
|
1349
1498
|
type: e === "start" ? "head_of_target" : "tail_after_target",
|
|
1350
|
-
unit: t ?
|
|
1499
|
+
unit: t ? ie(t) : "article"
|
|
1351
1500
|
};
|
|
1352
1501
|
}
|
|
1353
|
-
function
|
|
1502
|
+
function Hn(e) {
|
|
1354
1503
|
return e === "start" ? "insert_before" : "insert_after";
|
|
1355
1504
|
}
|
|
1356
|
-
var
|
|
1505
|
+
var Un = O(D("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), U = E(c, T([D("les?\\s+", { flags: "i" }), u], { value: (e) => e[1] }), u, r), Wn = E(T([D("la\\s+fin\\s+de\\s+", { flags: "i" }), U], { value: (e) => {
|
|
1357
1506
|
let t = e[1];
|
|
1358
1507
|
return {
|
|
1359
1508
|
targetReference: t,
|
|
1360
1509
|
targetScope: {
|
|
1361
1510
|
type: "tail_after_target",
|
|
1362
|
-
unit:
|
|
1511
|
+
unit: ie(t)
|
|
1363
1512
|
}
|
|
1364
1513
|
};
|
|
1365
|
-
} }),
|
|
1366
|
-
D(
|
|
1367
|
-
D(
|
|
1368
|
-
|
|
1369
|
-
D(
|
|
1514
|
+
} }), T([p], { value: (e) => ({ targetScope: e[0] }) })), W = O(T([
|
|
1515
|
+
O(D("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1516
|
+
O(D("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1517
|
+
U,
|
|
1518
|
+
O(D("\\s*,?\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*)?", { flags: "i" }), { default: "" })
|
|
1370
1519
|
], { value: (e, t) => ({
|
|
1371
1520
|
reference: e[2],
|
|
1372
1521
|
text: t.text()
|
|
1373
|
-
}) }), { default: null }),
|
|
1374
|
-
function
|
|
1522
|
+
}) }), { default: null }), Gn = O(D(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${pe})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
|
|
1523
|
+
function G(e) {
|
|
1375
1524
|
return e?.text ?? "";
|
|
1376
1525
|
}
|
|
1377
|
-
function
|
|
1526
|
+
function K(e) {
|
|
1378
1527
|
return { citation: d(e.position()) };
|
|
1379
1528
|
}
|
|
1380
|
-
var
|
|
1529
|
+
var q = E(T([i], { value: (e) => ({ citation: e[0] }) }), D("\\S[\\s\\S]*", { value: (e, t) => K(t) })), Kn = D("\\S[\\s\\S]*", { value: (e, t) => K(t) }), J = D("[^:«“\"]*(?::\\s*)?", { flags: "i" }), qn = D("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
|
|
1381
1530
|
flags: "i",
|
|
1382
|
-
value: (e, t) =>
|
|
1383
|
-
}),
|
|
1531
|
+
value: (e, t) => K(t)
|
|
1532
|
+
}), Jn = D("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
|
|
1384
1533
|
flags: "i",
|
|
1385
|
-
value: (e, t) =>
|
|
1386
|
-
}),
|
|
1534
|
+
value: (e, t) => K(t)
|
|
1535
|
+
}), Yn = D("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
|
|
1387
1536
|
flags: "i",
|
|
1388
|
-
value: (e, t) =>
|
|
1389
|
-
}),
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
], { value: (e) => e[2] }),
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1537
|
+
value: (e, t) => K(t)
|
|
1538
|
+
}), Xn = E(T([i], { value: (e) => ({ citation: e[0] }) }), qn), Zn = E(T([i], { value: (e) => ({ citation: e[0] }) }), Yn), Qn = T([D(`${re}s?\\s*:?\\s*`, { flags: "i" }), Xn], { value: (e) => e[1] }), $n = T([D(`${e}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), Zn], { value: (e) => e[1] }), er = E(T([i], { value: (e) => ({ citation: e[0] }) }), Jn), tr = T([
|
|
1539
|
+
Gn,
|
|
1540
|
+
D(`${re}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1541
|
+
er
|
|
1542
|
+
], { value: (e) => e[2] }), nr = T([
|
|
1543
|
+
Gn,
|
|
1544
|
+
D(`${re}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1545
|
+
E(T([i], { value: (e) => ({ citation: e[0] }) }), Kn)
|
|
1397
1546
|
], { value: (e) => e[2] });
|
|
1398
|
-
function
|
|
1547
|
+
function Y(e) {
|
|
1399
1548
|
return e?.reference;
|
|
1400
1549
|
}
|
|
1401
|
-
var
|
|
1550
|
+
var rr = T([Un, D("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => H(t, {
|
|
1402
1551
|
contextText: e[0],
|
|
1403
1552
|
kind: "delete_article"
|
|
1404
|
-
}) }),
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
], { value: (e, t) =>
|
|
1410
|
-
contextText:
|
|
1553
|
+
}) }), ir = T([
|
|
1554
|
+
W,
|
|
1555
|
+
D("supprimer", { flags: "i" }),
|
|
1556
|
+
O(T([k, U], { value: (e) => e[1] }), { default: null }),
|
|
1557
|
+
O(T([k, nr], { value: (e) => e[1] }), { default: null })
|
|
1558
|
+
], { value: (e, t) => H(t, {
|
|
1559
|
+
contextText: G(e[0]),
|
|
1411
1560
|
kind: "delete_portion",
|
|
1412
1561
|
targetCitation: e[3]?.citation ?? void 0,
|
|
1413
|
-
targetReference: e[2] ??
|
|
1414
|
-
}) }),
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
], { value: (e, t) =>
|
|
1420
|
-
contextText:
|
|
1562
|
+
targetReference: e[2] ?? Y(e[0])
|
|
1563
|
+
}) }), ar = T([
|
|
1564
|
+
W,
|
|
1565
|
+
E(D("r[eé]diger\\s+ainsi", { flags: "i" }), D("r[eé]tablir", { flags: "i" })),
|
|
1566
|
+
J,
|
|
1567
|
+
q
|
|
1568
|
+
], { value: (e, t) => H(t, {
|
|
1569
|
+
contextText: G(e[0]),
|
|
1421
1570
|
kind: "rewrite_portion",
|
|
1422
1571
|
replacementCitation: e[3].citation,
|
|
1423
|
-
targetReference:
|
|
1424
|
-
}) }),
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
D(
|
|
1432
|
-
|
|
1433
|
-
], { value: (e, t) =>
|
|
1434
|
-
contextText:
|
|
1572
|
+
targetReference: Y(e[0])
|
|
1573
|
+
}) }), or = T([
|
|
1574
|
+
W,
|
|
1575
|
+
E(D("substituer", { flags: "i" }), D("remplacer", { flags: "i" })),
|
|
1576
|
+
k,
|
|
1577
|
+
Gn,
|
|
1578
|
+
Qn,
|
|
1579
|
+
D("\\s*,?\\s*"),
|
|
1580
|
+
O(D("par\\s+", { flags: "i" }), { default: "" }),
|
|
1581
|
+
$n
|
|
1582
|
+
], { value: (e, t) => H(t, {
|
|
1583
|
+
contextText: G(e[0]),
|
|
1435
1584
|
kind: "replace",
|
|
1436
1585
|
replacementCitation: e[7].citation,
|
|
1437
1586
|
targetCitation: e[4].citation,
|
|
1438
|
-
targetReference:
|
|
1439
|
-
}) }),
|
|
1587
|
+
targetReference: Y(e[0])
|
|
1588
|
+
}) }), sr = T([
|
|
1589
|
+
W,
|
|
1590
|
+
D("substituer", { flags: "i" }),
|
|
1591
|
+
k,
|
|
1592
|
+
O(D("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
|
|
1440
1593
|
U,
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
E("[\\s\\S]*?(?=[«“\"]|$)"),
|
|
1446
|
-
K
|
|
1447
|
-
], { value: (e, t) => V(t, {
|
|
1448
|
-
contextText: W(e[0]),
|
|
1594
|
+
D("[\\s\\S]*?(?=[«“\"]|$)"),
|
|
1595
|
+
q
|
|
1596
|
+
], { value: (e, t) => H(t, {
|
|
1597
|
+
contextText: G(e[0]),
|
|
1449
1598
|
kind: "rewrite_portion",
|
|
1450
1599
|
replacementCitation: e[6].citation,
|
|
1451
|
-
targetReference: e[4] ??
|
|
1452
|
-
}) }),
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
], { value: (e, t) =>
|
|
1600
|
+
targetReference: e[4] ?? Y(e[0])
|
|
1601
|
+
}) }), cr = T([
|
|
1602
|
+
s,
|
|
1603
|
+
k,
|
|
1604
|
+
D("l['’ ]article", { flags: "i" }),
|
|
1605
|
+
D("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1606
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
1607
|
+
J,
|
|
1608
|
+
q
|
|
1609
|
+
], { value: (e, t) => H(t, {
|
|
1461
1610
|
contextText: "",
|
|
1462
1611
|
insertCitation: e[6].citation,
|
|
1463
1612
|
kind: e[0] === "before" ? "insert_article_before" : "insert_article_after"
|
|
1464
|
-
}) }),
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
], { value: (e,
|
|
1613
|
+
}) }), lr = T([
|
|
1614
|
+
s,
|
|
1615
|
+
k,
|
|
1616
|
+
U,
|
|
1617
|
+
D("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1618
|
+
E(D("ins[eé]rer", { flags: "i" }), D("ajouter", { flags: "i" })),
|
|
1619
|
+
J,
|
|
1620
|
+
q
|
|
1621
|
+
], { value: (e, n) => H(n, {
|
|
1473
1622
|
contextText: "",
|
|
1474
1623
|
insertCitation: e[6].citation,
|
|
1475
|
-
kind:
|
|
1624
|
+
kind: t(e[0]),
|
|
1476
1625
|
targetReference: e[2]
|
|
1477
|
-
}) }),
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
], { value: (e,
|
|
1626
|
+
}) }), ur = T([
|
|
1627
|
+
s,
|
|
1628
|
+
k,
|
|
1629
|
+
D("l['’ ]alin[eé]a", { flags: "i" }),
|
|
1630
|
+
D("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1631
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
1632
|
+
J,
|
|
1633
|
+
q
|
|
1634
|
+
], { value: (e, n) => H(n, {
|
|
1486
1635
|
contextText: "",
|
|
1487
1636
|
insertCitation: e[6].citation,
|
|
1488
|
-
kind:
|
|
1489
|
-
}) }),
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1637
|
+
kind: t(e[0])
|
|
1638
|
+
}) }), dr = T([
|
|
1639
|
+
W,
|
|
1640
|
+
n,
|
|
1641
|
+
D("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1642
|
+
E(D("ins[eé]rer", { flags: "i" }), D("ajouter", { flags: "i" })),
|
|
1643
|
+
J,
|
|
1644
|
+
q
|
|
1496
1645
|
], { value: (e, t) => {
|
|
1497
|
-
let n = e[0], r =
|
|
1498
|
-
return
|
|
1499
|
-
contextText:
|
|
1646
|
+
let n = e[0], r = Y(n), i = e[1];
|
|
1647
|
+
return H(t, {
|
|
1648
|
+
contextText: G(n),
|
|
1500
1649
|
insertCitation: e[5].citation,
|
|
1501
|
-
kind:
|
|
1650
|
+
kind: Hn(i),
|
|
1502
1651
|
targetReference: r,
|
|
1503
|
-
targetScope:
|
|
1652
|
+
targetScope: Vn(i, r)
|
|
1504
1653
|
});
|
|
1505
|
-
} }),
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
], { value: (e,
|
|
1515
|
-
contextText:
|
|
1654
|
+
} }), fr = T([
|
|
1655
|
+
W,
|
|
1656
|
+
s,
|
|
1657
|
+
k,
|
|
1658
|
+
tr,
|
|
1659
|
+
D("[\\s\\S]*?(?=ins[eé]rer)"),
|
|
1660
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
1661
|
+
k,
|
|
1662
|
+
$n
|
|
1663
|
+
], { value: (e, n) => H(n, {
|
|
1664
|
+
contextText: G(e[0]),
|
|
1516
1665
|
insertCitation: e[7].citation,
|
|
1517
|
-
kind:
|
|
1666
|
+
kind: t(e[1]),
|
|
1518
1667
|
targetCitation: e[3].citation,
|
|
1519
|
-
targetReference:
|
|
1520
|
-
}) }),
|
|
1668
|
+
targetReference: Y(e[0])
|
|
1669
|
+
}) }), pr = T([
|
|
1670
|
+
W,
|
|
1671
|
+
s,
|
|
1672
|
+
k,
|
|
1521
1673
|
U,
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
K
|
|
1529
|
-
], { value: (e, t) => V(t, {
|
|
1530
|
-
contextText: W(e[0]),
|
|
1674
|
+
D("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1675
|
+
E(D("ins[eé]rer", { flags: "i" }), D("ajouter", { flags: "i" })),
|
|
1676
|
+
J,
|
|
1677
|
+
q
|
|
1678
|
+
], { value: (e, n) => H(n, {
|
|
1679
|
+
contextText: G(e[0]),
|
|
1531
1680
|
insertCitation: e[7].citation,
|
|
1532
|
-
kind:
|
|
1533
|
-
targetReference:
|
|
1534
|
-
}) }),
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1681
|
+
kind: t(e[1]),
|
|
1682
|
+
targetReference: Y(e[0]) ?? e[3]
|
|
1683
|
+
}) }), mr = E(dr, cr, lr, ur, sr, T([
|
|
1684
|
+
W,
|
|
1685
|
+
s,
|
|
1686
|
+
k,
|
|
1687
|
+
tr,
|
|
1688
|
+
D("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
|
|
1689
|
+
E(T([
|
|
1690
|
+
D("supprimer", {
|
|
1542
1691
|
flags: "i",
|
|
1543
1692
|
value: "delete_portion"
|
|
1544
1693
|
}),
|
|
1545
|
-
|
|
1546
|
-
|
|
1694
|
+
k,
|
|
1695
|
+
Wn
|
|
1547
1696
|
], { value: (e) => ({
|
|
1548
1697
|
kind: e[0],
|
|
1549
1698
|
...e[2]
|
|
1550
|
-
}) }),
|
|
1551
|
-
|
|
1699
|
+
}) }), T([
|
|
1700
|
+
D("r[eé]diger\\s+ainsi", {
|
|
1552
1701
|
flags: "i",
|
|
1553
1702
|
value: "rewrite_portion"
|
|
1554
1703
|
}),
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1704
|
+
k,
|
|
1705
|
+
Wn,
|
|
1706
|
+
J,
|
|
1707
|
+
q
|
|
1559
1708
|
], { value: (e) => ({
|
|
1560
1709
|
kind: e[0],
|
|
1561
1710
|
replacementCitation: e[4].citation,
|
|
@@ -1563,49 +1712,49 @@ var Qn = w([Rn, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1563
1712
|
}) }))
|
|
1564
1713
|
], { value: (e, t) => {
|
|
1565
1714
|
let n = e[5];
|
|
1566
|
-
return
|
|
1567
|
-
contextText:
|
|
1715
|
+
return H(t, {
|
|
1716
|
+
contextText: G(e[0]),
|
|
1568
1717
|
kind: n.kind,
|
|
1569
1718
|
replacementCitation: n.replacementCitation,
|
|
1570
1719
|
targetCitation: e[3].citation,
|
|
1571
|
-
targetReference:
|
|
1720
|
+
targetReference: Y(e[0]) ?? n.targetReference,
|
|
1572
1721
|
targetScope: n.targetScope
|
|
1573
1722
|
});
|
|
1574
|
-
} }),
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
], { value: (e,
|
|
1723
|
+
} }), fr, pr, T([
|
|
1724
|
+
Un,
|
|
1725
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
1726
|
+
D(`[\\s\\S]*?(?=${y})`, { flags: "i" }),
|
|
1727
|
+
s,
|
|
1728
|
+
J,
|
|
1729
|
+
i,
|
|
1730
|
+
J,
|
|
1731
|
+
i
|
|
1732
|
+
], { value: (e, n) => H(n, {
|
|
1584
1733
|
contextText: e[0],
|
|
1585
1734
|
insertCitation: e[8],
|
|
1586
|
-
kind:
|
|
1735
|
+
kind: t(e[3]),
|
|
1587
1736
|
targetCitation: e[6]
|
|
1588
|
-
}) }),
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
], { value: (e, t) =>
|
|
1595
|
-
contextText:
|
|
1737
|
+
}) }), or, ar, T([
|
|
1738
|
+
W,
|
|
1739
|
+
D("compl[eé]ter", { flags: "i" }),
|
|
1740
|
+
O(T([k, U], { value: (e) => e[1] }), { default: null }),
|
|
1741
|
+
J,
|
|
1742
|
+
q
|
|
1743
|
+
], { value: (e, t) => H(t, {
|
|
1744
|
+
contextText: G(e[0]),
|
|
1596
1745
|
insertCitation: e[4].citation,
|
|
1597
1746
|
kind: "insert_after",
|
|
1598
|
-
targetReference: e[2] ??
|
|
1599
|
-
}) }),
|
|
1747
|
+
targetReference: e[2] ?? Y(e[0])
|
|
1748
|
+
}) }), rr, ir);
|
|
1600
1749
|
//#endregion
|
|
1601
1750
|
//#region src/lib/server/parsed_amendments.ts
|
|
1602
|
-
function
|
|
1751
|
+
function hr(e) {
|
|
1603
1752
|
return e.replace(/\s+/gu, " ").trim();
|
|
1604
1753
|
}
|
|
1605
|
-
function
|
|
1606
|
-
return e.split(/\n/gu).map(
|
|
1754
|
+
function gr(e) {
|
|
1755
|
+
return e.split(/\n/gu).map(hr).filter(Boolean).join("\n");
|
|
1607
1756
|
}
|
|
1608
|
-
function
|
|
1757
|
+
function _r(e, t) {
|
|
1609
1758
|
let { start: n, stop: r } = t;
|
|
1610
1759
|
for (; n < r && /\s/u.test(e[n]);) n++;
|
|
1611
1760
|
for (; r > n && /\s/u.test(e[r - 1]);) r--;
|
|
@@ -1614,16 +1763,16 @@ function fr(e, t) {
|
|
|
1614
1763
|
stop: r
|
|
1615
1764
|
} : null;
|
|
1616
1765
|
}
|
|
1617
|
-
function
|
|
1618
|
-
return
|
|
1766
|
+
function vr(e, t) {
|
|
1767
|
+
return se(ce(e), t);
|
|
1619
1768
|
}
|
|
1620
|
-
function
|
|
1769
|
+
function yr(e) {
|
|
1621
1770
|
return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
|
|
1622
1771
|
}
|
|
1623
|
-
function
|
|
1772
|
+
function br(e) {
|
|
1624
1773
|
return {
|
|
1625
1774
|
articleLabel: e.targetArticleLabel ?? null,
|
|
1626
|
-
targetPosition:
|
|
1775
|
+
targetPosition: yr(e.targetPosition),
|
|
1627
1776
|
alinea: e.targetAlinea ?? null,
|
|
1628
1777
|
alineaLabel: e.targetAlineaLabel ?? null,
|
|
1629
1778
|
subdivisionSourceId: e.targetSubdivisionSourceId ?? null,
|
|
@@ -1631,75 +1780,75 @@ function hr(e) {
|
|
|
1631
1780
|
subpos: e.targetSubpos ?? null
|
|
1632
1781
|
};
|
|
1633
1782
|
}
|
|
1634
|
-
function
|
|
1783
|
+
function X(e) {
|
|
1635
1784
|
return {
|
|
1636
1785
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
1637
1786
|
sourcePosition: e.position,
|
|
1638
1787
|
sourceText: e.text
|
|
1639
1788
|
};
|
|
1640
1789
|
}
|
|
1641
|
-
function
|
|
1790
|
+
function xr(e) {
|
|
1642
1791
|
return {
|
|
1643
1792
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
1644
1793
|
sourcePosition: e.position,
|
|
1645
1794
|
sourceText: e.text
|
|
1646
1795
|
};
|
|
1647
1796
|
}
|
|
1648
|
-
function
|
|
1797
|
+
function Sr(e) {
|
|
1649
1798
|
return {
|
|
1650
1799
|
...e?.originalTransformation === void 0 ? {} : { dispositifOriginalTransformation: e.originalTransformation },
|
|
1651
1800
|
...e === null ? {} : { dispositifPosition: e.position },
|
|
1652
1801
|
dispositifText: e?.text ?? null
|
|
1653
1802
|
};
|
|
1654
1803
|
}
|
|
1655
|
-
function
|
|
1804
|
+
function Z(e, t, n, r = gr(e.slice(n.start, n.stop))) {
|
|
1656
1805
|
return {
|
|
1657
|
-
originalTransformation:
|
|
1806
|
+
originalTransformation: vr(t, n),
|
|
1658
1807
|
position: n,
|
|
1659
1808
|
text: r
|
|
1660
1809
|
};
|
|
1661
1810
|
}
|
|
1662
|
-
function
|
|
1811
|
+
function Cr(e) {
|
|
1663
1812
|
let t = e.dispositifHtml ?? e.dispositifText;
|
|
1664
1813
|
if (!t) return null;
|
|
1665
|
-
let n = e.dispositifHtml ? le()(t) :
|
|
1814
|
+
let n = e.dispositifHtml ? le()(t) : me(t), r = n.output, i = _r(r, {
|
|
1666
1815
|
start: 0,
|
|
1667
1816
|
stop: r.length
|
|
1668
1817
|
});
|
|
1669
1818
|
return {
|
|
1670
|
-
dispositif: i === null ? null :
|
|
1819
|
+
dispositif: i === null ? null : Z(r, n, i),
|
|
1671
1820
|
simplifiedText: r,
|
|
1672
1821
|
transformation: n
|
|
1673
1822
|
};
|
|
1674
1823
|
}
|
|
1675
|
-
function
|
|
1824
|
+
function Q(e) {
|
|
1676
1825
|
if (!e) return [];
|
|
1677
|
-
if (e.type === "enumeration") return [...
|
|
1826
|
+
if (e.type === "enumeration") return [...Q(e.left), ...Q(e.right)];
|
|
1678
1827
|
if (e.type === "bounded-interval") {
|
|
1679
|
-
let t =
|
|
1828
|
+
let t = Q(e.first)[0], n = Q(e.last)[0];
|
|
1680
1829
|
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);
|
|
1681
1830
|
}
|
|
1682
1831
|
if (e.type === "counted-interval") {
|
|
1683
|
-
let t =
|
|
1832
|
+
let t = Q(e.first)[0];
|
|
1684
1833
|
return t === void 0 ? [] : Array.from({ length: e.count }, (e, n) => t + n);
|
|
1685
1834
|
}
|
|
1686
|
-
if (e.type === "exclusion") return
|
|
1687
|
-
for (let t of
|
|
1835
|
+
if (e.type === "exclusion") return Q(e.left);
|
|
1836
|
+
for (let t of a(e)) if (t.type === "alinéa" && typeof t.index == "number" && t.index > 0) return [t.index];
|
|
1688
1837
|
return [];
|
|
1689
1838
|
}
|
|
1690
|
-
function
|
|
1691
|
-
let n =
|
|
1839
|
+
function wr(e, t) {
|
|
1840
|
+
let n = Q(t);
|
|
1692
1841
|
return {
|
|
1693
1842
|
...e,
|
|
1694
1843
|
alinea: n[0] ?? e.alinea ?? null,
|
|
1695
1844
|
...n.length > 0 ? { alineas: n } : {}
|
|
1696
1845
|
};
|
|
1697
1846
|
}
|
|
1698
|
-
function
|
|
1847
|
+
function Tr(e) {
|
|
1699
1848
|
return e.replace(/^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*/iu, "").replace(/^\s*(?:\d+°|[a-z]\))\s*/iu, "").trim();
|
|
1700
1849
|
}
|
|
1701
|
-
function
|
|
1702
|
-
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(
|
|
1850
|
+
function Er(e, t) {
|
|
1851
|
+
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(Tr(t.text));
|
|
1703
1852
|
if (!n) return null;
|
|
1704
1853
|
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10);
|
|
1705
1854
|
return !Number.isFinite(r) || r < 1 ? null : {
|
|
@@ -1708,25 +1857,25 @@ function xr(e, t) {
|
|
|
1708
1857
|
alineas: [r]
|
|
1709
1858
|
};
|
|
1710
1859
|
}
|
|
1711
|
-
function
|
|
1860
|
+
function Dr(e, t) {
|
|
1712
1861
|
if (e) return e.unit === "article" && t.alinea !== null ? {
|
|
1713
1862
|
...e,
|
|
1714
1863
|
unit: "alinéa"
|
|
1715
1864
|
} : e;
|
|
1716
1865
|
}
|
|
1717
|
-
function
|
|
1718
|
-
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(
|
|
1866
|
+
function Or(e) {
|
|
1867
|
+
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(Tr(e.text));
|
|
1719
1868
|
}
|
|
1720
|
-
function
|
|
1721
|
-
return
|
|
1869
|
+
function kr(e, t, n, r) {
|
|
1870
|
+
return Z(e, t, {
|
|
1722
1871
|
start: n.position.start,
|
|
1723
1872
|
stop: r.position.stop
|
|
1724
1873
|
});
|
|
1725
1874
|
}
|
|
1726
|
-
function
|
|
1875
|
+
function Ar(e) {
|
|
1727
1876
|
return /^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*(?!alin[eé]a\b)/iu.test(e.text);
|
|
1728
1877
|
}
|
|
1729
|
-
function
|
|
1878
|
+
function jr(e, t) {
|
|
1730
1879
|
let n = { ...t.position };
|
|
1731
1880
|
function r(t) {
|
|
1732
1881
|
let r = t.exec(e.slice(n.start, n.stop));
|
|
@@ -1735,39 +1884,39 @@ function Er(e, t) {
|
|
|
1735
1884
|
stop: n.stop
|
|
1736
1885
|
});
|
|
1737
1886
|
}
|
|
1738
|
-
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),
|
|
1887
|
+
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), _r(e, n);
|
|
1739
1888
|
}
|
|
1740
|
-
function
|
|
1741
|
-
return
|
|
1889
|
+
function Mr(e) {
|
|
1890
|
+
return ae(e);
|
|
1742
1891
|
}
|
|
1743
|
-
function
|
|
1744
|
-
return
|
|
1892
|
+
function Nr(e, t) {
|
|
1893
|
+
return mr(new ue(e.slice(0, t.stop), t.start)) ?? null;
|
|
1745
1894
|
}
|
|
1746
|
-
function
|
|
1747
|
-
if (n) return
|
|
1895
|
+
function $(e, t, n) {
|
|
1896
|
+
if (n) return Z(e, t, n.position, gr(f(e, n)));
|
|
1748
1897
|
}
|
|
1749
|
-
function
|
|
1898
|
+
function Pr(e, t) {
|
|
1750
1899
|
if (!e) return;
|
|
1751
1900
|
let n = structuredClone(e);
|
|
1752
|
-
for (let e of
|
|
1901
|
+
for (let e of o(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = vr(t, e.position));
|
|
1753
1902
|
return n;
|
|
1754
1903
|
}
|
|
1755
|
-
function
|
|
1756
|
-
let i =
|
|
1904
|
+
function Fr(e, t, n, r) {
|
|
1905
|
+
let i = jr(e, n);
|
|
1757
1906
|
if (!i) return null;
|
|
1758
|
-
let a =
|
|
1907
|
+
let a = Nr(e, i);
|
|
1759
1908
|
if (!a) return null;
|
|
1760
|
-
let o =
|
|
1909
|
+
let o = Z(e, t, i), s = Pr(a.targetReference, t), c = wr(r, s), l = Mr(o.text);
|
|
1761
1910
|
if (a.kind === "delete_article") return {
|
|
1762
1911
|
kind: "delete_article",
|
|
1763
|
-
...
|
|
1912
|
+
...X(o),
|
|
1764
1913
|
target: c
|
|
1765
1914
|
};
|
|
1766
1915
|
if (a.kind === "delete_portion") {
|
|
1767
|
-
let n =
|
|
1916
|
+
let n = $(e, t, a.targetCitation);
|
|
1768
1917
|
return {
|
|
1769
1918
|
kind: "delete_portion",
|
|
1770
|
-
...
|
|
1919
|
+
...X(o),
|
|
1771
1920
|
target: c,
|
|
1772
1921
|
...n === void 0 ? {} : {
|
|
1773
1922
|
targetCitation: n,
|
|
@@ -1775,16 +1924,16 @@ function Ar(e, t, n, r) {
|
|
|
1775
1924
|
},
|
|
1776
1925
|
targetOccurrence: l,
|
|
1777
1926
|
targetReference: s,
|
|
1778
|
-
targetScope:
|
|
1927
|
+
targetScope: Dr(a.targetScope, c)
|
|
1779
1928
|
};
|
|
1780
1929
|
}
|
|
1781
1930
|
if (a.kind === "rewrite_portion") {
|
|
1782
|
-
let n =
|
|
1931
|
+
let n = $(e, t, a.replacementCitation);
|
|
1783
1932
|
if (!n) return null;
|
|
1784
|
-
let r =
|
|
1933
|
+
let r = $(e, t, a.targetCitation);
|
|
1785
1934
|
return {
|
|
1786
1935
|
kind: "rewrite_portion",
|
|
1787
|
-
...
|
|
1936
|
+
...X(o),
|
|
1788
1937
|
target: c,
|
|
1789
1938
|
...r === void 0 ? {} : {
|
|
1790
1939
|
targetCitation: r,
|
|
@@ -1792,16 +1941,16 @@ function Ar(e, t, n, r) {
|
|
|
1792
1941
|
},
|
|
1793
1942
|
targetOccurrence: l,
|
|
1794
1943
|
targetReference: s,
|
|
1795
|
-
targetScope:
|
|
1944
|
+
targetScope: Dr(a.targetScope, c),
|
|
1796
1945
|
replacementCitation: n,
|
|
1797
1946
|
replacementText: n.text
|
|
1798
1947
|
};
|
|
1799
1948
|
}
|
|
1800
1949
|
if (a.kind === "replace") {
|
|
1801
|
-
let n =
|
|
1950
|
+
let n = $(e, t, a.replacementCitation), r = $(e, t, a.targetCitation);
|
|
1802
1951
|
return !n || !r ? null : {
|
|
1803
1952
|
kind: "replace",
|
|
1804
|
-
...
|
|
1953
|
+
...X(o),
|
|
1805
1954
|
target: c,
|
|
1806
1955
|
targetCitation: r,
|
|
1807
1956
|
targetText: r.text,
|
|
@@ -1812,32 +1961,32 @@ function Ar(e, t, n, r) {
|
|
|
1812
1961
|
};
|
|
1813
1962
|
}
|
|
1814
1963
|
if (a.kind === "insert_article_after") {
|
|
1815
|
-
let n =
|
|
1964
|
+
let n = $(e, t, a.insertCitation);
|
|
1816
1965
|
return n ? {
|
|
1817
1966
|
kind: "insert_article_after",
|
|
1818
|
-
...
|
|
1967
|
+
...X(o),
|
|
1819
1968
|
target: c,
|
|
1820
1969
|
insertCitation: n,
|
|
1821
1970
|
insertText: n.text
|
|
1822
1971
|
} : null;
|
|
1823
1972
|
}
|
|
1824
1973
|
if (a.kind === "insert_article_before") {
|
|
1825
|
-
let n =
|
|
1974
|
+
let n = $(e, t, a.insertCitation);
|
|
1826
1975
|
return n ? {
|
|
1827
1976
|
kind: "insert_article_before",
|
|
1828
|
-
...
|
|
1977
|
+
...X(o),
|
|
1829
1978
|
target: c,
|
|
1830
1979
|
insertCitation: n,
|
|
1831
1980
|
insertText: n.text
|
|
1832
1981
|
} : null;
|
|
1833
1982
|
}
|
|
1834
1983
|
if (a.kind === "insert_after" || a.kind === "insert_before") {
|
|
1835
|
-
let n =
|
|
1984
|
+
let n = $(e, t, a.insertCitation);
|
|
1836
1985
|
if (!n) return null;
|
|
1837
|
-
let r =
|
|
1986
|
+
let r = $(e, t, a.targetCitation);
|
|
1838
1987
|
return {
|
|
1839
1988
|
kind: a.kind,
|
|
1840
|
-
...
|
|
1989
|
+
...X(o),
|
|
1841
1990
|
target: c,
|
|
1842
1991
|
...r === void 0 ? {} : {
|
|
1843
1992
|
targetCitation: r,
|
|
@@ -1847,19 +1996,19 @@ function Ar(e, t, n, r) {
|
|
|
1847
1996
|
targetReference: s,
|
|
1848
1997
|
insertCitation: n,
|
|
1849
1998
|
insertText: n.text,
|
|
1850
|
-
targetScope:
|
|
1999
|
+
targetScope: Dr(a.targetScope, c)
|
|
1851
2000
|
};
|
|
1852
2001
|
}
|
|
1853
2002
|
return null;
|
|
1854
2003
|
}
|
|
1855
|
-
function
|
|
2004
|
+
function Ir(e, t) {
|
|
1856
2005
|
let n = [], r = 0, i = 0;
|
|
1857
2006
|
function a(r) {
|
|
1858
|
-
let a =
|
|
2007
|
+
let a = _r(e, {
|
|
1859
2008
|
start: i,
|
|
1860
2009
|
stop: r
|
|
1861
2010
|
});
|
|
1862
|
-
a !== null && n.push(
|
|
2011
|
+
a !== null && n.push(Z(e, t, a));
|
|
1863
2012
|
}
|
|
1864
2013
|
function o(t) {
|
|
1865
2014
|
let n = Math.max(e.lastIndexOf("\n", t - 1), e.lastIndexOf("\r", t - 1));
|
|
@@ -1877,7 +2026,7 @@ function jr(e, t) {
|
|
|
1877
2026
|
continue;
|
|
1878
2027
|
}
|
|
1879
2028
|
if (r > 0) continue;
|
|
1880
|
-
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) &&
|
|
2029
|
+
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) && Or({
|
|
1881
2030
|
originalTransformation: void 0,
|
|
1882
2031
|
position: {
|
|
1883
2032
|
start: i,
|
|
@@ -1889,8 +2038,8 @@ function jr(e, t) {
|
|
|
1889
2038
|
}
|
|
1890
2039
|
return a(e.length), n;
|
|
1891
2040
|
}
|
|
1892
|
-
function
|
|
1893
|
-
let t =
|
|
2041
|
+
function Lr(e) {
|
|
2042
|
+
let t = Cr(e), n = t?.dispositif ?? null, r = Sr(n), i = [], a = [], o = br(e);
|
|
1894
2043
|
if (e.sourceFormat === "senat-ameli" && e.sourceKind === "S") return i.push({
|
|
1895
2044
|
code: "unsupported_sub_amendment",
|
|
1896
2045
|
message: "Les sous-amendements ne sont pas encore projetés."
|
|
@@ -1908,9 +2057,9 @@ function Mr(e) {
|
|
|
1908
2057
|
});
|
|
1909
2058
|
else {
|
|
1910
2059
|
let { simplifiedText: e, transformation: r } = t, s = o, c = null;
|
|
1911
|
-
for (let t of
|
|
1912
|
-
|
|
1913
|
-
let n = c ?
|
|
2060
|
+
for (let t of Ir(e, r)) {
|
|
2061
|
+
Ar(t) && (s = o, c = null);
|
|
2062
|
+
let n = c ? kr(e, r, c, t) : t, i = Fr(e, r, n, s);
|
|
1914
2063
|
if (i) {
|
|
1915
2064
|
a.push(i), c = null, (i.target.alinea !== null || i.target.alineas) && (s = i.target);
|
|
1916
2065
|
continue;
|
|
@@ -1919,23 +2068,23 @@ function Mr(e) {
|
|
|
1919
2068
|
c = n;
|
|
1920
2069
|
continue;
|
|
1921
2070
|
}
|
|
1922
|
-
let l =
|
|
2071
|
+
let l = Er(o, t);
|
|
1923
2072
|
if (l !== null) {
|
|
1924
2073
|
s = l;
|
|
1925
2074
|
continue;
|
|
1926
2075
|
}
|
|
1927
|
-
|
|
2076
|
+
Or(t) && (c = t);
|
|
1928
2077
|
}
|
|
1929
2078
|
a.length === 0 && (o.targetPosition === "after_article" || o.targetPosition === "before_article") && a.push({
|
|
1930
2079
|
kind: o.targetPosition === "before_article" ? "insert_article_before" : "insert_article_after",
|
|
1931
|
-
...
|
|
2080
|
+
...X(n),
|
|
1932
2081
|
target: o,
|
|
1933
2082
|
insertCitation: n,
|
|
1934
2083
|
insertText: n.text
|
|
1935
2084
|
}), a.length === 0 && i.push({
|
|
1936
2085
|
code: "unrecognized_dispositif",
|
|
1937
2086
|
message: "Le dispositif est présent mais aucune directive d'amendement n'a été reconnue.",
|
|
1938
|
-
...
|
|
2087
|
+
...xr(n)
|
|
1939
2088
|
});
|
|
1940
2089
|
}
|
|
1941
2090
|
return {
|
|
@@ -1949,25 +2098,25 @@ function Mr(e) {
|
|
|
1949
2098
|
}
|
|
1950
2099
|
//#endregion
|
|
1951
2100
|
//#region src/lib/server/senat_document_search.ts
|
|
1952
|
-
function
|
|
2101
|
+
function Rr(e) {
|
|
1953
2102
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1954
2103
|
}
|
|
1955
|
-
function
|
|
1956
|
-
let t =
|
|
2104
|
+
function zr(e) {
|
|
2105
|
+
let t = w(e);
|
|
1957
2106
|
if (!t) return {
|
|
1958
2107
|
articleNumber: null,
|
|
1959
2108
|
label: e,
|
|
1960
2109
|
title: null
|
|
1961
2110
|
};
|
|
1962
|
-
let n =
|
|
2111
|
+
let n = Rr(t.num ?? "") || null, r = Rr(t.title ?? "") || null;
|
|
1963
2112
|
return {
|
|
1964
2113
|
articleNumber: n,
|
|
1965
2114
|
label: t.label,
|
|
1966
2115
|
title: r
|
|
1967
2116
|
};
|
|
1968
2117
|
}
|
|
1969
|
-
function
|
|
1970
|
-
let t =
|
|
2118
|
+
function Br(e) {
|
|
2119
|
+
let t = S(e), n = [], r = Rr(t("section.akn-preamble").text());
|
|
1971
2120
|
return r && n.push({
|
|
1972
2121
|
anchor: "senat-expose-des-motifs",
|
|
1973
2122
|
articleNumber: null,
|
|
@@ -1977,9 +2126,9 @@ function Pr(e) {
|
|
|
1977
2126
|
label: "Exposé des motifs",
|
|
1978
2127
|
title: null
|
|
1979
2128
|
}), t("article.akn-article").each((e, r) => {
|
|
1980
|
-
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o =
|
|
2129
|
+
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o = Rr(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = zr(o || s), l = i.clone();
|
|
1981
2130
|
l.children("p.TCNumArticle").remove();
|
|
1982
|
-
let u =
|
|
2131
|
+
let u = Rr(l.text());
|
|
1983
2132
|
u && n.push({
|
|
1984
2133
|
anchor: i.attr("id") || null,
|
|
1985
2134
|
articleNumber: c.articleNumber,
|
|
@@ -1991,40 +2140,40 @@ function Pr(e) {
|
|
|
1991
2140
|
});
|
|
1992
2141
|
}), n;
|
|
1993
2142
|
}
|
|
1994
|
-
function
|
|
1995
|
-
return
|
|
2143
|
+
function Vr(e, t) {
|
|
2144
|
+
return be("sha256").update(JSON.stringify({
|
|
1996
2145
|
item: e,
|
|
1997
2146
|
metadata: t
|
|
1998
2147
|
})).digest("hex");
|
|
1999
2148
|
}
|
|
2000
2149
|
//#endregion
|
|
2001
2150
|
//#region src/lib/server/senat_document_sources.ts
|
|
2002
|
-
var
|
|
2003
|
-
function
|
|
2151
|
+
var Hr = new Set(["senat.fr", "www.senat.fr"]), Ur = "https://www.senat.fr";
|
|
2152
|
+
function Wr(e) {
|
|
2004
2153
|
return e?.trim() || void 0;
|
|
2005
2154
|
}
|
|
2006
|
-
function
|
|
2155
|
+
function Gr(e) {
|
|
2007
2156
|
try {
|
|
2008
|
-
let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`,
|
|
2009
|
-
return
|
|
2157
|
+
let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`, Ur);
|
|
2158
|
+
return Hr.has(n.hostname.toLowerCase()) ? n : void 0;
|
|
2010
2159
|
} catch {
|
|
2011
2160
|
return;
|
|
2012
2161
|
}
|
|
2013
2162
|
}
|
|
2014
|
-
function
|
|
2015
|
-
let t =
|
|
2163
|
+
function Kr(e) {
|
|
2164
|
+
let t = Wr(e);
|
|
2016
2165
|
if (t === void 0) return {
|
|
2017
2166
|
publicUrl: null,
|
|
2018
2167
|
status: "no_url"
|
|
2019
2168
|
};
|
|
2020
|
-
let n =
|
|
2169
|
+
let n = Gr(t);
|
|
2021
2170
|
if (n === void 0) return {
|
|
2022
2171
|
publicUrl: t,
|
|
2023
2172
|
status: "unsupported_source"
|
|
2024
2173
|
};
|
|
2025
2174
|
let r = n.pathname;
|
|
2026
2175
|
if (/^\/akomantoso\/[^/]+\.akn\.xml$/iu.test(r)) return {
|
|
2027
|
-
akomaNtosoUrl: `${
|
|
2176
|
+
akomaNtosoUrl: `${Ur}${r}`,
|
|
2028
2177
|
publicUrl: n.toString(),
|
|
2029
2178
|
status: "available"
|
|
2030
2179
|
};
|
|
@@ -2033,17 +2182,17 @@ function Br(e) {
|
|
|
2033
2182
|
publicUrl: n.toString(),
|
|
2034
2183
|
status: "unsupported_source"
|
|
2035
2184
|
} : {
|
|
2036
|
-
akomaNtosoUrl: `${
|
|
2185
|
+
akomaNtosoUrl: `${Ur}/akomantoso/${i.replace(/\.html$/iu, ".akn.xml")}`,
|
|
2037
2186
|
publicUrl: n.toString(),
|
|
2038
2187
|
status: "available"
|
|
2039
2188
|
};
|
|
2040
2189
|
}
|
|
2041
|
-
function
|
|
2190
|
+
function qr(e) {
|
|
2042
2191
|
return /^\s*(?:<\?xml\b[^>]*>\s*)?<akomaNtoso[\s/>]/iu.test(e);
|
|
2043
2192
|
}
|
|
2044
2193
|
//#endregion
|
|
2045
2194
|
//#region src/lib/alineas/alineas_numbers.ts
|
|
2046
|
-
var
|
|
2195
|
+
var Jr = {
|
|
2047
2196
|
"0150a855548f15a2af52ea057be53f5d": 1,
|
|
2048
2197
|
"039826cf379b94afefe90b25c6045ca0": 1,
|
|
2049
2198
|
"03a7e564b84662f4d957c51018e26244": 1,
|
|
@@ -21017,7 +21166,7 @@ var Hr = {
|
|
|
21017
21166
|
d16d29c923bd60c7b095b66c6058fe60: 1664,
|
|
21018
21167
|
"1c14c2adf5cfda3220b2057160e10e91": 1665,
|
|
21019
21168
|
e44c55ca1ac46ff46420686a466c9fc6: 1665
|
|
21020
|
-
},
|
|
21169
|
+
}, Yr = "\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", Xr = "\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", Zr = "\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", Qr = "\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", $r = "\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", ei = {
|
|
21021
21170
|
assnatetatagr: { bold: !0 },
|
|
21022
21171
|
assnatetatagrgr: { bold: !0 },
|
|
21023
21172
|
assnatetatatr: { bold: !0 },
|
|
@@ -21118,29 +21267,29 @@ var Hr = {
|
|
|
21118
21267
|
assnatxl67: { align: "center" },
|
|
21119
21268
|
assnatenteteequilibre: { align: "center" }
|
|
21120
21269
|
};
|
|
21121
|
-
function
|
|
21122
|
-
let t = Object.keys(
|
|
21123
|
-
for (let n of t) if (e.includes(n)) return
|
|
21270
|
+
function ti(e) {
|
|
21271
|
+
let t = Object.keys(ei).sort((e, t) => t.length - e.length);
|
|
21272
|
+
for (let n of t) if (e.includes(n)) return ei[n];
|
|
21124
21273
|
return null;
|
|
21125
21274
|
}
|
|
21126
|
-
function
|
|
21275
|
+
function ni(e) {
|
|
21127
21276
|
return ye.createHash("md5").update(e).digest("hex");
|
|
21128
21277
|
}
|
|
21129
|
-
function
|
|
21278
|
+
function ri(e) {
|
|
21130
21279
|
return e ? /font-weight\s*:\s*(bold|[6-9]00|1000)/i.test(e) || /font-family\s*:\s*[^;]*\bBold\b/i.test(e) : !1;
|
|
21131
21280
|
}
|
|
21132
|
-
function
|
|
21281
|
+
function ii(e) {
|
|
21133
21282
|
return e ? /font-style\s*:\s*italic/i.test(e) || /font-family\s*:\s*[^;]*\bItalic\b/i.test(e) : !1;
|
|
21134
21283
|
}
|
|
21135
|
-
function
|
|
21284
|
+
function ai(e) {
|
|
21136
21285
|
if (!e || !/vertical-align\s*:\s*super/i.test(e)) return !1;
|
|
21137
21286
|
let t = e.match(/font-size\s*:\s*([\d.]+)pt/i);
|
|
21138
21287
|
return !(t && parseFloat(t[1]) < 8);
|
|
21139
21288
|
}
|
|
21140
|
-
function
|
|
21289
|
+
function oi(e) {
|
|
21141
21290
|
return e ? /vertical-align\s*:\s*sub/i.test(e) : !1;
|
|
21142
21291
|
}
|
|
21143
|
-
function
|
|
21292
|
+
function si(e) {
|
|
21144
21293
|
if (!e) return;
|
|
21145
21294
|
let t = [
|
|
21146
21295
|
"width",
|
|
@@ -21175,15 +21324,15 @@ function ti(e) {
|
|
|
21175
21324
|
}
|
|
21176
21325
|
return n.length > 0 ? n.join("; ") : void 0;
|
|
21177
21326
|
}
|
|
21178
|
-
function
|
|
21327
|
+
function ci(e, t) {
|
|
21179
21328
|
return !!(e && /text-align\s*:\s*center/i.test(e) || t && /center/i.test(t));
|
|
21180
21329
|
}
|
|
21181
|
-
function
|
|
21330
|
+
function li(e) {
|
|
21182
21331
|
if (!e) return null;
|
|
21183
21332
|
let t = e.match(/text-align\s*:\s*(left|center|right|justify)/i);
|
|
21184
21333
|
return t ? t[1].toLowerCase() : null;
|
|
21185
21334
|
}
|
|
21186
|
-
function
|
|
21335
|
+
function ui(e) {
|
|
21187
21336
|
if (!e) return null;
|
|
21188
21337
|
for (let [t, n] of [
|
|
21189
21338
|
[/assnat1Tome|assnatAN1PARTIE/i, 1],
|
|
@@ -21195,8 +21344,8 @@ function ii(e) {
|
|
|
21195
21344
|
]) if (t.test(e)) return n;
|
|
21196
21345
|
return null;
|
|
21197
21346
|
}
|
|
21198
|
-
function
|
|
21199
|
-
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a =
|
|
21347
|
+
function di(e, t = {}) {
|
|
21348
|
+
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = S(e, { xml: { decodeEntities: !1 } });
|
|
21200
21349
|
a("style, script, meta, link").remove(), a(".assnatHeader, .assnatFooter, .assnatHeaderLeft, .assnatHeaderandFooter").remove(), a(".assnatFARSautApres, .assnatFARSautAvant, .assnatFARSautPageNiv0, .assnatFARSautPageNiv1, .assnatFARSautPageNiv1PG").remove(), a(".assnatFARTT08Bleu").each((e, t) => {
|
|
21201
21350
|
let n = a(t).closest("table");
|
|
21202
21351
|
n.length > 0 && n.remove();
|
|
@@ -21221,7 +21370,7 @@ function ai(e, t = {}) {
|
|
|
21221
21370
|
if (i.length !== 0 && !(n.parents("del").length > 0 || n.find("del img").length > 0) && !(i.parent("del").length > 0)) {
|
|
21222
21371
|
let e = i.attr();
|
|
21223
21372
|
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")) {
|
|
21224
|
-
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ?
|
|
21373
|
+
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? ni(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
|
|
21225
21374
|
n.replaceWith(`<span class="alinea"${i}></span>`);
|
|
21226
21375
|
return;
|
|
21227
21376
|
}
|
|
@@ -21240,7 +21389,7 @@ function ai(e, t = {}) {
|
|
|
21240
21389
|
(!r || r === "\xA0") && n.remove();
|
|
21241
21390
|
}), a("span[style*=\"display:block\"][style*=\"position:absolute\"]:not(.alinea)").remove(), a("del").remove();
|
|
21242
21391
|
function o(e) {
|
|
21243
|
-
let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i =
|
|
21392
|
+
let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = ri(n) || r === "b" || r === "strong", o = ii(n) || r === "i" || r === "em", s = ai(n) || r === "sup", c = oi(n) || r === "sub", l = t.attr("class") || "";
|
|
21244
21393
|
return /bold/i.test(l) && (i = !0), /strongemphasis/i.test(l) ? i = !0 : /italic|emphasis/i.test(l) && (o = !0), {
|
|
21245
21394
|
bold: i,
|
|
21246
21395
|
italic: o,
|
|
@@ -21274,7 +21423,7 @@ function ai(e, t = {}) {
|
|
|
21274
21423
|
c = e;
|
|
21275
21424
|
}
|
|
21276
21425
|
for (a("p").each((e, t) => {
|
|
21277
|
-
let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s =
|
|
21426
|
+
let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s = ui(i);
|
|
21278
21427
|
if (i.includes("assnatFARCouvTitreD")) {
|
|
21279
21428
|
let e = r.html() || "";
|
|
21280
21429
|
r.replaceWith(`<p class="cover-subtitle">${e}</p>`);
|
|
@@ -21307,11 +21456,11 @@ function ai(e, t = {}) {
|
|
|
21307
21456
|
let c = r.text().trim().startsWith("«");
|
|
21308
21457
|
if (s && !c) {
|
|
21309
21458
|
let e = a(`<h${s}>${r.html() || ""}</h${s}>`);
|
|
21310
|
-
n &&
|
|
21459
|
+
n && ci(o, i) && e.attr("align", "center"), r.replaceWith(e);
|
|
21311
21460
|
} else {
|
|
21312
|
-
let e =
|
|
21461
|
+
let e = ti(i), t;
|
|
21313
21462
|
if (n) {
|
|
21314
|
-
let n =
|
|
21463
|
+
let n = li(o);
|
|
21315
21464
|
n && n !== "justify" && n !== "left" ? t = n : e?.align && (t = e.align);
|
|
21316
21465
|
}
|
|
21317
21466
|
if (r.removeAttr("style").removeAttr("class"), t && r.attr("align", t), e?.bold) {
|
|
@@ -21321,7 +21470,7 @@ function ai(e, t = {}) {
|
|
|
21321
21470
|
}
|
|
21322
21471
|
}), a("h1, h2, h3, h4, h5, h6").each((e, t) => {
|
|
21323
21472
|
let r = a(t), i = r.attr("style"), o = r.attr("class");
|
|
21324
|
-
n &&
|
|
21473
|
+
n && ci(i, o) ? (r.removeAttr("style").removeAttr("class"), r.attr("align", "center")) : r.removeAttr("style").removeAttr("class");
|
|
21325
21474
|
}), a("a").each((e, t) => {
|
|
21326
21475
|
let n = a(t), r = n.attr("href"), i = n.attr("id"), o = { ...t.attribs || {} };
|
|
21327
21476
|
for (let e of Object.keys(o)) e !== "href" && e !== "id" && n.removeAttr(e);
|
|
@@ -21360,7 +21509,7 @@ function ai(e, t = {}) {
|
|
|
21360
21509
|
}), a("br").each((e, t) => {
|
|
21361
21510
|
a(t).removeAttr("style").removeAttr("class");
|
|
21362
21511
|
}), a("table, tr, td, th, thead, tbody, tfoot").each((e, t) => {
|
|
21363
|
-
let n = a(t), r =
|
|
21512
|
+
let n = a(t), r = si(n.attr("style"));
|
|
21364
21513
|
n.removeAttr("style").removeAttr("class"), r && n.attr("style", r);
|
|
21365
21514
|
}), a("td, th").each((e, t) => {
|
|
21366
21515
|
let n = a(t), r = n.children();
|
|
@@ -21378,17 +21527,17 @@ function ai(e, t = {}) {
|
|
|
21378
21527
|
!isNaN(e) && e > 1 && n.attr("style", `counter-reset: list-counter ${e - 1}`), n.attr("start", r);
|
|
21379
21528
|
}
|
|
21380
21529
|
}), a("li").each((e, t) => {
|
|
21381
|
-
let n = a(t), r =
|
|
21530
|
+
let n = a(t), r = li(n.attr("style"));
|
|
21382
21531
|
n.removeAttr("style").removeAttr("class"), r === "center" && n.attr("style", "text-align: center");
|
|
21383
21532
|
let i = n.html() || "", o = i.replace(/^(\s| | |\u00a0)+/, "");
|
|
21384
21533
|
o !== i && n.html(o);
|
|
21385
|
-
}),
|
|
21534
|
+
}), fi(a), pi(a, i);
|
|
21386
21535
|
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 = "";
|
|
21387
|
-
m && (h +=
|
|
21536
|
+
m && (h += $r), f && (h += Xr), p && (h += Zr), u && (h += Yr), d && (h += Qr);
|
|
21388
21537
|
let g = h ? `<style>${h}</style>\n${l}` : l;
|
|
21389
|
-
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 =
|
|
21538
|
+
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 = mi(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;
|
|
21390
21539
|
}
|
|
21391
|
-
function
|
|
21540
|
+
function fi(e) {
|
|
21392
21541
|
e("span[id]").each((t, n) => {
|
|
21393
21542
|
let r = e(n), i = r.attr("id"), a = n.attribs || {}, o = Object.keys(a);
|
|
21394
21543
|
if (o.length !== 1 || o[0] !== "id") return;
|
|
@@ -21411,13 +21560,13 @@ function oi(e) {
|
|
|
21411
21560
|
l.trim() === u.trim() && (s.attr("id", i), r.replaceWith(r.html() || ""));
|
|
21412
21561
|
});
|
|
21413
21562
|
}
|
|
21414
|
-
function
|
|
21563
|
+
function pi(e, t = !1) {
|
|
21415
21564
|
let n = e("body");
|
|
21416
21565
|
if (n.length === 0) return;
|
|
21417
21566
|
let r = n.find("span.alinea[data-image-hash]"), i = -1;
|
|
21418
21567
|
r.each((n, r) => {
|
|
21419
21568
|
let a = e(r), o = a.attr("data-image-hash"), s;
|
|
21420
|
-
if (o &&
|
|
21569
|
+
if (o && Jr[o] !== void 0 && (s = Jr[o]), s === void 0) {
|
|
21421
21570
|
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".`);
|
|
21422
21571
|
a.remove();
|
|
21423
21572
|
return;
|
|
@@ -21429,11 +21578,11 @@ function si(e, t = !1) {
|
|
|
21429
21578
|
i = s, a.attr("data-alinea", String(s)), a.text(String(s)), a.removeAttr("data-image-hash");
|
|
21430
21579
|
});
|
|
21431
21580
|
}
|
|
21432
|
-
function
|
|
21581
|
+
function mi(e) {
|
|
21433
21582
|
let t = e;
|
|
21434
21583
|
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;
|
|
21435
21584
|
}
|
|
21436
|
-
function
|
|
21585
|
+
function hi(e, t = {}) {
|
|
21437
21586
|
return `<!DOCTYPE html>
|
|
21438
21587
|
<html lang="fr">
|
|
21439
21588
|
<head>
|
|
@@ -21441,13 +21590,13 @@ function li(e, t = {}) {
|
|
|
21441
21590
|
<title>Document simplifié</title>
|
|
21442
21591
|
</head>
|
|
21443
21592
|
<body>
|
|
21444
|
-
${
|
|
21593
|
+
${di(e, t)}
|
|
21445
21594
|
</body>
|
|
21446
21595
|
</html>`;
|
|
21447
21596
|
}
|
|
21448
21597
|
//#endregion
|
|
21449
21598
|
//#region src/lib/server/text_parsers/transformers.ts
|
|
21450
|
-
function
|
|
21599
|
+
function gi(e, t) {
|
|
21451
21600
|
let n = "transformation_", r = {};
|
|
21452
21601
|
for (let e of A.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
|
|
21453
21602
|
let i = e.slice(15, -5), a = i.split(".").map((e) => parseInt(e) - 1), o = r;
|
|
@@ -21460,13 +21609,13 @@ function ui(e, t) {
|
|
|
21460
21609
|
let { sourceMap: s, title: c } = A.readJsonSync(j.join(t, e), { encoding: "utf-8" });
|
|
21461
21610
|
o.sourceMap = s ?? [], o.title = c;
|
|
21462
21611
|
}
|
|
21463
|
-
return
|
|
21612
|
+
return _i(r, e), r;
|
|
21464
21613
|
}
|
|
21465
|
-
function
|
|
21466
|
-
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations)
|
|
21614
|
+
function _i(e, t) {
|
|
21615
|
+
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) _i(n, t), t = n.output;
|
|
21467
21616
|
return t;
|
|
21468
21617
|
}
|
|
21469
|
-
function
|
|
21618
|
+
function vi(e, t, n = "1") {
|
|
21470
21619
|
if (A.ensureDirSync(t), e.transformations === void 0) A.writeJsonSync(j.join(t, `transformation_${n}.json`), {
|
|
21471
21620
|
sourceMap: e.sourceMap,
|
|
21472
21621
|
title: e.title
|
|
@@ -21479,48 +21628,48 @@ function fi(e, t, n = "1") {
|
|
|
21479
21628
|
encoding: "utf-8",
|
|
21480
21629
|
spaces: 2
|
|
21481
21630
|
});
|
|
21482
|
-
for (let [r, i] of e.transformations.entries())
|
|
21631
|
+
for (let [r, i] of e.transformations.entries()) vi(i, t, `${n}.${r + 1}`);
|
|
21483
21632
|
}
|
|
21484
21633
|
e.output !== void 0 && A.writeFileSync(j.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
|
|
21485
21634
|
}
|
|
21486
21635
|
//#endregion
|
|
21487
21636
|
//#region src/lib/server/linkers/html.ts
|
|
21488
|
-
async function
|
|
21489
|
-
let
|
|
21490
|
-
if (
|
|
21491
|
-
let
|
|
21492
|
-
a === void 0 ? (
|
|
21493
|
-
let
|
|
21494
|
-
s !== void 0 &&
|
|
21495
|
-
let { outputByType:
|
|
21496
|
-
legiResolver:
|
|
21637
|
+
async function yi({ 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: _ }) {
|
|
21638
|
+
let v = t ?? (e === void 0 ? void 0 : new g(e));
|
|
21639
|
+
if (v === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
21640
|
+
let y = await A.readFile(i, { encoding: "utf-8" }), b;
|
|
21641
|
+
a === void 0 ? (b = le({ removeAWithHref: !0 })(y), o !== void 0 && vi(b, o)) : b = gi(y, a);
|
|
21642
|
+
let x = [];
|
|
21643
|
+
s !== void 0 && x.push("links"), c !== void 0 && x.push("links_or_references"), u !== void 0 && x.push("references");
|
|
21644
|
+
let { outputByType: S, referredLegifranceTextCountByCid: ee } = await ne({
|
|
21645
|
+
legiResolver: v,
|
|
21497
21646
|
date: n,
|
|
21498
21647
|
defaultTextId: r,
|
|
21499
|
-
htmlTransformation:
|
|
21500
|
-
inputHtml:
|
|
21648
|
+
htmlTransformation: b,
|
|
21649
|
+
inputHtml: y,
|
|
21501
21650
|
linkBaseUrl: d,
|
|
21502
21651
|
linkType: f,
|
|
21503
21652
|
logIgnoredReferencesTypes: p,
|
|
21504
|
-
logPartialReferences:
|
|
21505
|
-
logReferences:
|
|
21506
|
-
outputTypes:
|
|
21653
|
+
logPartialReferences: m,
|
|
21654
|
+
logReferences: h,
|
|
21655
|
+
outputTypes: x,
|
|
21507
21656
|
referredLegifranceTextsInfos: _ !== void 0
|
|
21508
|
-
}),
|
|
21509
|
-
s !== void 0 && (
|
|
21510
|
-
for (let [e, t] of Object.entries(
|
|
21511
|
-
let n =
|
|
21657
|
+
}), C = {};
|
|
21658
|
+
s !== void 0 && (C.links = s), c !== void 0 && (C.links_or_references = c), u !== void 0 && (C.references = u);
|
|
21659
|
+
for (let [e, t] of Object.entries(S)) {
|
|
21660
|
+
let n = C[e];
|
|
21512
21661
|
n !== void 0 && await A.writeFile(n, t.html, { encoding: "utf-8" });
|
|
21513
21662
|
}
|
|
21514
|
-
|
|
21663
|
+
S.links !== void 0 && l !== void 0 && vi(le()(S.links.html), l), _ !== void 0 && await A.writeJson(_, ee, {
|
|
21515
21664
|
encoding: "utf-8",
|
|
21516
21665
|
spaces: 2
|
|
21517
21666
|
});
|
|
21518
21667
|
}
|
|
21519
21668
|
//#endregion
|
|
21520
21669
|
//#region src/lib/server/tables_of_contents.ts
|
|
21521
|
-
async function
|
|
21522
|
-
let i =
|
|
21523
|
-
for await (let e of
|
|
21670
|
+
async function bi(e, t, n, r) {
|
|
21671
|
+
let i = gi(await A.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new ue(a), s = await A.readJson(n, { encoding: "utf-8" });
|
|
21672
|
+
for await (let e of ee({
|
|
21524
21673
|
context: o,
|
|
21525
21674
|
tableOfContents: s,
|
|
21526
21675
|
transformation: i
|
|
@@ -21530,8 +21679,8 @@ async function mi(e, t, n, r) {
|
|
|
21530
21679
|
spaces: 2
|
|
21531
21680
|
});
|
|
21532
21681
|
}
|
|
21533
|
-
async function
|
|
21534
|
-
let r =
|
|
21682
|
+
async function xi(e, t, n) {
|
|
21683
|
+
let r = gi(await A.readFile(e, { encoding: "utf-8" }), t).output, i = te(r);
|
|
21535
21684
|
await A.writeJson(n, i, {
|
|
21536
21685
|
encoding: "utf-8",
|
|
21537
21686
|
spaces: 2
|
|
@@ -21539,8 +21688,8 @@ async function hi(e, t, n) {
|
|
|
21539
21688
|
}
|
|
21540
21689
|
//#endregion
|
|
21541
21690
|
//#region src/lib/server/legi/resolvers.ts
|
|
21542
|
-
function
|
|
21543
|
-
return new
|
|
21691
|
+
function Si({ canutesDb: e }) {
|
|
21692
|
+
return new g(e);
|
|
21544
21693
|
}
|
|
21545
21694
|
//#endregion
|
|
21546
|
-
export { ve as LegiResolver,
|
|
21695
|
+
export { ve as LegiResolver, yi as addLinksOrReferencesToHtmlFile, bi as addPositionsToTableOfContentsFile, he as buildAndInstallTextTitlesInfos, _e as buildTextTitlesInfos, Si as createLegiResolver, we as extractAssembleeAmendmentSearchItems, Pn as extractAssembleeExposesDesMotifs, zn as extractSenatAmendmentSearchItems, Te as hashAssembleeAmendmentSearchItem, In as hashAssembleeSearchItem, Bn as hashSenatAmendmentSearchItem, Vr as hashSenatSearchItem, qr as isAkomaNtosoXml, Ln as isoDateFromAssembleeDocument, An as linkAkomaNtosoBillRaw, Vt as linkAssembleeBillRaw, kn as parseAkomaNtosoBillRaw, Lr as parseAmendment, Bt as parseAssembleeBillRaw, Fn as parseAssembleeDocumentSearchContent, Br as parseSenatDocumentSearchContent, gi as readTransformation, Tn as renderAkomaNtosoBillRaw, Kr as resolveSenatAkomaNtosoSource, xi as simplifiedHtmlBillFileToTableOfContentsFile, di as simplifyWordHtml, hi as simplifyWordHtmlToDocument, vi as writeTransformation };
|