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