@tricoteuses/tisseuse 0.13.10 → 0.13.12

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 (2) hide show
  1. package/dist/server.js +291 -275
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -136,25 +136,25 @@ function oe(e, t) {
136
136
  stop: n.offset
137
137
  };
138
138
  }
139
- function se(e, t) {
139
+ function A(e, t) {
140
140
  let n = /\d/u.exec(e.slice(t));
141
141
  if (!n) return null;
142
142
  let r = t + n.index;
143
143
  return e.slice(t, r).trim().length > 0 ? null : oe(e, r);
144
144
  }
145
- function ce(e) {
145
+ function se(e) {
146
146
  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);
147
147
  for (; o !== -1;) {
148
148
  let s = e.indexOf(a, o + 15), c = e.slice(o, o + 1400), l = t.exec(c);
149
149
  if (l) {
150
- let e = se(c, l[0].length);
150
+ let e = A(c, l[0].length);
151
151
  e && i.push(e.date);
152
152
  }
153
153
  let u = n.exec(c);
154
154
  if (u) {
155
155
  let e = /\barticle\s+\w/iu.exec(c), t = e === null ? c.slice(u[0].length) : c.slice(u[0].length, e.index);
156
156
  for (r.lastIndex = 0; r.exec(t) !== null;) {
157
- let e = se(t, r.lastIndex);
157
+ let e = A(t, r.lastIndex);
158
158
  e && /^\s+pour\s+les\s+autres\s+dispositions\s+fiscales\b/iu.test(t.slice(e.stop)) && i.push(e.date);
159
159
  }
160
160
  }
@@ -162,20 +162,20 @@ function ce(e) {
162
162
  }
163
163
  return i;
164
164
  }
165
- function le(e) {
166
- let t = ce(ae(e).toLowerCase()), n = Array.from(new Set(t));
165
+ function ce(e) {
166
+ let t = se(ae(e).toLowerCase()), n = Array.from(new Set(t));
167
167
  return n.length === 1 ? n[0] : void 0;
168
168
  }
169
- function ue(e) {
169
+ function j(e) {
170
170
  return D(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-").replace(/^(?:(?:article\s+[^:]+|[a-z][.)]|[ivxlcdm]+\.|\d+°)\s*(?:-\s*)?)+/iu, "");
171
171
  }
172
- function A(e) {
172
+ function M(e) {
173
173
  return e?.type === "tag";
174
174
  }
175
- function j(e, t) {
175
+ function N(e, t) {
176
176
  return e.html(t) ?? "";
177
177
  }
178
- function de(e, t) {
178
+ function le(e, t) {
179
179
  let n = [], r = /* @__PURE__ */ new Set();
180
180
  for (let i of e(t).find("a").get()) {
181
181
  let a = e(i).attr("href") ?? "", o = /\/legifrance\/(articles|sections|textes)\/([^?#"]+)/u.exec(a);
@@ -186,33 +186,33 @@ function de(e, t) {
186
186
  let u = E(e(i).text());
187
187
  n.push({
188
188
  id: c,
189
- ...fe(e, t, i) ? { insideFrenchQuotes: !0 } : {},
189
+ ...ue(e, t, i) ? { insideFrenchQuotes: !0 } : {},
190
190
  ...u ? { text: u } : {},
191
191
  type: s
192
192
  });
193
193
  }
194
194
  return n;
195
195
  }
196
- function fe(e, t, n) {
197
- let r = pe(e, t, n);
196
+ function ue(e, t, n) {
197
+ let r = de(e, t, n);
198
198
  return (r.match(/«/gu) ?? []).length > (r.match(/»/gu) ?? []).length;
199
199
  }
200
- function pe(e, t, n) {
200
+ function de(e, t, n) {
201
201
  if (t === n) return "";
202
202
  if (t.type === "text") return t.data ?? "";
203
- if (!A(t)) return "";
203
+ if (!M(t)) return "";
204
204
  let r = "";
205
205
  for (let i of e(t).contents().get()) {
206
206
  if (i === n) return r;
207
- if (A(i) && e.contains(i, n)) return r + pe(e, i, n);
207
+ if (M(i) && e.contains(i, n)) return r + de(e, i, n);
208
208
  r += e(i).text();
209
209
  }
210
210
  return r;
211
211
  }
212
- function me(e, t) {
212
+ function fe(e, t) {
213
213
  return t.map((t) => E(e(t).text())).filter(Boolean).join("\n");
214
214
  }
215
- function M(e) {
215
+ function P(e) {
216
216
  let t = E(e).replace(/\s+:\s+/u, " : "), n = w.exec(t), r = n?.[1]?.trim();
217
217
  if (!r) return null;
218
218
  let i = r.replace(/\s+/gu, ""), a = n?.[2]?.trim();
@@ -222,11 +222,11 @@ function M(e) {
222
222
  title: a
223
223
  };
224
224
  }
225
- function he(e) {
225
+ function pe(e) {
226
226
  let t = D(e);
227
227
  return !t || T.test(t) ? "noise" : C.test(e) ? "directive_candidate" : "context";
228
228
  }
229
- async function N(e, t, r) {
229
+ async function F(e, t, r) {
230
230
  if (r === void 0) throw Error("A document date is required to add links to legal references.");
231
231
  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.");
232
232
  let { output: i } = await n({
@@ -241,37 +241,53 @@ async function N(e, t, r) {
241
241
  });
242
242
  return i ?? e;
243
243
  }
244
- function ge(e, t) {
244
+ function me(e, t) {
245
245
  let n = e(t).closest("h1,h2,h3,h4,h5,h6,p,td,th").get(0), r = e(t).closest("table").get(0);
246
- return A(r) && A(n) && e(n).parents("table").get(0) === r ? r : A(n) ? n : t;
246
+ return M(r) && M(n) && e(n).parents("table").get(0) === r ? r : M(n) ? n : t;
247
247
  }
248
- function P(e) {
248
+ function I(e) {
249
+ return `_TocArt${(e.num ?? e.label.replace(/^Article\s+/iu, "")).replace(/\s*\([^)]*\)\s*$/u, "").replace(/\s+/gu, "")}`;
250
+ }
251
+ function L(e) {
249
252
  let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
250
- return e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
251
- let o = M(E(e(a).text()));
253
+ e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
254
+ let o = P(E(e(a).text()));
252
255
  if (!o) return;
253
256
  let s = e(a).attr("id");
254
257
  if (!s || r.has(s)) return;
255
- let c = ge(e, a);
258
+ let c = me(e, a);
256
259
  n.has(c) || (r.add(s), n.add(c), t.push({
257
260
  id: s,
258
261
  ...o,
259
262
  element: a,
260
263
  container: c
261
264
  }));
262
- }), t;
265
+ }), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((i, a) => {
266
+ if (n.has(a)) return;
267
+ let o = P(E(e(a).text()));
268
+ if (!o) return;
269
+ let s = I(o);
270
+ r.has(s) || (r.add(s), n.add(a), t.push({
271
+ id: s,
272
+ ...o,
273
+ element: a,
274
+ container: a
275
+ }));
276
+ });
277
+ let i = e("body *");
278
+ return t.sort((e, t) => i.index(e.container) - i.index(t.container)), t;
263
279
  }
264
- function F(e) {
280
+ function he(e) {
265
281
  let t = e.next;
266
282
  for (; t !== null;) {
267
- if (A(t)) return t;
283
+ if (M(t)) return t;
268
284
  t = t.next;
269
285
  }
270
286
  return null;
271
287
  }
272
- function I(e, t, n) {
288
+ function ge(e, t, n) {
273
289
  let r = [t.container], i = n?.container;
274
- for (let e = F(t.container); e !== null && e !== i; e = F(e)) r.push(e);
290
+ for (let e = he(t.container); e !== null && e !== i; e = he(e)) r.push(e);
275
291
  if (r.length > 1) return r;
276
292
  let a = e("body *").index(t.container), o = i ? e("body *").index(i) : -1;
277
293
  return e("body > *").get().filter((t) => {
@@ -287,82 +303,82 @@ function _e(e, t) {
287
303
  }
288
304
  return n;
289
305
  }
290
- function L(e, t, n) {
306
+ function ve(e, t, n) {
291
307
  let r = [], i = !1;
292
308
  for (let a of _e(e, n)) {
293
309
  let n = E(e(a).text());
294
310
  if (!n) continue;
295
311
  T.test(n) && (i = !0);
296
- let o = i ? "noise" : he(n), s = `${t}-b${r.length + 1}`;
312
+ let o = i ? "noise" : pe(n), s = `${t}-b${r.length + 1}`;
297
313
  e(a).attr("data-pjl-parsed-article-id", t), e(a).attr("data-pjl-parsed-block-id", s), r.push({
298
314
  id: s,
299
315
  articleId: t,
300
316
  kind: o,
301
- links: de(e, a),
317
+ links: le(e, a),
302
318
  text: n,
303
- html: j(e, a)
319
+ html: N(e, a)
304
320
  });
305
321
  }
306
322
  return r;
307
323
  }
308
- function R(e, t) {
324
+ function ye(e, t) {
309
325
  if (t.length === 0) return e;
310
- let n = `<div style="display: none;">\n${t.map((e) => `<p class="assnatTOC6"><a href="#${`_TocArt${(e.num ?? e.label.replace(/^Article\s+/iu, "")).replace(/\s+/gu, "")}`}"><span class="assnatHyperlink" style="font-weight:bold; text-decoration:none; color:#000000">${e.label.toUpperCase()}</span></a></p>`).join("\n")}\n</div>`;
326
+ 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>`;
311
327
  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}`;
312
328
  }
313
- function ve(t) {
329
+ function be(t) {
314
330
  let n = e(t);
315
- for (let e of P(n)) {
316
- let t = `_TocArt${(e.num ?? e.label.replace(/^Article\s+/iu, "")).replace(/\s+/gu, "")}`, r = n(e.element), i = r.attr("id");
317
- i?.startsWith("_TocArt") || (i?.startsWith("_Toc") && !z(n, i, e.element) && r.before(n("<span></span>").attr("id", i)), r.attr("id", t));
331
+ for (let e of L(n)) {
332
+ let t = I(e), r = n(e.element), i = r.attr("id");
333
+ i !== t && (i?.startsWith("_Toc") && !xe(n, i, e.element) && r.before(n("<span></span>").attr("id", i)), r.attr("id", t));
318
334
  }
319
- let r = P(n);
335
+ let r = L(n);
320
336
  for (let [e, t] of r.entries()) {
321
- let i = I(n, t, r[e + 1]).flatMap((e) => n(e).is("span.alinea[data-alinea]") ? [e] : n(e).find("span.alinea[data-alinea]").get());
337
+ let i = ge(n, t, r[e + 1]).flatMap((e) => n(e).is("span.alinea[data-alinea]") ? [e] : n(e).find("span.alinea[data-alinea]").get());
322
338
  for (let e of i) {
323
339
  let r = n(e).attr("data-alinea")?.trim();
324
340
  if (!r) continue;
325
341
  let i = `${t.id}-alinea-${r.replace(/\s+/gu, "")}`;
326
- if (z(n, i, e)) continue;
342
+ if (xe(n, i, e)) continue;
327
343
  let a = n(e).attr("id");
328
344
  a && a !== i ? n(e).before(n("<span></span>").attr("id", i)) : n(e).attr("id", i);
329
345
  }
330
346
  }
331
347
  return n.html();
332
348
  }
333
- function z(e, t, n) {
349
+ function xe(e, t, n) {
334
350
  for (let r of e("[id]").get()) if (r !== n && e(r).attr("id") === t) return !0;
335
351
  return !1;
336
352
  }
337
- function ye(e, t) {
338
- let n = ue("sourceText" in t ? t.sourceText : "");
353
+ function Se(e, t) {
354
+ let n = j("sourceText" in t ? t.sourceText : "");
339
355
  if (n) return e.filter((e) => e.kind === "directive_candidate").find((e) => {
340
- let t = ue(e.text);
356
+ let t = j(e.text);
341
357
  return t.length > 0 && (n.includes(t) || t.includes(n));
342
358
  });
343
359
  }
344
- function be(e, t) {
360
+ function Ce(e, t) {
345
361
  if (t) return t.blockIds.map((t) => e.get(t)).find((e) => e?.kind === "directive_candidate");
346
362
  }
347
- function xe(e) {
363
+ function we(e) {
348
364
  return e?.links.filter((e) => !e.insideFrenchQuotes && (e.type === "article" || e.type === "division")).map((e) => e.id) ?? [];
349
365
  }
350
- var Se = [
366
+ var Te = [
351
367
  /^([IVXLCDM]+)\s*[.).]?\s*[–—-]/iu,
352
368
  /^(\d+°)\s+/u,
353
369
  /^([a-z])\)\s+/iu,
354
370
  /^([ivxlcdm]+)\)\s+/iu
355
371
  ];
356
- function Ce(e) {
372
+ function Ee(e) {
357
373
  let t = E(e);
358
374
  if (!t) return;
359
- let n = Se.findIndex((e) => e.test(t));
375
+ let n = Te.findIndex((e) => e.test(t));
360
376
  return n === -1 ? t.endsWith(":") ? 0 : void 0 : n + 1;
361
377
  }
362
- function we(e) {
378
+ function De(e) {
363
379
  let t = /* @__PURE__ */ new Map(), n = [];
364
380
  for (let r of e) {
365
- let e = Ce(r.text);
381
+ let e = Ee(r.text);
366
382
  if (e === void 0) {
367
383
  t.set(r.id, [...n, r]);
368
384
  continue;
@@ -371,14 +387,14 @@ function we(e) {
371
387
  }
372
388
  return t;
373
389
  }
374
- function Te(e, t) {
390
+ function Oe(e, t) {
375
391
  let n = [], r = /* @__PURE__ */ new Set();
376
392
  for (let i of [...e ?? [], ...t]) i !== void 0 && (r.has(i.id) || (r.add(i.id), n.push(i)));
377
393
  return n;
378
394
  }
379
- function Ee(e, t, n) {
395
+ function ke(e, t, n) {
380
396
  if (!t) return;
381
- let r = Te(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
397
+ let r = Oe(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
382
398
  if (r.length === 0) return;
383
399
  let i = r.map((e) => e.id);
384
400
  if (i.length === t.blockIds.length && i.every((e, n) => e === t.blockIds[n])) return;
@@ -393,7 +409,7 @@ function Ee(e, t, n) {
393
409
  }
394
410
  };
395
411
  }
396
- function De(e) {
412
+ function Ae(e) {
397
413
  let t = [], n = 0;
398
414
  for (let r of e.blocks) {
399
415
  let i = e.directiveText.indexOf(r.text, n);
@@ -407,7 +423,7 @@ function De(e) {
407
423
  }
408
424
  return t;
409
425
  }
410
- function Oe(e, t, n) {
426
+ function je(e, t, n) {
411
427
  let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop >= r && e.start <= i);
412
428
  if (a.length === 0) return;
413
429
  let o = a[0], s = a[a.length - 1], c = o.start, l = s.stop;
@@ -421,7 +437,7 @@ function Oe(e, t, n) {
421
437
  }
422
438
  };
423
439
  }
424
- function ke(e, t, n) {
440
+ function Me(e, t, n) {
425
441
  if (!t) return;
426
442
  let r = e.directiveText.indexOf(t.text);
427
443
  if (r === -1) return;
@@ -434,14 +450,14 @@ function ke(e, t, n) {
434
450
  stop: a
435
451
  };
436
452
  }
437
- function Ae(e) {
438
- let t = De(e), n = new Map(e.blocks.map((e) => [e.id, e])), r = we(e.blocks), a = /* @__PURE__ */ new Map(), o = [];
453
+ function Ne(e) {
454
+ let t = Ae(e), n = new Map(e.blocks.map((e) => [e.id, e])), r = De(e.blocks), a = /* @__PURE__ */ new Map(), o = [];
439
455
  for (let t of e.blocks) {
440
- let e = xe(t);
456
+ let e = we(t);
441
457
  e.length > 0 && (o = e), a.set(t.id, o);
442
458
  }
443
459
  return i(e.directiveText).map((i) => {
444
- let o = Oe(e, t, i), s = be(n, o) ?? ye(e.blocks, i), c = xe(s), l = c.length > 0 ? c : s?.id === void 0 ? [] : a.get(s.id) ?? [], u = ke(e, s, i), d = Ee(s?.id === void 0 ? void 0 : r.get(s.id), o, n);
460
+ let o = je(e, t, i), s = Ce(n, o) ?? Se(e.blocks, i), c = we(s), l = c.length > 0 ? c : s?.id === void 0 ? [] : a.get(s.id) ?? [], u = Me(e, s, i), d = ke(s?.id === void 0 ? void 0 : r.get(s.id), o, n);
445
461
  return {
446
462
  articleId: e.id,
447
463
  blockId: s?.id,
@@ -461,7 +477,7 @@ function Ae(e) {
461
477
  };
462
478
  });
463
479
  }
464
- function je(e) {
480
+ function Pe(e) {
465
481
  let t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Set();
466
482
  for (let i of e) {
467
483
  let e = re(i.directive);
@@ -491,7 +507,7 @@ function je(e) {
491
507
  definitions: n
492
508
  };
493
509
  }
494
- function Me(e, t, n) {
510
+ function Fe(e, t, n) {
495
511
  let r = new Map(t.map((e) => [O(e.num), e]));
496
512
  return e.map((e) => {
497
513
  let t = n.get(e), i = t?.[0], a = [...k(e.directive.reference)].map((e) => r.get(O(e))).filter((e) => e !== void 0 && e.definitionId !== i?.definitionId)[0], o = a === void 0 ? void 0 : {
@@ -510,7 +526,7 @@ function Me(e, t, n) {
510
526
  };
511
527
  });
512
528
  }
513
- function Ne(e, t, n, i, a, o, s = !0) {
529
+ function Ie(e, t, n, i, a, o, s = !0) {
514
530
  let c = a.map((e) => e.directiveText).filter(Boolean).join("\n"), l = {
515
531
  sourceFormat: e,
516
532
  documentDate: i,
@@ -523,7 +539,7 @@ function Ne(e, t, n, i, a, o, s = !0) {
523
539
  ...l,
524
540
  directives: []
525
541
  };
526
- let u = le(a.map((e) => e.text).join("\n")), d = a.flatMap(Ae), { createdArticlesByDirective: f, definitions: p } = je(d), m = Me(d, p, f);
542
+ let u = ce(a.map((e) => e.text).join("\n")), d = a.flatMap(Ne), { createdArticlesByDirective: f, definitions: p } = Pe(d), m = Fe(d, p, f);
527
543
  return {
528
544
  ...l,
529
545
  ...u ? { globalApplicabilityDate: u } : {},
@@ -531,7 +547,7 @@ function Ne(e, t, n, i, a, o, s = !0) {
531
547
  directives: m
532
548
  };
533
549
  }
534
- function Pe(e) {
550
+ function Le(e) {
535
551
  let t = r(e.map((e) => e.directiveText).filter(Boolean).join("\n")), n = new Map(e.map((e) => [D(e.label), e.id])), i = 0;
536
552
  function a(e) {
537
553
  for (let t of e.articles ?? []) i += 1, t.id ??= n.get(D(t.line));
@@ -543,20 +559,20 @@ function Pe(e) {
543
559
  type: "article"
544
560
  })) };
545
561
  }
546
- async function Fe(t, n) {
547
- let r = new u("parseAssembleeBillRaw"), i = n.linkedHtml === void 0 ? await r.time("linkAssembleeBillRaw", () => Ie(t, n)) : void 0, a = r.timeSync("applyArticleAnchorIds", () => ve(n.linkedHtml ?? i.linkedHtml), { inputSize: t.length }), o = r.timeSync("cheerioLoadLinkedHtml", () => e(a)), s = r.timeSync("extractArticleHeadings", () => P(o)), c = r.timeSync("extractArticlesAndBlocks", () => s.map((e, t) => {
548
- let n = I(o, e, s[t + 1]), r = L(o, e.id, n), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
562
+ async function Re(t, n) {
563
+ let r = new u("parseAssembleeBillRaw"), i = n.linkedHtml === void 0 ? await r.time("linkAssembleeBillRaw", () => ze(t, n)) : void 0, a = r.timeSync("applyArticleAnchorIds", () => be(n.linkedHtml ?? i.linkedHtml), { inputSize: t.length }), o = r.timeSync("cheerioLoadLinkedHtml", () => e(a)), s = r.timeSync("extractArticleHeadings", () => L(o)), c = r.timeSync("extractArticlesAndBlocks", () => s.map((e, t) => {
564
+ let n = ge(o, e, s[t + 1]), r = ve(o, e.id, n), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
549
565
  return {
550
566
  id: e.id,
551
567
  label: e.label,
552
568
  num: e.num,
553
569
  title: e.title,
554
- text: me(o, n),
555
- html: n.map((e) => j(o, e)).join("\n"),
570
+ text: fe(o, n),
571
+ html: n.map((e) => N(o, e)).join("\n"),
556
572
  directiveText: i,
557
573
  blocks: r
558
574
  };
559
- }), { count: s.length }), l = r.timeSync("injectHiddenArticleSummary", () => R(o.html(), c)), d = r.timeSync("buildAssembleeTableOfContents", () => Pe(c), { count: c.length }), f = r.timeSync("buildParsedDocument", () => Ne("assemblee-html", t, l, n.date, c, d, n.includeDirectiveAnalysis));
575
+ }), { count: s.length }), l = r.timeSync("injectHiddenArticleSummary", () => ye(o.html(), c)), d = r.timeSync("buildAssembleeTableOfContents", () => Le(c), { count: c.length }), f = r.timeSync("buildParsedDocument", () => Ie("assemblee-html", t, l, n.date, c, d, n.includeDirectiveAnalysis));
560
576
  return r.log({
561
577
  articleCount: f.articles.length,
562
578
  blockCount: f.articles.reduce((e, t) => e + t.blocks.length, 0),
@@ -564,18 +580,18 @@ async function Fe(t, n) {
564
580
  targetDirectiveCount: f.directives.filter((e) => e.targetIds !== void 0).length
565
581
  }), f;
566
582
  }
567
- async function Ie(e, t) {
583
+ async function ze(e, t) {
568
584
  return {
569
585
  sourceFormat: "assemblee-html",
570
586
  documentDate: t.date,
571
587
  html: e,
572
- linkedHtml: await N(e, t, t.date)
588
+ linkedHtml: await F(e, t, t.date)
573
589
  };
574
590
  }
575
- function B(e) {
591
+ function R(e) {
576
592
  return e.replace(/&/gu, "&amp;").replace(/</gu, "&lt;").replace(/>/gu, "&gt;").replace(/"/gu, "&quot;");
577
593
  }
578
- function Le(e) {
594
+ function Be(e) {
579
595
  let t = e;
580
596
  for (let e = 0; e < 3; e++) {
581
597
  let e = t;
@@ -583,25 +599,25 @@ function Le(e) {
583
599
  }
584
600
  return t;
585
601
  }
586
- function Re(e) {
602
+ function z(e) {
587
603
  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);
588
604
  }
589
- function V(e) {
605
+ function B(e) {
590
606
  return e.name.replace(/^.*:/u, "");
591
607
  }
592
- function ze(e, t) {
608
+ function V(e, t) {
593
609
  return t.children.map((t) => H(e, t)).filter(Boolean).join("");
594
610
  }
595
- function Be(e, t) {
596
- return t.children.map((t) => t.type === "text" && Re(t.data) ? Le(t.data) : H(e, t)).filter(Boolean).join("");
611
+ function Ve(e, t) {
612
+ return t.children.map((t) => t.type === "text" && z(t.data) ? Be(t.data) : H(e, t)).filter(Boolean).join("");
597
613
  }
598
614
  function H(e, t) {
599
615
  if (t.type === "text") {
600
616
  let e = t.data.replace(/\s+\./gu, ".");
601
- return Re(e) ? Le(e) : B(e);
617
+ return z(e) ? Be(e) : R(e);
602
618
  }
603
- if (!A(t)) return "";
604
- let n = V(t), r = ze(e, t);
619
+ if (!M(t)) return "";
620
+ let n = B(t), r = V(e, t);
605
621
  switch (n) {
606
622
  case "p": return `<p${U(e, t, [
607
623
  "id",
@@ -623,7 +639,7 @@ function H(e, t) {
623
639
  "title",
624
640
  "style"
625
641
  ])}>${r}</${n}>`;
626
- case "a": return `<a href="${B(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${U(e, t, [
642
+ case "a": return `<a href="${R(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${U(e, t, [
627
643
  "id",
628
644
  "class",
629
645
  "title",
@@ -634,7 +650,7 @@ function H(e, t) {
634
650
  case "tbody":
635
651
  case "tr":
636
652
  case "th":
637
- case "td": return Ve(e, t, n, r);
653
+ case "td": return He(e, t, n, r);
638
654
  case "caption": return `<caption${U(e, t, [
639
655
  "id",
640
656
  "class",
@@ -643,12 +659,12 @@ function H(e, t) {
643
659
  ])}>${r}</caption>`;
644
660
  case "num": return `<span class="akn-num">${r}</span> `;
645
661
  case "heading": return `<p class="akn-heading">${r}</p>`;
646
- case "content": return Be(e, t);
647
- case "alinea": return q(e, t, "div", "akn-alinea");
648
- case "article": return q(e, t, "article", "akn-article");
662
+ case "content": return Ve(e, t);
663
+ case "alinea": return K(e, t, "div", "akn-alinea");
664
+ case "article": return K(e, t, "article", "akn-article");
649
665
  case "blockList":
650
666
  case "list": return `<div class="akn-list">${r}</div>`;
651
- case "item": return q(e, t, "div", "akn-item");
667
+ case "item": return K(e, t, "div", "akn-item");
652
668
  case "listIntroduction":
653
669
  case "listWrapUp":
654
670
  case "intro":
@@ -664,7 +680,7 @@ function H(e, t) {
664
680
  case "book":
665
681
  case "tome":
666
682
  case "subchapter":
667
- case "subsection": return q(e, t, "section", `akn-${n}`);
683
+ case "subsection": return K(e, t, "section", `akn-${n}`);
668
684
  case "crossHeading": return `<p class="akn-cross-heading">${r}</p>`;
669
685
  default: return r;
670
686
  }
@@ -674,12 +690,12 @@ function U(e, t, n, r = {}) {
674
690
  for (let r of n) {
675
691
  if (r === "style") continue;
676
692
  let n = e(t).attr(r);
677
- n !== void 0 && i.push(`${r}="${B(n)}"`);
693
+ n !== void 0 && i.push(`${r}="${R(n)}"`);
678
694
  }
679
695
  let a = r.style ?? e(t).attr("style");
680
- return a && i.push(`style="${B(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
696
+ return a && i.push(`style="${R(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
681
697
  }
682
- function Ve(e, t, n, r) {
698
+ function He(e, t, n, r) {
683
699
  return `<${n}${U(e, t, [
684
700
  "id",
685
701
  "class",
@@ -693,105 +709,105 @@ function Ve(e, t, n, r) {
693
709
  "cellspacing",
694
710
  "cellpadding",
695
711
  "style"
696
- ], { style: He(e, t, n) })}>${r}</${n}>`;
712
+ ], { style: Ue(e, t, n) })}>${r}</${n}>`;
697
713
  }
698
- function He(e, t, n) {
714
+ function Ue(e, t, n) {
699
715
  let r = e(t).attr("style") ?? "";
700
- return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = Ue(r, "text-align", "center")), r || void 0;
716
+ return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = We(r, "text-align", "center")), r || void 0;
701
717
  }
702
- function Ue(e, t, n) {
718
+ function We(e, t, n) {
703
719
  let r = e.trim();
704
720
  return `${r}${r && !r.endsWith(";") ? ";" : ""} ${t}: ${n};`.trim();
705
721
  }
706
- function We(e, t) {
722
+ function Ge(e, t) {
707
723
  let n = [E(e(t).children("num").first().text()), E(e(t).children("heading").first().text())].filter(Boolean);
708
- return n.length === 0 ? "" : `<p class="akn-heading">${B(n.join(" "))}</p>`;
724
+ return n.length === 0 ? "" : `<p class="akn-heading">${R(n.join(" "))}</p>`;
709
725
  }
710
- function Ge(e, t) {
726
+ function Ke(e, t) {
711
727
  if (!t) return !1;
712
728
  let n = (e) => E(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
713
729
  return n(E(e.replace(/<[^>]*>/gu, " ").replace(/&nbsp;/gu, " ").replace(/&#xa0;/giu, " ").replace(/&#x2013;/giu, "–"))).startsWith(n(t));
714
730
  }
715
- function Ke(e) {
716
- let t = B(e);
731
+ function qe(e) {
732
+ let t = R(e);
717
733
  return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}">${t}</span></p>`;
718
734
  }
719
- function qe(e, t) {
720
- return W([Je({
735
+ function Je(e, t) {
736
+ return Ye([Xe({
721
737
  content: e,
722
738
  pastille: t
723
739
  })]);
724
740
  }
725
- function W(e) {
741
+ function Ye(e) {
726
742
  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>`;
727
743
  }
728
- function Je({ content: e, pastille: t, style: n, contextClass: r }) {
729
- let i = n ? ` style="${B(n)}"` : "", a = r ? ` ${B(r)}` : "";
730
- return `<tr${r ? ` class="${B(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${Ke(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>`;
744
+ function Xe({ content: e, pastille: t, style: n, contextClass: r }) {
745
+ let i = n ? ` style="${R(n)}"` : "", a = r ? ` ${R(r)}` : "";
746
+ return `<tr${r ? ` class="${R(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${qe(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>`;
731
747
  }
732
- function G({ content: e, style: t, contextClass: n }) {
733
- let r = t ? ` style="${B(t)}"` : "", i = n ? ` ${B(n)}` : "";
734
- return `<tr${n ? ` class="${B(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>`;
748
+ function W({ content: e, style: t, contextClass: n }) {
749
+ let r = t ? ` style="${R(t)}"` : "", i = n ? ` ${R(n)}` : "";
750
+ return `<tr${n ? ` class="${R(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>`;
735
751
  }
736
- function Ye(e, t) {
752
+ function Ze(e, t) {
737
753
  return e(t).attr("data:pastille") ?? e(t).attr("pastille");
738
754
  }
739
- function Xe(e, t) {
755
+ function Qe(e, t) {
740
756
  return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
741
757
  }
742
- function Ze(e, t) {
743
- return e(t).children().get().filter((e) => A(e) ? V(e) === "content" : !1).map((t) => H(e, t)).filter(Boolean).join("\n");
758
+ function $e(e, t) {
759
+ return e(t).children().get().filter((e) => M(e) ? B(e) === "content" : !1).map((t) => H(e, t)).filter(Boolean).join("\n");
744
760
  }
745
- function Qe(e, t) {
761
+ function et(e, t) {
746
762
  let n = [];
747
763
  return e(t).children().each((t, r) => {
748
- if (!A(r)) return;
749
- let i = V(r);
764
+ if (!M(r)) return;
765
+ let i = B(r);
750
766
  i === "num" || i === "heading" || i === "content" || n.push(H(e, r));
751
767
  }), n.filter(Boolean);
752
768
  }
753
- function K(e, t) {
754
- let n = [], r = V(t), i = r === "alinea" ? Ye(e, t) : void 0, a = Ze(e, t), o = $e(e, t, r, i), s = at(e, t);
769
+ function G(e, t) {
770
+ let n = [], r = B(t), i = r === "alinea" ? Ze(e, t) : void 0, a = $e(e, t), o = tt(e, t, r, i), s = st(e, t);
755
771
  if (i) {
756
- let r = [Ge(a, E(e(t).children("num").first().text())) ? "" : We(e, t), a].filter(Boolean).join("\n");
757
- E(r) && n.push(Je({
772
+ let r = [Ke(a, E(e(t).children("num").first().text())) ? "" : Ge(e, t), a].filter(Boolean).join("\n");
773
+ E(r) && n.push(Xe({
758
774
  content: r,
759
775
  pastille: i,
760
776
  style: o,
761
777
  contextClass: s
762
778
  }));
763
- } else a && n.push(G({
779
+ } else a && n.push(W({
764
780
  content: a,
765
781
  style: o,
766
782
  contextClass: s
767
783
  }));
768
784
  for (let r of e(t).children().get()) {
769
- if (!A(r)) continue;
770
- let t = V(r);
771
- t === "num" || t === "heading" || t === "content" || (t === "alinea" || Xe(e, r)) && n.push(...K(e, r));
785
+ if (!M(r)) continue;
786
+ let t = B(r);
787
+ t === "num" || t === "heading" || t === "content" || (t === "alinea" || Qe(e, r)) && n.push(...G(e, r));
772
788
  }
773
789
  return n;
774
790
  }
775
- function q(e, t, n, r) {
776
- let i = V(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = Ye(e, t), s = $e(e, t, i, o), c = [`<${n} ${[
777
- a ? `id="${B(a)}"` : void 0,
791
+ function K(e, t, n, r) {
792
+ let i = B(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = Ze(e, t), s = tt(e, t, i, o), c = [`<${n} ${[
793
+ a ? `id="${R(a)}"` : void 0,
778
794
  `class="${r}"`,
779
- o ? `data-pastille="${B(o)}"` : void 0,
780
- s ? `style="${B(s)}"` : void 0
795
+ o ? `data-pastille="${R(o)}"` : void 0,
796
+ s ? `style="${R(s)}"` : void 0
781
797
  ].filter((e) => e !== void 0).join(" ")}>`];
782
798
  if (i === "part" || i === "title") {
783
- let r = nt(e, t, i), a = it(e, t), o = r ? [G({
799
+ let r = it(e, t, i), a = ot(e, t), o = r ? [W({
784
800
  content: r,
785
801
  contextClass: a
786
802
  })] : [], s = () => {
787
- o.length !== 0 && (c.push(tt(o)), o = []);
803
+ o.length !== 0 && (c.push(rt(o)), o = []);
788
804
  };
789
805
  return e(t).children().each((t, n) => {
790
- if (!A(n)) return;
791
- let r = V(n);
806
+ if (!M(n)) return;
807
+ let r = B(n);
792
808
  if (!(r === "num" || r === "heading" || r === "content")) {
793
809
  if (r === "alinea") {
794
- o.push(...K(e, n));
810
+ o.push(...G(e, n));
795
811
  return;
796
812
  }
797
813
  s(), c.push(H(e, n));
@@ -799,49 +815,49 @@ function q(e, t, n, r) {
799
815
  }), s(), c.push(`</${n}>`), c.join("\n");
800
816
  }
801
817
  if (i === "article") {
802
- let r = E(e(t).children("num").first().text()), i = E(e(t).children("heading").first().text()), a = M(r) ?? {
818
+ let r = E(e(t).children("num").first().text()), i = E(e(t).children("heading").first().text()), a = P(r) ?? {
803
819
  label: r,
804
820
  num: r
805
- }, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${B(`_TocArt${(a.num ?? r).replace(/\s+/gu, "")}`)}">${B(a.label)}${i ? ` : ${B(i)}` : ""}</p>`;
806
- if (Xe(e, t)) {
807
- let r = [G({
821
+ }, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${R(`_TocArt${(a.num ?? r).replace(/\s+/gu, "")}`)}">${R(a.label)}${i ? ` : ${R(i)}` : ""}</p>`;
822
+ if (Qe(e, t)) {
823
+ let r = [W({
808
824
  content: o,
809
- contextClass: st(a.label)
810
- }), ...K(e, t)];
811
- c.push(W(r));
812
- for (let n of Qe(e, t)) n.includes("akn-pastille-table") || c.push(n);
825
+ contextClass: lt(a.label)
826
+ }), ...G(e, t)];
827
+ c.push(Ye(r));
828
+ for (let n of et(e, t)) n.includes("akn-pastille-table") || c.push(n);
813
829
  return c.push(`</${n}>`), c.join("\n");
814
830
  }
815
831
  c.push(o);
816
832
  }
817
833
  let l = [];
818
834
  for (let n of ["content", "children"]) e(t).children().each((t, r) => {
819
- if (!A(r)) return;
820
- let i = V(r);
835
+ if (!M(r)) return;
836
+ let i = B(r);
821
837
  i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(H(e, r));
822
838
  });
823
839
  let u = l.join("\n");
824
840
  if (i !== "article") {
825
- let n = Ge(u, E(e(t).children("num").first().text())) ? "" : We(e, t);
841
+ let n = Ke(u, E(e(t).children("num").first().text())) ? "" : Ge(e, t);
826
842
  n && c.push(n);
827
843
  }
828
- return c.push(o ? qe(u, o) : u), c.push(`</${n}>`), c.join("\n");
844
+ return c.push(o ? Je(u, o) : u), c.push(`</${n}>`), c.join("\n");
829
845
  }
830
- function $e(e, t, n, r) {
831
- let i = et(e(t).attr("style") ?? "", "font-family");
832
- return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = Ue(i, "text-align", "center")), i || void 0;
846
+ function tt(e, t, n, r) {
847
+ let i = nt(e(t).attr("style") ?? "", "font-family");
848
+ return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = We(i, "text-align", "center")), i || void 0;
833
849
  }
834
- function et(e, t) {
850
+ function nt(e, t) {
835
851
  return e.split(";").map((e) => e.trim()).filter(Boolean).filter((e) => !e.toLowerCase().startsWith(`${t.toLowerCase()}:`)).join(";");
836
852
  }
837
- function tt(e) {
853
+ function rt(e) {
838
854
  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>`;
839
855
  }
840
- function nt(e, t, n) {
841
- let r = E(e(t).children("num").first().text()), i = E(e(t).children("heading").first().text()), a = rt(n), o = [];
842
- return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${B(r)}</span></p>`), i && o.push(`<p class="${a.heading} as-text dispositif"><span aria-label="">${B(i)}</span></p>`), o.join("\n");
856
+ function it(e, t, n) {
857
+ let r = E(e(t).children("num").first().text()), i = E(e(t).children("heading").first().text()), a = at(n), o = [];
858
+ return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${R(r)}</span></p>`), i && o.push(`<p class="${a.heading} as-text dispositif"><span aria-label="">${R(i)}</span></p>`), o.join("\n");
843
859
  }
844
- function rt(e) {
860
+ function at(e) {
845
861
  switch (e) {
846
862
  case "part": return {
847
863
  num: "TCNumPartie",
@@ -865,21 +881,21 @@ function rt(e) {
865
881
  };
866
882
  }
867
883
  }
868
- function it(e, t) {
869
- let n = ot(E(e(t).children("num").first().text()));
884
+ function ot(e, t) {
885
+ let n = ct(E(e(t).children("num").first().text()));
870
886
  if (n) return n;
871
887
  for (let n of e(t).parents().get()) {
872
- if (!A(n)) continue;
873
- let t = V(n);
888
+ if (!M(n)) continue;
889
+ let t = B(n);
874
890
  if (t !== "title" && t !== "part") continue;
875
- let r = ot(E(e(n).children("num").first().text()));
891
+ let r = ct(E(e(n).children("num").first().text()));
876
892
  if (r) return r;
877
893
  }
878
894
  }
879
- function at(e, t) {
880
- return it(e, t);
895
+ function st(e, t) {
896
+ return ot(e, t);
881
897
  }
882
- function ot(e) {
898
+ function ct(e) {
883
899
  let [t, ...n] = E(e).split(/\s+/u);
884
900
  if (!t || n.length === 0) return;
885
901
  let r = t.toLocaleLowerCase("fr-FR");
@@ -890,10 +906,10 @@ function ot(e) {
890
906
  "section"
891
907
  ].includes(r)) return `${r}-${n.join("_")}`;
892
908
  }
893
- function st(e) {
909
+ function lt(e) {
894
910
  return `article-${E(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
895
911
  }
896
- function ct(e) {
912
+ function ut(e) {
897
913
  switch (e) {
898
914
  case "part": return "partie";
899
915
  case "book": return "livre";
@@ -905,11 +921,11 @@ function ct(e) {
905
921
  default: return;
906
922
  }
907
923
  }
908
- function lt(e, t) {
924
+ function dt(e, t) {
909
925
  return [E(e(t).children("num").first().text()), E(e(t).children("heading").first().text())].filter(Boolean).join(" ");
910
926
  }
911
- function ut(e, t) {
912
- let n = E(e(t).children("num").first().text()), r = E(e(t).children("heading").first().text()), i = M(n) ?? {
927
+ function ft(e, t) {
928
+ let n = E(e(t).children("num").first().text()), r = E(e(t).children("heading").first().text()), i = P(n) ?? {
913
929
  label: n,
914
930
  num: n
915
931
  };
@@ -919,24 +935,24 @@ function ut(e, t) {
919
935
  type: "article"
920
936
  };
921
937
  }
922
- function dt(e, t) {
938
+ function pt(e, t) {
923
939
  t.articles?.length && (e.articles ??= [], e.articles.push(...t.articles)), t.divisions?.length && (e.divisions ??= [], e.divisions.push(...t.divisions));
924
940
  }
925
- function J(e, t) {
941
+ function q(e, t) {
926
942
  let n = {};
927
943
  return e(t).children().each((t, r) => {
928
- if (!A(r)) return;
929
- let i = V(r);
944
+ if (!M(r)) return;
945
+ let i = B(r);
930
946
  if (i === "article") {
931
- n.articles ??= [], n.articles.push(ut(e, r));
947
+ n.articles ??= [], n.articles.push(ft(e, r));
932
948
  return;
933
949
  }
934
- let a = ct(i);
950
+ let a = ut(i);
935
951
  if (!a) {
936
- dt(n, J(e, r));
952
+ pt(n, q(e, r));
937
953
  return;
938
954
  }
939
- let o = lt(e, r), s = J(e, r);
955
+ let o = dt(e, r), s = q(e, r);
940
956
  !o && !s.articles?.length && !s.divisions?.length || (n.divisions ??= [], n.divisions.push({
941
957
  ...s,
942
958
  id: e(r).attr("eId") ?? e(r).attr("GUID"),
@@ -945,26 +961,26 @@ function J(e, t) {
945
961
  }));
946
962
  }), n;
947
963
  }
948
- function ft(e) {
964
+ function mt(e) {
949
965
  let t = e("body").first().get(0);
950
- return t === void 0 ? {} : J(e, t);
966
+ return t === void 0 ? {} : q(e, t);
951
967
  }
952
- function pt(e) {
968
+ function ht(e) {
953
969
  return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
954
970
  }
955
- function mt(e) {
971
+ function gt(e) {
956
972
  let t = e("preamble").first(), n = e("body").first(), r = ["<div class=\"akn-bill\">"];
957
- return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(ze(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
958
- A(n) && r.push(V(n) === "article" ? q(e, n, "article", "akn-article") : H(e, n));
973
+ return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(V(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
974
+ M(n) && r.push(B(n) === "article" ? K(e, n, "article", "akn-article") : H(e, n));
959
975
  }), r.push("</section></div>"), r.join("\n");
960
976
  }
961
- function ht(t) {
977
+ function _t(t) {
962
978
  let n = e(t, { xml: {
963
979
  decodeEntities: !1,
964
980
  lowerCaseTags: !1,
965
981
  lowerCaseAttributeNames: !1,
966
982
  xmlMode: !0
967
- } }), r = pt(n), i = mt(n);
983
+ } }), r = ht(n), i = gt(n);
968
984
  return {
969
985
  sourceFormat: "akoma-ntoso",
970
986
  documentDate: r,
@@ -972,42 +988,42 @@ function ht(t) {
972
988
  linkedHtml: i
973
989
  };
974
990
  }
975
- function gt(t) {
976
- return _t(e(t));
991
+ function vt(t) {
992
+ return yt(e(t));
977
993
  }
978
- function _t(e) {
994
+ function yt(e) {
979
995
  let t = [];
980
996
  return e("article.akn-article").each((n, r) => {
981
- let i = e(r).children("p.TCNumArticle").first().get(0), a = E(i ? e(i).text() : ""), o = M(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = L(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
997
+ let i = e(r).children("p.TCNumArticle").first().get(0), a = E(i ? e(i).text() : ""), o = P(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = ve(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
982
998
  t.push({
983
999
  id: s,
984
1000
  label: o.label,
985
1001
  num: o.num,
986
1002
  title: o.title,
987
- text: me(e, c),
988
- html: j(e, r),
1003
+ text: fe(e, c),
1004
+ html: N(e, r),
989
1005
  directiveText: u,
990
1006
  blocks: l
991
1007
  });
992
1008
  }), t;
993
1009
  }
994
- function vt(t) {
1010
+ function bt(t) {
995
1011
  let n = e(t);
996
1012
  return {
997
- articles: _t(n),
1013
+ articles: yt(n),
998
1014
  htmlWithLinks: n.html()
999
1015
  };
1000
1016
  }
1001
- async function yt(t, n) {
1017
+ async function xt(t, n) {
1002
1018
  let r = new u("parseAkomaNtosoBillRaw"), i = r.timeSync("cheerioLoadXml", () => e(t, { xml: {
1003
1019
  decodeEntities: !1,
1004
1020
  lowerCaseTags: !1,
1005
1021
  lowerCaseAttributeNames: !1,
1006
1022
  xmlMode: !0
1007
- } })), a = n.date ?? pt(i), o = r.timeSync("renderAknHtml", () => mt(i), { inputSize: t.length }), s = n.linkedHtml ?? await r.time("addLinksToRenderedAknHtml", () => N(o, {
1023
+ } })), a = n.date ?? ht(i), o = r.timeSync("renderAknHtml", () => gt(i), { inputSize: t.length }), s = n.linkedHtml ?? await r.time("addLinksToRenderedAknHtml", () => F(o, {
1008
1024
  ...n,
1009
1025
  date: a
1010
- }, a)), c = r.timeSync("extractRenderedAknArticles", () => gt(o)), l = r.timeSync("injectHiddenArticleSummary", () => R(s, c)), { articles: d, htmlWithLinks: f } = r.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => vt(l)), p = d.length > 0 ? d : c, m = r.timeSync("extractAknTableOfContents", () => ft(i)), h = r.timeSync("buildParsedDocument", () => Ne("akoma-ntoso", o, d.length > 0 ? f : l, a, p, m));
1026
+ }, a)), c = r.timeSync("extractRenderedAknArticles", () => vt(o)), l = r.timeSync("injectHiddenArticleSummary", () => ye(s, c)), { articles: d, htmlWithLinks: f } = r.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => bt(l)), p = d.length > 0 ? d : c, m = r.timeSync("extractAknTableOfContents", () => mt(i)), h = r.timeSync("buildParsedDocument", () => Ie("akoma-ntoso", o, d.length > 0 ? f : l, a, p, m));
1011
1027
  return r.log({
1012
1028
  articleCount: h.articles.length,
1013
1029
  blockCount: h.articles.reduce((e, t) => e + t.blocks.length, 0),
@@ -1015,25 +1031,25 @@ async function yt(t, n) {
1015
1031
  targetDirectiveCount: h.directives.filter((e) => e.targetIds !== void 0).length
1016
1032
  }), h;
1017
1033
  }
1018
- async function bt(e, t) {
1019
- let n = ht(e), r = t.date ?? n.documentDate;
1034
+ async function St(e, t) {
1035
+ let n = _t(e), r = t.date ?? n.documentDate;
1020
1036
  return {
1021
1037
  sourceFormat: "akoma-ntoso",
1022
1038
  documentDate: r,
1023
1039
  html: n.html,
1024
- linkedHtml: await N(n.html, t, r)
1040
+ linkedHtml: await F(n.html, t, r)
1025
1041
  };
1026
1042
  }
1027
1043
  //#endregion
1028
1044
  //#region src/lib/server/assemblee_document_search.ts
1029
- var xt = /\bexpos[ée]\s+des\s+motifs\b/giu, St = /\barticle\s+(?:premier|1er|\d+)/iu;
1030
- function Y(e) {
1045
+ var Ct = /\bexpos[ée]\s+des\s+motifs\b/giu, wt = /\barticle\s+(?:premier|1er|\d+)/iu;
1046
+ function J(e) {
1031
1047
  return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
1032
1048
  }
1033
- function Ct(t) {
1034
- let n = Y(e(t).text()), r = [...n.matchAll(xt)], i = /* @__PURE__ */ new Set(), a = [];
1049
+ function Y(t) {
1050
+ let n = J(e(t).text()), r = [...n.matchAll(Ct)], i = /* @__PURE__ */ new Set(), a = [];
1035
1051
  for (let [e, t] of r.entries()) {
1036
- let o = (t.index ?? 0) + t[0].length, s = n.slice(o), c = St.exec(s), l = Y(s.slice(0, c?.index ?? s.length));
1052
+ let o = (t.index ?? 0) + t[0].length, s = n.slice(o), c = wt.exec(s), l = J(s.slice(0, c?.index ?? s.length));
1037
1053
  if (l.length < 20 || i.has(l)) continue;
1038
1054
  i.add(l);
1039
1055
  let u = `expose-des-motifs-${e + 1}`;
@@ -1049,8 +1065,8 @@ function Ct(t) {
1049
1065
  }
1050
1066
  return a;
1051
1067
  }
1052
- async function wt({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
1053
- let i = await Fe(t, {
1068
+ async function Tt({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
1069
+ let i = await Re(t, {
1054
1070
  date: e,
1055
1071
  includeDirectiveAnalysis: !1,
1056
1072
  linkBaseUrl: n,
@@ -1059,7 +1075,7 @@ async function wt({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
1059
1075
  });
1060
1076
  return {
1061
1077
  items: [...i.articles.map((e) => {
1062
- let t = Y(e.directiveText || e.text);
1078
+ let t = J(e.directiveText || e.text);
1063
1079
  if (t) return {
1064
1080
  anchor: e.id,
1065
1081
  articleNumber: e.num ?? null,
@@ -1069,17 +1085,17 @@ async function wt({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
1069
1085
  label: e.label,
1070
1086
  title: e.title ?? null
1071
1087
  };
1072
- }).filter((e) => e !== void 0), ...Ct(t)],
1088
+ }).filter((e) => e !== void 0), ...Y(t)],
1073
1089
  tableOfContents: i.tableOfContents
1074
1090
  };
1075
1091
  }
1076
- function Tt(e, t) {
1092
+ function Et(e, t) {
1077
1093
  return h("sha256").update(JSON.stringify({
1078
1094
  item: e,
1079
1095
  metadata: t
1080
1096
  })).digest("hex");
1081
1097
  }
1082
- function Et(e) {
1098
+ function Dt(e) {
1083
1099
  if (typeof e != "object" || !e) return;
1084
1100
  let t = e.cycleDeVie?.chrono;
1085
1101
  if (t !== void 0) for (let e of [
@@ -1094,11 +1110,11 @@ function Et(e) {
1094
1110
  }
1095
1111
  //#endregion
1096
1112
  //#region src/lib/server/senat_amendment_search.ts
1097
- function Dt(t) {
1113
+ function Ot(t) {
1098
1114
  return t?.trim() ? e(t).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
1099
1115
  }
1100
- function Ot({ dispositifHtml: e, objetHtml: t }) {
1101
- let n = Dt(e), r = Dt(t);
1116
+ function kt({ dispositifHtml: e, objetHtml: t }) {
1117
+ let n = Ot(e), r = Ot(t);
1102
1118
  return [...n ? [{
1103
1119
  content: n,
1104
1120
  itemKind: "dispositif",
@@ -1109,7 +1125,7 @@ function Ot({ dispositifHtml: e, objetHtml: t }) {
1109
1125
  label: "Objet"
1110
1126
  }] : []];
1111
1127
  }
1112
- function kt(e, t) {
1128
+ function At(e, t) {
1113
1129
  return h("sha256").update(JSON.stringify({
1114
1130
  item: e,
1115
1131
  metadata: t
@@ -1117,12 +1133,12 @@ function kt(e, t) {
1117
1133
  }
1118
1134
  //#endregion
1119
1135
  //#region src/lib/server/senat_document_search.ts
1120
- var At = /^article\s+(.+?)(?:\s*[::]\s*(.+))?$/iu;
1136
+ var jt = /^article\s+(.+?)(?:\s*[::]\s*(.+))?$/iu;
1121
1137
  function X(e) {
1122
1138
  return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
1123
1139
  }
1124
- function jt(e) {
1125
- let t = e.match(At);
1140
+ function Mt(e) {
1141
+ let t = e.match(jt);
1126
1142
  if (!t) return {
1127
1143
  articleNumber: null,
1128
1144
  label: e,
@@ -1135,7 +1151,7 @@ function jt(e) {
1135
1151
  title: r
1136
1152
  };
1137
1153
  }
1138
- function Mt(t) {
1154
+ function Nt(t) {
1139
1155
  let n = e(t), r = [], i = X(n("section.akn-preamble").text());
1140
1156
  return i && r.push({
1141
1157
  anchor: "senat-expose-des-motifs",
@@ -1146,7 +1162,7 @@ function Mt(t) {
1146
1162
  label: "Exposé des motifs",
1147
1163
  title: null
1148
1164
  }), n("article.akn-article").each((e, t) => {
1149
- let i = n(t), a = i.attr("id") || `akn-article-${e + 1}`, o = X(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = jt(o || s), l = i.clone();
1165
+ let i = n(t), a = i.attr("id") || `akn-article-${e + 1}`, o = X(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = Mt(o || s), l = i.clone();
1150
1166
  l.children("p.TCNumArticle").remove();
1151
1167
  let u = X(l.text());
1152
1168
  u && r.push({
@@ -1160,7 +1176,7 @@ function Mt(t) {
1160
1176
  });
1161
1177
  }), r;
1162
1178
  }
1163
- function Nt(e, t) {
1179
+ function Pt(e, t) {
1164
1180
  return h("sha256").update(JSON.stringify({
1165
1181
  item: e,
1166
1182
  metadata: t
@@ -1168,25 +1184,25 @@ function Nt(e, t) {
1168
1184
  }
1169
1185
  //#endregion
1170
1186
  //#region src/lib/server/senat_document_sources.ts
1171
- var Pt = new Set(["senat.fr", "www.senat.fr"]), Z = "https://www.senat.fr";
1172
- function Ft(e) {
1187
+ var Ft = new Set(["senat.fr", "www.senat.fr"]), Z = "https://www.senat.fr";
1188
+ function It(e) {
1173
1189
  return e?.trim() || void 0;
1174
1190
  }
1175
- function It(e) {
1191
+ function Lt(e) {
1176
1192
  try {
1177
1193
  let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`, Z);
1178
- return Pt.has(n.hostname.toLowerCase()) ? n : void 0;
1194
+ return Ft.has(n.hostname.toLowerCase()) ? n : void 0;
1179
1195
  } catch {
1180
1196
  return;
1181
1197
  }
1182
1198
  }
1183
- function Lt(e) {
1184
- let t = Ft(e);
1199
+ function Rt(e) {
1200
+ let t = It(e);
1185
1201
  if (t === void 0) return {
1186
1202
  publicUrl: null,
1187
1203
  status: "no_url"
1188
1204
  };
1189
- let n = It(t);
1205
+ let n = Lt(t);
1190
1206
  if (n === void 0) return {
1191
1207
  publicUrl: t,
1192
1208
  status: "unsupported_source"
@@ -1207,12 +1223,12 @@ function Lt(e) {
1207
1223
  status: "available"
1208
1224
  };
1209
1225
  }
1210
- function Rt(e) {
1226
+ function zt(e) {
1211
1227
  return /^\s*(?:<\?xml\b[^>]*>\s*)?<akomaNtoso[\s/>]/iu.test(e);
1212
1228
  }
1213
1229
  //#endregion
1214
1230
  //#region src/lib/alineas/alineas_numbers.ts
1215
- var zt = {
1231
+ var Bt = {
1216
1232
  "0150a855548f15a2af52ea057be53f5d": 1,
1217
1233
  "039826cf379b94afefe90b25c6045ca0": 1,
1218
1234
  "03a7e564b84662f4d957c51018e26244": 1,
@@ -20186,7 +20202,7 @@ var zt = {
20186
20202
  d16d29c923bd60c7b095b66c6058fe60: 1664,
20187
20203
  "1c14c2adf5cfda3220b2057160e10e91": 1665,
20188
20204
  e44c55ca1ac46ff46420686a466c9fc6: 1665
20189
- }, Bt = "\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", Vt = "\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", Ht = "\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", Ut = "\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", Wt = "\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", Gt = {
20205
+ }, Vt = "\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", Ht = "\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", Ut = "\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", Wt = "\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", Gt = "\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", Kt = {
20190
20206
  assnatetatagr: { bold: !0 },
20191
20207
  assnatetatagrgr: { bold: !0 },
20192
20208
  assnatetatatr: { bold: !0 },
@@ -20287,29 +20303,29 @@ var zt = {
20287
20303
  assnatxl67: { align: "center" },
20288
20304
  assnatenteteequilibre: { align: "center" }
20289
20305
  };
20290
- function Kt(e) {
20291
- let t = Object.keys(Gt).sort((e, t) => t.length - e.length);
20292
- for (let n of t) if (e.includes(n)) return Gt[n];
20306
+ function qt(e) {
20307
+ let t = Object.keys(Kt).sort((e, t) => t.length - e.length);
20308
+ for (let n of t) if (e.includes(n)) return Kt[n];
20293
20309
  return null;
20294
20310
  }
20295
- function qt(e) {
20311
+ function Jt(e) {
20296
20312
  return m.createHash("md5").update(e).digest("hex");
20297
20313
  }
20298
- function Jt(e) {
20314
+ function Yt(e) {
20299
20315
  return e ? /font-weight\s*:\s*(bold|[6-9]00|1000)/i.test(e) || /font-family\s*:\s*[^;]*\bBold\b/i.test(e) : !1;
20300
20316
  }
20301
- function Yt(e) {
20317
+ function Xt(e) {
20302
20318
  return e ? /font-style\s*:\s*italic/i.test(e) || /font-family\s*:\s*[^;]*\bItalic\b/i.test(e) : !1;
20303
20319
  }
20304
- function Xt(e) {
20320
+ function Zt(e) {
20305
20321
  if (!e || !/vertical-align\s*:\s*super/i.test(e)) return !1;
20306
20322
  let t = e.match(/font-size\s*:\s*([\d.]+)pt/i);
20307
20323
  return !(t && parseFloat(t[1]) < 8);
20308
20324
  }
20309
- function Zt(e) {
20325
+ function Qt(e) {
20310
20326
  return e ? /vertical-align\s*:\s*sub/i.test(e) : !1;
20311
20327
  }
20312
- function Qt(e) {
20328
+ function $t(e) {
20313
20329
  if (!e) return;
20314
20330
  let t = [
20315
20331
  "width",
@@ -20344,15 +20360,15 @@ function Qt(e) {
20344
20360
  }
20345
20361
  return n.length > 0 ? n.join("; ") : void 0;
20346
20362
  }
20347
- function $t(e, t) {
20363
+ function en(e, t) {
20348
20364
  return !!(e && /text-align\s*:\s*center/i.test(e) || t && /center/i.test(t));
20349
20365
  }
20350
- function en(e) {
20366
+ function tn(e) {
20351
20367
  if (!e) return null;
20352
20368
  let t = e.match(/text-align\s*:\s*(left|center|right|justify)/i);
20353
20369
  return t ? t[1].toLowerCase() : null;
20354
20370
  }
20355
- function tn(e) {
20371
+ function nn(e) {
20356
20372
  if (!e) return null;
20357
20373
  for (let [t, n] of [
20358
20374
  [/assnat1Tome|assnatAN1PARTIE/i, 1],
@@ -20364,7 +20380,7 @@ function tn(e) {
20364
20380
  ]) if (t.test(e)) return n;
20365
20381
  return null;
20366
20382
  }
20367
- function nn(t, n = {}) {
20383
+ function rn(t, n = {}) {
20368
20384
  let { keepAlignment: r = !0, removeEmptyParagraphs: i = !0, strictAlineas: a = !1 } = n, o = e(t, { xml: { decodeEntities: !1 } });
20369
20385
  o("style, script, meta, link").remove(), o(".assnatHeader, .assnatFooter, .assnatHeaderLeft, .assnatHeaderandFooter").remove(), o(".assnatFARSautApres, .assnatFARSautAvant, .assnatFARSautPageNiv0, .assnatFARSautPageNiv1, .assnatFARSautPageNiv1PG").remove(), o(".assnatFARTT08Bleu").each((e, t) => {
20370
20386
  let n = o(t).closest("table");
@@ -20390,7 +20406,7 @@ function nn(t, n = {}) {
20390
20406
  if (i.length !== 0 && !(n.parents("del").length > 0 || n.find("del img").length > 0) && !(i.parent("del").length > 0)) {
20391
20407
  let e = i.attr();
20392
20408
  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")) {
20393
- let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? qt(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
20409
+ let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? Jt(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
20394
20410
  n.replaceWith(`<span class="alinea"${i}></span>`);
20395
20411
  return;
20396
20412
  }
@@ -20409,7 +20425,7 @@ function nn(t, n = {}) {
20409
20425
  (!r || r === "\xA0") && n.remove();
20410
20426
  }), o("span[style*=\"display:block\"][style*=\"position:absolute\"]:not(.alinea)").remove(), o("del").remove();
20411
20427
  function s(e) {
20412
- let t = o(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = Jt(n) || r === "b" || r === "strong", a = Yt(n) || r === "i" || r === "em", s = Xt(n) || r === "sup", c = Zt(n) || r === "sub", l = t.attr("class") || "";
20428
+ let t = o(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = Yt(n) || r === "b" || r === "strong", a = Xt(n) || r === "i" || r === "em", s = Zt(n) || r === "sup", c = Qt(n) || r === "sub", l = t.attr("class") || "";
20413
20429
  return /bold/i.test(l) && (i = !0), /strongemphasis/i.test(l) ? i = !0 : /italic|emphasis/i.test(l) && (a = !0), {
20414
20430
  bold: i,
20415
20431
  italic: a,
@@ -20443,7 +20459,7 @@ function nn(t, n = {}) {
20443
20459
  l = e;
20444
20460
  }
20445
20461
  for (o("p").each((e, t) => {
20446
- let n = o(t), i = n.attr("class") || "", a = n.attr("style"), s = tn(i);
20462
+ let n = o(t), i = n.attr("class") || "", a = n.attr("style"), s = nn(i);
20447
20463
  if (i.includes("assnatFARCouvTitreD")) {
20448
20464
  let e = n.html() || "";
20449
20465
  n.replaceWith(`<p class="cover-subtitle">${e}</p>`);
@@ -20476,11 +20492,11 @@ function nn(t, n = {}) {
20476
20492
  let c = n.text().trim().startsWith("«");
20477
20493
  if (s && !c) {
20478
20494
  let e = o(`<h${s}>${n.html() || ""}</h${s}>`);
20479
- r && $t(a, i) && e.attr("align", "center"), n.replaceWith(e);
20495
+ r && en(a, i) && e.attr("align", "center"), n.replaceWith(e);
20480
20496
  } else {
20481
- let e = Kt(i), t;
20497
+ let e = qt(i), t;
20482
20498
  if (r) {
20483
- let n = en(a);
20499
+ let n = tn(a);
20484
20500
  n && n !== "justify" && n !== "left" ? t = n : e?.align && (t = e.align);
20485
20501
  }
20486
20502
  if (n.removeAttr("style").removeAttr("class"), t && n.attr("align", t), e?.bold) {
@@ -20490,7 +20506,7 @@ function nn(t, n = {}) {
20490
20506
  }
20491
20507
  }), o("h1, h2, h3, h4, h5, h6").each((e, t) => {
20492
20508
  let n = o(t), i = n.attr("style"), a = n.attr("class");
20493
- r && $t(i, a) ? (n.removeAttr("style").removeAttr("class"), n.attr("align", "center")) : n.removeAttr("style").removeAttr("class");
20509
+ r && en(i, a) ? (n.removeAttr("style").removeAttr("class"), n.attr("align", "center")) : n.removeAttr("style").removeAttr("class");
20494
20510
  }), o("a").each((e, t) => {
20495
20511
  let n = o(t), r = n.attr("href"), i = n.attr("id"), a = { ...t.attribs || {} };
20496
20512
  for (let e of Object.keys(a)) e !== "href" && e !== "id" && n.removeAttr(e);
@@ -20529,7 +20545,7 @@ function nn(t, n = {}) {
20529
20545
  }), o("br").each((e, t) => {
20530
20546
  o(t).removeAttr("style").removeAttr("class");
20531
20547
  }), o("table, tr, td, th, thead, tbody, tfoot").each((e, t) => {
20532
- let n = o(t), r = Qt(n.attr("style"));
20548
+ let n = o(t), r = $t(n.attr("style"));
20533
20549
  n.removeAttr("style").removeAttr("class"), r && n.attr("style", r);
20534
20550
  }), o("td, th").each((e, t) => {
20535
20551
  let n = o(t), r = n.children();
@@ -20547,17 +20563,17 @@ function nn(t, n = {}) {
20547
20563
  !isNaN(e) && e > 1 && n.attr("style", `counter-reset: list-counter ${e - 1}`), n.attr("start", r);
20548
20564
  }
20549
20565
  }), o("li").each((e, t) => {
20550
- let n = o(t), r = en(n.attr("style"));
20566
+ let n = o(t), r = tn(n.attr("style"));
20551
20567
  n.removeAttr("style").removeAttr("class"), r === "center" && n.attr("style", "text-align: center");
20552
20568
  let i = n.html() || "", a = i.replace(/^(\s|&#xa0;|&#160;|\u00a0)+/, "");
20553
20569
  a !== i && n.html(a);
20554
- }), rn(o), an(o, a);
20570
+ }), an(o), on(o, a);
20555
20571
  let u = o("body").html() || o.html(), d = u.includes("class=\"alinea"), f = o("ol").length > 0, p = o("h1, h2, h3, h4, h5, h6").length > 0, m = u.includes("class=\"expose-motifs"), h = u.includes("class=\"cover-title\"") || u.includes("class=\"cover-subtitle\"") || u.includes("class=\"cover-info\"") || u.includes("class=\"cover-year\""), g = "";
20556
- h && (g += Wt), p && (g += Vt), m && (g += Ht), d && (g += Bt), f && (g += Ut);
20572
+ h && (g += Gt), p && (g += Ht), m && (g += Ut), d && (g += Vt), f && (g += Wt);
20557
20573
  let _ = g ? `<style>${g}</style>\n${u}` : u;
20558
- 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"), i && (_ = _.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, ""), _ = on(_), _ = _.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(), _;
20574
+ 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"), i && (_ = _.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, ""), _ = sn(_), _ = _.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(), _;
20559
20575
  }
20560
- function rn(e) {
20576
+ function an(e) {
20561
20577
  e("span[id]").each((t, n) => {
20562
20578
  let r = e(n), i = r.attr("id"), a = n.attribs || {}, o = Object.keys(a);
20563
20579
  if (o.length !== 1 || o[0] !== "id") return;
@@ -20580,13 +20596,13 @@ function rn(e) {
20580
20596
  l.trim() === u.trim() && (s.attr("id", i), r.replaceWith(r.html() || ""));
20581
20597
  });
20582
20598
  }
20583
- function an(e, t = !1) {
20599
+ function on(e, t = !1) {
20584
20600
  let n = e("body");
20585
20601
  if (n.length === 0) return;
20586
20602
  let r = n.find("span.alinea[data-image-hash]"), i = -1;
20587
20603
  r.each((n, r) => {
20588
20604
  let a = e(r), o = a.attr("data-image-hash"), s;
20589
- if (o && zt[o] !== void 0 && (s = zt[o]), s === void 0) {
20605
+ if (o && Bt[o] !== void 0 && (s = Bt[o]), s === void 0) {
20590
20606
  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".`);
20591
20607
  a.remove();
20592
20608
  return;
@@ -20598,11 +20614,11 @@ function an(e, t = !1) {
20598
20614
  i = s, a.attr("data-alinea", String(s)), a.text(String(s)), a.removeAttr("data-image-hash");
20599
20615
  });
20600
20616
  }
20601
- function on(e) {
20617
+ function sn(e) {
20602
20618
  let t = e;
20603
20619
  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;
20604
20620
  }
20605
- function sn(e, t = {}) {
20621
+ function cn(e, t = {}) {
20606
20622
  return `<!DOCTYPE html>
20607
20623
  <html lang="fr">
20608
20624
  <head>
@@ -20610,7 +20626,7 @@ function sn(e, t = {}) {
20610
20626
  <title>Document simplifié</title>
20611
20627
  </head>
20612
20628
  <body>
20613
- ${nn(e, t)}
20629
+ ${rn(e, t)}
20614
20630
  </body>
20615
20631
  </html>`;
20616
20632
  }
@@ -20629,10 +20645,10 @@ function Q(e, t) {
20629
20645
  let { sourceMap: s, title: c } = g.readJsonSync(_.join(t, e), { encoding: "utf-8" });
20630
20646
  o.sourceMap = s ?? [], o.title = c;
20631
20647
  }
20632
- return cn(r, e), r;
20648
+ return ln(r, e), r;
20633
20649
  }
20634
- function cn(e, t) {
20635
- if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) cn(n, t), t = n.output;
20650
+ function ln(e, t) {
20651
+ if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) ln(n, t), t = n.output;
20636
20652
  return t;
20637
20653
  }
20638
20654
  function $(e, t, n = "1") {
@@ -20654,7 +20670,7 @@ function $(e, t, n = "1") {
20654
20670
  }
20655
20671
  //#endregion
20656
20672
  //#region src/lib/server/linkers/html.ts
20657
- async function ln({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, htmlFilePath: i, htmlTransformationsInputDir: c, htmlTransformationsOutputDir: l, htmlWithLinksFilePath: u, htmlWithLinksOrReferencesFilePath: d, htmlWithLinksTransformationsOutputDir: f, htmlWithReferencesFilePath: p, linkBaseUrl: m, linkType: h, logIgnoredReferencesTypes: _, logPartialReferences: v, logReferences: y, referredLegifranceTextsInfosFilePath: b }) {
20673
+ async function un({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, htmlFilePath: i, htmlTransformationsInputDir: c, htmlTransformationsOutputDir: l, htmlWithLinksFilePath: u, htmlWithLinksOrReferencesFilePath: d, htmlWithLinksTransformationsOutputDir: f, htmlWithReferencesFilePath: p, linkBaseUrl: m, linkType: h, logIgnoredReferencesTypes: _, logPartialReferences: v, logReferences: y, referredLegifranceTextsInfosFilePath: b }) {
20658
20674
  let x = t ?? (e === void 0 ? void 0 : new o(e));
20659
20675
  if (x === void 0) throw Error("A Canutes database or legal resolver is required");
20660
20676
  let S = await g.readFile(i, { encoding: "utf-8" }), C;
@@ -20687,7 +20703,7 @@ async function ln({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
20687
20703
  }
20688
20704
  //#endregion
20689
20705
  //#region src/lib/server/tables_of_contents.ts
20690
- async function un(e, n, r, i) {
20706
+ async function dn(e, n, r, i) {
20691
20707
  let a = Q(await g.readFile(e, { encoding: "utf-8" }), n), o = a.output, s = new p(o), c = await g.readJson(r, { encoding: "utf-8" });
20692
20708
  for await (let e of t({
20693
20709
  context: s,
@@ -20699,7 +20715,7 @@ async function un(e, n, r, i) {
20699
20715
  spaces: 2
20700
20716
  });
20701
20717
  }
20702
- async function dn(e, t, n) {
20718
+ async function fn(e, t, n) {
20703
20719
  let i = Q(await g.readFile(e, { encoding: "utf-8" }), t).output, a = r(i);
20704
20720
  await g.writeJson(n, a, {
20705
20721
  encoding: "utf-8",
@@ -20708,8 +20724,8 @@ async function dn(e, t, n) {
20708
20724
  }
20709
20725
  //#endregion
20710
20726
  //#region src/lib/server/legi/resolvers.ts
20711
- function fn({ canutesDb: e }) {
20727
+ function pn({ canutesDb: e }) {
20712
20728
  return new o(e);
20713
20729
  }
20714
20730
  //#endregion
20715
- export { f as LegiResolver, ln as addLinksOrReferencesToHtmlFile, un as addPositionsToTableOfContentsFile, d as buildAndInstallTextTitlesInfos, l as buildTextTitlesInfos, fn as createLegiResolver, x as extractAssembleeAmendmentSearchItems, Ct as extractAssembleeExposesDesMotifs, Ot as extractSenatAmendmentSearchItems, S as hashAssembleeAmendmentSearchItem, Tt as hashAssembleeSearchItem, kt as hashSenatAmendmentSearchItem, Nt as hashSenatSearchItem, Rt as isAkomaNtosoXml, Et as isoDateFromAssembleeDocument, bt as linkAkomaNtosoBillRaw, Ie as linkAssembleeBillRaw, yt as parseAkomaNtosoBillRaw, Fe as parseAssembleeBillRaw, wt as parseAssembleeDocumentSearchContent, Mt as parseSenatDocumentSearchContent, Q as readTransformation, ht as renderAkomaNtosoBillRaw, Lt as resolveSenatAkomaNtosoSource, dn as simplifiedHtmlBillFileToTableOfContentsFile, nn as simplifyWordHtml, sn as simplifyWordHtmlToDocument, $ as writeTransformation };
20731
+ export { f as LegiResolver, un as addLinksOrReferencesToHtmlFile, dn as addPositionsToTableOfContentsFile, d as buildAndInstallTextTitlesInfos, l as buildTextTitlesInfos, pn as createLegiResolver, x as extractAssembleeAmendmentSearchItems, Y as extractAssembleeExposesDesMotifs, kt as extractSenatAmendmentSearchItems, S as hashAssembleeAmendmentSearchItem, Et as hashAssembleeSearchItem, At as hashSenatAmendmentSearchItem, Pt as hashSenatSearchItem, zt as isAkomaNtosoXml, Dt as isoDateFromAssembleeDocument, St as linkAkomaNtosoBillRaw, ze as linkAssembleeBillRaw, xt as parseAkomaNtosoBillRaw, Re as parseAssembleeBillRaw, Tt as parseAssembleeDocumentSearchContent, Nt as parseSenatDocumentSearchContent, Q as readTransformation, _t as renderAkomaNtosoBillRaw, Rt as resolveSenatAkomaNtosoSource, fn as simplifiedHtmlBillFileToTableOfContentsFile, rn as simplifyWordHtml, cn as simplifyWordHtmlToDocument, $ as writeTransformation };