@tricoteuses/tisseuse 0.14.3 → 0.14.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{html-IERGWCi4.js → html-CsSi8pXx.js} +629 -582
- package/dist/index.js +1 -1
- package/dist/server.js +1 -1
- package/dist/src/lib/extractors/action_directives.d.ts +2 -0
- package/dist/src/lib/text_parsers/ast.d.ts +1 -0
- package/dist/src/lib/text_parsers/legal_text_aliases.d.ts +5 -2
- package/package.json +1 -1
|
@@ -10557,12 +10557,6 @@ var Qp = [
|
|
|
10557
10557
|
pattern: "cpi",
|
|
10558
10558
|
title: "Code de la propriété intellectuelle"
|
|
10559
10559
|
},
|
|
10560
|
-
{
|
|
10561
|
-
cid: "LEGITEXT000006070987",
|
|
10562
|
-
nature: "CODE",
|
|
10563
|
-
pattern: "cpce",
|
|
10564
|
-
title: "Code des postes et des communications électroniques"
|
|
10565
|
-
},
|
|
10566
10560
|
{
|
|
10567
10561
|
cid: "LEGITEXT000006072665",
|
|
10568
10562
|
nature: "CODE",
|
|
@@ -10584,7 +10578,24 @@ var Qp = [
|
|
|
10584
10578
|
], $p = Qp.map((e) => ({
|
|
10585
10579
|
alias: e,
|
|
10586
10580
|
regExp: RegExp(`^(?:${e.pattern})$`, "iv")
|
|
10587
|
-
})), em =
|
|
10581
|
+
})), em = "cpce", tm = {
|
|
10582
|
+
execution: {
|
|
10583
|
+
cid: "LEGITEXT000025024948",
|
|
10584
|
+
nature: "CODE",
|
|
10585
|
+
title: "Code des procédures civiles d'exécution"
|
|
10586
|
+
},
|
|
10587
|
+
postes: {
|
|
10588
|
+
cid: "LEGITEXT000006070987",
|
|
10589
|
+
nature: "CODE",
|
|
10590
|
+
title: "Code des postes et des communications électroniques"
|
|
10591
|
+
}
|
|
10592
|
+
}, nm = [{
|
|
10593
|
+
info: tm.execution,
|
|
10594
|
+
regExp: /code\s+des?\s+proc[eé]dures?\s+(?:civiles?\s+)?d['’]\s*ex(?:c)?[eé]cution/giu
|
|
10595
|
+
}, {
|
|
10596
|
+
info: tm.postes,
|
|
10597
|
+
regExp: /code\s+des\s+postes\s+et\s+(?:des?\s+)?communications?\s+[eé]lectroniques?/giu
|
|
10598
|
+
}], rm = `(?:${[...Qp.map(({ pattern: e }) => `(?:${e})`), em].join("|")})`, im = {
|
|
10588
10599
|
I: {
|
|
10589
10600
|
cid: "LEGITEXT000006069568",
|
|
10590
10601
|
nature: "CODE",
|
|
@@ -10606,122 +10617,140 @@ var Qp = [
|
|
|
10606
10617
|
title: "Code général des impôts, annexe IV"
|
|
10607
10618
|
}
|
|
10608
10619
|
};
|
|
10609
|
-
function
|
|
10610
|
-
let
|
|
10611
|
-
|
|
10612
|
-
|
|
10620
|
+
function am(e, t) {
|
|
10621
|
+
let n = [];
|
|
10622
|
+
for (let { info: r, regExp: i } of nm) {
|
|
10623
|
+
i.lastIndex = 0;
|
|
10624
|
+
for (let a of e.matchAll(i)) a.index <= t.start && n.push({
|
|
10625
|
+
index: a.index,
|
|
10626
|
+
info: r
|
|
10627
|
+
});
|
|
10628
|
+
}
|
|
10629
|
+
return n.sort((e, t) => t.index - e.index), n[0]?.info;
|
|
10630
|
+
}
|
|
10631
|
+
function om(e, t) {
|
|
10632
|
+
if (/^cpce$/iv.test(e)) return t === void 0 ? void 0 : am(t.input, t.position);
|
|
10633
|
+
let n = $p.find(({ regExp: t }) => t.test(e))?.alias;
|
|
10634
|
+
if (n === void 0) return;
|
|
10635
|
+
let { cid: r, nature: i, title: a } = n;
|
|
10613
10636
|
return {
|
|
10614
|
-
cid:
|
|
10615
|
-
nature:
|
|
10616
|
-
title:
|
|
10637
|
+
cid: r,
|
|
10638
|
+
nature: i,
|
|
10639
|
+
title: a
|
|
10617
10640
|
};
|
|
10618
10641
|
}
|
|
10619
|
-
function
|
|
10620
|
-
let
|
|
10621
|
-
|
|
10622
|
-
|
|
10642
|
+
function sm(e, t, n) {
|
|
10643
|
+
let r = om(e, n === void 0 ? void 0 : {
|
|
10644
|
+
input: n,
|
|
10645
|
+
position: t
|
|
10646
|
+
});
|
|
10647
|
+
return r === void 0 ? void 0 : {
|
|
10648
|
+
...r,
|
|
10623
10649
|
position: t,
|
|
10624
10650
|
type: "texte"
|
|
10625
10651
|
};
|
|
10626
10652
|
}
|
|
10627
|
-
var
|
|
10653
|
+
var cm = T(...Qp.map(({ pattern: e }) => C(`${e}(?=$|\\P{Alphabetic})`, {
|
|
10628
10654
|
flags: "iv",
|
|
10629
|
-
value: (e, t) =>
|
|
10630
|
-
})))
|
|
10655
|
+
value: (e, t) => sm(e[0], t.position(), t.input)
|
|
10656
|
+
})), C(`${em}(?=$|\\P{Alphabetic})`, {
|
|
10657
|
+
flags: "iv",
|
|
10658
|
+
value: (e, t) => sm(e[0], t.position(), t.input)
|
|
10659
|
+
}));
|
|
10631
10660
|
//#endregion
|
|
10632
10661
|
//#region src/lib/text_parsers/doctrinal_references.ts
|
|
10633
|
-
function
|
|
10662
|
+
function lm(e, t) {
|
|
10634
10663
|
let n = e.indices?.groups?.[t];
|
|
10635
10664
|
return n === void 0 ? void 0 : {
|
|
10636
10665
|
start: n[0],
|
|
10637
10666
|
stop: n[1]
|
|
10638
10667
|
};
|
|
10639
10668
|
}
|
|
10640
|
-
function
|
|
10641
|
-
let
|
|
10642
|
-
if (
|
|
10643
|
-
let
|
|
10644
|
-
if (
|
|
10645
|
-
let
|
|
10646
|
-
if (
|
|
10647
|
-
let
|
|
10648
|
-
if (
|
|
10649
|
-
let
|
|
10650
|
-
num:
|
|
10669
|
+
function um(e, t) {
|
|
10670
|
+
let n = e.groups?.article?.trim(), r = e.groups?.text;
|
|
10671
|
+
if (n === void 0 || r === void 0) return;
|
|
10672
|
+
let i = lm(e, "articleKeyword");
|
|
10673
|
+
if (i === void 0 && !/^(?:(?:L\.?\s*O|[LRDA])\*?\.?\s*)\d/iu.test(n)) return;
|
|
10674
|
+
let a = n.match(/^(?<article>.*\d(?:[\p{L}\d-]*))\s+(?<subdivision>[IVXLCDM]+(?:\s+(?:bis|ter|quater))?|\d+\s*(?:°|º))$/iu)?.groups?.article?.trim() ?? n, o = Jt(a), s = lm(e, "article"), c = lm(e, "text");
|
|
10675
|
+
if (o === void 0 || s === void 0 || c === void 0) return;
|
|
10676
|
+
let l = sm(r, c, t.input);
|
|
10677
|
+
if (l === void 0) return;
|
|
10678
|
+
let u = {
|
|
10679
|
+
num: o,
|
|
10651
10680
|
position: {
|
|
10652
|
-
start:
|
|
10653
|
-
stop:
|
|
10681
|
+
start: i?.start ?? s.start,
|
|
10682
|
+
stop: s.stop - (n.length - a.length)
|
|
10654
10683
|
},
|
|
10655
10684
|
type: "article"
|
|
10656
10685
|
};
|
|
10657
10686
|
return {
|
|
10658
|
-
child:
|
|
10659
|
-
parent:
|
|
10687
|
+
child: u,
|
|
10688
|
+
parent: l,
|
|
10660
10689
|
position: {
|
|
10661
|
-
start: Math.min(
|
|
10662
|
-
stop: Math.max(
|
|
10690
|
+
start: Math.min(l.position.start, u.position.start),
|
|
10691
|
+
stop: Math.max(l.position.stop, u.position.stop)
|
|
10663
10692
|
},
|
|
10664
10693
|
type: "parent-enfant"
|
|
10665
10694
|
};
|
|
10666
10695
|
}
|
|
10667
|
-
var
|
|
10696
|
+
var dm = C(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
10668
10697
|
flags: "i",
|
|
10669
10698
|
value: (e, t) => {
|
|
10670
|
-
let n =
|
|
10699
|
+
let n = im[e[1].toUpperCase()];
|
|
10671
10700
|
return n === void 0 ? void 0 : {
|
|
10672
10701
|
...n,
|
|
10673
10702
|
position: t.position(),
|
|
10674
10703
|
type: "texte"
|
|
10675
10704
|
};
|
|
10676
10705
|
}
|
|
10677
|
-
}),
|
|
10706
|
+
}), fm = o(Qt, { value: (e, t) => ({
|
|
10678
10707
|
num: e,
|
|
10679
10708
|
position: t.position(),
|
|
10680
10709
|
type: "article"
|
|
10681
|
-
}) }),
|
|
10710
|
+
}) }), pm = x([C(String.raw`\s*,\s*art(?:icle)?\.?\s+`, { flags: "i" }), fm], { value: (e) => e[1] }), mm = x([
|
|
10682
10711
|
w(C(String.raw`(?:le|la|les)\s+`, { flags: "i" }), { default: "" }),
|
|
10683
|
-
T(
|
|
10684
|
-
|
|
10712
|
+
T(dm, cm),
|
|
10713
|
+
pm
|
|
10685
10714
|
], { value: (e, t) => ({
|
|
10686
10715
|
child: e[2],
|
|
10687
10716
|
parent: e[1],
|
|
10688
10717
|
position: t.position(),
|
|
10689
10718
|
type: "parent-enfant"
|
|
10690
|
-
}) }),
|
|
10719
|
+
}) }), hm = C(String.raw`(?:(?<articleKeyword>articles?)\s+)?(?<article>\S[^\n,;:\(\)]*?)\s+(?:(?:du|de\s+la|de\s+l['’])\s+)?(?<text>${rm})(?=$|\P{Alphabetic})`, {
|
|
10691
10720
|
flags: "div",
|
|
10692
|
-
value: (e) =>
|
|
10693
|
-
}),
|
|
10721
|
+
value: (e, t) => um(e, t)
|
|
10722
|
+
}), gm = C(String.raw`(?<article1>(?:(?:L\.?\s*O|[LRDA])\*?\.?\s*)\d[^\n,;:\(\)]*?)\s+(?<coordinator>et|ou)\s+(?<article2>(?:(?:L\.?\s*O|[LRDA])\*?\.?\s*)\d[^\n,;:\(\)]*?)\s+(?:(?:du|de\s+la|de\s+l['’])\s+)?(?<text>${rm})(?=$|\P{Alphabetic})`, {
|
|
10694
10723
|
flags: "div",
|
|
10695
|
-
value: (e) => {
|
|
10696
|
-
let
|
|
10697
|
-
if (!(
|
|
10724
|
+
value: (e, t) => {
|
|
10725
|
+
let n = lm(e, "article1"), r = lm(e, "article2"), i = lm(e, "text"), a = e.groups?.article1, o = e.groups?.article2, s = e.groups?.coordinator, c = a === void 0 ? void 0 : Jt(a.trim()), l = o === void 0 ? void 0 : Jt(o.trim()), u = e.groups?.text === void 0 || i === void 0 ? void 0 : sm(e.groups.text, i, t.input);
|
|
10726
|
+
if (!(n === void 0 || r === void 0 || c === void 0 || l === void 0 || s !== "et" && s !== "ou" || u === void 0)) return {
|
|
10698
10727
|
child: {
|
|
10699
|
-
coordinator:
|
|
10728
|
+
coordinator: s,
|
|
10700
10729
|
left: {
|
|
10701
|
-
num:
|
|
10702
|
-
position:
|
|
10730
|
+
num: c,
|
|
10731
|
+
position: n,
|
|
10703
10732
|
type: "article"
|
|
10704
10733
|
},
|
|
10705
10734
|
position: {
|
|
10706
|
-
start:
|
|
10707
|
-
stop:
|
|
10735
|
+
start: n.start,
|
|
10736
|
+
stop: r.stop
|
|
10708
10737
|
},
|
|
10709
10738
|
right: {
|
|
10710
|
-
num:
|
|
10711
|
-
position:
|
|
10739
|
+
num: l,
|
|
10740
|
+
position: r,
|
|
10712
10741
|
type: "article"
|
|
10713
10742
|
},
|
|
10714
10743
|
type: "enumeration"
|
|
10715
10744
|
},
|
|
10716
|
-
parent:
|
|
10745
|
+
parent: u,
|
|
10717
10746
|
position: {
|
|
10718
|
-
start:
|
|
10719
|
-
stop:
|
|
10747
|
+
start: n.start,
|
|
10748
|
+
stop: u.position.stop
|
|
10720
10749
|
},
|
|
10721
10750
|
type: "parent-enfant"
|
|
10722
10751
|
};
|
|
10723
10752
|
}
|
|
10724
|
-
}),
|
|
10753
|
+
}), _m = T(mm, gm, hm), vm = (e) => {
|
|
10725
10754
|
let t = e.offset, n = /,\s*(?:par\s+)?/guy;
|
|
10726
10755
|
if (n.lastIndex = t, !n.exec(e.input)) return;
|
|
10727
10756
|
e.offset = n.lastIndex;
|
|
@@ -10737,7 +10766,7 @@ var sm = C(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
|
10737
10766
|
}
|
|
10738
10767
|
return e.offset = i.lastIndex, e.length = 0, e.usedInputs = e.input.slice(t, e.offset), r;
|
|
10739
10768
|
};
|
|
10740
|
-
function
|
|
10769
|
+
function ym(e) {
|
|
10741
10770
|
for (let t = 0; t < e.length; t += 1) {
|
|
10742
10771
|
let r = t === 0 ? void 0 : e[t - 1];
|
|
10743
10772
|
if (r && /[\p{L}\p{N}_]/u.test(r)) continue;
|
|
@@ -10746,7 +10775,7 @@ function hm(e) {
|
|
|
10746
10775
|
}
|
|
10747
10776
|
return null;
|
|
10748
10777
|
}
|
|
10749
|
-
function
|
|
10778
|
+
function bm(e, t) {
|
|
10750
10779
|
let r = e.slice(0, Math.max(0, t)), i = /(?:^|[^\p{L}\p{N}_])les\s+/giu, a = null;
|
|
10751
10780
|
for (; i.exec(r) !== null;) {
|
|
10752
10781
|
let e = new n(r, i.lastIndex), t = Ae(e);
|
|
@@ -10754,7 +10783,7 @@ function gm(e, t) {
|
|
|
10754
10783
|
}
|
|
10755
10784
|
return a;
|
|
10756
10785
|
}
|
|
10757
|
-
function
|
|
10786
|
+
function xm(e) {
|
|
10758
10787
|
let t = [], r = /(?:,\s*)?par\s+/giu, i = 0, a;
|
|
10759
10788
|
for (; (a = r.exec(e)) !== null;) {
|
|
10760
10789
|
let o = new n(e, r.lastIndex);
|
|
@@ -10766,17 +10795,17 @@ function _m(e) {
|
|
|
10766
10795
|
}
|
|
10767
10796
|
//#endregion
|
|
10768
10797
|
//#region src/lib/text_parsers/actions.ts
|
|
10769
|
-
var
|
|
10798
|
+
var Sm = (e) => x([
|
|
10770
10799
|
C(e, { flags: "i" }),
|
|
10771
|
-
|
|
10800
|
+
vm,
|
|
10772
10801
|
C(e === "est" ? "remplacée?" : "remplacée?s", { flags: "i" })
|
|
10773
|
-
], { value: "remplacer" }),
|
|
10802
|
+
], { value: "remplacer" }), Cm = T(ee(C("(modalités|conditions) d'application (de )?", { flags: "i" }), {
|
|
10774
10803
|
lookbackLength: 35,
|
|
10775
10804
|
value: { action: "précision" }
|
|
10776
10805
|
}), ee(C("en application (de )?", { flags: "i" }), {
|
|
10777
10806
|
lookbackLength: 35,
|
|
10778
10807
|
value: { action: "application" }
|
|
10779
|
-
})),
|
|
10808
|
+
})), wm = i("après|avant|ajoutée?s?|insérée?s?|complétée?s?|rédigée?s?|suit|modifiée?s?|rétablie?s?|remplacée?s?|supprimée?s?|abrogée?s?|devient", T(x([
|
|
10780
10809
|
b,
|
|
10781
10810
|
C("est complété par les mots ?", { flags: "i" }),
|
|
10782
10811
|
C(" ?:"),
|
|
@@ -10844,7 +10873,7 @@ var vm = (e) => x([
|
|
|
10844
10873
|
}), C("est rétablie? (ainsi qu'il|comme) suit", {
|
|
10845
10874
|
flags: "i",
|
|
10846
10875
|
value: "rétablir"
|
|
10847
|
-
}),
|
|
10876
|
+
}), Sm("est"), C("est remplacée?", {
|
|
10848
10877
|
flags: "i",
|
|
10849
10878
|
value: "remplacer"
|
|
10850
10879
|
}), C("sont ainsi modifiée?s", {
|
|
@@ -10859,7 +10888,7 @@ var vm = (e) => x([
|
|
|
10859
10888
|
}), C("sont rétablie?s (ainsi qu'il|comme) suit", {
|
|
10860
10889
|
flags: "i",
|
|
10861
10890
|
value: "rétablir"
|
|
10862
|
-
}),
|
|
10891
|
+
}), Sm("sont"), C("sont remplacée?s", {
|
|
10863
10892
|
flags: "i",
|
|
10864
10893
|
value: "remplacer"
|
|
10865
10894
|
}), C("sont renum[eé]rotée?s", {
|
|
@@ -10879,7 +10908,7 @@ var vm = (e) => x([
|
|
|
10879
10908
|
}), C("est remplacée?", {
|
|
10880
10909
|
flags: "i",
|
|
10881
10910
|
value: "remplacer"
|
|
10882
|
-
}),
|
|
10911
|
+
}), Sm("est"), Sm("sont"), C("sont remplacée?s", {
|
|
10883
10912
|
flags: "i",
|
|
10884
10913
|
value: "remplacer"
|
|
10885
10914
|
}), C("est modifiée?", {
|
|
@@ -11039,23 +11068,23 @@ var vm = (e) => x([
|
|
|
11039
11068
|
}), C("est supprimée?", {
|
|
11040
11069
|
flags: "i",
|
|
11041
11070
|
value: "supprimer"
|
|
11042
|
-
}))], { value: (e) => ({ action: e[1] }) }))),
|
|
11071
|
+
}))], { value: (e) => ({ action: e[1] }) }))), Tm = T(un, wn), Em = T(fn, xn, cm, he), Dm = x([Tm, _(x([le, Em], { value: (e) => e[1] }))], { value: (e, t) => _t(e[0], e[1], t.position()) }), Om = x([Em, _(x([le, Em], { value: (e) => e[1] }))], { value: (e, t) => _t(e[0], e[1], t.position()) }), km = x([se, Dm], { value: (e) => e[1] }), Am = T(x([le, Om], { value: (e) => e[1] }), km), jm = T(x([Ht, w(Am, { default: null })], { value: (e) => {
|
|
11043
11072
|
let t = e[0], n = e[1];
|
|
11044
11073
|
return n === null ? t : mt(n, t);
|
|
11045
|
-
} }),
|
|
11074
|
+
} }), Dm), Mm = T(x([Ut, w(Am, { default: null })], { value: (e) => {
|
|
11046
11075
|
let t = e[0], n = e[1];
|
|
11047
11076
|
return n === null ? t : mt(n, t);
|
|
11048
|
-
} }),
|
|
11049
|
-
w(
|
|
11077
|
+
} }), Om), Nm = x([
|
|
11078
|
+
w(Cm, { default: null }),
|
|
11050
11079
|
x([
|
|
11051
11080
|
p,
|
|
11052
|
-
|
|
11081
|
+
jm,
|
|
11053
11082
|
w([w(C(" modifiée?s", { flags: "i" }), { default: "" }), C(" susvisée?s", { flags: "i" })], { default: "" })
|
|
11054
11083
|
], { value: (e, t) => ({
|
|
11055
11084
|
...e[1],
|
|
11056
11085
|
position: t.position()
|
|
11057
11086
|
}) }),
|
|
11058
|
-
w(
|
|
11087
|
+
w(wm, { default: null })
|
|
11059
11088
|
], { value: (e, t) => {
|
|
11060
11089
|
let n = e[2] ?? e[0];
|
|
11061
11090
|
return n === null ? e[1] : {
|
|
@@ -11064,18 +11093,18 @@ var vm = (e) => x([
|
|
|
11064
11093
|
reference: e[1],
|
|
11065
11094
|
type: "reference_et_action"
|
|
11066
11095
|
};
|
|
11067
|
-
} }),
|
|
11068
|
-
w(
|
|
11096
|
+
} }), Pm = T(x([
|
|
11097
|
+
w(Cm, { default: null }),
|
|
11069
11098
|
x([
|
|
11070
11099
|
ce,
|
|
11071
|
-
|
|
11100
|
+
Mm,
|
|
11072
11101
|
w([w(C(" modifiée?", { flags: "i" }), { default: "" }), C(" susvisée?", { flags: "i" })], { default: "" }),
|
|
11073
11102
|
w(C(String.raw`, ?qui devient [^,]+ ","`, { flags: "i" }), { default: "" })
|
|
11074
11103
|
], { value: (e, t) => ({
|
|
11075
11104
|
...e[1],
|
|
11076
11105
|
position: t.position()
|
|
11077
11106
|
}) }),
|
|
11078
|
-
w(
|
|
11107
|
+
w(wm, { default: null })
|
|
11079
11108
|
], { value: (e, t) => {
|
|
11080
11109
|
let n = e[2] ?? e[0];
|
|
11081
11110
|
return n === null ? e[1] : {
|
|
@@ -11084,23 +11113,23 @@ var vm = (e) => x([
|
|
|
11084
11113
|
reference: e[1],
|
|
11085
11114
|
type: "reference_et_action"
|
|
11086
11115
|
};
|
|
11087
|
-
} }),
|
|
11116
|
+
} }), Nm), Fm = i("article|loi|décret|code|alinéa|phrase|chapitre|titre|livre|partie|section|paragraphe|ordonnance|constitution|directive|règlement|\\d|[ivxlc]+|[a-zA-Z]", x([Pm, _([T(Ct, St), Pm])], { value: (e, t) => ht(e[0], e[1], t.position()) })), Im = o(Mm, { value: (e, t) => ({
|
|
11088
11117
|
...e,
|
|
11089
11118
|
position: t.position()
|
|
11090
|
-
}) }),
|
|
11119
|
+
}) }), Lm = T(_(Im, {
|
|
11091
11120
|
min: 2,
|
|
11092
11121
|
separator: Ne,
|
|
11093
11122
|
value: (e) => [e[0], ...e.slice(1).map(([, e]) => e)]
|
|
11094
|
-
}), _(
|
|
11123
|
+
}), _(Im, {
|
|
11095
11124
|
min: 2,
|
|
11096
11125
|
separator: C(String.raw`\n`),
|
|
11097
11126
|
value: (e) => [e[0], ...e.slice(1).map(([, e]) => e)]
|
|
11098
|
-
}), o(
|
|
11127
|
+
}), o(Im, { value: (e) => [e] }));
|
|
11099
11128
|
//#endregion
|
|
11100
11129
|
//#region src/lib/extractors/references.ts
|
|
11101
|
-
function*
|
|
11130
|
+
function* Rm(e, t) {
|
|
11102
11131
|
let r = Xp(e, t), i = new n(r.output), a = _e(r);
|
|
11103
|
-
for (let e of
|
|
11132
|
+
for (let e of Bm(i)) {
|
|
11104
11133
|
e = structuredClone(e), t.references === void 0 && (t.references = []), t.references.push(e);
|
|
11105
11134
|
for (let t of xt(e)) {
|
|
11106
11135
|
let e = t.position;
|
|
@@ -11109,132 +11138,132 @@ function* Pm(e, t) {
|
|
|
11109
11138
|
yield e;
|
|
11110
11139
|
}
|
|
11111
11140
|
}
|
|
11112
|
-
function*
|
|
11113
|
-
yield*
|
|
11141
|
+
function* zm(e, t = {}) {
|
|
11142
|
+
yield* Bm(e, t);
|
|
11114
11143
|
}
|
|
11115
|
-
function*
|
|
11116
|
-
let n = i(String.raw`arrêtés?|circulaires?|code|constitution|décrets?(?:-loi)?|loi|ordonnance|art\.|articles?|chapitre|livre|paragraphe|partie|section|sous-paragraphe|sous-section|sous-sous-paragraphe|sous-titre|titre|alinéas?|phrases?|règlements?|directives?|décisions?|«|[IVXLCDM]+|[A-Z]|\d+`, T($, tn, _n,
|
|
11144
|
+
function* Bm(e, t = {}) {
|
|
11145
|
+
let n = i(String.raw`arrêtés?|circulaires?|code|constitution|décrets?(?:-loi)?|loi|ordonnance|art\.|articles?|chapitre|livre|paragraphe|partie|section|sous-paragraphe|sous-section|sous-sous-paragraphe|sous-titre|titre|alinéas?|phrases?|règlements?|directives?|décisions?|«|[IVXLCDM]+|[A-Z]|\d+`, T($, tn, _n, _m, Fm), 80, String.raw`(?<=^|\P{Alphabetic})(?:arrêtés?|circulaires?|code|constitution|décrets?(?:-loi)?|loi|ordonnance|art\.|articles?|chapitre|livre|paragraphe|partie|section|sous-paragraphe|sous-section|sous-sous-paragraphe|sous-titre|titre|alinéas?|phrases?|règlements?|directives?|décisions?|«|[IVXLCDM]+|[A-Z]|\d+)(?=$|\P{Alphabetic})`);
|
|
11117
11146
|
for (let r of n.extract(e, {
|
|
11118
11147
|
overlapWindow: 80,
|
|
11119
11148
|
overlapWindowForCandidate: t.overlapWindowForCandidate
|
|
11120
|
-
})) if (r !== void 0) if (r.type === "citation") yield*
|
|
11149
|
+
})) if (r !== void 0) if (r.type === "citation") yield* Rm(e, r);
|
|
11121
11150
|
else {
|
|
11122
11151
|
if (r.type === "reference_et_action" || r.type === "alinéa" || r.type === "article" || r.type === "chapitre" || r.type === "item" || r.type === "livre" || r.type === "paragraphe" || r.type === "partie" || r.type === "phrase" || r.type === "section" || r.type === "sous-paragraphe" || r.type === "sous-section" || r.type === "sous-sous-paragraphe" || r.type === "sous-titre" || r.type === "titre" || r.type === "texte" || r.type === "bounded-interval" || r.type === "counted-interval" || r.type === "enumeration" || r.type === "exclusion" || r.type === "parent-enfant" || r.type === "incomplete-header") {
|
|
11123
11152
|
for (let t of xt(r)) if (t.type === "reference_et_action") {
|
|
11124
11153
|
let { originalCitations: n } = t.action;
|
|
11125
|
-
if (n !== void 0) for (let t of n) for (let n of
|
|
11154
|
+
if (n !== void 0) for (let t of n) for (let n of Rm(e, t));
|
|
11126
11155
|
}
|
|
11127
11156
|
}
|
|
11128
11157
|
yield r;
|
|
11129
11158
|
}
|
|
11130
11159
|
}
|
|
11131
|
-
function*
|
|
11160
|
+
function* Vm(e, t) {
|
|
11132
11161
|
let n = _e(t);
|
|
11133
|
-
for (let t of
|
|
11162
|
+
for (let t of zm(e)) {
|
|
11134
11163
|
for (let e of xt(t, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = v(n, e.position));
|
|
11135
11164
|
yield t;
|
|
11136
11165
|
}
|
|
11137
11166
|
}
|
|
11138
|
-
var
|
|
11167
|
+
var Hm = (e) => [...zm(e)], Um = (e, t) => [...Vm(e, t)], Wm = "(?:avant|apr[eè]s)", Gm = T(C("avant(?![-A-Za-zÀ-ÖØ-öø-ÿ0-9_])", {
|
|
11139
11168
|
flags: "i",
|
|
11140
11169
|
value: "before"
|
|
11141
11170
|
}), C("apr[eè]s(?![-A-Za-zÀ-ÖØ-öø-ÿ0-9_])", {
|
|
11142
11171
|
flags: "i",
|
|
11143
11172
|
value: "after"
|
|
11144
|
-
})),
|
|
11173
|
+
})), Km = T(C("(?:au|a[uù])\\s+d[eé]but\\b", {
|
|
11145
11174
|
flags: "i",
|
|
11146
11175
|
value: "start"
|
|
11147
11176
|
}), C("(?:a|à)\\s+la\\s+fin\\b", {
|
|
11148
11177
|
flags: "i",
|
|
11149
11178
|
value: "end"
|
|
11150
11179
|
}));
|
|
11151
|
-
function
|
|
11180
|
+
function qm(e) {
|
|
11152
11181
|
return e === "before" ? "insert_before" : "insert_after";
|
|
11153
11182
|
}
|
|
11154
|
-
function
|
|
11155
|
-
let t =
|
|
11183
|
+
function Jm(e) {
|
|
11184
|
+
let t = Ym(e), n = /(?:^|[^\p{L}\p{N}_-])(avant|apres)(?![\p{L}\p{N}_-])/u.exec(t);
|
|
11156
11185
|
return n ? n[1] === "avant" ? "before" : "after" : null;
|
|
11157
11186
|
}
|
|
11158
|
-
function
|
|
11187
|
+
function Ym(e) {
|
|
11159
11188
|
return e.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
11160
11189
|
}
|
|
11161
11190
|
//#endregion
|
|
11162
11191
|
//#region src/lib/text_parsers/action_words.ts
|
|
11163
|
-
var
|
|
11164
|
-
function
|
|
11192
|
+
var Xm = /\b(ins[èe]re|ins[ée]r[ée]|ajout|remplac|supprim|abrog|compl[èeé]t|r[ée]dig|r[ée]tabl|modifi(?:e|é|ée|és|ées|er|ant|ent))/iu;
|
|
11193
|
+
function Zm(e) {
|
|
11165
11194
|
return e.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
11166
11195
|
}
|
|
11167
|
-
function
|
|
11196
|
+
function Qm(e, t = e) {
|
|
11168
11197
|
return /\bredige\b|\bredigee\b|\bredigees\b|\brediges\b|\bainsi\b/.test(e) || /\bdispositions suivantes\b/.test(t);
|
|
11169
11198
|
}
|
|
11170
|
-
function
|
|
11171
|
-
return
|
|
11199
|
+
function $m(e) {
|
|
11200
|
+
return Jm(e) === "after";
|
|
11172
11201
|
}
|
|
11173
|
-
function
|
|
11174
|
-
return
|
|
11202
|
+
function eh(e) {
|
|
11203
|
+
return Jm(e) === "before";
|
|
11175
11204
|
}
|
|
11176
|
-
function
|
|
11205
|
+
function th(e) {
|
|
11177
11206
|
return /\bretabl/.test(e);
|
|
11178
11207
|
}
|
|
11179
|
-
function
|
|
11208
|
+
function nh(e) {
|
|
11180
11209
|
return /\binsere(?:e|es|s)?\b|\bajoute\b|\bajoutee\b|\bajoutes\b|\bajoutees\b|\bcomplete(?:e|es|s)?\b/.test(e);
|
|
11181
11210
|
}
|
|
11182
|
-
function
|
|
11211
|
+
function rh(e) {
|
|
11183
11212
|
return /\bremplace\b|\bremplacee\b|\bremplaces\b|\bremplacees\b/.test(e);
|
|
11184
11213
|
}
|
|
11185
|
-
function
|
|
11214
|
+
function ih(e) {
|
|
11186
11215
|
return /\bsupprime\b|\bsupprimee\b|\bsupprimes\b|\bsupprimees\b|\babroge\b|\babrogee\b|\babroges\b|\babrogees\b/.test(e);
|
|
11187
11216
|
}
|
|
11188
|
-
function
|
|
11217
|
+
function ah(e) {
|
|
11189
11218
|
return /\b(remplace|modifie|redige|rediges|redigee|redigees)\b/.test(e);
|
|
11190
11219
|
}
|
|
11191
11220
|
//#endregion
|
|
11192
11221
|
//#region src/lib/extractors/portion_references.ts
|
|
11193
|
-
function
|
|
11222
|
+
function oh(e, t) {
|
|
11194
11223
|
e && (e.start += t, e.stop += t);
|
|
11195
11224
|
}
|
|
11196
|
-
function
|
|
11225
|
+
function sh(e, t) {
|
|
11197
11226
|
if (e.type === "parent-enfant") {
|
|
11198
|
-
|
|
11227
|
+
sh(e.parent, t), sh(e.child, t), oh(e.position, t);
|
|
11199
11228
|
return;
|
|
11200
11229
|
}
|
|
11201
11230
|
if (e.type === "bounded-interval") {
|
|
11202
|
-
|
|
11231
|
+
sh(e.first, t), sh(e.last, t), oh(e.position, t);
|
|
11203
11232
|
return;
|
|
11204
11233
|
}
|
|
11205
11234
|
if (e.type === "counted-interval") {
|
|
11206
|
-
|
|
11235
|
+
sh(e.first, t), oh(e.position, t);
|
|
11207
11236
|
return;
|
|
11208
11237
|
}
|
|
11209
11238
|
if (e.type === "enumeration" || e.type === "exclusion") {
|
|
11210
|
-
|
|
11239
|
+
sh(e.left, t), sh(e.right, t), oh(e.position, t);
|
|
11211
11240
|
return;
|
|
11212
11241
|
}
|
|
11213
11242
|
if (e.type === "reference_et_action") {
|
|
11214
|
-
|
|
11243
|
+
sh(e.reference, t), oh(e.position, t);
|
|
11215
11244
|
return;
|
|
11216
11245
|
}
|
|
11217
|
-
|
|
11246
|
+
oh(e.position, t);
|
|
11218
11247
|
}
|
|
11219
|
-
function
|
|
11248
|
+
function ch(e) {
|
|
11220
11249
|
return e.replace(/\b(de\s+l['’]?|de\s+la|de\s+le|du|des)\s*$/i, "");
|
|
11221
11250
|
}
|
|
11222
|
-
function
|
|
11251
|
+
function lh(e) {
|
|
11223
11252
|
let t = /^(?:(?:[aà]\s+)?l['’]|(?:[aà]\s+)?la\b|(?:[aà]\s+)?le\b|les\b|des\b|aux\b|du\b)\s*/iu.exec(e)?.[0].length ?? 0, n = e.slice(t > 0 ? t : 0).trim();
|
|
11224
11253
|
return n ? {
|
|
11225
11254
|
text: n,
|
|
11226
11255
|
offset: t
|
|
11227
11256
|
} : null;
|
|
11228
11257
|
}
|
|
11229
|
-
function
|
|
11258
|
+
function uh(e) {
|
|
11230
11259
|
return [...e.matchAll(/(?:^|\P{L})(\p{L})/gu)].map((e) => (e.index ?? 0) + e[0].length - (e[1]?.length ?? 0));
|
|
11231
11260
|
}
|
|
11232
|
-
function
|
|
11261
|
+
function dh(e) {
|
|
11233
11262
|
let t = new n(e), r = Rt(t);
|
|
11234
11263
|
return !r || t.remaining().trim().length !== 0 ? null : r;
|
|
11235
11264
|
}
|
|
11236
|
-
function
|
|
11237
|
-
for (let t of
|
|
11265
|
+
function fh(e) {
|
|
11266
|
+
for (let t of uh(e)) {
|
|
11238
11267
|
let r = new n(e, t), i = Et(r);
|
|
11239
11268
|
if (!(i === void 0 || r.remaining().trim() !== "")) return {
|
|
11240
11269
|
nature: i,
|
|
@@ -11243,17 +11272,17 @@ function ch(e) {
|
|
|
11243
11272
|
}
|
|
11244
11273
|
return null;
|
|
11245
11274
|
}
|
|
11246
|
-
function
|
|
11275
|
+
function ph(e, t) {
|
|
11247
11276
|
let n = e.trim().replace(/[;:,]\s*$/u, "").replace(/\b(?:est|sont)\s*$/iu, "").trim();
|
|
11248
11277
|
if (!n) return null;
|
|
11249
|
-
for (let e of
|
|
11250
|
-
let r = n.slice(e).trim(), i =
|
|
11278
|
+
for (let e of uh(n)) {
|
|
11279
|
+
let r = n.slice(e).trim(), i = fh(r);
|
|
11251
11280
|
if (!i) continue;
|
|
11252
|
-
let a =
|
|
11281
|
+
let a = xm(r.slice(0, i.start)).trim();
|
|
11253
11282
|
if (!a) continue;
|
|
11254
11283
|
let o = /\s*(,|\bet\b|\bou\b|(?<!\p{L})[aà](?!\p{L}))\s*/giu, s = [], c = 0, l;
|
|
11255
11284
|
for (; (l = o.exec(a)) !== null;) {
|
|
11256
|
-
let e =
|
|
11285
|
+
let e = Zm(l[1] ?? "");
|
|
11257
11286
|
if (a.slice(c, l.index).trim() === "") {
|
|
11258
11287
|
e !== "a" && e !== "à" && (c = o.lastIndex);
|
|
11259
11288
|
continue;
|
|
@@ -11270,17 +11299,17 @@ function lh(e, t) {
|
|
|
11270
11299
|
}), s.length < 2) continue;
|
|
11271
11300
|
let u = s.some((e) => e.separator === "à"), d = [], f = [], p = !0, m = i.nature, h;
|
|
11272
11301
|
for (let [n, r] of s.entries()) {
|
|
11273
|
-
let i =
|
|
11302
|
+
let i = lh(r.text);
|
|
11274
11303
|
if (!i) {
|
|
11275
11304
|
d.length = 0;
|
|
11276
11305
|
break;
|
|
11277
11306
|
}
|
|
11278
|
-
let a =
|
|
11307
|
+
let a = dh(`${i.text} ${m}`);
|
|
11279
11308
|
if (!a) {
|
|
11280
11309
|
d.length = 0;
|
|
11281
11310
|
break;
|
|
11282
11311
|
}
|
|
11283
|
-
|
|
11312
|
+
sh(a, t + e + r.start + i.offset), d.push(a), a.type !== m || a.index === void 0 || a.index < 1 ? p = !1 : (h !== void 0 && !u && a.index !== h + 1 && (p = !1), h = a.index), n < s.length - 1 && (f.push(r.separator ?? "et"), (r.separator ?? "et") === "ou" && (p = !1));
|
|
11284
11313
|
}
|
|
11285
11314
|
let [g, ..._] = d;
|
|
11286
11315
|
if (!g || _.length === 0) continue;
|
|
@@ -11297,16 +11326,16 @@ function lh(e, t) {
|
|
|
11297
11326
|
}
|
|
11298
11327
|
return null;
|
|
11299
11328
|
}
|
|
11300
|
-
function
|
|
11329
|
+
function mh(e, t) {
|
|
11301
11330
|
let r = e.trim().replace(/[;:,]\s*$/u, "").replace(/\b(?:est|sont)\s*$/iu, "").trim();
|
|
11302
11331
|
if (!r) return null;
|
|
11303
|
-
for (let e of
|
|
11332
|
+
for (let e of uh(r)) {
|
|
11304
11333
|
let i = r.slice(e);
|
|
11305
11334
|
if (!i) continue;
|
|
11306
11335
|
let a = new n(i), o = Rt(a);
|
|
11307
11336
|
if (!o || a.offset === 0 || !se(a)) continue;
|
|
11308
|
-
let s = a.offset, c =
|
|
11309
|
-
if (c) return
|
|
11337
|
+
let s = a.offset, c = ph(i.slice(s), t + e + s);
|
|
11338
|
+
if (c) return sh(o, t + e), {
|
|
11310
11339
|
...mt(c, o),
|
|
11311
11340
|
position: {
|
|
11312
11341
|
start: o.position.start,
|
|
@@ -11316,57 +11345,57 @@ function uh(e, t) {
|
|
|
11316
11345
|
}
|
|
11317
11346
|
return null;
|
|
11318
11347
|
}
|
|
11319
|
-
function
|
|
11320
|
-
let r =
|
|
11348
|
+
function hh(e, t) {
|
|
11349
|
+
let r = ch(e);
|
|
11321
11350
|
if (!r) return null;
|
|
11322
|
-
let i =
|
|
11351
|
+
let i = mh(r, t);
|
|
11323
11352
|
if (i) return i;
|
|
11324
|
-
let a =
|
|
11353
|
+
let a = ph(r, t);
|
|
11325
11354
|
if (a) return a;
|
|
11326
|
-
for (let e of
|
|
11355
|
+
for (let e of uh(r)) {
|
|
11327
11356
|
let i = r.slice(e);
|
|
11328
11357
|
if (!i) continue;
|
|
11329
11358
|
let a = new n(i), o = Rt(a);
|
|
11330
|
-
if (!(!o || a.offset === 0) && i.slice(a.offset).trim().length === 0) return
|
|
11359
|
+
if (!(!o || a.offset === 0) && i.slice(a.offset).trim().length === 0) return sh(o, t + e), o;
|
|
11331
11360
|
}
|
|
11332
11361
|
return null;
|
|
11333
11362
|
}
|
|
11334
|
-
function
|
|
11363
|
+
function gh(e) {
|
|
11335
11364
|
return Math.max(0, ...Rp(e).map((e) => e.kind === "single" ? e.steps.length : Math.max(e.first.length, e.last.length)));
|
|
11336
11365
|
}
|
|
11337
|
-
function
|
|
11366
|
+
function _h(e) {
|
|
11338
11367
|
return Rp(e).length;
|
|
11339
11368
|
}
|
|
11340
|
-
function
|
|
11369
|
+
function vh(e, t) {
|
|
11341
11370
|
if (!e) return t;
|
|
11342
11371
|
if (!t) return e;
|
|
11343
|
-
let n =
|
|
11344
|
-
return n === r ?
|
|
11372
|
+
let n = gh(e), r = gh(t);
|
|
11373
|
+
return n === r ? _h(e) >= _h(t) ? e : t : n > r ? e : t;
|
|
11345
11374
|
}
|
|
11346
|
-
function
|
|
11375
|
+
function yh(e) {
|
|
11347
11376
|
return e.map((e) => ({
|
|
11348
11377
|
reference: e,
|
|
11349
|
-
specificity:
|
|
11378
|
+
specificity: gh(e)
|
|
11350
11379
|
})).filter((e) => e.specificity > 0).sort((e, t) => t.specificity - e.specificity)[0]?.reference ?? null;
|
|
11351
11380
|
}
|
|
11352
|
-
function
|
|
11381
|
+
function bh(e, { actionIndex: t = e.length } = {}) {
|
|
11353
11382
|
let r = /\barticle\b/i.exec(e);
|
|
11354
11383
|
if (!r || r.index === void 0) return null;
|
|
11355
11384
|
let i = r.index, a = new n(e.slice(i)), o = fn(a);
|
|
11356
11385
|
if (!o) return null;
|
|
11357
|
-
|
|
11358
|
-
let s = e.slice(0, i), c = i + a.offset, l = e.slice(c, t), u =
|
|
11386
|
+
sh(o, i);
|
|
11387
|
+
let s = e.slice(0, i), c = i + a.offset, l = e.slice(c, t), u = vh(yh(xh(s)), hh(s, 0)) ?? yh(xh(l)) ?? hh(l, c);
|
|
11359
11388
|
return u ? mt(o, u) : null;
|
|
11360
11389
|
}
|
|
11361
|
-
function
|
|
11362
|
-
return
|
|
11390
|
+
function xh(e) {
|
|
11391
|
+
return Hm(new n(e));
|
|
11363
11392
|
}
|
|
11364
11393
|
//#endregion
|
|
11365
11394
|
//#region src/lib/extractors/quoted_text.ts
|
|
11366
|
-
function
|
|
11395
|
+
function Sh(e) {
|
|
11367
11396
|
return e.split(/\n+/).map((e) => e.replace(/^\s*[«“"]\s*/u, "").trim()).filter((e) => e.length > 0).join("\n").replace(/[»”"]\s*$/u, "").trim();
|
|
11368
11397
|
}
|
|
11369
|
-
function
|
|
11398
|
+
function Ch(e) {
|
|
11370
11399
|
let t = [], r = 0;
|
|
11371
11400
|
for (; r < e.length;) {
|
|
11372
11401
|
let i = e.indexOf("«", r);
|
|
@@ -11378,7 +11407,7 @@ function yh(e) {
|
|
|
11378
11407
|
r = i + 1;
|
|
11379
11408
|
continue;
|
|
11380
11409
|
}
|
|
11381
|
-
let s =
|
|
11410
|
+
let s = Sh(Zp(e, o)), c = o.position ?? {
|
|
11382
11411
|
start: i,
|
|
11383
11412
|
stop: i + 1
|
|
11384
11413
|
};
|
|
@@ -11392,7 +11421,7 @@ function yh(e) {
|
|
|
11392
11421
|
}
|
|
11393
11422
|
return t;
|
|
11394
11423
|
}
|
|
11395
|
-
function
|
|
11424
|
+
function wh(e, t) {
|
|
11396
11425
|
if (t.length === 0) return e;
|
|
11397
11426
|
let n = 0, r = [];
|
|
11398
11427
|
for (let { start: i, end: a } of t) {
|
|
@@ -11401,7 +11430,7 @@ function bh(e, t) {
|
|
|
11401
11430
|
}
|
|
11402
11431
|
return n < e.length && r.push(e.slice(n)), r.join("");
|
|
11403
11432
|
}
|
|
11404
|
-
function
|
|
11433
|
+
function Th(e) {
|
|
11405
11434
|
let t = [], n = 0;
|
|
11406
11435
|
for (; n < e.length;) {
|
|
11407
11436
|
let r = e.indexOf("«", n);
|
|
@@ -11421,13 +11450,13 @@ function xh(e) {
|
|
|
11421
11450
|
}
|
|
11422
11451
|
return t;
|
|
11423
11452
|
}
|
|
11424
|
-
function
|
|
11453
|
+
function Eh(e, t) {
|
|
11425
11454
|
return e ? t.some((t) => e.start >= t.start && e.stop <= t.end) : !1;
|
|
11426
11455
|
}
|
|
11427
|
-
function
|
|
11428
|
-
return
|
|
11456
|
+
function Dh(e, t) {
|
|
11457
|
+
return Eh(e, t);
|
|
11429
11458
|
}
|
|
11430
|
-
function
|
|
11459
|
+
function Oh(e) {
|
|
11431
11460
|
if (!e.includes("«")) return e;
|
|
11432
11461
|
let t = e.split(""), n = !1;
|
|
11433
11462
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -11446,10 +11475,10 @@ function wh(e) {
|
|
|
11446
11475
|
}
|
|
11447
11476
|
//#endregion
|
|
11448
11477
|
//#region src/lib/text_parsers/action_citation_patterns.ts
|
|
11449
|
-
function
|
|
11478
|
+
function kh(e) {
|
|
11450
11479
|
return `(?:${e.join("|")})`;
|
|
11451
11480
|
}
|
|
11452
|
-
var
|
|
11481
|
+
var Ah = [
|
|
11453
11482
|
"(?:à\\s+|de\\s+)?l[’']année",
|
|
11454
11483
|
"(?:à\\s+|de\\s+)?la date",
|
|
11455
11484
|
"(?:à\\s+|de\\s+)?la mention",
|
|
@@ -11467,7 +11496,7 @@ var Eh = [
|
|
|
11467
11496
|
"(?:aux|des|les)\\s+nombres",
|
|
11468
11497
|
"(?:aux|des|les)\\s+références",
|
|
11469
11498
|
"le tableau intitulé"
|
|
11470
|
-
],
|
|
11499
|
+
], jh = [
|
|
11471
11500
|
"l[’']année",
|
|
11472
11501
|
"la date",
|
|
11473
11502
|
"la mention",
|
|
@@ -11485,10 +11514,10 @@ var Eh = [
|
|
|
11485
11514
|
"les mots",
|
|
11486
11515
|
"les nombres",
|
|
11487
11516
|
"les références"
|
|
11488
|
-
],
|
|
11517
|
+
], Mh = kh(Ah), Nh = kh(jh);
|
|
11489
11518
|
//#endregion
|
|
11490
11519
|
//#region src/lib/text_parsers/action_directives.ts
|
|
11491
|
-
function
|
|
11520
|
+
function Ph(e) {
|
|
11492
11521
|
return e.type === "reference_et_action" ? {
|
|
11493
11522
|
action: e.action,
|
|
11494
11523
|
reference: e.reference
|
|
@@ -11497,7 +11526,7 @@ function Ah(e) {
|
|
|
11497
11526
|
reference: e
|
|
11498
11527
|
};
|
|
11499
11528
|
}
|
|
11500
|
-
function
|
|
11529
|
+
function Fh(e) {
|
|
11501
11530
|
let t = e.indices?.[0]?.[0] ?? e.index, n = /« ?(.*?) ?»/dg, r = [], i;
|
|
11502
11531
|
for (; (i = n.exec(e[0])) !== null;) {
|
|
11503
11532
|
let e = i.indices?.[1], n = i.indices?.[0];
|
|
@@ -11513,21 +11542,21 @@ function jh(e) {
|
|
|
11513
11542
|
}
|
|
11514
11543
|
return r;
|
|
11515
11544
|
}
|
|
11516
|
-
var
|
|
11517
|
-
C(`${
|
|
11545
|
+
var Ih = x([
|
|
11546
|
+
C(`${Mh}s?`, { flags: "i" }),
|
|
11518
11547
|
C(" ?: ?"),
|
|
11519
11548
|
$
|
|
11520
|
-
], { value: (e) => e[2] }),
|
|
11521
|
-
C(`${
|
|
11549
|
+
], { value: (e) => e[2] }), Lh = x([
|
|
11550
|
+
C(`${Nh}s?(?: suivant(?:e)?s?)?`, { flags: "i" }),
|
|
11522
11551
|
C(" ?: ?"),
|
|
11523
11552
|
$
|
|
11524
|
-
], { value: (e) => e[2] }),
|
|
11553
|
+
], { value: (e) => e[2] }), Rh = x([
|
|
11525
11554
|
b,
|
|
11526
|
-
|
|
11555
|
+
Ih,
|
|
11527
11556
|
S,
|
|
11528
11557
|
T(C("est remplacée? par", { flags: "i" }), C("sont remplacée?s par", { flags: "i" })),
|
|
11529
11558
|
S,
|
|
11530
|
-
|
|
11559
|
+
Lh
|
|
11531
11560
|
], { value: (e) => ({
|
|
11532
11561
|
action: {
|
|
11533
11562
|
action: "remplacer",
|
|
@@ -11538,9 +11567,9 @@ var Mh = x([
|
|
|
11538
11567
|
replacementCitation: e[5],
|
|
11539
11568
|
targetCitation: e[1]
|
|
11540
11569
|
}
|
|
11541
|
-
}) }),
|
|
11570
|
+
}) }), zh = T(C(`(?:, ?| )(?:${Mh}s? ?: ?« ?[^»]+ ?»(?: ?(?:,|et) ?)*)+(?:est|sont) (?:supprimée?s?|abrogée?s?)`, {
|
|
11542
11571
|
flags: "di",
|
|
11543
|
-
value: (e) =>
|
|
11572
|
+
value: (e) => Fh(e).map((e) => ({
|
|
11544
11573
|
action: {
|
|
11545
11574
|
action: "supprimer",
|
|
11546
11575
|
actionInContent: !0
|
|
@@ -11552,8 +11581,8 @@ var Mh = x([
|
|
|
11552
11581
|
}))
|
|
11553
11582
|
}), x([
|
|
11554
11583
|
b,
|
|
11555
|
-
|
|
11556
|
-
_([C("(?:, ?| et )"),
|
|
11584
|
+
Ih,
|
|
11585
|
+
_([C("(?:, ?| et )"), Ih], { value: (e) => e.map((e) => e[1]) }),
|
|
11557
11586
|
S,
|
|
11558
11587
|
T(C("est supprimée?", { flags: "i" }), C("sont supprimée?s", { flags: "i" }), C("est abrogée?", { flags: "i" }), C("sont abrogée?s", { flags: "i" }))
|
|
11559
11588
|
], { value: (e) => [e[1], ...e[2] ?? []].map((e) => ({
|
|
@@ -11565,9 +11594,9 @@ var Mh = x([
|
|
|
11565
11594
|
kind: "delete",
|
|
11566
11595
|
targetCitation: e
|
|
11567
11596
|
}
|
|
11568
|
-
})) })),
|
|
11597
|
+
})) })), Bh = T(x([
|
|
11569
11598
|
b,
|
|
11570
|
-
|
|
11599
|
+
Gm,
|
|
11571
11600
|
S,
|
|
11572
11601
|
C("(?:la référence|la mention|le mot|les mots|le signe)", { flags: "i" }),
|
|
11573
11602
|
C(" ?: ?"),
|
|
@@ -11583,10 +11612,10 @@ var Mh = x([
|
|
|
11583
11612
|
},
|
|
11584
11613
|
operation: {
|
|
11585
11614
|
insertCitation: e[9],
|
|
11586
|
-
kind:
|
|
11615
|
+
kind: qm(e[1]),
|
|
11587
11616
|
targetCitation: e[5]
|
|
11588
11617
|
}
|
|
11589
|
-
}) }),
|
|
11618
|
+
}) }), Rh, zh, x([
|
|
11590
11619
|
b,
|
|
11591
11620
|
T(C("est ainsi rédigée?", { flags: "i" }), C("sont ainsi rédigée?s", { flags: "i" }), C("est rédigée? (?:ainsi qu'il|comme) suit", { flags: "i" }), C("sont rédigée?s (?:ainsi qu'il|comme) suit", { flags: "i" })),
|
|
11592
11621
|
C(" ?: ?"),
|
|
@@ -11601,27 +11630,27 @@ var Mh = x([
|
|
|
11601
11630
|
replacementCitation: e[3],
|
|
11602
11631
|
replacementKind: "text"
|
|
11603
11632
|
}
|
|
11604
|
-
}) })),
|
|
11633
|
+
}) })), Vh = T(Bh, x([C(" et"), Bh], { value: (e) => e[1] })), Hh = w(T(x([
|
|
11605
11634
|
S,
|
|
11606
11635
|
C("par", { flags: "i" }),
|
|
11607
11636
|
S,
|
|
11608
|
-
|
|
11637
|
+
Lh
|
|
11609
11638
|
], { value: (e) => ({
|
|
11610
11639
|
citation: e[3],
|
|
11611
11640
|
kind: "replace"
|
|
11612
|
-
}) }), x([S,
|
|
11641
|
+
}) }), x([S, Lh], { value: (e) => ({
|
|
11613
11642
|
citation: e[1],
|
|
11614
11643
|
kind: "insert"
|
|
11615
11644
|
}) })), { default: null });
|
|
11616
|
-
function
|
|
11645
|
+
function Uh(e) {
|
|
11617
11646
|
return typeof e == "object" && !!e && "action" in e && "operation" in e;
|
|
11618
11647
|
}
|
|
11619
|
-
function
|
|
11648
|
+
function Wh(e) {
|
|
11620
11649
|
let t = [];
|
|
11621
|
-
for (let n of e)
|
|
11650
|
+
for (let n of e) Uh(n) ? t.push(n) : Array.isArray(n) && t.push(...Wh(n));
|
|
11622
11651
|
return t;
|
|
11623
11652
|
}
|
|
11624
|
-
function
|
|
11653
|
+
function Gh(e, t) {
|
|
11625
11654
|
if (!e) return [];
|
|
11626
11655
|
let n = e.originalCitations ?? [];
|
|
11627
11656
|
if (e.action === "remplacer") {
|
|
@@ -11669,12 +11698,12 @@ function Vh(e, t) {
|
|
|
11669
11698
|
}
|
|
11670
11699
|
return [];
|
|
11671
11700
|
}
|
|
11672
|
-
var
|
|
11673
|
-
|
|
11674
|
-
|
|
11675
|
-
_(
|
|
11701
|
+
var Kh = i("après|avant|remplacée?s?|supprimée?s?|abrogée?s?|ins[eé]r[eé]e?s?|ajout[eé]e?s?|rédigée?s?", x([
|
|
11702
|
+
Fm,
|
|
11703
|
+
Hh,
|
|
11704
|
+
_(Vh, { value: (e) => Wh(e) })
|
|
11676
11705
|
], { value: (e, t) => {
|
|
11677
|
-
let { action: n, reference: r } =
|
|
11706
|
+
let { action: n, reference: r } = Ph(e[0]), i = [...Gh(n, e[1]), ...e[2] ?? []], a = n ?? i[0]?.action;
|
|
11678
11707
|
if (!(!a || i.length === 0)) return {
|
|
11679
11708
|
action: a,
|
|
11680
11709
|
operations: i.map(({ operation: e }) => e),
|
|
@@ -11682,7 +11711,7 @@ var Hh = i("après|avant|remplacée?s?|supprimée?s?|abrogée?s?|ins[eé]r[eé]e
|
|
|
11682
11711
|
reference: r,
|
|
11683
11712
|
type: "action_directive"
|
|
11684
11713
|
};
|
|
11685
|
-
} }), 200),
|
|
11714
|
+
} }), 200), qh = x([
|
|
11686
11715
|
C("la\\s+fin\\s+de\\s+", { flags: "i" }),
|
|
11687
11716
|
w(C("(?:la\\s+|l['’]\\s*)", { flags: "i" }), { default: "" }),
|
|
11688
11717
|
T(C("phrase", {
|
|
@@ -11699,14 +11728,14 @@ var Hh = i("après|avant|remplacée?s?|supprimée?s?|abrogée?s?|ins[eé]r[eé]e
|
|
|
11699
11728
|
type: "tail_after_target",
|
|
11700
11729
|
unit: e[2]
|
|
11701
11730
|
}) });
|
|
11702
|
-
function
|
|
11731
|
+
function Jh(e) {
|
|
11703
11732
|
if (e.type === "phrase") return "phrase";
|
|
11704
11733
|
if (e.type === "alinéa") return "alinéa";
|
|
11705
11734
|
if (e.type === "article") return "article";
|
|
11706
|
-
if (e.type === "parent-enfant") return
|
|
11735
|
+
if (e.type === "parent-enfant") return Jh(e.child);
|
|
11707
11736
|
}
|
|
11708
|
-
function
|
|
11709
|
-
let t =
|
|
11737
|
+
function Yh(e) {
|
|
11738
|
+
let t = Zm(e);
|
|
11710
11739
|
if (!/\bla\s+fin\s+d/iu.test(t)) return null;
|
|
11711
11740
|
let n = /\bla\s+fin\s+(?:de\s+la|d['’]?une|du|de\s+l['’]?|des)\s*[^,;.]*\bphrase\b/u.test(t) ? "phrase" : /\bla\s+fin\s+(?:de\s+la|d['’]?un|du|de\s+l['’]?|des)\s*[^,;.]*\balinea\b/u.test(t) ? "alinéa" : /\bla\s+fin\s+(?:de\s+l['’]?|d['’]?)article\b/u.test(t) ? "article" : void 0;
|
|
11712
11741
|
return {
|
|
@@ -11716,10 +11745,10 @@ function Gh(e) {
|
|
|
11716
11745
|
}
|
|
11717
11746
|
//#endregion
|
|
11718
11747
|
//#region src/lib/text_parsers/action_occurrences.ts
|
|
11719
|
-
function
|
|
11748
|
+
function Xh(e) {
|
|
11720
11749
|
return e.replace(/\s+/gu, " ").trim().normalize("NFD").replace(/[\u0300-\u036f]/gu, "").replace(/[’‘]/gu, "'").toLowerCase();
|
|
11721
11750
|
}
|
|
11722
|
-
function
|
|
11751
|
+
function Zh(e, t) {
|
|
11723
11752
|
let n = e.slice(0, Math.max(0, t)), r = RegExp(`\\b(${we})\\s+occurrence\\b`, "giu"), i = null, a;
|
|
11724
11753
|
for (; (a = r.exec(n)) !== null;) {
|
|
11725
11754
|
let e = be(a[1] ?? "");
|
|
@@ -11727,37 +11756,37 @@ function qh(e, t) {
|
|
|
11727
11756
|
}
|
|
11728
11757
|
return i;
|
|
11729
11758
|
}
|
|
11730
|
-
function
|
|
11731
|
-
let t =
|
|
11732
|
-
return /\b(?:derniere\s+occurrence|a\s+la\s+fin)\b/u.test(t) ? "last" :
|
|
11759
|
+
function Qh(e) {
|
|
11760
|
+
let t = Xh(e);
|
|
11761
|
+
return /\b(?:derniere\s+occurrence|a\s+la\s+fin)\b/u.test(t) ? "last" : Zh(e, e.length) ?? void 0;
|
|
11733
11762
|
}
|
|
11734
11763
|
//#endregion
|
|
11735
11764
|
//#region src/lib/extractors/action_directives.ts
|
|
11736
|
-
var
|
|
11737
|
-
function
|
|
11765
|
+
var $h = "(?:(?:alinea|alineas|section|sous-section|paragraphe|sous-paragraphe|sous-sous-paragraphe|chapitre|titre|livre|partie)|(?:[ivxlcdm]+|[a-z]|\\d+\\s*°?)(?:\\s+(?:bis|ter|quater|quinquies|sexies|septies|octies|nonies|decies|undecies|duodecies))?)", eg = "(?:un|une|l['’]?|le|la)";
|
|
11766
|
+
function tg(e) {
|
|
11738
11767
|
return /\b(?:les?|la|l['’]?)\s+(?:mots?|references?|mentions?|signes?|nombres?|montants?|taux|pourcentages?|dates?|annees?)\b/u.test(e);
|
|
11739
11768
|
}
|
|
11740
|
-
function
|
|
11769
|
+
function ng(e) {
|
|
11741
11770
|
return /\b(?:une|la|les?)\s+phrases?\b/u.test(e);
|
|
11742
11771
|
}
|
|
11743
|
-
function
|
|
11744
|
-
return new RegExp(String.raw`\b(?:insere(?:e|es|s)?|ajoute(?:e|es|s)?|complete(?:e|es|s)?|retabli(?:e|es|s)?)\b[\s\S]{0,90}\b${
|
|
11772
|
+
function rg(e) {
|
|
11773
|
+
return new RegExp(String.raw`\b(?:insere(?:e|es|s)?|ajoute(?:e|es|s)?|complete(?:e|es|s)?|retabli(?:e|es|s)?)\b[\s\S]{0,90}\b${eg}\s+${$h}\b`, "u").test(e) ? !0 : new RegExp(String.raw`\b${eg}\s+${$h}\b[\s\S]{0,90}\b(?:est|sont)\s+(?:ainsi\s+)?(?:insere(?:e|es|s)?|ajoute(?:e|es|s)?|complete(?:e|es|s)?|retabli(?:e|es|s)?)\b`, "u").test(e);
|
|
11745
11774
|
}
|
|
11746
|
-
function
|
|
11747
|
-
if (!
|
|
11775
|
+
function ig({ hasRedactionIntro: e, insertText: t, normalized: n }) {
|
|
11776
|
+
if (!tg(n) && !ng(n) && (rg(n) && /\balinea\b/u.test(n) || e && yp(t))) return "block";
|
|
11748
11777
|
}
|
|
11749
|
-
function
|
|
11750
|
-
if (!
|
|
11778
|
+
function ag({ hasRedactionIntro: e, normalized: t, replacementText: n }) {
|
|
11779
|
+
if (!ng(t) && (e && /\balineas?\b/u.test(t) || e && yp(n))) return "block";
|
|
11751
11780
|
}
|
|
11752
|
-
function
|
|
11781
|
+
function og(e) {
|
|
11753
11782
|
let t = bp(e);
|
|
11754
11783
|
return t ? t.restText : e;
|
|
11755
11784
|
}
|
|
11756
|
-
function
|
|
11757
|
-
let t =
|
|
11785
|
+
function sg(e) {
|
|
11786
|
+
let t = og(e);
|
|
11758
11787
|
return t === e ? e.replace(gp, "") : t;
|
|
11759
11788
|
}
|
|
11760
|
-
function
|
|
11789
|
+
function cg(e) {
|
|
11761
11790
|
let t = e.split("\n"), n = [], r = 0;
|
|
11762
11791
|
for (let e of t) {
|
|
11763
11792
|
let t = r, i = t + e.length;
|
|
@@ -11769,10 +11798,10 @@ function ig(e) {
|
|
|
11769
11798
|
}
|
|
11770
11799
|
return n;
|
|
11771
11800
|
}
|
|
11772
|
-
function
|
|
11801
|
+
function lg(e) {
|
|
11773
11802
|
return bp(e) !== void 0 || gp.test(e);
|
|
11774
11803
|
}
|
|
11775
|
-
function
|
|
11804
|
+
function ug(e) {
|
|
11776
11805
|
if (gp.test(e)) return {
|
|
11777
11806
|
marker: "-",
|
|
11778
11807
|
level: 5
|
|
@@ -11780,87 +11809,87 @@ function og(e) {
|
|
|
11780
11809
|
let t = bp(e);
|
|
11781
11810
|
return t ? {
|
|
11782
11811
|
marker: t.token,
|
|
11783
|
-
level:
|
|
11812
|
+
level: dg(t.token)
|
|
11784
11813
|
} : null;
|
|
11785
11814
|
}
|
|
11786
|
-
function
|
|
11815
|
+
function dg(e) {
|
|
11787
11816
|
let t = e.trim().split(/\s+/u)[0]?.replace(/[^\p{L}\p{N}]+/gu, "") ?? "";
|
|
11788
11817
|
return /^\d+$/u.test(t) ? 2 : /^[ivxlcdm]+$/u.test(t) && (t.length > 1 || /^[ivx]$/u.test(t)) ? 4 : /^[a-z]$/u.test(t) ? 3 : vp(t) || /^[A-Z]$/u.test(t) ? 1 : 2;
|
|
11789
11818
|
}
|
|
11790
|
-
function
|
|
11819
|
+
function fg(e) {
|
|
11791
11820
|
let t = [], n = e;
|
|
11792
11821
|
for (;;) {
|
|
11793
|
-
let e =
|
|
11822
|
+
let e = ug(n);
|
|
11794
11823
|
if (!e) return t;
|
|
11795
11824
|
t.push(e.marker);
|
|
11796
|
-
let r =
|
|
11825
|
+
let r = sg(n);
|
|
11797
11826
|
if (r === n) return t;
|
|
11798
11827
|
n = r.trimStart();
|
|
11799
11828
|
}
|
|
11800
11829
|
}
|
|
11801
|
-
function
|
|
11802
|
-
let t =
|
|
11830
|
+
function pg(e) {
|
|
11831
|
+
let t = Zm(wh(e, Ch(e)));
|
|
11803
11832
|
return /(?:^|[;:.]\s*)(?:(?:il\s+)?est|sont)\s+(?:inseree?s?|ajoutee?s?)\s+(?:la\s+reference|la\s+mention|les\s+mots|le\s+mot|le\s+signe|les\s+references)?\s*:/.exec(t)?.index ?? null;
|
|
11804
11833
|
}
|
|
11805
|
-
function
|
|
11806
|
-
let t =
|
|
11834
|
+
function mg(e) {
|
|
11835
|
+
let t = pg(e);
|
|
11807
11836
|
if (t !== null) return t;
|
|
11808
11837
|
for (let t = 0; t < e.length; t += 1) {
|
|
11809
11838
|
let r = new n(e.slice(t));
|
|
11810
|
-
if (
|
|
11839
|
+
if (wm(r) && r.offset > 0) return t;
|
|
11811
11840
|
}
|
|
11812
11841
|
return null;
|
|
11813
11842
|
}
|
|
11814
|
-
function
|
|
11843
|
+
function hg(e) {
|
|
11815
11844
|
return e.type === "reference_et_action" ? e.reference : e;
|
|
11816
11845
|
}
|
|
11817
|
-
function
|
|
11818
|
-
return
|
|
11846
|
+
function gg(e) {
|
|
11847
|
+
return Hm(new n(e)).map(hg).find((e) => bt(e) === "article") || (T_(e)?.reference ?? null);
|
|
11819
11848
|
}
|
|
11820
|
-
function
|
|
11821
|
-
let t =
|
|
11849
|
+
function _g(e) {
|
|
11850
|
+
let t = mg(e) ?? e.length, r = Th(e), i = Hm(new n(e)), a = i.flatMap((e) => Array.from(O(hg(e)))).filter((e) => e.type === "article" && e.position).map((e) => ({
|
|
11822
11851
|
start: e.position.start,
|
|
11823
11852
|
end: e.position.stop
|
|
11824
|
-
})), o = i.map(
|
|
11825
|
-
return u ?
|
|
11853
|
+
})), o = i.map(hg).filter((e) => !Dh(e.position, r) && !Eh(e.position, a) && bt(e) !== "article" && (e.position?.start ?? 0) < t).sort((e, t) => (e.position?.start ?? 0) - (t.position?.start ?? 0)), s = e.slice(0, t).trimEnd(), c = hh(l_(s), 0) ?? hh(s, 0) ?? hh(s.replace(/\b(?:est|sont)\s*$/iu, "").trimEnd(), 0), l = c && !Eh(c.position, a) ? c : null, u = o[0];
|
|
11854
|
+
return u ? vh(u, l) : l;
|
|
11826
11855
|
}
|
|
11827
|
-
function
|
|
11828
|
-
let t =
|
|
11856
|
+
function vg(e) {
|
|
11857
|
+
let t = mg(e) ?? e.length, r = Th(e), i = Hm(new n(e)).map(hg).filter((e) => !Dh(e.position, r) && (e.position?.start ?? 0) < t).sort((e, t) => (e.position?.start ?? 0) - (t.position?.start ?? 0));
|
|
11829
11858
|
return i.length === 0 ? null : i.find((e) => bt(e) !== "article") ?? null ?? i[0] ?? null;
|
|
11830
11859
|
}
|
|
11831
|
-
function
|
|
11832
|
-
let t = [e,
|
|
11860
|
+
function yg(e) {
|
|
11861
|
+
let t = [e, og(e)].map((e) => e.trim()).filter((e, t, n) => e && n.indexOf(e) === t);
|
|
11833
11862
|
for (let e of t) {
|
|
11834
|
-
let t =
|
|
11863
|
+
let t = mg(e) ?? e.length, n = hh(e, 0) ?? bh(e, { actionIndex: t }) ?? vg(e) ?? gg(e);
|
|
11835
11864
|
if (n) return n;
|
|
11836
11865
|
}
|
|
11837
11866
|
return null;
|
|
11838
11867
|
}
|
|
11839
|
-
function
|
|
11868
|
+
function bg(e) {
|
|
11840
11869
|
return e?.toLowerCase().replace(/[.)]/g, "").trim();
|
|
11841
11870
|
}
|
|
11842
|
-
function
|
|
11843
|
-
return !(e.type !== t.type || e.index !== void 0 && t.index !== void 0 && e.index !== t.index || e.num !== void 0 && t.num !== void 0 &&
|
|
11871
|
+
function xg(e, t) {
|
|
11872
|
+
return !(e.type !== t.type || e.index !== void 0 && t.index !== void 0 && e.index !== t.index || e.num !== void 0 && t.num !== void 0 && bg(e.num) !== bg(t.num));
|
|
11844
11873
|
}
|
|
11845
|
-
function
|
|
11874
|
+
function Sg(e) {
|
|
11846
11875
|
let t = null;
|
|
11847
11876
|
for (let n of O(e)) t = n;
|
|
11848
11877
|
return t;
|
|
11849
11878
|
}
|
|
11850
|
-
function
|
|
11851
|
-
return t && e.type === "parent-enfant" &&
|
|
11879
|
+
function Cg(e, t) {
|
|
11880
|
+
return t && e.type === "parent-enfant" && xg(e.parent, t) ? e.child : e;
|
|
11852
11881
|
}
|
|
11853
|
-
function
|
|
11882
|
+
function wg(e, t) {
|
|
11854
11883
|
let n = null;
|
|
11855
11884
|
for (let r of O(e)) r.type === t && r.relative === void 0 && (r.index === void 0 && r.num === void 0 || (n = r));
|
|
11856
11885
|
return n;
|
|
11857
11886
|
}
|
|
11858
|
-
function
|
|
11887
|
+
function Tg(e, t) {
|
|
11859
11888
|
if (!t) return e;
|
|
11860
11889
|
let n = structuredClone(e), r = (e) => {
|
|
11861
11890
|
if (e.type !== "parent-enfant" && e.type !== "bounded-interval" && e.type !== "counted-interval" && e.type !== "enumeration" && e.type !== "exclusion" && e.type !== "reference_et_action") {
|
|
11862
11891
|
if (e.relative === 0) {
|
|
11863
|
-
let n =
|
|
11892
|
+
let n = wg(t, e.type);
|
|
11864
11893
|
n && (e.index = n.index, e.num = n.num, delete e.relative);
|
|
11865
11894
|
}
|
|
11866
11895
|
return;
|
|
@@ -11886,7 +11915,7 @@ function xg(e, t) {
|
|
|
11886
11915
|
};
|
|
11887
11916
|
return r(n), n;
|
|
11888
11917
|
}
|
|
11889
|
-
function
|
|
11918
|
+
function Eg(e) {
|
|
11890
11919
|
let t = (e) => {
|
|
11891
11920
|
if (e.type !== "parent-enfant" && e.type !== "bounded-interval" && e.type !== "counted-interval" && e.type !== "enumeration" && e.type !== "exclusion" && e.type !== "reference_et_action") return e.relative !== void 0;
|
|
11892
11921
|
switch (e.type) {
|
|
@@ -11900,14 +11929,14 @@ function Sg(e) {
|
|
|
11900
11929
|
};
|
|
11901
11930
|
return t(e);
|
|
11902
11931
|
}
|
|
11903
|
-
function
|
|
11932
|
+
function Dg(e) {
|
|
11904
11933
|
let t = [], n = [];
|
|
11905
11934
|
for (let r of e) {
|
|
11906
|
-
if (!
|
|
11935
|
+
if (!lg(r.text)) {
|
|
11907
11936
|
n[n.length - 1]?.body.push(r);
|
|
11908
11937
|
continue;
|
|
11909
11938
|
}
|
|
11910
|
-
let e =
|
|
11939
|
+
let e = ug(r.text), i = e?.level ?? 0, a = {
|
|
11911
11940
|
body: [],
|
|
11912
11941
|
children: [],
|
|
11913
11942
|
level: i,
|
|
@@ -11919,13 +11948,13 @@ function Cg(e) {
|
|
|
11919
11948
|
}
|
|
11920
11949
|
return t;
|
|
11921
11950
|
}
|
|
11922
|
-
function
|
|
11951
|
+
function Og(e, t) {
|
|
11923
11952
|
if (!e) return t;
|
|
11924
11953
|
if (!t) return e;
|
|
11925
|
-
let n =
|
|
11954
|
+
let n = Cg(t, Sg(e));
|
|
11926
11955
|
return n.type === "article" || bt(n), mt(e, n);
|
|
11927
11956
|
}
|
|
11928
|
-
function
|
|
11957
|
+
function kg(e, t) {
|
|
11929
11958
|
return {
|
|
11930
11959
|
...mt(e, t),
|
|
11931
11960
|
position: {
|
|
@@ -11934,16 +11963,16 @@ function Tg(e, t) {
|
|
|
11934
11963
|
}
|
|
11935
11964
|
};
|
|
11936
11965
|
}
|
|
11937
|
-
function
|
|
11938
|
-
return [
|
|
11966
|
+
function Ag(e) {
|
|
11967
|
+
return [sg(e.line.text), ...e.body.map((e) => e.text)].join("\n").trim();
|
|
11939
11968
|
}
|
|
11940
|
-
function
|
|
11969
|
+
function jg(e) {
|
|
11941
11970
|
return e.body[e.body.length - 1]?.end ?? e.line.end;
|
|
11942
11971
|
}
|
|
11943
|
-
function
|
|
11972
|
+
function Mg(e) {
|
|
11944
11973
|
return (e ?? "").replace(/°/gu, "").replace(/\s+/gu, " ").trim();
|
|
11945
11974
|
}
|
|
11946
|
-
function
|
|
11975
|
+
function Ng(e, t) {
|
|
11947
11976
|
let r = new n(e, t), i = te(r);
|
|
11948
11977
|
return typeof i == "string" && r.offset > t ? {
|
|
11949
11978
|
date: i,
|
|
@@ -11951,14 +11980,14 @@ function kg(e, t) {
|
|
|
11951
11980
|
stop: r.offset
|
|
11952
11981
|
} : null;
|
|
11953
11982
|
}
|
|
11954
|
-
function
|
|
11955
|
-
let t =
|
|
11983
|
+
function Pg(e) {
|
|
11984
|
+
let t = Th(e), n = [];
|
|
11956
11985
|
for (let r = 0; r < e.length; r += 1) {
|
|
11957
11986
|
let i = e[r];
|
|
11958
11987
|
if (i === void 0 || !/\d/u.test(i)) continue;
|
|
11959
|
-
let a =
|
|
11988
|
+
let a = Ng(e, r);
|
|
11960
11989
|
if (a) {
|
|
11961
|
-
if (
|
|
11990
|
+
if (Eh(a, t)) {
|
|
11962
11991
|
r = Math.max(r, a.stop - 1);
|
|
11963
11992
|
continue;
|
|
11964
11993
|
}
|
|
@@ -11967,25 +11996,25 @@ function Ag(e) {
|
|
|
11967
11996
|
}
|
|
11968
11997
|
return n;
|
|
11969
11998
|
}
|
|
11970
|
-
function
|
|
11971
|
-
return
|
|
11999
|
+
function Fg(e) {
|
|
12000
|
+
return Zm(e).replace(/\s+/gu, " ");
|
|
11972
12001
|
}
|
|
11973
|
-
function
|
|
11974
|
-
let t =
|
|
12002
|
+
function Ig(e) {
|
|
12003
|
+
let t = Fg(e), n = /\b(?:entr(?:e|ent|era|eront)\s+en\s+vigueur|s['’]?\s*appli(?:que|quent)|est\s+applicable|sont\s+applicables?|applicables?)\b/giu, r = null, i;
|
|
11975
12004
|
for (; (i = n.exec(t)) !== null;) r = i;
|
|
11976
12005
|
return r;
|
|
11977
12006
|
}
|
|
11978
|
-
function
|
|
11979
|
-
let n =
|
|
11980
|
-
return !!(/\bau\s*$/u.test(n) && r.startsWith(",") || /\ba compter\s+(?:du|de la|de l['’]?|des)?\s*$/u.test(n) || /\babroge(?:e|es|s)?\s+a compter\s+(?:du|de la|de l['’]?|des)?\s*$/u.test(n) ||
|
|
12007
|
+
function Lg(e, t) {
|
|
12008
|
+
let n = Fg(e.slice(0, t.start)), r = Fg(e.slice(t.stop));
|
|
12009
|
+
return !!(/\bau\s*$/u.test(n) && r.startsWith(",") || /\ba compter\s+(?:du|de la|de l['’]?|des)?\s*$/u.test(n) || /\babroge(?:e|es|s)?\s+a compter\s+(?:du|de la|de l['’]?|des)?\s*$/u.test(n) || Ig(e.slice(0, t.start)));
|
|
11981
12010
|
}
|
|
11982
|
-
function
|
|
11983
|
-
return
|
|
12011
|
+
function Rg(e) {
|
|
12012
|
+
return Pg(e).find((t) => Lg(e, t))?.date;
|
|
11984
12013
|
}
|
|
11985
|
-
function
|
|
11986
|
-
return e.map((e) =>
|
|
12014
|
+
function zg(e) {
|
|
12015
|
+
return e.map((e) => Mg(e.num)).filter((e) => e.length > 0);
|
|
11987
12016
|
}
|
|
11988
|
-
function
|
|
12017
|
+
function Bg(e, t) {
|
|
11989
12018
|
let n = e.at(-1), r = t.at(-1);
|
|
11990
12019
|
if (!n || !r) return [e, t];
|
|
11991
12020
|
let i = e.slice(0, -1), a = t.slice(0, -1);
|
|
@@ -11996,51 +12025,51 @@ function Ig(e, t) {
|
|
|
11996
12025
|
for (let e = o; e <= s; e += 1) c.push([...i, String(e)]);
|
|
11997
12026
|
return c;
|
|
11998
12027
|
}
|
|
11999
|
-
function
|
|
12028
|
+
function Vg(e) {
|
|
12000
12029
|
if (e.kind === "single") {
|
|
12001
|
-
let t =
|
|
12030
|
+
let t = zg(e.steps);
|
|
12002
12031
|
return t.length > 0 ? [t] : [];
|
|
12003
12032
|
}
|
|
12004
|
-
let t =
|
|
12005
|
-
return t.length === 0 && n.length === 0 ? [] :
|
|
12033
|
+
let t = zg(e.first), n = zg(e.last);
|
|
12034
|
+
return t.length === 0 && n.length === 0 ? [] : Bg(t, n);
|
|
12006
12035
|
}
|
|
12007
|
-
function
|
|
12008
|
-
let t =
|
|
12009
|
-
for (let e of t.map(
|
|
12036
|
+
function Hg(e) {
|
|
12037
|
+
let t = Hm(new n(e)), r = [];
|
|
12038
|
+
for (let e of t.map(hg)) {
|
|
12010
12039
|
if (e.type === "article" && e.present) {
|
|
12011
12040
|
r.push([]);
|
|
12012
12041
|
continue;
|
|
12013
12042
|
}
|
|
12014
|
-
for (let t of Rp(e)) r.push(...
|
|
12043
|
+
for (let t of Rp(e)) r.push(...Vg(t));
|
|
12015
12044
|
}
|
|
12016
12045
|
return r.filter((e, t, n) => n.findIndex((t) => t.join("\0") === e.join("\0")) === t);
|
|
12017
12046
|
}
|
|
12018
|
-
function
|
|
12047
|
+
function Ug(e) {
|
|
12019
12048
|
let t = [], n = e.split(/(?<=[.;])\s+/u).map((e) => e.trim()).filter(Boolean);
|
|
12020
|
-
for (let e of n) for (let n of
|
|
12021
|
-
if (!
|
|
12022
|
-
let r =
|
|
12049
|
+
for (let e of n) for (let n of Pg(e)) {
|
|
12050
|
+
if (!Lg(e, n)) continue;
|
|
12051
|
+
let r = Ig(e.slice(0, n.start));
|
|
12023
12052
|
if (!r) continue;
|
|
12024
|
-
let i =
|
|
12053
|
+
let i = Hg(e.slice(0, r.index).trim());
|
|
12025
12054
|
if (i.length === 0) continue;
|
|
12026
12055
|
t.push({
|
|
12027
12056
|
date: n.date,
|
|
12028
12057
|
paths: i
|
|
12029
12058
|
});
|
|
12030
|
-
let a =
|
|
12059
|
+
let a = Wg(e.slice(n.stop), i);
|
|
12031
12060
|
t.push(...a);
|
|
12032
12061
|
}
|
|
12033
12062
|
return t;
|
|
12034
12063
|
}
|
|
12035
|
-
function
|
|
12064
|
+
function Wg(e, t) {
|
|
12036
12065
|
let n = /(?:^|[^\p{L}\p{N}_])(?:a|à)\s+l['’]exception\s+(.+?)(?:\bqui\b|\bentr(?:e|ent|era|eront)\s+en\s+vigueur\b)/iu.exec(e);
|
|
12037
12066
|
if (!n) return [];
|
|
12038
12067
|
let r = n.index + n[0].length, i = n[1]?.trim();
|
|
12039
12068
|
if (!i) return [];
|
|
12040
|
-
let a =
|
|
12069
|
+
let a = Hg(i);
|
|
12041
12070
|
if (a.length === 0) return [];
|
|
12042
12071
|
let o = [];
|
|
12043
|
-
for (let n of
|
|
12072
|
+
for (let n of Pg(e.slice(r))) {
|
|
12044
12073
|
let e = n.date;
|
|
12045
12074
|
o.push({
|
|
12046
12075
|
date: e,
|
|
@@ -12051,44 +12080,44 @@ function Bg(e, t) {
|
|
|
12051
12080
|
}
|
|
12052
12081
|
return o;
|
|
12053
12082
|
}
|
|
12054
|
-
function
|
|
12083
|
+
function Gg(e, t, n) {
|
|
12055
12084
|
return [
|
|
12056
12085
|
...e,
|
|
12057
|
-
|
|
12058
|
-
...
|
|
12086
|
+
Mg(t.marker),
|
|
12087
|
+
...fg(n).map(Mg)
|
|
12059
12088
|
].filter((e) => e.length > 0);
|
|
12060
12089
|
}
|
|
12061
|
-
function
|
|
12090
|
+
function Kg(e) {
|
|
12062
12091
|
let t = [];
|
|
12063
|
-
for (let n of e) t.push(...
|
|
12092
|
+
for (let n of e) t.push(...Ug(Ag(n))), t.push(...Kg(n.children));
|
|
12064
12093
|
return t;
|
|
12065
12094
|
}
|
|
12066
|
-
function
|
|
12095
|
+
function qg(e, t) {
|
|
12067
12096
|
return t.length > e.length ? !1 : t.every((t, n) => e[n] === t);
|
|
12068
12097
|
}
|
|
12069
|
-
function
|
|
12098
|
+
function Jg(e, t) {
|
|
12070
12099
|
if (t.length > e.length) return !1;
|
|
12071
12100
|
let n = e.length - t.length;
|
|
12072
12101
|
return t.every((t, r) => e[n + r] === t);
|
|
12073
12102
|
}
|
|
12074
|
-
function
|
|
12075
|
-
return n ? n.some((n) =>
|
|
12103
|
+
function Yg(e, t, n) {
|
|
12104
|
+
return n ? n.some((n) => Yg(e, n) ? Yg(e, qg(e, n) ? [...n, ...t] : t) : !1) : t.length === 0 ? !0 : qg(e, t) || Jg(e, t);
|
|
12076
12105
|
}
|
|
12077
|
-
function
|
|
12106
|
+
function Xg(e, t, n) {
|
|
12078
12107
|
if (e.length === 0 || n.length === 0) return;
|
|
12079
12108
|
let r = new Map(t.map((e) => [e.directive, e.sourcePath]));
|
|
12080
12109
|
for (let t of e) {
|
|
12081
12110
|
if (t.applicabilityDate) continue;
|
|
12082
12111
|
let e = r.get(t) ?? [], i, a = -1;
|
|
12083
12112
|
for (let t of n) for (let n of t.paths) {
|
|
12084
|
-
if (!
|
|
12113
|
+
if (!Yg(e, n, t.parentPaths)) continue;
|
|
12085
12114
|
let r = n.length + Math.max(0, ...t.parentPaths?.map((e) => e.length) ?? [0]);
|
|
12086
12115
|
r > a && (i = t.date, a = r);
|
|
12087
12116
|
}
|
|
12088
12117
|
i && (t.applicabilityDate = i);
|
|
12089
12118
|
}
|
|
12090
12119
|
}
|
|
12091
|
-
function
|
|
12120
|
+
function Zg(e, t) {
|
|
12092
12121
|
if (!e) return t;
|
|
12093
12122
|
if (!t) return e;
|
|
12094
12123
|
let n = t.rowIndex ?? e.rowIndex, r = t.columnIndex ?? e.columnIndex;
|
|
@@ -12098,39 +12127,39 @@ function qg(e, t) {
|
|
|
12098
12127
|
...r ? { columnIndex: r } : {}
|
|
12099
12128
|
};
|
|
12100
12129
|
}
|
|
12101
|
-
function
|
|
12130
|
+
function Qg(e) {
|
|
12102
12131
|
return e !== void 0 && (e.rowIndex !== void 0 || e.columnIndex !== void 0);
|
|
12103
12132
|
}
|
|
12104
|
-
function
|
|
12133
|
+
function $g(e, t, n, r, i = [], a = []) {
|
|
12105
12134
|
let o = [], s = t;
|
|
12106
12135
|
for (let c of e) {
|
|
12107
|
-
let e =
|
|
12136
|
+
let e = sg(c.line.text), l = Gg(i, c, e), u = Ag(c);
|
|
12108
12137
|
if (!u) continue;
|
|
12109
|
-
let d =
|
|
12110
|
-
if (
|
|
12138
|
+
let d = Zg(r, c_(u, r !== void 0)), f = yg(e), p = Og(t, f);
|
|
12139
|
+
if (mg(u) === null) {
|
|
12111
12140
|
if (c.children.length > 0) {
|
|
12112
|
-
let e = p ?? t, r =
|
|
12141
|
+
let e = p ?? t, r = $g(c.children, e, n, d, l, a);
|
|
12113
12142
|
r.length > 0 && (o.push(...r), s = r[r.length - 1]?.reference ?? s);
|
|
12114
12143
|
continue;
|
|
12115
12144
|
}
|
|
12116
12145
|
s = p ?? s;
|
|
12117
12146
|
continue;
|
|
12118
12147
|
}
|
|
12119
|
-
let m =
|
|
12148
|
+
let m = gg(u), h = Og(t, _g(u) ?? m ?? f) ?? m ?? p;
|
|
12120
12149
|
if (!h) {
|
|
12121
12150
|
if (c.children.length > 0) {
|
|
12122
|
-
let e =
|
|
12151
|
+
let e = $g(c.children, p ?? t, n, d, l, a);
|
|
12123
12152
|
o.push(...e);
|
|
12124
12153
|
}
|
|
12125
12154
|
continue;
|
|
12126
12155
|
}
|
|
12127
|
-
h =
|
|
12128
|
-
let g =
|
|
12156
|
+
h = Tg(h, Eg(h) ? s ?? t : t);
|
|
12157
|
+
let g = w_({
|
|
12129
12158
|
action: { action: "modifier" },
|
|
12130
12159
|
reference: h,
|
|
12131
12160
|
sourcePosition: {
|
|
12132
12161
|
start: c.line.start,
|
|
12133
|
-
stop:
|
|
12162
|
+
stop: jg(c)
|
|
12134
12163
|
},
|
|
12135
12164
|
sourceText: u,
|
|
12136
12165
|
fullText: n,
|
|
@@ -12138,7 +12167,7 @@ function Yg(e, t, n, r, i = [], a = []) {
|
|
|
12138
12167
|
});
|
|
12139
12168
|
if (!g) {
|
|
12140
12169
|
if (s = h, c.children.length > 0) {
|
|
12141
|
-
let e =
|
|
12170
|
+
let e = $g(c.children, p ?? h, n, d, l, a);
|
|
12142
12171
|
o.push(...e), s = e[e.length - 1]?.reference ?? s;
|
|
12143
12172
|
}
|
|
12144
12173
|
continue;
|
|
@@ -12154,19 +12183,19 @@ function Yg(e, t, n, r, i = [], a = []) {
|
|
|
12154
12183
|
sourcePath: l
|
|
12155
12184
|
});
|
|
12156
12185
|
if (s = h, c.children.length > 0) {
|
|
12157
|
-
let e =
|
|
12186
|
+
let e = $g(c.children, p ?? h, n, d, l, a);
|
|
12158
12187
|
e.length > 0 && (o.push(...e), s = e[e.length - 1]?.reference ?? s);
|
|
12159
12188
|
}
|
|
12160
12189
|
}
|
|
12161
|
-
return
|
|
12190
|
+
return C_(o);
|
|
12162
12191
|
}
|
|
12163
|
-
function
|
|
12164
|
-
let t =
|
|
12192
|
+
function e_(e) {
|
|
12193
|
+
let t = cg(e), n = t.findIndex((e) => lg(e.text));
|
|
12165
12194
|
if (n === -1) return null;
|
|
12166
|
-
let r = t.slice(0, n).reverse().map((e) =>
|
|
12167
|
-
return
|
|
12195
|
+
let r = t.slice(0, n).reverse().map((e) => yg(e.text)).find((e) => e !== null) ?? null, i = Dg(t.slice(n)), a = [], o = $g(i, r, e, void 0, [], a);
|
|
12196
|
+
return Xg(o, a, Kg(i)), o.length > 0 ? o : null;
|
|
12168
12197
|
}
|
|
12169
|
-
function
|
|
12198
|
+
function t_(e, t) {
|
|
12170
12199
|
let n = e.indexOf("«");
|
|
12171
12200
|
if (n === -1) return;
|
|
12172
12201
|
let r = e.indexOf("»", n + 1);
|
|
@@ -12181,40 +12210,40 @@ function Zg(e, t) {
|
|
|
12181
12210
|
}
|
|
12182
12211
|
};
|
|
12183
12212
|
}
|
|
12184
|
-
function
|
|
12185
|
-
let t =
|
|
12213
|
+
function n_(e) {
|
|
12214
|
+
let t = Zm(e);
|
|
12186
12215
|
return /\btableau\b/.test(t) && /\b(?:tableau|celui)\s+(?:suivant|ainsi\s+redigee?|ainsi\s+rediges|ainsi\s+redigees)\b/.test(t);
|
|
12187
12216
|
}
|
|
12188
|
-
function
|
|
12189
|
-
for (let t of
|
|
12190
|
-
if (!
|
|
12217
|
+
function r_(e) {
|
|
12218
|
+
for (let t of cg(e)) {
|
|
12219
|
+
if (!n_(t.text)) continue;
|
|
12191
12220
|
let e = t.text.indexOf(":");
|
|
12192
12221
|
return e === -1 ? t.end : t.start + e + 1;
|
|
12193
12222
|
}
|
|
12194
12223
|
return null;
|
|
12195
12224
|
}
|
|
12196
|
-
function
|
|
12197
|
-
let n =
|
|
12198
|
-
return n === null ?
|
|
12225
|
+
function i_(e, t) {
|
|
12226
|
+
let n = r_(e);
|
|
12227
|
+
return n === null ? t_(e, t) : t_(e.slice(n), t + n);
|
|
12199
12228
|
}
|
|
12200
|
-
function
|
|
12201
|
-
return
|
|
12229
|
+
function a_(e, t) {
|
|
12230
|
+
return Zh(e, t);
|
|
12202
12231
|
}
|
|
12203
|
-
function
|
|
12204
|
-
let n =
|
|
12232
|
+
function o_(e, t) {
|
|
12233
|
+
let n = bm(e, t);
|
|
12205
12234
|
return n && n > 1 ? n : void 0;
|
|
12206
12235
|
}
|
|
12207
|
-
function
|
|
12236
|
+
function s_(e, t) {
|
|
12208
12237
|
if (!Array.isArray(e) || e.length < 2 || t.length < e.length) return e;
|
|
12209
12238
|
let n = e[0];
|
|
12210
12239
|
return e.some((e) => JSON.stringify(e) !== JSON.stringify(n)) ? e : n;
|
|
12211
12240
|
}
|
|
12212
|
-
function
|
|
12213
|
-
let n =
|
|
12241
|
+
function c_(e, t = !1) {
|
|
12242
|
+
let n = wh(e, Ch(e)), r = Zm(n), i = /\btableau\b/.test(r);
|
|
12214
12243
|
if (!i && !t) return;
|
|
12215
12244
|
let a = (e) => {
|
|
12216
12245
|
if (!e) return;
|
|
12217
|
-
let t = e.replace(/^(?:a|à)\s+la\s+/iu, "").trim(), n =
|
|
12246
|
+
let t = e.replace(/^(?:a|à)\s+la\s+/iu, "").trim(), n = Zm(t);
|
|
12218
12247
|
if (/^derni(?:er|ere)s?\b/u.test(n)) return -1;
|
|
12219
12248
|
let r = be(t);
|
|
12220
12249
|
return r && r > 0 ? r : void 0;
|
|
@@ -12235,30 +12264,30 @@ function i_(e, t = !1) {
|
|
|
12235
12264
|
let l = /\bla\s+(.+?)\s+ligne\b/iu.exec(n), u = /\bla\s+(.+?)\s+colonne\b/iu.exec(n);
|
|
12236
12265
|
return o(a(l?.[1]), a(u?.[1])) || (i ? { type: "table" } : void 0);
|
|
12237
12266
|
}
|
|
12238
|
-
function
|
|
12267
|
+
function l_(e) {
|
|
12239
12268
|
return e.replace(/(?:[,;:]\s*)?(?:(?:le|la|les|l['’])\s+)?(?:année|date|dispositions?|mention|montant|mot|mots|nombre|nombres|pourcentage|référence|références|signe|taux|texte|phrase|phrases|tableau)(?:\s+[^,;:]*)?\s*:?\s*$/iu, "").trimEnd();
|
|
12240
12269
|
}
|
|
12241
|
-
function
|
|
12270
|
+
function u_(e) {
|
|
12242
12271
|
return e.replace(/(?:[,;:]\s*)?(?:(?:le|la|les|l['’])\s+)?(?:année|date|dispositions?|mention|montant|mot|mots|nombre|nombres|pourcentage|référence|références|signe|taux|texte|tableau)(?:\s+[^,;:]*)?\s*:?\s*$/iu, "").trimEnd();
|
|
12243
12272
|
}
|
|
12244
|
-
var
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12273
|
+
var d_ = [
|
|
12274
|
+
f_("(?:la\\s+date\\s+d(?:u|e|[’']))"),
|
|
12275
|
+
f_("(?:le\\s+montant\\s+d(?:e|[’']))"),
|
|
12276
|
+
f_("(?:la\\s+référence\\s+à)")
|
|
12248
12277
|
];
|
|
12249
|
-
function
|
|
12278
|
+
function f_(e) {
|
|
12250
12279
|
return new RegExp(String.raw`(?:^|[,;:]\s*)${e}\s+(?<target>.+?)\s+(?:est|sont)\s+remplac[eé]e?s?\s+par\s+${e}\s+(?<replacement>.+?)(?=\s*(?:[.;]|$))`, "iu");
|
|
12251
12280
|
}
|
|
12252
|
-
function
|
|
12281
|
+
function p_(e) {
|
|
12253
12282
|
return e.replace(/\s+/gu, " ").replace(/\s+([,;])/gu, "$1").trim();
|
|
12254
12283
|
}
|
|
12255
|
-
function
|
|
12284
|
+
function m_(e) {
|
|
12256
12285
|
if (e.includes("«") || e.includes("»")) return null;
|
|
12257
|
-
for (let t of
|
|
12286
|
+
for (let t of d_) {
|
|
12258
12287
|
let n = t.exec(e), r = n?.groups?.target, i = n?.groups?.replacement;
|
|
12259
12288
|
if (!(!r || !i)) return {
|
|
12260
|
-
targetText:
|
|
12261
|
-
replacementText:
|
|
12289
|
+
targetText: p_(r),
|
|
12290
|
+
replacementText: p_(i),
|
|
12262
12291
|
operandRange: {
|
|
12263
12292
|
start: n.index,
|
|
12264
12293
|
end: n.index + n[0].length
|
|
@@ -12267,19 +12296,22 @@ function u_(e) {
|
|
|
12267
12296
|
}
|
|
12268
12297
|
return null;
|
|
12269
12298
|
}
|
|
12270
|
-
function
|
|
12271
|
-
let t =
|
|
12299
|
+
function h_(e) {
|
|
12300
|
+
let t = m_(e);
|
|
12272
12301
|
return t ? [t.operandRange] : [];
|
|
12273
12302
|
}
|
|
12274
|
-
function
|
|
12275
|
-
return
|
|
12303
|
+
function g_(e, t) {
|
|
12304
|
+
return Eh(e.position, t) ? !0 : Array.from(O(hg(e))).some((e) => Eh(e.position, t));
|
|
12276
12305
|
}
|
|
12277
|
-
function
|
|
12278
|
-
let o =
|
|
12306
|
+
function __(e, t, n, r, i, a) {
|
|
12307
|
+
let o = Zm(e), s = Zm(wh(e, i)), c = Qm(s, o), l = $m(s), u = eh(s), d = n.action === "rétablir" || th(s), f = nh(s) || d, p = rh(s), m = ih(s), h = n_(e), g = u ? "insert_before" : "insert_after", _ = l ? Yh(s) : null, v = p ? _ : null, y = m ? _ : null, ee = () => {
|
|
12279
12308
|
let n = i[0]?.start;
|
|
12280
|
-
return (n === void 0 ? void 0 :
|
|
12281
|
-
}, te = (
|
|
12282
|
-
let
|
|
12309
|
+
return (n === void 0 ? void 0 : o_(t, n)) ?? ym(e) ?? void 0;
|
|
12310
|
+
}, te = () => {
|
|
12311
|
+
let e = i[0]?.start;
|
|
12312
|
+
return (e === void 0 ? void 0 : a_(t, e)) ?? void 0;
|
|
12313
|
+
}, ne = ({ kind: e, targetText: t, insertText: n, expectsFollowingTable: r }) => {
|
|
12314
|
+
let i = ig({
|
|
12283
12315
|
hasRedactionIntro: c,
|
|
12284
12316
|
insertText: n,
|
|
12285
12317
|
normalized: o
|
|
@@ -12298,7 +12330,7 @@ function p_(e, t, n, r, i, a) {
|
|
|
12298
12330
|
kind: "delete",
|
|
12299
12331
|
targetText: e[0],
|
|
12300
12332
|
extraTargetTexts: e.slice(1)
|
|
12301
|
-
},
|
|
12333
|
+
}, ne({
|
|
12302
12334
|
kind: g,
|
|
12303
12335
|
targetText: t,
|
|
12304
12336
|
insertText: n,
|
|
@@ -12311,7 +12343,7 @@ function p_(e, t, n, r, i, a) {
|
|
|
12311
12343
|
kind: "delete",
|
|
12312
12344
|
targetText: e[0],
|
|
12313
12345
|
extraTargetTexts: e.slice(1)
|
|
12314
|
-
},
|
|
12346
|
+
}, ne({
|
|
12315
12347
|
kind: "insert_after",
|
|
12316
12348
|
targetText: "",
|
|
12317
12349
|
insertText: t,
|
|
@@ -12324,7 +12356,7 @@ function p_(e, t, n, r, i, a) {
|
|
|
12324
12356
|
kind: "replace",
|
|
12325
12357
|
targetText: a[0],
|
|
12326
12358
|
replacementText: a[1]
|
|
12327
|
-
},
|
|
12359
|
+
}, ne({
|
|
12328
12360
|
kind: g,
|
|
12329
12361
|
targetText: e,
|
|
12330
12362
|
insertText: t,
|
|
@@ -12356,8 +12388,8 @@ function p_(e, t, n, r, i, a) {
|
|
|
12356
12388
|
...v ? { targetScope: v } : {}
|
|
12357
12389
|
}];
|
|
12358
12390
|
}
|
|
12359
|
-
let
|
|
12360
|
-
if (p && !f && a.length >= 4 && a.length % 2 == 0 &&
|
|
12391
|
+
let re = s.match(/\bremplace(?:e|es|s)?\b/gu)?.length ?? 0;
|
|
12392
|
+
if (p && !f && a.length >= 4 && a.length % 2 == 0 && re >= 2) {
|
|
12361
12393
|
let e = [];
|
|
12362
12394
|
for (let t = 0; t < a.length; t += 2) e.push({
|
|
12363
12395
|
kind: "replace",
|
|
@@ -12386,7 +12418,7 @@ function p_(e, t, n, r, i, a) {
|
|
|
12386
12418
|
replacement: { type: "following_table" }
|
|
12387
12419
|
};
|
|
12388
12420
|
if (p && !f && !m && a.length === 0) {
|
|
12389
|
-
let t =
|
|
12421
|
+
let t = m_(e);
|
|
12390
12422
|
if (t) return {
|
|
12391
12423
|
kind: "replace",
|
|
12392
12424
|
targetText: t.targetText,
|
|
@@ -12395,11 +12427,12 @@ function p_(e, t, n, r, i, a) {
|
|
|
12395
12427
|
};
|
|
12396
12428
|
}
|
|
12397
12429
|
if (p && a.length >= 2) {
|
|
12398
|
-
let e = ee();
|
|
12430
|
+
let e = ee(), t = te();
|
|
12399
12431
|
return {
|
|
12400
12432
|
kind: "replace",
|
|
12401
12433
|
targetText: a[0],
|
|
12402
12434
|
replacementText: a[1],
|
|
12435
|
+
...t ? { occurrenceIndex: t } : {},
|
|
12403
12436
|
...e ? { targetOccurrenceCount: e } : {},
|
|
12404
12437
|
...v ? { targetScope: v } : {}
|
|
12405
12438
|
};
|
|
@@ -12411,7 +12444,7 @@ function p_(e, t, n, r, i, a) {
|
|
|
12411
12444
|
targetScope: _
|
|
12412
12445
|
};
|
|
12413
12446
|
if (!f && a.length === 1 && c) {
|
|
12414
|
-
let e =
|
|
12447
|
+
let e = ag({
|
|
12415
12448
|
hasRedactionIntro: c,
|
|
12416
12449
|
normalized: o,
|
|
12417
12450
|
replacementText: a[0]
|
|
@@ -12425,7 +12458,7 @@ function p_(e, t, n, r, i, a) {
|
|
|
12425
12458
|
...e ? { replacementLayout: e } : {}
|
|
12426
12459
|
};
|
|
12427
12460
|
}
|
|
12428
|
-
if (f && h) return
|
|
12461
|
+
if (f && h) return ne(u ? {
|
|
12429
12462
|
kind: "insert_before",
|
|
12430
12463
|
targetText: "",
|
|
12431
12464
|
insertText: "",
|
|
@@ -12437,20 +12470,20 @@ function p_(e, t, n, r, i, a) {
|
|
|
12437
12470
|
expectsFollowingTable: !0
|
|
12438
12471
|
});
|
|
12439
12472
|
if (f && a.length >= 2) {
|
|
12440
|
-
if (l) return
|
|
12473
|
+
if (l) return ne({
|
|
12441
12474
|
kind: "insert_after",
|
|
12442
12475
|
targetText: a[0],
|
|
12443
12476
|
insertText: a[1],
|
|
12444
12477
|
expectsFollowingTable: h
|
|
12445
12478
|
});
|
|
12446
|
-
if (u) return
|
|
12479
|
+
if (u) return ne({
|
|
12447
12480
|
kind: "insert_before",
|
|
12448
12481
|
targetText: a[0],
|
|
12449
12482
|
insertText: a[1],
|
|
12450
12483
|
expectsFollowingTable: h
|
|
12451
12484
|
});
|
|
12452
12485
|
}
|
|
12453
|
-
return f && a.length === 1 ?
|
|
12486
|
+
return f && a.length === 1 ? ne(l ? {
|
|
12454
12487
|
kind: "insert_after",
|
|
12455
12488
|
targetText: "",
|
|
12456
12489
|
insertText: a[0],
|
|
@@ -12467,11 +12500,11 @@ function p_(e, t, n, r, i, a) {
|
|
|
12467
12500
|
expectsFollowingTable: h
|
|
12468
12501
|
}) : null;
|
|
12469
12502
|
}
|
|
12470
|
-
function
|
|
12471
|
-
let t =
|
|
12503
|
+
function v_(e) {
|
|
12504
|
+
let t = Zm(e);
|
|
12472
12505
|
return /\bapres\b/.test(t) && /\bla\s+fin\s+(?:(?:de\s+l['’]?)|d['’]?|de|du|des)?\s*$/u.test(t);
|
|
12473
12506
|
}
|
|
12474
|
-
function
|
|
12507
|
+
function y_(e) {
|
|
12475
12508
|
switch (e.kind) {
|
|
12476
12509
|
case "insert_after":
|
|
12477
12510
|
case "insert_before": return {
|
|
@@ -12487,6 +12520,7 @@ function h_(e) {
|
|
|
12487
12520
|
targetText: e.targetText,
|
|
12488
12521
|
replacementText: e.replacementText,
|
|
12489
12522
|
replacement: e.replacement,
|
|
12523
|
+
...e.occurrenceIndex === void 0 ? {} : { occurrenceIndex: e.occurrenceIndex },
|
|
12490
12524
|
...e.targetOccurrenceCount === void 0 ? {} : { targetOccurrenceCount: e.targetOccurrenceCount },
|
|
12491
12525
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12492
12526
|
...e.tableTarget ? { tableTarget: e.tableTarget } : {}
|
|
@@ -12514,7 +12548,7 @@ function h_(e) {
|
|
|
12514
12548
|
case "delete_article": return { kind: "delete_article" };
|
|
12515
12549
|
}
|
|
12516
12550
|
}
|
|
12517
|
-
function
|
|
12551
|
+
function b_(e) {
|
|
12518
12552
|
let t = (t) => {
|
|
12519
12553
|
let n = e[t];
|
|
12520
12554
|
return typeof n == "string" ? n : "";
|
|
@@ -12531,7 +12565,7 @@ function g_(e) {
|
|
|
12531
12565
|
o
|
|
12532
12566
|
].join("|");
|
|
12533
12567
|
}
|
|
12534
|
-
function
|
|
12568
|
+
function x_(e, t, n) {
|
|
12535
12569
|
return t.targetType === n.targetType && JSON.stringify(t.reference) === JSON.stringify(n.reference) && JSON.stringify(t.portionSelectors) === JSON.stringify(n.portionSelectors) ? e : {
|
|
12536
12570
|
...e,
|
|
12537
12571
|
targetType: t.targetType,
|
|
@@ -12539,10 +12573,10 @@ function __(e, t, n) {
|
|
|
12539
12573
|
portionSelectors: t.portionSelectors
|
|
12540
12574
|
};
|
|
12541
12575
|
}
|
|
12542
|
-
function
|
|
12543
|
-
return (e.kind === "compound" ? e.operations : [
|
|
12576
|
+
function S_(e, t) {
|
|
12577
|
+
return (e.kind === "compound" ? e.operations : [y_(e)]).map((n) => x_(n, e, t));
|
|
12544
12578
|
}
|
|
12545
|
-
function
|
|
12579
|
+
function C_(e) {
|
|
12546
12580
|
let t = [];
|
|
12547
12581
|
for (let n = 0; n < e.length; n += 1) {
|
|
12548
12582
|
let r = e[n];
|
|
@@ -12557,14 +12591,14 @@ function y_(e) {
|
|
|
12557
12591
|
continue;
|
|
12558
12592
|
}
|
|
12559
12593
|
let o = i[0], s = [];
|
|
12560
|
-
for (let [e, t] of i.entries()) for (let [n, r] of
|
|
12594
|
+
for (let [e, t] of i.entries()) for (let [n, r] of S_(t, o).entries()) s.push({
|
|
12561
12595
|
directiveIndex: e,
|
|
12562
12596
|
operationIndex: n,
|
|
12563
12597
|
operation: r
|
|
12564
12598
|
});
|
|
12565
12599
|
let c = /* @__PURE__ */ new Set(), l = [];
|
|
12566
12600
|
for (let e = s.length - 1; e >= 0; --e) {
|
|
12567
|
-
let t = s[e], n =
|
|
12601
|
+
let t = s[e], n = b_(t.operation);
|
|
12568
12602
|
c.has(n) || (c.add(n), l.push(t));
|
|
12569
12603
|
}
|
|
12570
12604
|
l.sort((e, t) => e.directiveIndex - t.directiveIndex || e.operationIndex - t.operationIndex), t.push({
|
|
@@ -12583,14 +12617,14 @@ function y_(e) {
|
|
|
12583
12617
|
}
|
|
12584
12618
|
return t;
|
|
12585
12619
|
}
|
|
12586
|
-
function
|
|
12587
|
-
let o = e.target ?? bt(t), s = Rp(t), c = i && n.start < i.length ? i.slice(n.start) : r, l = i && n.start < i.length ? n.start : 0, u = i === r && n.start < r.length && !
|
|
12620
|
+
function w_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullText: i, tableTarget: a }) {
|
|
12621
|
+
let o = e.target ?? bt(t), s = Rp(t), c = i && n.start < i.length ? i.slice(n.start) : r, l = i && n.start < i.length ? n.start : 0, u = i === r && n.start < r.length && !v_(r.slice(0, n.start)) ? r.slice(n.start) : r, d = Ch(u), f = __(r, u, e, o, d, d.map((e) => e.text));
|
|
12588
12622
|
if (!f) return null;
|
|
12589
|
-
let p =
|
|
12623
|
+
let p = s_(f, s), m = Rg(r), h = {
|
|
12590
12624
|
...m ? { applicabilityDate: m } : {},
|
|
12591
12625
|
sourcePosition: n,
|
|
12592
12626
|
sourceText: r
|
|
12593
|
-
}, g =
|
|
12627
|
+
}, g = i_(c, l), _ = (e) => {
|
|
12594
12628
|
switch (e.kind) {
|
|
12595
12629
|
case "insert_after":
|
|
12596
12630
|
case "insert_before": return {
|
|
@@ -12606,6 +12640,7 @@ function b_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12606
12640
|
targetText: e.targetText,
|
|
12607
12641
|
replacementText: e.replacementText,
|
|
12608
12642
|
replacement: e.replacement,
|
|
12643
|
+
...e.occurrenceIndex === void 0 ? {} : { occurrenceIndex: e.occurrenceIndex },
|
|
12609
12644
|
...e.targetOccurrenceCount === void 0 ? {} : { targetOccurrenceCount: e.targetOccurrenceCount },
|
|
12610
12645
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12611
12646
|
...e.tableTarget ? { tableTarget: e.tableTarget } : {}
|
|
@@ -12651,7 +12686,7 @@ function b_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12651
12686
|
insertText: e.insertText,
|
|
12652
12687
|
...e.insertLayout ? { insertLayout: e.insertLayout } : {},
|
|
12653
12688
|
...e.expectsFollowingTable && g ? { citation: g } : {},
|
|
12654
|
-
...
|
|
12689
|
+
...Qg(a) ? { tableTarget: a } : {},
|
|
12655
12690
|
...h
|
|
12656
12691
|
};
|
|
12657
12692
|
case "replace": return {
|
|
@@ -12665,9 +12700,10 @@ function b_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12665
12700
|
type: "text",
|
|
12666
12701
|
text: e.replacementText
|
|
12667
12702
|
},
|
|
12703
|
+
...e.occurrenceIndex === void 0 ? {} : { occurrenceIndex: e.occurrenceIndex },
|
|
12668
12704
|
...e.targetOccurrenceCount === void 0 ? {} : { targetOccurrenceCount: e.targetOccurrenceCount },
|
|
12669
12705
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12670
|
-
...
|
|
12706
|
+
...Qg(a) ? { tableTarget: a } : {},
|
|
12671
12707
|
...h
|
|
12672
12708
|
};
|
|
12673
12709
|
case "replace_portion": return e.replacement.type === "following_table" && !g ? null : {
|
|
@@ -12679,11 +12715,11 @@ function b_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12679
12715
|
replacement: e.replacement,
|
|
12680
12716
|
...e.replacementLayout ? { replacementLayout: e.replacementLayout } : {},
|
|
12681
12717
|
...e.replacement.type === "following_table" && g ? { citation: g } : {},
|
|
12682
|
-
...
|
|
12718
|
+
...Qg(a) ? { tableTarget: a } : {},
|
|
12683
12719
|
...h
|
|
12684
12720
|
};
|
|
12685
12721
|
case "delete": {
|
|
12686
|
-
let n = d.map((e) =>
|
|
12722
|
+
let n = d.map((e) => a_(u, e.start)), r = /* @__PURE__ */ new Map();
|
|
12687
12723
|
for (let [e, t] of d.entries()) r.has(t.text) || r.set(t.text, n[e] ?? null);
|
|
12688
12724
|
let i = [e.targetText, ...e.extraTargetTexts ?? []].filter((e) => e && e.trim().length > 0).filter((e, t, n) => n.indexOf(e) === t);
|
|
12689
12725
|
return i.length > 1 ? v(i.map((t) => ({
|
|
@@ -12692,7 +12728,7 @@ function b_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12692
12728
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12693
12729
|
occurrenceIndex: r.get(t) ?? void 0,
|
|
12694
12730
|
...t === e.targetText && e.targetOccurrenceCount !== void 0 ? { targetOccurrenceCount: e.targetOccurrenceCount } : {},
|
|
12695
|
-
...
|
|
12731
|
+
...Qg(a) ? { tableTarget: a } : {}
|
|
12696
12732
|
}))) : {
|
|
12697
12733
|
kind: "delete",
|
|
12698
12734
|
targetType: o,
|
|
@@ -12702,7 +12738,7 @@ function b_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12702
12738
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12703
12739
|
occurrenceIndex: r.get(e.targetText) ?? void 0,
|
|
12704
12740
|
...e.targetOccurrenceCount === void 0 ? {} : { targetOccurrenceCount: e.targetOccurrenceCount },
|
|
12705
|
-
...
|
|
12741
|
+
...Qg(a) ? { tableTarget: a } : {},
|
|
12706
12742
|
...h
|
|
12707
12743
|
};
|
|
12708
12744
|
}
|
|
@@ -12711,7 +12747,7 @@ function b_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12711
12747
|
targetType: o,
|
|
12712
12748
|
reference: t,
|
|
12713
12749
|
portionSelectors: s,
|
|
12714
|
-
...
|
|
12750
|
+
...Qg(a) ? { tableTarget: a } : {},
|
|
12715
12751
|
...h
|
|
12716
12752
|
};
|
|
12717
12753
|
case "delete_article": return o === "article" ? {
|
|
@@ -12735,7 +12771,7 @@ function b_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12735
12771
|
}
|
|
12736
12772
|
return y(p);
|
|
12737
12773
|
}
|
|
12738
|
-
function
|
|
12774
|
+
function T_(e) {
|
|
12739
12775
|
let t = /\barticle\s+([0-9]+(?:-[0-9]+)?(?:\s*[A-Z])?(?:\s+[a-z]+)?)\b/i.exec(e);
|
|
12740
12776
|
if (!t || t.index === void 0) return null;
|
|
12741
12777
|
let n = t.index, r = t.index + t[0].length;
|
|
@@ -12754,57 +12790,57 @@ function x_(e) {
|
|
|
12754
12790
|
}
|
|
12755
12791
|
};
|
|
12756
12792
|
}
|
|
12757
|
-
function
|
|
12793
|
+
function E_(e, t) {
|
|
12758
12794
|
let i = r(e).output;
|
|
12759
12795
|
if (t.allowListExtraction) {
|
|
12760
|
-
let e =
|
|
12796
|
+
let e = e_(i);
|
|
12761
12797
|
if (e) return e;
|
|
12762
12798
|
}
|
|
12763
|
-
let a =
|
|
12764
|
-
if (l.length > 0 && (c = c.filter((e) => !
|
|
12765
|
-
let e =
|
|
12799
|
+
let a = Th(i), o = h_(i), s = Oh(i), c = Hm(new n(i)), l = [...a, ...o];
|
|
12800
|
+
if (l.length > 0 && (c = c.filter((e) => !g_(e, l))), c.length === 0 && (c = Hm(new n(s.split(",")[0] ?? s))), c.length === 0) {
|
|
12801
|
+
let e = T_(s);
|
|
12766
12802
|
e && (c = [{
|
|
12767
12803
|
...e.reference,
|
|
12768
12804
|
position: e.position
|
|
12769
12805
|
}]);
|
|
12770
12806
|
}
|
|
12771
|
-
let u =
|
|
12807
|
+
let u = mg(s);
|
|
12772
12808
|
if (c.length === 1 && c[0]?.type === "article") {
|
|
12773
|
-
let e =
|
|
12809
|
+
let e = bh(s, { actionIndex: u ?? s.length });
|
|
12774
12810
|
e && (c = [e]);
|
|
12775
12811
|
}
|
|
12776
12812
|
if (u !== null) {
|
|
12777
|
-
let e = c.some((e) => bt(
|
|
12813
|
+
let e = c.some((e) => bt(hg(e)) === "article"), t = c.some((e) => [...O(hg(e))].some((e) => e.type === "article")), n = s.slice(0, u), r = hh(l_(n), 0) ?? hh(n, 0), i = c.map(hg).sort((e, t) => gh(t) - gh(e) || _h(t) - _h(e))[0], a = vh(i ?? null, r);
|
|
12778
12814
|
if (!e && a && a === r && (c = [r]), !t) {
|
|
12779
12815
|
let e = i, t = n.indexOf(":");
|
|
12780
12816
|
if (t !== -1) {
|
|
12781
|
-
let r = t + 1, i =
|
|
12782
|
-
e && i &&
|
|
12817
|
+
let r = t + 1, i = hh(u_(n.slice(r)), r), a = i ? Rp(i) : [];
|
|
12818
|
+
e && i && gh(e) > 0 && (a.length > 1 || a.some((e) => e.kind === "range")) && (c = [kg(e, i)]);
|
|
12783
12819
|
}
|
|
12784
12820
|
}
|
|
12785
12821
|
if (t) {
|
|
12786
|
-
let e = c.map(
|
|
12787
|
-
t !== -1 && e && i &&
|
|
12822
|
+
let e = c.map(hg).filter((e) => [...O(e)].some((e) => e.type === "article")).sort((e, t) => gh(t) - gh(e) || _h(t) - _h(e))[0], t = n.indexOf(":"), r = t === -1 ? 0 : t + 1, i = hh(u_(n.slice(r)), r), a = i ? Rp(i) : [];
|
|
12823
|
+
t !== -1 && e && i && gh(e) > 0 && (a.length > 1 || a.some((e) => e.kind === "range")) && c.push(kg(e, i));
|
|
12788
12824
|
}
|
|
12789
12825
|
}
|
|
12790
12826
|
let d = [];
|
|
12791
12827
|
for (let e of c) {
|
|
12792
12828
|
if (e.type === "reference_et_action") {
|
|
12793
|
-
let t = e.position?.start ?? 0, n = i.lastIndexOf("\n", Math.max(0, t - 1)) + 1, r =
|
|
12829
|
+
let t = e.position?.start ?? 0, n = i.lastIndexOf("\n", Math.max(0, t - 1)) + 1, r = v_(i.slice(n, t)) ? n : t, a = {
|
|
12794
12830
|
start: r,
|
|
12795
12831
|
stop: i.length
|
|
12796
|
-
}, o = i.slice(r), s =
|
|
12832
|
+
}, o = i.slice(r), s = w_({
|
|
12797
12833
|
action: e.action,
|
|
12798
12834
|
reference: e.reference,
|
|
12799
12835
|
sourcePosition: a,
|
|
12800
12836
|
sourceText: o,
|
|
12801
12837
|
fullText: i,
|
|
12802
|
-
tableTarget:
|
|
12838
|
+
tableTarget: c_(o) ?? c_(i)
|
|
12803
12839
|
});
|
|
12804
12840
|
s && (Array.isArray(s) ? d.push(...s) : d.push(s));
|
|
12805
12841
|
continue;
|
|
12806
12842
|
}
|
|
12807
|
-
let t =
|
|
12843
|
+
let t = w_({
|
|
12808
12844
|
action: { action: "modifier" },
|
|
12809
12845
|
reference: e,
|
|
12810
12846
|
sourcePosition: e.position ?? {
|
|
@@ -12813,87 +12849,87 @@ function S_(e, t) {
|
|
|
12813
12849
|
},
|
|
12814
12850
|
sourceText: i,
|
|
12815
12851
|
fullText: i,
|
|
12816
|
-
tableTarget:
|
|
12852
|
+
tableTarget: c_(i)
|
|
12817
12853
|
});
|
|
12818
12854
|
t && (Array.isArray(t) ? d.push(...t) : d.push(t));
|
|
12819
12855
|
}
|
|
12820
12856
|
if (d.length === 0) {
|
|
12821
|
-
let e =
|
|
12857
|
+
let e = T_(s);
|
|
12822
12858
|
if (e) {
|
|
12823
|
-
let t =
|
|
12859
|
+
let t = w_({
|
|
12824
12860
|
action: { action: "modifier" },
|
|
12825
12861
|
reference: e.reference,
|
|
12826
12862
|
sourcePosition: e.position,
|
|
12827
12863
|
sourceText: i,
|
|
12828
12864
|
fullText: i,
|
|
12829
|
-
tableTarget:
|
|
12865
|
+
tableTarget: c_(i)
|
|
12830
12866
|
});
|
|
12831
12867
|
t && (Array.isArray(t) ? d.push(...t) : d.push(t));
|
|
12832
12868
|
}
|
|
12833
12869
|
}
|
|
12834
|
-
return
|
|
12870
|
+
return C_(d);
|
|
12835
12871
|
}
|
|
12836
|
-
function
|
|
12872
|
+
function D_(e) {
|
|
12837
12873
|
let t = new n(r(e).output);
|
|
12838
|
-
return [...
|
|
12874
|
+
return [...Kh.extract(t, { overlapWindow: 100 })];
|
|
12839
12875
|
}
|
|
12840
|
-
function
|
|
12841
|
-
return
|
|
12876
|
+
function O_(e) {
|
|
12877
|
+
return E_(e, { allowListExtraction: !0 });
|
|
12842
12878
|
}
|
|
12843
|
-
var
|
|
12844
|
-
function
|
|
12845
|
-
let t =
|
|
12846
|
-
return t.includes("«") || t.includes("»") || !e.trim().endsWith(":") ? !1 :
|
|
12879
|
+
var k_ = O_;
|
|
12880
|
+
function A_(e) {
|
|
12881
|
+
let t = Zm(e);
|
|
12882
|
+
return t.includes("«") || t.includes("»") || !e.trim().endsWith(":") ? !1 : ah(t);
|
|
12847
12883
|
}
|
|
12848
|
-
function
|
|
12884
|
+
function j_(e) {
|
|
12849
12885
|
return e.trimStart().startsWith("«");
|
|
12850
12886
|
}
|
|
12851
|
-
function
|
|
12887
|
+
function M_(e) {
|
|
12852
12888
|
return /»[.;]?\s*$/u.test(e);
|
|
12853
12889
|
}
|
|
12854
|
-
function
|
|
12890
|
+
function N_(e, t) {
|
|
12855
12891
|
for (let n = t; n < e.length; n += 1) {
|
|
12856
|
-
let t =
|
|
12892
|
+
let t = og(e[n]).trim();
|
|
12857
12893
|
if (t.length > 0) return t;
|
|
12858
12894
|
}
|
|
12859
12895
|
}
|
|
12860
|
-
function
|
|
12896
|
+
function P_(e, t) {
|
|
12861
12897
|
let n = [], r = !1, i = t + 1;
|
|
12862
12898
|
for (; i < e.length;) {
|
|
12863
|
-
let t = e[i], a =
|
|
12899
|
+
let t = e[i], a = og(t);
|
|
12864
12900
|
if (!r && a.includes("«") && (r = !0), r) {
|
|
12865
12901
|
n.push(a);
|
|
12866
|
-
let t =
|
|
12867
|
-
if (
|
|
12902
|
+
let t = N_(e, i + 1);
|
|
12903
|
+
if (M_(a) && (t === void 0 || !j_(t))) break;
|
|
12868
12904
|
} else if (a.trim().length > 0) break;
|
|
12869
12905
|
i += 1;
|
|
12870
12906
|
}
|
|
12871
12907
|
return !r || n.length === 0 ? null : {
|
|
12872
|
-
combinedText: [
|
|
12908
|
+
combinedText: [og(e[t]), ...n].join("\n"),
|
|
12873
12909
|
endIndex: i
|
|
12874
12910
|
};
|
|
12875
12911
|
}
|
|
12876
|
-
function
|
|
12912
|
+
function F_(e) {
|
|
12877
12913
|
let t = a()(e).output.split("\n").map((e) => e.trim()).filter((e) => e.length > 0), n = [];
|
|
12878
12914
|
for (let e = 0; e < t.length; e += 1) {
|
|
12879
12915
|
let r = t[e];
|
|
12880
|
-
if (
|
|
12881
|
-
let r =
|
|
12916
|
+
if (A_(r)) {
|
|
12917
|
+
let r = P_(t, e);
|
|
12882
12918
|
if (r) {
|
|
12883
|
-
let t =
|
|
12919
|
+
let t = O_(r.combinedText);
|
|
12884
12920
|
if (t.length > 0) {
|
|
12885
12921
|
n.push(...t), e = r.endIndex;
|
|
12886
12922
|
continue;
|
|
12887
12923
|
}
|
|
12888
12924
|
}
|
|
12889
12925
|
}
|
|
12890
|
-
let i =
|
|
12926
|
+
let i = E_(r, { allowListExtraction: !1 });
|
|
12891
12927
|
i.length > 0 && n.push(...i);
|
|
12892
12928
|
}
|
|
12893
12929
|
return n;
|
|
12894
12930
|
}
|
|
12895
|
-
var
|
|
12896
|
-
function
|
|
12931
|
+
var I_ = F_, L_;
|
|
12932
|
+
function R_(e) {
|
|
12897
12933
|
return {
|
|
12898
12934
|
dateDebut: e.dateDebut ?? "0001-01-01",
|
|
12899
12935
|
dateFin: e.dateFin ?? "2999-01-01",
|
|
@@ -12902,7 +12938,7 @@ function P_(e) {
|
|
|
12902
12938
|
textId: e.textId
|
|
12903
12939
|
};
|
|
12904
12940
|
}
|
|
12905
|
-
function
|
|
12941
|
+
function z_(e) {
|
|
12906
12942
|
let t = e["@id"];
|
|
12907
12943
|
return t === void 0 ? null : {
|
|
12908
12944
|
dateDebut: e["@debut"] ?? null,
|
|
@@ -12912,10 +12948,10 @@ function F_(e) {
|
|
|
12912
12948
|
title: e["#text"] ?? null
|
|
12913
12949
|
};
|
|
12914
12950
|
}
|
|
12915
|
-
function
|
|
12951
|
+
function B_(e, t) {
|
|
12916
12952
|
return (e.dateDebut === null || e.dateDebut <= t) && (e.dateFin === null || e.dateFin >= t);
|
|
12917
12953
|
}
|
|
12918
|
-
var
|
|
12954
|
+
var V_ = class extends ke {
|
|
12919
12955
|
canutesDb;
|
|
12920
12956
|
articleRowsByNumByTextAndDate = /* @__PURE__ */ new Map();
|
|
12921
12957
|
directSectionChildrenByParentAndDate = /* @__PURE__ */ new Map();
|
|
@@ -12940,7 +12976,7 @@ var L_ = class extends ke {
|
|
|
12940
12976
|
WHERE
|
|
12941
12977
|
data -> 'CONTEXTE' -> 'TEXTE' ->> '@cid' = ${n}
|
|
12942
12978
|
AND num = ${t}
|
|
12943
|
-
`).map(
|
|
12979
|
+
`).map(R_), this.articleRowsByNumByTextAndDate.set(r, i)), i;
|
|
12944
12980
|
}
|
|
12945
12981
|
async getDirectSectionChildren({ date: e, parentPath: t }) {
|
|
12946
12982
|
let n = `${t}\0${e}`, r = this.directSectionChildrenByParentAndDate.get(n);
|
|
@@ -12954,7 +12990,7 @@ var L_ = class extends ke {
|
|
|
12954
12990
|
SELECT data
|
|
12955
12991
|
FROM legifrance.textelr
|
|
12956
12992
|
WHERE id = ${t}
|
|
12957
|
-
`)[0]?.data.STRUCT?.LIEN_SECTION_TA?.map(
|
|
12993
|
+
`)[0]?.data.STRUCT?.LIEN_SECTION_TA?.map(z_).filter((e) => e !== null).filter((t) => B_(t, e)) ?? [] : i.map(z_).filter((e) => e !== null).filter((t) => B_(t, e)), this.directSectionChildrenByParentAndDate.set(n, r);
|
|
12958
12994
|
}
|
|
12959
12995
|
return r;
|
|
12960
12996
|
}
|
|
@@ -12997,7 +13033,7 @@ var L_ = class extends ke {
|
|
|
12997
13033
|
FROM legifrance.article
|
|
12998
13034
|
WHERE num = ${t}
|
|
12999
13035
|
LIMIT 100
|
|
13000
|
-
`).map(
|
|
13036
|
+
`).map(R_), this.globalArticleRowsByNumAndDate.set(n, r)), r;
|
|
13001
13037
|
}
|
|
13002
13038
|
async preloadTextTitlesInfos(e = {}) {
|
|
13003
13039
|
let t = (t, n = {}) => {
|
|
@@ -13012,7 +13048,7 @@ var L_ = class extends ke {
|
|
|
13012
13048
|
return;
|
|
13013
13049
|
}
|
|
13014
13050
|
let n = new xe("canutes.preloadTextTitlesInfos");
|
|
13015
|
-
|
|
13051
|
+
L_ === void 0 ? (t("queryTextTitlesInfos:start"), L_ = (async () => {
|
|
13016
13052
|
let e = await n.time("queryTextTitlesInfos", () => this.canutesDb`
|
|
13017
13053
|
SELECT
|
|
13018
13054
|
data -> 'META' -> 'META_SPEC' -> 'META_TEXTE_CHRONICLE' ->> 'CID' AS cid,
|
|
@@ -13042,8 +13078,8 @@ var L_ = class extends ke {
|
|
|
13042
13078
|
`);
|
|
13043
13079
|
t("queryTextTitlesInfos:done", { count: e.length }), t("buildTextTitlesInfos:start", { count: e.length }), await Ee(e, { onProgress: ({ count: e, phase: n }) => t(`buildTextTitlesInfos:${n}`, { count: e }) }), t("buildTextTitlesInfos:done", { count: e.length }), t("setTextTitlesInfos:done");
|
|
13044
13080
|
})().catch((e) => {
|
|
13045
|
-
throw
|
|
13046
|
-
})) : t("waiting-for-shared-preload"), await
|
|
13081
|
+
throw L_ = void 0, e;
|
|
13082
|
+
})) : t("waiting-for-shared-preload"), await L_, n.log(), this.textTitlesInfosLoaded = !0;
|
|
13047
13083
|
}
|
|
13048
13084
|
async preloadUniqueActiveArticlesByNums({ date: e, nums: t }) {
|
|
13049
13085
|
let n = [...new Set([...t].filter(Boolean))].filter((t) => !this.globalArticleRowsByNumAndDate.has(`${t}\0${e}`));
|
|
@@ -13057,7 +13093,7 @@ var L_ = class extends ke {
|
|
|
13057
13093
|
data -> 'META' -> 'META_SPEC' -> 'META_ARTICLE' ->> 'DATE_FIN' AS "dateFin"
|
|
13058
13094
|
FROM legifrance.article
|
|
13059
13095
|
WHERE num IN ${this.canutesDb(n)}
|
|
13060
|
-
`).map(
|
|
13096
|
+
`).map(R_), i = /* @__PURE__ */ new Map();
|
|
13061
13097
|
for (let e of r) {
|
|
13062
13098
|
if (e.num === null) continue;
|
|
13063
13099
|
let t = i.get(e.num);
|
|
@@ -13068,15 +13104,15 @@ var L_ = class extends ke {
|
|
|
13068
13104
|
};
|
|
13069
13105
|
//#endregion
|
|
13070
13106
|
//#region src/lib/extractors/links.ts
|
|
13071
|
-
async function*
|
|
13072
|
-
let l = r ?? (e === void 0 ? void 0 : new
|
|
13107
|
+
async function* H_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgnoredReferencesTypes: i, logPartialReferences: a, logReferences: o, state: s, transformation: c }) {
|
|
13108
|
+
let l = r ?? (e === void 0 ? void 0 : new V_(e));
|
|
13073
13109
|
if (l === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
13074
13110
|
let u = new xe("extractTextLinks"), d = {}, f = c === void 0 ? void 0 : _e(c), p = s === void 0 ? {} : structuredClone(s), m = u.timeSync("extractReferences", () => {
|
|
13075
13111
|
let e = [];
|
|
13076
|
-
for (let n of c === void 0 ?
|
|
13112
|
+
for (let n of c === void 0 ? zm(t) : Vm(t, c)) o && console.log(`In "${t.input.slice(n.position.start, n.position.stop)}": \nReference "${t.text(n.position)}": ${JSON.stringify(n, null, 2)}`), e.push(n);
|
|
13077
13113
|
return e;
|
|
13078
13114
|
}, { inputSize: t.input.length }), h = performance.now();
|
|
13079
|
-
for (let e of m) for (let n of
|
|
13115
|
+
for (let e of m) for (let n of Q_(t, e)) {
|
|
13080
13116
|
let r = n.type === "parent-enfant" ? n.parent : n;
|
|
13081
13117
|
switch (r.type) {
|
|
13082
13118
|
case "alinéa":
|
|
@@ -13105,7 +13141,7 @@ async function* R_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13105
13141
|
r.definition && p.textId === void 0 && a && console.log(`In "${t.input.slice(e.position.start, e.position.stop)}": Missing state.textId for division definition`);
|
|
13106
13142
|
break;
|
|
13107
13143
|
case "texte":
|
|
13108
|
-
|
|
13144
|
+
U_({
|
|
13109
13145
|
context: t,
|
|
13110
13146
|
logPartialReferences: a,
|
|
13111
13147
|
reference: e,
|
|
@@ -13121,14 +13157,14 @@ async function* R_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13121
13157
|
phase: "collectDefinitionsAndTextState"
|
|
13122
13158
|
});
|
|
13123
13159
|
let g = /* @__PURE__ */ new Set();
|
|
13124
|
-
for (let e of m) for (let t of
|
|
13125
|
-
let _ =
|
|
13160
|
+
for (let e of m) for (let t of Z_(e, { citations: !0 })) g.add(t);
|
|
13161
|
+
let _ = W_(t, m);
|
|
13126
13162
|
await u.time("preloadActiveArticlesByTextIds", () => l.preloadActiveArticlesByTextIds({
|
|
13127
13163
|
date: n,
|
|
13128
13164
|
nums: g,
|
|
13129
13165
|
textIds: _
|
|
13130
13166
|
}), { count: _.size });
|
|
13131
|
-
let v = await u.time("collectUniqueFallbackArticleNums", () =>
|
|
13167
|
+
let v = await u.time("collectUniqueFallbackArticleNums", () => G_({
|
|
13132
13168
|
context: t,
|
|
13133
13169
|
date: n,
|
|
13134
13170
|
legiResolver: l,
|
|
@@ -13141,7 +13177,7 @@ async function* R_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13141
13177
|
nums: v
|
|
13142
13178
|
}), { count: v.size }), p = s === void 0 ? {} : s;
|
|
13143
13179
|
let y = 0, ee = performance.now();
|
|
13144
|
-
for (let e of m) for await (let r of
|
|
13180
|
+
for (let e of m) for await (let r of rv({
|
|
13145
13181
|
articleDefinitionByNumByTextId: d,
|
|
13146
13182
|
legiResolver: l,
|
|
13147
13183
|
context: t,
|
|
@@ -13158,7 +13194,7 @@ async function* R_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13158
13194
|
phase: "iterReferenceLinks"
|
|
13159
13195
|
}), u.log({ referenceCount: m.length });
|
|
13160
13196
|
}
|
|
13161
|
-
function
|
|
13197
|
+
function U_({ context: e, logPartialReferences: t, reference: n, state: r, text: i }) {
|
|
13162
13198
|
switch (i.nature) {
|
|
13163
13199
|
case "ARRETE":
|
|
13164
13200
|
case "CIRCULAIRE":
|
|
@@ -13229,17 +13265,17 @@ function z_({ context: e, logPartialReferences: t, reference: n, state: r, text:
|
|
|
13229
13265
|
default: i.nature === void 0 ? delete r.textId : c("nature", i.nature);
|
|
13230
13266
|
}
|
|
13231
13267
|
}
|
|
13232
|
-
function
|
|
13268
|
+
function W_(e, t) {
|
|
13233
13269
|
let n = /* @__PURE__ */ new Set();
|
|
13234
|
-
for (let r of t) for (let t of
|
|
13270
|
+
for (let r of t) for (let t of Q_(e, r, { citations: !0 })) {
|
|
13235
13271
|
let e = t.type === "parent-enfant" ? t.parent : t;
|
|
13236
13272
|
e.type === "texte" && e.cid !== void 0 ? n.add(e.cid) : e.type === "article" && e.implicitText?.cid !== void 0 && n.add(e.implicitText.cid);
|
|
13237
13273
|
}
|
|
13238
13274
|
return n;
|
|
13239
13275
|
}
|
|
13240
|
-
async function
|
|
13276
|
+
async function G_({ context: e, date: t, legiResolver: n, logPartialReferences: r, references: i, state: a }) {
|
|
13241
13277
|
let o = /* @__PURE__ */ new Set();
|
|
13242
|
-
for (let s of i) await
|
|
13278
|
+
for (let s of i) await K_({
|
|
13243
13279
|
articleNums: o,
|
|
13244
13280
|
context: e,
|
|
13245
13281
|
date: t,
|
|
@@ -13250,8 +13286,8 @@ async function V_({ context: e, date: t, legiResolver: n, logPartialReferences:
|
|
|
13250
13286
|
});
|
|
13251
13287
|
return o;
|
|
13252
13288
|
}
|
|
13253
|
-
async function
|
|
13254
|
-
for (let s of
|
|
13289
|
+
async function K_({ articleNums: e, context: t, date: n, legiResolver: r, logPartialReferences: i, reference: a, state: o }) {
|
|
13290
|
+
for (let s of Q_(t, a)) await q_({
|
|
13255
13291
|
articleNums: e,
|
|
13256
13292
|
atomicOrParentChildReference: s,
|
|
13257
13293
|
context: t,
|
|
@@ -13266,7 +13302,7 @@ async function H_({ articleNums: e, context: t, date: n, legiResolver: r, logPar
|
|
|
13266
13302
|
if (s !== void 0) {
|
|
13267
13303
|
for (let a of s) if (a.references !== void 0) {
|
|
13268
13304
|
let s = structuredClone(o);
|
|
13269
|
-
for (let o of a.references) await
|
|
13305
|
+
for (let o of a.references) await K_({
|
|
13270
13306
|
articleNums: e,
|
|
13271
13307
|
context: t,
|
|
13272
13308
|
date: n,
|
|
@@ -13279,7 +13315,7 @@ async function H_({ articleNums: e, context: t, date: n, legiResolver: r, logPar
|
|
|
13279
13315
|
}
|
|
13280
13316
|
}
|
|
13281
13317
|
}
|
|
13282
|
-
async function
|
|
13318
|
+
async function q_({ articleNums: e, atomicOrParentChildReference: t, context: n, date: r, legiResolver: i, logPartialReferences: a, reference: o, state: s }) {
|
|
13283
13319
|
let c = t.type === "parent-enfant" ? t.parent : t, l = t.type === "parent-enfant" ? t : void 0;
|
|
13284
13320
|
switch (c.type) {
|
|
13285
13321
|
case "alinéa":
|
|
@@ -13288,7 +13324,7 @@ async function U_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13288
13324
|
case "phrase": break;
|
|
13289
13325
|
case "article":
|
|
13290
13326
|
if (c.definition && s.textId !== void 0) break;
|
|
13291
|
-
await
|
|
13327
|
+
await Y_({
|
|
13292
13328
|
article: c,
|
|
13293
13329
|
date: r,
|
|
13294
13330
|
legiResolver: i,
|
|
@@ -13306,7 +13342,7 @@ async function U_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13306
13342
|
case "sous-titre":
|
|
13307
13343
|
case "titre":
|
|
13308
13344
|
if (c.definition && s.textId !== void 0) break;
|
|
13309
|
-
l !== void 0 && await
|
|
13345
|
+
l !== void 0 && await K_({
|
|
13310
13346
|
articleNums: e,
|
|
13311
13347
|
context: n,
|
|
13312
13348
|
date: r,
|
|
@@ -13317,13 +13353,13 @@ async function U_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13317
13353
|
});
|
|
13318
13354
|
break;
|
|
13319
13355
|
case "texte":
|
|
13320
|
-
|
|
13356
|
+
U_({
|
|
13321
13357
|
context: n,
|
|
13322
13358
|
logPartialReferences: a,
|
|
13323
13359
|
reference: o,
|
|
13324
13360
|
state: s,
|
|
13325
13361
|
text: c
|
|
13326
|
-
}), l !== void 0 && await
|
|
13362
|
+
}), l !== void 0 && await K_({
|
|
13327
13363
|
articleNums: e,
|
|
13328
13364
|
context: n,
|
|
13329
13365
|
date: r,
|
|
@@ -13336,7 +13372,10 @@ async function U_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13336
13372
|
default: break;
|
|
13337
13373
|
}
|
|
13338
13374
|
}
|
|
13339
|
-
|
|
13375
|
+
function J_(e, t) {
|
|
13376
|
+
if (!(e === void 0 || t !== "LEGITEXT000006069577")) return e.match(/^(?<article>.+?)-(?:[1-9]\d*|[IVXLCDM]+)(?:-(?:[1-9]\d*|[IVXLCDM]+))?(?:\s+(?:bis|ter|quater|quinquies|sexies|septies|octies|nonies|decies|undecies|duodecies|terdecies|quaterdecies))?$/iu)?.groups?.article;
|
|
13377
|
+
}
|
|
13378
|
+
async function Y_({ article: e, date: t, legiResolver: n, state: r }) {
|
|
13340
13379
|
if (e.present || e.num === void 0) return !1;
|
|
13341
13380
|
let i = e.implicitText?.cid ?? r.textId;
|
|
13342
13381
|
return !(i !== void 0 && (await n.getActiveArticlesByTextAndNum({
|
|
@@ -13349,14 +13388,22 @@ async function W_({ article: e, date: t, legiResolver: n, state: r }) {
|
|
|
13349
13388
|
textId: r.defaultTextId
|
|
13350
13389
|
})).length > 0);
|
|
13351
13390
|
}
|
|
13352
|
-
async function*
|
|
13391
|
+
async function* X_({ ancestors: e, article: t, legiResolver: n, context: r, date: i, logPartialReferences: a, originalPositionsFromTransformedIterator: o, reference: s, state: c }) {
|
|
13353
13392
|
if (t.present) return;
|
|
13354
13393
|
let l = [], u = t.implicitText?.cid ?? c.textId;
|
|
13355
13394
|
if (u !== void 0 && (l = await n.getActiveArticlesByTextAndNum({
|
|
13356
13395
|
date: i,
|
|
13357
13396
|
num: t.num,
|
|
13358
13397
|
textId: u
|
|
13359
|
-
})), l.length === 0
|
|
13398
|
+
})), l.length === 0) {
|
|
13399
|
+
let e = J_(t.num, u);
|
|
13400
|
+
e !== void 0 && u !== void 0 && (l = await n.getActiveArticlesByTextAndNum({
|
|
13401
|
+
date: i,
|
|
13402
|
+
num: e,
|
|
13403
|
+
textId: u
|
|
13404
|
+
}));
|
|
13405
|
+
}
|
|
13406
|
+
if (l.length === 0 && c.defaultTextId !== void 0 && c.defaultTextId !== u && (l = await n.getActiveArticlesByTextAndNum({
|
|
13360
13407
|
date: i,
|
|
13361
13408
|
num: t.num,
|
|
13362
13409
|
textId: c.defaultTextId
|
|
@@ -13385,91 +13432,91 @@ async function* G_({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13385
13432
|
type: "external_article"
|
|
13386
13433
|
}).filter(([, e]) => e !== void 0));
|
|
13387
13434
|
}
|
|
13388
|
-
function*
|
|
13435
|
+
function* Z_(e, { citations: t = !1 } = {}) {
|
|
13389
13436
|
switch (e.type) {
|
|
13390
13437
|
case "article":
|
|
13391
13438
|
e.num !== void 0 && (yield e.num);
|
|
13392
13439
|
break;
|
|
13393
13440
|
case "bounded-interval":
|
|
13394
|
-
yield*
|
|
13441
|
+
yield* Z_(e.first, { citations: t }), yield* Z_(e.last, { citations: t });
|
|
13395
13442
|
break;
|
|
13396
13443
|
case "counted-interval":
|
|
13397
|
-
yield*
|
|
13444
|
+
yield* Z_(e.first, { citations: t });
|
|
13398
13445
|
break;
|
|
13399
13446
|
case "enumeration":
|
|
13400
13447
|
case "exclusion":
|
|
13401
|
-
yield*
|
|
13448
|
+
yield* Z_(e.left, { citations: t }), yield* Z_(e.right, { citations: t });
|
|
13402
13449
|
break;
|
|
13403
13450
|
case "parent-enfant":
|
|
13404
|
-
yield*
|
|
13451
|
+
yield* Z_(e.parent, { citations: t }), yield* Z_(e.child, { citations: t });
|
|
13405
13452
|
break;
|
|
13406
13453
|
case "reference_et_action":
|
|
13407
|
-
if (yield*
|
|
13454
|
+
if (yield* Z_(e.reference, { citations: t }), t) {
|
|
13408
13455
|
let { originalCitations: n } = e.action;
|
|
13409
13456
|
if (n !== void 0) {
|
|
13410
|
-
for (let e of n) if (e.references !== void 0) for (let n of e.references) yield*
|
|
13457
|
+
for (let e of n) if (e.references !== void 0) for (let n of e.references) yield* Z_(n, { citations: t });
|
|
13411
13458
|
}
|
|
13412
13459
|
}
|
|
13413
13460
|
break;
|
|
13414
13461
|
}
|
|
13415
13462
|
}
|
|
13416
|
-
function*
|
|
13463
|
+
function* Q_(e, t, { citations: n = !1 } = {}) {
|
|
13417
13464
|
switch (t.type) {
|
|
13418
13465
|
case "bounded-interval":
|
|
13419
|
-
yield*
|
|
13466
|
+
yield* Q_(e, t.first, { citations: n }), yield* Q_(e, t.last, { citations: n });
|
|
13420
13467
|
break;
|
|
13421
13468
|
case "counted-interval":
|
|
13422
|
-
yield*
|
|
13469
|
+
yield* Q_(e, t.first, { citations: n });
|
|
13423
13470
|
break;
|
|
13424
13471
|
case "enumeration":
|
|
13425
13472
|
case "exclusion":
|
|
13426
|
-
yield*
|
|
13473
|
+
yield* Q_(e, t.left, { citations: n }), yield* Q_(e, t.right, { citations: n });
|
|
13427
13474
|
break;
|
|
13428
13475
|
case "reference_et_action":
|
|
13429
|
-
if (yield*
|
|
13476
|
+
if (yield* Q_(e, t.reference, { citations: n }), n) {
|
|
13430
13477
|
let { originalCitations: r } = t.action;
|
|
13431
13478
|
if (r !== void 0) {
|
|
13432
|
-
for (let t of r) if (t.references !== void 0) for (let r of t.references) yield*
|
|
13479
|
+
for (let t of r) if (t.references !== void 0) for (let r of t.references) yield* Q_(e, r, { citations: n });
|
|
13433
13480
|
}
|
|
13434
13481
|
}
|
|
13435
13482
|
break;
|
|
13436
13483
|
default: yield t;
|
|
13437
13484
|
}
|
|
13438
13485
|
}
|
|
13439
|
-
function*
|
|
13486
|
+
function* $_(e, t) {
|
|
13440
13487
|
if (t.type === "texte") console.error(`iterDeepestDivisionsOrArticles must not be called with a text:\n${JSON.stringify(t, null, 2)}`);
|
|
13441
13488
|
else if (dt(t) || t.type === "article") yield t;
|
|
13442
13489
|
else if (!(ft(t) || t.type === "incomplete-header")) switch (t.type) {
|
|
13443
13490
|
case "bounded-interval":
|
|
13444
|
-
yield*
|
|
13491
|
+
yield* $_(e, t.first), yield* $_(e, t.last);
|
|
13445
13492
|
break;
|
|
13446
13493
|
case "counted-interval":
|
|
13447
|
-
yield*
|
|
13494
|
+
yield* $_(e, t.first);
|
|
13448
13495
|
break;
|
|
13449
13496
|
case "enumeration":
|
|
13450
13497
|
case "exclusion":
|
|
13451
|
-
yield*
|
|
13498
|
+
yield* $_(e, t.left), yield* $_(e, t.right);
|
|
13452
13499
|
break;
|
|
13453
13500
|
case "parent-enfant": {
|
|
13454
|
-
let n = [
|
|
13455
|
-
n.length === 0 ? yield*
|
|
13501
|
+
let n = [...$_(e, t.child)];
|
|
13502
|
+
n.length === 0 ? yield* $_(e, t.parent) : yield* n;
|
|
13456
13503
|
break;
|
|
13457
13504
|
}
|
|
13458
13505
|
case "reference_et_action": {
|
|
13459
|
-
yield*
|
|
13506
|
+
yield* $_(e, t.reference);
|
|
13460
13507
|
let { originalCitations: n } = t.action;
|
|
13461
13508
|
if (n !== void 0) {
|
|
13462
|
-
for (let t of n) if (t.references !== void 0) for (let n of t.references) yield*
|
|
13509
|
+
for (let t of n) if (t.references !== void 0) for (let n of t.references) yield* $_(e, n);
|
|
13463
13510
|
}
|
|
13464
13511
|
break;
|
|
13465
13512
|
}
|
|
13466
13513
|
default: c("iterDeepestDivisionsOrArticles reference.type", t);
|
|
13467
13514
|
}
|
|
13468
13515
|
}
|
|
13469
|
-
function
|
|
13516
|
+
function ev(e) {
|
|
13470
13517
|
return e?.split(":")[0].trim().toLowerCase().split(/\s+/).map((e) => e.trim()).filter((e) => e !== "").join(" ");
|
|
13471
13518
|
}
|
|
13472
|
-
async function*
|
|
13519
|
+
async function* tv({ ancestors: e, legiResolver: t, context: n, date: r, division: i, divisionChildReference: a, logIgnoredReferencesTypes: o, logPartialReferences: s, originalPositionsFromTransformedIterator: c, parentSectionChildren: l, reference: u, state: d }) {
|
|
13473
13520
|
if (i.present) return;
|
|
13474
13521
|
let f;
|
|
13475
13522
|
if (l === void 0 && d.textId !== void 0 && (l = await t.getDirectSectionChildren({
|
|
@@ -13477,20 +13524,20 @@ async function* X_({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13477
13524
|
parentPath: d.textId
|
|
13478
13525
|
})), l !== void 0) {
|
|
13479
13526
|
for (let e of l) {
|
|
13480
|
-
let t =
|
|
13527
|
+
let t = ev(e.title);
|
|
13481
13528
|
if (t !== void 0) {
|
|
13482
13529
|
let n = !1;
|
|
13483
|
-
if (i.index !== void 0 && (n =
|
|
13530
|
+
if (i.index !== void 0 && (n = nv(i.type, i.index).some((e) => e === t)), !n && i.num !== void 0 && (n = `${i.type} ${i.num.toLowerCase()}` === t), n) {
|
|
13484
13531
|
f = e;
|
|
13485
13532
|
break;
|
|
13486
13533
|
}
|
|
13487
13534
|
}
|
|
13488
13535
|
}
|
|
13489
13536
|
if (f === void 0 && (f = l.find((e) => {
|
|
13490
|
-
let t =
|
|
13537
|
+
let t = ev(e.title)?.split(/\s+/);
|
|
13491
13538
|
return t !== void 0 && t.length === 2 && ot.includes(t[0]) && t[1] === "législative";
|
|
13492
13539
|
}), f !== void 0)) {
|
|
13493
|
-
let e =
|
|
13540
|
+
let e = ev(f.title).split(/\s+/), t = {
|
|
13494
13541
|
start: i.position.stop,
|
|
13495
13542
|
stop: i.position.stop
|
|
13496
13543
|
}, n = c === void 0 ? void 0 : v(c, t), r = Object.fromEntries(Object.entries({
|
|
@@ -13508,8 +13555,8 @@ async function* X_({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13508
13555
|
}).filter(([, e]) => e !== void 0)), i = r;
|
|
13509
13556
|
}
|
|
13510
13557
|
}
|
|
13511
|
-
let p = a === void 0 ? [] : [
|
|
13512
|
-
if (a !== void 0) for (let l of
|
|
13558
|
+
let p = a === void 0 ? [] : [...$_(n, a.child)], m = 0;
|
|
13559
|
+
if (a !== void 0) for (let l of Q_(n, a.child)) {
|
|
13513
13560
|
let h = l.type === "parent-enfant" ? l.parent : l, g = l.type === "parent-enfant" ? l : void 0;
|
|
13514
13561
|
switch (h.type) {
|
|
13515
13562
|
case "alinéa":
|
|
@@ -13517,7 +13564,7 @@ async function* X_({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13517
13564
|
case "item":
|
|
13518
13565
|
case "phrase": break;
|
|
13519
13566
|
case "article":
|
|
13520
|
-
yield*
|
|
13567
|
+
yield* X_({
|
|
13521
13568
|
ancestors: p.length === 1 ? [...e ?? [], i] : void 0,
|
|
13522
13569
|
article: h,
|
|
13523
13570
|
legiResolver: t,
|
|
@@ -13543,7 +13590,7 @@ async function* X_({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13543
13590
|
f !== void 0 && (a = await t.getDirectSectionChildren({
|
|
13544
13591
|
date: r,
|
|
13545
13592
|
parentPath: f.path
|
|
13546
|
-
})), yield*
|
|
13593
|
+
})), yield* tv({
|
|
13547
13594
|
ancestors: p.length === 1 ? [...e ?? [], i] : void 0,
|
|
13548
13595
|
legiResolver: t,
|
|
13549
13596
|
context: n,
|
|
@@ -13581,7 +13628,7 @@ async function* X_({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13581
13628
|
}).filter(([, e]) => e !== void 0));
|
|
13582
13629
|
}
|
|
13583
13630
|
}
|
|
13584
|
-
function*
|
|
13631
|
+
function* nv(e, t) {
|
|
13585
13632
|
let n = Math.floor(t), r = Math.floor((t - n) * 1e3);
|
|
13586
13633
|
if (r === 0) {
|
|
13587
13634
|
for (let t of re(n)) yield `${t.toLowerCase()} ${e}`;
|
|
@@ -13591,9 +13638,9 @@ function* Z_(e, t) {
|
|
|
13591
13638
|
for (let r of f(n)) yield `${e} ${t} ${r.toLowerCase()}`;
|
|
13592
13639
|
}
|
|
13593
13640
|
}
|
|
13594
|
-
async function*
|
|
13641
|
+
async function* rv({ articleDefinitionByNumByTextId: e, legiResolver: t, context: n, date: r, logIgnoredReferencesTypes: i, logPartialReferences: a, originalPositionsFromTransformedIterator: o, reference: s, state: c }) {
|
|
13595
13642
|
let l = e ?? {}, u = c === void 0 ? {} : c;
|
|
13596
|
-
for (let e of
|
|
13643
|
+
for (let e of Q_(n, s)) {
|
|
13597
13644
|
let c = e.type === "parent-enfant" ? e.parent : e, d = e.type === "parent-enfant" ? e : void 0;
|
|
13598
13645
|
switch (c.type) {
|
|
13599
13646
|
case "alinéa":
|
|
@@ -13604,7 +13651,7 @@ async function* Q_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13604
13651
|
if (c.definition && u.textId !== void 0) {
|
|
13605
13652
|
let e = l[u.textId]?.[c.num];
|
|
13606
13653
|
e !== void 0 && (e.originalTransformation === void 0 && o !== void 0 && (e.originalTransformation = v(o, e.position)), yield e);
|
|
13607
|
-
} else yield*
|
|
13654
|
+
} else yield* X_({
|
|
13608
13655
|
article: c,
|
|
13609
13656
|
legiResolver: t,
|
|
13610
13657
|
context: n,
|
|
@@ -13625,7 +13672,7 @@ async function* Q_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13625
13672
|
case "sous-sous-paragraphe":
|
|
13626
13673
|
case "sous-titre":
|
|
13627
13674
|
case "titre":
|
|
13628
|
-
c.definition && u.textId !== void 0 || (yield*
|
|
13675
|
+
c.definition && u.textId !== void 0 || (yield* tv({
|
|
13629
13676
|
legiResolver: t,
|
|
13630
13677
|
context: n,
|
|
13631
13678
|
date: r,
|
|
@@ -13639,15 +13686,15 @@ async function* Q_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13639
13686
|
}));
|
|
13640
13687
|
break;
|
|
13641
13688
|
case "texte": {
|
|
13642
|
-
|
|
13689
|
+
U_({
|
|
13643
13690
|
context: n,
|
|
13644
13691
|
logPartialReferences: a,
|
|
13645
13692
|
reference: s,
|
|
13646
13693
|
state: u,
|
|
13647
13694
|
text: c
|
|
13648
13695
|
});
|
|
13649
|
-
let e = d === void 0 ? [] : [
|
|
13650
|
-
if (d !== void 0) for (let f of
|
|
13696
|
+
let e = d === void 0 ? [] : [...$_(n, d.child)], l = 0;
|
|
13697
|
+
if (d !== void 0) for (let f of Q_(n, d.child)) {
|
|
13651
13698
|
let p = f.type === "parent-enfant" ? f.parent : f, m = f.type === "parent-enfant" ? f : void 0;
|
|
13652
13699
|
switch (p.type) {
|
|
13653
13700
|
case "alinéa":
|
|
@@ -13655,7 +13702,7 @@ async function* Q_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13655
13702
|
case "item":
|
|
13656
13703
|
case "phrase": break;
|
|
13657
13704
|
case "article":
|
|
13658
|
-
yield*
|
|
13705
|
+
yield* X_({
|
|
13659
13706
|
ancestors: e.length === 1 ? [c] : void 0,
|
|
13660
13707
|
article: p,
|
|
13661
13708
|
legiResolver: t,
|
|
@@ -13681,7 +13728,7 @@ async function* Q_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13681
13728
|
u.textId !== void 0 && (d = await t.getDirectSectionChildren({
|
|
13682
13729
|
date: r,
|
|
13683
13730
|
parentPath: u.textId
|
|
13684
|
-
})), yield*
|
|
13731
|
+
})), yield* tv({
|
|
13685
13732
|
ancestors: e.length === 1 ? [c] : void 0,
|
|
13686
13733
|
legiResolver: t,
|
|
13687
13734
|
context: n,
|
|
@@ -13732,7 +13779,7 @@ async function* Q_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13732
13779
|
if (e !== void 0) {
|
|
13733
13780
|
for (let s of e) if (s.references !== void 0) {
|
|
13734
13781
|
let e = structuredClone(u);
|
|
13735
|
-
for (let c of s.references) yield*
|
|
13782
|
+
for (let c of s.references) yield* rv({
|
|
13736
13783
|
articleDefinitionByNumByTextId: l,
|
|
13737
13784
|
legiResolver: t,
|
|
13738
13785
|
context: n,
|
|
@@ -13749,13 +13796,13 @@ async function* Q_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13749
13796
|
}
|
|
13750
13797
|
//#endregion
|
|
13751
13798
|
//#region src/lib/extractors/table_of_contents.ts
|
|
13752
|
-
function
|
|
13799
|
+
function iv(e) {
|
|
13753
13800
|
let t = e;
|
|
13754
13801
|
return t.items ?? [...t.articles ?? [], ...t.divisions ?? []];
|
|
13755
13802
|
}
|
|
13756
|
-
function*
|
|
13803
|
+
function* av({ context: e, tableOfContents: t, transformation: n }) {
|
|
13757
13804
|
let r = 0, i = _e(n);
|
|
13758
|
-
for (let n of
|
|
13805
|
+
for (let n of sv(t)) {
|
|
13759
13806
|
let t = n.line.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = RegExp(`^${t}$`, "m");
|
|
13760
13807
|
a.lastIndex = r;
|
|
13761
13808
|
let o = a.exec(e.input);
|
|
@@ -13767,7 +13814,7 @@ function* ev({ context: e, tableOfContents: t, transformation: n }) {
|
|
|
13767
13814
|
l.originalTransformation = c, l.position = s, yield l, r = s.stop;
|
|
13768
13815
|
}
|
|
13769
13816
|
}
|
|
13770
|
-
function
|
|
13817
|
+
function ov(e) {
|
|
13771
13818
|
let t = new n(e), r = { items: [] }, i = [];
|
|
13772
13819
|
for (let e of Tn(t)) if (dt(e)) {
|
|
13773
13820
|
let n = i.findIndex(({ type: t }) => t === e.type);
|
|
@@ -13785,14 +13832,14 @@ function tv(e) {
|
|
|
13785
13832
|
else throw Error(`Unexpected type "${e.type}" in definition:\n${JSON.stringify(e, null, 2)}`);
|
|
13786
13833
|
return r;
|
|
13787
13834
|
}
|
|
13788
|
-
function*
|
|
13835
|
+
function* sv(e) {
|
|
13789
13836
|
e.type !== void 0 && (yield e);
|
|
13790
|
-
for (let t of
|
|
13837
|
+
for (let t of iv(e)) t.type === "article" ? yield t : yield* sv(t);
|
|
13791
13838
|
}
|
|
13792
13839
|
//#endregion
|
|
13793
13840
|
//#region src/lib/links.ts
|
|
13794
|
-
var
|
|
13795
|
-
function
|
|
13841
|
+
var cv = ["Exploratrice", "Forgejo"];
|
|
13842
|
+
function lv(e, t, n) {
|
|
13796
13843
|
let r = n.match(Ke);
|
|
13797
13844
|
if (r === null) throw Error(`Unknown ID format: ${n}`);
|
|
13798
13845
|
switch (e) {
|
|
@@ -13813,19 +13860,19 @@ function iv(e, t, n) {
|
|
|
13813
13860
|
}
|
|
13814
13861
|
//#endregion
|
|
13815
13862
|
//#region src/lib/linkers/html.ts
|
|
13816
|
-
function
|
|
13863
|
+
function uv(e, t) {
|
|
13817
13864
|
if (e !== void 0) return e;
|
|
13818
|
-
if (t !== void 0) return new
|
|
13865
|
+
if (t !== void 0) return new V_(t);
|
|
13819
13866
|
throw Error("A Canutes database or legal resolver is required");
|
|
13820
13867
|
}
|
|
13821
|
-
function
|
|
13868
|
+
function dv(e, t) {
|
|
13822
13869
|
return t.type === "reference_et_action" ? JSON.stringify({
|
|
13823
13870
|
...e,
|
|
13824
13871
|
action: t.action
|
|
13825
13872
|
}) : JSON.stringify(e);
|
|
13826
13873
|
}
|
|
13827
|
-
async function
|
|
13828
|
-
let h = new xe("addLinksToHtml"), g =
|
|
13874
|
+
async function fv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl: o, linkType: s, logIgnoredReferencesTypes: l, logPartialReferences: u, logReferences: d, onLink: f, previousContext: p, state: m }) {
|
|
13875
|
+
let h = new xe("addLinksToHtml"), g = uv(t, e);
|
|
13829
13876
|
await h.time("preloadTextTitlesInfos", () => g.preloadTextTitlesInfos());
|
|
13830
13877
|
let _ = h.timeSync("simplifyHtml", () => a({ removeAWithHref: !0 })(i), {
|
|
13831
13878
|
inputSize: i.length,
|
|
@@ -13834,7 +13881,7 @@ async function sv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13834
13881
|
v.currentArticle = p?.currentArticle, v.currentText = p?.currentText;
|
|
13835
13882
|
let y = [], ee = { value: 0 }, te = -1;
|
|
13836
13883
|
await h.time("extractTextLinks", async () => {
|
|
13837
|
-
for await (let e of
|
|
13884
|
+
for await (let e of H_({
|
|
13838
13885
|
legiResolver: g,
|
|
13839
13886
|
context: v,
|
|
13840
13887
|
date: r,
|
|
@@ -13847,7 +13894,7 @@ async function sv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13847
13894
|
case "article_definition": {
|
|
13848
13895
|
let { article: t, originalTransformation: n, textId: r } = e;
|
|
13849
13896
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in article definition: ${JSON.stringify(e, null, 2)}`);
|
|
13850
|
-
|
|
13897
|
+
mv({
|
|
13851
13898
|
inputHtml: i,
|
|
13852
13899
|
originalTransformation: n,
|
|
13853
13900
|
output: { replacements: y },
|
|
@@ -13860,12 +13907,12 @@ async function sv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13860
13907
|
let { articleId: t, originalTransformation: n } = e;
|
|
13861
13908
|
if (t !== void 0) {
|
|
13862
13909
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(e, null, 2)}`);
|
|
13863
|
-
|
|
13910
|
+
mv({
|
|
13864
13911
|
inputHtml: i,
|
|
13865
13912
|
originalTransformation: n,
|
|
13866
13913
|
output: { replacements: y },
|
|
13867
13914
|
replacementCounter: ee,
|
|
13868
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_article_externe" href="${
|
|
13915
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_article_externe" href="${lv(s, o, t)}">${e}</a>`
|
|
13869
13916
|
});
|
|
13870
13917
|
}
|
|
13871
13918
|
break;
|
|
@@ -13874,12 +13921,12 @@ async function sv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13874
13921
|
let { originalTransformation: t, sectionTaId: n } = e;
|
|
13875
13922
|
if (n !== void 0) {
|
|
13876
13923
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(e, null, 2)}`);
|
|
13877
|
-
|
|
13924
|
+
mv({
|
|
13878
13925
|
inputHtml: i,
|
|
13879
13926
|
originalTransformation: t,
|
|
13880
13927
|
output: { replacements: y },
|
|
13881
13928
|
replacementCounter: ee,
|
|
13882
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_division_externe" href="${
|
|
13929
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_division_externe" href="${lv(s, o, n)}">${e}</a>`
|
|
13883
13930
|
});
|
|
13884
13931
|
}
|
|
13885
13932
|
break;
|
|
@@ -13891,12 +13938,12 @@ async function sv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13891
13938
|
continue;
|
|
13892
13939
|
}
|
|
13893
13940
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
13894
|
-
|
|
13941
|
+
mv({
|
|
13895
13942
|
inputHtml: i,
|
|
13896
13943
|
originalTransformation: t,
|
|
13897
13944
|
output: { replacements: y },
|
|
13898
13945
|
replacementCounter: ee,
|
|
13899
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_texte_externe" href="${
|
|
13946
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_texte_externe" href="${lv(s, o, n.cid)}">${e}</a>`
|
|
13900
13947
|
});
|
|
13901
13948
|
break;
|
|
13902
13949
|
}
|
|
@@ -13904,7 +13951,7 @@ async function sv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13904
13951
|
let { url: t, originalTransformation: n } = e;
|
|
13905
13952
|
if (t === void 0) continue;
|
|
13906
13953
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in european text link: ${JSON.stringify(e, null, 2)}`);
|
|
13907
|
-
|
|
13954
|
+
mv({
|
|
13908
13955
|
inputHtml: i,
|
|
13909
13956
|
originalTransformation: n,
|
|
13910
13957
|
output: { replacements: y },
|
|
@@ -13916,7 +13963,7 @@ async function sv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13916
13963
|
case "internal_article": {
|
|
13917
13964
|
let { definition: t, originalTransformation: n } = e;
|
|
13918
13965
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(e, null, 2)}`);
|
|
13919
|
-
|
|
13966
|
+
mv({
|
|
13920
13967
|
inputHtml: i,
|
|
13921
13968
|
originalTransformation: n,
|
|
13922
13969
|
output: { replacements: y },
|
|
@@ -13928,7 +13975,7 @@ async function sv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13928
13975
|
default: c("Link", e);
|
|
13929
13976
|
}
|
|
13930
13977
|
}, { count: te + 1 });
|
|
13931
|
-
let ne = h.timeSync("applyHtmlReplacements", () =>
|
|
13978
|
+
let ne = h.timeSync("applyHtmlReplacements", () => pv(i, y), {
|
|
13932
13979
|
count: y.length,
|
|
13933
13980
|
inputSize: i.length
|
|
13934
13981
|
});
|
|
@@ -13940,13 +13987,13 @@ async function sv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13940
13987
|
output: y.length === 0 ? null : ne
|
|
13941
13988
|
};
|
|
13942
13989
|
}
|
|
13943
|
-
function
|
|
13990
|
+
function pv(e, t) {
|
|
13944
13991
|
if (t.length === 0) return e;
|
|
13945
13992
|
let n = [], r = 0;
|
|
13946
13993
|
for (let i of t.toSorted((e, t) => e.start - t.start || e.stop - t.stop || e.order - t.order)) i.start < r || (n.push(e.slice(r, i.start)), n.push(i.replacement), r = i.stop);
|
|
13947
13994
|
return n.push(e.slice(r)), n.join("");
|
|
13948
13995
|
}
|
|
13949
|
-
function
|
|
13996
|
+
function mv({ inputHtml: e, originalTransformation: t, output: n, replacementCounter: r, tagHtmlFromOriginal: i }) {
|
|
13950
13997
|
let a = d(t, i(s(e, t, 0) ?? ""));
|
|
13951
13998
|
n.replacements.push({
|
|
13952
13999
|
order: r.value++,
|
|
@@ -13955,11 +14002,11 @@ function lv({ inputHtml: e, originalTransformation: t, output: n, replacementCou
|
|
|
13955
14002
|
stop: t.position.stop
|
|
13956
14003
|
});
|
|
13957
14004
|
}
|
|
13958
|
-
function
|
|
14005
|
+
function hv({ attributes: e, inputHtml: t, originalTransformation: n, outputByType: r, replacementCounter: i }) {
|
|
13959
14006
|
let a = Object.entries(e).map(([e, t]) => `${e}="${et(t, !0)}"`).join(" ");
|
|
13960
14007
|
for (let e of ["links", "links_or_references"]) {
|
|
13961
14008
|
let o = r[e];
|
|
13962
|
-
o !== void 0 &&
|
|
14009
|
+
o !== void 0 && mv({
|
|
13963
14010
|
inputHtml: t,
|
|
13964
14011
|
originalTransformation: n,
|
|
13965
14012
|
output: o,
|
|
@@ -13968,11 +14015,11 @@ function uv({ attributes: e, inputHtml: t, originalTransformation: n, outputByTy
|
|
|
13968
14015
|
});
|
|
13969
14016
|
}
|
|
13970
14017
|
}
|
|
13971
|
-
function
|
|
14018
|
+
function gv({ id: e, outputByType: t }) {
|
|
13972
14019
|
return t.references !== void 0 || e === void 0 && t.links_or_references !== void 0;
|
|
13973
14020
|
}
|
|
13974
|
-
async function
|
|
13975
|
-
let h =
|
|
14021
|
+
async function _v({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, htmlTransformation: a, inputHtml: o, linkBaseUrl: s, linkType: l, logIgnoredReferencesTypes: u, logPartialReferences: d, logReferences: f, outputTypes: p, referredLegifranceTextsInfos: m }) {
|
|
14022
|
+
let h = uv(t, e);
|
|
13976
14023
|
await h.preloadTextTitlesInfos();
|
|
13977
14024
|
let g = new n(a.output), _ = {}, v = {};
|
|
13978
14025
|
for (let e of p) v[e] = {
|
|
@@ -13981,7 +14028,7 @@ async function fv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13981
14028
|
replacements: []
|
|
13982
14029
|
};
|
|
13983
14030
|
let y = { value: 0 };
|
|
13984
|
-
for await (let e of
|
|
14031
|
+
for await (let e of H_({
|
|
13985
14032
|
legiResolver: h,
|
|
13986
14033
|
context: g,
|
|
13987
14034
|
date: r,
|
|
@@ -13994,7 +14041,7 @@ async function fv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13994
14041
|
case "article_definition": {
|
|
13995
14042
|
let { article: t, originalTransformation: n, textId: r } = e;
|
|
13996
14043
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in article definition: ${JSON.stringify(e, null, 2)}`);
|
|
13997
|
-
for (let e of Object.values(v))
|
|
14044
|
+
for (let e of Object.values(v)) mv({
|
|
13998
14045
|
inputHtml: o,
|
|
13999
14046
|
originalTransformation: n,
|
|
14000
14047
|
output: e,
|
|
@@ -14006,10 +14053,10 @@ async function fv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14006
14053
|
case "external_article": {
|
|
14007
14054
|
let { article: t, articleId: n, originalTransformation: r } = e;
|
|
14008
14055
|
if (r === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(e, null, 2)}`);
|
|
14009
|
-
if (n !== void 0 && (
|
|
14056
|
+
if (n !== void 0 && (hv({
|
|
14010
14057
|
attributes: {
|
|
14011
14058
|
class: "lien_article_externe",
|
|
14012
|
-
href:
|
|
14059
|
+
href: lv(l, s, n)
|
|
14013
14060
|
},
|
|
14014
14061
|
inputHtml: o,
|
|
14015
14062
|
originalTransformation: r,
|
|
@@ -14019,14 +14066,14 @@ async function fv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14019
14066
|
let e = await h.getTextIdFromSegmentId(n);
|
|
14020
14067
|
e != null && (_[e] = (_[e] ?? 0) + 1);
|
|
14021
14068
|
}
|
|
14022
|
-
|
|
14069
|
+
gv({
|
|
14023
14070
|
id: n,
|
|
14024
14071
|
outputByType: v
|
|
14025
|
-
}) &&
|
|
14072
|
+
}) && vv({
|
|
14026
14073
|
attributes: {
|
|
14027
14074
|
class: "reference_article",
|
|
14028
14075
|
style: "background-color: #eae462",
|
|
14029
|
-
title:
|
|
14076
|
+
title: dv(t, e.reference)
|
|
14030
14077
|
},
|
|
14031
14078
|
id: n,
|
|
14032
14079
|
inputHtml: o,
|
|
@@ -14039,10 +14086,10 @@ async function fv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14039
14086
|
case "external_division": {
|
|
14040
14087
|
let { division: t, originalTransformation: n, sectionTaId: r } = e;
|
|
14041
14088
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(e, null, 2)}`);
|
|
14042
|
-
if (r !== void 0 && (
|
|
14089
|
+
if (r !== void 0 && (hv({
|
|
14043
14090
|
attributes: {
|
|
14044
14091
|
class: "lien_division_externe",
|
|
14045
|
-
href:
|
|
14092
|
+
href: lv(l, s, r)
|
|
14046
14093
|
},
|
|
14047
14094
|
inputHtml: o,
|
|
14048
14095
|
originalTransformation: n,
|
|
@@ -14052,14 +14099,14 @@ async function fv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14052
14099
|
let e = await h.getTextIdFromSegmentId(r);
|
|
14053
14100
|
e != null && (_[e] = (_[e] ?? 0) + 1);
|
|
14054
14101
|
}
|
|
14055
|
-
|
|
14102
|
+
gv({
|
|
14056
14103
|
id: r,
|
|
14057
14104
|
outputByType: v
|
|
14058
|
-
}) &&
|
|
14105
|
+
}) && vv({
|
|
14059
14106
|
attributes: {
|
|
14060
14107
|
class: "reference_division",
|
|
14061
14108
|
style: "background-color: #eae462",
|
|
14062
|
-
title:
|
|
14109
|
+
title: dv(t, e.reference)
|
|
14063
14110
|
},
|
|
14064
14111
|
id: r,
|
|
14065
14112
|
inputHtml: o,
|
|
@@ -14072,7 +14119,7 @@ async function fv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14072
14119
|
case "european_text": {
|
|
14073
14120
|
let { url: t, originalTransformation: n, text: r, titleId: i } = e;
|
|
14074
14121
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14075
|
-
|
|
14122
|
+
hv({
|
|
14076
14123
|
attributes: {
|
|
14077
14124
|
class: "lien_texte_european",
|
|
14078
14125
|
href: t,
|
|
@@ -14082,14 +14129,14 @@ async function fv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14082
14129
|
originalTransformation: n,
|
|
14083
14130
|
outputByType: v,
|
|
14084
14131
|
replacementCounter: y
|
|
14085
|
-
}),
|
|
14132
|
+
}), gv({
|
|
14086
14133
|
id: i,
|
|
14087
14134
|
outputByType: v
|
|
14088
|
-
}) &&
|
|
14135
|
+
}) && vv({
|
|
14089
14136
|
attributes: {
|
|
14090
14137
|
class: "reference_texte",
|
|
14091
14138
|
style: "background-color: #eae462",
|
|
14092
|
-
title:
|
|
14139
|
+
title: dv(r, e.reference)
|
|
14093
14140
|
},
|
|
14094
14141
|
id: i,
|
|
14095
14142
|
inputHtml: o,
|
|
@@ -14102,23 +14149,23 @@ async function fv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14102
14149
|
case "external_text": {
|
|
14103
14150
|
let { originalTransformation: t, text: n } = e;
|
|
14104
14151
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14105
|
-
n.cid === void 0 ? !n.present && d && console.error(`Link to text "${g.text(n.position)}" without CID: ${JSON.stringify(n, null, 2)}`) : (
|
|
14152
|
+
n.cid === void 0 ? !n.present && d && console.error(`Link to text "${g.text(n.position)}" without CID: ${JSON.stringify(n, null, 2)}`) : (hv({
|
|
14106
14153
|
attributes: {
|
|
14107
14154
|
class: "lien_texte_externe",
|
|
14108
|
-
href:
|
|
14155
|
+
href: lv(l, s, n.cid)
|
|
14109
14156
|
},
|
|
14110
14157
|
inputHtml: o,
|
|
14111
14158
|
originalTransformation: t,
|
|
14112
14159
|
outputByType: v,
|
|
14113
14160
|
replacementCounter: y
|
|
14114
|
-
}), m && (_[n.cid] = (_[n.cid] ?? 0) + 1)),
|
|
14161
|
+
}), m && (_[n.cid] = (_[n.cid] ?? 0) + 1)), gv({
|
|
14115
14162
|
id: n.cid,
|
|
14116
14163
|
outputByType: v
|
|
14117
|
-
}) &&
|
|
14164
|
+
}) && vv({
|
|
14118
14165
|
attributes: {
|
|
14119
14166
|
class: "reference_texte",
|
|
14120
14167
|
style: "background-color: #eae462",
|
|
14121
|
-
title:
|
|
14168
|
+
title: dv(n, e.reference)
|
|
14122
14169
|
},
|
|
14123
14170
|
id: n.cid,
|
|
14124
14171
|
inputHtml: o,
|
|
@@ -14131,7 +14178,7 @@ async function fv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14131
14178
|
case "internal_article": {
|
|
14132
14179
|
let { definition: t, originalTransformation: n } = e;
|
|
14133
14180
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(e, null, 2)}`);
|
|
14134
|
-
for (let e of Object.values(v))
|
|
14181
|
+
for (let e of Object.values(v)) mv({
|
|
14135
14182
|
inputHtml: o,
|
|
14136
14183
|
originalTransformation: n,
|
|
14137
14184
|
output: e,
|
|
@@ -14142,18 +14189,18 @@ async function fv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14142
14189
|
}
|
|
14143
14190
|
default: c("Link", e);
|
|
14144
14191
|
}
|
|
14145
|
-
for (let e of Object.values(v)) e.html =
|
|
14192
|
+
for (let e of Object.values(v)) e.html = pv(o, e.replacements);
|
|
14146
14193
|
return {
|
|
14147
14194
|
outputByType: v,
|
|
14148
14195
|
referredLegifranceTextCountByCid: _
|
|
14149
14196
|
};
|
|
14150
14197
|
}
|
|
14151
|
-
function
|
|
14198
|
+
function vv({ attributes: e, id: t, inputHtml: n, originalTransformation: r, outputByType: i, replacementCounter: a }) {
|
|
14152
14199
|
let o = Object.entries(e).map(([e, t]) => `${e}="${et(t, !0)}"`).join(" ");
|
|
14153
14200
|
for (let e of ["links_or_references", "references"]) {
|
|
14154
14201
|
if (e === "links_or_references" && t !== void 0) continue;
|
|
14155
14202
|
let s = i[e];
|
|
14156
|
-
s !== void 0 &&
|
|
14203
|
+
s !== void 0 && mv({
|
|
14157
14204
|
inputHtml: n,
|
|
14158
14205
|
originalTransformation: r,
|
|
14159
14206
|
output: s,
|
|
@@ -14163,4 +14210,4 @@ function pv({ attributes: e, id: t, inputHtml: n, originalTransformation: r, out
|
|
|
14163
14210
|
}
|
|
14164
14211
|
}
|
|
14165
14212
|
//#endregion
|
|
14166
|
-
export { Wp as $,
|
|
14213
|
+
export { Wp as $, Vm as A, O as At, hm as B, ft as Bt, Xm as C, Rt as Ct, Wm as D, ht as Dt, Gm as E, mt as Et, Im as F, rt as Ft, Kp as G, mm as H, lt as Ht, Om as I, it as It, Gp as J, qp as K, Em as L, at as Lt, Um as M, tt as Mt, Lm as N, nt as Nt, Rm as O, _t as Ot, Fm as P, ot as Pt, bp as Q, wm as R, ut as Rt, Mh as S, Dt as St, qm as T, Ot as Tt, cm as U, ct as Ut, gm as V, st as Vt, $ as W, Rp as X, jp as Y, yp as Z, Qh as _, qt as _t, av as a, wn as at, Kh as b, Bt as bt, sv as c, fn as ct, V_ as d, rn as dt, dp as et, D_ as f, an as ft, O_ as g, Xt as gt, F_ as h, Qt as ht, lv as i, xn as it, Hm as j, xt as jt, zm as k, D as kt, H_ as l, un as lt, k_ as m, sn as mt, fv as n, _n as nt, ov as o, pn as ot, I_ as p, nn as pt, Zp as q, cv as r, vn as rt, iv as s, gn as st, _v as t, Tn as tt, rv as u, tn as ut, qh as v, Jt as vt, Km as w, zt as wt, Nh as x, Vt as xt, Jh as y, Yt as yt, _m as z, dt as zt };
|