@tricoteuses/tisseuse 0.14.18 → 0.14.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{html-DN3bob0k.js → html-BmJb9-6k.js} +1995 -1923
- package/dist/index.js +135 -135
- package/dist/server.js +635 -635
- package/dist/src/lib/extractors/quoted_text.d.ts +3 -1
- package/dist/src/lib/index.d.ts +1 -1
- package/dist/src/lib/text_parsers/citations.d.ts +21 -4
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { A as e, Ct as t, D as n, E as r,
|
|
2
|
-
import { Dt as
|
|
3
|
-
import * as
|
|
4
|
-
import { createHash as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { A as e, Ct as t, D as n, E as r, Ft as i, It as a, L as o, O as s, Ot as c, S as l, St as u, T as d, Tt as f, X as p, Z as m, _ as h, at as g, b as _, c as v, k as y, m as b, n as x, p as ee, q as S, rt as C, s as te, t as ne, u as re, vt as ie, w as ae, wt as w, x as oe } from "./html-BmJb9-6k.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
|
+
import * as ye from "node:crypto";
|
|
4
|
+
import { createHash as be } from "node:crypto";
|
|
5
|
+
import A from "fs-extra";
|
|
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 Se(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(g(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 Te(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 u(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 Ae(e) {
|
|
79
|
+
return N(e).replace(/[‐‑‒–—]/gu, "-").replace(/\s*\.\s*/gu, ".");
|
|
80
|
+
}
|
|
78
81
|
function je(e) {
|
|
79
|
-
return
|
|
82
|
+
return Ae(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
|
|
80
83
|
}
|
|
81
84
|
function Me(e) {
|
|
82
|
-
return je(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
|
|
83
|
-
}
|
|
84
|
-
function Ne(e) {
|
|
85
85
|
switch (e.kind) {
|
|
86
86
|
case "insert_after":
|
|
87
87
|
case "insert_before": return e.insertText;
|
|
@@ -99,12 +99,12 @@ function Ne(e) {
|
|
|
99
99
|
default: return;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
let
|
|
104
|
-
if (
|
|
102
|
+
function Ne(e) {
|
|
103
|
+
let n = M(e.sourceText), r = /\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(n);
|
|
104
|
+
if (r?.[1] !== void 0) return t(r[1]);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
let t =
|
|
106
|
+
function Pe(e) {
|
|
107
|
+
let t = Me(e), n = ie(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 Fe(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 Ve(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,40 +192,40 @@ function Ge(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" : r.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
231
|
let { output: r } = await x({
|
|
@@ -240,13 +240,13 @@ async function Xe(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,25 +256,25 @@ function Qe(e, t, n, r) {
|
|
|
256
256
|
container: r.container
|
|
257
257
|
}));
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function Qe(e) {
|
|
260
260
|
let t = /* @__PURE__ */ new Map();
|
|
261
261
|
return e("body *").each((e, n) => {
|
|
262
262
|
t.set(n, e);
|
|
263
263
|
}), t;
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function F(e, t) {
|
|
266
266
|
return e.get(t) ?? 2 ** 53 - 1;
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function $e(e) {
|
|
269
269
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
270
270
|
e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
|
|
271
|
-
if (
|
|
272
|
-
let o =
|
|
271
|
+
if (ke(e, a)) return;
|
|
272
|
+
let o = w(M(e(a).text()));
|
|
273
273
|
if (!o) return;
|
|
274
274
|
let s = e(a).attr("id");
|
|
275
275
|
if (!s || r.has(s)) return;
|
|
276
|
-
let c =
|
|
277
|
-
|
|
276
|
+
let c = Xe(e, a);
|
|
277
|
+
Ze(t, n, r, {
|
|
278
278
|
id: s,
|
|
279
279
|
...o,
|
|
280
280
|
element: a,
|
|
@@ -282,37 +282,37 @@ function et(e) {
|
|
|
282
282
|
});
|
|
283
283
|
}), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((i, a) => {
|
|
284
284
|
if (n.has(a)) return;
|
|
285
|
-
let o =
|
|
286
|
-
o &&
|
|
285
|
+
let o = w(M(e(a).text()));
|
|
286
|
+
o && Ze(t, n, r, {
|
|
287
287
|
...o,
|
|
288
288
|
element: a,
|
|
289
289
|
container: a
|
|
290
290
|
});
|
|
291
291
|
});
|
|
292
|
-
let i =
|
|
293
|
-
return t.sort((e, t) =>
|
|
292
|
+
let i = Qe(e);
|
|
293
|
+
return t.sort((e, t) => F(i, e.container) - F(i, t.container)), t;
|
|
294
294
|
}
|
|
295
|
-
function
|
|
296
|
-
if (
|
|
295
|
+
function et(e, t) {
|
|
296
|
+
if (ke(e, t)) return !1;
|
|
297
297
|
let n = t.tagName?.toLowerCase();
|
|
298
298
|
if (n !== "p") return /^h[1-6]$/u.test(n ?? "");
|
|
299
299
|
let r = e(t).attr("style") ?? "", i = e(t).html() ?? "";
|
|
300
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));
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function tt(e) {
|
|
303
303
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
304
304
|
return e("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6,p").each((i, a) => {
|
|
305
|
-
if (
|
|
306
|
-
let o =
|
|
307
|
-
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, {
|
|
308
308
|
...o,
|
|
309
309
|
element: a,
|
|
310
310
|
container: a
|
|
311
311
|
});
|
|
312
312
|
}), t;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
315
|
-
let t =
|
|
314
|
+
function nt(e) {
|
|
315
|
+
let t = N(De(e ?? "")).replace(/[()]/gu, "").trim();
|
|
316
316
|
if (!t || t === "liminaire") return;
|
|
317
317
|
if (t === "unique") return {
|
|
318
318
|
base: 1,
|
|
@@ -321,21 +321,21 @@ function rt(e) {
|
|
|
321
321
|
};
|
|
322
322
|
let n = /^(?:(\d+)|1er|premier)(?:\s+([a-z]+))?$/u.exec(t);
|
|
323
323
|
if (!n) return;
|
|
324
|
-
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);
|
|
325
325
|
if (a !== void 0) return {
|
|
326
326
|
base: r,
|
|
327
327
|
suffixOrder: a,
|
|
328
328
|
text: t
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
|
-
function
|
|
332
|
-
let t = new
|
|
331
|
+
function rt(e) {
|
|
332
|
+
let t = new ue(e), n = de(t);
|
|
333
333
|
if (!(n === void 0 || t.offset !== e.length) && !(typeof n != "object" || !n || !("value" in n) || typeof n.value != "number")) return n.value - 1;
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function it(e) {
|
|
336
336
|
let t = [], n = e.map((e) => ({
|
|
337
337
|
heading: e,
|
|
338
|
-
token:
|
|
338
|
+
token: nt(e.num)
|
|
339
339
|
}));
|
|
340
340
|
n.filter(({ token: e }) => e?.text === "unique").length > 0 && e.length > 1 && t.push("Article unique appears with other articles");
|
|
341
341
|
let r;
|
|
@@ -348,31 +348,31 @@ function at(e) {
|
|
|
348
348
|
}
|
|
349
349
|
t.length > 0 && process.env.TISSEUSE_WARN_ASSEMBLEE_HEADING_SEQUENCE === "1" && console.warn("Incoherent Assemblée article heading sequence", { issues: t });
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
let n =
|
|
353
|
-
if (n.length > 0) return t &&
|
|
354
|
-
let r =
|
|
355
|
-
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;
|
|
356
356
|
}
|
|
357
|
-
function
|
|
357
|
+
function ot(e) {
|
|
358
358
|
let t = e.next;
|
|
359
359
|
for (; t !== null;) {
|
|
360
|
-
if (
|
|
360
|
+
if (P(t)) return t;
|
|
361
361
|
t = t.next;
|
|
362
362
|
}
|
|
363
363
|
return null;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function st(e, t, n, r = Qe(e)) {
|
|
366
366
|
let i = [t.container], a = n?.container;
|
|
367
|
-
for (let e =
|
|
367
|
+
for (let e = ot(t.container); e !== null && e !== a; e = ot(e)) i.push(e);
|
|
368
368
|
if (i.length > 1) return i;
|
|
369
|
-
let o =
|
|
369
|
+
let o = F(r, t.container), s = a ? F(r, a) : -1;
|
|
370
370
|
return e("body > *").get().filter((e) => {
|
|
371
|
-
let t =
|
|
371
|
+
let t = F(r, e);
|
|
372
372
|
return t >= o && (s === -1 || t < s);
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function ct(e, t) {
|
|
376
376
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
377
377
|
for (let i of t) {
|
|
378
378
|
let t = "p,li,table", a = e(i).is(t) ? [i] : e(i).find(t).get();
|
|
@@ -380,105 +380,105 @@ function lt(e, t) {
|
|
|
380
380
|
}
|
|
381
381
|
return n;
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function lt(e, t, n) {
|
|
384
384
|
let r = [], i = !1;
|
|
385
|
-
for (let a of
|
|
386
|
-
let n =
|
|
385
|
+
for (let a of ct(e, n)) {
|
|
386
|
+
let n = M(e(a).text());
|
|
387
387
|
if (!n) continue;
|
|
388
|
-
|
|
389
|
-
let o = i ? "noise" :
|
|
388
|
+
Ee.test(n) && (i = !0);
|
|
389
|
+
let o = i ? "noise" : Je(n), s = `${t}-b${r.length + 1}`;
|
|
390
390
|
e(a).attr("data-pjl-parsed-article-id", t), e(a).attr("data-pjl-parsed-block-id", s), r.push({
|
|
391
391
|
id: s,
|
|
392
392
|
articleId: t,
|
|
393
393
|
kind: o,
|
|
394
|
-
links:
|
|
394
|
+
links: We(e, a),
|
|
395
395
|
text: n,
|
|
396
|
-
html:
|
|
396
|
+
html: Ue(e, a)
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
399
|
return r;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function ut(e, t) {
|
|
402
402
|
if (t.length === 0) return e;
|
|
403
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>`;
|
|
404
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}`;
|
|
405
405
|
}
|
|
406
|
-
function
|
|
407
|
-
let t =
|
|
408
|
-
for (let e of
|
|
409
|
-
let r =
|
|
406
|
+
function dt(e) {
|
|
407
|
+
let t = g(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
410
|
if (a !== r) {
|
|
411
|
-
if (a?.startsWith("_Toc") && !
|
|
411
|
+
if (a?.startsWith("_Toc") && !mt(n, a, e.element)) {
|
|
412
412
|
let e = t("<span></span>").attr("id", a);
|
|
413
413
|
i.before(e);
|
|
414
414
|
let r = e.get(0);
|
|
415
|
-
|
|
415
|
+
P(r) && I(n, a, r);
|
|
416
416
|
}
|
|
417
|
-
a &&
|
|
417
|
+
a && pt(n, a, e.element), i.attr("id", r), I(n, r, e.element);
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
|
-
let r =
|
|
420
|
+
let r = at(t), i = Qe(t);
|
|
421
421
|
for (let [e, a] of r.entries()) {
|
|
422
|
-
let o =
|
|
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
423
|
for (let e of o) {
|
|
424
424
|
let r = t(e).attr("data-alinea")?.trim();
|
|
425
425
|
if (!r) continue;
|
|
426
426
|
let i = `${a.id}-alinea-${r.replace(/\s+/gu, "")}`;
|
|
427
|
-
if (
|
|
427
|
+
if (mt(n, i, e)) continue;
|
|
428
428
|
let o = t(e).attr("id");
|
|
429
429
|
if (o && o !== i) {
|
|
430
430
|
let r = t("<span></span>").attr("id", i);
|
|
431
431
|
t(e).before(r);
|
|
432
432
|
let a = r.get(0);
|
|
433
|
-
|
|
434
|
-
} else o &&
|
|
433
|
+
P(a) && I(n, i, a);
|
|
434
|
+
} else o && pt(n, o, e), t(e).attr("id", i), I(n, i, e);
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
return t.html();
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function ft(e) {
|
|
440
440
|
let t = /* @__PURE__ */ new Map();
|
|
441
441
|
for (let n of e("[id]").get()) {
|
|
442
442
|
let r = e(n).attr("id");
|
|
443
|
-
r &&
|
|
443
|
+
r && I(t, r, n);
|
|
444
444
|
}
|
|
445
445
|
return t;
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function I(e, t, n) {
|
|
448
448
|
let r = e.get(t);
|
|
449
449
|
r === void 0 && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function pt(e, t, n) {
|
|
452
452
|
let r = e.get(t);
|
|
453
453
|
r !== void 0 && (r.delete(n), r.size === 0 && e.delete(t));
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function mt(e, t, n) {
|
|
456
456
|
for (let r of e.get(t) ?? []) if (r !== n) return !0;
|
|
457
457
|
return !1;
|
|
458
458
|
}
|
|
459
|
-
function
|
|
460
|
-
let n =
|
|
459
|
+
function ht(e, t) {
|
|
460
|
+
let n = He("sourceText" in t ? t.sourceText : "");
|
|
461
461
|
if (n) return e.filter((e) => e.kind === "directive_candidate").find((e) => {
|
|
462
|
-
let t =
|
|
462
|
+
let t = He(e.text);
|
|
463
463
|
return t.length > 0 && (n.includes(t) || t.includes(n));
|
|
464
464
|
});
|
|
465
465
|
}
|
|
466
|
-
function
|
|
466
|
+
function gt(e, t) {
|
|
467
467
|
if (t) return t.blockIds.map((t) => e.get(t)).find((e) => e?.kind === "directive_candidate");
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function _t(e) {
|
|
470
470
|
return e?.links.filter((e) => !e.insideFrenchQuotes && (e.type === "article" || e.type === "division")).map((e) => e.id) ?? [];
|
|
471
471
|
}
|
|
472
|
-
function
|
|
473
|
-
let
|
|
474
|
-
if (!
|
|
475
|
-
let
|
|
476
|
-
return
|
|
472
|
+
function vt(e, t) {
|
|
473
|
+
let n = M(e);
|
|
474
|
+
if (!n) return;
|
|
475
|
+
let r = C(n);
|
|
476
|
+
return r ? r.level : n.endsWith(":") ? (t ?? -1) + 1 : void 0;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function yt(e) {
|
|
479
479
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
480
480
|
for (let r of e) {
|
|
481
|
-
let e =
|
|
481
|
+
let e = vt(r.text, n.at(-1)?.level);
|
|
482
482
|
if (e === void 0) {
|
|
483
483
|
t.set(r.id, [...n.map((e) => e.block), r]);
|
|
484
484
|
continue;
|
|
@@ -491,14 +491,14 @@ function bt(e) {
|
|
|
491
491
|
}
|
|
492
492
|
return t;
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function bt(e, t) {
|
|
495
495
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
496
496
|
for (let i of [...e ?? [], ...t]) i !== void 0 && (r.has(i.id) || (r.add(i.id), n.push(i)));
|
|
497
497
|
return n;
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function xt(e, t, n) {
|
|
500
500
|
if (!t) return;
|
|
501
|
-
let r =
|
|
501
|
+
let r = bt(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
|
|
502
502
|
if (r.length === 0) return;
|
|
503
503
|
let i = r.map((e) => e.id);
|
|
504
504
|
if (i.length === t.blockIds.length && i.every((e, n) => e === t.blockIds[n])) return;
|
|
@@ -513,7 +513,7 @@ function St(e, t, n) {
|
|
|
513
513
|
}
|
|
514
514
|
};
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function St(e) {
|
|
517
517
|
let t = [], n = 0;
|
|
518
518
|
for (let r of e.blocks) {
|
|
519
519
|
let i = e.directiveText.indexOf(r.text, n);
|
|
@@ -527,8 +527,8 @@ function Ct(e) {
|
|
|
527
527
|
}
|
|
528
528
|
return t;
|
|
529
529
|
}
|
|
530
|
-
function
|
|
531
|
-
let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop
|
|
530
|
+
function Ct(e, t, n) {
|
|
531
|
+
let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop > r && e.start < i);
|
|
532
532
|
if (a.length === 0) return;
|
|
533
533
|
let o = a[0], s = a[a.length - 1], c = o.start, l = s.stop;
|
|
534
534
|
return {
|
|
@@ -541,7 +541,7 @@ function wt(e, t, n) {
|
|
|
541
541
|
}
|
|
542
542
|
};
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function wt(e, t, n) {
|
|
545
545
|
if (!t) return;
|
|
546
546
|
let r = e.directiveText.indexOf(t.text);
|
|
547
547
|
if (r === -1) return;
|
|
@@ -554,14 +554,14 @@ function Tt(e, t, n) {
|
|
|
554
554
|
stop: a
|
|
555
555
|
};
|
|
556
556
|
}
|
|
557
|
-
function
|
|
558
|
-
let n = performance.now(), r = performance.now(), i =
|
|
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 = [];
|
|
559
559
|
for (let t of e.blocks) {
|
|
560
|
-
let e =
|
|
560
|
+
let e = _t(t);
|
|
561
561
|
e.length > 0 && (u = e), l.set(t.id, u);
|
|
562
562
|
}
|
|
563
|
-
let d = performance.now() - o, f = performance.now(), p = b(),
|
|
564
|
-
let n =
|
|
563
|
+
let d = performance.now() - o, f = performance.now(), p = b(), m = h(e.directiveText, t === void 0 ? void 0 : p), g = performance.now() - f, _ = 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);
|
|
565
565
|
return {
|
|
566
566
|
articleId: e.id,
|
|
567
567
|
blockId: r?.id,
|
|
@@ -593,13 +593,13 @@ function Et(e, t) {
|
|
|
593
593
|
totalMs: Math.round((performance.now() - n) * 10) / 10
|
|
594
594
|
}), v;
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function Et(e) {
|
|
597
597
|
let t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Set();
|
|
598
598
|
for (let i of e) {
|
|
599
|
-
let e =
|
|
599
|
+
let e = Pe(i.directive);
|
|
600
600
|
if (e.length === 0) continue;
|
|
601
601
|
let a = e.map(({ num: e }) => ({
|
|
602
|
-
definitionId: `${i.articleId}:article:${
|
|
602
|
+
definitionId: `${i.articleId}:article:${je(e)}`,
|
|
603
603
|
num: e
|
|
604
604
|
}));
|
|
605
605
|
t.set(i, a);
|
|
@@ -622,13 +622,13 @@ function Dt(e) {
|
|
|
622
622
|
definitions: n
|
|
623
623
|
};
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
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]));
|
|
627
627
|
return e.map((e) => {
|
|
628
|
-
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 : {
|
|
629
629
|
definitionId: a.definitionId,
|
|
630
630
|
num: a.num
|
|
631
|
-
}, s =
|
|
631
|
+
}, s = Ie(e.directive), c = (e.targetIds?.length ?? 0) > 0;
|
|
632
632
|
return {
|
|
633
633
|
...e,
|
|
634
634
|
...i === void 0 ? {} : { createdArticle: i },
|
|
@@ -641,7 +641,7 @@ function Ot(e, t, n) {
|
|
|
641
641
|
};
|
|
642
642
|
});
|
|
643
643
|
}
|
|
644
|
-
function
|
|
644
|
+
function Ot(e) {
|
|
645
645
|
switch (e.kind) {
|
|
646
646
|
case "insert_after":
|
|
647
647
|
case "insert_before": return [e.insertText];
|
|
@@ -659,8 +659,8 @@ function kt(e) {
|
|
|
659
659
|
default: return [];
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
|
-
function
|
|
663
|
-
return e.flatMap((e) =>
|
|
662
|
+
function kt(e) {
|
|
663
|
+
return e.flatMap((e) => Ot(e.directive).filter((e) => /[«»]/u.test(e)).map((t) => ({
|
|
664
664
|
code: "nested_french_quote_in_redaction",
|
|
665
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.",
|
|
666
666
|
details: {
|
|
@@ -672,18 +672,18 @@ function At(e) {
|
|
|
672
672
|
}
|
|
673
673
|
})));
|
|
674
674
|
}
|
|
675
|
-
function
|
|
676
|
-
return
|
|
675
|
+
function At(e) {
|
|
676
|
+
return Ot(e).map((t) => ({
|
|
677
677
|
directiveKind: e.kind,
|
|
678
678
|
text: t
|
|
679
679
|
}));
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function jt(e) {
|
|
682
682
|
let t = /* @__PURE__ */ new Set();
|
|
683
683
|
for (let n of e.matchAll(/«[^«»\n]+»/gu)) t.add(n[0]);
|
|
684
684
|
return Array.from(t);
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function Mt(e, t) {
|
|
687
687
|
let n = new Map(e.blocks.map((e) => [e.id, e])), r = t.sourceBlockIds ?? e.blocks.map((e) => e.id), i = [], a = 0;
|
|
688
688
|
for (let e of r) {
|
|
689
689
|
let t = n.get(e);
|
|
@@ -695,11 +695,11 @@ function Nt(e, t) {
|
|
|
695
695
|
}
|
|
696
696
|
return i;
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function Nt(e, t, n) {
|
|
699
699
|
return e.find((e) => t >= e.start && n <= e.stop);
|
|
700
700
|
}
|
|
701
|
-
function
|
|
702
|
-
let r =
|
|
701
|
+
function Pt(e, t, n) {
|
|
702
|
+
let r = jt(n), i = r.flatMap((t) => {
|
|
703
703
|
for (let n of e.blocks) {
|
|
704
704
|
let e = n.text.indexOf(t);
|
|
705
705
|
if (e !== -1) return [{
|
|
@@ -718,7 +718,7 @@ function Ft(e, t, n) {
|
|
|
718
718
|
e.directiveText
|
|
719
719
|
].filter((e) => e !== void 0 && e.length > 0), o = a.find((e) => r.some((t) => e.includes(t))) ?? a[0];
|
|
720
720
|
if (!o) return [];
|
|
721
|
-
let s =
|
|
721
|
+
let s = Mt(e, t);
|
|
722
722
|
if (s.length === 0) return [];
|
|
723
723
|
let c = [], l = 0;
|
|
724
724
|
for (let e of r) {
|
|
@@ -726,7 +726,7 @@ function Ft(e, t, n) {
|
|
|
726
726
|
if (t === -1) continue;
|
|
727
727
|
let n = t + e.length;
|
|
728
728
|
l = n;
|
|
729
|
-
let r =
|
|
729
|
+
let r = Nt(s, t, n);
|
|
730
730
|
r && c.push({
|
|
731
731
|
blockId: r.block.id,
|
|
732
732
|
start: t - r.start,
|
|
@@ -736,15 +736,15 @@ function Ft(e, t, n) {
|
|
|
736
736
|
}
|
|
737
737
|
return c;
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function Ft(e, t) {
|
|
740
740
|
let n = new Map(e.map((e) => [e.id, e]));
|
|
741
741
|
return t.flatMap((e) => {
|
|
742
742
|
let t = n.get(e.articleId);
|
|
743
|
-
return t ?
|
|
743
|
+
return t ? At(e.directive).filter(({ text: e }) => /[«»]/u.test(e)).map(({ directiveKind: n, text: r }) => ({
|
|
744
744
|
articleId: e.articleId,
|
|
745
745
|
code: "nested_french_quote_in_redaction",
|
|
746
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.",
|
|
747
|
-
ranges:
|
|
747
|
+
ranges: Pt(t, e, r),
|
|
748
748
|
severity: "warning",
|
|
749
749
|
details: {
|
|
750
750
|
blockId: e.blockId,
|
|
@@ -755,13 +755,13 @@ function It(e, t) {
|
|
|
755
755
|
})) : [];
|
|
756
756
|
});
|
|
757
757
|
}
|
|
758
|
-
function
|
|
759
|
-
let c = new
|
|
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 = {
|
|
760
760
|
sourceFormat: e,
|
|
761
761
|
documentDate: r,
|
|
762
762
|
html: t,
|
|
763
763
|
htmlWithLinks: n,
|
|
764
|
-
tableOfContents: a ?? c.timeSync("extractTableOfContents", () =>
|
|
764
|
+
tableOfContents: a ?? c.timeSync("extractTableOfContents", () => v(u), { inputSize: u.length }),
|
|
765
765
|
articles: i
|
|
766
766
|
};
|
|
767
767
|
if (!o) {
|
|
@@ -776,18 +776,18 @@ function Lt(e, t, n, r, i, a, o = !0, s) {
|
|
|
776
776
|
directiveTextSize: u.length
|
|
777
777
|
}), e;
|
|
778
778
|
}
|
|
779
|
-
let f = c.timeSync("extractGlobalApplicabilityDate", () =>
|
|
779
|
+
let f = c.timeSync("extractGlobalApplicabilityDate", () => Ve(i.map((e) => e.text).join("\n"))), p = [], m = c.timeSync("extractDirectivesFromArticles", () => {
|
|
780
780
|
let e = [];
|
|
781
781
|
for (let t of i) {
|
|
782
|
-
let n =
|
|
782
|
+
let n = Tt(t, c.enabled ? p : void 0);
|
|
783
783
|
e.push(...n);
|
|
784
784
|
}
|
|
785
785
|
return e;
|
|
786
|
-
}, { count: i.length }), { createdArticlesByDirective: h, definitions: g } = c.timeSync("buildInternalArticleDefinitions", () =>
|
|
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 }), y = c.timeSync("collectNestedFrenchQuoteDiagnostics", () => kt(_), { count: _.length }), b = [...s ?? [], ...y], x = c.timeSync("collectNestedFrenchQuoteAnnotations", () => Ft(i, _), { count: _.length }), ee = {
|
|
787
787
|
...d,
|
|
788
788
|
...f ? { globalApplicabilityDate: f } : {},
|
|
789
789
|
...g.length > 0 ? { internalArticleDefinitions: g } : {},
|
|
790
|
-
directives:
|
|
790
|
+
directives: _,
|
|
791
791
|
...x.length > 0 ? { annotations: x } : {},
|
|
792
792
|
...b.length > 0 ? { diagnostics: b } : {}
|
|
793
793
|
};
|
|
@@ -798,7 +798,7 @@ function Lt(e, t, n, r, i, a, o = !0, s) {
|
|
|
798
798
|
definitionCount: g.length,
|
|
799
799
|
diagnosticCount: b.length,
|
|
800
800
|
directiveAnalysisIncluded: !0,
|
|
801
|
-
directiveCount:
|
|
801
|
+
directiveCount: _.length,
|
|
802
802
|
actionDirectiveExtractionTotals: p.reduce((e, t) => ({
|
|
803
803
|
applyApplicabilityDatesMs: e.applyApplicabilityDatesMs + t.actionDirectiveExtraction.applyApplicabilityDatesMs,
|
|
804
804
|
buildListItemTreeMs: e.buildListItemTreeMs + t.actionDirectiveExtraction.buildListItemTreeMs,
|
|
@@ -877,18 +877,18 @@ function Lt(e, t, n, r, i, a, o = !0, s) {
|
|
|
877
877
|
slowDirectiveArticles: p.toSorted((e, t) => t.totalMs - e.totalMs).slice(0, 10)
|
|
878
878
|
}), ee;
|
|
879
879
|
}
|
|
880
|
-
function
|
|
880
|
+
function Lt(e) {
|
|
881
881
|
return { items: e.map((e) => ({
|
|
882
882
|
id: e.id,
|
|
883
883
|
line: e.title ? `${e.label} : ${e.title}` : e.label,
|
|
884
884
|
type: "article"
|
|
885
885
|
})) };
|
|
886
886
|
}
|
|
887
|
-
function
|
|
888
|
-
return Array.from(
|
|
887
|
+
function Rt(e) {
|
|
888
|
+
return Array.from(re(e)).filter((e) => e.type === "article").map((e) => N(e.line.split(/[::]/u)[0]));
|
|
889
889
|
}
|
|
890
|
-
function
|
|
891
|
-
let t =
|
|
890
|
+
function zt(e) {
|
|
891
|
+
let t = Rt(v(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), n = e.map((e) => N(e.label)), r = [];
|
|
892
892
|
if (t.length > 0 && (t.length !== n.length || t.some((e, t) => e !== n[t]))) {
|
|
893
893
|
let i = t.findIndex((e, t) => e !== n[t]);
|
|
894
894
|
r.push({
|
|
@@ -909,23 +909,23 @@ function Bt(e) {
|
|
|
909
909
|
}
|
|
910
910
|
return {
|
|
911
911
|
diagnostics: r,
|
|
912
|
-
tableOfContents:
|
|
912
|
+
tableOfContents: Lt(e)
|
|
913
913
|
};
|
|
914
914
|
}
|
|
915
|
-
async function
|
|
916
|
-
let n = new
|
|
917
|
-
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", () => g(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");
|
|
918
918
|
return {
|
|
919
919
|
id: e.id,
|
|
920
920
|
label: e.label,
|
|
921
921
|
num: e.num,
|
|
922
922
|
title: e.title,
|
|
923
|
-
text:
|
|
924
|
-
html: n.map((e) =>
|
|
923
|
+
text: qe(a, n),
|
|
924
|
+
html: n.map((e) => Ue(a, e)).join("\n"),
|
|
925
925
|
directiveText: i,
|
|
926
926
|
blocks: r
|
|
927
927
|
};
|
|
928
|
-
}), { count: o.length }), l = n.timeSync("injectHiddenArticleSummary", () =>
|
|
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
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
930
|
articleCount: f.articles.length,
|
|
931
931
|
blockCount: f.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -933,18 +933,18 @@ async function Vt(e, t) {
|
|
|
933
933
|
targetDirectiveCount: f.directives.filter((e) => e.targetIds !== void 0).length
|
|
934
934
|
}), f;
|
|
935
935
|
}
|
|
936
|
-
async function
|
|
936
|
+
async function Vt(e, t) {
|
|
937
937
|
return {
|
|
938
938
|
sourceFormat: "assemblee-html",
|
|
939
939
|
documentDate: t.date,
|
|
940
940
|
html: e,
|
|
941
|
-
linkedHtml: await
|
|
941
|
+
linkedHtml: await Ye(e, t, t.date)
|
|
942
942
|
};
|
|
943
943
|
}
|
|
944
|
-
function
|
|
944
|
+
function L(e) {
|
|
945
945
|
return e.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
946
946
|
}
|
|
947
|
-
function
|
|
947
|
+
function Ht(e) {
|
|
948
948
|
let t = e;
|
|
949
949
|
for (let e = 0; e < 3; e++) {
|
|
950
950
|
let e = t;
|
|
@@ -952,27 +952,27 @@ function Ut(e) {
|
|
|
952
952
|
}
|
|
953
953
|
return t;
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Ut(e) {
|
|
956
956
|
return /(?:<|&lt;)\/?(?:p|br|span|b|i|u|sup|sub|table|thead|tbody|tr|th|td|ul|ol|li)\b/iu.test(e);
|
|
957
957
|
}
|
|
958
|
-
function
|
|
958
|
+
function R(e) {
|
|
959
959
|
return e.name.replace(/^.*:/u, "");
|
|
960
960
|
}
|
|
961
|
-
function
|
|
962
|
-
return t.children.map((t) =>
|
|
961
|
+
function Wt(e, t) {
|
|
962
|
+
return t.children.map((t) => z(e, t)).filter(Boolean).join("");
|
|
963
963
|
}
|
|
964
|
-
function
|
|
965
|
-
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("");
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function z(e, t) {
|
|
968
968
|
if (t.type === "text") {
|
|
969
969
|
let e = t.data.replace(/\s+\./gu, ".");
|
|
970
|
-
return
|
|
970
|
+
return Ut(e) ? Ht(e) : L(e);
|
|
971
971
|
}
|
|
972
|
-
if (!
|
|
973
|
-
let n =
|
|
972
|
+
if (!P(t)) return "";
|
|
973
|
+
let n = R(t), r = Wt(e, t);
|
|
974
974
|
switch (n) {
|
|
975
|
-
case "p": return `<p${
|
|
975
|
+
case "p": return `<p${B(e, t, [
|
|
976
976
|
"id",
|
|
977
977
|
"class",
|
|
978
978
|
"align",
|
|
@@ -986,13 +986,13 @@ function R(e, t) {
|
|
|
986
986
|
case "u":
|
|
987
987
|
case "sup":
|
|
988
988
|
case "sub":
|
|
989
|
-
case "abbr": return `<${n}${
|
|
989
|
+
case "abbr": return `<${n}${B(e, t, [
|
|
990
990
|
"id",
|
|
991
991
|
"class",
|
|
992
992
|
"title",
|
|
993
993
|
"style"
|
|
994
994
|
])}>${r}</${n}>`;
|
|
995
|
-
case "a": return `<a href="${
|
|
995
|
+
case "a": return `<a href="${L(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${B(e, t, [
|
|
996
996
|
"id",
|
|
997
997
|
"class",
|
|
998
998
|
"title",
|
|
@@ -1003,8 +1003,8 @@ function R(e, t) {
|
|
|
1003
1003
|
case "tbody":
|
|
1004
1004
|
case "tr":
|
|
1005
1005
|
case "th":
|
|
1006
|
-
case "td": return
|
|
1007
|
-
case "caption": return `<caption${
|
|
1006
|
+
case "td": return Kt(e, t, n, r);
|
|
1007
|
+
case "caption": return `<caption${B(e, t, [
|
|
1008
1008
|
"id",
|
|
1009
1009
|
"class",
|
|
1010
1010
|
"align",
|
|
@@ -1012,12 +1012,12 @@ function R(e, t) {
|
|
|
1012
1012
|
])}>${r}</caption>`;
|
|
1013
1013
|
case "num": return `<span class="akn-num">${r}</span> `;
|
|
1014
1014
|
case "heading": return `<p class="akn-heading">${r}</p>`;
|
|
1015
|
-
case "content": return
|
|
1016
|
-
case "alinea": return
|
|
1017
|
-
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");
|
|
1018
1018
|
case "blockList":
|
|
1019
1019
|
case "list": return `<div class="akn-list">${r}</div>`;
|
|
1020
|
-
case "item": return
|
|
1020
|
+
case "item": return V(e, t, "div", "akn-item");
|
|
1021
1021
|
case "listIntroduction":
|
|
1022
1022
|
case "listWrapUp":
|
|
1023
1023
|
case "intro":
|
|
@@ -1033,23 +1033,23 @@ function R(e, t) {
|
|
|
1033
1033
|
case "book":
|
|
1034
1034
|
case "tome":
|
|
1035
1035
|
case "subchapter":
|
|
1036
|
-
case "subsection": return
|
|
1036
|
+
case "subsection": return V(e, t, "section", `akn-${n}`);
|
|
1037
1037
|
case "crossHeading": return `<p class="akn-cross-heading">${r}</p>`;
|
|
1038
1038
|
default: return r;
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1041
|
+
function B(e, t, n, r = {}) {
|
|
1042
1042
|
let i = [];
|
|
1043
1043
|
for (let r of n) {
|
|
1044
1044
|
if (r === "style") continue;
|
|
1045
1045
|
let n = e(t).attr(r);
|
|
1046
|
-
n !== void 0 && i.push(`${r}="${
|
|
1046
|
+
n !== void 0 && i.push(`${r}="${L(n)}"`);
|
|
1047
1047
|
}
|
|
1048
1048
|
let a = r.style ?? e(t).attr("style");
|
|
1049
|
-
return a && i.push(`style="${
|
|
1049
|
+
return a && i.push(`style="${L(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
|
|
1050
1050
|
}
|
|
1051
|
-
function
|
|
1052
|
-
return `<${n}${
|
|
1051
|
+
function Kt(e, t, n, r) {
|
|
1052
|
+
return `<${n}${B(e, t, [
|
|
1053
1053
|
"id",
|
|
1054
1054
|
"class",
|
|
1055
1055
|
"colspan",
|
|
@@ -1062,155 +1062,155 @@ function qt(e, t, n, r) {
|
|
|
1062
1062
|
"cellspacing",
|
|
1063
1063
|
"cellpadding",
|
|
1064
1064
|
"style"
|
|
1065
|
-
], { style:
|
|
1065
|
+
], { style: qt(e, t, n) })}>${r}</${n}>`;
|
|
1066
1066
|
}
|
|
1067
|
-
function
|
|
1067
|
+
function qt(e, t, n) {
|
|
1068
1068
|
let r = e(t).attr("style") ?? "";
|
|
1069
|
-
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;
|
|
1070
1070
|
}
|
|
1071
|
-
function
|
|
1071
|
+
function Jt(e, t, n) {
|
|
1072
1072
|
let r = e.trim();
|
|
1073
1073
|
return `${r}${r && !r.endsWith(";") ? ";" : ""} ${t}: ${n};`.trim();
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1076
|
-
let n = [
|
|
1077
|
-
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>`;
|
|
1078
1078
|
}
|
|
1079
|
-
function
|
|
1079
|
+
function Xt(e, t) {
|
|
1080
1080
|
if (!t) return !1;
|
|
1081
|
-
let n = (e) =>
|
|
1082
|
-
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));
|
|
1083
1083
|
}
|
|
1084
|
-
function
|
|
1085
|
-
let t =
|
|
1084
|
+
function Zt(e) {
|
|
1085
|
+
let t = L(e);
|
|
1086
1086
|
return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}">${t}</span></p>`;
|
|
1087
1087
|
}
|
|
1088
|
-
function
|
|
1089
|
-
return
|
|
1088
|
+
function Qt(e, t) {
|
|
1089
|
+
return $t([en({
|
|
1090
1090
|
content: e,
|
|
1091
1091
|
pastille: t
|
|
1092
1092
|
})]);
|
|
1093
1093
|
}
|
|
1094
|
-
function
|
|
1094
|
+
function $t(e) {
|
|
1095
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>`;
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1098
|
-
let i = n ? ` style="${
|
|
1099
|
-
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>`;
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1102
|
-
let r = t ? ` style="${
|
|
1103
|
-
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>`;
|
|
1104
1104
|
}
|
|
1105
|
-
function
|
|
1105
|
+
function nn(e, t) {
|
|
1106
1106
|
return e(t).attr("data:pastille") ?? e(t).attr("pastille");
|
|
1107
1107
|
}
|
|
1108
|
-
function
|
|
1108
|
+
function rn(e, t) {
|
|
1109
1109
|
return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
|
|
1110
1110
|
}
|
|
1111
|
-
function
|
|
1112
|
-
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");
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1114
|
+
function on(e, t) {
|
|
1115
1115
|
let n = [];
|
|
1116
1116
|
return e(t).children().each((t, r) => {
|
|
1117
|
-
if (!
|
|
1118
|
-
let i =
|
|
1119
|
-
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));
|
|
1120
1120
|
}), n.filter(Boolean);
|
|
1121
1121
|
}
|
|
1122
|
-
function
|
|
1123
|
-
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);
|
|
1124
1124
|
if (i) {
|
|
1125
|
-
let r = [
|
|
1126
|
-
|
|
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({
|
|
1127
1127
|
content: r,
|
|
1128
1128
|
pastille: i,
|
|
1129
1129
|
style: o,
|
|
1130
1130
|
contextClass: s
|
|
1131
1131
|
}));
|
|
1132
|
-
} else a && n.push(
|
|
1132
|
+
} else a && n.push(tn({
|
|
1133
1133
|
content: a,
|
|
1134
1134
|
style: o,
|
|
1135
1135
|
contextClass: s
|
|
1136
1136
|
}));
|
|
1137
1137
|
for (let r of e(t).children().get()) {
|
|
1138
|
-
if (!
|
|
1139
|
-
let t =
|
|
1140
|
-
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));
|
|
1141
1141
|
}
|
|
1142
1142
|
return n;
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1145
|
-
let i =
|
|
1146
|
-
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,
|
|
1147
1147
|
`class="${r}"`,
|
|
1148
|
-
o ? `data-pastille="${
|
|
1149
|
-
s ? `style="${
|
|
1148
|
+
o ? `data-pastille="${L(o)}"` : void 0,
|
|
1149
|
+
s ? `style="${L(s)}"` : void 0
|
|
1150
1150
|
].filter((e) => e !== void 0).join(" ")}>`];
|
|
1151
1151
|
if (i === "part" || i === "title") {
|
|
1152
|
-
let r =
|
|
1152
|
+
let r = dn(e, t, i), a = pn(e, t), o = r ? [tn({
|
|
1153
1153
|
content: r,
|
|
1154
1154
|
contextClass: a
|
|
1155
1155
|
})] : [], s = () => {
|
|
1156
|
-
o.length !== 0 && (c.push(
|
|
1156
|
+
o.length !== 0 && (c.push(un(o)), o = []);
|
|
1157
1157
|
};
|
|
1158
1158
|
return e(t).children().each((t, n) => {
|
|
1159
|
-
if (!
|
|
1160
|
-
let r =
|
|
1159
|
+
if (!P(n)) return;
|
|
1160
|
+
let r = R(n);
|
|
1161
1161
|
if (!(r === "num" || r === "heading" || r === "content")) {
|
|
1162
1162
|
if (r === "alinea") {
|
|
1163
|
-
o.push(...
|
|
1163
|
+
o.push(...sn(e, n));
|
|
1164
1164
|
return;
|
|
1165
1165
|
}
|
|
1166
|
-
s(), c.push(
|
|
1166
|
+
s(), c.push(z(e, n));
|
|
1167
1167
|
}
|
|
1168
1168
|
}), s(), c.push(`</${n}>`), c.join("\n");
|
|
1169
1169
|
}
|
|
1170
1170
|
if (i === "article") {
|
|
1171
|
-
let r =
|
|
1171
|
+
let r = M(e(t).children("num").first().text()), i = M(e(t).children("heading").first().text()), a = w(r) ?? {
|
|
1172
1172
|
label: r,
|
|
1173
1173
|
num: r
|
|
1174
|
-
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${
|
|
1175
|
-
if (
|
|
1176
|
-
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({
|
|
1177
1177
|
content: o,
|
|
1178
|
-
contextClass:
|
|
1179
|
-
}), ...
|
|
1180
|
-
c.push(
|
|
1181
|
-
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);
|
|
1182
1182
|
return c.push(`</${n}>`), c.join("\n");
|
|
1183
1183
|
}
|
|
1184
1184
|
c.push(o);
|
|
1185
1185
|
}
|
|
1186
1186
|
let l = [];
|
|
1187
1187
|
for (let n of ["content", "children"]) e(t).children().each((t, r) => {
|
|
1188
|
-
if (!
|
|
1189
|
-
let i =
|
|
1190
|
-
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));
|
|
1191
1191
|
});
|
|
1192
|
-
let
|
|
1192
|
+
let u = l.join("\n");
|
|
1193
1193
|
if (i !== "article") {
|
|
1194
|
-
let n =
|
|
1194
|
+
let n = Xt(u, M(e(t).children("num").first().text())) ? "" : Yt(e, t);
|
|
1195
1195
|
n && c.push(n);
|
|
1196
1196
|
}
|
|
1197
|
-
return c.push(o ?
|
|
1197
|
+
return c.push(o ? Qt(u, o) : u), c.push(`</${n}>`), c.join("\n");
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1200
|
-
let i =
|
|
1201
|
-
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;
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1203
|
+
function ln(e, t) {
|
|
1204
1204
|
return e.split(";").map((e) => e.trim()).filter(Boolean).filter((e) => !e.toLowerCase().startsWith(`${t.toLowerCase()}:`)).join(";");
|
|
1205
1205
|
}
|
|
1206
|
-
function
|
|
1206
|
+
function un(e) {
|
|
1207
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>`;
|
|
1208
1208
|
}
|
|
1209
|
-
function
|
|
1210
|
-
let r =
|
|
1211
|
-
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");
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1213
|
+
function fn(e) {
|
|
1214
1214
|
switch (e) {
|
|
1215
1215
|
case "part": return {
|
|
1216
1216
|
num: "TCNumPartie",
|
|
@@ -1234,22 +1234,22 @@ function pn(e) {
|
|
|
1234
1234
|
};
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
|
-
function
|
|
1238
|
-
let n =
|
|
1237
|
+
function pn(e, t) {
|
|
1238
|
+
let n = hn(M(e(t).children("num").first().text()));
|
|
1239
1239
|
if (n) return n;
|
|
1240
1240
|
for (let n of e(t).parents().get()) {
|
|
1241
|
-
if (!
|
|
1242
|
-
let t =
|
|
1241
|
+
if (!P(n)) continue;
|
|
1242
|
+
let t = R(n);
|
|
1243
1243
|
if (t !== "title" && t !== "part") continue;
|
|
1244
|
-
let r =
|
|
1244
|
+
let r = hn(M(e(n).children("num").first().text()));
|
|
1245
1245
|
if (r) return r;
|
|
1246
1246
|
}
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1249
|
-
return
|
|
1248
|
+
function mn(e, t) {
|
|
1249
|
+
return pn(e, t);
|
|
1250
1250
|
}
|
|
1251
|
-
function
|
|
1252
|
-
let [t, ...n] =
|
|
1251
|
+
function hn(e) {
|
|
1252
|
+
let [t, ...n] = M(e).split(/\s+/u);
|
|
1253
1253
|
if (!t || n.length === 0) return;
|
|
1254
1254
|
let r = t.toLocaleLowerCase("fr-FR");
|
|
1255
1255
|
if ([
|
|
@@ -1259,10 +1259,10 @@ function gn(e) {
|
|
|
1259
1259
|
"section"
|
|
1260
1260
|
].includes(r)) return `${r}-${n.join("_")}`;
|
|
1261
1261
|
}
|
|
1262
|
-
function
|
|
1263
|
-
return `article-${
|
|
1262
|
+
function gn(e) {
|
|
1263
|
+
return `article-${M(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
|
|
1264
1264
|
}
|
|
1265
|
-
function
|
|
1265
|
+
function _n(e) {
|
|
1266
1266
|
switch (e) {
|
|
1267
1267
|
case "part": return "partie";
|
|
1268
1268
|
case "book": return "livre";
|
|
@@ -1274,11 +1274,11 @@ function vn(e) {
|
|
|
1274
1274
|
default: return;
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
|
-
function
|
|
1278
|
-
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(" ");
|
|
1279
1279
|
}
|
|
1280
|
-
function
|
|
1281
|
-
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) ?? {
|
|
1282
1282
|
label: n,
|
|
1283
1283
|
num: n
|
|
1284
1284
|
};
|
|
@@ -1288,24 +1288,24 @@ function bn(e, t) {
|
|
|
1288
1288
|
type: "article"
|
|
1289
1289
|
};
|
|
1290
1290
|
}
|
|
1291
|
-
function
|
|
1291
|
+
function bn(e, t) {
|
|
1292
1292
|
e.items.push(...t.items);
|
|
1293
1293
|
}
|
|
1294
|
-
function
|
|
1294
|
+
function xn(e, t) {
|
|
1295
1295
|
let n = { items: [] };
|
|
1296
1296
|
return e(t).children().each((t, r) => {
|
|
1297
|
-
if (!
|
|
1298
|
-
let i =
|
|
1297
|
+
if (!P(r)) return;
|
|
1298
|
+
let i = R(r);
|
|
1299
1299
|
if (i === "article") {
|
|
1300
|
-
n.items.push(
|
|
1300
|
+
n.items.push(yn(e, r));
|
|
1301
1301
|
return;
|
|
1302
1302
|
}
|
|
1303
|
-
let a =
|
|
1303
|
+
let a = _n(i);
|
|
1304
1304
|
if (!a) {
|
|
1305
|
-
|
|
1305
|
+
bn(n, xn(e, r));
|
|
1306
1306
|
return;
|
|
1307
1307
|
}
|
|
1308
|
-
let o =
|
|
1308
|
+
let o = vn(e, r), s = xn(e, r);
|
|
1309
1309
|
!o && s.items.length === 0 || n.items.push({
|
|
1310
1310
|
...s,
|
|
1311
1311
|
id: e(r).attr("eId") ?? e(r).attr("GUID"),
|
|
@@ -1314,26 +1314,26 @@ function Sn(e, t) {
|
|
|
1314
1314
|
});
|
|
1315
1315
|
}), n;
|
|
1316
1316
|
}
|
|
1317
|
-
function
|
|
1317
|
+
function Sn(e) {
|
|
1318
1318
|
let t = e("body").first().get(0);
|
|
1319
|
-
return t === void 0 ? { items: [] } :
|
|
1319
|
+
return t === void 0 ? { items: [] } : xn(e, t);
|
|
1320
1320
|
}
|
|
1321
|
-
function
|
|
1321
|
+
function Cn(e) {
|
|
1322
1322
|
return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
|
|
1323
1323
|
}
|
|
1324
|
-
function
|
|
1324
|
+
function wn(e) {
|
|
1325
1325
|
let t = e("preamble").first(), n = e("body").first(), r = ["<div class=\"akn-bill\">"];
|
|
1326
|
-
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(
|
|
1327
|
-
|
|
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));
|
|
1328
1328
|
}), r.push("</section></div>"), r.join("\n");
|
|
1329
1329
|
}
|
|
1330
|
-
function
|
|
1331
|
-
let t =
|
|
1330
|
+
function Tn(e) {
|
|
1331
|
+
let t = g(e, { xml: {
|
|
1332
1332
|
decodeEntities: !1,
|
|
1333
1333
|
lowerCaseTags: !1,
|
|
1334
1334
|
lowerCaseAttributeNames: !1,
|
|
1335
1335
|
xmlMode: !0
|
|
1336
|
-
} }), n =
|
|
1336
|
+
} }), n = Cn(t), r = wn(t);
|
|
1337
1337
|
return {
|
|
1338
1338
|
sourceFormat: "akoma-ntoso",
|
|
1339
1339
|
documentDate: n,
|
|
@@ -1341,42 +1341,42 @@ function En(e) {
|
|
|
1341
1341
|
linkedHtml: r
|
|
1342
1342
|
};
|
|
1343
1343
|
}
|
|
1344
|
-
function
|
|
1345
|
-
return
|
|
1344
|
+
function En(e) {
|
|
1345
|
+
return Dn(g(e));
|
|
1346
1346
|
}
|
|
1347
|
-
function
|
|
1347
|
+
function Dn(e) {
|
|
1348
1348
|
let t = [];
|
|
1349
1349
|
return e("article.akn-article").each((n, r) => {
|
|
1350
|
-
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");
|
|
1351
1351
|
t.push({
|
|
1352
1352
|
id: s,
|
|
1353
1353
|
label: o.label,
|
|
1354
1354
|
num: o.num,
|
|
1355
1355
|
title: o.title,
|
|
1356
|
-
text:
|
|
1357
|
-
html:
|
|
1358
|
-
directiveText:
|
|
1356
|
+
text: qe(e, c),
|
|
1357
|
+
html: Ue(e, r),
|
|
1358
|
+
directiveText: u,
|
|
1359
1359
|
blocks: l
|
|
1360
1360
|
});
|
|
1361
1361
|
}), t;
|
|
1362
1362
|
}
|
|
1363
|
-
function
|
|
1364
|
-
let t =
|
|
1363
|
+
function On(e) {
|
|
1364
|
+
let t = g(e);
|
|
1365
1365
|
return {
|
|
1366
|
-
articles:
|
|
1366
|
+
articles: Dn(t),
|
|
1367
1367
|
htmlWithLinks: t.html()
|
|
1368
1368
|
};
|
|
1369
1369
|
}
|
|
1370
|
-
async function
|
|
1371
|
-
let n = new
|
|
1370
|
+
async function kn(e, t) {
|
|
1371
|
+
let n = new ge("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => g(e, { xml: {
|
|
1372
1372
|
decodeEntities: !1,
|
|
1373
1373
|
lowerCaseTags: !1,
|
|
1374
1374
|
lowerCaseAttributeNames: !1,
|
|
1375
1375
|
xmlMode: !0
|
|
1376
|
-
} })), 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, {
|
|
1377
1377
|
...t,
|
|
1378
1378
|
date: i
|
|
1379
|
-
}, 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));
|
|
1380
1380
|
return n.log({
|
|
1381
1381
|
articleCount: p.articles.length,
|
|
1382
1382
|
blockCount: p.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -1384,25 +1384,25 @@ async function An(e, t) {
|
|
|
1384
1384
|
targetDirectiveCount: p.directives.filter((e) => e.targetIds !== void 0).length
|
|
1385
1385
|
}), p;
|
|
1386
1386
|
}
|
|
1387
|
-
async function
|
|
1388
|
-
let n =
|
|
1387
|
+
async function An(e, t) {
|
|
1388
|
+
let n = Tn(e), r = t.date ?? n.documentDate;
|
|
1389
1389
|
return {
|
|
1390
1390
|
sourceFormat: "akoma-ntoso",
|
|
1391
1391
|
documentDate: r,
|
|
1392
1392
|
html: n.html,
|
|
1393
|
-
linkedHtml: await
|
|
1393
|
+
linkedHtml: await Ye(n.html, t, r)
|
|
1394
1394
|
};
|
|
1395
1395
|
}
|
|
1396
1396
|
//#endregion
|
|
1397
1397
|
//#region src/lib/server/assemblee_document_search.ts
|
|
1398
|
-
var
|
|
1399
|
-
function
|
|
1398
|
+
var jn = /\bexpos[ée]\s+des\s+motifs\b/giu, Mn = /\barticle\s+(?:premier|1er|\d+)/iu;
|
|
1399
|
+
function Nn(e) {
|
|
1400
1400
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1403
|
-
let t =
|
|
1402
|
+
function Pn(e) {
|
|
1403
|
+
let t = Nn(g(e).text()), n = [...t.matchAll(jn)], r = /* @__PURE__ */ new Set(), i = [];
|
|
1404
1404
|
for (let [e, a] of n.entries()) {
|
|
1405
|
-
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));
|
|
1406
1406
|
if (l.length < 20 || r.has(l)) continue;
|
|
1407
1407
|
r.add(l);
|
|
1408
1408
|
let u = `expose-des-motifs-${e + 1}`;
|
|
@@ -1418,8 +1418,8 @@ function Fn(e) {
|
|
|
1418
1418
|
}
|
|
1419
1419
|
return i;
|
|
1420
1420
|
}
|
|
1421
|
-
async function
|
|
1422
|
-
let i = await
|
|
1421
|
+
async function Fn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
1422
|
+
let i = await Bt(t, {
|
|
1423
1423
|
date: e,
|
|
1424
1424
|
includeDirectiveAnalysis: !1,
|
|
1425
1425
|
linkBaseUrl: n,
|
|
@@ -1428,7 +1428,7 @@ async function In({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1428
1428
|
});
|
|
1429
1429
|
return {
|
|
1430
1430
|
items: [...i.articles.map((e) => {
|
|
1431
|
-
let t =
|
|
1431
|
+
let t = Nn(e.directiveText || e.text);
|
|
1432
1432
|
if (t) return {
|
|
1433
1433
|
anchor: e.id,
|
|
1434
1434
|
articleNumber: e.num ?? null,
|
|
@@ -1438,17 +1438,17 @@ async function In({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1438
1438
|
label: e.label,
|
|
1439
1439
|
title: e.title ?? null
|
|
1440
1440
|
};
|
|
1441
|
-
}).filter((e) => e !== void 0), ...
|
|
1441
|
+
}).filter((e) => e !== void 0), ...Pn(t)],
|
|
1442
1442
|
tableOfContents: i.tableOfContents
|
|
1443
1443
|
};
|
|
1444
1444
|
}
|
|
1445
|
-
function
|
|
1446
|
-
return
|
|
1445
|
+
function In(e, t) {
|
|
1446
|
+
return be("sha256").update(JSON.stringify({
|
|
1447
1447
|
item: e,
|
|
1448
1448
|
metadata: t
|
|
1449
1449
|
})).digest("hex");
|
|
1450
1450
|
}
|
|
1451
|
-
function
|
|
1451
|
+
function Ln(e) {
|
|
1452
1452
|
if (typeof e != "object" || !e) return;
|
|
1453
1453
|
let t = e.cycleDeVie?.chrono;
|
|
1454
1454
|
if (t !== void 0) for (let e of [
|
|
@@ -1463,11 +1463,11 @@ function Rn(e) {
|
|
|
1463
1463
|
}
|
|
1464
1464
|
//#endregion
|
|
1465
1465
|
//#region src/lib/server/senat_amendment_search.ts
|
|
1466
|
-
function
|
|
1467
|
-
return e?.trim() ?
|
|
1466
|
+
function Rn(e) {
|
|
1467
|
+
return e?.trim() ? g(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1470
|
-
let n =
|
|
1469
|
+
function zn({ dispositifHtml: e, objetHtml: t }) {
|
|
1470
|
+
let n = Rn(e), r = Rn(t);
|
|
1471
1471
|
return [...n ? [{
|
|
1472
1472
|
content: n,
|
|
1473
1473
|
itemKind: "dispositif",
|
|
@@ -1478,31 +1478,31 @@ function Bn({ dispositifHtml: e, objetHtml: t }) {
|
|
|
1478
1478
|
label: "Objet"
|
|
1479
1479
|
}] : []];
|
|
1480
1480
|
}
|
|
1481
|
-
function
|
|
1482
|
-
return
|
|
1481
|
+
function Bn(e, t) {
|
|
1482
|
+
return be("sha256").update(JSON.stringify({
|
|
1483
1483
|
item: e,
|
|
1484
1484
|
metadata: t
|
|
1485
1485
|
})).digest("hex");
|
|
1486
1486
|
}
|
|
1487
1487
|
//#endregion
|
|
1488
1488
|
//#region src/lib/text_parsers/amendment_action_directives.ts
|
|
1489
|
-
function
|
|
1489
|
+
function H(e, t) {
|
|
1490
1490
|
return {
|
|
1491
1491
|
...t,
|
|
1492
1492
|
position: e.position(),
|
|
1493
1493
|
type: "amendment_action_directive"
|
|
1494
1494
|
};
|
|
1495
1495
|
}
|
|
1496
|
-
function
|
|
1496
|
+
function Vn(e, t) {
|
|
1497
1497
|
return {
|
|
1498
1498
|
type: e === "start" ? "head_of_target" : "tail_after_target",
|
|
1499
1499
|
unit: t ? l(t) : "article"
|
|
1500
1500
|
};
|
|
1501
1501
|
}
|
|
1502
|
-
function
|
|
1502
|
+
function Hn(e) {
|
|
1503
1503
|
return e === "start" ? "insert_before" : "insert_after";
|
|
1504
1504
|
}
|
|
1505
|
-
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(f, T([D("les?\\s+", { flags: "i" }), c], { value: (e) => e[1] }), c, o), Wn = E(T([D("la\\s+fin\\s+de\\s+", { flags: "i" }), U], { value: (e) => {
|
|
1506
1506
|
let t = e[1];
|
|
1507
1507
|
return {
|
|
1508
1508
|
targetReference: t,
|
|
@@ -1511,200 +1511,200 @@ var Wn = D(E("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]
|
|
|
1511
1511
|
unit: l(t)
|
|
1512
1512
|
}
|
|
1513
1513
|
};
|
|
1514
|
-
} }),
|
|
1515
|
-
D(
|
|
1516
|
-
D(
|
|
1517
|
-
|
|
1518
|
-
D(
|
|
1514
|
+
} }), T([oe], { 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: "" })
|
|
1519
1519
|
], { value: (e, t) => ({
|
|
1520
1520
|
reference: e[2],
|
|
1521
1521
|
text: t.text()
|
|
1522
|
-
}) }), { default: null }),
|
|
1523
|
-
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) {
|
|
1524
1524
|
return e?.text ?? "";
|
|
1525
1525
|
}
|
|
1526
|
-
function
|
|
1527
|
-
return { citation:
|
|
1526
|
+
function K(e) {
|
|
1527
|
+
return { citation: m(e.position()) };
|
|
1528
1528
|
}
|
|
1529
|
-
var
|
|
1529
|
+
var q = E(T([S], { 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*:)", {
|
|
1530
1530
|
flags: "i",
|
|
1531
|
-
value: (e, t) =>
|
|
1532
|
-
}),
|
|
1531
|
+
value: (e, t) => K(t)
|
|
1532
|
+
}), Jn = D("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
|
|
1533
1533
|
flags: "i",
|
|
1534
|
-
value: (e, t) =>
|
|
1535
|
-
}),
|
|
1534
|
+
value: (e, t) => K(t)
|
|
1535
|
+
}), Yn = D("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
|
|
1536
1536
|
flags: "i",
|
|
1537
|
-
value: (e, t) =>
|
|
1538
|
-
}),
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
], { value: (e) => e[2] }),
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
T(
|
|
1537
|
+
value: (e, t) => K(t)
|
|
1538
|
+
}), Xn = E(T([S], { value: (e) => ({ citation: e[0] }) }), qn), Zn = E(T([S], { value: (e) => ({ citation: e[0] }) }), Yn), Qn = T([D(`${d}s?\\s*:?\\s*`, { flags: "i" }), Xn], { value: (e) => e[1] }), $n = T([D(`${ae}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), Zn], { value: (e) => e[1] }), er = E(T([S], { value: (e) => ({ citation: e[0] }) }), Jn), tr = T([
|
|
1539
|
+
Gn,
|
|
1540
|
+
D(`${d}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1541
|
+
er
|
|
1542
|
+
], { value: (e) => e[2] }), nr = T([
|
|
1543
|
+
Gn,
|
|
1544
|
+
D(`${d}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1545
|
+
E(T([S], { value: (e) => ({ citation: e[0] }) }), Kn)
|
|
1546
1546
|
], { value: (e) => e[2] });
|
|
1547
|
-
function
|
|
1547
|
+
function Y(e) {
|
|
1548
1548
|
return e?.reference;
|
|
1549
1549
|
}
|
|
1550
|
-
var
|
|
1550
|
+
var rr = T([Un, D("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => H(t, {
|
|
1551
1551
|
contextText: e[0],
|
|
1552
1552
|
kind: "delete_article"
|
|
1553
|
-
}) }),
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
], { value: (e, t) =>
|
|
1559
|
-
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]),
|
|
1560
1560
|
kind: "delete_portion",
|
|
1561
1561
|
targetCitation: e[3]?.citation ?? void 0,
|
|
1562
|
-
targetReference: e[2] ??
|
|
1563
|
-
}) }),
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
], { value: (e, t) =>
|
|
1569
|
-
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]),
|
|
1570
1570
|
kind: "rewrite_portion",
|
|
1571
1571
|
replacementCitation: e[3].citation,
|
|
1572
|
-
targetReference:
|
|
1573
|
-
}) }),
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
D(
|
|
1581
|
-
|
|
1582
|
-
], { value: (e, t) =>
|
|
1583
|
-
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]),
|
|
1584
1584
|
kind: "replace",
|
|
1585
1585
|
replacementCitation: e[7].citation,
|
|
1586
1586
|
targetCitation: e[4].citation,
|
|
1587
|
-
targetReference:
|
|
1588
|
-
}) }),
|
|
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: "" }),
|
|
1589
1593
|
U,
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
E("[\\s\\S]*?(?=[«“\"]|$)"),
|
|
1595
|
-
K
|
|
1596
|
-
], { value: (e, t) => V(t, {
|
|
1597
|
-
contextText: W(e[0]),
|
|
1594
|
+
D("[\\s\\S]*?(?=[«“\"]|$)"),
|
|
1595
|
+
q
|
|
1596
|
+
], { value: (e, t) => H(t, {
|
|
1597
|
+
contextText: G(e[0]),
|
|
1598
1598
|
kind: "rewrite_portion",
|
|
1599
1599
|
replacementCitation: e[6].citation,
|
|
1600
|
-
targetReference: e[4] ??
|
|
1601
|
-
}) }),
|
|
1600
|
+
targetReference: e[4] ?? Y(e[0])
|
|
1601
|
+
}) }), cr = T([
|
|
1602
1602
|
y,
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
], { value: (e, t) =>
|
|
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, {
|
|
1610
1610
|
contextText: "",
|
|
1611
1611
|
insertCitation: e[6].citation,
|
|
1612
1612
|
kind: e[0] === "before" ? "insert_article_before" : "insert_article_after"
|
|
1613
|
-
}) }),
|
|
1613
|
+
}) }), lr = T([
|
|
1614
1614
|
y,
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
], { value: (e, t) =>
|
|
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, t) => H(t, {
|
|
1622
1622
|
contextText: "",
|
|
1623
1623
|
insertCitation: e[6].citation,
|
|
1624
1624
|
kind: s(e[0]),
|
|
1625
1625
|
targetReference: e[2]
|
|
1626
|
-
}) }),
|
|
1626
|
+
}) }), ur = T([
|
|
1627
1627
|
y,
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
], { value: (e, t) =>
|
|
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, t) => H(t, {
|
|
1635
1635
|
contextText: "",
|
|
1636
1636
|
insertCitation: e[6].citation,
|
|
1637
1637
|
kind: s(e[0])
|
|
1638
|
-
}) }),
|
|
1639
|
-
|
|
1638
|
+
}) }), dr = T([
|
|
1639
|
+
W,
|
|
1640
1640
|
n,
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
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
|
|
1645
1645
|
], { value: (e, t) => {
|
|
1646
|
-
let n = e[0], r =
|
|
1647
|
-
return
|
|
1648
|
-
contextText:
|
|
1646
|
+
let n = e[0], r = Y(n), i = e[1];
|
|
1647
|
+
return H(t, {
|
|
1648
|
+
contextText: G(n),
|
|
1649
1649
|
insertCitation: e[5].citation,
|
|
1650
|
-
kind:
|
|
1650
|
+
kind: Hn(i),
|
|
1651
1651
|
targetReference: r,
|
|
1652
|
-
targetScope:
|
|
1652
|
+
targetScope: Vn(i, r)
|
|
1653
1653
|
});
|
|
1654
|
-
} }),
|
|
1655
|
-
|
|
1654
|
+
} }), fr = T([
|
|
1655
|
+
W,
|
|
1656
1656
|
y,
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
], { value: (e, t) =>
|
|
1664
|
-
contextText:
|
|
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, t) => H(t, {
|
|
1664
|
+
contextText: G(e[0]),
|
|
1665
1665
|
insertCitation: e[7].citation,
|
|
1666
1666
|
kind: s(e[1]),
|
|
1667
1667
|
targetCitation: e[3].citation,
|
|
1668
|
-
targetReference:
|
|
1669
|
-
}) }),
|
|
1670
|
-
|
|
1668
|
+
targetReference: Y(e[0])
|
|
1669
|
+
}) }), pr = T([
|
|
1670
|
+
W,
|
|
1671
1671
|
y,
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
], { value: (e, t) =>
|
|
1679
|
-
contextText:
|
|
1672
|
+
k,
|
|
1673
|
+
U,
|
|
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, t) => H(t, {
|
|
1679
|
+
contextText: G(e[0]),
|
|
1680
1680
|
insertCitation: e[7].citation,
|
|
1681
1681
|
kind: s(e[1]),
|
|
1682
|
-
targetReference:
|
|
1683
|
-
}) }),
|
|
1684
|
-
|
|
1682
|
+
targetReference: Y(e[0]) ?? e[3]
|
|
1683
|
+
}) }), mr = E(dr, cr, lr, ur, sr, T([
|
|
1684
|
+
W,
|
|
1685
1685
|
y,
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
T(
|
|
1690
|
-
|
|
1686
|
+
k,
|
|
1687
|
+
tr,
|
|
1688
|
+
D("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
|
|
1689
|
+
E(T([
|
|
1690
|
+
D("supprimer", {
|
|
1691
1691
|
flags: "i",
|
|
1692
1692
|
value: "delete_portion"
|
|
1693
1693
|
}),
|
|
1694
|
-
|
|
1695
|
-
|
|
1694
|
+
k,
|
|
1695
|
+
Wn
|
|
1696
1696
|
], { value: (e) => ({
|
|
1697
1697
|
kind: e[0],
|
|
1698
1698
|
...e[2]
|
|
1699
|
-
}) }),
|
|
1700
|
-
|
|
1699
|
+
}) }), T([
|
|
1700
|
+
D("r[eé]diger\\s+ainsi", {
|
|
1701
1701
|
flags: "i",
|
|
1702
1702
|
value: "rewrite_portion"
|
|
1703
1703
|
}),
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1704
|
+
k,
|
|
1705
|
+
Wn,
|
|
1706
|
+
J,
|
|
1707
|
+
q
|
|
1708
1708
|
], { value: (e) => ({
|
|
1709
1709
|
kind: e[0],
|
|
1710
1710
|
replacementCitation: e[4].citation,
|
|
@@ -1712,49 +1712,49 @@ var ir = w([Wn, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1712
1712
|
}) }))
|
|
1713
1713
|
], { value: (e, t) => {
|
|
1714
1714
|
let n = e[5];
|
|
1715
|
-
return
|
|
1716
|
-
contextText:
|
|
1715
|
+
return H(t, {
|
|
1716
|
+
contextText: G(e[0]),
|
|
1717
1717
|
kind: n.kind,
|
|
1718
1718
|
replacementCitation: n.replacementCitation,
|
|
1719
1719
|
targetCitation: e[3].citation,
|
|
1720
|
-
targetReference:
|
|
1720
|
+
targetReference: Y(e[0]) ?? n.targetReference,
|
|
1721
1721
|
targetScope: n.targetScope
|
|
1722
1722
|
});
|
|
1723
|
-
} }),
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1723
|
+
} }), fr, pr, T([
|
|
1724
|
+
Un,
|
|
1725
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
1726
|
+
D(`[\\s\\S]*?(?=${e})`, { flags: "i" }),
|
|
1727
1727
|
y,
|
|
1728
|
-
|
|
1728
|
+
J,
|
|
1729
1729
|
S,
|
|
1730
|
-
|
|
1730
|
+
J,
|
|
1731
1731
|
S
|
|
1732
|
-
], { value: (e, t) =>
|
|
1732
|
+
], { value: (e, t) => H(t, {
|
|
1733
1733
|
contextText: e[0],
|
|
1734
1734
|
insertCitation: e[8],
|
|
1735
1735
|
kind: s(e[3]),
|
|
1736
1736
|
targetCitation: e[6]
|
|
1737
|
-
}) }),
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
], { value: (e, t) =>
|
|
1744
|
-
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]),
|
|
1745
1745
|
insertCitation: e[4].citation,
|
|
1746
1746
|
kind: "insert_after",
|
|
1747
|
-
targetReference: e[2] ??
|
|
1748
|
-
}) }),
|
|
1747
|
+
targetReference: e[2] ?? Y(e[0])
|
|
1748
|
+
}) }), rr, ir);
|
|
1749
1749
|
//#endregion
|
|
1750
1750
|
//#region src/lib/server/parsed_amendments.ts
|
|
1751
|
-
function
|
|
1751
|
+
function hr(e) {
|
|
1752
1752
|
return e.replace(/\s+/gu, " ").trim();
|
|
1753
1753
|
}
|
|
1754
|
-
function
|
|
1755
|
-
return e.split(/\n/gu).map(
|
|
1754
|
+
function gr(e) {
|
|
1755
|
+
return e.split(/\n/gu).map(hr).filter(Boolean).join("\n");
|
|
1756
1756
|
}
|
|
1757
|
-
function
|
|
1757
|
+
function _r(e, t) {
|
|
1758
1758
|
let { start: n, stop: r } = t;
|
|
1759
1759
|
for (; n < r && /\s/u.test(e[n]);) n++;
|
|
1760
1760
|
for (; r > n && /\s/u.test(e[r - 1]);) r--;
|
|
@@ -1763,16 +1763,16 @@ function vr(e, t) {
|
|
|
1763
1763
|
stop: r
|
|
1764
1764
|
} : null;
|
|
1765
1765
|
}
|
|
1766
|
-
function
|
|
1767
|
-
return ce(
|
|
1766
|
+
function vr(e, t) {
|
|
1767
|
+
return se(ce(e), t);
|
|
1768
1768
|
}
|
|
1769
|
-
function
|
|
1769
|
+
function yr(e) {
|
|
1770
1770
|
return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
|
|
1771
1771
|
}
|
|
1772
|
-
function
|
|
1772
|
+
function br(e) {
|
|
1773
1773
|
return {
|
|
1774
1774
|
articleLabel: e.targetArticleLabel ?? null,
|
|
1775
|
-
targetPosition:
|
|
1775
|
+
targetPosition: yr(e.targetPosition),
|
|
1776
1776
|
alinea: e.targetAlinea ?? null,
|
|
1777
1777
|
alineaLabel: e.targetAlineaLabel ?? null,
|
|
1778
1778
|
subdivisionSourceId: e.targetSubdivisionSourceId ?? null,
|
|
@@ -1780,75 +1780,75 @@ function xr(e) {
|
|
|
1780
1780
|
subpos: e.targetSubpos ?? null
|
|
1781
1781
|
};
|
|
1782
1782
|
}
|
|
1783
|
-
function
|
|
1783
|
+
function X(e) {
|
|
1784
1784
|
return {
|
|
1785
1785
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
1786
1786
|
sourcePosition: e.position,
|
|
1787
1787
|
sourceText: e.text
|
|
1788
1788
|
};
|
|
1789
1789
|
}
|
|
1790
|
-
function
|
|
1790
|
+
function xr(e) {
|
|
1791
1791
|
return {
|
|
1792
1792
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
1793
1793
|
sourcePosition: e.position,
|
|
1794
1794
|
sourceText: e.text
|
|
1795
1795
|
};
|
|
1796
1796
|
}
|
|
1797
|
-
function
|
|
1797
|
+
function Sr(e) {
|
|
1798
1798
|
return {
|
|
1799
1799
|
...e?.originalTransformation === void 0 ? {} : { dispositifOriginalTransformation: e.originalTransformation },
|
|
1800
1800
|
...e === null ? {} : { dispositifPosition: e.position },
|
|
1801
1801
|
dispositifText: e?.text ?? null
|
|
1802
1802
|
};
|
|
1803
1803
|
}
|
|
1804
|
-
function
|
|
1804
|
+
function Z(e, t, n, r = gr(e.slice(n.start, n.stop))) {
|
|
1805
1805
|
return {
|
|
1806
|
-
originalTransformation:
|
|
1806
|
+
originalTransformation: vr(t, n),
|
|
1807
1807
|
position: n,
|
|
1808
1808
|
text: r
|
|
1809
1809
|
};
|
|
1810
1810
|
}
|
|
1811
|
-
function
|
|
1811
|
+
function Cr(e) {
|
|
1812
1812
|
let t = e.dispositifHtml ?? e.dispositifText;
|
|
1813
1813
|
if (!t) return null;
|
|
1814
|
-
let n = e.dispositifHtml ?
|
|
1814
|
+
let n = e.dispositifHtml ? le()(t) : me(t), r = n.output, i = _r(r, {
|
|
1815
1815
|
start: 0,
|
|
1816
1816
|
stop: r.length
|
|
1817
1817
|
});
|
|
1818
1818
|
return {
|
|
1819
|
-
dispositif: i === null ? null :
|
|
1819
|
+
dispositif: i === null ? null : Z(r, n, i),
|
|
1820
1820
|
simplifiedText: r,
|
|
1821
1821
|
transformation: n
|
|
1822
1822
|
};
|
|
1823
1823
|
}
|
|
1824
|
-
function
|
|
1824
|
+
function Q(e) {
|
|
1825
1825
|
if (!e) return [];
|
|
1826
|
-
if (e.type === "enumeration") return [...
|
|
1826
|
+
if (e.type === "enumeration") return [...Q(e.left), ...Q(e.right)];
|
|
1827
1827
|
if (e.type === "bounded-interval") {
|
|
1828
|
-
let t =
|
|
1828
|
+
let t = Q(e.first)[0], n = Q(e.last)[0];
|
|
1829
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);
|
|
1830
1830
|
}
|
|
1831
1831
|
if (e.type === "counted-interval") {
|
|
1832
|
-
let t =
|
|
1832
|
+
let t = Q(e.first)[0];
|
|
1833
1833
|
return t === void 0 ? [] : Array.from({ length: e.count }, (e, n) => t + n);
|
|
1834
1834
|
}
|
|
1835
|
-
if (e.type === "exclusion") return
|
|
1836
|
-
for (let t of
|
|
1835
|
+
if (e.type === "exclusion") return Q(e.left);
|
|
1836
|
+
for (let t of i(e)) if (t.type === "alinéa" && typeof t.index == "number" && t.index > 0) return [t.index];
|
|
1837
1837
|
return [];
|
|
1838
1838
|
}
|
|
1839
|
-
function
|
|
1840
|
-
let n =
|
|
1839
|
+
function wr(e, t) {
|
|
1840
|
+
let n = Q(t);
|
|
1841
1841
|
return {
|
|
1842
1842
|
...e,
|
|
1843
1843
|
alinea: n[0] ?? e.alinea ?? null,
|
|
1844
1844
|
...n.length > 0 ? { alineas: n } : {}
|
|
1845
1845
|
};
|
|
1846
1846
|
}
|
|
1847
|
-
function
|
|
1847
|
+
function Tr(e) {
|
|
1848
1848
|
return e.replace(/^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*/iu, "").replace(/^\s*(?:\d+°|[a-z]\))\s*/iu, "").trim();
|
|
1849
1849
|
}
|
|
1850
|
-
function
|
|
1851
|
-
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));
|
|
1852
1852
|
if (!n) return null;
|
|
1853
1853
|
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10);
|
|
1854
1854
|
return !Number.isFinite(r) || r < 1 ? null : {
|
|
@@ -1857,25 +1857,25 @@ function Dr(e, t) {
|
|
|
1857
1857
|
alineas: [r]
|
|
1858
1858
|
};
|
|
1859
1859
|
}
|
|
1860
|
-
function
|
|
1860
|
+
function Dr(e, t) {
|
|
1861
1861
|
if (e) return e.unit === "article" && t.alinea !== null ? {
|
|
1862
1862
|
...e,
|
|
1863
1863
|
unit: "alinéa"
|
|
1864
1864
|
} : e;
|
|
1865
1865
|
}
|
|
1866
|
-
function
|
|
1867
|
-
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));
|
|
1868
1868
|
}
|
|
1869
|
-
function
|
|
1870
|
-
return
|
|
1869
|
+
function kr(e, t, n, r) {
|
|
1870
|
+
return Z(e, t, {
|
|
1871
1871
|
start: n.position.start,
|
|
1872
1872
|
stop: r.position.stop
|
|
1873
1873
|
});
|
|
1874
1874
|
}
|
|
1875
|
-
function
|
|
1875
|
+
function Ar(e) {
|
|
1876
1876
|
return /^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*(?!alin[eé]a\b)/iu.test(e.text);
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1878
|
+
function jr(e, t) {
|
|
1879
1879
|
let n = { ...t.position };
|
|
1880
1880
|
function r(t) {
|
|
1881
1881
|
let r = t.exec(e.slice(n.start, n.stop));
|
|
@@ -1884,39 +1884,39 @@ function Mr(e, t) {
|
|
|
1884
1884
|
stop: n.stop
|
|
1885
1885
|
});
|
|
1886
1886
|
}
|
|
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),
|
|
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);
|
|
1888
1888
|
}
|
|
1889
|
-
function
|
|
1890
|
-
return
|
|
1889
|
+
function Mr(e) {
|
|
1890
|
+
return _(e);
|
|
1891
1891
|
}
|
|
1892
|
-
function
|
|
1893
|
-
return
|
|
1892
|
+
function Nr(e, t) {
|
|
1893
|
+
return mr(new ue(e.slice(0, t.stop), t.start)) ?? null;
|
|
1894
1894
|
}
|
|
1895
|
-
function
|
|
1896
|
-
if (n) return
|
|
1895
|
+
function $(e, t, n) {
|
|
1896
|
+
if (n) return Z(e, t, n.position, gr(p(e, n)));
|
|
1897
1897
|
}
|
|
1898
|
-
function
|
|
1898
|
+
function Pr(e, t) {
|
|
1899
1899
|
if (!e) return;
|
|
1900
1900
|
let n = structuredClone(e);
|
|
1901
|
-
for (let e of
|
|
1901
|
+
for (let e of a(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = vr(t, e.position));
|
|
1902
1902
|
return n;
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1905
|
-
let i =
|
|
1904
|
+
function Fr(e, t, n, r) {
|
|
1905
|
+
let i = jr(e, n);
|
|
1906
1906
|
if (!i) return null;
|
|
1907
|
-
let a =
|
|
1907
|
+
let a = Nr(e, i);
|
|
1908
1908
|
if (!a) return null;
|
|
1909
|
-
let o =
|
|
1909
|
+
let o = Z(e, t, i), s = Pr(a.targetReference, t), c = wr(r, s), l = Mr(o.text);
|
|
1910
1910
|
if (a.kind === "delete_article") return {
|
|
1911
1911
|
kind: "delete_article",
|
|
1912
|
-
...
|
|
1912
|
+
...X(o),
|
|
1913
1913
|
target: c
|
|
1914
1914
|
};
|
|
1915
1915
|
if (a.kind === "delete_portion") {
|
|
1916
|
-
let n =
|
|
1916
|
+
let n = $(e, t, a.targetCitation);
|
|
1917
1917
|
return {
|
|
1918
1918
|
kind: "delete_portion",
|
|
1919
|
-
...
|
|
1919
|
+
...X(o),
|
|
1920
1920
|
target: c,
|
|
1921
1921
|
...n === void 0 ? {} : {
|
|
1922
1922
|
targetCitation: n,
|
|
@@ -1924,16 +1924,16 @@ function Ir(e, t, n, r) {
|
|
|
1924
1924
|
},
|
|
1925
1925
|
targetOccurrence: l,
|
|
1926
1926
|
targetReference: s,
|
|
1927
|
-
targetScope:
|
|
1927
|
+
targetScope: Dr(a.targetScope, c)
|
|
1928
1928
|
};
|
|
1929
1929
|
}
|
|
1930
1930
|
if (a.kind === "rewrite_portion") {
|
|
1931
|
-
let n =
|
|
1931
|
+
let n = $(e, t, a.replacementCitation);
|
|
1932
1932
|
if (!n) return null;
|
|
1933
|
-
let r =
|
|
1933
|
+
let r = $(e, t, a.targetCitation);
|
|
1934
1934
|
return {
|
|
1935
1935
|
kind: "rewrite_portion",
|
|
1936
|
-
...
|
|
1936
|
+
...X(o),
|
|
1937
1937
|
target: c,
|
|
1938
1938
|
...r === void 0 ? {} : {
|
|
1939
1939
|
targetCitation: r,
|
|
@@ -1941,16 +1941,16 @@ function Ir(e, t, n, r) {
|
|
|
1941
1941
|
},
|
|
1942
1942
|
targetOccurrence: l,
|
|
1943
1943
|
targetReference: s,
|
|
1944
|
-
targetScope:
|
|
1944
|
+
targetScope: Dr(a.targetScope, c),
|
|
1945
1945
|
replacementCitation: n,
|
|
1946
1946
|
replacementText: n.text
|
|
1947
1947
|
};
|
|
1948
1948
|
}
|
|
1949
1949
|
if (a.kind === "replace") {
|
|
1950
|
-
let n =
|
|
1950
|
+
let n = $(e, t, a.replacementCitation), r = $(e, t, a.targetCitation);
|
|
1951
1951
|
return !n || !r ? null : {
|
|
1952
1952
|
kind: "replace",
|
|
1953
|
-
...
|
|
1953
|
+
...X(o),
|
|
1954
1954
|
target: c,
|
|
1955
1955
|
targetCitation: r,
|
|
1956
1956
|
targetText: r.text,
|
|
@@ -1961,32 +1961,32 @@ function Ir(e, t, n, r) {
|
|
|
1961
1961
|
};
|
|
1962
1962
|
}
|
|
1963
1963
|
if (a.kind === "insert_article_after") {
|
|
1964
|
-
let n =
|
|
1964
|
+
let n = $(e, t, a.insertCitation);
|
|
1965
1965
|
return n ? {
|
|
1966
1966
|
kind: "insert_article_after",
|
|
1967
|
-
...
|
|
1967
|
+
...X(o),
|
|
1968
1968
|
target: c,
|
|
1969
1969
|
insertCitation: n,
|
|
1970
1970
|
insertText: n.text
|
|
1971
1971
|
} : null;
|
|
1972
1972
|
}
|
|
1973
1973
|
if (a.kind === "insert_article_before") {
|
|
1974
|
-
let n =
|
|
1974
|
+
let n = $(e, t, a.insertCitation);
|
|
1975
1975
|
return n ? {
|
|
1976
1976
|
kind: "insert_article_before",
|
|
1977
|
-
...
|
|
1977
|
+
...X(o),
|
|
1978
1978
|
target: c,
|
|
1979
1979
|
insertCitation: n,
|
|
1980
1980
|
insertText: n.text
|
|
1981
1981
|
} : null;
|
|
1982
1982
|
}
|
|
1983
1983
|
if (a.kind === "insert_after" || a.kind === "insert_before") {
|
|
1984
|
-
let n =
|
|
1984
|
+
let n = $(e, t, a.insertCitation);
|
|
1985
1985
|
if (!n) return null;
|
|
1986
|
-
let r =
|
|
1986
|
+
let r = $(e, t, a.targetCitation);
|
|
1987
1987
|
return {
|
|
1988
1988
|
kind: a.kind,
|
|
1989
|
-
...
|
|
1989
|
+
...X(o),
|
|
1990
1990
|
target: c,
|
|
1991
1991
|
...r === void 0 ? {} : {
|
|
1992
1992
|
targetCitation: r,
|
|
@@ -1996,19 +1996,19 @@ function Ir(e, t, n, r) {
|
|
|
1996
1996
|
targetReference: s,
|
|
1997
1997
|
insertCitation: n,
|
|
1998
1998
|
insertText: n.text,
|
|
1999
|
-
targetScope:
|
|
1999
|
+
targetScope: Dr(a.targetScope, c)
|
|
2000
2000
|
};
|
|
2001
2001
|
}
|
|
2002
2002
|
return null;
|
|
2003
2003
|
}
|
|
2004
|
-
function
|
|
2004
|
+
function Ir(e, t) {
|
|
2005
2005
|
let n = [], r = 0, i = 0;
|
|
2006
2006
|
function a(r) {
|
|
2007
|
-
let a =
|
|
2007
|
+
let a = _r(e, {
|
|
2008
2008
|
start: i,
|
|
2009
2009
|
stop: r
|
|
2010
2010
|
});
|
|
2011
|
-
a !== null && n.push(
|
|
2011
|
+
a !== null && n.push(Z(e, t, a));
|
|
2012
2012
|
}
|
|
2013
2013
|
function o(t) {
|
|
2014
2014
|
let n = Math.max(e.lastIndexOf("\n", t - 1), e.lastIndexOf("\r", t - 1));
|
|
@@ -2026,7 +2026,7 @@ function Lr(e, t) {
|
|
|
2026
2026
|
continue;
|
|
2027
2027
|
}
|
|
2028
2028
|
if (r > 0) continue;
|
|
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) &&
|
|
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({
|
|
2030
2030
|
originalTransformation: void 0,
|
|
2031
2031
|
position: {
|
|
2032
2032
|
start: i,
|
|
@@ -2038,8 +2038,8 @@ function Lr(e, t) {
|
|
|
2038
2038
|
}
|
|
2039
2039
|
return a(e.length), n;
|
|
2040
2040
|
}
|
|
2041
|
-
function
|
|
2042
|
-
let t =
|
|
2041
|
+
function Lr(e) {
|
|
2042
|
+
let t = Cr(e), n = t?.dispositif ?? null, r = Sr(n), i = [], a = [], o = br(e);
|
|
2043
2043
|
if (e.sourceFormat === "senat-ameli" && e.sourceKind === "S") return i.push({
|
|
2044
2044
|
code: "unsupported_sub_amendment",
|
|
2045
2045
|
message: "Les sous-amendements ne sont pas encore projetés."
|
|
@@ -2057,9 +2057,9 @@ function Rr(e) {
|
|
|
2057
2057
|
});
|
|
2058
2058
|
else {
|
|
2059
2059
|
let { simplifiedText: e, transformation: r } = t, s = o, c = null;
|
|
2060
|
-
for (let t of
|
|
2061
|
-
|
|
2062
|
-
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);
|
|
2063
2063
|
if (i) {
|
|
2064
2064
|
a.push(i), c = null, (i.target.alinea !== null || i.target.alineas) && (s = i.target);
|
|
2065
2065
|
continue;
|
|
@@ -2068,23 +2068,23 @@ function Rr(e) {
|
|
|
2068
2068
|
c = n;
|
|
2069
2069
|
continue;
|
|
2070
2070
|
}
|
|
2071
|
-
let l =
|
|
2071
|
+
let l = Er(o, t);
|
|
2072
2072
|
if (l !== null) {
|
|
2073
2073
|
s = l;
|
|
2074
2074
|
continue;
|
|
2075
2075
|
}
|
|
2076
|
-
|
|
2076
|
+
Or(t) && (c = t);
|
|
2077
2077
|
}
|
|
2078
2078
|
a.length === 0 && (o.targetPosition === "after_article" || o.targetPosition === "before_article") && a.push({
|
|
2079
2079
|
kind: o.targetPosition === "before_article" ? "insert_article_before" : "insert_article_after",
|
|
2080
|
-
...
|
|
2080
|
+
...X(n),
|
|
2081
2081
|
target: o,
|
|
2082
2082
|
insertCitation: n,
|
|
2083
2083
|
insertText: n.text
|
|
2084
2084
|
}), a.length === 0 && i.push({
|
|
2085
2085
|
code: "unrecognized_dispositif",
|
|
2086
2086
|
message: "Le dispositif est présent mais aucune directive d'amendement n'a été reconnue.",
|
|
2087
|
-
...
|
|
2087
|
+
...xr(n)
|
|
2088
2088
|
});
|
|
2089
2089
|
}
|
|
2090
2090
|
return {
|
|
@@ -2098,17 +2098,17 @@ function Rr(e) {
|
|
|
2098
2098
|
}
|
|
2099
2099
|
//#endregion
|
|
2100
2100
|
//#region src/lib/server/senat_document_search.ts
|
|
2101
|
-
function
|
|
2101
|
+
function Rr(e) {
|
|
2102
2102
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
2103
2103
|
}
|
|
2104
2104
|
function zr(e) {
|
|
2105
|
-
let t =
|
|
2105
|
+
let t = w(e);
|
|
2106
2106
|
if (!t) return {
|
|
2107
2107
|
articleNumber: null,
|
|
2108
2108
|
label: e,
|
|
2109
2109
|
title: null
|
|
2110
2110
|
};
|
|
2111
|
-
let n =
|
|
2111
|
+
let n = Rr(t.num ?? "") || null, r = Rr(t.title ?? "") || null;
|
|
2112
2112
|
return {
|
|
2113
2113
|
articleNumber: n,
|
|
2114
2114
|
label: t.label,
|
|
@@ -2116,7 +2116,7 @@ function zr(e) {
|
|
|
2116
2116
|
};
|
|
2117
2117
|
}
|
|
2118
2118
|
function Br(e) {
|
|
2119
|
-
let t =
|
|
2119
|
+
let t = g(e), n = [], r = Rr(t("section.akn-preamble").text());
|
|
2120
2120
|
return r && n.push({
|
|
2121
2121
|
anchor: "senat-expose-des-motifs",
|
|
2122
2122
|
articleNumber: null,
|
|
@@ -2126,9 +2126,9 @@ function Br(e) {
|
|
|
2126
2126
|
label: "Exposé des motifs",
|
|
2127
2127
|
title: null
|
|
2128
2128
|
}), t("article.akn-article").each((e, r) => {
|
|
2129
|
-
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();
|
|
2130
2130
|
l.children("p.TCNumArticle").remove();
|
|
2131
|
-
let u =
|
|
2131
|
+
let u = Rr(l.text());
|
|
2132
2132
|
u && n.push({
|
|
2133
2133
|
anchor: i.attr("id") || null,
|
|
2134
2134
|
articleNumber: c.articleNumber,
|
|
@@ -2141,7 +2141,7 @@ function Br(e) {
|
|
|
2141
2141
|
}), n;
|
|
2142
2142
|
}
|
|
2143
2143
|
function Vr(e, t) {
|
|
2144
|
-
return
|
|
2144
|
+
return be("sha256").update(JSON.stringify({
|
|
2145
2145
|
item: e,
|
|
2146
2146
|
metadata: t
|
|
2147
2147
|
})).digest("hex");
|
|
@@ -21273,7 +21273,7 @@ function ti(e) {
|
|
|
21273
21273
|
return null;
|
|
21274
21274
|
}
|
|
21275
21275
|
function ni(e) {
|
|
21276
|
-
return
|
|
21276
|
+
return ye.createHash("md5").update(e).digest("hex");
|
|
21277
21277
|
}
|
|
21278
21278
|
function ri(e) {
|
|
21279
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;
|
|
@@ -21345,7 +21345,7 @@ function ui(e) {
|
|
|
21345
21345
|
return null;
|
|
21346
21346
|
}
|
|
21347
21347
|
function di(e, t = {}) {
|
|
21348
|
-
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a =
|
|
21348
|
+
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = g(e, { xml: { decodeEntities: !1 } });
|
|
21349
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) => {
|
|
21350
21350
|
let n = a(t).closest("table");
|
|
21351
21351
|
n.length > 0 && n.remove();
|
|
@@ -21534,8 +21534,8 @@ function di(e, t = {}) {
|
|
|
21534
21534
|
}), fi(a), pi(a, i);
|
|
21535
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 = "";
|
|
21536
21536
|
m && (h += $r), f && (h += Xr), p && (h += Zr), u && (h += Yr), d && (h += Qr);
|
|
21537
|
-
let
|
|
21538
|
-
return
|
|
21537
|
+
let _ = h ? `<style>${h}</style>\n${l}` : l;
|
|
21538
|
+
return _ = _.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"), _ = _.replace(/ /g, "\xA0"), r && (_ = _.replace(/<p[^>]*>\s*( | | |\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*( | | |\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), _ = _.replace(/<span[^>]*>\s*<\/span>/gi, ""), _ = _.replace(/ class=""/g, ""), _ = mi(_), _ = _.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(), _;
|
|
21539
21539
|
}
|
|
21540
21540
|
function fi(e) {
|
|
21541
21541
|
e("span[id]").each((t, n) => {
|
|
@@ -21598,15 +21598,15 @@ ${di(e, t)}
|
|
|
21598
21598
|
//#region src/lib/server/text_parsers/transformers.ts
|
|
21599
21599
|
function gi(e, t) {
|
|
21600
21600
|
let n = "transformation_", r = {};
|
|
21601
|
-
for (let e of
|
|
21601
|
+
for (let e of A.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
|
|
21602
21602
|
let i = e.slice(15, -5), a = i.split(".").map((e) => parseInt(e) - 1), o = r;
|
|
21603
21603
|
for (let e of a.slice(1)) {
|
|
21604
21604
|
let t = o.transformations ??= [];
|
|
21605
21605
|
for (; e >= t.length;) t.push({});
|
|
21606
21606
|
o = t[e];
|
|
21607
21607
|
}
|
|
21608
|
-
o.output =
|
|
21609
|
-
let { sourceMap: s, title: c } =
|
|
21608
|
+
o.output = A.readFileSync(j.join(t, `${n}${i}.html`), { encoding: "utf-8" });
|
|
21609
|
+
let { sourceMap: s, title: c } = A.readJsonSync(j.join(t, e), { encoding: "utf-8" });
|
|
21610
21610
|
o.sourceMap = s ?? [], o.title = c;
|
|
21611
21611
|
}
|
|
21612
21612
|
return _i(r, e), r;
|
|
@@ -21616,7 +21616,7 @@ function _i(e, t) {
|
|
|
21616
21616
|
return t;
|
|
21617
21617
|
}
|
|
21618
21618
|
function vi(e, t, n = "1") {
|
|
21619
|
-
if (
|
|
21619
|
+
if (A.ensureDirSync(t), e.transformations === void 0) A.writeJsonSync(j.join(t, `transformation_${n}.json`), {
|
|
21620
21620
|
sourceMap: e.sourceMap,
|
|
21621
21621
|
title: e.title
|
|
21622
21622
|
}, {
|
|
@@ -21624,21 +21624,21 @@ function vi(e, t, n = "1") {
|
|
|
21624
21624
|
spaces: 2
|
|
21625
21625
|
});
|
|
21626
21626
|
else {
|
|
21627
|
-
|
|
21627
|
+
A.writeJsonSync(j.join(t, `transformation_${n}.json`), { title: e.title }, {
|
|
21628
21628
|
encoding: "utf-8",
|
|
21629
21629
|
spaces: 2
|
|
21630
21630
|
});
|
|
21631
21631
|
for (let [r, i] of e.transformations.entries()) vi(i, t, `${n}.${r + 1}`);
|
|
21632
21632
|
}
|
|
21633
|
-
e.output !== void 0 &&
|
|
21633
|
+
e.output !== void 0 && A.writeFileSync(j.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
|
|
21634
21634
|
}
|
|
21635
21635
|
//#endregion
|
|
21636
21636
|
//#region src/lib/server/linkers/html.ts
|
|
21637
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: g }) {
|
|
21638
21638
|
let _ = t ?? (e === void 0 ? void 0 : new ee(e));
|
|
21639
21639
|
if (_ === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
21640
|
-
let v = await
|
|
21641
|
-
a === void 0 ? (y =
|
|
21640
|
+
let v = await A.readFile(i, { encoding: "utf-8" }), y;
|
|
21641
|
+
a === void 0 ? (y = le({ removeAWithHref: !0 })(v), o !== void 0 && vi(y, o)) : y = gi(v, a);
|
|
21642
21642
|
let b = [];
|
|
21643
21643
|
s !== void 0 && b.push("links"), c !== void 0 && b.push("links_or_references"), u !== void 0 && b.push("references");
|
|
21644
21644
|
let { outputByType: x, referredLegifranceTextCountByCid: S } = await ne({
|
|
@@ -21658,9 +21658,9 @@ async function yi({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
21658
21658
|
s !== void 0 && (C.links = s), c !== void 0 && (C.links_or_references = c), u !== void 0 && (C.references = u);
|
|
21659
21659
|
for (let [e, t] of Object.entries(x)) {
|
|
21660
21660
|
let n = C[e];
|
|
21661
|
-
n !== void 0 && await
|
|
21661
|
+
n !== void 0 && await A.writeFile(n, t.html, { encoding: "utf-8" });
|
|
21662
21662
|
}
|
|
21663
|
-
x.links !== void 0 && l !== void 0 && vi(
|
|
21663
|
+
x.links !== void 0 && l !== void 0 && vi(le()(x.links.html), l), g !== void 0 && await A.writeJson(g, S, {
|
|
21664
21664
|
encoding: "utf-8",
|
|
21665
21665
|
spaces: 2
|
|
21666
21666
|
});
|
|
@@ -21668,20 +21668,20 @@ async function yi({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
21668
21668
|
//#endregion
|
|
21669
21669
|
//#region src/lib/server/tables_of_contents.ts
|
|
21670
21670
|
async function bi(e, t, n, r) {
|
|
21671
|
-
let i = gi(await
|
|
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
21672
|
for await (let e of te({
|
|
21673
21673
|
context: o,
|
|
21674
21674
|
tableOfContents: s,
|
|
21675
21675
|
transformation: i
|
|
21676
21676
|
}));
|
|
21677
|
-
await
|
|
21677
|
+
await A.writeJson(r, s, {
|
|
21678
21678
|
encoding: "utf-8",
|
|
21679
21679
|
spaces: 2
|
|
21680
21680
|
});
|
|
21681
21681
|
}
|
|
21682
21682
|
async function xi(e, t, n) {
|
|
21683
|
-
let r = gi(await
|
|
21684
|
-
await
|
|
21683
|
+
let r = gi(await A.readFile(e, { encoding: "utf-8" }), t).output, i = v(r);
|
|
21684
|
+
await A.writeJson(n, i, {
|
|
21685
21685
|
encoding: "utf-8",
|
|
21686
21686
|
spaces: 2
|
|
21687
21687
|
});
|
|
@@ -21692,4 +21692,4 @@ function Si({ canutesDb: e }) {
|
|
|
21692
21692
|
return new ee(e);
|
|
21693
21693
|
}
|
|
21694
21694
|
//#endregion
|
|
21695
|
-
export {
|
|
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 };
|