@tricoteuses/tisseuse 0.14.0 → 0.14.2

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.
Files changed (51) hide show
  1. package/README.md +10 -1
  2. package/dist/{html-BKxA21Bq.js → html-_xYtGRXN.js} +2462 -2119
  3. package/dist/index.js +47 -47
  4. package/dist/{resolver-dqOM1G7A.js → resolver-CLdkzY2R.js} +2 -20
  5. package/dist/server-f-legi.js +1 -1
  6. package/dist/server.js +697 -697
  7. package/dist/src/lib/extractors/links.doctrinal.test.d.ts +1 -0
  8. package/dist/src/lib/extractors/links.european.test.d.ts +1 -0
  9. package/dist/src/lib/index.d.ts +2 -0
  10. package/dist/src/lib/legi/canutes_resolver_europe.test.d.ts +1 -0
  11. package/dist/src/lib/server/administrative_acts_autocompletion.d.ts +20 -0
  12. package/dist/src/lib/server/administrative_acts_autocompletion.test.d.ts +1 -0
  13. package/dist/src/lib/server/ameli_autocompletion.d.ts +17 -0
  14. package/dist/src/lib/server/ameli_autocompletion.test.d.ts +1 -0
  15. package/dist/src/lib/server/bofip_autocompletion.d.ts +22 -0
  16. package/dist/src/lib/server/bofip_autocompletion.test.d.ts +1 -0
  17. package/dist/src/lib/server/boss_autocompletion.d.ts +18 -0
  18. package/dist/src/lib/server/boss_autocompletion.test.d.ts +1 -0
  19. package/dist/src/lib/server/europe_autocompletion.d.ts +18 -0
  20. package/dist/src/lib/server/europe_autocompletion.test.d.ts +1 -0
  21. package/dist/src/lib/server/international_treaties_autocompletion.d.ts +16 -0
  22. package/dist/src/lib/server/international_treaties_autocompletion.test.d.ts +1 -0
  23. package/dist/src/lib/server/local_acts_autocompletion.d.ts +20 -0
  24. package/dist/src/lib/server/local_acts_autocompletion.test.d.ts +1 -0
  25. package/dist/src/lib/server/raa_autocompletion.d.ts +20 -0
  26. package/dist/src/lib/server/raa_autocompletion.test.d.ts +1 -0
  27. package/dist/src/lib/server/shared_legal_text_sections.d.ts +10 -0
  28. package/dist/src/lib/server/shared_legal_text_sections.test.d.ts +1 -0
  29. package/dist/src/lib/server/sync_administrative_act_titles.d.ts +16 -0
  30. package/dist/src/lib/server/sync_administrative_act_titles.test.d.ts +1 -0
  31. package/dist/src/lib/server/sync_ameli_titles.d.ts +16 -0
  32. package/dist/src/lib/server/sync_assemblee_legal_texts.d.ts +17 -0
  33. package/dist/src/lib/server/sync_assemblee_legal_texts.test.d.ts +1 -0
  34. package/dist/src/lib/server/sync_boss_titles.d.ts +16 -0
  35. package/dist/src/lib/server/sync_europe_titles.d.ts +16 -0
  36. package/dist/src/lib/server/sync_international_treaty_titles.d.ts +16 -0
  37. package/dist/src/lib/server/sync_local_act_titles.d.ts +16 -0
  38. package/dist/src/lib/server/sync_local_act_titles.test.d.ts +1 -0
  39. package/dist/src/lib/server/sync_raa_titles.d.ts +16 -0
  40. package/dist/src/lib/server/typesense_blue_green.d.ts +15 -0
  41. package/dist/src/lib/server/typesense_blue_green.test.d.ts +1 -0
  42. package/dist/src/lib/server/typesense_index_lock.d.ts +9 -0
  43. package/dist/src/lib/server/typesense_index_lock.test.d.ts +1 -0
  44. package/dist/src/lib/text_parsers/doctrinal_references.d.ts +21 -0
  45. package/dist/src/lib/text_parsers/doctrinal_references.test.d.ts +1 -0
  46. package/dist/src/lib/text_parsers/legal_text_aliases.d.ts +12 -0
  47. package/dist/src/lib/text_parsers/portions.d.ts +2 -2
  48. package/dist/src/lib/text_parsers/simplifiers.d.ts +1 -1
  49. package/dist/src/scripts/shared/assemblee_legislature.d.ts +2 -0
  50. package/dist/src/scripts/shared/assemblee_legislature.test.d.ts +1 -0
  51. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -1,11 +1,11 @@
1
- import { C as e, D as t, E as n, Et as r, H as i, P as a, S as o, T as s, Tt as c, U as l, Y as u, _ as d, a as f, c as p, ct as m, d as h, ft as g, ht as _, m as ee, mt as v, n as y, o as b, pt as te, q as ne, t as re, v as x, vt as ie, w as ae, x as oe, y as se, z as S } from "./html-BKxA21Bq.js";
2
- import { Ct as C, D as ce, E as le, N as ue, Q as de, Tt as w, gt as T, i as fe, j as pe, jt as E, kt as D, n as me, ot as he, pt as ge, r as _e, t as ve, wt as O } from "./resolver-dqOM1G7A.js";
3
- import * as ye from "node:crypto";
4
- import { createHash as k } from "node:crypto";
5
- import A from "fs-extra";
6
- import j from "node:path";
1
+ import { At as e, C as t, Ct as n, D as r, E as i, J as a, P as o, Q as s, S as c, T as l, W as u, _ as d, _t as f, a as p, bt as ee, c as m, d as h, et as g, jt as te, m as _, n as v, o as y, pt as b, q as ne, t as re, v as x, vt as ie, w as ae, x as oe, y as se, yt as S } from "./html-_xYtGRXN.js";
2
+ import { Ct as ce, D as le, E as ue, N as de, Q as fe, Tt as C, gt as w, i as pe, j as me, jt as T, kt as E, n as he, ot as ge, pt as _e, r as ve, t as ye, wt as D } from "./resolver-CLdkzY2R.js";
3
+ import * as be from "node:crypto";
4
+ import { createHash as O } from "node:crypto";
5
+ import k from "fs-extra";
6
+ import A from "node:path";
7
7
  //#region src/lib/server/assemblee_amendment_search.ts
8
- function M(e, t) {
8
+ function xe(e, t) {
9
9
  let n = e;
10
10
  for (let e of t) {
11
11
  if (typeof n != "object" || !n) return null;
@@ -13,34 +13,34 @@ function M(e, t) {
13
13
  }
14
14
  return typeof n == "string" && n.trim() ? n.trim() : null;
15
15
  }
16
- function be(e) {
16
+ function Se(e) {
17
17
  return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
18
18
  }
19
- function xe(e) {
20
- return be(u(e).text());
19
+ function Ce(e) {
20
+ return Se(g(e).text());
21
21
  }
22
- function Se(e) {
23
- let t = be([
24
- M(e, [
22
+ function we(e) {
23
+ let t = Se([
24
+ xe(e, [
25
25
  "corps",
26
26
  "contenuAuteur",
27
27
  "dispositif"
28
28
  ]),
29
- M(e, [
29
+ xe(e, [
30
30
  "corps",
31
31
  "contenuAuteur",
32
32
  "dispositifAmdtCreditPLF"
33
33
  ]),
34
- M(e, [
34
+ xe(e, [
35
35
  "corps",
36
36
  "contenuAuteur",
37
37
  "dispositifAmdtCreditPLFR"
38
38
  ])
39
- ].filter((e) => e !== null).map((e) => xe(e)).join("\n")), n = M(e, [
39
+ ].filter((e) => e !== null).map((e) => Ce(e)).join("\n")), n = xe(e, [
40
40
  "corps",
41
41
  "contenuAuteur",
42
42
  "exposeSommaire"
43
- ]), r = n === null ? "" : xe(n);
43
+ ]), r = n === null ? "" : Ce(n);
44
44
  return [...t ? [{
45
45
  content: t,
46
46
  itemKind: "dispositif",
@@ -51,37 +51,37 @@ function Se(e) {
51
51
  label: "Exposé sommaire"
52
52
  }] : []];
53
53
  }
54
- function Ce(e, t) {
55
- return k("sha256").update(JSON.stringify({
54
+ function Te(e, t) {
55
+ return O("sha256").update(JSON.stringify({
56
56
  item: e,
57
57
  metadata: t
58
58
  })).digest("hex");
59
59
  }
60
60
  //#endregion
61
61
  //#region src/lib/server/parsed_bills.ts
62
- var we = /^expos[ée]\s+des\s+motifs\b/iu;
63
- function N(e) {
62
+ var Ee = /^expos[ée]\s+des\s+motifs\b/iu;
63
+ function j(e) {
64
64
  return (e ?? "").replace(/\u00a0/g, " ").replace(/\s+/g, " ").trim();
65
65
  }
66
- function P(e) {
67
- return N(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
66
+ function M(e) {
67
+ return j(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
68
68
  }
69
- function Te(e) {
70
- return g(N(e));
69
+ function De(e) {
70
+ return f(j(e));
71
71
  }
72
- function Ee(e) {
73
- return `_TocArt${Te(e).replace(/\s+/gu, "")}`;
72
+ function Oe(e) {
73
+ return `_TocArt${De(e).replace(/\s+/gu, "")}`;
74
74
  }
75
- function De(e, t) {
75
+ function ke(e, t) {
76
76
  return e(t).closest(".assnatTOC6,.assnatTOC5,.assnatTOC4").length > 0;
77
77
  }
78
- function Oe(e) {
79
- return P(e).replace(/[‐‑‒–—]/gu, "-").replace(/\s*\.\s*/gu, ".");
78
+ function Ae(e) {
79
+ return M(e).replace(/[‐‑‒–—]/gu, "-").replace(/\s*\.\s*/gu, ".");
80
80
  }
81
- function ke(e) {
82
- return Oe(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
81
+ function je(e) {
82
+ return Ae(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
83
83
  }
84
- function Ae(e) {
84
+ function Me(e) {
85
85
  switch (e.kind) {
86
86
  case "insert_after":
87
87
  case "insert_before": return e.insertText;
@@ -99,12 +99,12 @@ function Ae(e) {
99
99
  default: return;
100
100
  }
101
101
  }
102
- function je(e) {
103
- let t = N(e.sourceText), n = /\b(?:ins[ée]r[ée]s?|cr[ée][ée]s?|ajout[ée]s?|compl[ée]t[ée]s?\s+par)\b[\s\S]{0,160}?\barticle\s+(.+?)\s+ainsi\s+r[ée]dig[ée]s?\b/iu.exec(t);
104
- if (n?.[1] !== void 0) return te(n[1]);
102
+ function Ne(e) {
103
+ let t = j(e.sourceText), n = /\b(?:ins[ée]r[ée]s?|cr[ée][ée]s?|ajout[ée]s?|compl[ée]t[ée]s?\s+par)\b[\s\S]{0,160}?\barticle\s+(.+?)\s+ainsi\s+r[ée]dig[ée]s?\b/iu.exec(t);
104
+ if (n?.[1] !== void 0) return ie(n[1]);
105
105
  }
106
- function Me(e) {
107
- let t = Ae(e), n = m(t ?? "");
106
+ function Pe(e) {
107
+ let t = Me(e), n = b(t ?? "");
108
108
  if (n.length > 0 && t !== void 0) return n.map((e, r) => {
109
109
  let i = e.start, a = n[r + 1]?.start ?? t.length, o = t.slice(i, a).trim();
110
110
  return {
@@ -112,58 +112,58 @@ function Me(e) {
112
112
  text: o
113
113
  };
114
114
  });
115
- let r = je(e);
115
+ let r = Ne(e);
116
116
  return r === void 0 ? [] : [{
117
117
  num: r,
118
118
  text: t ?? e.sourceText
119
119
  }];
120
120
  }
121
- function Ne(e, t = /* @__PURE__ */ new Set()) {
121
+ function Fe(e, t = /* @__PURE__ */ new Set()) {
122
122
  if (e == null) return t;
123
123
  if (Array.isArray(e)) {
124
- for (let n of e) Ne(n, t);
124
+ for (let n of e) Fe(n, t);
125
125
  return t;
126
126
  }
127
127
  if (typeof e != "object") return t;
128
128
  let n = e;
129
129
  n.type === "article" && typeof n.num == "string" && t.add(n.num);
130
- for (let e of Object.values(n)) Ne(e, t);
130
+ for (let e of Object.values(n)) Fe(e, t);
131
131
  return t;
132
132
  }
133
- function Pe(e) {
134
- let t = P(e.sourceText);
133
+ function Ie(e) {
134
+ let t = M(e.sourceText);
135
135
  return /\b(?:cree|cree[e]?s?|resultant|issu|prevu|mentionne)\b[\s\S]{0,80}\b(?:present|presente|pjl|projet\s+de\s+loi)\b/u.test(t);
136
136
  }
137
- function Fe(e) {
138
- return N(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
137
+ function Le(e) {
138
+ return j(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
139
139
  }
140
- function Ie(e, t) {
141
- let n = new C(e, t), r = de(n);
140
+ function Re(e, t) {
141
+ let n = new ce(e, t), r = fe(n);
142
142
  return typeof r != "string" || n.offset <= t ? null : {
143
143
  date: r,
144
144
  start: t,
145
145
  stop: n.offset
146
146
  };
147
147
  }
148
- function Le(e, t) {
148
+ function ze(e, t) {
149
149
  let n = /\d/u.exec(e.slice(t));
150
150
  if (!n) return null;
151
151
  let r = t + n.index;
152
- return e.slice(t, r).trim().length > 0 ? null : Ie(e, r);
152
+ return e.slice(t, r).trim().length > 0 ? null : Re(e, r);
153
153
  }
154
- function Re(e) {
154
+ function Be(e) {
155
155
  let t = /^la présente loi (?:s['’]appli(?:que|quent)|entr(?:e|ent) en vigueur) (?:[aà] compter (?:du|de|d['’])|au|le)\s*/u, n = /^la présente loi s['’]appli(?:que|quent)\s*:\s*/u, r = /\b[aà] compter (?:du|de|d['’])\s*/gu, i = [], a = "la présente loi", o = e.indexOf(a);
156
156
  for (; o !== -1;) {
157
157
  let s = e.indexOf(a, o + 15), c = e.slice(o, o + 1400), l = t.exec(c);
158
158
  if (l) {
159
- let e = Le(c, l[0].length);
159
+ let e = ze(c, l[0].length);
160
160
  e && i.push(e.date);
161
161
  }
162
162
  let u = n.exec(c);
163
163
  if (u) {
164
164
  let e = /\barticle\s+\w/iu.exec(c), t = e === null ? c.slice(u[0].length) : c.slice(u[0].length, e.index);
165
165
  for (r.lastIndex = 0; r.exec(t) !== null;) {
166
- let e = Le(t, r.lastIndex);
166
+ let e = ze(t, r.lastIndex);
167
167
  e && /^\s+pour\s+les\s+autres\s+dispositions\s+fiscales\b/iu.test(t.slice(e.stop)) && i.push(e.date);
168
168
  }
169
169
  }
@@ -171,20 +171,20 @@ function Re(e) {
171
171
  }
172
172
  return i;
173
173
  }
174
- function ze(e) {
175
- let t = Re(Fe(e).toLowerCase()), n = Array.from(new Set(t));
174
+ function Ve(e) {
175
+ let t = Be(Le(e).toLowerCase()), n = Array.from(new Set(t));
176
176
  return n.length === 1 ? n[0] : void 0;
177
177
  }
178
- function Be(e) {
179
- return P(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-").replace(/^(?:(?:article\s+[^:]+|[a-z][.)]|[ivxlcdm]+\.|\d+°)\s*(?:-\s*)?)+/iu, "");
178
+ function He(e) {
179
+ return M(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-").replace(/^(?:(?:article\s+[^:]+|[a-z][.)]|[ivxlcdm]+\.|\d+°)\s*(?:-\s*)?)+/iu, "");
180
180
  }
181
- function F(e) {
181
+ function N(e) {
182
182
  return e?.type === "tag";
183
183
  }
184
- function Ve(e, t) {
184
+ function Ue(e, t) {
185
185
  return e.html(t) ?? "";
186
186
  }
187
- function He(e, t) {
187
+ function We(e, t) {
188
188
  let n = [], r = /* @__PURE__ */ new Set();
189
189
  for (let i of e(t).find("a").get()) {
190
190
  let a = e(i).attr("href") ?? "", o = /\/legifrance\/(articles|sections|textes)\/([^?#"]+)/u.exec(a);
@@ -192,43 +192,43 @@ function He(e, t) {
192
192
  let s = o[1] === "articles" ? "article" : o[1] === "sections" ? "division" : "text", c = o[2].replace(/\.md$/u, ""), l = `${s}\0${c}`;
193
193
  if (r.has(l)) continue;
194
194
  r.add(l);
195
- let u = N(e(i).text());
195
+ let u = j(e(i).text());
196
196
  n.push({
197
197
  id: c,
198
- ...Ue(e, t, i) ? { insideFrenchQuotes: !0 } : {},
198
+ ...Ge(e, t, i) ? { insideFrenchQuotes: !0 } : {},
199
199
  ...u ? { text: u } : {},
200
200
  type: s
201
201
  });
202
202
  }
203
203
  return n;
204
204
  }
205
- function Ue(e, t, n) {
206
- let r = We(e, t, n);
205
+ function Ge(e, t, n) {
206
+ let r = Ke(e, t, n);
207
207
  return (r.match(/«/gu) ?? []).length > (r.match(/»/gu) ?? []).length;
208
208
  }
209
- function We(e, t, n) {
209
+ function Ke(e, t, n) {
210
210
  if (t === n) return "";
211
211
  if (t.type === "text") return t.data ?? "";
212
- if (!F(t)) return "";
212
+ if (!N(t)) return "";
213
213
  let r = "";
214
214
  for (let i of e(t).contents().get()) {
215
215
  if (i === n) return r;
216
- if (F(i) && e.contains(i, n)) return r + We(e, i, n);
216
+ if (N(i) && e.contains(i, n)) return r + Ke(e, i, n);
217
217
  r += e(i).text();
218
218
  }
219
219
  return r;
220
220
  }
221
- function Ge(e, t) {
222
- return t.map((t) => N(e(t).text())).filter(Boolean).join("\n");
221
+ function qe(e, t) {
222
+ return t.map((t) => j(e(t).text())).filter(Boolean).join("\n");
223
223
  }
224
- function Ke(t) {
225
- let n = P(t);
226
- return !n || we.test(n) ? "noise" : e.test(t) ? "directive_candidate" : "context";
224
+ function Je(e) {
225
+ let n = M(e);
226
+ return !n || Ee.test(n) ? "noise" : t.test(e) ? "directive_candidate" : "context";
227
227
  }
228
- async function qe(e, t, n) {
228
+ async function Ye(e, t, n) {
229
229
  if (n === void 0) throw Error("A document date is required to add links to legal references.");
230
230
  if (t.legiResolver === void 0 && t.canutesDb === void 0) throw Error("A Canutes database or an explicit legal resolver is required to add links to legal references.");
231
- let { output: r } = await y({
231
+ let { output: r } = await v({
232
232
  date: n,
233
233
  html: e,
234
234
  legiResolver: t.legiResolver ?? new h(t.canutesDb),
@@ -240,13 +240,13 @@ async function qe(e, t, n) {
240
240
  });
241
241
  return r ?? e;
242
242
  }
243
- function Je(e, t) {
243
+ function Xe(e, t) {
244
244
  let n = e(t).closest("h1,h2,h3,h4,h5,h6,p,td,th").get(0), r = e(t).closest("table").get(0);
245
- return F(r) && F(n) && e(n).parents("table").get(0) === r ? r : F(n) ? n : t;
245
+ return N(r) && N(n) && e(n).parents("table").get(0) === r ? r : N(n) ? n : t;
246
246
  }
247
- function Ye(e, t, n, r) {
247
+ function Ze(e, t, n, r) {
248
248
  if (t.has(r.container)) return;
249
- let i = r.id ?? Ee(r.num ?? r.label);
249
+ let i = r.id ?? Oe(r.num ?? r.label);
250
250
  n.has(i) || (n.add(i), t.add(r.container), e.push({
251
251
  id: i,
252
252
  label: r.label,
@@ -256,16 +256,16 @@ function Ye(e, t, n, r) {
256
256
  container: r.container
257
257
  }));
258
258
  }
259
- function Xe(e) {
259
+ function Qe(e) {
260
260
  let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
261
261
  e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
262
- if (De(e, a)) return;
263
- let o = v(N(e(a).text()));
262
+ if (ke(e, a)) return;
263
+ let o = S(j(e(a).text()));
264
264
  if (!o) return;
265
265
  let s = e(a).attr("id");
266
266
  if (!s || r.has(s)) return;
267
- let c = Je(e, a);
268
- Ye(t, n, r, {
267
+ let c = Xe(e, a);
268
+ Ze(t, n, r, {
269
269
  id: s,
270
270
  ...o,
271
271
  element: a,
@@ -273,8 +273,8 @@ function Xe(e) {
273
273
  });
274
274
  }), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((i, a) => {
275
275
  if (n.has(a)) return;
276
- let o = v(N(e(a).text()));
277
- o && Ye(t, n, r, {
276
+ let o = S(j(e(a).text()));
277
+ o && Ze(t, n, r, {
278
278
  ...o,
279
279
  element: a,
280
280
  container: a
@@ -283,27 +283,27 @@ function Xe(e) {
283
283
  let i = e("body *");
284
284
  return t.sort((e, t) => i.index(e.container) - i.index(t.container)), t;
285
285
  }
286
- function Ze(e, t) {
287
- if (De(e, t)) return !1;
286
+ function $e(e, t) {
287
+ if (ke(e, t)) return !1;
288
288
  let n = t.tagName?.toLowerCase();
289
289
  if (n !== "p") return /^h[1-6]$/u.test(n ?? "");
290
290
  let r = e(t).attr("style") ?? "", i = e(t).html() ?? "";
291
291
  return /text-align\s*:\s*center/iu.test(r) && (/font-weight\s*:\s*bold/iu.test(r) || /font-weight\s*:\s*bold/iu.test(i) || /<(?:strong|b)(?:\s|>)/iu.test(i));
292
292
  }
293
- function Qe(e) {
293
+ function et(e) {
294
294
  let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
295
295
  return e("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6,p").each((i, a) => {
296
- if (De(e, a) || !e(a).hasClass("assnat9ArticleNum") && !Ze(e, a)) return;
297
- let o = v(e(a).text());
298
- o && Ye(t, n, r, {
296
+ if (ke(e, a) || !e(a).hasClass("assnat9ArticleNum") && !$e(e, a)) return;
297
+ let o = S(e(a).text());
298
+ o && Ze(t, n, r, {
299
299
  ...o,
300
300
  element: a,
301
301
  container: a
302
302
  });
303
303
  }), t;
304
304
  }
305
- function $e(e) {
306
- let t = P(Te(e ?? "")).replace(/[()]/gu, "").trim();
305
+ function tt(e) {
306
+ let t = M(De(e ?? "")).replace(/[()]/gu, "").trim();
307
307
  if (!t || t === "liminaire") return;
308
308
  if (t === "unique") return {
309
309
  base: 1,
@@ -312,21 +312,21 @@ function $e(e) {
312
312
  };
313
313
  let n = /^(?:(\d+)|1er|premier)(?:\s+([a-z]+))?$/u.exec(t);
314
314
  if (!n) return;
315
- let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 : et(i);
315
+ let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 : nt(i);
316
316
  if (a !== void 0) return {
317
317
  base: r,
318
318
  suffixOrder: a,
319
319
  text: t
320
320
  };
321
321
  }
322
- function et(e) {
323
- let t = new C(e), n = he(t);
322
+ function nt(e) {
323
+ let t = new ce(e), n = ge(t);
324
324
  if (!(n === void 0 || t.offset !== e.length) && !(typeof n != "object" || !n || !("value" in n) || typeof n.value != "number")) return n.value - 1;
325
325
  }
326
- function tt(e) {
326
+ function rt(e) {
327
327
  let t = [], n = e.map((e) => ({
328
328
  heading: e,
329
- token: $e(e.num)
329
+ token: tt(e.num)
330
330
  }));
331
331
  n.filter(({ token: e }) => e?.text === "unique").length > 0 && e.length > 1 && t.push("Article unique appears with other articles");
332
332
  let r;
@@ -339,23 +339,23 @@ function tt(e) {
339
339
  }
340
340
  t.length > 0 && process.env.TISSEUSE_WARN_ASSEMBLEE_HEADING_SEQUENCE === "1" && console.warn("Incoherent Assemblée article heading sequence", { issues: t });
341
341
  }
342
- function nt(e, { warn: t = !0 } = {}) {
343
- let n = Xe(e);
344
- if (n.length > 0) return t && tt(n), n;
345
- let r = Qe(e);
346
- return t && tt(r), r;
342
+ function it(e, { warn: t = !0 } = {}) {
343
+ let n = Qe(e);
344
+ if (n.length > 0) return t && rt(n), n;
345
+ let r = et(e);
346
+ return t && rt(r), r;
347
347
  }
348
- function rt(e) {
348
+ function at(e) {
349
349
  let t = e.next;
350
350
  for (; t !== null;) {
351
- if (F(t)) return t;
351
+ if (N(t)) return t;
352
352
  t = t.next;
353
353
  }
354
354
  return null;
355
355
  }
356
- function it(e, t, n) {
356
+ function ot(e, t, n) {
357
357
  let r = [t.container], i = n?.container;
358
- for (let e = rt(t.container); e !== null && e !== i; e = rt(e)) r.push(e);
358
+ for (let e = at(t.container); e !== null && e !== i; e = at(e)) r.push(e);
359
359
  if (r.length > 1) return r;
360
360
  let a = e("body *").index(t.container), o = i ? e("body *").index(i) : -1;
361
361
  return e("body > *").get().filter((t) => {
@@ -363,7 +363,7 @@ function it(e, t, n) {
363
363
  return n >= a && (o === -1 || n < o);
364
364
  });
365
365
  }
366
- function at(e, t) {
366
+ function st(e, t) {
367
367
  let n = [], r = /* @__PURE__ */ new Set();
368
368
  for (let i of t) {
369
369
  let t = "p,li,table", a = e(i).is(t) ? [i] : e(i).find(t).get();
@@ -371,76 +371,76 @@ function at(e, t) {
371
371
  }
372
372
  return n;
373
373
  }
374
- function ot(e, t, n) {
374
+ function ct(e, t, n) {
375
375
  let r = [], i = !1;
376
- for (let a of at(e, n)) {
377
- let n = N(e(a).text());
376
+ for (let a of st(e, n)) {
377
+ let n = j(e(a).text());
378
378
  if (!n) continue;
379
- we.test(n) && (i = !0);
380
- let o = i ? "noise" : Ke(n), s = `${t}-b${r.length + 1}`;
379
+ Ee.test(n) && (i = !0);
380
+ let o = i ? "noise" : Je(n), s = `${t}-b${r.length + 1}`;
381
381
  e(a).attr("data-pjl-parsed-article-id", t), e(a).attr("data-pjl-parsed-block-id", s), r.push({
382
382
  id: s,
383
383
  articleId: t,
384
384
  kind: o,
385
- links: He(e, a),
385
+ links: We(e, a),
386
386
  text: n,
387
- html: Ve(e, a)
387
+ html: Ue(e, a)
388
388
  });
389
389
  }
390
390
  return r;
391
391
  }
392
- function st(e, t) {
392
+ function lt(e, t) {
393
393
  if (t.length === 0) return e;
394
394
  let n = `<div style="display: none;">\n${t.map((e) => `<p class="assnatTOC6"><a href="#${e.id}"><span class="assnatHyperlink" style="font-weight:bold; text-decoration:none; color:#000000">${e.label.toUpperCase()}</span></a></p>`).join("\n")}\n</div>`;
395
395
  return e.includes("class=\"assnatSection3\"") ? e.replace(/(<div class="assnatSection3">)/u, `${n}$1`) : e.includes("id=\"formCorrection:panel:1:table\"") ? e.replace(/(<div id="formCorrection:panel:1:table">)/u, `${n}$1`) : `${n}\n${e}`;
396
396
  }
397
- function ct(e) {
398
- let t = u(e);
399
- for (let e of nt(t, { warn: !1 })) {
400
- let n = Ee(e.num ?? e.label.replace(/^Article\s+/iu, "")), r = t(e.element), i = r.attr("id");
401
- i !== n && (i?.startsWith("_Toc") && !lt(t, i, e.element) && r.before(t("<span></span>").attr("id", i)), r.attr("id", n));
397
+ function ut(e) {
398
+ let t = g(e);
399
+ for (let e of it(t, { warn: !1 })) {
400
+ let n = Oe(e.num ?? e.label.replace(/^Article\s+/iu, "")), r = t(e.element), i = r.attr("id");
401
+ i !== n && (i?.startsWith("_Toc") && !dt(t, i, e.element) && r.before(t("<span></span>").attr("id", i)), r.attr("id", n));
402
402
  }
403
- let n = nt(t);
403
+ let n = it(t);
404
404
  for (let [e, r] of n.entries()) {
405
- let i = it(t, r, n[e + 1]).flatMap((e) => t(e).is("span.alinea[data-alinea]") ? [e] : t(e).find("span.alinea[data-alinea]").get());
405
+ let i = ot(t, r, n[e + 1]).flatMap((e) => t(e).is("span.alinea[data-alinea]") ? [e] : t(e).find("span.alinea[data-alinea]").get());
406
406
  for (let e of i) {
407
407
  let n = t(e).attr("data-alinea")?.trim();
408
408
  if (!n) continue;
409
409
  let i = `${r.id}-alinea-${n.replace(/\s+/gu, "")}`;
410
- if (lt(t, i, e)) continue;
410
+ if (dt(t, i, e)) continue;
411
411
  let a = t(e).attr("id");
412
412
  a && a !== i ? t(e).before(t("<span></span>").attr("id", i)) : t(e).attr("id", i);
413
413
  }
414
414
  }
415
415
  return t.html();
416
416
  }
417
- function lt(e, t, n) {
417
+ function dt(e, t, n) {
418
418
  for (let r of e("[id]").get()) if (r !== n && e(r).attr("id") === t) return !0;
419
419
  return !1;
420
420
  }
421
- function ut(e, t) {
422
- let n = Be("sourceText" in t ? t.sourceText : "");
421
+ function ft(e, t) {
422
+ let n = He("sourceText" in t ? t.sourceText : "");
423
423
  if (n) return e.filter((e) => e.kind === "directive_candidate").find((e) => {
424
- let t = Be(e.text);
424
+ let t = He(e.text);
425
425
  return t.length > 0 && (n.includes(t) || t.includes(n));
426
426
  });
427
427
  }
428
- function dt(e, t) {
428
+ function pt(e, t) {
429
429
  if (t) return t.blockIds.map((t) => e.get(t)).find((e) => e?.kind === "directive_candidate");
430
430
  }
431
- function ft(e) {
431
+ function mt(e) {
432
432
  return e?.links.filter((e) => !e.insideFrenchQuotes && (e.type === "article" || e.type === "division")).map((e) => e.id) ?? [];
433
433
  }
434
- function pt(e) {
435
- let t = N(e);
434
+ function ht(e) {
435
+ let t = j(e);
436
436
  if (!t) return;
437
- let n = ne(t);
437
+ let n = s(t);
438
438
  return n ? n.level : t.endsWith(":") ? 0 : void 0;
439
439
  }
440
- function mt(e) {
440
+ function gt(e) {
441
441
  let t = /* @__PURE__ */ new Map(), n = [];
442
442
  for (let r of e) {
443
- let e = pt(r.text);
443
+ let e = ht(r.text);
444
444
  if (e === void 0) {
445
445
  t.set(r.id, [...n.map((e) => e.block), r]);
446
446
  continue;
@@ -453,14 +453,14 @@ function mt(e) {
453
453
  }
454
454
  return t;
455
455
  }
456
- function ht(e, t) {
456
+ function _t(e, t) {
457
457
  let n = [], r = /* @__PURE__ */ new Set();
458
458
  for (let i of [...e ?? [], ...t]) i !== void 0 && (r.has(i.id) || (r.add(i.id), n.push(i)));
459
459
  return n;
460
460
  }
461
- function gt(e, t, n) {
461
+ function vt(e, t, n) {
462
462
  if (!t) return;
463
- let r = ht(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
463
+ let r = _t(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
464
464
  if (r.length === 0) return;
465
465
  let i = r.map((e) => e.id);
466
466
  if (i.length === t.blockIds.length && i.every((e, n) => e === t.blockIds[n])) return;
@@ -475,7 +475,7 @@ function gt(e, t, n) {
475
475
  }
476
476
  };
477
477
  }
478
- function _t(e) {
478
+ function yt(e) {
479
479
  let t = [], n = 0;
480
480
  for (let r of e.blocks) {
481
481
  let i = e.directiveText.indexOf(r.text, n);
@@ -489,7 +489,7 @@ function _t(e) {
489
489
  }
490
490
  return t;
491
491
  }
492
- function vt(e, t, n) {
492
+ function bt(e, t, n) {
493
493
  let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop >= r && e.start <= i);
494
494
  if (a.length === 0) return;
495
495
  let o = a[0], s = a[a.length - 1], c = o.start, l = s.stop;
@@ -503,7 +503,7 @@ function vt(e, t, n) {
503
503
  }
504
504
  };
505
505
  }
506
- function yt(e, t, n) {
506
+ function xt(e, t, n) {
507
507
  if (!t) return;
508
508
  let r = e.directiveText.indexOf(t.text);
509
509
  if (r === -1) return;
@@ -516,14 +516,14 @@ function yt(e, t, n) {
516
516
  stop: a
517
517
  };
518
518
  }
519
- function bt(e) {
520
- let t = _t(e), n = new Map(e.blocks.map((e) => [e.id, e])), r = mt(e.blocks), i = /* @__PURE__ */ new Map(), a = [];
519
+ function St(e) {
520
+ let t = yt(e), n = new Map(e.blocks.map((e) => [e.id, e])), r = gt(e.blocks), i = /* @__PURE__ */ new Map(), a = [];
521
521
  for (let t of e.blocks) {
522
- let e = ft(t);
522
+ let e = mt(t);
523
523
  e.length > 0 && (a = e), i.set(t.id, a);
524
524
  }
525
- return ee(e.directiveText).map((a) => {
526
- let o = vt(e, t, a), s = dt(n, o) ?? ut(e.blocks, a), c = ft(s), l = c.length > 0 ? c : s?.id === void 0 ? [] : i.get(s.id) ?? [], u = yt(e, s, a), d = gt(s?.id === void 0 ? void 0 : r.get(s.id), o, n);
525
+ return _(e.directiveText).map((a) => {
526
+ let o = bt(e, t, a), s = pt(n, o) ?? ft(e.blocks, a), c = mt(s), l = c.length > 0 ? c : s?.id === void 0 ? [] : i.get(s.id) ?? [], u = xt(e, s, a), d = vt(s?.id === void 0 ? void 0 : r.get(s.id), o, n);
527
527
  return {
528
528
  articleId: e.id,
529
529
  blockId: s?.id,
@@ -543,13 +543,13 @@ function bt(e) {
543
543
  };
544
544
  });
545
545
  }
546
- function xt(e) {
546
+ function Ct(e) {
547
547
  let t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Set();
548
548
  for (let i of e) {
549
- let e = Me(i.directive);
549
+ let e = Pe(i.directive);
550
550
  if (e.length === 0) continue;
551
551
  let a = e.map(({ num: e }) => ({
552
- definitionId: `${i.articleId}:article:${ke(e)}`,
552
+ definitionId: `${i.articleId}:article:${je(e)}`,
553
553
  num: e
554
554
  }));
555
555
  t.set(i, a);
@@ -572,13 +572,13 @@ function xt(e) {
572
572
  definitions: n
573
573
  };
574
574
  }
575
- function St(e, t, n) {
576
- let r = new Map(t.map((e) => [Oe(e.num), e]));
575
+ function wt(e, t, n) {
576
+ let r = new Map(t.map((e) => [Ae(e.num), e]));
577
577
  return e.map((e) => {
578
- let t = n.get(e), i = t?.[0], a = [...Ne(e.directive.reference)].map((e) => r.get(Oe(e))).filter((e) => e !== void 0 && e.definitionId !== i?.definitionId)[0], o = a === void 0 ? void 0 : {
578
+ let t = n.get(e), i = t?.[0], a = [...Fe(e.directive.reference)].map((e) => r.get(Ae(e))).filter((e) => e !== void 0 && e.definitionId !== i?.definitionId)[0], o = a === void 0 ? void 0 : {
579
579
  definitionId: a.definitionId,
580
580
  num: a.num
581
- }, s = Pe(e.directive), c = (e.targetIds?.length ?? 0) > 0;
581
+ }, s = Ie(e.directive), c = (e.targetIds?.length ?? 0) > 0;
582
582
  return {
583
583
  ...e,
584
584
  ...i === void 0 ? {} : { createdArticle: i },
@@ -591,40 +591,40 @@ function St(e, t, n) {
591
591
  };
592
592
  });
593
593
  }
594
- function Ct(e, t, n, r, i, a, o = !0, s) {
594
+ function Tt(e, t, n, r, i, a, o = !0, s) {
595
595
  let c = i.map((e) => e.directiveText).filter(Boolean).join("\n"), l = {
596
596
  sourceFormat: e,
597
597
  documentDate: r,
598
598
  html: t,
599
599
  htmlWithLinks: n,
600
- tableOfContents: a ?? b(c),
600
+ tableOfContents: a ?? y(c),
601
601
  articles: i
602
602
  };
603
603
  if (!o) return {
604
604
  ...l,
605
605
  directives: []
606
606
  };
607
- let u = ze(i.map((e) => e.text).join("\n")), d = i.flatMap(bt), { createdArticlesByDirective: f, definitions: p } = xt(d), m = St(d, p, f);
607
+ let u = Ve(i.map((e) => e.text).join("\n")), d = i.flatMap(St), { createdArticlesByDirective: f, definitions: p } = Ct(d), ee = wt(d, p, f);
608
608
  return {
609
609
  ...l,
610
610
  ...u ? { globalApplicabilityDate: u } : {},
611
611
  ...p.length > 0 ? { internalArticleDefinitions: p } : {},
612
- directives: m,
612
+ directives: ee,
613
613
  ...s !== void 0 && s.length > 0 ? { diagnostics: s } : {}
614
614
  };
615
615
  }
616
- function wt(e) {
616
+ function Et(e) {
617
617
  return { items: e.map((e) => ({
618
618
  id: e.id,
619
619
  line: e.title ? `${e.label} : ${e.title}` : e.label,
620
620
  type: "article"
621
621
  })) };
622
622
  }
623
- function Tt(e) {
624
- return Array.from(p(e)).filter((e) => e.type === "article").map((e) => P(e.line.split(/[::]/u)[0]));
623
+ function Dt(e) {
624
+ return Array.from(m(e)).filter((e) => e.type === "article").map((e) => M(e.line.split(/[::]/u)[0]));
625
625
  }
626
- function Et(e) {
627
- let t = Tt(b(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), n = e.map((e) => P(e.label)), r = [];
626
+ function Ot(e) {
627
+ let t = Dt(y(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), n = e.map((e) => M(e.label)), r = [];
628
628
  if (t.length > 0 && (t.length !== n.length || t.some((e, t) => e !== n[t]))) {
629
629
  let i = t.findIndex((e, t) => e !== n[t]);
630
630
  r.push({
@@ -645,42 +645,42 @@ function Et(e) {
645
645
  }
646
646
  return {
647
647
  diagnostics: r,
648
- tableOfContents: wt(e)
648
+ tableOfContents: Et(e)
649
649
  };
650
650
  }
651
- async function Dt(e, t) {
652
- let n = new me("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => Ot(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => ct(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => u(i)), o = n.timeSync("extractArticleHeadings", () => nt(a)), s = n.timeSync("extractArticlesAndBlocks", () => o.map((e, t) => {
653
- let n = it(a, e, o[t + 1]), r = ot(a, e.id, n), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
651
+ async function kt(e, t) {
652
+ let n = new he("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => At(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => ut(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => g(i)), o = n.timeSync("extractArticleHeadings", () => it(a)), s = n.timeSync("extractArticlesAndBlocks", () => o.map((e, t) => {
653
+ let n = ot(a, e, o[t + 1]), r = ct(a, e.id, n), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
654
654
  return {
655
655
  id: e.id,
656
656
  label: e.label,
657
657
  num: e.num,
658
658
  title: e.title,
659
- text: Ge(a, n),
660
- html: n.map((e) => Ve(a, e)).join("\n"),
659
+ text: qe(a, n),
660
+ html: n.map((e) => Ue(a, e)).join("\n"),
661
661
  directiveText: i,
662
662
  blocks: r
663
663
  };
664
- }), { count: o.length }), c = n.timeSync("injectHiddenArticleSummary", () => st(a.html(), s)), { diagnostics: l, tableOfContents: d } = n.timeSync("buildAssembleeTableOfContents", () => Et(s), { count: s.length }), f = n.timeSync("buildParsedDocument", () => Ct("assemblee-html", e, c, t.date, s, d, t.includeDirectiveAnalysis, l));
665
- return f.diagnostics?.length && process.env.TISSEUSE_WARN_PARSED_BILL_DIAGNOSTICS === "1" && console.warn("Assemblée bill parsing diagnostics", f.diagnostics), n.log({
666
- articleCount: f.articles.length,
667
- blockCount: f.articles.reduce((e, t) => e + t.blocks.length, 0),
668
- directiveCount: f.directives.length,
669
- targetDirectiveCount: f.directives.filter((e) => e.targetIds !== void 0).length
670
- }), f;
664
+ }), { count: o.length }), c = n.timeSync("injectHiddenArticleSummary", () => lt(a.html(), s)), { diagnostics: l, tableOfContents: u } = n.timeSync("buildAssembleeTableOfContents", () => Ot(s), { count: s.length }), d = n.timeSync("buildParsedDocument", () => Tt("assemblee-html", e, c, t.date, s, u, t.includeDirectiveAnalysis, l));
665
+ return d.diagnostics?.length && process.env.TISSEUSE_WARN_PARSED_BILL_DIAGNOSTICS === "1" && console.warn("Assemblée bill parsing diagnostics", d.diagnostics), n.log({
666
+ articleCount: d.articles.length,
667
+ blockCount: d.articles.reduce((e, t) => e + t.blocks.length, 0),
668
+ directiveCount: d.directives.length,
669
+ targetDirectiveCount: d.directives.filter((e) => e.targetIds !== void 0).length
670
+ }), d;
671
671
  }
672
- async function Ot(e, t) {
672
+ async function At(e, t) {
673
673
  return {
674
674
  sourceFormat: "assemblee-html",
675
675
  documentDate: t.date,
676
676
  html: e,
677
- linkedHtml: await qe(e, t, t.date)
677
+ linkedHtml: await Ye(e, t, t.date)
678
678
  };
679
679
  }
680
- function I(e) {
680
+ function P(e) {
681
681
  return e.replace(/&/gu, "&amp;").replace(/</gu, "&lt;").replace(/>/gu, "&gt;").replace(/"/gu, "&quot;");
682
682
  }
683
- function kt(e) {
683
+ function jt(e) {
684
684
  let t = e;
685
685
  for (let e = 0; e < 3; e++) {
686
686
  let e = t;
@@ -688,27 +688,27 @@ function kt(e) {
688
688
  }
689
689
  return t;
690
690
  }
691
- function At(e) {
691
+ function Mt(e) {
692
692
  return /(?:&lt;|&amp;lt;)\/?(?:p|br|span|b|i|u|sup|sub|table|thead|tbody|tr|th|td|ul|ol|li)\b/iu.test(e);
693
693
  }
694
- function L(e) {
694
+ function F(e) {
695
695
  return e.name.replace(/^.*:/u, "");
696
696
  }
697
- function jt(e, t) {
698
- return t.children.map((t) => R(e, t)).filter(Boolean).join("");
697
+ function Nt(e, t) {
698
+ return t.children.map((t) => I(e, t)).filter(Boolean).join("");
699
699
  }
700
- function Mt(e, t) {
701
- return t.children.map((t) => t.type === "text" && At(t.data) ? kt(t.data) : R(e, t)).filter(Boolean).join("");
700
+ function Pt(e, t) {
701
+ return t.children.map((t) => t.type === "text" && Mt(t.data) ? jt(t.data) : I(e, t)).filter(Boolean).join("");
702
702
  }
703
- function R(e, t) {
703
+ function I(e, t) {
704
704
  if (t.type === "text") {
705
705
  let e = t.data.replace(/\s+\./gu, ".");
706
- return At(e) ? kt(e) : I(e);
706
+ return Mt(e) ? jt(e) : P(e);
707
707
  }
708
- if (!F(t)) return "";
709
- let n = L(t), r = jt(e, t);
708
+ if (!N(t)) return "";
709
+ let n = F(t), r = Nt(e, t);
710
710
  switch (n) {
711
- case "p": return `<p${z(e, t, [
711
+ case "p": return `<p${L(e, t, [
712
712
  "id",
713
713
  "class",
714
714
  "align",
@@ -722,13 +722,13 @@ function R(e, t) {
722
722
  case "u":
723
723
  case "sup":
724
724
  case "sub":
725
- case "abbr": return `<${n}${z(e, t, [
725
+ case "abbr": return `<${n}${L(e, t, [
726
726
  "id",
727
727
  "class",
728
728
  "title",
729
729
  "style"
730
730
  ])}>${r}</${n}>`;
731
- case "a": return `<a href="${I(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${z(e, t, [
731
+ case "a": return `<a href="${P(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${L(e, t, [
732
732
  "id",
733
733
  "class",
734
734
  "title",
@@ -739,8 +739,8 @@ function R(e, t) {
739
739
  case "tbody":
740
740
  case "tr":
741
741
  case "th":
742
- case "td": return Nt(e, t, n, r);
743
- case "caption": return `<caption${z(e, t, [
742
+ case "td": return Ft(e, t, n, r);
743
+ case "caption": return `<caption${L(e, t, [
744
744
  "id",
745
745
  "class",
746
746
  "align",
@@ -748,12 +748,12 @@ function R(e, t) {
748
748
  ])}>${r}</caption>`;
749
749
  case "num": return `<span class="akn-num">${r}</span> `;
750
750
  case "heading": return `<p class="akn-heading">${r}</p>`;
751
- case "content": return Mt(e, t);
752
- case "alinea": return B(e, t, "div", "akn-alinea");
753
- case "article": return B(e, t, "article", "akn-article");
751
+ case "content": return Pt(e, t);
752
+ case "alinea": return R(e, t, "div", "akn-alinea");
753
+ case "article": return R(e, t, "article", "akn-article");
754
754
  case "blockList":
755
755
  case "list": return `<div class="akn-list">${r}</div>`;
756
- case "item": return B(e, t, "div", "akn-item");
756
+ case "item": return R(e, t, "div", "akn-item");
757
757
  case "listIntroduction":
758
758
  case "listWrapUp":
759
759
  case "intro":
@@ -769,23 +769,23 @@ function R(e, t) {
769
769
  case "book":
770
770
  case "tome":
771
771
  case "subchapter":
772
- case "subsection": return B(e, t, "section", `akn-${n}`);
772
+ case "subsection": return R(e, t, "section", `akn-${n}`);
773
773
  case "crossHeading": return `<p class="akn-cross-heading">${r}</p>`;
774
774
  default: return r;
775
775
  }
776
776
  }
777
- function z(e, t, n, r = {}) {
777
+ function L(e, t, n, r = {}) {
778
778
  let i = [];
779
779
  for (let r of n) {
780
780
  if (r === "style") continue;
781
781
  let n = e(t).attr(r);
782
- n !== void 0 && i.push(`${r}="${I(n)}"`);
782
+ n !== void 0 && i.push(`${r}="${P(n)}"`);
783
783
  }
784
784
  let a = r.style ?? e(t).attr("style");
785
- return a && i.push(`style="${I(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
785
+ return a && i.push(`style="${P(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
786
786
  }
787
- function Nt(e, t, n, r) {
788
- return `<${n}${z(e, t, [
787
+ function Ft(e, t, n, r) {
788
+ return `<${n}${L(e, t, [
789
789
  "id",
790
790
  "class",
791
791
  "colspan",
@@ -798,155 +798,155 @@ function Nt(e, t, n, r) {
798
798
  "cellspacing",
799
799
  "cellpadding",
800
800
  "style"
801
- ], { style: Pt(e, t, n) })}>${r}</${n}>`;
801
+ ], { style: It(e, t, n) })}>${r}</${n}>`;
802
802
  }
803
- function Pt(e, t, n) {
803
+ function It(e, t, n) {
804
804
  let r = e(t).attr("style") ?? "";
805
- return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = Ft(r, "text-align", "center")), r || void 0;
805
+ return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = Lt(r, "text-align", "center")), r || void 0;
806
806
  }
807
- function Ft(e, t, n) {
807
+ function Lt(e, t, n) {
808
808
  let r = e.trim();
809
809
  return `${r}${r && !r.endsWith(";") ? ";" : ""} ${t}: ${n};`.trim();
810
810
  }
811
- function It(e, t) {
812
- let n = [N(e(t).children("num").first().text()), N(e(t).children("heading").first().text())].filter(Boolean);
813
- return n.length === 0 ? "" : `<p class="akn-heading">${I(n.join(" "))}</p>`;
811
+ function Rt(e, t) {
812
+ let n = [j(e(t).children("num").first().text()), j(e(t).children("heading").first().text())].filter(Boolean);
813
+ return n.length === 0 ? "" : `<p class="akn-heading">${P(n.join(" "))}</p>`;
814
814
  }
815
- function Lt(e, t) {
815
+ function zt(e, t) {
816
816
  if (!t) return !1;
817
- let n = (e) => N(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
818
- return n(N(e.replace(/<[^>]*>/gu, " ").replace(/&nbsp;/gu, " ").replace(/&#xa0;/giu, " ").replace(/&#x2013;/giu, "–"))).startsWith(n(t));
817
+ let n = (e) => j(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
818
+ return n(j(e.replace(/<[^>]*>/gu, " ").replace(/&nbsp;/gu, " ").replace(/&#xa0;/giu, " ").replace(/&#x2013;/giu, "–"))).startsWith(n(t));
819
819
  }
820
- function Rt(e) {
821
- let t = I(e);
820
+ function Bt(e) {
821
+ let t = P(e);
822
822
  return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}">${t}</span></p>`;
823
823
  }
824
- function zt(e, t) {
825
- return Bt([Vt({
824
+ function Vt(e, t) {
825
+ return Ht([Ut({
826
826
  content: e,
827
827
  pastille: t
828
828
  })]);
829
829
  }
830
- function Bt(e) {
830
+ function Ht(e) {
831
831
  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>`;
832
832
  }
833
- function Vt({ content: e, pastille: t, style: n, contextClass: r }) {
834
- let i = n ? ` style="${I(n)}"` : "", a = r ? ` ${I(r)}` : "";
835
- return `<tr${r ? ` class="${I(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${Rt(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>`;
833
+ function Ut({ content: e, pastille: t, style: n, contextClass: r }) {
834
+ let i = n ? ` style="${P(n)}"` : "", a = r ? ` ${P(r)}` : "";
835
+ return `<tr${r ? ` class="${P(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${Bt(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>`;
836
836
  }
837
- function Ht({ content: e, style: t, contextClass: n }) {
838
- let r = t ? ` style="${I(t)}"` : "", i = n ? ` ${I(n)}` : "";
839
- return `<tr${n ? ` class="${I(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>`;
837
+ function Wt({ content: e, style: t, contextClass: n }) {
838
+ let r = t ? ` style="${P(t)}"` : "", i = n ? ` ${P(n)}` : "";
839
+ return `<tr${n ? ` class="${P(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>`;
840
840
  }
841
- function Ut(e, t) {
841
+ function Gt(e, t) {
842
842
  return e(t).attr("data:pastille") ?? e(t).attr("pastille");
843
843
  }
844
- function Wt(e, t) {
844
+ function Kt(e, t) {
845
845
  return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
846
846
  }
847
- function Gt(e, t) {
848
- return e(t).children().get().filter((e) => F(e) ? L(e) === "content" : !1).map((t) => R(e, t)).filter(Boolean).join("\n");
847
+ function qt(e, t) {
848
+ return e(t).children().get().filter((e) => N(e) ? F(e) === "content" : !1).map((t) => I(e, t)).filter(Boolean).join("\n");
849
849
  }
850
- function Kt(e, t) {
850
+ function Jt(e, t) {
851
851
  let n = [];
852
852
  return e(t).children().each((t, r) => {
853
- if (!F(r)) return;
854
- let i = L(r);
855
- i === "num" || i === "heading" || i === "content" || n.push(R(e, r));
853
+ if (!N(r)) return;
854
+ let i = F(r);
855
+ i === "num" || i === "heading" || i === "content" || n.push(I(e, r));
856
856
  }), n.filter(Boolean);
857
857
  }
858
- function qt(e, t) {
859
- let n = [], r = L(t), i = r === "alinea" ? Ut(e, t) : void 0, a = Gt(e, t), o = Jt(e, t, r, i), s = en(e, t);
858
+ function Yt(e, t) {
859
+ let n = [], r = F(t), i = r === "alinea" ? Gt(e, t) : void 0, a = qt(e, t), o = Xt(e, t, r, i), s = nn(e, t);
860
860
  if (i) {
861
- let r = [Lt(a, N(e(t).children("num").first().text())) ? "" : It(e, t), a].filter(Boolean).join("\n");
862
- N(r) && n.push(Vt({
861
+ let r = [zt(a, j(e(t).children("num").first().text())) ? "" : Rt(e, t), a].filter(Boolean).join("\n");
862
+ j(r) && n.push(Ut({
863
863
  content: r,
864
864
  pastille: i,
865
865
  style: o,
866
866
  contextClass: s
867
867
  }));
868
- } else a && n.push(Ht({
868
+ } else a && n.push(Wt({
869
869
  content: a,
870
870
  style: o,
871
871
  contextClass: s
872
872
  }));
873
873
  for (let r of e(t).children().get()) {
874
- if (!F(r)) continue;
875
- let t = L(r);
876
- t === "num" || t === "heading" || t === "content" || (t === "alinea" || Wt(e, r)) && n.push(...qt(e, r));
874
+ if (!N(r)) continue;
875
+ let t = F(r);
876
+ t === "num" || t === "heading" || t === "content" || (t === "alinea" || Kt(e, r)) && n.push(...Yt(e, r));
877
877
  }
878
878
  return n;
879
879
  }
880
- function B(e, t, n, r) {
881
- let i = L(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = Ut(e, t), s = Jt(e, t, i, o), c = [`<${n} ${[
882
- a ? `id="${I(a)}"` : void 0,
880
+ function R(e, t, n, r) {
881
+ let i = F(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = Gt(e, t), s = Xt(e, t, i, o), c = [`<${n} ${[
882
+ a ? `id="${P(a)}"` : void 0,
883
883
  `class="${r}"`,
884
- o ? `data-pastille="${I(o)}"` : void 0,
885
- s ? `style="${I(s)}"` : void 0
884
+ o ? `data-pastille="${P(o)}"` : void 0,
885
+ s ? `style="${P(s)}"` : void 0
886
886
  ].filter((e) => e !== void 0).join(" ")}>`];
887
887
  if (i === "part" || i === "title") {
888
- let r = Zt(e, t, i), a = $t(e, t), o = r ? [Ht({
888
+ let r = $t(e, t, i), a = tn(e, t), o = r ? [Wt({
889
889
  content: r,
890
890
  contextClass: a
891
891
  })] : [], s = () => {
892
- o.length !== 0 && (c.push(Xt(o)), o = []);
892
+ o.length !== 0 && (c.push(Qt(o)), o = []);
893
893
  };
894
894
  return e(t).children().each((t, n) => {
895
- if (!F(n)) return;
896
- let r = L(n);
895
+ if (!N(n)) return;
896
+ let r = F(n);
897
897
  if (!(r === "num" || r === "heading" || r === "content")) {
898
898
  if (r === "alinea") {
899
- o.push(...qt(e, n));
899
+ o.push(...Yt(e, n));
900
900
  return;
901
901
  }
902
- s(), c.push(R(e, n));
902
+ s(), c.push(I(e, n));
903
903
  }
904
904
  }), s(), c.push(`</${n}>`), c.join("\n");
905
905
  }
906
906
  if (i === "article") {
907
- let r = N(e(t).children("num").first().text()), i = N(e(t).children("heading").first().text()), a = v(r) ?? {
907
+ let r = j(e(t).children("num").first().text()), i = j(e(t).children("heading").first().text()), a = S(r) ?? {
908
908
  label: r,
909
909
  num: r
910
- }, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${I(`_TocArt${(a.num ?? r).replace(/\s+/gu, "")}`)}">${I(a.label)}${i ? ` : ${I(i)}` : ""}</p>`;
911
- if (Wt(e, t)) {
912
- let r = [Ht({
910
+ }, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${P(`_TocArt${(a.num ?? r).replace(/\s+/gu, "")}`)}">${P(a.label)}${i ? ` : ${P(i)}` : ""}</p>`;
911
+ if (Kt(e, t)) {
912
+ let r = [Wt({
913
913
  content: o,
914
- contextClass: nn(a.label)
915
- }), ...qt(e, t)];
916
- c.push(Bt(r));
917
- for (let n of Kt(e, t)) n.includes("akn-pastille-table") || c.push(n);
914
+ contextClass: an(a.label)
915
+ }), ...Yt(e, t)];
916
+ c.push(Ht(r));
917
+ for (let n of Jt(e, t)) n.includes("akn-pastille-table") || c.push(n);
918
918
  return c.push(`</${n}>`), c.join("\n");
919
919
  }
920
920
  c.push(o);
921
921
  }
922
922
  let l = [];
923
923
  for (let n of ["content", "children"]) e(t).children().each((t, r) => {
924
- if (!F(r)) return;
925
- let i = L(r);
926
- i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(R(e, r));
924
+ if (!N(r)) return;
925
+ let i = F(r);
926
+ i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(I(e, r));
927
927
  });
928
928
  let u = l.join("\n");
929
929
  if (i !== "article") {
930
- let n = Lt(u, N(e(t).children("num").first().text())) ? "" : It(e, t);
930
+ let n = zt(u, j(e(t).children("num").first().text())) ? "" : Rt(e, t);
931
931
  n && c.push(n);
932
932
  }
933
- return c.push(o ? zt(u, o) : u), c.push(`</${n}>`), c.join("\n");
933
+ return c.push(o ? Vt(u, o) : u), c.push(`</${n}>`), c.join("\n");
934
934
  }
935
- function Jt(e, t, n, r) {
936
- let i = Yt(e(t).attr("style") ?? "", "font-family");
937
- return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = Ft(i, "text-align", "center")), i || void 0;
935
+ function Xt(e, t, n, r) {
936
+ let i = Zt(e(t).attr("style") ?? "", "font-family");
937
+ return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = Lt(i, "text-align", "center")), i || void 0;
938
938
  }
939
- function Yt(e, t) {
939
+ function Zt(e, t) {
940
940
  return e.split(";").map((e) => e.trim()).filter(Boolean).filter((e) => !e.toLowerCase().startsWith(`${t.toLowerCase()}:`)).join(";");
941
941
  }
942
- function Xt(e) {
942
+ function Qt(e) {
943
943
  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>`;
944
944
  }
945
- function Zt(e, t, n) {
946
- let r = N(e(t).children("num").first().text()), i = N(e(t).children("heading").first().text()), a = Qt(n), o = [];
947
- return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${I(r)}</span></p>`), i && o.push(`<p class="${a.heading} as-text dispositif"><span aria-label="">${I(i)}</span></p>`), o.join("\n");
945
+ function $t(e, t, n) {
946
+ let r = j(e(t).children("num").first().text()), i = j(e(t).children("heading").first().text()), a = en(n), o = [];
947
+ return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${P(r)}</span></p>`), i && o.push(`<p class="${a.heading} as-text dispositif"><span aria-label="">${P(i)}</span></p>`), o.join("\n");
948
948
  }
949
- function Qt(e) {
949
+ function en(e) {
950
950
  switch (e) {
951
951
  case "part": return {
952
952
  num: "TCNumPartie",
@@ -970,22 +970,22 @@ function Qt(e) {
970
970
  };
971
971
  }
972
972
  }
973
- function $t(e, t) {
974
- let n = tn(N(e(t).children("num").first().text()));
973
+ function tn(e, t) {
974
+ let n = rn(j(e(t).children("num").first().text()));
975
975
  if (n) return n;
976
976
  for (let n of e(t).parents().get()) {
977
- if (!F(n)) continue;
978
- let t = L(n);
977
+ if (!N(n)) continue;
978
+ let t = F(n);
979
979
  if (t !== "title" && t !== "part") continue;
980
- let r = tn(N(e(n).children("num").first().text()));
980
+ let r = rn(j(e(n).children("num").first().text()));
981
981
  if (r) return r;
982
982
  }
983
983
  }
984
- function en(e, t) {
985
- return $t(e, t);
984
+ function nn(e, t) {
985
+ return tn(e, t);
986
986
  }
987
- function tn(e) {
988
- let [t, ...n] = N(e).split(/\s+/u);
987
+ function rn(e) {
988
+ let [t, ...n] = j(e).split(/\s+/u);
989
989
  if (!t || n.length === 0) return;
990
990
  let r = t.toLocaleLowerCase("fr-FR");
991
991
  if ([
@@ -995,10 +995,10 @@ function tn(e) {
995
995
  "section"
996
996
  ].includes(r)) return `${r}-${n.join("_")}`;
997
997
  }
998
- function nn(e) {
999
- return `article-${N(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
998
+ function an(e) {
999
+ return `article-${j(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
1000
1000
  }
1001
- function rn(e) {
1001
+ function on(e) {
1002
1002
  switch (e) {
1003
1003
  case "part": return "partie";
1004
1004
  case "book": return "livre";
@@ -1010,11 +1010,11 @@ function rn(e) {
1010
1010
  default: return;
1011
1011
  }
1012
1012
  }
1013
- function an(e, t) {
1014
- return [N(e(t).children("num").first().text()), N(e(t).children("heading").first().text())].filter(Boolean).join(" ");
1013
+ function sn(e, t) {
1014
+ return [j(e(t).children("num").first().text()), j(e(t).children("heading").first().text())].filter(Boolean).join(" ");
1015
1015
  }
1016
- function on(e, t) {
1017
- let n = N(e(t).children("num").first().text()), r = N(e(t).children("heading").first().text()), i = v(n) ?? {
1016
+ function cn(e, t) {
1017
+ let n = j(e(t).children("num").first().text()), r = j(e(t).children("heading").first().text()), i = S(n) ?? {
1018
1018
  label: n,
1019
1019
  num: n
1020
1020
  };
@@ -1024,24 +1024,24 @@ function on(e, t) {
1024
1024
  type: "article"
1025
1025
  };
1026
1026
  }
1027
- function sn(e, t) {
1027
+ function ln(e, t) {
1028
1028
  e.items.push(...t.items);
1029
1029
  }
1030
- function cn(e, t) {
1030
+ function un(e, t) {
1031
1031
  let n = { items: [] };
1032
1032
  return e(t).children().each((t, r) => {
1033
- if (!F(r)) return;
1034
- let i = L(r);
1033
+ if (!N(r)) return;
1034
+ let i = F(r);
1035
1035
  if (i === "article") {
1036
- n.items.push(on(e, r));
1036
+ n.items.push(cn(e, r));
1037
1037
  return;
1038
1038
  }
1039
- let a = rn(i);
1039
+ let a = on(i);
1040
1040
  if (!a) {
1041
- sn(n, cn(e, r));
1041
+ ln(n, un(e, r));
1042
1042
  return;
1043
1043
  }
1044
- let o = an(e, r), s = cn(e, r);
1044
+ let o = sn(e, r), s = un(e, r);
1045
1045
  !o && s.items.length === 0 || n.items.push({
1046
1046
  ...s,
1047
1047
  id: e(r).attr("eId") ?? e(r).attr("GUID"),
@@ -1050,26 +1050,26 @@ function cn(e, t) {
1050
1050
  });
1051
1051
  }), n;
1052
1052
  }
1053
- function ln(e) {
1053
+ function dn(e) {
1054
1054
  let t = e("body").first().get(0);
1055
- return t === void 0 ? { items: [] } : cn(e, t);
1055
+ return t === void 0 ? { items: [] } : un(e, t);
1056
1056
  }
1057
- function un(e) {
1057
+ function fn(e) {
1058
1058
  return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
1059
1059
  }
1060
- function dn(e) {
1060
+ function pn(e) {
1061
1061
  let t = e("preamble").first(), n = e("body").first(), r = ["<div class=\"akn-bill\">"];
1062
- return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(jt(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
1063
- F(n) && r.push(L(n) === "article" ? B(e, n, "article", "akn-article") : R(e, n));
1062
+ return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(Nt(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
1063
+ N(n) && r.push(F(n) === "article" ? R(e, n, "article", "akn-article") : I(e, n));
1064
1064
  }), r.push("</section></div>"), r.join("\n");
1065
1065
  }
1066
- function fn(e) {
1067
- let t = u(e, { xml: {
1066
+ function mn(e) {
1067
+ let t = g(e, { xml: {
1068
1068
  decodeEntities: !1,
1069
1069
  lowerCaseTags: !1,
1070
1070
  lowerCaseAttributeNames: !1,
1071
1071
  xmlMode: !0
1072
- } }), n = un(t), r = dn(t);
1072
+ } }), n = fn(t), r = pn(t);
1073
1073
  return {
1074
1074
  sourceFormat: "akoma-ntoso",
1075
1075
  documentDate: n,
@@ -1077,68 +1077,68 @@ function fn(e) {
1077
1077
  linkedHtml: r
1078
1078
  };
1079
1079
  }
1080
- function pn(e) {
1081
- return mn(u(e));
1080
+ function hn(e) {
1081
+ return gn(g(e));
1082
1082
  }
1083
- function mn(e) {
1083
+ function gn(e) {
1084
1084
  let t = [];
1085
1085
  return e("article.akn-article").each((n, r) => {
1086
- let i = e(r).children("p.TCNumArticle").first().get(0), a = N(i ? e(i).text() : ""), o = v(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = ot(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
1086
+ let i = e(r).children("p.TCNumArticle").first().get(0), a = j(i ? e(i).text() : ""), o = S(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = ct(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
1087
1087
  t.push({
1088
1088
  id: s,
1089
1089
  label: o.label,
1090
1090
  num: o.num,
1091
1091
  title: o.title,
1092
- text: Ge(e, c),
1093
- html: Ve(e, r),
1092
+ text: qe(e, c),
1093
+ html: Ue(e, r),
1094
1094
  directiveText: u,
1095
1095
  blocks: l
1096
1096
  });
1097
1097
  }), t;
1098
1098
  }
1099
- function hn(e) {
1100
- let t = u(e);
1099
+ function _n(e) {
1100
+ let t = g(e);
1101
1101
  return {
1102
- articles: mn(t),
1102
+ articles: gn(t),
1103
1103
  htmlWithLinks: t.html()
1104
1104
  };
1105
1105
  }
1106
- async function gn(e, t) {
1107
- let n = new me("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => u(e, { xml: {
1106
+ async function vn(e, t) {
1107
+ let n = new he("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => g(e, { xml: {
1108
1108
  decodeEntities: !1,
1109
1109
  lowerCaseTags: !1,
1110
1110
  lowerCaseAttributeNames: !1,
1111
1111
  xmlMode: !0
1112
- } })), i = t.date ?? un(r), a = n.timeSync("renderAknHtml", () => dn(r), { inputSize: e.length }), o = t.linkedHtml ?? await n.time("addLinksToRenderedAknHtml", () => qe(a, {
1112
+ } })), i = t.date ?? fn(r), a = n.timeSync("renderAknHtml", () => pn(r), { inputSize: e.length }), o = t.linkedHtml ?? await n.time("addLinksToRenderedAknHtml", () => Ye(a, {
1113
1113
  ...t,
1114
1114
  date: i
1115
- }, i)), s = n.timeSync("extractRenderedAknArticles", () => pn(a)), c = n.timeSync("injectHiddenArticleSummary", () => st(o, s)), { articles: l, htmlWithLinks: d } = n.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => hn(c)), f = l.length > 0 ? l : s, p = n.timeSync("extractAknTableOfContents", () => ln(r)), m = n.timeSync("buildParsedDocument", () => Ct("akoma-ntoso", a, l.length > 0 ? d : c, i, f, p, t.includeDirectiveAnalysis));
1115
+ }, i)), s = n.timeSync("extractRenderedAknArticles", () => hn(a)), c = n.timeSync("injectHiddenArticleSummary", () => lt(o, s)), { articles: l, htmlWithLinks: u } = n.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => _n(c)), d = l.length > 0 ? l : s, f = n.timeSync("extractAknTableOfContents", () => dn(r)), p = n.timeSync("buildParsedDocument", () => Tt("akoma-ntoso", a, l.length > 0 ? u : c, i, d, f, t.includeDirectiveAnalysis));
1116
1116
  return n.log({
1117
- articleCount: m.articles.length,
1118
- blockCount: m.articles.reduce((e, t) => e + t.blocks.length, 0),
1119
- directiveCount: m.directives.length,
1120
- targetDirectiveCount: m.directives.filter((e) => e.targetIds !== void 0).length
1121
- }), m;
1117
+ articleCount: p.articles.length,
1118
+ blockCount: p.articles.reduce((e, t) => e + t.blocks.length, 0),
1119
+ directiveCount: p.directives.length,
1120
+ targetDirectiveCount: p.directives.filter((e) => e.targetIds !== void 0).length
1121
+ }), p;
1122
1122
  }
1123
- async function _n(e, t) {
1124
- let n = fn(e), r = t.date ?? n.documentDate;
1123
+ async function yn(e, t) {
1124
+ let n = mn(e), r = t.date ?? n.documentDate;
1125
1125
  return {
1126
1126
  sourceFormat: "akoma-ntoso",
1127
1127
  documentDate: r,
1128
1128
  html: n.html,
1129
- linkedHtml: await qe(n.html, t, r)
1129
+ linkedHtml: await Ye(n.html, t, r)
1130
1130
  };
1131
1131
  }
1132
1132
  //#endregion
1133
1133
  //#region src/lib/server/assemblee_document_search.ts
1134
- var vn = /\bexpos[ée]\s+des\s+motifs\b/giu, yn = /\barticle\s+(?:premier|1er|\d+)/iu;
1135
- function bn(e) {
1134
+ var bn = /\bexpos[ée]\s+des\s+motifs\b/giu, xn = /\barticle\s+(?:premier|1er|\d+)/iu;
1135
+ function Sn(e) {
1136
1136
  return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
1137
1137
  }
1138
- function xn(e) {
1139
- let t = bn(u(e).text()), n = [...t.matchAll(vn)], r = /* @__PURE__ */ new Set(), i = [];
1138
+ function Cn(e) {
1139
+ let t = Sn(g(e).text()), n = [...t.matchAll(bn)], r = /* @__PURE__ */ new Set(), i = [];
1140
1140
  for (let [e, a] of n.entries()) {
1141
- let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = yn.exec(s), l = bn(s.slice(0, c?.index ?? s.length));
1141
+ let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = xn.exec(s), l = Sn(s.slice(0, c?.index ?? s.length));
1142
1142
  if (l.length < 20 || r.has(l)) continue;
1143
1143
  r.add(l);
1144
1144
  let u = `expose-des-motifs-${e + 1}`;
@@ -1154,8 +1154,8 @@ function xn(e) {
1154
1154
  }
1155
1155
  return i;
1156
1156
  }
1157
- async function Sn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
1158
- let i = await Dt(t, {
1157
+ async function wn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
1158
+ let i = await kt(t, {
1159
1159
  date: e,
1160
1160
  includeDirectiveAnalysis: !1,
1161
1161
  linkBaseUrl: n,
@@ -1164,7 +1164,7 @@ async function Sn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
1164
1164
  });
1165
1165
  return {
1166
1166
  items: [...i.articles.map((e) => {
1167
- let t = bn(e.directiveText || e.text);
1167
+ let t = Sn(e.directiveText || e.text);
1168
1168
  if (t) return {
1169
1169
  anchor: e.id,
1170
1170
  articleNumber: e.num ?? null,
@@ -1174,17 +1174,17 @@ async function Sn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
1174
1174
  label: e.label,
1175
1175
  title: e.title ?? null
1176
1176
  };
1177
- }).filter((e) => e !== void 0), ...xn(t)],
1177
+ }).filter((e) => e !== void 0), ...Cn(t)],
1178
1178
  tableOfContents: i.tableOfContents
1179
1179
  };
1180
1180
  }
1181
- function Cn(e, t) {
1182
- return k("sha256").update(JSON.stringify({
1181
+ function Tn(e, t) {
1182
+ return O("sha256").update(JSON.stringify({
1183
1183
  item: e,
1184
1184
  metadata: t
1185
1185
  })).digest("hex");
1186
1186
  }
1187
- function wn(e) {
1187
+ function En(e) {
1188
1188
  if (typeof e != "object" || !e) return;
1189
1189
  let t = e.cycleDeVie?.chrono;
1190
1190
  if (t !== void 0) for (let e of [
@@ -1199,11 +1199,11 @@ function wn(e) {
1199
1199
  }
1200
1200
  //#endregion
1201
1201
  //#region src/lib/server/senat_amendment_search.ts
1202
- function Tn(e) {
1203
- return e?.trim() ? u(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
1202
+ function Dn(e) {
1203
+ return e?.trim() ? g(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
1204
1204
  }
1205
- function En({ dispositifHtml: e, objetHtml: t }) {
1206
- let n = Tn(e), r = Tn(t);
1205
+ function On({ dispositifHtml: e, objetHtml: t }) {
1206
+ let n = Dn(e), r = Dn(t);
1207
1207
  return [...n ? [{
1208
1208
  content: n,
1209
1209
  itemKind: "dispositif",
@@ -1214,31 +1214,31 @@ function En({ dispositifHtml: e, objetHtml: t }) {
1214
1214
  label: "Objet"
1215
1215
  }] : []];
1216
1216
  }
1217
- function Dn(e, t) {
1218
- return k("sha256").update(JSON.stringify({
1217
+ function kn(e, t) {
1218
+ return O("sha256").update(JSON.stringify({
1219
1219
  item: e,
1220
1220
  metadata: t
1221
1221
  })).digest("hex");
1222
1222
  }
1223
1223
  //#endregion
1224
1224
  //#region src/lib/text_parsers/amendment_action_directives.ts
1225
- function V(e, t) {
1225
+ function z(e, t) {
1226
1226
  return {
1227
1227
  ...t,
1228
1228
  position: e.position(),
1229
1229
  type: "amendment_action_directive"
1230
1230
  };
1231
1231
  }
1232
- function On(e, t) {
1232
+ function An(e, t) {
1233
1233
  return {
1234
1234
  type: e === "start" ? "head_of_target" : "tail_after_target",
1235
1235
  unit: t ? se(t) : "article"
1236
1236
  };
1237
1237
  }
1238
- function kn(e) {
1238
+ function jn(e) {
1239
1239
  return e === "start" ? "insert_before" : "insert_after";
1240
1240
  }
1241
- var An = D(E("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), H = O(_, w([E("les?\\s+", { flags: "i" }), ie], { value: (e) => e[1] }), ie, a), jn = O(w([E("la\\s+fin\\s+de\\s+", { flags: "i" }), H], { value: (e) => {
1241
+ var Mn = E(T("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), B = D(ee, C([T("les?\\s+", { flags: "i" }), n], { value: (e) => e[1] }), n, o), Nn = D(C([T("la\\s+fin\\s+de\\s+", { flags: "i" }), B], { value: (e) => {
1242
1242
  let t = e[1];
1243
1243
  return {
1244
1244
  targetReference: t,
@@ -1247,200 +1247,200 @@ var An = D(E("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]
1247
1247
  unit: se(t)
1248
1248
  }
1249
1249
  };
1250
- } }), w([x], { value: (e) => ({ targetScope: e[0] }) })), U = D(w([
1251
- D(E("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
1252
- D(E("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
1253
- H,
1254
- D(E("\\s*,?\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*)?", { flags: "i" }), { default: "" })
1250
+ } }), C([x], { value: (e) => ({ targetScope: e[0] }) })), V = E(C([
1251
+ E(T("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
1252
+ E(T("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
1253
+ B,
1254
+ E(T("\\s*,?\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*)?", { flags: "i" }), { default: "" })
1255
1255
  ], { value: (e, t) => ({
1256
1256
  reference: e[2],
1257
1257
  text: t.text()
1258
- }) }), { default: null }), Mn = D(E(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${ge})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
1259
- function W(e) {
1258
+ }) }), { default: null }), Pn = E(T(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${_e})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
1259
+ function H(e) {
1260
1260
  return e?.text ?? "";
1261
1261
  }
1262
- function G(e) {
1263
- return { citation: l(e.position()) };
1262
+ function U(e) {
1263
+ return { citation: a(e.position()) };
1264
1264
  }
1265
- var K = O(w([S], { value: (e) => ({ citation: e[0] }) }), E("\\S[\\s\\S]*", { value: (e, t) => G(t) })), Nn = E("\\S[\\s\\S]*", { value: (e, t) => G(t) }), q = E("[^:«“\"]*(?::\\s*)?", { flags: "i" }), Pn = E("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
1265
+ var W = D(C([u], { value: (e) => ({ citation: e[0] }) }), T("\\S[\\s\\S]*", { value: (e, t) => U(t) })), Fn = T("\\S[\\s\\S]*", { value: (e, t) => U(t) }), G = T("[^:«“\"]*(?::\\s*)?", { flags: "i" }), In = T("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
1266
1266
  flags: "i",
1267
- value: (e, t) => G(t)
1268
- }), Fn = E("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
1267
+ value: (e, t) => U(t)
1268
+ }), Ln = T("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
1269
1269
  flags: "i",
1270
- value: (e, t) => G(t)
1271
- }), In = E("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
1270
+ value: (e, t) => U(t)
1271
+ }), Rn = T("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
1272
1272
  flags: "i",
1273
- value: (e, t) => G(t)
1274
- }), Ln = O(w([S], { value: (e) => ({ citation: e[0] }) }), Pn), Rn = O(w([S], { value: (e) => ({ citation: e[0] }) }), In), zn = w([E(`${o}s?\\s*:?\\s*`, { flags: "i" }), Ln], { value: (e) => e[1] }), Bn = w([E(`${oe}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), Rn], { value: (e) => e[1] }), Vn = O(w([S], { value: (e) => ({ citation: e[0] }) }), Fn), Hn = w([
1275
- Mn,
1276
- E(`${o}s?\\s*:?\\s*`, { flags: "i" }),
1277
- Vn
1278
- ], { value: (e) => e[2] }), Un = w([
1279
- Mn,
1280
- E(`${o}s?\\s*:?\\s*`, { flags: "i" }),
1281
- O(w([S], { value: (e) => ({ citation: e[0] }) }), Nn)
1273
+ value: (e, t) => U(t)
1274
+ }), zn = D(C([u], { value: (e) => ({ citation: e[0] }) }), In), Bn = D(C([u], { value: (e) => ({ citation: e[0] }) }), Rn), Vn = C([T(`${c}s?\\s*:?\\s*`, { flags: "i" }), zn], { value: (e) => e[1] }), Hn = C([T(`${oe}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), Bn], { value: (e) => e[1] }), Un = D(C([u], { value: (e) => ({ citation: e[0] }) }), Ln), Wn = C([
1275
+ Pn,
1276
+ T(`${c}s?\\s*:?\\s*`, { flags: "i" }),
1277
+ Un
1278
+ ], { value: (e) => e[2] }), Gn = C([
1279
+ Pn,
1280
+ T(`${c}s?\\s*:?\\s*`, { flags: "i" }),
1281
+ D(C([u], { value: (e) => ({ citation: e[0] }) }), Fn)
1282
1282
  ], { value: (e) => e[2] });
1283
- function J(e) {
1283
+ function K(e) {
1284
1284
  return e?.reference;
1285
1285
  }
1286
- var Wn = w([An, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => V(t, {
1286
+ var Kn = C([Mn, T("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => z(t, {
1287
1287
  contextText: e[0],
1288
1288
  kind: "delete_article"
1289
- }) }), Gn = w([
1290
- U,
1291
- E("supprimer", { flags: "i" }),
1292
- D(w([T, H], { value: (e) => e[1] }), { default: null }),
1293
- D(w([T, Un], { value: (e) => e[1] }), { default: null })
1294
- ], { value: (e, t) => V(t, {
1295
- contextText: W(e[0]),
1289
+ }) }), qn = C([
1290
+ V,
1291
+ T("supprimer", { flags: "i" }),
1292
+ E(C([w, B], { value: (e) => e[1] }), { default: null }),
1293
+ E(C([w, Gn], { value: (e) => e[1] }), { default: null })
1294
+ ], { value: (e, t) => z(t, {
1295
+ contextText: H(e[0]),
1296
1296
  kind: "delete_portion",
1297
1297
  targetCitation: e[3]?.citation ?? void 0,
1298
- targetReference: e[2] ?? J(e[0])
1299
- }) }), Kn = w([
1300
- U,
1301
- O(E("r[eé]diger\\s+ainsi", { flags: "i" }), E("r[eé]tablir", { flags: "i" })),
1302
- q,
1303
- K
1304
- ], { value: (e, t) => V(t, {
1305
- contextText: W(e[0]),
1298
+ targetReference: e[2] ?? K(e[0])
1299
+ }) }), Jn = C([
1300
+ V,
1301
+ D(T("r[eé]diger\\s+ainsi", { flags: "i" }), T("r[eé]tablir", { flags: "i" })),
1302
+ G,
1303
+ W
1304
+ ], { value: (e, t) => z(t, {
1305
+ contextText: H(e[0]),
1306
1306
  kind: "rewrite_portion",
1307
1307
  replacementCitation: e[3].citation,
1308
- targetReference: J(e[0])
1309
- }) }), qn = w([
1310
- U,
1311
- O(E("substituer", { flags: "i" }), E("remplacer", { flags: "i" })),
1312
- T,
1313
- Mn,
1314
- zn,
1315
- E("\\s*,?\\s*"),
1316
- D(E("par\\s+", { flags: "i" }), { default: "" }),
1317
- Bn
1318
- ], { value: (e, t) => V(t, {
1319
- contextText: W(e[0]),
1308
+ targetReference: K(e[0])
1309
+ }) }), Yn = C([
1310
+ V,
1311
+ D(T("substituer", { flags: "i" }), T("remplacer", { flags: "i" })),
1312
+ w,
1313
+ Pn,
1314
+ Vn,
1315
+ T("\\s*,?\\s*"),
1316
+ E(T("par\\s+", { flags: "i" }), { default: "" }),
1317
+ Hn
1318
+ ], { value: (e, t) => z(t, {
1319
+ contextText: H(e[0]),
1320
1320
  kind: "replace",
1321
1321
  replacementCitation: e[7].citation,
1322
1322
  targetCitation: e[4].citation,
1323
- targetReference: J(e[0])
1324
- }) }), Jn = w([
1325
- U,
1326
- E("substituer", { flags: "i" }),
1327
- T,
1328
- D(E("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
1329
- H,
1330
- E("[\\s\\S]*?(?=[«“\"]|$)"),
1331
- K
1332
- ], { value: (e, t) => V(t, {
1333
- contextText: W(e[0]),
1323
+ targetReference: K(e[0])
1324
+ }) }), Xn = C([
1325
+ V,
1326
+ T("substituer", { flags: "i" }),
1327
+ w,
1328
+ E(T("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
1329
+ B,
1330
+ T("[\\s\\S]*?(?=[«“\"]|$)"),
1331
+ W
1332
+ ], { value: (e, t) => z(t, {
1333
+ contextText: H(e[0]),
1334
1334
  kind: "rewrite_portion",
1335
1335
  replacementCitation: e[6].citation,
1336
- targetReference: e[4] ?? J(e[0])
1337
- }) }), Yn = w([
1338
- n,
1339
- T,
1340
- E("l['’ ]article", { flags: "i" }),
1341
- E("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
1342
- E("ins[eé]rer", { flags: "i" }),
1343
- q,
1344
- K
1345
- ], { value: (e, t) => V(t, {
1336
+ targetReference: e[4] ?? K(e[0])
1337
+ }) }), Zn = C([
1338
+ i,
1339
+ w,
1340
+ T("l['’ ]article", { flags: "i" }),
1341
+ T("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
1342
+ T("ins[eé]rer", { flags: "i" }),
1343
+ G,
1344
+ W
1345
+ ], { value: (e, t) => z(t, {
1346
1346
  contextText: "",
1347
1347
  insertCitation: e[6].citation,
1348
1348
  kind: e[0] === "before" ? "insert_article_before" : "insert_article_after"
1349
- }) }), Xn = w([
1350
- n,
1351
- T,
1352
- H,
1353
- E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
1354
- O(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
1355
- q,
1356
- K
1357
- ], { value: (e, t) => V(t, {
1349
+ }) }), Qn = C([
1350
+ i,
1351
+ w,
1352
+ B,
1353
+ T("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
1354
+ D(T("ins[eé]rer", { flags: "i" }), T("ajouter", { flags: "i" })),
1355
+ G,
1356
+ W
1357
+ ], { value: (e, t) => z(t, {
1358
1358
  contextText: "",
1359
1359
  insertCitation: e[6].citation,
1360
- kind: s(e[0]),
1360
+ kind: l(e[0]),
1361
1361
  targetReference: e[2]
1362
- }) }), Zn = w([
1363
- n,
1364
- T,
1365
- E("l['’ ]alin[eé]a", { flags: "i" }),
1366
- E("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
1367
- E("ins[eé]rer", { flags: "i" }),
1368
- q,
1369
- K
1370
- ], { value: (e, t) => V(t, {
1362
+ }) }), $n = C([
1363
+ i,
1364
+ w,
1365
+ T("l['’ ]alin[eé]a", { flags: "i" }),
1366
+ T("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
1367
+ T("ins[eé]rer", { flags: "i" }),
1368
+ G,
1369
+ W
1370
+ ], { value: (e, t) => z(t, {
1371
1371
  contextText: "",
1372
1372
  insertCitation: e[6].citation,
1373
- kind: s(e[0])
1374
- }) }), Qn = w([
1375
- U,
1373
+ kind: l(e[0])
1374
+ }) }), er = C([
1375
+ V,
1376
1376
  ae,
1377
- E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
1378
- O(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
1379
- q,
1380
- K
1377
+ T("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
1378
+ D(T("ins[eé]rer", { flags: "i" }), T("ajouter", { flags: "i" })),
1379
+ G,
1380
+ W
1381
1381
  ], { value: (e, t) => {
1382
- let n = e[0], r = J(n), i = e[1];
1383
- return V(t, {
1384
- contextText: W(n),
1382
+ let n = e[0], r = K(n), i = e[1];
1383
+ return z(t, {
1384
+ contextText: H(n),
1385
1385
  insertCitation: e[5].citation,
1386
- kind: kn(i),
1386
+ kind: jn(i),
1387
1387
  targetReference: r,
1388
- targetScope: On(i, r)
1388
+ targetScope: An(i, r)
1389
1389
  });
1390
- } }), $n = w([
1391
- U,
1392
- n,
1393
- T,
1394
- Hn,
1395
- E("[\\s\\S]*?(?=ins[eé]rer)"),
1396
- E("ins[eé]rer", { flags: "i" }),
1397
- T,
1398
- Bn
1399
- ], { value: (e, t) => V(t, {
1400
- contextText: W(e[0]),
1390
+ } }), tr = C([
1391
+ V,
1392
+ i,
1393
+ w,
1394
+ Wn,
1395
+ T("[\\s\\S]*?(?=ins[eé]rer)"),
1396
+ T("ins[eé]rer", { flags: "i" }),
1397
+ w,
1398
+ Hn
1399
+ ], { value: (e, t) => z(t, {
1400
+ contextText: H(e[0]),
1401
1401
  insertCitation: e[7].citation,
1402
- kind: s(e[1]),
1402
+ kind: l(e[1]),
1403
1403
  targetCitation: e[3].citation,
1404
- targetReference: J(e[0])
1405
- }) }), er = w([
1406
- U,
1407
- n,
1408
- T,
1409
- H,
1410
- E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
1411
- O(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
1412
- q,
1413
- K
1414
- ], { value: (e, t) => V(t, {
1415
- contextText: W(e[0]),
1404
+ targetReference: K(e[0])
1405
+ }) }), nr = C([
1406
+ V,
1407
+ i,
1408
+ w,
1409
+ B,
1410
+ T("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
1411
+ D(T("ins[eé]rer", { flags: "i" }), T("ajouter", { flags: "i" })),
1412
+ G,
1413
+ W
1414
+ ], { value: (e, t) => z(t, {
1415
+ contextText: H(e[0]),
1416
1416
  insertCitation: e[7].citation,
1417
- kind: s(e[1]),
1418
- targetReference: J(e[0]) ?? e[3]
1419
- }) }), tr = O(Qn, Yn, Xn, Zn, Jn, w([
1420
- U,
1421
- n,
1422
- T,
1423
- Hn,
1424
- E("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
1425
- O(w([
1426
- E("supprimer", {
1417
+ kind: l(e[1]),
1418
+ targetReference: K(e[0]) ?? e[3]
1419
+ }) }), rr = D(er, Zn, Qn, $n, Xn, C([
1420
+ V,
1421
+ i,
1422
+ w,
1423
+ Wn,
1424
+ T("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
1425
+ D(C([
1426
+ T("supprimer", {
1427
1427
  flags: "i",
1428
1428
  value: "delete_portion"
1429
1429
  }),
1430
- T,
1431
- jn
1430
+ w,
1431
+ Nn
1432
1432
  ], { value: (e) => ({
1433
1433
  kind: e[0],
1434
1434
  ...e[2]
1435
- }) }), w([
1436
- E("r[eé]diger\\s+ainsi", {
1435
+ }) }), C([
1436
+ T("r[eé]diger\\s+ainsi", {
1437
1437
  flags: "i",
1438
1438
  value: "rewrite_portion"
1439
1439
  }),
1440
- T,
1441
- jn,
1442
- q,
1443
- K
1440
+ w,
1441
+ Nn,
1442
+ G,
1443
+ W
1444
1444
  ], { value: (e) => ({
1445
1445
  kind: e[0],
1446
1446
  replacementCitation: e[4].citation,
@@ -1448,49 +1448,49 @@ var Wn = w([An, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
1448
1448
  }) }))
1449
1449
  ], { value: (e, t) => {
1450
1450
  let n = e[5];
1451
- return V(t, {
1452
- contextText: W(e[0]),
1451
+ return z(t, {
1452
+ contextText: H(e[0]),
1453
1453
  kind: n.kind,
1454
1454
  replacementCitation: n.replacementCitation,
1455
1455
  targetCitation: e[3].citation,
1456
- targetReference: J(e[0]) ?? n.targetReference,
1456
+ targetReference: K(e[0]) ?? n.targetReference,
1457
1457
  targetScope: n.targetScope
1458
1458
  });
1459
- } }), $n, er, w([
1460
- An,
1461
- E("ins[eé]rer", { flags: "i" }),
1462
- E(`[\\s\\S]*?(?=${t})`, { flags: "i" }),
1463
- n,
1464
- q,
1465
- S,
1466
- q,
1467
- S
1468
- ], { value: (e, t) => V(t, {
1459
+ } }), tr, nr, C([
1460
+ Mn,
1461
+ T("ins[eé]rer", { flags: "i" }),
1462
+ T(`[\\s\\S]*?(?=${r})`, { flags: "i" }),
1463
+ i,
1464
+ G,
1465
+ u,
1466
+ G,
1467
+ u
1468
+ ], { value: (e, t) => z(t, {
1469
1469
  contextText: e[0],
1470
1470
  insertCitation: e[8],
1471
- kind: s(e[3]),
1471
+ kind: l(e[3]),
1472
1472
  targetCitation: e[6]
1473
- }) }), qn, Kn, w([
1474
- U,
1475
- E("compl[eé]ter", { flags: "i" }),
1476
- D(w([T, H], { value: (e) => e[1] }), { default: null }),
1477
- q,
1478
- K
1479
- ], { value: (e, t) => V(t, {
1480
- contextText: W(e[0]),
1473
+ }) }), Yn, Jn, C([
1474
+ V,
1475
+ T("compl[eé]ter", { flags: "i" }),
1476
+ E(C([w, B], { value: (e) => e[1] }), { default: null }),
1477
+ G,
1478
+ W
1479
+ ], { value: (e, t) => z(t, {
1480
+ contextText: H(e[0]),
1481
1481
  insertCitation: e[4].citation,
1482
1482
  kind: "insert_after",
1483
- targetReference: e[2] ?? J(e[0])
1484
- }) }), Wn, Gn);
1483
+ targetReference: e[2] ?? K(e[0])
1484
+ }) }), Kn, qn);
1485
1485
  //#endregion
1486
1486
  //#region src/lib/server/parsed_amendments.ts
1487
- function nr(e) {
1487
+ function ir(e) {
1488
1488
  return e.replace(/\s+/gu, " ").trim();
1489
1489
  }
1490
- function rr(e) {
1491
- return e.split(/\n/gu).map(nr).filter(Boolean).join("\n");
1490
+ function ar(e) {
1491
+ return e.split(/\n/gu).map(ir).filter(Boolean).join("\n");
1492
1492
  }
1493
- function ir(e, t) {
1493
+ function or(e, t) {
1494
1494
  let { start: n, stop: r } = t;
1495
1495
  for (; n < r && /\s/u.test(e[n]);) n++;
1496
1496
  for (; r > n && /\s/u.test(e[r - 1]);) r--;
@@ -1499,16 +1499,16 @@ function ir(e, t) {
1499
1499
  stop: r
1500
1500
  } : null;
1501
1501
  }
1502
- function ar(e, t) {
1503
- return ue(pe(e), t);
1502
+ function sr(e, t) {
1503
+ return de(me(e), t);
1504
1504
  }
1505
- function or(e) {
1505
+ function cr(e) {
1506
1506
  return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
1507
1507
  }
1508
- function sr(e) {
1508
+ function lr(e) {
1509
1509
  return {
1510
1510
  articleLabel: e.targetArticleLabel ?? null,
1511
- targetPosition: or(e.targetPosition),
1511
+ targetPosition: cr(e.targetPosition),
1512
1512
  alinea: e.targetAlinea ?? null,
1513
1513
  alineaLabel: e.targetAlineaLabel ?? null,
1514
1514
  subdivisionSourceId: e.targetSubdivisionSourceId ?? null,
@@ -1516,75 +1516,75 @@ function sr(e) {
1516
1516
  subpos: e.targetSubpos ?? null
1517
1517
  };
1518
1518
  }
1519
- function Y(e) {
1519
+ function q(e) {
1520
1520
  return {
1521
1521
  ...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
1522
1522
  sourcePosition: e.position,
1523
1523
  sourceText: e.text
1524
1524
  };
1525
1525
  }
1526
- function cr(e) {
1526
+ function ur(e) {
1527
1527
  return {
1528
1528
  ...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
1529
1529
  sourcePosition: e.position,
1530
1530
  sourceText: e.text
1531
1531
  };
1532
1532
  }
1533
- function lr(e) {
1533
+ function dr(e) {
1534
1534
  return {
1535
1535
  ...e?.originalTransformation === void 0 ? {} : { dispositifOriginalTransformation: e.originalTransformation },
1536
1536
  ...e === null ? {} : { dispositifPosition: e.position },
1537
1537
  dispositifText: e?.text ?? null
1538
1538
  };
1539
1539
  }
1540
- function X(e, t, n, r = rr(e.slice(n.start, n.stop))) {
1540
+ function J(e, t, n, r = ar(e.slice(n.start, n.stop))) {
1541
1541
  return {
1542
- originalTransformation: ar(t, n),
1542
+ originalTransformation: sr(t, n),
1543
1543
  position: n,
1544
1544
  text: r
1545
1545
  };
1546
1546
  }
1547
- function ur(e) {
1547
+ function fr(e) {
1548
1548
  let t = e.dispositifHtml ?? e.dispositifText;
1549
1549
  if (!t) return null;
1550
- let n = e.dispositifHtml ? le()(t) : ce(t), r = n.output, i = ir(r, {
1550
+ let n = e.dispositifHtml ? ue()(t) : le(t), r = n.output, i = or(r, {
1551
1551
  start: 0,
1552
1552
  stop: r.length
1553
1553
  });
1554
1554
  return {
1555
- dispositif: i === null ? null : X(r, n, i),
1555
+ dispositif: i === null ? null : J(r, n, i),
1556
1556
  simplifiedText: r,
1557
1557
  transformation: n
1558
1558
  };
1559
1559
  }
1560
- function Z(e) {
1561
- if (!e) return [];
1562
- if (e.type === "enumeration") return [...Z(e.left), ...Z(e.right)];
1563
- if (e.type === "bounded-interval") {
1564
- let t = Z(e.first)[0], n = Z(e.last)[0];
1565
- return t !== void 0 && n !== void 0 && n >= t ? Array.from({ length: n - t + 1 }, (e, n) => t + n) : [t, n].filter((e) => e !== void 0);
1560
+ function Y(t) {
1561
+ if (!t) return [];
1562
+ if (t.type === "enumeration") return [...Y(t.left), ...Y(t.right)];
1563
+ if (t.type === "bounded-interval") {
1564
+ let e = Y(t.first)[0], n = Y(t.last)[0];
1565
+ return e !== void 0 && n !== void 0 && n >= e ? Array.from({ length: n - e + 1 }, (t, n) => e + n) : [e, n].filter((e) => e !== void 0);
1566
1566
  }
1567
- if (e.type === "counted-interval") {
1568
- let t = Z(e.first)[0];
1569
- return t === void 0 ? [] : Array.from({ length: e.count }, (e, n) => t + n);
1567
+ if (t.type === "counted-interval") {
1568
+ let e = Y(t.first)[0];
1569
+ return e === void 0 ? [] : Array.from({ length: t.count }, (t, n) => e + n);
1570
1570
  }
1571
- if (e.type === "exclusion") return Z(e.left);
1572
- for (let t of c(e)) if (t.type === "alinéa" && typeof t.index == "number" && t.index > 0) return [t.index];
1571
+ if (t.type === "exclusion") return Y(t.left);
1572
+ for (let n of e(t)) if (n.type === "alinéa" && typeof n.index == "number" && n.index > 0) return [n.index];
1573
1573
  return [];
1574
1574
  }
1575
- function dr(e, t) {
1576
- let n = Z(t);
1575
+ function pr(e, t) {
1576
+ let n = Y(t);
1577
1577
  return {
1578
1578
  ...e,
1579
1579
  alinea: n[0] ?? e.alinea ?? null,
1580
1580
  ...n.length > 0 ? { alineas: n } : {}
1581
1581
  };
1582
1582
  }
1583
- function fr(e) {
1583
+ function mr(e) {
1584
1584
  return e.replace(/^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*/iu, "").replace(/^\s*(?:\d+°|[a-z]\))\s*/iu, "").trim();
1585
1585
  }
1586
- function pr(e, t) {
1587
- let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(fr(t.text));
1586
+ function hr(e, t) {
1587
+ let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(mr(t.text));
1588
1588
  if (!n) return null;
1589
1589
  let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10);
1590
1590
  return !Number.isFinite(r) || r < 1 ? null : {
@@ -1593,25 +1593,25 @@ function pr(e, t) {
1593
1593
  alineas: [r]
1594
1594
  };
1595
1595
  }
1596
- function mr(e, t) {
1596
+ function gr(e, t) {
1597
1597
  if (e) return e.unit === "article" && t.alinea !== null ? {
1598
1598
  ...e,
1599
1599
  unit: "alinéa"
1600
1600
  } : e;
1601
1601
  }
1602
- function hr(e) {
1603
- return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(fr(e.text));
1602
+ function _r(e) {
1603
+ return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(mr(e.text));
1604
1604
  }
1605
- function gr(e, t, n, r) {
1606
- return X(e, t, {
1605
+ function vr(e, t, n, r) {
1606
+ return J(e, t, {
1607
1607
  start: n.position.start,
1608
1608
  stop: r.position.stop
1609
1609
  });
1610
1610
  }
1611
- function _r(e) {
1611
+ function yr(e) {
1612
1612
  return /^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*(?!alin[eé]a\b)/iu.test(e.text);
1613
1613
  }
1614
- function vr(e, t) {
1614
+ function br(e, t) {
1615
1615
  let n = { ...t.position };
1616
1616
  function r(t) {
1617
1617
  let r = t.exec(e.slice(n.start, n.stop));
@@ -1620,39 +1620,39 @@ function vr(e, t) {
1620
1620
  stop: n.stop
1621
1621
  });
1622
1622
  }
1623
- 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), ir(e, n);
1623
+ 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), or(e, n);
1624
1624
  }
1625
- function yr(e) {
1625
+ function xr(e) {
1626
1626
  return d(e);
1627
1627
  }
1628
- function br(e, t) {
1629
- return tr(new C(e.slice(0, t.stop), t.start)) ?? null;
1628
+ function Sr(e, t) {
1629
+ return rr(new ce(e.slice(0, t.stop), t.start)) ?? null;
1630
1630
  }
1631
- function Q(e, t, n) {
1632
- if (n) return X(e, t, n.position, rr(i(e, n)));
1631
+ function X(e, t, n) {
1632
+ if (n) return J(e, t, n.position, ar(ne(e, n)));
1633
1633
  }
1634
- function xr(e, t) {
1634
+ function Cr(e, t) {
1635
1635
  if (!e) return;
1636
1636
  let n = structuredClone(e);
1637
- for (let e of r(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = ar(t, e.position));
1637
+ for (let e of te(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = sr(t, e.position));
1638
1638
  return n;
1639
1639
  }
1640
- function Sr(e, t, n, r) {
1641
- let i = vr(e, n);
1640
+ function wr(e, t, n, r) {
1641
+ let i = br(e, n);
1642
1642
  if (!i) return null;
1643
- let a = br(e, i);
1643
+ let a = Sr(e, i);
1644
1644
  if (!a) return null;
1645
- let o = X(e, t, i), s = xr(a.targetReference, t), c = dr(r, s), l = yr(o.text);
1645
+ let o = J(e, t, i), s = Cr(a.targetReference, t), c = pr(r, s), l = xr(o.text);
1646
1646
  if (a.kind === "delete_article") return {
1647
1647
  kind: "delete_article",
1648
- ...Y(o),
1648
+ ...q(o),
1649
1649
  target: c
1650
1650
  };
1651
1651
  if (a.kind === "delete_portion") {
1652
- let n = Q(e, t, a.targetCitation);
1652
+ let n = X(e, t, a.targetCitation);
1653
1653
  return {
1654
1654
  kind: "delete_portion",
1655
- ...Y(o),
1655
+ ...q(o),
1656
1656
  target: c,
1657
1657
  ...n === void 0 ? {} : {
1658
1658
  targetCitation: n,
@@ -1660,16 +1660,16 @@ function Sr(e, t, n, r) {
1660
1660
  },
1661
1661
  targetOccurrence: l,
1662
1662
  targetReference: s,
1663
- targetScope: mr(a.targetScope, c)
1663
+ targetScope: gr(a.targetScope, c)
1664
1664
  };
1665
1665
  }
1666
1666
  if (a.kind === "rewrite_portion") {
1667
- let n = Q(e, t, a.replacementCitation);
1667
+ let n = X(e, t, a.replacementCitation);
1668
1668
  if (!n) return null;
1669
- let r = Q(e, t, a.targetCitation);
1669
+ let r = X(e, t, a.targetCitation);
1670
1670
  return {
1671
1671
  kind: "rewrite_portion",
1672
- ...Y(o),
1672
+ ...q(o),
1673
1673
  target: c,
1674
1674
  ...r === void 0 ? {} : {
1675
1675
  targetCitation: r,
@@ -1677,16 +1677,16 @@ function Sr(e, t, n, r) {
1677
1677
  },
1678
1678
  targetOccurrence: l,
1679
1679
  targetReference: s,
1680
- targetScope: mr(a.targetScope, c),
1680
+ targetScope: gr(a.targetScope, c),
1681
1681
  replacementCitation: n,
1682
1682
  replacementText: n.text
1683
1683
  };
1684
1684
  }
1685
1685
  if (a.kind === "replace") {
1686
- let n = Q(e, t, a.replacementCitation), r = Q(e, t, a.targetCitation);
1686
+ let n = X(e, t, a.replacementCitation), r = X(e, t, a.targetCitation);
1687
1687
  return !n || !r ? null : {
1688
1688
  kind: "replace",
1689
- ...Y(o),
1689
+ ...q(o),
1690
1690
  target: c,
1691
1691
  targetCitation: r,
1692
1692
  targetText: r.text,
@@ -1697,32 +1697,32 @@ function Sr(e, t, n, r) {
1697
1697
  };
1698
1698
  }
1699
1699
  if (a.kind === "insert_article_after") {
1700
- let n = Q(e, t, a.insertCitation);
1700
+ let n = X(e, t, a.insertCitation);
1701
1701
  return n ? {
1702
1702
  kind: "insert_article_after",
1703
- ...Y(o),
1703
+ ...q(o),
1704
1704
  target: c,
1705
1705
  insertCitation: n,
1706
1706
  insertText: n.text
1707
1707
  } : null;
1708
1708
  }
1709
1709
  if (a.kind === "insert_article_before") {
1710
- let n = Q(e, t, a.insertCitation);
1710
+ let n = X(e, t, a.insertCitation);
1711
1711
  return n ? {
1712
1712
  kind: "insert_article_before",
1713
- ...Y(o),
1713
+ ...q(o),
1714
1714
  target: c,
1715
1715
  insertCitation: n,
1716
1716
  insertText: n.text
1717
1717
  } : null;
1718
1718
  }
1719
1719
  if (a.kind === "insert_after" || a.kind === "insert_before") {
1720
- let n = Q(e, t, a.insertCitation);
1720
+ let n = X(e, t, a.insertCitation);
1721
1721
  if (!n) return null;
1722
- let r = Q(e, t, a.targetCitation);
1722
+ let r = X(e, t, a.targetCitation);
1723
1723
  return {
1724
1724
  kind: a.kind,
1725
- ...Y(o),
1725
+ ...q(o),
1726
1726
  target: c,
1727
1727
  ...r === void 0 ? {} : {
1728
1728
  targetCitation: r,
@@ -1732,19 +1732,19 @@ function Sr(e, t, n, r) {
1732
1732
  targetReference: s,
1733
1733
  insertCitation: n,
1734
1734
  insertText: n.text,
1735
- targetScope: mr(a.targetScope, c)
1735
+ targetScope: gr(a.targetScope, c)
1736
1736
  };
1737
1737
  }
1738
1738
  return null;
1739
1739
  }
1740
- function Cr(e, t) {
1740
+ function Tr(e, t) {
1741
1741
  let n = [], r = 0, i = 0;
1742
1742
  function a(r) {
1743
- let a = ir(e, {
1743
+ let a = or(e, {
1744
1744
  start: i,
1745
1745
  stop: r
1746
1746
  });
1747
- a !== null && n.push(X(e, t, a));
1747
+ a !== null && n.push(J(e, t, a));
1748
1748
  }
1749
1749
  function o(t) {
1750
1750
  let n = Math.max(e.lastIndexOf("\n", t - 1), e.lastIndexOf("\r", t - 1));
@@ -1762,7 +1762,7 @@ function Cr(e, t) {
1762
1762
  continue;
1763
1763
  }
1764
1764
  if (r > 0) continue;
1765
- 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) && hr({
1765
+ 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({
1766
1766
  originalTransformation: void 0,
1767
1767
  position: {
1768
1768
  start: i,
@@ -1774,8 +1774,8 @@ function Cr(e, t) {
1774
1774
  }
1775
1775
  return a(e.length), n;
1776
1776
  }
1777
- function wr(e) {
1778
- let t = ur(e), n = t?.dispositif ?? null, r = lr(n), i = [], a = [], o = sr(e);
1777
+ function Er(e) {
1778
+ let t = fr(e), n = t?.dispositif ?? null, r = dr(n), i = [], a = [], o = lr(e);
1779
1779
  if (e.sourceFormat === "senat-ameli" && e.sourceKind === "S") return i.push({
1780
1780
  code: "unsupported_sub_amendment",
1781
1781
  message: "Les sous-amendements ne sont pas encore projetés."
@@ -1793,9 +1793,9 @@ function wr(e) {
1793
1793
  });
1794
1794
  else {
1795
1795
  let { simplifiedText: e, transformation: r } = t, s = o, c = null;
1796
- for (let t of Cr(e, r)) {
1797
- _r(t) && (s = o, c = null);
1798
- let n = c ? gr(e, r, c, t) : t, i = Sr(e, r, n, s);
1796
+ for (let t of Tr(e, r)) {
1797
+ yr(t) && (s = o, c = null);
1798
+ let n = c ? vr(e, r, c, t) : t, i = wr(e, r, n, s);
1799
1799
  if (i) {
1800
1800
  a.push(i), c = null, (i.target.alinea !== null || i.target.alineas) && (s = i.target);
1801
1801
  continue;
@@ -1804,23 +1804,23 @@ function wr(e) {
1804
1804
  c = n;
1805
1805
  continue;
1806
1806
  }
1807
- let l = pr(o, t);
1807
+ let l = hr(o, t);
1808
1808
  if (l !== null) {
1809
1809
  s = l;
1810
1810
  continue;
1811
1811
  }
1812
- hr(t) && (c = t);
1812
+ _r(t) && (c = t);
1813
1813
  }
1814
1814
  a.length === 0 && (o.targetPosition === "after_article" || o.targetPosition === "before_article") && a.push({
1815
1815
  kind: o.targetPosition === "before_article" ? "insert_article_before" : "insert_article_after",
1816
- ...Y(n),
1816
+ ...q(n),
1817
1817
  target: o,
1818
1818
  insertCitation: n,
1819
1819
  insertText: n.text
1820
1820
  }), a.length === 0 && i.push({
1821
1821
  code: "unrecognized_dispositif",
1822
1822
  message: "Le dispositif est présent mais aucune directive d'amendement n'a été reconnue.",
1823
- ...cr(n)
1823
+ ...ur(n)
1824
1824
  });
1825
1825
  }
1826
1826
  return {
@@ -1834,25 +1834,25 @@ function wr(e) {
1834
1834
  }
1835
1835
  //#endregion
1836
1836
  //#region src/lib/server/senat_document_search.ts
1837
- function $(e) {
1837
+ function Z(e) {
1838
1838
  return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
1839
1839
  }
1840
- function Tr(e) {
1841
- let t = v(e);
1840
+ function Dr(e) {
1841
+ let t = S(e);
1842
1842
  if (!t) return {
1843
1843
  articleNumber: null,
1844
1844
  label: e,
1845
1845
  title: null
1846
1846
  };
1847
- let n = $(t.num ?? "") || null, r = $(t.title ?? "") || null;
1847
+ let n = Z(t.num ?? "") || null, r = Z(t.title ?? "") || null;
1848
1848
  return {
1849
1849
  articleNumber: n,
1850
1850
  label: t.label,
1851
1851
  title: r
1852
1852
  };
1853
1853
  }
1854
- function Er(e) {
1855
- let t = u(e), n = [], r = $(t("section.akn-preamble").text());
1854
+ function Or(e) {
1855
+ let t = g(e), n = [], r = Z(t("section.akn-preamble").text());
1856
1856
  return r && n.push({
1857
1857
  anchor: "senat-expose-des-motifs",
1858
1858
  articleNumber: null,
@@ -1862,9 +1862,9 @@ function Er(e) {
1862
1862
  label: "Exposé des motifs",
1863
1863
  title: null
1864
1864
  }), t("article.akn-article").each((e, r) => {
1865
- let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o = $(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = Tr(o || s), l = i.clone();
1865
+ let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o = Z(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = Dr(o || s), l = i.clone();
1866
1866
  l.children("p.TCNumArticle").remove();
1867
- let u = $(l.text());
1867
+ let u = Z(l.text());
1868
1868
  u && n.push({
1869
1869
  anchor: i.attr("id") || null,
1870
1870
  articleNumber: c.articleNumber,
@@ -1876,40 +1876,40 @@ function Er(e) {
1876
1876
  });
1877
1877
  }), n;
1878
1878
  }
1879
- function Dr(e, t) {
1880
- return k("sha256").update(JSON.stringify({
1879
+ function kr(e, t) {
1880
+ return O("sha256").update(JSON.stringify({
1881
1881
  item: e,
1882
1882
  metadata: t
1883
1883
  })).digest("hex");
1884
1884
  }
1885
1885
  //#endregion
1886
1886
  //#region src/lib/server/senat_document_sources.ts
1887
- var Or = new Set(["senat.fr", "www.senat.fr"]), kr = "https://www.senat.fr";
1888
- function Ar(e) {
1887
+ var Ar = new Set(["senat.fr", "www.senat.fr"]), jr = "https://www.senat.fr";
1888
+ function Mr(e) {
1889
1889
  return e?.trim() || void 0;
1890
1890
  }
1891
- function jr(e) {
1891
+ function Nr(e) {
1892
1892
  try {
1893
- let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`, kr);
1894
- return Or.has(n.hostname.toLowerCase()) ? n : void 0;
1893
+ let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`, jr);
1894
+ return Ar.has(n.hostname.toLowerCase()) ? n : void 0;
1895
1895
  } catch {
1896
1896
  return;
1897
1897
  }
1898
1898
  }
1899
- function Mr(e) {
1900
- let t = Ar(e);
1899
+ function Pr(e) {
1900
+ let t = Mr(e);
1901
1901
  if (t === void 0) return {
1902
1902
  publicUrl: null,
1903
1903
  status: "no_url"
1904
1904
  };
1905
- let n = jr(t);
1905
+ let n = Nr(t);
1906
1906
  if (n === void 0) return {
1907
1907
  publicUrl: t,
1908
1908
  status: "unsupported_source"
1909
1909
  };
1910
1910
  let r = n.pathname;
1911
1911
  if (/^\/akomantoso\/[^/]+\.akn\.xml$/iu.test(r)) return {
1912
- akomaNtosoUrl: `${kr}${r}`,
1912
+ akomaNtosoUrl: `${jr}${r}`,
1913
1913
  publicUrl: n.toString(),
1914
1914
  status: "available"
1915
1915
  };
@@ -1918,17 +1918,17 @@ function Mr(e) {
1918
1918
  publicUrl: n.toString(),
1919
1919
  status: "unsupported_source"
1920
1920
  } : {
1921
- akomaNtosoUrl: `${kr}/akomantoso/${i.replace(/\.html$/iu, ".akn.xml")}`,
1921
+ akomaNtosoUrl: `${jr}/akomantoso/${i.replace(/\.html$/iu, ".akn.xml")}`,
1922
1922
  publicUrl: n.toString(),
1923
1923
  status: "available"
1924
1924
  };
1925
1925
  }
1926
- function Nr(e) {
1926
+ function Fr(e) {
1927
1927
  return /^\s*(?:<\?xml\b[^>]*>\s*)?<akomaNtoso[\s/>]/iu.test(e);
1928
1928
  }
1929
1929
  //#endregion
1930
1930
  //#region src/lib/alineas/alineas_numbers.ts
1931
- var Pr = {
1931
+ var Ir = {
1932
1932
  "0150a855548f15a2af52ea057be53f5d": 1,
1933
1933
  "039826cf379b94afefe90b25c6045ca0": 1,
1934
1934
  "03a7e564b84662f4d957c51018e26244": 1,
@@ -20902,7 +20902,7 @@ var Pr = {
20902
20902
  d16d29c923bd60c7b095b66c6058fe60: 1664,
20903
20903
  "1c14c2adf5cfda3220b2057160e10e91": 1665,
20904
20904
  e44c55ca1ac46ff46420686a466c9fc6: 1665
20905
- }, Fr = "\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", Ir = "\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", Lr = "\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", Rr = "\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", zr = "\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", Br = {
20905
+ }, Lr = "\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", Rr = "\nh1 {\n font-size: 1.8em;\n margin: 1em 0 0.5em 0;\n}\nh2 {\n font-size: 1.5em;\n margin: 0.9em 0 0.4em 0;\n}\nh3 {\n font-size: 1.3em;\n margin: 0.8em 0 0.4em 0;\n}\nh4 {\n font-size: 1.15em;\n margin: 0.7em 0 0.3em 0;\n}\nh5 {\n font-size: 1.05em;\n margin: 0.6em 0 0.3em 0;\n}\nh6 {\n font-size: 1em;\n margin: 0.5em 0 0.3em 0;\n}\n", zr = "\n.expose-motifs-titre {\n font-size: 1.1em;\n font-weight: bold;\n color: #0070b9;\n margin: 1em 0 0.5em 0;\n}\n.expose-motifs {\n border-left: 3px solid #0070b9;\n padding-left: 1em;\n margin: 0.5em 0 1em 0;\n color: #333;\n}\n.expose-motifs p {\n margin: 0.5em 0;\n}\n", Br = "\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", Vr = "\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", Hr = {
20906
20906
  assnatetatagr: { bold: !0 },
20907
20907
  assnatetatagrgr: { bold: !0 },
20908
20908
  assnatetatatr: { bold: !0 },
@@ -21003,29 +21003,29 @@ var Pr = {
21003
21003
  assnatxl67: { align: "center" },
21004
21004
  assnatenteteequilibre: { align: "center" }
21005
21005
  };
21006
- function Vr(e) {
21007
- let t = Object.keys(Br).sort((e, t) => t.length - e.length);
21008
- for (let n of t) if (e.includes(n)) return Br[n];
21006
+ function Ur(e) {
21007
+ let t = Object.keys(Hr).sort((e, t) => t.length - e.length);
21008
+ for (let n of t) if (e.includes(n)) return Hr[n];
21009
21009
  return null;
21010
21010
  }
21011
- function Hr(e) {
21012
- return ye.createHash("md5").update(e).digest("hex");
21011
+ function Wr(e) {
21012
+ return be.createHash("md5").update(e).digest("hex");
21013
21013
  }
21014
- function Ur(e) {
21014
+ function Gr(e) {
21015
21015
  return e ? /font-weight\s*:\s*(bold|[6-9]00|1000)/i.test(e) || /font-family\s*:\s*[^;]*\bBold\b/i.test(e) : !1;
21016
21016
  }
21017
- function Wr(e) {
21017
+ function Kr(e) {
21018
21018
  return e ? /font-style\s*:\s*italic/i.test(e) || /font-family\s*:\s*[^;]*\bItalic\b/i.test(e) : !1;
21019
21019
  }
21020
- function Gr(e) {
21020
+ function qr(e) {
21021
21021
  if (!e || !/vertical-align\s*:\s*super/i.test(e)) return !1;
21022
21022
  let t = e.match(/font-size\s*:\s*([\d.]+)pt/i);
21023
21023
  return !(t && parseFloat(t[1]) < 8);
21024
21024
  }
21025
- function Kr(e) {
21025
+ function Jr(e) {
21026
21026
  return e ? /vertical-align\s*:\s*sub/i.test(e) : !1;
21027
21027
  }
21028
- function qr(e) {
21028
+ function Yr(e) {
21029
21029
  if (!e) return;
21030
21030
  let t = [
21031
21031
  "width",
@@ -21060,15 +21060,15 @@ function qr(e) {
21060
21060
  }
21061
21061
  return n.length > 0 ? n.join("; ") : void 0;
21062
21062
  }
21063
- function Jr(e, t) {
21063
+ function Xr(e, t) {
21064
21064
  return !!(e && /text-align\s*:\s*center/i.test(e) || t && /center/i.test(t));
21065
21065
  }
21066
- function Yr(e) {
21066
+ function Zr(e) {
21067
21067
  if (!e) return null;
21068
21068
  let t = e.match(/text-align\s*:\s*(left|center|right|justify)/i);
21069
21069
  return t ? t[1].toLowerCase() : null;
21070
21070
  }
21071
- function Xr(e) {
21071
+ function Qr(e) {
21072
21072
  if (!e) return null;
21073
21073
  for (let [t, n] of [
21074
21074
  [/assnat1Tome|assnatAN1PARTIE/i, 1],
@@ -21080,8 +21080,8 @@ function Xr(e) {
21080
21080
  ]) if (t.test(e)) return n;
21081
21081
  return null;
21082
21082
  }
21083
- function Zr(e, t = {}) {
21084
- let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = u(e, { xml: { decodeEntities: !1 } });
21083
+ function $r(e, t = {}) {
21084
+ let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = g(e, { xml: { decodeEntities: !1 } });
21085
21085
  a("style, script, meta, link").remove(), a(".assnatHeader, .assnatFooter, .assnatHeaderLeft, .assnatHeaderandFooter").remove(), a(".assnatFARSautApres, .assnatFARSautAvant, .assnatFARSautPageNiv0, .assnatFARSautPageNiv1, .assnatFARSautPageNiv1PG").remove(), a(".assnatFARTT08Bleu").each((e, t) => {
21086
21086
  let n = a(t).closest("table");
21087
21087
  n.length > 0 && n.remove();
@@ -21106,7 +21106,7 @@ function Zr(e, t = {}) {
21106
21106
  if (i.length !== 0 && !(n.parents("del").length > 0 || n.find("del img").length > 0) && !(i.parent("del").length > 0)) {
21107
21107
  let e = i.attr();
21108
21108
  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")) {
21109
- let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? Hr(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
21109
+ let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? Wr(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
21110
21110
  n.replaceWith(`<span class="alinea"${i}></span>`);
21111
21111
  return;
21112
21112
  }
@@ -21125,7 +21125,7 @@ function Zr(e, t = {}) {
21125
21125
  (!r || r === "\xA0") && n.remove();
21126
21126
  }), a("span[style*=\"display:block\"][style*=\"position:absolute\"]:not(.alinea)").remove(), a("del").remove();
21127
21127
  function o(e) {
21128
- let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = Ur(n) || r === "b" || r === "strong", o = Wr(n) || r === "i" || r === "em", s = Gr(n) || r === "sup", c = Kr(n) || r === "sub", l = t.attr("class") || "";
21128
+ let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = Gr(n) || r === "b" || r === "strong", o = Kr(n) || r === "i" || r === "em", s = qr(n) || r === "sup", c = Jr(n) || r === "sub", l = t.attr("class") || "";
21129
21129
  return /bold/i.test(l) && (i = !0), /strongemphasis/i.test(l) ? i = !0 : /italic|emphasis/i.test(l) && (o = !0), {
21130
21130
  bold: i,
21131
21131
  italic: o,
@@ -21159,7 +21159,7 @@ function Zr(e, t = {}) {
21159
21159
  c = e;
21160
21160
  }
21161
21161
  for (a("p").each((e, t) => {
21162
- let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s = Xr(i);
21162
+ let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s = Qr(i);
21163
21163
  if (i.includes("assnatFARCouvTitreD")) {
21164
21164
  let e = r.html() || "";
21165
21165
  r.replaceWith(`<p class="cover-subtitle">${e}</p>`);
@@ -21192,11 +21192,11 @@ function Zr(e, t = {}) {
21192
21192
  let c = r.text().trim().startsWith("«");
21193
21193
  if (s && !c) {
21194
21194
  let e = a(`<h${s}>${r.html() || ""}</h${s}>`);
21195
- n && Jr(o, i) && e.attr("align", "center"), r.replaceWith(e);
21195
+ n && Xr(o, i) && e.attr("align", "center"), r.replaceWith(e);
21196
21196
  } else {
21197
- let e = Vr(i), t;
21197
+ let e = Ur(i), t;
21198
21198
  if (n) {
21199
- let n = Yr(o);
21199
+ let n = Zr(o);
21200
21200
  n && n !== "justify" && n !== "left" ? t = n : e?.align && (t = e.align);
21201
21201
  }
21202
21202
  if (r.removeAttr("style").removeAttr("class"), t && r.attr("align", t), e?.bold) {
@@ -21206,7 +21206,7 @@ function Zr(e, t = {}) {
21206
21206
  }
21207
21207
  }), a("h1, h2, h3, h4, h5, h6").each((e, t) => {
21208
21208
  let r = a(t), i = r.attr("style"), o = r.attr("class");
21209
- n && Jr(i, o) ? (r.removeAttr("style").removeAttr("class"), r.attr("align", "center")) : r.removeAttr("style").removeAttr("class");
21209
+ n && Xr(i, o) ? (r.removeAttr("style").removeAttr("class"), r.attr("align", "center")) : r.removeAttr("style").removeAttr("class");
21210
21210
  }), a("a").each((e, t) => {
21211
21211
  let n = a(t), r = n.attr("href"), i = n.attr("id"), o = { ...t.attribs || {} };
21212
21212
  for (let e of Object.keys(o)) e !== "href" && e !== "id" && n.removeAttr(e);
@@ -21245,7 +21245,7 @@ function Zr(e, t = {}) {
21245
21245
  }), a("br").each((e, t) => {
21246
21246
  a(t).removeAttr("style").removeAttr("class");
21247
21247
  }), a("table, tr, td, th, thead, tbody, tfoot").each((e, t) => {
21248
- let n = a(t), r = qr(n.attr("style"));
21248
+ let n = a(t), r = Yr(n.attr("style"));
21249
21249
  n.removeAttr("style").removeAttr("class"), r && n.attr("style", r);
21250
21250
  }), a("td, th").each((e, t) => {
21251
21251
  let n = a(t), r = n.children();
@@ -21263,17 +21263,17 @@ function Zr(e, t = {}) {
21263
21263
  !isNaN(e) && e > 1 && n.attr("style", `counter-reset: list-counter ${e - 1}`), n.attr("start", r);
21264
21264
  }
21265
21265
  }), a("li").each((e, t) => {
21266
- let n = a(t), r = Yr(n.attr("style"));
21266
+ let n = a(t), r = Zr(n.attr("style"));
21267
21267
  n.removeAttr("style").removeAttr("class"), r === "center" && n.attr("style", "text-align: center");
21268
21268
  let i = n.html() || "", o = i.replace(/^(\s|&#xa0;|&#160;|\u00a0)+/, "");
21269
21269
  o !== i && n.html(o);
21270
- }), Qr(a), $r(a, i);
21271
- let l = a("body").html() || a.html(), d = l.includes("class=\"alinea"), f = a("ol").length > 0, p = a("h1, h2, h3, h4, h5, h6").length > 0, m = l.includes("class=\"expose-motifs"), h = l.includes("class=\"cover-title\"") || l.includes("class=\"cover-subtitle\"") || l.includes("class=\"cover-info\"") || l.includes("class=\"cover-year\""), g = "";
21272
- h && (g += zr), p && (g += Ir), m && (g += Lr), d && (g += Fr), f && (g += Rr);
21273
- let _ = g ? `<style>${g}</style>\n${l}` : l;
21274
- return _ = _.replace(/>\s+</g, "> <").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n{3,}/g, "\n\n").split("\n").map((e) => e.trim()).filter((e) => e.length > 0).join("\n"), _ = _.replace(/&nbsp;/g, "\xA0"), r && (_ = _.replace(/<p[^>]*>\s*(&nbsp;|&#xa0;|&#160;|\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*(&nbsp;|&#xa0;|&#160;|\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), _ = _.replace(/<span[^>]*>\s*<\/span>/gi, ""), _ = _.replace(/ class=""/g, ""), _ = ei(_), _ = _.replace(/<(strong|em|b|i|sup|sub)>\s*(&nbsp;|&#xa0;|&#160;|\u00a0|\s)*\s*<\/\1>/gi, "").replace(/<(strong|em|b|i)>(&nbsp;|&#xa0;|&#160;|\u00a0)+<\/\1>/gi, " ").replace(/<br\s*\/?>/gi, "<br/>").replace(/ +/g, " ").trim(), _;
21270
+ }), ei(a), ti(a, i);
21271
+ 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"), ee = l.includes("class=\"cover-title\"") || l.includes("class=\"cover-subtitle\"") || l.includes("class=\"cover-info\"") || l.includes("class=\"cover-year\""), m = "";
21272
+ ee && (m += Vr), f && (m += Rr), p && (m += zr), u && (m += Lr), d && (m += Br);
21273
+ let h = m ? `<style>${m}</style>\n${l}` : l;
21274
+ return h = h.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"), h = h.replace(/&nbsp;/g, "\xA0"), r && (h = h.replace(/<p[^>]*>\s*(&nbsp;|&#xa0;|&#160;|\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*(&nbsp;|&#xa0;|&#160;|\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), h = h.replace(/<span[^>]*>\s*<\/span>/gi, ""), h = h.replace(/ class=""/g, ""), h = ni(h), h = h.replace(/<(strong|em|b|i|sup|sub)>\s*(&nbsp;|&#xa0;|&#160;|\u00a0|\s)*\s*<\/\1>/gi, "").replace(/<(strong|em|b|i)>(&nbsp;|&#xa0;|&#160;|\u00a0)+<\/\1>/gi, " ").replace(/<br\s*\/?>/gi, "<br/>").replace(/ +/g, " ").trim(), h;
21275
21275
  }
21276
- function Qr(e) {
21276
+ function ei(e) {
21277
21277
  e("span[id]").each((t, n) => {
21278
21278
  let r = e(n), i = r.attr("id"), a = n.attribs || {}, o = Object.keys(a);
21279
21279
  if (o.length !== 1 || o[0] !== "id") return;
@@ -21296,13 +21296,13 @@ function Qr(e) {
21296
21296
  l.trim() === u.trim() && (s.attr("id", i), r.replaceWith(r.html() || ""));
21297
21297
  });
21298
21298
  }
21299
- function $r(e, t = !1) {
21299
+ function ti(e, t = !1) {
21300
21300
  let n = e("body");
21301
21301
  if (n.length === 0) return;
21302
21302
  let r = n.find("span.alinea[data-image-hash]"), i = -1;
21303
21303
  r.each((n, r) => {
21304
21304
  let a = e(r), o = a.attr("data-image-hash"), s;
21305
- if (o && Pr[o] !== void 0 && (s = Pr[o]), s === void 0) {
21305
+ if (o && Ir[o] !== void 0 && (s = Ir[o]), s === void 0) {
21306
21306
  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".`);
21307
21307
  a.remove();
21308
21308
  return;
@@ -21314,11 +21314,11 @@ function $r(e, t = !1) {
21314
21314
  i = s, a.attr("data-alinea", String(s)), a.text(String(s)), a.removeAttr("data-image-hash");
21315
21315
  });
21316
21316
  }
21317
- function ei(e) {
21317
+ function ni(e) {
21318
21318
  let t = e;
21319
21319
  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;
21320
21320
  }
21321
- function ti(e, t = {}) {
21321
+ function ri(e, t = {}) {
21322
21322
  return `<!DOCTYPE html>
21323
21323
  <html lang="fr">
21324
21324
  <head>
@@ -21326,33 +21326,33 @@ function ti(e, t = {}) {
21326
21326
  <title>Document simplifié</title>
21327
21327
  </head>
21328
21328
  <body>
21329
- ${Zr(e, t)}
21329
+ ${$r(e, t)}
21330
21330
  </body>
21331
21331
  </html>`;
21332
21332
  }
21333
21333
  //#endregion
21334
21334
  //#region src/lib/server/text_parsers/transformers.ts
21335
- function ni(e, t) {
21335
+ function Q(e, t) {
21336
21336
  let n = "transformation_", r = {};
21337
- for (let e of A.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
21337
+ for (let e of k.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
21338
21338
  let i = e.slice(15, -5), a = i.split(".").map((e) => parseInt(e) - 1), o = r;
21339
21339
  for (let e of a.slice(1)) {
21340
21340
  let t = o.transformations ??= [];
21341
21341
  for (; e >= t.length;) t.push({});
21342
21342
  o = t[e];
21343
21343
  }
21344
- o.output = A.readFileSync(j.join(t, `${n}${i}.html`), { encoding: "utf-8" });
21345
- let { sourceMap: s, title: c } = A.readJsonSync(j.join(t, e), { encoding: "utf-8" });
21344
+ o.output = k.readFileSync(A.join(t, `${n}${i}.html`), { encoding: "utf-8" });
21345
+ let { sourceMap: s, title: c } = k.readJsonSync(A.join(t, e), { encoding: "utf-8" });
21346
21346
  o.sourceMap = s ?? [], o.title = c;
21347
21347
  }
21348
- return ri(r, e), r;
21348
+ return ii(r, e), r;
21349
21349
  }
21350
- function ri(e, t) {
21351
- if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) ri(n, t), t = n.output;
21350
+ function ii(e, t) {
21351
+ if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) ii(n, t), t = n.output;
21352
21352
  return t;
21353
21353
  }
21354
- function ii(e, t, n = "1") {
21355
- if (A.ensureDirSync(t), e.transformations === void 0) A.writeJsonSync(j.join(t, `transformation_${n}.json`), {
21354
+ function $(e, t, n = "1") {
21355
+ if (k.ensureDirSync(t), e.transformations === void 0) k.writeJsonSync(A.join(t, `transformation_${n}.json`), {
21356
21356
  sourceMap: e.sourceMap,
21357
21357
  title: e.title
21358
21358
  }, {
@@ -21360,43 +21360,43 @@ function ii(e, t, n = "1") {
21360
21360
  spaces: 2
21361
21361
  });
21362
21362
  else {
21363
- A.writeJsonSync(j.join(t, `transformation_${n}.json`), { title: e.title }, {
21363
+ k.writeJsonSync(A.join(t, `transformation_${n}.json`), { title: e.title }, {
21364
21364
  encoding: "utf-8",
21365
21365
  spaces: 2
21366
21366
  });
21367
- for (let [r, i] of e.transformations.entries()) ii(i, t, `${n}.${r + 1}`);
21367
+ for (let [r, i] of e.transformations.entries()) $(i, t, `${n}.${r + 1}`);
21368
21368
  }
21369
- e.output !== void 0 && A.writeFileSync(j.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
21369
+ e.output !== void 0 && k.writeFileSync(A.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
21370
21370
  }
21371
21371
  //#endregion
21372
21372
  //#region src/lib/server/linkers/html.ts
21373
- async function ai({ 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: g, referredLegifranceTextsInfosFilePath: _ }) {
21374
- let ee = t ?? (e === void 0 ? void 0 : new h(e));
21375
- if (ee === void 0) throw Error("A Canutes database or legal resolver is required");
21376
- let v = await A.readFile(i, { encoding: "utf-8" }), y;
21377
- a === void 0 ? (y = le({ removeAWithHref: !0 })(v), o !== void 0 && ii(y, o)) : y = ni(v, a);
21378
- let b = [];
21379
- s !== void 0 && b.push("links"), c !== void 0 && b.push("links_or_references"), u !== void 0 && b.push("references");
21380
- let { outputByType: te, referredLegifranceTextCountByCid: ne } = await re({
21381
- legiResolver: ee,
21373
+ async function ai({ 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: ee, logReferences: m, referredLegifranceTextsInfosFilePath: g }) {
21374
+ let te = t ?? (e === void 0 ? void 0 : new h(e));
21375
+ if (te === void 0) throw Error("A Canutes database or legal resolver is required");
21376
+ let _ = await k.readFile(i, { encoding: "utf-8" }), v;
21377
+ a === void 0 ? (v = ue({ removeAWithHref: !0 })(_), o !== void 0 && $(v, o)) : v = Q(_, a);
21378
+ let y = [];
21379
+ s !== void 0 && y.push("links"), c !== void 0 && y.push("links_or_references"), u !== void 0 && y.push("references");
21380
+ let { outputByType: b, referredLegifranceTextCountByCid: ne } = await re({
21381
+ legiResolver: te,
21382
21382
  date: n,
21383
21383
  defaultTextId: r,
21384
- htmlTransformation: y,
21385
- inputHtml: v,
21384
+ htmlTransformation: v,
21385
+ inputHtml: _,
21386
21386
  linkBaseUrl: d,
21387
21387
  linkType: f,
21388
21388
  logIgnoredReferencesTypes: p,
21389
- logPartialReferences: m,
21390
- logReferences: g,
21391
- outputTypes: b,
21392
- referredLegifranceTextsInfos: _ !== void 0
21389
+ logPartialReferences: ee,
21390
+ logReferences: m,
21391
+ outputTypes: y,
21392
+ referredLegifranceTextsInfos: g !== void 0
21393
21393
  }), x = {};
21394
21394
  s !== void 0 && (x.links = s), c !== void 0 && (x.links_or_references = c), u !== void 0 && (x.references = u);
21395
- for (let [e, t] of Object.entries(te)) {
21395
+ for (let [e, t] of Object.entries(b)) {
21396
21396
  let n = x[e];
21397
- n !== void 0 && await A.writeFile(n, t.html, { encoding: "utf-8" });
21397
+ n !== void 0 && await k.writeFile(n, t.html, { encoding: "utf-8" });
21398
21398
  }
21399
- te.links !== void 0 && l !== void 0 && ii(le()(te.links.html), l), _ !== void 0 && await A.writeJson(_, ne, {
21399
+ b.links !== void 0 && l !== void 0 && $(ue()(b.links.html), l), g !== void 0 && await k.writeJson(g, ne, {
21400
21400
  encoding: "utf-8",
21401
21401
  spaces: 2
21402
21402
  });
@@ -21404,20 +21404,20 @@ async function ai({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
21404
21404
  //#endregion
21405
21405
  //#region src/lib/server/tables_of_contents.ts
21406
21406
  async function oi(e, t, n, r) {
21407
- let i = ni(await A.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new C(a), s = await A.readJson(n, { encoding: "utf-8" });
21408
- for await (let e of f({
21407
+ let i = Q(await k.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new ce(a), s = await k.readJson(n, { encoding: "utf-8" });
21408
+ for await (let e of p({
21409
21409
  context: o,
21410
21410
  tableOfContents: s,
21411
21411
  transformation: i
21412
21412
  }));
21413
- await A.writeJson(r, s, {
21413
+ await k.writeJson(r, s, {
21414
21414
  encoding: "utf-8",
21415
21415
  spaces: 2
21416
21416
  });
21417
21417
  }
21418
21418
  async function si(e, t, n) {
21419
- let r = ni(await A.readFile(e, { encoding: "utf-8" }), t).output, i = b(r);
21420
- await A.writeJson(n, i, {
21419
+ let r = Q(await k.readFile(e, { encoding: "utf-8" }), t).output, i = y(r);
21420
+ await k.writeJson(n, i, {
21421
21421
  encoding: "utf-8",
21422
21422
  spaces: 2
21423
21423
  });
@@ -21428,4 +21428,4 @@ function ci({ canutesDb: e }) {
21428
21428
  return new h(e);
21429
21429
  }
21430
21430
  //#endregion
21431
- export { ve as LegiResolver, ai as addLinksOrReferencesToHtmlFile, oi as addPositionsToTableOfContentsFile, _e as buildAndInstallTextTitlesInfos, fe as buildTextTitlesInfos, ci as createLegiResolver, Se as extractAssembleeAmendmentSearchItems, xn as extractAssembleeExposesDesMotifs, En as extractSenatAmendmentSearchItems, Ce as hashAssembleeAmendmentSearchItem, Cn as hashAssembleeSearchItem, Dn as hashSenatAmendmentSearchItem, Dr as hashSenatSearchItem, Nr as isAkomaNtosoXml, wn as isoDateFromAssembleeDocument, _n as linkAkomaNtosoBillRaw, Ot as linkAssembleeBillRaw, gn as parseAkomaNtosoBillRaw, wr as parseAmendment, Dt as parseAssembleeBillRaw, Sn as parseAssembleeDocumentSearchContent, Er as parseSenatDocumentSearchContent, ni as readTransformation, fn as renderAkomaNtosoBillRaw, Mr as resolveSenatAkomaNtosoSource, si as simplifiedHtmlBillFileToTableOfContentsFile, Zr as simplifyWordHtml, ti as simplifyWordHtmlToDocument, ii as writeTransformation };
21431
+ export { ye as LegiResolver, ai as addLinksOrReferencesToHtmlFile, oi as addPositionsToTableOfContentsFile, ve as buildAndInstallTextTitlesInfos, pe as buildTextTitlesInfos, ci as createLegiResolver, we as extractAssembleeAmendmentSearchItems, Cn as extractAssembleeExposesDesMotifs, On as extractSenatAmendmentSearchItems, Te as hashAssembleeAmendmentSearchItem, Tn as hashAssembleeSearchItem, kn as hashSenatAmendmentSearchItem, kr as hashSenatSearchItem, Fr as isAkomaNtosoXml, En as isoDateFromAssembleeDocument, yn as linkAkomaNtosoBillRaw, At as linkAssembleeBillRaw, vn as parseAkomaNtosoBillRaw, Er as parseAmendment, kt as parseAssembleeBillRaw, wn as parseAssembleeDocumentSearchContent, Or as parseSenatDocumentSearchContent, Q as readTransformation, mn as renderAkomaNtosoBillRaw, Pr as resolveSenatAkomaNtosoSource, si as simplifiedHtmlBillFileToTableOfContentsFile, $r as simplifyWordHtml, ri as simplifyWordHtmlToDocument, $ as writeTransformation };