@tricoteuses/tisseuse 0.14.6 → 0.14.8
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.
|
@@ -10589,7 +10589,9 @@ var Qp = [
|
|
|
10589
10589
|
nature: "CODE",
|
|
10590
10590
|
title: "Code des postes et des communications électroniques"
|
|
10591
10591
|
}
|
|
10592
|
-
}
|
|
10592
|
+
};
|
|
10593
|
+
new Set([...Qp.map(({ cid: e }) => e), ...Object.values(tm).map(({ cid: e }) => e)]);
|
|
10594
|
+
var nm = [{
|
|
10593
10595
|
info: tm.execution,
|
|
10594
10596
|
regExp: /code\s+des?\s+proc[eé]dures?\s+(?:civiles?\s+)?d['’]\s*ex(?:c)?[eé]cution/giu
|
|
10595
10597
|
}, {
|
|
@@ -10639,7 +10641,14 @@ function om(e, t) {
|
|
|
10639
10641
|
title: a
|
|
10640
10642
|
};
|
|
10641
10643
|
}
|
|
10642
|
-
function sm(e, t
|
|
10644
|
+
function sm(e, t) {
|
|
10645
|
+
return e.cid === "LEGITEXT000006070716" && t !== void 0 && /^[LR]\d/u.test(t) ? {
|
|
10646
|
+
...tm.execution,
|
|
10647
|
+
position: e.position,
|
|
10648
|
+
type: "texte"
|
|
10649
|
+
} : e;
|
|
10650
|
+
}
|
|
10651
|
+
function cm(e, t, n) {
|
|
10643
10652
|
let r = om(e, n === void 0 ? void 0 : {
|
|
10644
10653
|
input: n,
|
|
10645
10654
|
position: t
|
|
@@ -10650,50 +10659,57 @@ function sm(e, t, n) {
|
|
|
10650
10659
|
type: "texte"
|
|
10651
10660
|
};
|
|
10652
10661
|
}
|
|
10653
|
-
var
|
|
10662
|
+
var lm = T(...Qp.map(({ pattern: e }) => C(`${e}(?=$|\\P{Alphabetic})`, {
|
|
10654
10663
|
flags: "iv",
|
|
10655
|
-
value: (e, t) =>
|
|
10664
|
+
value: (e, t) => cm(e[0], t.position(), t.input)
|
|
10656
10665
|
})), C(`${em}(?=$|\\P{Alphabetic})`, {
|
|
10657
10666
|
flags: "iv",
|
|
10658
|
-
value: (e, t) =>
|
|
10667
|
+
value: (e, t) => cm(e[0], t.position(), t.input)
|
|
10659
10668
|
}));
|
|
10660
10669
|
//#endregion
|
|
10661
10670
|
//#region src/lib/text_parsers/doctrinal_references.ts
|
|
10662
|
-
function
|
|
10671
|
+
function um(e, t) {
|
|
10663
10672
|
let n = e.indices?.groups?.[t];
|
|
10664
10673
|
return n === void 0 ? void 0 : {
|
|
10665
10674
|
start: n[0],
|
|
10666
10675
|
stop: n[1]
|
|
10667
10676
|
};
|
|
10668
10677
|
}
|
|
10669
|
-
function
|
|
10678
|
+
function dm(e) {
|
|
10679
|
+
let t = e.match(/^(?<article>.*\d(?:[\p{L}\d-]*))\s+(?<subdivision>[IVXLCDM]+(?:\s+(?:bis|ter|quater))?|\d+\s*(?:°|º|er|e|ème))$/iu)?.groups?.article?.trim() ?? e;
|
|
10680
|
+
return {
|
|
10681
|
+
num: Jt(t),
|
|
10682
|
+
parsedArticleText: t
|
|
10683
|
+
};
|
|
10684
|
+
}
|
|
10685
|
+
function fm(e, t) {
|
|
10670
10686
|
let n = e.groups?.article?.trim(), r = e.groups?.text;
|
|
10671
10687
|
if (n === void 0 || r === void 0) return;
|
|
10672
|
-
let i =
|
|
10688
|
+
let i = um(e, "articleKeyword");
|
|
10673
10689
|
if (i === void 0 && !/^(?:(?:L\.?\s*O|[LRDA])\*?\.?\s*)\d/iu.test(n)) return;
|
|
10674
|
-
let
|
|
10675
|
-
if (
|
|
10676
|
-
let l =
|
|
10690
|
+
let { num: a, parsedArticleText: o } = dm(n), s = um(e, "article"), c = um(e, "text");
|
|
10691
|
+
if (a === void 0 || s === void 0 || c === void 0) return;
|
|
10692
|
+
let l = cm(r, c, t.input);
|
|
10677
10693
|
if (l === void 0) return;
|
|
10678
|
-
let u = {
|
|
10679
|
-
num:
|
|
10694
|
+
let u = sm(l, a), d = {
|
|
10695
|
+
num: a,
|
|
10680
10696
|
position: {
|
|
10681
10697
|
start: i?.start ?? s.start,
|
|
10682
|
-
stop: s.stop - (n.length -
|
|
10698
|
+
stop: s.stop - (n.length - o.length)
|
|
10683
10699
|
},
|
|
10684
10700
|
type: "article"
|
|
10685
10701
|
};
|
|
10686
10702
|
return {
|
|
10687
|
-
child:
|
|
10688
|
-
parent:
|
|
10703
|
+
child: d,
|
|
10704
|
+
parent: u,
|
|
10689
10705
|
position: {
|
|
10690
|
-
start: Math.min(
|
|
10691
|
-
stop: Math.max(
|
|
10706
|
+
start: Math.min(u.position.start, d.position.start),
|
|
10707
|
+
stop: Math.max(u.position.stop, d.position.stop)
|
|
10692
10708
|
},
|
|
10693
10709
|
type: "parent-enfant"
|
|
10694
10710
|
};
|
|
10695
10711
|
}
|
|
10696
|
-
var
|
|
10712
|
+
var pm = C(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
10697
10713
|
flags: "i",
|
|
10698
10714
|
value: (e, t) => {
|
|
10699
10715
|
let n = im[e[1].toUpperCase()];
|
|
@@ -10703,26 +10719,35 @@ var dm = C(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
|
10703
10719
|
type: "texte"
|
|
10704
10720
|
};
|
|
10705
10721
|
}
|
|
10706
|
-
}),
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10722
|
+
}), mm = o(Qt, { value: (e, t) => {
|
|
10723
|
+
let n = t.position(), r = t.text(n), i = r.match(/^(?<article>.*\d(?:[\p{L}\d-]*))\s+\d+\s*(?:°|º|er|e|ème)$/iu)?.groups?.article?.trim() ?? r;
|
|
10724
|
+
return {
|
|
10725
|
+
num: Jt(i),
|
|
10726
|
+
position: {
|
|
10727
|
+
start: n.start,
|
|
10728
|
+
stop: n.stop - (r.length - i.length)
|
|
10729
|
+
},
|
|
10730
|
+
type: "article"
|
|
10731
|
+
};
|
|
10732
|
+
} }), hm = x([C(String.raw`\s*,\s*art(?:icle)?\.?\s+`, { flags: "i" }), mm], { value: (e) => e[1] }), gm = x([
|
|
10711
10733
|
w(C(String.raw`(?:le|la|les)\s+`, { flags: "i" }), { default: "" }),
|
|
10712
|
-
T(
|
|
10713
|
-
|
|
10714
|
-
], { value: (e, t) =>
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10734
|
+
T(pm, lm),
|
|
10735
|
+
hm
|
|
10736
|
+
], { value: (e, t) => {
|
|
10737
|
+
let n = e[2];
|
|
10738
|
+
return {
|
|
10739
|
+
child: n,
|
|
10740
|
+
parent: sm(e[1], n.num),
|
|
10741
|
+
position: t.position(),
|
|
10742
|
+
type: "parent-enfant"
|
|
10743
|
+
};
|
|
10744
|
+
} }), _m = C(String.raw`(?:(?<articleKeyword>articles?)\s+)?(?<article>\S[^\n,;:\(\)]*?)\s+(?:(?:du|de\s+la|de\s+l['’])\s+)?(?<text>${rm})(?=$|\P{Alphabetic})`, {
|
|
10720
10745
|
flags: "div",
|
|
10721
|
-
value: (e, t) =>
|
|
10722
|
-
}),
|
|
10746
|
+
value: (e, t) => fm(e, t)
|
|
10747
|
+
}), vm = 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})`, {
|
|
10723
10748
|
flags: "div",
|
|
10724
10749
|
value: (e, t) => {
|
|
10725
|
-
let n =
|
|
10750
|
+
let n = um(e, "article1"), r = um(e, "article2"), i = um(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 : cm(e.groups.text, i, t.input);
|
|
10726
10751
|
if (!(n === void 0 || r === void 0 || c === void 0 || l === void 0 || s !== "et" && s !== "ou" || u === void 0)) return {
|
|
10727
10752
|
child: {
|
|
10728
10753
|
coordinator: s,
|
|
@@ -10742,7 +10767,7 @@ var dm = C(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
|
10742
10767
|
},
|
|
10743
10768
|
type: "enumeration"
|
|
10744
10769
|
},
|
|
10745
|
-
parent: u,
|
|
10770
|
+
parent: sm(sm(u, c), l),
|
|
10746
10771
|
position: {
|
|
10747
10772
|
start: n.start,
|
|
10748
10773
|
stop: u.position.stop
|
|
@@ -10750,7 +10775,7 @@ var dm = C(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
|
10750
10775
|
type: "parent-enfant"
|
|
10751
10776
|
};
|
|
10752
10777
|
}
|
|
10753
|
-
}),
|
|
10778
|
+
}), ym = T(gm, vm, _m), bm = (e) => {
|
|
10754
10779
|
let t = e.offset, n = /,\s*(?:par\s+)?/guy;
|
|
10755
10780
|
if (n.lastIndex = t, !n.exec(e.input)) return;
|
|
10756
10781
|
e.offset = n.lastIndex;
|
|
@@ -10766,7 +10791,7 @@ var dm = C(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
|
10766
10791
|
}
|
|
10767
10792
|
return e.offset = i.lastIndex, e.length = 0, e.usedInputs = e.input.slice(t, e.offset), r;
|
|
10768
10793
|
};
|
|
10769
|
-
function
|
|
10794
|
+
function xm(e) {
|
|
10770
10795
|
for (let t = 0; t < e.length; t += 1) {
|
|
10771
10796
|
let r = t === 0 ? void 0 : e[t - 1];
|
|
10772
10797
|
if (r && /[\p{L}\p{N}_]/u.test(r)) continue;
|
|
@@ -10775,7 +10800,7 @@ function ym(e) {
|
|
|
10775
10800
|
}
|
|
10776
10801
|
return null;
|
|
10777
10802
|
}
|
|
10778
|
-
function
|
|
10803
|
+
function Sm(e, t) {
|
|
10779
10804
|
let r = e.slice(0, Math.max(0, t)), i = /(?:^|[^\p{L}\p{N}_])les\s+/giu, a = null;
|
|
10780
10805
|
for (; i.exec(r) !== null;) {
|
|
10781
10806
|
let e = new n(r, i.lastIndex), t = Ae(e);
|
|
@@ -10783,7 +10808,7 @@ function bm(e, t) {
|
|
|
10783
10808
|
}
|
|
10784
10809
|
return a;
|
|
10785
10810
|
}
|
|
10786
|
-
function
|
|
10811
|
+
function Cm(e) {
|
|
10787
10812
|
let t = [], r = /(?:,\s*)?par\s+/giu, i = 0, a;
|
|
10788
10813
|
for (; (a = r.exec(e)) !== null;) {
|
|
10789
10814
|
let o = new n(e, r.lastIndex);
|
|
@@ -10795,17 +10820,17 @@ function xm(e) {
|
|
|
10795
10820
|
}
|
|
10796
10821
|
//#endregion
|
|
10797
10822
|
//#region src/lib/text_parsers/actions.ts
|
|
10798
|
-
var
|
|
10823
|
+
var wm = (e) => x([
|
|
10799
10824
|
C(e, { flags: "i" }),
|
|
10800
|
-
|
|
10825
|
+
bm,
|
|
10801
10826
|
C(e === "est" ? "remplacée?" : "remplacée?s", { flags: "i" })
|
|
10802
|
-
], { value: "remplacer" }),
|
|
10827
|
+
], { value: "remplacer" }), Tm = T(ee(C("(modalités|conditions) d'application (de )?", { flags: "i" }), {
|
|
10803
10828
|
lookbackLength: 35,
|
|
10804
10829
|
value: { action: "précision" }
|
|
10805
10830
|
}), ee(C("en application (de )?", { flags: "i" }), {
|
|
10806
10831
|
lookbackLength: 35,
|
|
10807
10832
|
value: { action: "application" }
|
|
10808
|
-
})),
|
|
10833
|
+
})), Em = 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([
|
|
10809
10834
|
b,
|
|
10810
10835
|
C("est complété par les mots ?", { flags: "i" }),
|
|
10811
10836
|
C(" ?:"),
|
|
@@ -10873,7 +10898,7 @@ var Sm = (e) => x([
|
|
|
10873
10898
|
}), C("est rétablie? (ainsi qu'il|comme) suit", {
|
|
10874
10899
|
flags: "i",
|
|
10875
10900
|
value: "rétablir"
|
|
10876
|
-
}),
|
|
10901
|
+
}), wm("est"), C("est remplacée?", {
|
|
10877
10902
|
flags: "i",
|
|
10878
10903
|
value: "remplacer"
|
|
10879
10904
|
}), C("sont ainsi modifiée?s", {
|
|
@@ -10888,7 +10913,7 @@ var Sm = (e) => x([
|
|
|
10888
10913
|
}), C("sont rétablie?s (ainsi qu'il|comme) suit", {
|
|
10889
10914
|
flags: "i",
|
|
10890
10915
|
value: "rétablir"
|
|
10891
|
-
}),
|
|
10916
|
+
}), wm("sont"), C("sont remplacée?s", {
|
|
10892
10917
|
flags: "i",
|
|
10893
10918
|
value: "remplacer"
|
|
10894
10919
|
}), C("sont renum[eé]rotée?s", {
|
|
@@ -10908,7 +10933,7 @@ var Sm = (e) => x([
|
|
|
10908
10933
|
}), C("est remplacée?", {
|
|
10909
10934
|
flags: "i",
|
|
10910
10935
|
value: "remplacer"
|
|
10911
|
-
}),
|
|
10936
|
+
}), wm("est"), wm("sont"), C("sont remplacée?s", {
|
|
10912
10937
|
flags: "i",
|
|
10913
10938
|
value: "remplacer"
|
|
10914
10939
|
}), C("est modifiée?", {
|
|
@@ -11068,23 +11093,23 @@ var Sm = (e) => x([
|
|
|
11068
11093
|
}), C("est supprimée?", {
|
|
11069
11094
|
flags: "i",
|
|
11070
11095
|
value: "supprimer"
|
|
11071
|
-
}))], { value: (e) => ({ action: e[1] }) }))),
|
|
11096
|
+
}))], { value: (e) => ({ action: e[1] }) }))), Dm = T(un, wn), Om = T(fn, xn, lm, he), km = x([Dm, _(x([le, Om], { value: (e) => e[1] }))], { value: (e, t) => _t(e[0], e[1], t.position()) }), Am = x([Om, _(x([le, Om], { value: (e) => e[1] }))], { value: (e, t) => _t(e[0], e[1], t.position()) }), jm = x([se, km], { value: (e) => e[1] }), Mm = T(x([le, Am], { value: (e) => e[1] }), jm), Nm = T(x([Ht, w(Mm, { default: null })], { value: (e) => {
|
|
11072
11097
|
let t = e[0], n = e[1];
|
|
11073
11098
|
return n === null ? t : mt(n, t);
|
|
11074
|
-
} }),
|
|
11099
|
+
} }), km), Pm = T(x([Ut, w(Mm, { default: null })], { value: (e) => {
|
|
11075
11100
|
let t = e[0], n = e[1];
|
|
11076
11101
|
return n === null ? t : mt(n, t);
|
|
11077
|
-
} }),
|
|
11078
|
-
w(
|
|
11102
|
+
} }), Am), Fm = x([
|
|
11103
|
+
w(Tm, { default: null }),
|
|
11079
11104
|
x([
|
|
11080
11105
|
p,
|
|
11081
|
-
|
|
11106
|
+
Nm,
|
|
11082
11107
|
w([w(C(" modifiée?s", { flags: "i" }), { default: "" }), C(" susvisée?s", { flags: "i" })], { default: "" })
|
|
11083
11108
|
], { value: (e, t) => ({
|
|
11084
11109
|
...e[1],
|
|
11085
11110
|
position: t.position()
|
|
11086
11111
|
}) }),
|
|
11087
|
-
w(
|
|
11112
|
+
w(Em, { default: null })
|
|
11088
11113
|
], { value: (e, t) => {
|
|
11089
11114
|
let n = e[2] ?? e[0];
|
|
11090
11115
|
return n === null ? e[1] : {
|
|
@@ -11093,18 +11118,18 @@ var Sm = (e) => x([
|
|
|
11093
11118
|
reference: e[1],
|
|
11094
11119
|
type: "reference_et_action"
|
|
11095
11120
|
};
|
|
11096
|
-
} }),
|
|
11097
|
-
w(
|
|
11121
|
+
} }), Im = T(x([
|
|
11122
|
+
w(Tm, { default: null }),
|
|
11098
11123
|
x([
|
|
11099
11124
|
ce,
|
|
11100
|
-
|
|
11125
|
+
Pm,
|
|
11101
11126
|
w([w(C(" modifiée?", { flags: "i" }), { default: "" }), C(" susvisée?", { flags: "i" })], { default: "" }),
|
|
11102
11127
|
w(C(String.raw`, ?qui devient [^,]+ ","`, { flags: "i" }), { default: "" })
|
|
11103
11128
|
], { value: (e, t) => ({
|
|
11104
11129
|
...e[1],
|
|
11105
11130
|
position: t.position()
|
|
11106
11131
|
}) }),
|
|
11107
|
-
w(
|
|
11132
|
+
w(Em, { default: null })
|
|
11108
11133
|
], { value: (e, t) => {
|
|
11109
11134
|
let n = e[2] ?? e[0];
|
|
11110
11135
|
return n === null ? e[1] : {
|
|
@@ -11113,23 +11138,23 @@ var Sm = (e) => x([
|
|
|
11113
11138
|
reference: e[1],
|
|
11114
11139
|
type: "reference_et_action"
|
|
11115
11140
|
};
|
|
11116
|
-
} }),
|
|
11141
|
+
} }), Fm), Lm = 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([Im, _([T(Ct, St), Im])], { value: (e, t) => ht(e[0], e[1], t.position()) })), Rm = o(Pm, { value: (e, t) => ({
|
|
11117
11142
|
...e,
|
|
11118
11143
|
position: t.position()
|
|
11119
|
-
}) }),
|
|
11144
|
+
}) }), zm = T(_(Rm, {
|
|
11120
11145
|
min: 2,
|
|
11121
11146
|
separator: Ne,
|
|
11122
11147
|
value: (e) => [e[0], ...e.slice(1).map(([, e]) => e)]
|
|
11123
|
-
}), _(
|
|
11148
|
+
}), _(Rm, {
|
|
11124
11149
|
min: 2,
|
|
11125
11150
|
separator: C(String.raw`\n`),
|
|
11126
11151
|
value: (e) => [e[0], ...e.slice(1).map(([, e]) => e)]
|
|
11127
|
-
}), o(
|
|
11152
|
+
}), o(Rm, { value: (e) => [e] }));
|
|
11128
11153
|
//#endregion
|
|
11129
11154
|
//#region src/lib/extractors/references.ts
|
|
11130
|
-
function*
|
|
11155
|
+
function* Bm(e, t) {
|
|
11131
11156
|
let r = Xp(e, t), i = new n(r.output), a = _e(r);
|
|
11132
|
-
for (let e of
|
|
11157
|
+
for (let e of Hm(i)) {
|
|
11133
11158
|
e = structuredClone(e), t.references === void 0 && (t.references = []), t.references.push(e);
|
|
11134
11159
|
for (let t of xt(e)) {
|
|
11135
11160
|
let e = t.position;
|
|
@@ -11138,132 +11163,132 @@ function* Rm(e, t) {
|
|
|
11138
11163
|
yield e;
|
|
11139
11164
|
}
|
|
11140
11165
|
}
|
|
11141
|
-
function*
|
|
11142
|
-
yield*
|
|
11166
|
+
function* Vm(e, t = {}) {
|
|
11167
|
+
yield* Hm(e, t);
|
|
11143
11168
|
}
|
|
11144
|
-
function*
|
|
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,
|
|
11169
|
+
function* Hm(e, t = {}) {
|
|
11170
|
+
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, ym, Lm), 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})`);
|
|
11146
11171
|
for (let r of n.extract(e, {
|
|
11147
11172
|
overlapWindow: 80,
|
|
11148
11173
|
overlapWindowForCandidate: t.overlapWindowForCandidate
|
|
11149
|
-
})) if (r !== void 0) if (r.type === "citation") yield*
|
|
11174
|
+
})) if (r !== void 0) if (r.type === "citation") yield* Bm(e, r);
|
|
11150
11175
|
else {
|
|
11151
11176
|
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") {
|
|
11152
11177
|
for (let t of xt(r)) if (t.type === "reference_et_action") {
|
|
11153
11178
|
let { originalCitations: n } = t.action;
|
|
11154
|
-
if (n !== void 0) for (let t of n) for (let n of
|
|
11179
|
+
if (n !== void 0) for (let t of n) for (let n of Bm(e, t));
|
|
11155
11180
|
}
|
|
11156
11181
|
}
|
|
11157
11182
|
yield r;
|
|
11158
11183
|
}
|
|
11159
11184
|
}
|
|
11160
|
-
function*
|
|
11185
|
+
function* Um(e, t) {
|
|
11161
11186
|
let n = _e(t);
|
|
11162
|
-
for (let t of
|
|
11187
|
+
for (let t of Vm(e)) {
|
|
11163
11188
|
for (let e of xt(t, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = v(n, e.position));
|
|
11164
11189
|
yield t;
|
|
11165
11190
|
}
|
|
11166
11191
|
}
|
|
11167
|
-
var
|
|
11192
|
+
var Wm = (e) => [...Vm(e)], Gm = (e, t) => [...Um(e, t)], Km = "(?:avant|apr[eè]s)", qm = T(C("avant(?![-A-Za-zÀ-ÖØ-öø-ÿ0-9_])", {
|
|
11168
11193
|
flags: "i",
|
|
11169
11194
|
value: "before"
|
|
11170
11195
|
}), C("apr[eè]s(?![-A-Za-zÀ-ÖØ-öø-ÿ0-9_])", {
|
|
11171
11196
|
flags: "i",
|
|
11172
11197
|
value: "after"
|
|
11173
|
-
})),
|
|
11198
|
+
})), Jm = T(C("(?:au|a[uù])\\s+d[eé]but\\b", {
|
|
11174
11199
|
flags: "i",
|
|
11175
11200
|
value: "start"
|
|
11176
11201
|
}), C("(?:a|à)\\s+la\\s+fin\\b", {
|
|
11177
11202
|
flags: "i",
|
|
11178
11203
|
value: "end"
|
|
11179
11204
|
}));
|
|
11180
|
-
function
|
|
11205
|
+
function Ym(e) {
|
|
11181
11206
|
return e === "before" ? "insert_before" : "insert_after";
|
|
11182
11207
|
}
|
|
11183
|
-
function
|
|
11184
|
-
let t =
|
|
11208
|
+
function Xm(e) {
|
|
11209
|
+
let t = Zm(e), n = /(?:^|[^\p{L}\p{N}_-])(avant|apres)(?![\p{L}\p{N}_-])/u.exec(t);
|
|
11185
11210
|
return n ? n[1] === "avant" ? "before" : "after" : null;
|
|
11186
11211
|
}
|
|
11187
|
-
function
|
|
11212
|
+
function Zm(e) {
|
|
11188
11213
|
return e.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
11189
11214
|
}
|
|
11190
11215
|
//#endregion
|
|
11191
11216
|
//#region src/lib/text_parsers/action_words.ts
|
|
11192
|
-
var
|
|
11193
|
-
function
|
|
11217
|
+
var Qm = /\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;
|
|
11218
|
+
function $m(e) {
|
|
11194
11219
|
return e.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
11195
11220
|
}
|
|
11196
|
-
function
|
|
11221
|
+
function eh(e, t = e) {
|
|
11197
11222
|
return /\bredige\b|\bredigee\b|\bredigees\b|\brediges\b|\bainsi\b/.test(e) || /\bdispositions suivantes\b/.test(t);
|
|
11198
11223
|
}
|
|
11199
|
-
function
|
|
11200
|
-
return
|
|
11224
|
+
function th(e) {
|
|
11225
|
+
return Xm(e) === "after";
|
|
11201
11226
|
}
|
|
11202
|
-
function
|
|
11203
|
-
return
|
|
11227
|
+
function nh(e) {
|
|
11228
|
+
return Xm(e) === "before";
|
|
11204
11229
|
}
|
|
11205
|
-
function
|
|
11230
|
+
function rh(e) {
|
|
11206
11231
|
return /\bretabl/.test(e);
|
|
11207
11232
|
}
|
|
11208
|
-
function
|
|
11233
|
+
function ih(e) {
|
|
11209
11234
|
return /\binsere(?:e|es|s)?\b|\bajoute\b|\bajoutee\b|\bajoutes\b|\bajoutees\b|\bcomplete(?:e|es|s)?\b/.test(e);
|
|
11210
11235
|
}
|
|
11211
|
-
function
|
|
11236
|
+
function ah(e) {
|
|
11212
11237
|
return /\bremplace\b|\bremplacee\b|\bremplaces\b|\bremplacees\b/.test(e);
|
|
11213
11238
|
}
|
|
11214
|
-
function
|
|
11239
|
+
function oh(e) {
|
|
11215
11240
|
return /\bsupprime\b|\bsupprimee\b|\bsupprimes\b|\bsupprimees\b|\babroge\b|\babrogee\b|\babroges\b|\babrogees\b/.test(e);
|
|
11216
11241
|
}
|
|
11217
|
-
function
|
|
11242
|
+
function sh(e) {
|
|
11218
11243
|
return /\b(remplace|modifie|redige|rediges|redigee|redigees)\b/.test(e);
|
|
11219
11244
|
}
|
|
11220
11245
|
//#endregion
|
|
11221
11246
|
//#region src/lib/extractors/portion_references.ts
|
|
11222
|
-
function
|
|
11247
|
+
function ch(e, t) {
|
|
11223
11248
|
e && (e.start += t, e.stop += t);
|
|
11224
11249
|
}
|
|
11225
|
-
function
|
|
11250
|
+
function lh(e, t) {
|
|
11226
11251
|
if (e.type === "parent-enfant") {
|
|
11227
|
-
|
|
11252
|
+
lh(e.parent, t), lh(e.child, t), ch(e.position, t);
|
|
11228
11253
|
return;
|
|
11229
11254
|
}
|
|
11230
11255
|
if (e.type === "bounded-interval") {
|
|
11231
|
-
|
|
11256
|
+
lh(e.first, t), lh(e.last, t), ch(e.position, t);
|
|
11232
11257
|
return;
|
|
11233
11258
|
}
|
|
11234
11259
|
if (e.type === "counted-interval") {
|
|
11235
|
-
|
|
11260
|
+
lh(e.first, t), ch(e.position, t);
|
|
11236
11261
|
return;
|
|
11237
11262
|
}
|
|
11238
11263
|
if (e.type === "enumeration" || e.type === "exclusion") {
|
|
11239
|
-
|
|
11264
|
+
lh(e.left, t), lh(e.right, t), ch(e.position, t);
|
|
11240
11265
|
return;
|
|
11241
11266
|
}
|
|
11242
11267
|
if (e.type === "reference_et_action") {
|
|
11243
|
-
|
|
11268
|
+
lh(e.reference, t), ch(e.position, t);
|
|
11244
11269
|
return;
|
|
11245
11270
|
}
|
|
11246
|
-
|
|
11271
|
+
ch(e.position, t);
|
|
11247
11272
|
}
|
|
11248
|
-
function
|
|
11273
|
+
function uh(e) {
|
|
11249
11274
|
return e.replace(/\b(de\s+l['’]?|de\s+la|de\s+le|du|des)\s*$/i, "");
|
|
11250
11275
|
}
|
|
11251
|
-
function
|
|
11276
|
+
function dh(e) {
|
|
11252
11277
|
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();
|
|
11253
11278
|
return n ? {
|
|
11254
11279
|
text: n,
|
|
11255
11280
|
offset: t
|
|
11256
11281
|
} : null;
|
|
11257
11282
|
}
|
|
11258
|
-
function
|
|
11283
|
+
function fh(e) {
|
|
11259
11284
|
return [...e.matchAll(/(?:^|\P{L})(\p{L})/gu)].map((e) => (e.index ?? 0) + e[0].length - (e[1]?.length ?? 0));
|
|
11260
11285
|
}
|
|
11261
|
-
function
|
|
11286
|
+
function ph(e) {
|
|
11262
11287
|
let t = new n(e), r = Rt(t);
|
|
11263
11288
|
return !r || t.remaining().trim().length !== 0 ? null : r;
|
|
11264
11289
|
}
|
|
11265
|
-
function
|
|
11266
|
-
for (let t of
|
|
11290
|
+
function mh(e) {
|
|
11291
|
+
for (let t of fh(e)) {
|
|
11267
11292
|
let r = new n(e, t), i = Et(r);
|
|
11268
11293
|
if (!(i === void 0 || r.remaining().trim() !== "")) return {
|
|
11269
11294
|
nature: i,
|
|
@@ -11272,17 +11297,17 @@ function fh(e) {
|
|
|
11272
11297
|
}
|
|
11273
11298
|
return null;
|
|
11274
11299
|
}
|
|
11275
|
-
function
|
|
11300
|
+
function hh(e, t) {
|
|
11276
11301
|
let n = e.trim().replace(/[;:,]\s*$/u, "").replace(/\b(?:est|sont)\s*$/iu, "").trim();
|
|
11277
11302
|
if (!n) return null;
|
|
11278
|
-
for (let e of
|
|
11279
|
-
let r = n.slice(e).trim(), i =
|
|
11303
|
+
for (let e of fh(n)) {
|
|
11304
|
+
let r = n.slice(e).trim(), i = mh(r);
|
|
11280
11305
|
if (!i) continue;
|
|
11281
|
-
let a =
|
|
11306
|
+
let a = Cm(r.slice(0, i.start)).trim();
|
|
11282
11307
|
if (!a) continue;
|
|
11283
11308
|
let o = /\s*(,|\bet\b|\bou\b|(?<!\p{L})[aà](?!\p{L}))\s*/giu, s = [], c = 0, l;
|
|
11284
11309
|
for (; (l = o.exec(a)) !== null;) {
|
|
11285
|
-
let e =
|
|
11310
|
+
let e = $m(l[1] ?? "");
|
|
11286
11311
|
if (a.slice(c, l.index).trim() === "") {
|
|
11287
11312
|
e !== "a" && e !== "à" && (c = o.lastIndex);
|
|
11288
11313
|
continue;
|
|
@@ -11299,17 +11324,17 @@ function ph(e, t) {
|
|
|
11299
11324
|
}), s.length < 2) continue;
|
|
11300
11325
|
let u = s.some((e) => e.separator === "à"), d = [], f = [], p = !0, m = i.nature, h;
|
|
11301
11326
|
for (let [n, r] of s.entries()) {
|
|
11302
|
-
let i =
|
|
11327
|
+
let i = dh(r.text);
|
|
11303
11328
|
if (!i) {
|
|
11304
11329
|
d.length = 0;
|
|
11305
11330
|
break;
|
|
11306
11331
|
}
|
|
11307
|
-
let a =
|
|
11332
|
+
let a = ph(`${i.text} ${m}`);
|
|
11308
11333
|
if (!a) {
|
|
11309
11334
|
d.length = 0;
|
|
11310
11335
|
break;
|
|
11311
11336
|
}
|
|
11312
|
-
|
|
11337
|
+
lh(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));
|
|
11313
11338
|
}
|
|
11314
11339
|
let [g, ..._] = d;
|
|
11315
11340
|
if (!g || _.length === 0) continue;
|
|
@@ -11326,16 +11351,16 @@ function ph(e, t) {
|
|
|
11326
11351
|
}
|
|
11327
11352
|
return null;
|
|
11328
11353
|
}
|
|
11329
|
-
function
|
|
11354
|
+
function gh(e, t) {
|
|
11330
11355
|
let r = e.trim().replace(/[;:,]\s*$/u, "").replace(/\b(?:est|sont)\s*$/iu, "").trim();
|
|
11331
11356
|
if (!r) return null;
|
|
11332
|
-
for (let e of
|
|
11357
|
+
for (let e of fh(r)) {
|
|
11333
11358
|
let i = r.slice(e);
|
|
11334
11359
|
if (!i) continue;
|
|
11335
11360
|
let a = new n(i), o = Rt(a);
|
|
11336
11361
|
if (!o || a.offset === 0 || !se(a)) continue;
|
|
11337
|
-
let s = a.offset, c =
|
|
11338
|
-
if (c) return
|
|
11362
|
+
let s = a.offset, c = hh(i.slice(s), t + e + s);
|
|
11363
|
+
if (c) return lh(o, t + e), {
|
|
11339
11364
|
...mt(c, o),
|
|
11340
11365
|
position: {
|
|
11341
11366
|
start: o.position.start,
|
|
@@ -11345,57 +11370,57 @@ function mh(e, t) {
|
|
|
11345
11370
|
}
|
|
11346
11371
|
return null;
|
|
11347
11372
|
}
|
|
11348
|
-
function
|
|
11349
|
-
let r =
|
|
11373
|
+
function _h(e, t) {
|
|
11374
|
+
let r = uh(e);
|
|
11350
11375
|
if (!r) return null;
|
|
11351
|
-
let i =
|
|
11376
|
+
let i = gh(r, t);
|
|
11352
11377
|
if (i) return i;
|
|
11353
|
-
let a =
|
|
11378
|
+
let a = hh(r, t);
|
|
11354
11379
|
if (a) return a;
|
|
11355
|
-
for (let e of
|
|
11380
|
+
for (let e of fh(r)) {
|
|
11356
11381
|
let i = r.slice(e);
|
|
11357
11382
|
if (!i) continue;
|
|
11358
11383
|
let a = new n(i), o = Rt(a);
|
|
11359
|
-
if (!(!o || a.offset === 0) && i.slice(a.offset).trim().length === 0) return
|
|
11384
|
+
if (!(!o || a.offset === 0) && i.slice(a.offset).trim().length === 0) return lh(o, t + e), o;
|
|
11360
11385
|
}
|
|
11361
11386
|
return null;
|
|
11362
11387
|
}
|
|
11363
|
-
function
|
|
11388
|
+
function vh(e) {
|
|
11364
11389
|
return Math.max(0, ...Rp(e).map((e) => e.kind === "single" ? e.steps.length : Math.max(e.first.length, e.last.length)));
|
|
11365
11390
|
}
|
|
11366
|
-
function
|
|
11391
|
+
function yh(e) {
|
|
11367
11392
|
return Rp(e).length;
|
|
11368
11393
|
}
|
|
11369
|
-
function
|
|
11394
|
+
function bh(e, t) {
|
|
11370
11395
|
if (!e) return t;
|
|
11371
11396
|
if (!t) return e;
|
|
11372
|
-
let n =
|
|
11373
|
-
return n === r ?
|
|
11397
|
+
let n = vh(e), r = vh(t);
|
|
11398
|
+
return n === r ? yh(e) >= yh(t) ? e : t : n > r ? e : t;
|
|
11374
11399
|
}
|
|
11375
|
-
function
|
|
11400
|
+
function xh(e) {
|
|
11376
11401
|
return e.map((e) => ({
|
|
11377
11402
|
reference: e,
|
|
11378
|
-
specificity:
|
|
11403
|
+
specificity: vh(e)
|
|
11379
11404
|
})).filter((e) => e.specificity > 0).sort((e, t) => t.specificity - e.specificity)[0]?.reference ?? null;
|
|
11380
11405
|
}
|
|
11381
|
-
function
|
|
11406
|
+
function Sh(e, { actionIndex: t = e.length } = {}) {
|
|
11382
11407
|
let r = /\barticle\b/i.exec(e);
|
|
11383
11408
|
if (!r || r.index === void 0) return null;
|
|
11384
11409
|
let i = r.index, a = new n(e.slice(i)), o = fn(a);
|
|
11385
11410
|
if (!o) return null;
|
|
11386
|
-
|
|
11387
|
-
let s = e.slice(0, i), c = i + a.offset, l = e.slice(c, t), u =
|
|
11411
|
+
lh(o, i);
|
|
11412
|
+
let s = e.slice(0, i), c = i + a.offset, l = e.slice(c, t), u = bh(xh(Ch(s)), _h(s, 0)) ?? xh(Ch(l)) ?? _h(l, c);
|
|
11388
11413
|
return u ? mt(o, u) : null;
|
|
11389
11414
|
}
|
|
11390
|
-
function
|
|
11391
|
-
return
|
|
11415
|
+
function Ch(e) {
|
|
11416
|
+
return Wm(new n(e));
|
|
11392
11417
|
}
|
|
11393
11418
|
//#endregion
|
|
11394
11419
|
//#region src/lib/extractors/quoted_text.ts
|
|
11395
|
-
function
|
|
11420
|
+
function wh(e) {
|
|
11396
11421
|
return e.split(/\n+/).map((e) => e.replace(/^\s*[«“"]\s*/u, "").trim()).filter((e) => e.length > 0).join("\n").replace(/[»”"]\s*$/u, "").trim();
|
|
11397
11422
|
}
|
|
11398
|
-
function
|
|
11423
|
+
function Th(e) {
|
|
11399
11424
|
let t = [], r = 0;
|
|
11400
11425
|
for (; r < e.length;) {
|
|
11401
11426
|
let i = e.indexOf("«", r);
|
|
@@ -11407,7 +11432,7 @@ function Ch(e) {
|
|
|
11407
11432
|
r = i + 1;
|
|
11408
11433
|
continue;
|
|
11409
11434
|
}
|
|
11410
|
-
let s =
|
|
11435
|
+
let s = wh(Zp(e, o)), c = o.position ?? {
|
|
11411
11436
|
start: i,
|
|
11412
11437
|
stop: i + 1
|
|
11413
11438
|
};
|
|
@@ -11421,7 +11446,7 @@ function Ch(e) {
|
|
|
11421
11446
|
}
|
|
11422
11447
|
return t;
|
|
11423
11448
|
}
|
|
11424
|
-
function
|
|
11449
|
+
function Eh(e, t) {
|
|
11425
11450
|
if (t.length === 0) return e;
|
|
11426
11451
|
let n = 0, r = [];
|
|
11427
11452
|
for (let { start: i, end: a } of t) {
|
|
@@ -11430,7 +11455,7 @@ function wh(e, t) {
|
|
|
11430
11455
|
}
|
|
11431
11456
|
return n < e.length && r.push(e.slice(n)), r.join("");
|
|
11432
11457
|
}
|
|
11433
|
-
function
|
|
11458
|
+
function Dh(e) {
|
|
11434
11459
|
let t = [], n = 0;
|
|
11435
11460
|
for (; n < e.length;) {
|
|
11436
11461
|
let r = e.indexOf("«", n);
|
|
@@ -11450,13 +11475,13 @@ function Th(e) {
|
|
|
11450
11475
|
}
|
|
11451
11476
|
return t;
|
|
11452
11477
|
}
|
|
11453
|
-
function
|
|
11478
|
+
function Oh(e, t) {
|
|
11454
11479
|
return e ? t.some((t) => e.start >= t.start && e.stop <= t.end) : !1;
|
|
11455
11480
|
}
|
|
11456
|
-
function
|
|
11457
|
-
return
|
|
11481
|
+
function kh(e, t) {
|
|
11482
|
+
return Oh(e, t);
|
|
11458
11483
|
}
|
|
11459
|
-
function
|
|
11484
|
+
function Ah(e) {
|
|
11460
11485
|
if (!e.includes("«")) return e;
|
|
11461
11486
|
let t = e.split(""), n = !1;
|
|
11462
11487
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -11475,10 +11500,10 @@ function Oh(e) {
|
|
|
11475
11500
|
}
|
|
11476
11501
|
//#endregion
|
|
11477
11502
|
//#region src/lib/text_parsers/action_citation_patterns.ts
|
|
11478
|
-
function
|
|
11503
|
+
function jh(e) {
|
|
11479
11504
|
return `(?:${e.join("|")})`;
|
|
11480
11505
|
}
|
|
11481
|
-
var
|
|
11506
|
+
var Mh = [
|
|
11482
11507
|
"(?:à\\s+|de\\s+)?l[’']année",
|
|
11483
11508
|
"(?:à\\s+|de\\s+)?la date",
|
|
11484
11509
|
"(?:à\\s+|de\\s+)?la mention",
|
|
@@ -11496,7 +11521,7 @@ var Ah = [
|
|
|
11496
11521
|
"(?:aux|des|les)\\s+nombres",
|
|
11497
11522
|
"(?:aux|des|les)\\s+références",
|
|
11498
11523
|
"le tableau intitulé"
|
|
11499
|
-
],
|
|
11524
|
+
], Nh = [
|
|
11500
11525
|
"l[’']année",
|
|
11501
11526
|
"la date",
|
|
11502
11527
|
"la mention",
|
|
@@ -11514,10 +11539,10 @@ var Ah = [
|
|
|
11514
11539
|
"les mots",
|
|
11515
11540
|
"les nombres",
|
|
11516
11541
|
"les références"
|
|
11517
|
-
],
|
|
11542
|
+
], Ph = jh(Mh), Fh = jh(Nh);
|
|
11518
11543
|
//#endregion
|
|
11519
11544
|
//#region src/lib/text_parsers/action_directives.ts
|
|
11520
|
-
function
|
|
11545
|
+
function Ih(e) {
|
|
11521
11546
|
return e.type === "reference_et_action" ? {
|
|
11522
11547
|
action: e.action,
|
|
11523
11548
|
reference: e.reference
|
|
@@ -11526,7 +11551,7 @@ function Ph(e) {
|
|
|
11526
11551
|
reference: e
|
|
11527
11552
|
};
|
|
11528
11553
|
}
|
|
11529
|
-
function
|
|
11554
|
+
function Lh(e) {
|
|
11530
11555
|
let t = e.indices?.[0]?.[0] ?? e.index, n = /« ?(.*?) ?»/dg, r = [], i;
|
|
11531
11556
|
for (; (i = n.exec(e[0])) !== null;) {
|
|
11532
11557
|
let e = i.indices?.[1], n = i.indices?.[0];
|
|
@@ -11542,21 +11567,21 @@ function Fh(e) {
|
|
|
11542
11567
|
}
|
|
11543
11568
|
return r;
|
|
11544
11569
|
}
|
|
11545
|
-
var
|
|
11546
|
-
C(`${
|
|
11570
|
+
var Rh = x([
|
|
11571
|
+
C(`${Ph}s?`, { flags: "i" }),
|
|
11547
11572
|
C(" ?: ?"),
|
|
11548
11573
|
$
|
|
11549
|
-
], { value: (e) => e[2] }),
|
|
11550
|
-
C(`${
|
|
11574
|
+
], { value: (e) => e[2] }), zh = x([
|
|
11575
|
+
C(`${Fh}s?(?: suivant(?:e)?s?)?`, { flags: "i" }),
|
|
11551
11576
|
C(" ?: ?"),
|
|
11552
11577
|
$
|
|
11553
|
-
], { value: (e) => e[2] }),
|
|
11578
|
+
], { value: (e) => e[2] }), Bh = x([
|
|
11554
11579
|
b,
|
|
11555
|
-
|
|
11580
|
+
Rh,
|
|
11556
11581
|
S,
|
|
11557
11582
|
T(C("est remplacée? par", { flags: "i" }), C("sont remplacée?s par", { flags: "i" })),
|
|
11558
11583
|
S,
|
|
11559
|
-
|
|
11584
|
+
zh
|
|
11560
11585
|
], { value: (e) => ({
|
|
11561
11586
|
action: {
|
|
11562
11587
|
action: "remplacer",
|
|
@@ -11567,9 +11592,9 @@ var Ih = x([
|
|
|
11567
11592
|
replacementCitation: e[5],
|
|
11568
11593
|
targetCitation: e[1]
|
|
11569
11594
|
}
|
|
11570
|
-
}) }),
|
|
11595
|
+
}) }), Vh = T(C(`(?:, ?| )(?:${Ph}s? ?: ?« ?[^»]+ ?»(?: ?(?:,|et) ?)*)+(?:est|sont) (?:supprimée?s?|abrogée?s?)`, {
|
|
11571
11596
|
flags: "di",
|
|
11572
|
-
value: (e) =>
|
|
11597
|
+
value: (e) => Lh(e).map((e) => ({
|
|
11573
11598
|
action: {
|
|
11574
11599
|
action: "supprimer",
|
|
11575
11600
|
actionInContent: !0
|
|
@@ -11581,8 +11606,8 @@ var Ih = x([
|
|
|
11581
11606
|
}))
|
|
11582
11607
|
}), x([
|
|
11583
11608
|
b,
|
|
11584
|
-
|
|
11585
|
-
_([C("(?:, ?| et )"),
|
|
11609
|
+
Rh,
|
|
11610
|
+
_([C("(?:, ?| et )"), Rh], { value: (e) => e.map((e) => e[1]) }),
|
|
11586
11611
|
S,
|
|
11587
11612
|
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" }))
|
|
11588
11613
|
], { value: (e) => [e[1], ...e[2] ?? []].map((e) => ({
|
|
@@ -11594,9 +11619,9 @@ var Ih = x([
|
|
|
11594
11619
|
kind: "delete",
|
|
11595
11620
|
targetCitation: e
|
|
11596
11621
|
}
|
|
11597
|
-
})) })),
|
|
11622
|
+
})) })), Hh = T(x([
|
|
11598
11623
|
b,
|
|
11599
|
-
|
|
11624
|
+
qm,
|
|
11600
11625
|
S,
|
|
11601
11626
|
C("(?:la référence|la mention|le mot|les mots|le signe)", { flags: "i" }),
|
|
11602
11627
|
C(" ?: ?"),
|
|
@@ -11612,10 +11637,10 @@ var Ih = x([
|
|
|
11612
11637
|
},
|
|
11613
11638
|
operation: {
|
|
11614
11639
|
insertCitation: e[9],
|
|
11615
|
-
kind:
|
|
11640
|
+
kind: Ym(e[1]),
|
|
11616
11641
|
targetCitation: e[5]
|
|
11617
11642
|
}
|
|
11618
|
-
}) }),
|
|
11643
|
+
}) }), Bh, Vh, x([
|
|
11619
11644
|
b,
|
|
11620
11645
|
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" })),
|
|
11621
11646
|
C(" ?: ?"),
|
|
@@ -11630,27 +11655,27 @@ var Ih = x([
|
|
|
11630
11655
|
replacementCitation: e[3],
|
|
11631
11656
|
replacementKind: "text"
|
|
11632
11657
|
}
|
|
11633
|
-
}) })),
|
|
11658
|
+
}) })), Uh = T(Hh, x([C(" et"), Hh], { value: (e) => e[1] })), Wh = w(T(x([
|
|
11634
11659
|
S,
|
|
11635
11660
|
C("par", { flags: "i" }),
|
|
11636
11661
|
S,
|
|
11637
|
-
|
|
11662
|
+
zh
|
|
11638
11663
|
], { value: (e) => ({
|
|
11639
11664
|
citation: e[3],
|
|
11640
11665
|
kind: "replace"
|
|
11641
|
-
}) }), x([S,
|
|
11666
|
+
}) }), x([S, zh], { value: (e) => ({
|
|
11642
11667
|
citation: e[1],
|
|
11643
11668
|
kind: "insert"
|
|
11644
11669
|
}) })), { default: null });
|
|
11645
|
-
function
|
|
11670
|
+
function Gh(e) {
|
|
11646
11671
|
return typeof e == "object" && !!e && "action" in e && "operation" in e;
|
|
11647
11672
|
}
|
|
11648
|
-
function
|
|
11673
|
+
function Kh(e) {
|
|
11649
11674
|
let t = [];
|
|
11650
|
-
for (let n of e)
|
|
11675
|
+
for (let n of e) Gh(n) ? t.push(n) : Array.isArray(n) && t.push(...Kh(n));
|
|
11651
11676
|
return t;
|
|
11652
11677
|
}
|
|
11653
|
-
function
|
|
11678
|
+
function qh(e, t) {
|
|
11654
11679
|
if (!e) return [];
|
|
11655
11680
|
let n = e.originalCitations ?? [];
|
|
11656
11681
|
if (e.action === "remplacer") {
|
|
@@ -11698,12 +11723,12 @@ function Gh(e, t) {
|
|
|
11698
11723
|
}
|
|
11699
11724
|
return [];
|
|
11700
11725
|
}
|
|
11701
|
-
var
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
_(
|
|
11726
|
+
var Jh = 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([
|
|
11727
|
+
Lm,
|
|
11728
|
+
Wh,
|
|
11729
|
+
_(Uh, { value: (e) => Kh(e) })
|
|
11705
11730
|
], { value: (e, t) => {
|
|
11706
|
-
let { action: n, reference: r } =
|
|
11731
|
+
let { action: n, reference: r } = Ih(e[0]), i = [...qh(n, e[1]), ...e[2] ?? []], a = n ?? i[0]?.action;
|
|
11707
11732
|
if (!(!a || i.length === 0)) return {
|
|
11708
11733
|
action: a,
|
|
11709
11734
|
operations: i.map(({ operation: e }) => e),
|
|
@@ -11711,7 +11736,7 @@ var Kh = i("après|avant|remplacée?s?|supprimée?s?|abrogée?s?|ins[eé]r[eé]e
|
|
|
11711
11736
|
reference: r,
|
|
11712
11737
|
type: "action_directive"
|
|
11713
11738
|
};
|
|
11714
|
-
} }), 200),
|
|
11739
|
+
} }), 200), Yh = x([
|
|
11715
11740
|
C("la\\s+fin\\s+de\\s+", { flags: "i" }),
|
|
11716
11741
|
w(C("(?:la\\s+|l['’]\\s*)", { flags: "i" }), { default: "" }),
|
|
11717
11742
|
T(C("phrase", {
|
|
@@ -11728,14 +11753,14 @@ var Kh = i("après|avant|remplacée?s?|supprimée?s?|abrogée?s?|ins[eé]r[eé]e
|
|
|
11728
11753
|
type: "tail_after_target",
|
|
11729
11754
|
unit: e[2]
|
|
11730
11755
|
}) });
|
|
11731
|
-
function
|
|
11756
|
+
function Xh(e) {
|
|
11732
11757
|
if (e.type === "phrase") return "phrase";
|
|
11733
11758
|
if (e.type === "alinéa") return "alinéa";
|
|
11734
11759
|
if (e.type === "article") return "article";
|
|
11735
|
-
if (e.type === "parent-enfant") return
|
|
11760
|
+
if (e.type === "parent-enfant") return Xh(e.child);
|
|
11736
11761
|
}
|
|
11737
|
-
function
|
|
11738
|
-
let t =
|
|
11762
|
+
function Zh(e) {
|
|
11763
|
+
let t = $m(e);
|
|
11739
11764
|
if (!/\bla\s+fin\s+d/iu.test(t)) return null;
|
|
11740
11765
|
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;
|
|
11741
11766
|
return {
|
|
@@ -11745,10 +11770,10 @@ function Yh(e) {
|
|
|
11745
11770
|
}
|
|
11746
11771
|
//#endregion
|
|
11747
11772
|
//#region src/lib/text_parsers/action_occurrences.ts
|
|
11748
|
-
function
|
|
11773
|
+
function Qh(e) {
|
|
11749
11774
|
return e.replace(/\s+/gu, " ").trim().normalize("NFD").replace(/[\u0300-\u036f]/gu, "").replace(/[’‘]/gu, "'").toLowerCase();
|
|
11750
11775
|
}
|
|
11751
|
-
function
|
|
11776
|
+
function $h(e, t) {
|
|
11752
11777
|
let n = e.slice(0, Math.max(0, t)), r = RegExp(`\\b(${we})\\s+occurrence\\b`, "giu"), i = null, a;
|
|
11753
11778
|
for (; (a = r.exec(n)) !== null;) {
|
|
11754
11779
|
let e = be(a[1] ?? "");
|
|
@@ -11756,37 +11781,37 @@ function Zh(e, t) {
|
|
|
11756
11781
|
}
|
|
11757
11782
|
return i;
|
|
11758
11783
|
}
|
|
11759
|
-
function
|
|
11760
|
-
let t =
|
|
11761
|
-
return /\b(?:derniere\s+occurrence|a\s+la\s+fin)\b/u.test(t) ? "last" :
|
|
11784
|
+
function eg(e) {
|
|
11785
|
+
let t = Qh(e);
|
|
11786
|
+
return /\b(?:derniere\s+occurrence|a\s+la\s+fin)\b/u.test(t) ? "last" : $h(e, e.length) ?? void 0;
|
|
11762
11787
|
}
|
|
11763
11788
|
//#endregion
|
|
11764
11789
|
//#region src/lib/extractors/action_directives.ts
|
|
11765
|
-
var
|
|
11766
|
-
function
|
|
11790
|
+
var tg = "(?:(?: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))?)", ng = "(?:un|une|l['’]?|le|la)";
|
|
11791
|
+
function rg(e) {
|
|
11767
11792
|
return /\b(?:les?|la|l['’]?)\s+(?:mots?|references?|mentions?|signes?|nombres?|montants?|taux|pourcentages?|dates?|annees?)\b/u.test(e);
|
|
11768
11793
|
}
|
|
11769
|
-
function
|
|
11794
|
+
function ig(e) {
|
|
11770
11795
|
return /\b(?:une|la|les?)\s+phrases?\b/u.test(e);
|
|
11771
11796
|
}
|
|
11772
|
-
function
|
|
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${
|
|
11797
|
+
function ag(e) {
|
|
11798
|
+
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${ng}\s+${tg}\b`, "u").test(e) ? !0 : new RegExp(String.raw`\b${ng}\s+${tg}\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);
|
|
11774
11799
|
}
|
|
11775
|
-
function
|
|
11776
|
-
if (!
|
|
11800
|
+
function og({ hasRedactionIntro: e, insertText: t, normalized: n }) {
|
|
11801
|
+
if (!rg(n) && !ig(n) && (ag(n) && /\balinea\b/u.test(n) || e && yp(t))) return "block";
|
|
11777
11802
|
}
|
|
11778
|
-
function
|
|
11779
|
-
if (!
|
|
11803
|
+
function sg({ hasRedactionIntro: e, normalized: t, replacementText: n }) {
|
|
11804
|
+
if (!ig(t) && (e && /\balineas?\b/u.test(t) || e && yp(n))) return "block";
|
|
11780
11805
|
}
|
|
11781
|
-
function
|
|
11806
|
+
function cg(e) {
|
|
11782
11807
|
let t = bp(e);
|
|
11783
11808
|
return t ? t.restText : e;
|
|
11784
11809
|
}
|
|
11785
|
-
function
|
|
11786
|
-
let t =
|
|
11810
|
+
function lg(e) {
|
|
11811
|
+
let t = cg(e);
|
|
11787
11812
|
return t === e ? e.replace(gp, "") : t;
|
|
11788
11813
|
}
|
|
11789
|
-
function
|
|
11814
|
+
function ug(e) {
|
|
11790
11815
|
let t = e.split("\n"), n = [], r = 0;
|
|
11791
11816
|
for (let e of t) {
|
|
11792
11817
|
let t = r, i = t + e.length;
|
|
@@ -11798,10 +11823,10 @@ function cg(e) {
|
|
|
11798
11823
|
}
|
|
11799
11824
|
return n;
|
|
11800
11825
|
}
|
|
11801
|
-
function
|
|
11826
|
+
function dg(e) {
|
|
11802
11827
|
return bp(e) !== void 0 || gp.test(e);
|
|
11803
11828
|
}
|
|
11804
|
-
function
|
|
11829
|
+
function fg(e) {
|
|
11805
11830
|
if (gp.test(e)) return {
|
|
11806
11831
|
marker: "-",
|
|
11807
11832
|
level: 5
|
|
@@ -11809,87 +11834,87 @@ function ug(e) {
|
|
|
11809
11834
|
let t = bp(e);
|
|
11810
11835
|
return t ? {
|
|
11811
11836
|
marker: t.token,
|
|
11812
|
-
level:
|
|
11837
|
+
level: pg(t.token)
|
|
11813
11838
|
} : null;
|
|
11814
11839
|
}
|
|
11815
|
-
function
|
|
11840
|
+
function pg(e) {
|
|
11816
11841
|
let t = e.trim().split(/\s+/u)[0]?.replace(/[^\p{L}\p{N}]+/gu, "") ?? "";
|
|
11817
11842
|
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;
|
|
11818
11843
|
}
|
|
11819
|
-
function
|
|
11844
|
+
function mg(e) {
|
|
11820
11845
|
let t = [], n = e;
|
|
11821
11846
|
for (;;) {
|
|
11822
|
-
let e =
|
|
11847
|
+
let e = fg(n);
|
|
11823
11848
|
if (!e) return t;
|
|
11824
11849
|
t.push(e.marker);
|
|
11825
|
-
let r =
|
|
11850
|
+
let r = lg(n);
|
|
11826
11851
|
if (r === n) return t;
|
|
11827
11852
|
n = r.trimStart();
|
|
11828
11853
|
}
|
|
11829
11854
|
}
|
|
11830
|
-
function
|
|
11831
|
-
let t =
|
|
11855
|
+
function hg(e) {
|
|
11856
|
+
let t = $m(Eh(e, Th(e)));
|
|
11832
11857
|
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;
|
|
11833
11858
|
}
|
|
11834
|
-
function
|
|
11835
|
-
let t =
|
|
11859
|
+
function gg(e) {
|
|
11860
|
+
let t = hg(e);
|
|
11836
11861
|
if (t !== null) return t;
|
|
11837
11862
|
for (let t = 0; t < e.length; t += 1) {
|
|
11838
11863
|
let r = new n(e.slice(t));
|
|
11839
|
-
if (
|
|
11864
|
+
if (Em(r) && r.offset > 0) return t;
|
|
11840
11865
|
}
|
|
11841
11866
|
return null;
|
|
11842
11867
|
}
|
|
11843
|
-
function
|
|
11868
|
+
function _g(e) {
|
|
11844
11869
|
return e.type === "reference_et_action" ? e.reference : e;
|
|
11845
11870
|
}
|
|
11846
|
-
function
|
|
11847
|
-
return
|
|
11871
|
+
function vg(e) {
|
|
11872
|
+
return Wm(new n(e)).map(_g).find((e) => bt(e) === "article") || (D_(e)?.reference ?? null);
|
|
11848
11873
|
}
|
|
11849
|
-
function
|
|
11850
|
-
let t =
|
|
11874
|
+
function yg(e) {
|
|
11875
|
+
let t = gg(e) ?? e.length, r = Dh(e), i = Wm(new n(e)), a = i.flatMap((e) => Array.from(O(_g(e)))).filter((e) => e.type === "article" && e.position).map((e) => ({
|
|
11851
11876
|
start: e.position.start,
|
|
11852
11877
|
end: e.position.stop
|
|
11853
|
-
})), o = i.map(
|
|
11854
|
-
return u ?
|
|
11878
|
+
})), o = i.map(_g).filter((e) => !kh(e.position, r) && !Oh(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 = _h(d_(s), 0) ?? _h(s, 0) ?? _h(s.replace(/\b(?:est|sont)\s*$/iu, "").trimEnd(), 0), l = c && !Oh(c.position, a) ? c : null, u = o[0];
|
|
11879
|
+
return u ? bh(u, l) : l;
|
|
11855
11880
|
}
|
|
11856
|
-
function
|
|
11857
|
-
let t =
|
|
11881
|
+
function bg(e) {
|
|
11882
|
+
let t = gg(e) ?? e.length, r = Dh(e), i = Wm(new n(e)).map(_g).filter((e) => !kh(e.position, r) && (e.position?.start ?? 0) < t).sort((e, t) => (e.position?.start ?? 0) - (t.position?.start ?? 0));
|
|
11858
11883
|
return i.length === 0 ? null : i.find((e) => bt(e) !== "article") ?? null ?? i[0] ?? null;
|
|
11859
11884
|
}
|
|
11860
|
-
function
|
|
11861
|
-
let t = [e,
|
|
11885
|
+
function xg(e) {
|
|
11886
|
+
let t = [e, cg(e)].map((e) => e.trim()).filter((e, t, n) => e && n.indexOf(e) === t);
|
|
11862
11887
|
for (let e of t) {
|
|
11863
|
-
let t =
|
|
11888
|
+
let t = gg(e) ?? e.length, n = _h(e, 0) ?? Sh(e, { actionIndex: t }) ?? bg(e) ?? vg(e);
|
|
11864
11889
|
if (n) return n;
|
|
11865
11890
|
}
|
|
11866
11891
|
return null;
|
|
11867
11892
|
}
|
|
11868
|
-
function
|
|
11893
|
+
function Sg(e) {
|
|
11869
11894
|
return e?.toLowerCase().replace(/[.)]/g, "").trim();
|
|
11870
11895
|
}
|
|
11871
|
-
function
|
|
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 &&
|
|
11896
|
+
function Cg(e, t) {
|
|
11897
|
+
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 && Sg(e.num) !== Sg(t.num));
|
|
11873
11898
|
}
|
|
11874
|
-
function
|
|
11899
|
+
function wg(e) {
|
|
11875
11900
|
let t = null;
|
|
11876
11901
|
for (let n of O(e)) t = n;
|
|
11877
11902
|
return t;
|
|
11878
11903
|
}
|
|
11879
|
-
function
|
|
11880
|
-
return t && e.type === "parent-enfant" &&
|
|
11904
|
+
function Tg(e, t) {
|
|
11905
|
+
return t && e.type === "parent-enfant" && Cg(e.parent, t) ? e.child : e;
|
|
11881
11906
|
}
|
|
11882
|
-
function
|
|
11907
|
+
function Eg(e, t) {
|
|
11883
11908
|
let n = null;
|
|
11884
11909
|
for (let r of O(e)) r.type === t && r.relative === void 0 && (r.index === void 0 && r.num === void 0 || (n = r));
|
|
11885
11910
|
return n;
|
|
11886
11911
|
}
|
|
11887
|
-
function
|
|
11912
|
+
function Dg(e, t) {
|
|
11888
11913
|
if (!t) return e;
|
|
11889
11914
|
let n = structuredClone(e), r = (e) => {
|
|
11890
11915
|
if (e.type !== "parent-enfant" && e.type !== "bounded-interval" && e.type !== "counted-interval" && e.type !== "enumeration" && e.type !== "exclusion" && e.type !== "reference_et_action") {
|
|
11891
11916
|
if (e.relative === 0) {
|
|
11892
|
-
let n =
|
|
11917
|
+
let n = Eg(t, e.type);
|
|
11893
11918
|
n && (e.index = n.index, e.num = n.num, delete e.relative);
|
|
11894
11919
|
}
|
|
11895
11920
|
return;
|
|
@@ -11915,7 +11940,7 @@ function Tg(e, t) {
|
|
|
11915
11940
|
};
|
|
11916
11941
|
return r(n), n;
|
|
11917
11942
|
}
|
|
11918
|
-
function
|
|
11943
|
+
function Og(e) {
|
|
11919
11944
|
let t = (e) => {
|
|
11920
11945
|
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;
|
|
11921
11946
|
switch (e.type) {
|
|
@@ -11929,14 +11954,14 @@ function Eg(e) {
|
|
|
11929
11954
|
};
|
|
11930
11955
|
return t(e);
|
|
11931
11956
|
}
|
|
11932
|
-
function
|
|
11957
|
+
function kg(e) {
|
|
11933
11958
|
let t = [], n = [];
|
|
11934
11959
|
for (let r of e) {
|
|
11935
|
-
if (!
|
|
11960
|
+
if (!dg(r.text)) {
|
|
11936
11961
|
n[n.length - 1]?.body.push(r);
|
|
11937
11962
|
continue;
|
|
11938
11963
|
}
|
|
11939
|
-
let e =
|
|
11964
|
+
let e = fg(r.text), i = e?.level ?? 0, a = {
|
|
11940
11965
|
body: [],
|
|
11941
11966
|
children: [],
|
|
11942
11967
|
level: i,
|
|
@@ -11948,13 +11973,13 @@ function Dg(e) {
|
|
|
11948
11973
|
}
|
|
11949
11974
|
return t;
|
|
11950
11975
|
}
|
|
11951
|
-
function
|
|
11976
|
+
function Ag(e, t) {
|
|
11952
11977
|
if (!e) return t;
|
|
11953
11978
|
if (!t) return e;
|
|
11954
|
-
let n =
|
|
11979
|
+
let n = Tg(t, wg(e));
|
|
11955
11980
|
return n.type === "article" || bt(n), mt(e, n);
|
|
11956
11981
|
}
|
|
11957
|
-
function
|
|
11982
|
+
function jg(e, t) {
|
|
11958
11983
|
return {
|
|
11959
11984
|
...mt(e, t),
|
|
11960
11985
|
position: {
|
|
@@ -11963,16 +11988,16 @@ function kg(e, t) {
|
|
|
11963
11988
|
}
|
|
11964
11989
|
};
|
|
11965
11990
|
}
|
|
11966
|
-
function
|
|
11967
|
-
return [
|
|
11991
|
+
function Mg(e) {
|
|
11992
|
+
return [lg(e.line.text), ...e.body.map((e) => e.text)].join("\n").trim();
|
|
11968
11993
|
}
|
|
11969
|
-
function
|
|
11994
|
+
function Ng(e) {
|
|
11970
11995
|
return e.body[e.body.length - 1]?.end ?? e.line.end;
|
|
11971
11996
|
}
|
|
11972
|
-
function
|
|
11997
|
+
function Pg(e) {
|
|
11973
11998
|
return (e ?? "").replace(/°/gu, "").replace(/\s+/gu, " ").trim();
|
|
11974
11999
|
}
|
|
11975
|
-
function
|
|
12000
|
+
function Fg(e, t) {
|
|
11976
12001
|
let r = new n(e, t), i = te(r);
|
|
11977
12002
|
return typeof i == "string" && r.offset > t ? {
|
|
11978
12003
|
date: i,
|
|
@@ -11980,14 +12005,14 @@ function Ng(e, t) {
|
|
|
11980
12005
|
stop: r.offset
|
|
11981
12006
|
} : null;
|
|
11982
12007
|
}
|
|
11983
|
-
function
|
|
11984
|
-
let t =
|
|
12008
|
+
function Ig(e) {
|
|
12009
|
+
let t = Dh(e), n = [];
|
|
11985
12010
|
for (let r = 0; r < e.length; r += 1) {
|
|
11986
12011
|
let i = e[r];
|
|
11987
12012
|
if (i === void 0 || !/\d/u.test(i)) continue;
|
|
11988
|
-
let a =
|
|
12013
|
+
let a = Fg(e, r);
|
|
11989
12014
|
if (a) {
|
|
11990
|
-
if (
|
|
12015
|
+
if (Oh(a, t)) {
|
|
11991
12016
|
r = Math.max(r, a.stop - 1);
|
|
11992
12017
|
continue;
|
|
11993
12018
|
}
|
|
@@ -11996,25 +12021,25 @@ function Pg(e) {
|
|
|
11996
12021
|
}
|
|
11997
12022
|
return n;
|
|
11998
12023
|
}
|
|
11999
|
-
function
|
|
12000
|
-
return
|
|
12024
|
+
function Lg(e) {
|
|
12025
|
+
return $m(e).replace(/\s+/gu, " ");
|
|
12001
12026
|
}
|
|
12002
|
-
function
|
|
12003
|
-
let t =
|
|
12027
|
+
function Rg(e) {
|
|
12028
|
+
let t = Lg(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;
|
|
12004
12029
|
for (; (i = n.exec(t)) !== null;) r = i;
|
|
12005
12030
|
return r;
|
|
12006
12031
|
}
|
|
12007
|
-
function
|
|
12008
|
-
let n =
|
|
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) ||
|
|
12032
|
+
function zg(e, t) {
|
|
12033
|
+
let n = Lg(e.slice(0, t.start)), r = Lg(e.slice(t.stop));
|
|
12034
|
+
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) || Rg(e.slice(0, t.start)));
|
|
12010
12035
|
}
|
|
12011
|
-
function
|
|
12012
|
-
return
|
|
12036
|
+
function Bg(e) {
|
|
12037
|
+
return Ig(e).find((t) => zg(e, t))?.date;
|
|
12013
12038
|
}
|
|
12014
|
-
function
|
|
12015
|
-
return e.map((e) =>
|
|
12039
|
+
function Vg(e) {
|
|
12040
|
+
return e.map((e) => Pg(e.num)).filter((e) => e.length > 0);
|
|
12016
12041
|
}
|
|
12017
|
-
function
|
|
12042
|
+
function Hg(e, t) {
|
|
12018
12043
|
let n = e.at(-1), r = t.at(-1);
|
|
12019
12044
|
if (!n || !r) return [e, t];
|
|
12020
12045
|
let i = e.slice(0, -1), a = t.slice(0, -1);
|
|
@@ -12025,51 +12050,51 @@ function Bg(e, t) {
|
|
|
12025
12050
|
for (let e = o; e <= s; e += 1) c.push([...i, String(e)]);
|
|
12026
12051
|
return c;
|
|
12027
12052
|
}
|
|
12028
|
-
function
|
|
12053
|
+
function Ug(e) {
|
|
12029
12054
|
if (e.kind === "single") {
|
|
12030
|
-
let t =
|
|
12055
|
+
let t = Vg(e.steps);
|
|
12031
12056
|
return t.length > 0 ? [t] : [];
|
|
12032
12057
|
}
|
|
12033
|
-
let t =
|
|
12034
|
-
return t.length === 0 && n.length === 0 ? [] :
|
|
12058
|
+
let t = Vg(e.first), n = Vg(e.last);
|
|
12059
|
+
return t.length === 0 && n.length === 0 ? [] : Hg(t, n);
|
|
12035
12060
|
}
|
|
12036
|
-
function
|
|
12037
|
-
let t =
|
|
12038
|
-
for (let e of t.map(
|
|
12061
|
+
function Wg(e) {
|
|
12062
|
+
let t = Wm(new n(e)), r = [];
|
|
12063
|
+
for (let e of t.map(_g)) {
|
|
12039
12064
|
if (e.type === "article" && e.present) {
|
|
12040
12065
|
r.push([]);
|
|
12041
12066
|
continue;
|
|
12042
12067
|
}
|
|
12043
|
-
for (let t of Rp(e)) r.push(...
|
|
12068
|
+
for (let t of Rp(e)) r.push(...Ug(t));
|
|
12044
12069
|
}
|
|
12045
12070
|
return r.filter((e, t, n) => n.findIndex((t) => t.join("\0") === e.join("\0")) === t);
|
|
12046
12071
|
}
|
|
12047
|
-
function
|
|
12072
|
+
function Gg(e) {
|
|
12048
12073
|
let t = [], n = e.split(/(?<=[.;])\s+/u).map((e) => e.trim()).filter(Boolean);
|
|
12049
|
-
for (let e of n) for (let n of
|
|
12050
|
-
if (!
|
|
12051
|
-
let r =
|
|
12074
|
+
for (let e of n) for (let n of Ig(e)) {
|
|
12075
|
+
if (!zg(e, n)) continue;
|
|
12076
|
+
let r = Rg(e.slice(0, n.start));
|
|
12052
12077
|
if (!r) continue;
|
|
12053
|
-
let i =
|
|
12078
|
+
let i = Wg(e.slice(0, r.index).trim());
|
|
12054
12079
|
if (i.length === 0) continue;
|
|
12055
12080
|
t.push({
|
|
12056
12081
|
date: n.date,
|
|
12057
12082
|
paths: i
|
|
12058
12083
|
});
|
|
12059
|
-
let a =
|
|
12084
|
+
let a = Kg(e.slice(n.stop), i);
|
|
12060
12085
|
t.push(...a);
|
|
12061
12086
|
}
|
|
12062
12087
|
return t;
|
|
12063
12088
|
}
|
|
12064
|
-
function
|
|
12089
|
+
function Kg(e, t) {
|
|
12065
12090
|
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);
|
|
12066
12091
|
if (!n) return [];
|
|
12067
12092
|
let r = n.index + n[0].length, i = n[1]?.trim();
|
|
12068
12093
|
if (!i) return [];
|
|
12069
|
-
let a =
|
|
12094
|
+
let a = Wg(i);
|
|
12070
12095
|
if (a.length === 0) return [];
|
|
12071
12096
|
let o = [];
|
|
12072
|
-
for (let n of
|
|
12097
|
+
for (let n of Ig(e.slice(r))) {
|
|
12073
12098
|
let e = n.date;
|
|
12074
12099
|
o.push({
|
|
12075
12100
|
date: e,
|
|
@@ -12080,44 +12105,44 @@ function Wg(e, t) {
|
|
|
12080
12105
|
}
|
|
12081
12106
|
return o;
|
|
12082
12107
|
}
|
|
12083
|
-
function
|
|
12108
|
+
function qg(e, t, n) {
|
|
12084
12109
|
return [
|
|
12085
12110
|
...e,
|
|
12086
|
-
|
|
12087
|
-
...
|
|
12111
|
+
Pg(t.marker),
|
|
12112
|
+
...mg(n).map(Pg)
|
|
12088
12113
|
].filter((e) => e.length > 0);
|
|
12089
12114
|
}
|
|
12090
|
-
function
|
|
12115
|
+
function Jg(e) {
|
|
12091
12116
|
let t = [];
|
|
12092
|
-
for (let n of e) t.push(...
|
|
12117
|
+
for (let n of e) t.push(...Gg(Mg(n))), t.push(...Jg(n.children));
|
|
12093
12118
|
return t;
|
|
12094
12119
|
}
|
|
12095
|
-
function
|
|
12120
|
+
function Yg(e, t) {
|
|
12096
12121
|
return t.length > e.length ? !1 : t.every((t, n) => e[n] === t);
|
|
12097
12122
|
}
|
|
12098
|
-
function
|
|
12123
|
+
function Xg(e, t) {
|
|
12099
12124
|
if (t.length > e.length) return !1;
|
|
12100
12125
|
let n = e.length - t.length;
|
|
12101
12126
|
return t.every((t, r) => e[n + r] === t);
|
|
12102
12127
|
}
|
|
12103
|
-
function
|
|
12104
|
-
return n ? n.some((n) =>
|
|
12128
|
+
function Zg(e, t, n) {
|
|
12129
|
+
return n ? n.some((n) => Zg(e, n) ? Zg(e, Yg(e, n) ? [...n, ...t] : t) : !1) : t.length === 0 ? !0 : Yg(e, t) || Xg(e, t);
|
|
12105
12130
|
}
|
|
12106
|
-
function
|
|
12131
|
+
function Qg(e, t, n) {
|
|
12107
12132
|
if (e.length === 0 || n.length === 0) return;
|
|
12108
12133
|
let r = new Map(t.map((e) => [e.directive, e.sourcePath]));
|
|
12109
12134
|
for (let t of e) {
|
|
12110
12135
|
if (t.applicabilityDate) continue;
|
|
12111
12136
|
let e = r.get(t) ?? [], i, a = -1;
|
|
12112
12137
|
for (let t of n) for (let n of t.paths) {
|
|
12113
|
-
if (!
|
|
12138
|
+
if (!Zg(e, n, t.parentPaths)) continue;
|
|
12114
12139
|
let r = n.length + Math.max(0, ...t.parentPaths?.map((e) => e.length) ?? [0]);
|
|
12115
12140
|
r > a && (i = t.date, a = r);
|
|
12116
12141
|
}
|
|
12117
12142
|
i && (t.applicabilityDate = i);
|
|
12118
12143
|
}
|
|
12119
12144
|
}
|
|
12120
|
-
function
|
|
12145
|
+
function $g(e, t) {
|
|
12121
12146
|
if (!e) return t;
|
|
12122
12147
|
if (!t) return e;
|
|
12123
12148
|
let n = t.rowIndex ?? e.rowIndex, r = t.columnIndex ?? e.columnIndex;
|
|
@@ -12127,39 +12152,39 @@ function Zg(e, t) {
|
|
|
12127
12152
|
...r ? { columnIndex: r } : {}
|
|
12128
12153
|
};
|
|
12129
12154
|
}
|
|
12130
|
-
function
|
|
12155
|
+
function e_(e) {
|
|
12131
12156
|
return e !== void 0 && (e.rowIndex !== void 0 || e.columnIndex !== void 0);
|
|
12132
12157
|
}
|
|
12133
|
-
function
|
|
12158
|
+
function t_(e, t, n, r, i = [], a = []) {
|
|
12134
12159
|
let o = [], s = t;
|
|
12135
12160
|
for (let c of e) {
|
|
12136
|
-
let e =
|
|
12161
|
+
let e = lg(c.line.text), l = qg(i, c, e), u = Mg(c);
|
|
12137
12162
|
if (!u) continue;
|
|
12138
|
-
let d =
|
|
12139
|
-
if (
|
|
12163
|
+
let d = $g(r, u_(u, r !== void 0)), f = xg(e), p = Ag(t, f);
|
|
12164
|
+
if (gg(u) === null) {
|
|
12140
12165
|
if (c.children.length > 0) {
|
|
12141
|
-
let e = p ?? t, r =
|
|
12166
|
+
let e = p ?? t, r = t_(c.children, e, n, d, l, a);
|
|
12142
12167
|
r.length > 0 && (o.push(...r), s = r[r.length - 1]?.reference ?? s);
|
|
12143
12168
|
continue;
|
|
12144
12169
|
}
|
|
12145
12170
|
s = p ?? s;
|
|
12146
12171
|
continue;
|
|
12147
12172
|
}
|
|
12148
|
-
let m =
|
|
12173
|
+
let m = vg(u), h = Ag(t, yg(u) ?? m ?? f) ?? m ?? p;
|
|
12149
12174
|
if (!h) {
|
|
12150
12175
|
if (c.children.length > 0) {
|
|
12151
|
-
let e =
|
|
12176
|
+
let e = t_(c.children, p ?? t, n, d, l, a);
|
|
12152
12177
|
o.push(...e);
|
|
12153
12178
|
}
|
|
12154
12179
|
continue;
|
|
12155
12180
|
}
|
|
12156
|
-
h =
|
|
12157
|
-
let g =
|
|
12181
|
+
h = Dg(h, Og(h) ? s ?? t : t);
|
|
12182
|
+
let g = E_({
|
|
12158
12183
|
action: { action: "modifier" },
|
|
12159
12184
|
reference: h,
|
|
12160
12185
|
sourcePosition: {
|
|
12161
12186
|
start: c.line.start,
|
|
12162
|
-
stop:
|
|
12187
|
+
stop: Ng(c)
|
|
12163
12188
|
},
|
|
12164
12189
|
sourceText: u,
|
|
12165
12190
|
fullText: n,
|
|
@@ -12167,7 +12192,7 @@ function $g(e, t, n, r, i = [], a = []) {
|
|
|
12167
12192
|
});
|
|
12168
12193
|
if (!g) {
|
|
12169
12194
|
if (s = h, c.children.length > 0) {
|
|
12170
|
-
let e =
|
|
12195
|
+
let e = t_(c.children, p ?? h, n, d, l, a);
|
|
12171
12196
|
o.push(...e), s = e[e.length - 1]?.reference ?? s;
|
|
12172
12197
|
}
|
|
12173
12198
|
continue;
|
|
@@ -12183,19 +12208,19 @@ function $g(e, t, n, r, i = [], a = []) {
|
|
|
12183
12208
|
sourcePath: l
|
|
12184
12209
|
});
|
|
12185
12210
|
if (s = h, c.children.length > 0) {
|
|
12186
|
-
let e =
|
|
12211
|
+
let e = t_(c.children, p ?? h, n, d, l, a);
|
|
12187
12212
|
e.length > 0 && (o.push(...e), s = e[e.length - 1]?.reference ?? s);
|
|
12188
12213
|
}
|
|
12189
12214
|
}
|
|
12190
|
-
return
|
|
12215
|
+
return T_(o);
|
|
12191
12216
|
}
|
|
12192
|
-
function
|
|
12193
|
-
let t =
|
|
12217
|
+
function n_(e) {
|
|
12218
|
+
let t = ug(e), n = t.findIndex((e) => dg(e.text));
|
|
12194
12219
|
if (n === -1) return null;
|
|
12195
|
-
let r = t.slice(0, n).reverse().map((e) =>
|
|
12196
|
-
return
|
|
12220
|
+
let r = t.slice(0, n).reverse().map((e) => xg(e.text)).find((e) => e !== null) ?? null, i = kg(t.slice(n)), a = [], o = t_(i, r, e, void 0, [], a);
|
|
12221
|
+
return Qg(o, a, Jg(i)), o.length > 0 ? o : null;
|
|
12197
12222
|
}
|
|
12198
|
-
function
|
|
12223
|
+
function r_(e, t) {
|
|
12199
12224
|
let n = e.indexOf("«");
|
|
12200
12225
|
if (n === -1) return;
|
|
12201
12226
|
let r = e.indexOf("»", n + 1);
|
|
@@ -12210,40 +12235,40 @@ function t_(e, t) {
|
|
|
12210
12235
|
}
|
|
12211
12236
|
};
|
|
12212
12237
|
}
|
|
12213
|
-
function
|
|
12214
|
-
let t =
|
|
12238
|
+
function i_(e) {
|
|
12239
|
+
let t = $m(e);
|
|
12215
12240
|
return /\btableau\b/.test(t) && /\b(?:tableau|celui)\s+(?:suivant|ainsi\s+redigee?|ainsi\s+rediges|ainsi\s+redigees)\b/.test(t);
|
|
12216
12241
|
}
|
|
12217
|
-
function
|
|
12218
|
-
for (let t of
|
|
12219
|
-
if (!
|
|
12242
|
+
function a_(e) {
|
|
12243
|
+
for (let t of ug(e)) {
|
|
12244
|
+
if (!i_(t.text)) continue;
|
|
12220
12245
|
let e = t.text.indexOf(":");
|
|
12221
12246
|
return e === -1 ? t.end : t.start + e + 1;
|
|
12222
12247
|
}
|
|
12223
12248
|
return null;
|
|
12224
12249
|
}
|
|
12225
|
-
function
|
|
12226
|
-
let n =
|
|
12227
|
-
return n === null ?
|
|
12250
|
+
function o_(e, t) {
|
|
12251
|
+
let n = a_(e);
|
|
12252
|
+
return n === null ? r_(e, t) : r_(e.slice(n), t + n);
|
|
12228
12253
|
}
|
|
12229
|
-
function
|
|
12230
|
-
return
|
|
12254
|
+
function s_(e, t) {
|
|
12255
|
+
return $h(e, t);
|
|
12231
12256
|
}
|
|
12232
|
-
function
|
|
12233
|
-
let n =
|
|
12257
|
+
function c_(e, t) {
|
|
12258
|
+
let n = Sm(e, t);
|
|
12234
12259
|
return n && n > 1 ? n : void 0;
|
|
12235
12260
|
}
|
|
12236
|
-
function
|
|
12261
|
+
function l_(e, t) {
|
|
12237
12262
|
if (!Array.isArray(e) || e.length < 2 || t.length < e.length) return e;
|
|
12238
12263
|
let n = e[0];
|
|
12239
12264
|
return e.some((e) => JSON.stringify(e) !== JSON.stringify(n)) ? e : n;
|
|
12240
12265
|
}
|
|
12241
|
-
function
|
|
12242
|
-
let n =
|
|
12266
|
+
function u_(e, t = !1) {
|
|
12267
|
+
let n = Eh(e, Th(e)), r = $m(n), i = /\btableau\b/.test(r);
|
|
12243
12268
|
if (!i && !t) return;
|
|
12244
12269
|
let a = (e) => {
|
|
12245
12270
|
if (!e) return;
|
|
12246
|
-
let t = e.replace(/^(?:a|à)\s+la\s+/iu, "").trim(), n =
|
|
12271
|
+
let t = e.replace(/^(?:a|à)\s+la\s+/iu, "").trim(), n = $m(t);
|
|
12247
12272
|
if (/^derni(?:er|ere)s?\b/u.test(n)) return -1;
|
|
12248
12273
|
let r = be(t);
|
|
12249
12274
|
return r && r > 0 ? r : void 0;
|
|
@@ -12264,30 +12289,30 @@ function c_(e, t = !1) {
|
|
|
12264
12289
|
let l = /\bla\s+(.+?)\s+ligne\b/iu.exec(n), u = /\bla\s+(.+?)\s+colonne\b/iu.exec(n);
|
|
12265
12290
|
return o(a(l?.[1]), a(u?.[1])) || (i ? { type: "table" } : void 0);
|
|
12266
12291
|
}
|
|
12267
|
-
function
|
|
12292
|
+
function d_(e) {
|
|
12268
12293
|
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();
|
|
12269
12294
|
}
|
|
12270
|
-
function
|
|
12295
|
+
function f_(e) {
|
|
12271
12296
|
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();
|
|
12272
12297
|
}
|
|
12273
|
-
var
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12298
|
+
var p_ = [
|
|
12299
|
+
m_("(?:la\\s+date\\s+d(?:u|e|[’']))"),
|
|
12300
|
+
m_("(?:le\\s+montant\\s+d(?:e|[’']))"),
|
|
12301
|
+
m_("(?:la\\s+référence\\s+à)")
|
|
12277
12302
|
];
|
|
12278
|
-
function
|
|
12303
|
+
function m_(e) {
|
|
12279
12304
|
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");
|
|
12280
12305
|
}
|
|
12281
|
-
function
|
|
12306
|
+
function h_(e) {
|
|
12282
12307
|
return e.replace(/\s+/gu, " ").replace(/\s+([,;])/gu, "$1").trim();
|
|
12283
12308
|
}
|
|
12284
|
-
function
|
|
12309
|
+
function g_(e) {
|
|
12285
12310
|
if (e.includes("«") || e.includes("»")) return null;
|
|
12286
|
-
for (let t of
|
|
12311
|
+
for (let t of p_) {
|
|
12287
12312
|
let n = t.exec(e), r = n?.groups?.target, i = n?.groups?.replacement;
|
|
12288
12313
|
if (!(!r || !i)) return {
|
|
12289
|
-
targetText:
|
|
12290
|
-
replacementText:
|
|
12314
|
+
targetText: h_(r),
|
|
12315
|
+
replacementText: h_(i),
|
|
12291
12316
|
operandRange: {
|
|
12292
12317
|
start: n.index,
|
|
12293
12318
|
end: n.index + n[0].length
|
|
@@ -12296,22 +12321,22 @@ function m_(e) {
|
|
|
12296
12321
|
}
|
|
12297
12322
|
return null;
|
|
12298
12323
|
}
|
|
12299
|
-
function
|
|
12300
|
-
let t =
|
|
12324
|
+
function __(e) {
|
|
12325
|
+
let t = g_(e);
|
|
12301
12326
|
return t ? [t.operandRange] : [];
|
|
12302
12327
|
}
|
|
12303
|
-
function
|
|
12304
|
-
return
|
|
12328
|
+
function v_(e, t) {
|
|
12329
|
+
return Oh(e.position, t) ? !0 : Array.from(O(_g(e))).some((e) => Oh(e.position, t));
|
|
12305
12330
|
}
|
|
12306
|
-
function
|
|
12307
|
-
let o =
|
|
12331
|
+
function y_(e, t, n, r, i, a) {
|
|
12332
|
+
let o = $m(e), s = $m(Eh(e, i)), c = eh(s, o), l = th(s), u = nh(s), d = n.action === "rétablir" || rh(s), f = ih(s) || d, p = ah(s), m = oh(s), h = i_(e), g = u ? "insert_before" : "insert_after", _ = l ? Zh(s) : null, v = p ? _ : null, y = m ? _ : null, ee = () => {
|
|
12308
12333
|
let n = i[0]?.start;
|
|
12309
|
-
return (n === void 0 ? void 0 :
|
|
12334
|
+
return (n === void 0 ? void 0 : c_(t, n)) ?? xm(e) ?? void 0;
|
|
12310
12335
|
}, te = () => {
|
|
12311
12336
|
let e = i[0]?.start;
|
|
12312
|
-
return (e === void 0 ? void 0 :
|
|
12337
|
+
return (e === void 0 ? void 0 : s_(t, e)) ?? void 0;
|
|
12313
12338
|
}, ne = ({ kind: e, targetText: t, insertText: n, expectsFollowingTable: r }) => {
|
|
12314
|
-
let i =
|
|
12339
|
+
let i = og({
|
|
12315
12340
|
hasRedactionIntro: c,
|
|
12316
12341
|
insertText: n,
|
|
12317
12342
|
normalized: o
|
|
@@ -12418,7 +12443,7 @@ function __(e, t, n, r, i, a) {
|
|
|
12418
12443
|
replacement: { type: "following_table" }
|
|
12419
12444
|
};
|
|
12420
12445
|
if (p && !f && !m && a.length === 0) {
|
|
12421
|
-
let t =
|
|
12446
|
+
let t = g_(e);
|
|
12422
12447
|
if (t) return {
|
|
12423
12448
|
kind: "replace",
|
|
12424
12449
|
targetText: t.targetText,
|
|
@@ -12444,7 +12469,7 @@ function __(e, t, n, r, i, a) {
|
|
|
12444
12469
|
targetScope: _
|
|
12445
12470
|
};
|
|
12446
12471
|
if (!f && a.length === 1 && c) {
|
|
12447
|
-
let e =
|
|
12472
|
+
let e = sg({
|
|
12448
12473
|
hasRedactionIntro: c,
|
|
12449
12474
|
normalized: o,
|
|
12450
12475
|
replacementText: a[0]
|
|
@@ -12500,11 +12525,11 @@ function __(e, t, n, r, i, a) {
|
|
|
12500
12525
|
expectsFollowingTable: h
|
|
12501
12526
|
}) : null;
|
|
12502
12527
|
}
|
|
12503
|
-
function
|
|
12504
|
-
let t =
|
|
12528
|
+
function b_(e) {
|
|
12529
|
+
let t = $m(e);
|
|
12505
12530
|
return /\bapres\b/.test(t) && /\bla\s+fin\s+(?:(?:de\s+l['’]?)|d['’]?|de|du|des)?\s*$/u.test(t);
|
|
12506
12531
|
}
|
|
12507
|
-
function
|
|
12532
|
+
function x_(e) {
|
|
12508
12533
|
switch (e.kind) {
|
|
12509
12534
|
case "insert_after":
|
|
12510
12535
|
case "insert_before": return {
|
|
@@ -12548,7 +12573,7 @@ function y_(e) {
|
|
|
12548
12573
|
case "delete_article": return { kind: "delete_article" };
|
|
12549
12574
|
}
|
|
12550
12575
|
}
|
|
12551
|
-
function
|
|
12576
|
+
function S_(e) {
|
|
12552
12577
|
let t = (t) => {
|
|
12553
12578
|
let n = e[t];
|
|
12554
12579
|
return typeof n == "string" ? n : "";
|
|
@@ -12565,7 +12590,7 @@ function b_(e) {
|
|
|
12565
12590
|
o
|
|
12566
12591
|
].join("|");
|
|
12567
12592
|
}
|
|
12568
|
-
function
|
|
12593
|
+
function C_(e, t, n) {
|
|
12569
12594
|
return t.targetType === n.targetType && JSON.stringify(t.reference) === JSON.stringify(n.reference) && JSON.stringify(t.portionSelectors) === JSON.stringify(n.portionSelectors) ? e : {
|
|
12570
12595
|
...e,
|
|
12571
12596
|
targetType: t.targetType,
|
|
@@ -12573,10 +12598,10 @@ function x_(e, t, n) {
|
|
|
12573
12598
|
portionSelectors: t.portionSelectors
|
|
12574
12599
|
};
|
|
12575
12600
|
}
|
|
12576
|
-
function
|
|
12577
|
-
return (e.kind === "compound" ? e.operations : [
|
|
12601
|
+
function w_(e, t) {
|
|
12602
|
+
return (e.kind === "compound" ? e.operations : [x_(e)]).map((n) => C_(n, e, t));
|
|
12578
12603
|
}
|
|
12579
|
-
function
|
|
12604
|
+
function T_(e) {
|
|
12580
12605
|
let t = [];
|
|
12581
12606
|
for (let n = 0; n < e.length; n += 1) {
|
|
12582
12607
|
let r = e[n];
|
|
@@ -12591,14 +12616,14 @@ function C_(e) {
|
|
|
12591
12616
|
continue;
|
|
12592
12617
|
}
|
|
12593
12618
|
let o = i[0], s = [];
|
|
12594
|
-
for (let [e, t] of i.entries()) for (let [n, r] of
|
|
12619
|
+
for (let [e, t] of i.entries()) for (let [n, r] of w_(t, o).entries()) s.push({
|
|
12595
12620
|
directiveIndex: e,
|
|
12596
12621
|
operationIndex: n,
|
|
12597
12622
|
operation: r
|
|
12598
12623
|
});
|
|
12599
12624
|
let c = /* @__PURE__ */ new Set(), l = [];
|
|
12600
12625
|
for (let e = s.length - 1; e >= 0; --e) {
|
|
12601
|
-
let t = s[e], n =
|
|
12626
|
+
let t = s[e], n = S_(t.operation);
|
|
12602
12627
|
c.has(n) || (c.add(n), l.push(t));
|
|
12603
12628
|
}
|
|
12604
12629
|
l.sort((e, t) => e.directiveIndex - t.directiveIndex || e.operationIndex - t.operationIndex), t.push({
|
|
@@ -12617,14 +12642,14 @@ function C_(e) {
|
|
|
12617
12642
|
}
|
|
12618
12643
|
return t;
|
|
12619
12644
|
}
|
|
12620
|
-
function
|
|
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 && !
|
|
12645
|
+
function E_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullText: i, tableTarget: a }) {
|
|
12646
|
+
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 && !b_(r.slice(0, n.start)) ? r.slice(n.start) : r, d = Th(u), f = y_(r, u, e, o, d, d.map((e) => e.text));
|
|
12622
12647
|
if (!f) return null;
|
|
12623
|
-
let p =
|
|
12648
|
+
let p = l_(f, s), m = Bg(r), h = {
|
|
12624
12649
|
...m ? { applicabilityDate: m } : {},
|
|
12625
12650
|
sourcePosition: n,
|
|
12626
12651
|
sourceText: r
|
|
12627
|
-
}, g =
|
|
12652
|
+
}, g = o_(c, l), _ = (e) => {
|
|
12628
12653
|
switch (e.kind) {
|
|
12629
12654
|
case "insert_after":
|
|
12630
12655
|
case "insert_before": return {
|
|
@@ -12686,7 +12711,7 @@ function w_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12686
12711
|
insertText: e.insertText,
|
|
12687
12712
|
...e.insertLayout ? { insertLayout: e.insertLayout } : {},
|
|
12688
12713
|
...e.expectsFollowingTable && g ? { citation: g } : {},
|
|
12689
|
-
...
|
|
12714
|
+
...e_(a) ? { tableTarget: a } : {},
|
|
12690
12715
|
...h
|
|
12691
12716
|
};
|
|
12692
12717
|
case "replace": return {
|
|
@@ -12703,7 +12728,7 @@ function w_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12703
12728
|
...e.occurrenceIndex === void 0 ? {} : { occurrenceIndex: e.occurrenceIndex },
|
|
12704
12729
|
...e.targetOccurrenceCount === void 0 ? {} : { targetOccurrenceCount: e.targetOccurrenceCount },
|
|
12705
12730
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12706
|
-
...
|
|
12731
|
+
...e_(a) ? { tableTarget: a } : {},
|
|
12707
12732
|
...h
|
|
12708
12733
|
};
|
|
12709
12734
|
case "replace_portion": return e.replacement.type === "following_table" && !g ? null : {
|
|
@@ -12715,11 +12740,11 @@ function w_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12715
12740
|
replacement: e.replacement,
|
|
12716
12741
|
...e.replacementLayout ? { replacementLayout: e.replacementLayout } : {},
|
|
12717
12742
|
...e.replacement.type === "following_table" && g ? { citation: g } : {},
|
|
12718
|
-
...
|
|
12743
|
+
...e_(a) ? { tableTarget: a } : {},
|
|
12719
12744
|
...h
|
|
12720
12745
|
};
|
|
12721
12746
|
case "delete": {
|
|
12722
|
-
let n = d.map((e) =>
|
|
12747
|
+
let n = d.map((e) => s_(u, e.start)), r = /* @__PURE__ */ new Map();
|
|
12723
12748
|
for (let [e, t] of d.entries()) r.has(t.text) || r.set(t.text, n[e] ?? null);
|
|
12724
12749
|
let i = [e.targetText, ...e.extraTargetTexts ?? []].filter((e) => e && e.trim().length > 0).filter((e, t, n) => n.indexOf(e) === t);
|
|
12725
12750
|
return i.length > 1 ? v(i.map((t) => ({
|
|
@@ -12728,7 +12753,7 @@ function w_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12728
12753
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12729
12754
|
occurrenceIndex: r.get(t) ?? void 0,
|
|
12730
12755
|
...t === e.targetText && e.targetOccurrenceCount !== void 0 ? { targetOccurrenceCount: e.targetOccurrenceCount } : {},
|
|
12731
|
-
...
|
|
12756
|
+
...e_(a) ? { tableTarget: a } : {}
|
|
12732
12757
|
}))) : {
|
|
12733
12758
|
kind: "delete",
|
|
12734
12759
|
targetType: o,
|
|
@@ -12738,7 +12763,7 @@ function w_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12738
12763
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12739
12764
|
occurrenceIndex: r.get(e.targetText) ?? void 0,
|
|
12740
12765
|
...e.targetOccurrenceCount === void 0 ? {} : { targetOccurrenceCount: e.targetOccurrenceCount },
|
|
12741
|
-
...
|
|
12766
|
+
...e_(a) ? { tableTarget: a } : {},
|
|
12742
12767
|
...h
|
|
12743
12768
|
};
|
|
12744
12769
|
}
|
|
@@ -12747,7 +12772,7 @@ function w_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12747
12772
|
targetType: o,
|
|
12748
12773
|
reference: t,
|
|
12749
12774
|
portionSelectors: s,
|
|
12750
|
-
...
|
|
12775
|
+
...e_(a) ? { tableTarget: a } : {},
|
|
12751
12776
|
...h
|
|
12752
12777
|
};
|
|
12753
12778
|
case "delete_article": return o === "article" ? {
|
|
@@ -12771,7 +12796,7 @@ function w_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12771
12796
|
}
|
|
12772
12797
|
return y(p);
|
|
12773
12798
|
}
|
|
12774
|
-
function
|
|
12799
|
+
function D_(e) {
|
|
12775
12800
|
let t = /\barticle\s+([0-9]+(?:-[0-9]+)?(?:\s*[A-Z])?(?:\s+[a-z]+)?)\b/i.exec(e);
|
|
12776
12801
|
if (!t || t.index === void 0) return null;
|
|
12777
12802
|
let n = t.index, r = t.index + t[0].length;
|
|
@@ -12790,57 +12815,57 @@ function T_(e) {
|
|
|
12790
12815
|
}
|
|
12791
12816
|
};
|
|
12792
12817
|
}
|
|
12793
|
-
function
|
|
12818
|
+
function O_(e, t) {
|
|
12794
12819
|
let i = r(e).output;
|
|
12795
12820
|
if (t.allowListExtraction) {
|
|
12796
|
-
let e =
|
|
12821
|
+
let e = n_(i);
|
|
12797
12822
|
if (e) return e;
|
|
12798
12823
|
}
|
|
12799
|
-
let a =
|
|
12800
|
-
if (l.length > 0 && (c = c.filter((e) => !
|
|
12801
|
-
let e =
|
|
12824
|
+
let a = Dh(i), o = __(i), s = Ah(i), c = Wm(new n(i)), l = [...a, ...o];
|
|
12825
|
+
if (l.length > 0 && (c = c.filter((e) => !v_(e, l))), c.length === 0 && (c = Wm(new n(s.split(",")[0] ?? s))), c.length === 0) {
|
|
12826
|
+
let e = D_(s);
|
|
12802
12827
|
e && (c = [{
|
|
12803
12828
|
...e.reference,
|
|
12804
12829
|
position: e.position
|
|
12805
12830
|
}]);
|
|
12806
12831
|
}
|
|
12807
|
-
let u =
|
|
12832
|
+
let u = gg(s);
|
|
12808
12833
|
if (c.length === 1 && c[0]?.type === "article") {
|
|
12809
|
-
let e =
|
|
12834
|
+
let e = Sh(s, { actionIndex: u ?? s.length });
|
|
12810
12835
|
e && (c = [e]);
|
|
12811
12836
|
}
|
|
12812
12837
|
if (u !== null) {
|
|
12813
|
-
let e = c.some((e) => bt(
|
|
12838
|
+
let e = c.some((e) => bt(_g(e)) === "article"), t = c.some((e) => [...O(_g(e))].some((e) => e.type === "article")), n = s.slice(0, u), r = _h(d_(n), 0) ?? _h(n, 0), i = c.map(_g).sort((e, t) => vh(t) - vh(e) || yh(t) - yh(e))[0], a = bh(i ?? null, r);
|
|
12814
12839
|
if (!e && a && a === r && (c = [r]), !t) {
|
|
12815
12840
|
let e = i, t = n.indexOf(":");
|
|
12816
12841
|
if (t !== -1) {
|
|
12817
|
-
let r = t + 1, i =
|
|
12818
|
-
e && i &&
|
|
12842
|
+
let r = t + 1, i = _h(f_(n.slice(r)), r), a = i ? Rp(i) : [];
|
|
12843
|
+
e && i && vh(e) > 0 && (a.length > 1 || a.some((e) => e.kind === "range")) && (c = [jg(e, i)]);
|
|
12819
12844
|
}
|
|
12820
12845
|
}
|
|
12821
12846
|
if (t) {
|
|
12822
|
-
let e = c.map(
|
|
12823
|
-
t !== -1 && e && i &&
|
|
12847
|
+
let e = c.map(_g).filter((e) => [...O(e)].some((e) => e.type === "article")).sort((e, t) => vh(t) - vh(e) || yh(t) - yh(e))[0], t = n.indexOf(":"), r = t === -1 ? 0 : t + 1, i = _h(f_(n.slice(r)), r), a = i ? Rp(i) : [];
|
|
12848
|
+
t !== -1 && e && i && vh(e) > 0 && (a.length > 1 || a.some((e) => e.kind === "range")) && c.push(jg(e, i));
|
|
12824
12849
|
}
|
|
12825
12850
|
}
|
|
12826
12851
|
let d = [];
|
|
12827
12852
|
for (let e of c) {
|
|
12828
12853
|
if (e.type === "reference_et_action") {
|
|
12829
|
-
let t = e.position?.start ?? 0, n = i.lastIndexOf("\n", Math.max(0, t - 1)) + 1, r =
|
|
12854
|
+
let t = e.position?.start ?? 0, n = i.lastIndexOf("\n", Math.max(0, t - 1)) + 1, r = b_(i.slice(n, t)) ? n : t, a = {
|
|
12830
12855
|
start: r,
|
|
12831
12856
|
stop: i.length
|
|
12832
|
-
}, o = i.slice(r), s =
|
|
12857
|
+
}, o = i.slice(r), s = E_({
|
|
12833
12858
|
action: e.action,
|
|
12834
12859
|
reference: e.reference,
|
|
12835
12860
|
sourcePosition: a,
|
|
12836
12861
|
sourceText: o,
|
|
12837
12862
|
fullText: i,
|
|
12838
|
-
tableTarget:
|
|
12863
|
+
tableTarget: u_(o) ?? u_(i)
|
|
12839
12864
|
});
|
|
12840
12865
|
s && (Array.isArray(s) ? d.push(...s) : d.push(s));
|
|
12841
12866
|
continue;
|
|
12842
12867
|
}
|
|
12843
|
-
let t =
|
|
12868
|
+
let t = E_({
|
|
12844
12869
|
action: { action: "modifier" },
|
|
12845
12870
|
reference: e,
|
|
12846
12871
|
sourcePosition: e.position ?? {
|
|
@@ -12849,87 +12874,87 @@ function E_(e, t) {
|
|
|
12849
12874
|
},
|
|
12850
12875
|
sourceText: i,
|
|
12851
12876
|
fullText: i,
|
|
12852
|
-
tableTarget:
|
|
12877
|
+
tableTarget: u_(i)
|
|
12853
12878
|
});
|
|
12854
12879
|
t && (Array.isArray(t) ? d.push(...t) : d.push(t));
|
|
12855
12880
|
}
|
|
12856
12881
|
if (d.length === 0) {
|
|
12857
|
-
let e =
|
|
12882
|
+
let e = D_(s);
|
|
12858
12883
|
if (e) {
|
|
12859
|
-
let t =
|
|
12884
|
+
let t = E_({
|
|
12860
12885
|
action: { action: "modifier" },
|
|
12861
12886
|
reference: e.reference,
|
|
12862
12887
|
sourcePosition: e.position,
|
|
12863
12888
|
sourceText: i,
|
|
12864
12889
|
fullText: i,
|
|
12865
|
-
tableTarget:
|
|
12890
|
+
tableTarget: u_(i)
|
|
12866
12891
|
});
|
|
12867
12892
|
t && (Array.isArray(t) ? d.push(...t) : d.push(t));
|
|
12868
12893
|
}
|
|
12869
12894
|
}
|
|
12870
|
-
return
|
|
12895
|
+
return T_(d);
|
|
12871
12896
|
}
|
|
12872
|
-
function
|
|
12897
|
+
function k_(e) {
|
|
12873
12898
|
let t = new n(r(e).output);
|
|
12874
|
-
return [...
|
|
12899
|
+
return [...Jh.extract(t, { overlapWindow: 100 })];
|
|
12875
12900
|
}
|
|
12876
|
-
function O_(e) {
|
|
12877
|
-
return E_(e, { allowListExtraction: !0 });
|
|
12878
|
-
}
|
|
12879
|
-
var k_ = O_;
|
|
12880
12901
|
function A_(e) {
|
|
12881
|
-
|
|
12882
|
-
return t.includes("«") || t.includes("»") || !e.trim().endsWith(":") ? !1 : ah(t);
|
|
12902
|
+
return O_(e, { allowListExtraction: !0 });
|
|
12883
12903
|
}
|
|
12884
|
-
|
|
12904
|
+
var j_ = A_;
|
|
12905
|
+
function M_(e) {
|
|
12906
|
+
let t = $m(e);
|
|
12907
|
+
return t.includes("«") || t.includes("»") || !e.trim().endsWith(":") ? !1 : sh(t);
|
|
12908
|
+
}
|
|
12909
|
+
function N_(e) {
|
|
12885
12910
|
return e.trimStart().startsWith("«");
|
|
12886
12911
|
}
|
|
12887
|
-
function
|
|
12912
|
+
function P_(e) {
|
|
12888
12913
|
return /»[.;]?\s*$/u.test(e);
|
|
12889
12914
|
}
|
|
12890
|
-
function
|
|
12915
|
+
function F_(e, t) {
|
|
12891
12916
|
for (let n = t; n < e.length; n += 1) {
|
|
12892
|
-
let t =
|
|
12917
|
+
let t = cg(e[n]).trim();
|
|
12893
12918
|
if (t.length > 0) return t;
|
|
12894
12919
|
}
|
|
12895
12920
|
}
|
|
12896
|
-
function
|
|
12921
|
+
function I_(e, t) {
|
|
12897
12922
|
let n = [], r = !1, i = t + 1;
|
|
12898
12923
|
for (; i < e.length;) {
|
|
12899
|
-
let t = e[i], a =
|
|
12924
|
+
let t = e[i], a = cg(t);
|
|
12900
12925
|
if (!r && a.includes("«") && (r = !0), r) {
|
|
12901
12926
|
n.push(a);
|
|
12902
|
-
let t =
|
|
12903
|
-
if (
|
|
12927
|
+
let t = F_(e, i + 1);
|
|
12928
|
+
if (P_(a) && (t === void 0 || !N_(t))) break;
|
|
12904
12929
|
} else if (a.trim().length > 0) break;
|
|
12905
12930
|
i += 1;
|
|
12906
12931
|
}
|
|
12907
12932
|
return !r || n.length === 0 ? null : {
|
|
12908
|
-
combinedText: [
|
|
12933
|
+
combinedText: [cg(e[t]), ...n].join("\n"),
|
|
12909
12934
|
endIndex: i
|
|
12910
12935
|
};
|
|
12911
12936
|
}
|
|
12912
|
-
function
|
|
12937
|
+
function L_(e) {
|
|
12913
12938
|
let t = a()(e).output.split("\n").map((e) => e.trim()).filter((e) => e.length > 0), n = [];
|
|
12914
12939
|
for (let e = 0; e < t.length; e += 1) {
|
|
12915
12940
|
let r = t[e];
|
|
12916
|
-
if (
|
|
12917
|
-
let r =
|
|
12941
|
+
if (M_(r)) {
|
|
12942
|
+
let r = I_(t, e);
|
|
12918
12943
|
if (r) {
|
|
12919
|
-
let t =
|
|
12944
|
+
let t = A_(r.combinedText);
|
|
12920
12945
|
if (t.length > 0) {
|
|
12921
12946
|
n.push(...t), e = r.endIndex;
|
|
12922
12947
|
continue;
|
|
12923
12948
|
}
|
|
12924
12949
|
}
|
|
12925
12950
|
}
|
|
12926
|
-
let i =
|
|
12951
|
+
let i = O_(r, { allowListExtraction: !1 });
|
|
12927
12952
|
i.length > 0 && n.push(...i);
|
|
12928
12953
|
}
|
|
12929
12954
|
return n;
|
|
12930
12955
|
}
|
|
12931
|
-
var
|
|
12932
|
-
function
|
|
12956
|
+
var R_ = L_, z_;
|
|
12957
|
+
function B_(e) {
|
|
12933
12958
|
return {
|
|
12934
12959
|
dateDebut: e.dateDebut ?? "0001-01-01",
|
|
12935
12960
|
dateFin: e.dateFin ?? "2999-01-01",
|
|
@@ -12938,7 +12963,7 @@ function R_(e) {
|
|
|
12938
12963
|
textId: e.textId
|
|
12939
12964
|
};
|
|
12940
12965
|
}
|
|
12941
|
-
function
|
|
12966
|
+
function V_(e) {
|
|
12942
12967
|
let t = e["@id"];
|
|
12943
12968
|
return t === void 0 ? null : {
|
|
12944
12969
|
dateDebut: e["@debut"] ?? null,
|
|
@@ -12948,10 +12973,10 @@ function z_(e) {
|
|
|
12948
12973
|
title: e["#text"] ?? null
|
|
12949
12974
|
};
|
|
12950
12975
|
}
|
|
12951
|
-
function
|
|
12976
|
+
function H_(e, t) {
|
|
12952
12977
|
return (e.dateDebut === null || e.dateDebut <= t) && (e.dateFin === null || e.dateFin >= t);
|
|
12953
12978
|
}
|
|
12954
|
-
var
|
|
12979
|
+
var U_ = class extends ke {
|
|
12955
12980
|
canutesDb;
|
|
12956
12981
|
articleRowsByNumByTextAndDate = /* @__PURE__ */ new Map();
|
|
12957
12982
|
directSectionChildrenByParentAndDate = /* @__PURE__ */ new Map();
|
|
@@ -12976,7 +13001,7 @@ var V_ = class extends ke {
|
|
|
12976
13001
|
WHERE
|
|
12977
13002
|
data -> 'CONTEXTE' -> 'TEXTE' ->> '@cid' = ${n}
|
|
12978
13003
|
AND num = ${t}
|
|
12979
|
-
`).map(
|
|
13004
|
+
`).map(B_), this.articleRowsByNumByTextAndDate.set(r, i)), i;
|
|
12980
13005
|
}
|
|
12981
13006
|
async getDirectSectionChildren({ date: e, parentPath: t }) {
|
|
12982
13007
|
let n = `${t}\0${e}`, r = this.directSectionChildrenByParentAndDate.get(n);
|
|
@@ -12990,7 +13015,7 @@ var V_ = class extends ke {
|
|
|
12990
13015
|
SELECT data
|
|
12991
13016
|
FROM legifrance.textelr
|
|
12992
13017
|
WHERE id = ${t}
|
|
12993
|
-
`)[0]?.data.STRUCT?.LIEN_SECTION_TA?.map(
|
|
13018
|
+
`)[0]?.data.STRUCT?.LIEN_SECTION_TA?.map(V_).filter((e) => e !== null).filter((t) => H_(t, e)) ?? [] : i.map(V_).filter((e) => e !== null).filter((t) => H_(t, e)), this.directSectionChildrenByParentAndDate.set(n, r);
|
|
12994
13019
|
}
|
|
12995
13020
|
return r;
|
|
12996
13021
|
}
|
|
@@ -13033,7 +13058,7 @@ var V_ = class extends ke {
|
|
|
13033
13058
|
FROM legifrance.article
|
|
13034
13059
|
WHERE num = ${t}
|
|
13035
13060
|
LIMIT 100
|
|
13036
|
-
`).map(
|
|
13061
|
+
`).map(B_), this.globalArticleRowsByNumAndDate.set(n, r)), r;
|
|
13037
13062
|
}
|
|
13038
13063
|
async preloadTextTitlesInfos(e = {}) {
|
|
13039
13064
|
let t = (t, n = {}) => {
|
|
@@ -13048,7 +13073,7 @@ var V_ = class extends ke {
|
|
|
13048
13073
|
return;
|
|
13049
13074
|
}
|
|
13050
13075
|
let n = new xe("canutes.preloadTextTitlesInfos");
|
|
13051
|
-
|
|
13076
|
+
z_ === void 0 ? (t("queryTextTitlesInfos:start"), z_ = (async () => {
|
|
13052
13077
|
let e = await n.time("queryTextTitlesInfos", () => this.canutesDb`
|
|
13053
13078
|
SELECT
|
|
13054
13079
|
data -> 'META' -> 'META_SPEC' -> 'META_TEXTE_CHRONICLE' ->> 'CID' AS cid,
|
|
@@ -13078,8 +13103,8 @@ var V_ = class extends ke {
|
|
|
13078
13103
|
`);
|
|
13079
13104
|
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");
|
|
13080
13105
|
})().catch((e) => {
|
|
13081
|
-
throw
|
|
13082
|
-
})) : t("waiting-for-shared-preload"), await
|
|
13106
|
+
throw z_ = void 0, e;
|
|
13107
|
+
})) : t("waiting-for-shared-preload"), await z_, n.log(), this.textTitlesInfosLoaded = !0;
|
|
13083
13108
|
}
|
|
13084
13109
|
async preloadUniqueActiveArticlesByNums({ date: e, nums: t }) {
|
|
13085
13110
|
let n = [...new Set([...t].filter(Boolean))].filter((t) => !this.globalArticleRowsByNumAndDate.has(`${t}\0${e}`));
|
|
@@ -13093,7 +13118,7 @@ var V_ = class extends ke {
|
|
|
13093
13118
|
data -> 'META' -> 'META_SPEC' -> 'META_ARTICLE' ->> 'DATE_FIN' AS "dateFin"
|
|
13094
13119
|
FROM legifrance.article
|
|
13095
13120
|
WHERE num IN ${this.canutesDb(n)}
|
|
13096
|
-
`).map(
|
|
13121
|
+
`).map(B_), i = /* @__PURE__ */ new Map();
|
|
13097
13122
|
for (let e of r) {
|
|
13098
13123
|
if (e.num === null) continue;
|
|
13099
13124
|
let t = i.get(e.num);
|
|
@@ -13104,15 +13129,15 @@ var V_ = class extends ke {
|
|
|
13104
13129
|
};
|
|
13105
13130
|
//#endregion
|
|
13106
13131
|
//#region src/lib/extractors/links.ts
|
|
13107
|
-
async function*
|
|
13108
|
-
let l = r ?? (e === void 0 ? void 0 : new
|
|
13132
|
+
async function* W_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgnoredReferencesTypes: i, logPartialReferences: a, logReferences: o, state: s, transformation: c }) {
|
|
13133
|
+
let l = r ?? (e === void 0 ? void 0 : new U_(e));
|
|
13109
13134
|
if (l === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
13110
13135
|
let u = new xe("extractTextLinks"), d = {}, f = c === void 0 ? void 0 : _e(c), p = s === void 0 ? {} : structuredClone(s), m = u.timeSync("extractReferences", () => {
|
|
13111
13136
|
let e = [];
|
|
13112
|
-
for (let n of c === void 0 ?
|
|
13137
|
+
for (let n of c === void 0 ? Vm(t) : Um(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);
|
|
13113
13138
|
return e;
|
|
13114
13139
|
}, { inputSize: t.input.length }), h = performance.now();
|
|
13115
|
-
for (let e of m) for (let n of
|
|
13140
|
+
for (let e of m) for (let n of lv(t, e)) {
|
|
13116
13141
|
let r = n.type === "parent-enfant" ? n.parent : n;
|
|
13117
13142
|
switch (r.type) {
|
|
13118
13143
|
case "alinéa":
|
|
@@ -13141,7 +13166,7 @@ async function* H_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13141
13166
|
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`);
|
|
13142
13167
|
break;
|
|
13143
13168
|
case "texte":
|
|
13144
|
-
|
|
13169
|
+
G_({
|
|
13145
13170
|
context: t,
|
|
13146
13171
|
logPartialReferences: a,
|
|
13147
13172
|
reference: e,
|
|
@@ -13157,14 +13182,14 @@ async function* H_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13157
13182
|
phase: "collectDefinitionsAndTextState"
|
|
13158
13183
|
});
|
|
13159
13184
|
let g = /* @__PURE__ */ new Set();
|
|
13160
|
-
for (let e of m) for (let t of
|
|
13161
|
-
let _ =
|
|
13185
|
+
for (let e of m) for (let t of cv(e, { citations: !0 })) g.add(t);
|
|
13186
|
+
let _ = K_(t, m);
|
|
13162
13187
|
await u.time("preloadActiveArticlesByTextIds", () => l.preloadActiveArticlesByTextIds({
|
|
13163
13188
|
date: n,
|
|
13164
13189
|
nums: g,
|
|
13165
13190
|
textIds: _
|
|
13166
13191
|
}), { count: _.size });
|
|
13167
|
-
let v = await u.time("collectUniqueFallbackArticleNums", () =>
|
|
13192
|
+
let v = await u.time("collectUniqueFallbackArticleNums", () => q_({
|
|
13168
13193
|
context: t,
|
|
13169
13194
|
date: n,
|
|
13170
13195
|
legiResolver: l,
|
|
@@ -13177,7 +13202,7 @@ async function* H_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13177
13202
|
nums: v
|
|
13178
13203
|
}), { count: v.size }), p = s === void 0 ? {} : s;
|
|
13179
13204
|
let y = 0, ee = performance.now();
|
|
13180
|
-
for (let e of m) for await (let r of
|
|
13205
|
+
for (let e of m) for await (let r of mv({
|
|
13181
13206
|
articleDefinitionByNumByTextId: d,
|
|
13182
13207
|
legiResolver: l,
|
|
13183
13208
|
context: t,
|
|
@@ -13194,7 +13219,7 @@ async function* H_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13194
13219
|
phase: "iterReferenceLinks"
|
|
13195
13220
|
}), u.log({ referenceCount: m.length });
|
|
13196
13221
|
}
|
|
13197
|
-
function
|
|
13222
|
+
function G_({ context: e, logPartialReferences: t, reference: n, state: r, text: i }) {
|
|
13198
13223
|
switch (i.nature) {
|
|
13199
13224
|
case "ARRETE":
|
|
13200
13225
|
case "CIRCULAIRE":
|
|
@@ -13265,17 +13290,17 @@ function U_({ context: e, logPartialReferences: t, reference: n, state: r, text:
|
|
|
13265
13290
|
default: i.nature === void 0 ? delete r.textId : c("nature", i.nature);
|
|
13266
13291
|
}
|
|
13267
13292
|
}
|
|
13268
|
-
function
|
|
13293
|
+
function K_(e, t) {
|
|
13269
13294
|
let n = /* @__PURE__ */ new Set();
|
|
13270
|
-
for (let r of t) for (let t of
|
|
13295
|
+
for (let r of t) for (let t of lv(e, r, { citations: !0 })) {
|
|
13271
13296
|
let e = t.type === "parent-enfant" ? t.parent : t;
|
|
13272
13297
|
e.type === "texte" && e.cid !== void 0 ? n.add(e.cid) : e.type === "article" && e.implicitText?.cid !== void 0 && n.add(e.implicitText.cid);
|
|
13273
13298
|
}
|
|
13274
13299
|
return n;
|
|
13275
13300
|
}
|
|
13276
|
-
async function
|
|
13301
|
+
async function q_({ context: e, date: t, legiResolver: n, logPartialReferences: r, references: i, state: a }) {
|
|
13277
13302
|
let o = /* @__PURE__ */ new Set();
|
|
13278
|
-
for (let s of i) await
|
|
13303
|
+
for (let s of i) await J_({
|
|
13279
13304
|
articleNums: o,
|
|
13280
13305
|
context: e,
|
|
13281
13306
|
date: t,
|
|
@@ -13286,8 +13311,8 @@ async function G_({ context: e, date: t, legiResolver: n, logPartialReferences:
|
|
|
13286
13311
|
});
|
|
13287
13312
|
return o;
|
|
13288
13313
|
}
|
|
13289
|
-
async function
|
|
13290
|
-
for (let s of
|
|
13314
|
+
async function J_({ articleNums: e, context: t, date: n, legiResolver: r, logPartialReferences: i, reference: a, state: o }) {
|
|
13315
|
+
for (let s of lv(t, a)) await Y_({
|
|
13291
13316
|
articleNums: e,
|
|
13292
13317
|
atomicOrParentChildReference: s,
|
|
13293
13318
|
context: t,
|
|
@@ -13302,7 +13327,7 @@ async function K_({ articleNums: e, context: t, date: n, legiResolver: r, logPar
|
|
|
13302
13327
|
if (s !== void 0) {
|
|
13303
13328
|
for (let a of s) if (a.references !== void 0) {
|
|
13304
13329
|
let s = structuredClone(o);
|
|
13305
|
-
for (let o of a.references) await
|
|
13330
|
+
for (let o of a.references) await J_({
|
|
13306
13331
|
articleNums: e,
|
|
13307
13332
|
context: t,
|
|
13308
13333
|
date: n,
|
|
@@ -13315,7 +13340,7 @@ async function K_({ articleNums: e, context: t, date: n, legiResolver: r, logPar
|
|
|
13315
13340
|
}
|
|
13316
13341
|
}
|
|
13317
13342
|
}
|
|
13318
|
-
async function
|
|
13343
|
+
async function Y_({ articleNums: e, atomicOrParentChildReference: t, context: n, date: r, legiResolver: i, logPartialReferences: a, reference: o, state: s }) {
|
|
13319
13344
|
let c = t.type === "parent-enfant" ? t.parent : t, l = t.type === "parent-enfant" ? t : void 0;
|
|
13320
13345
|
switch (c.type) {
|
|
13321
13346
|
case "alinéa":
|
|
@@ -13324,7 +13349,7 @@ async function q_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13324
13349
|
case "phrase": break;
|
|
13325
13350
|
case "article":
|
|
13326
13351
|
if (c.definition && s.textId !== void 0) break;
|
|
13327
|
-
await
|
|
13352
|
+
await ov({
|
|
13328
13353
|
article: c,
|
|
13329
13354
|
date: r,
|
|
13330
13355
|
legiResolver: i,
|
|
@@ -13342,7 +13367,7 @@ async function q_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13342
13367
|
case "sous-titre":
|
|
13343
13368
|
case "titre":
|
|
13344
13369
|
if (c.definition && s.textId !== void 0) break;
|
|
13345
|
-
l !== void 0 && await
|
|
13370
|
+
l !== void 0 && await J_({
|
|
13346
13371
|
articleNums: e,
|
|
13347
13372
|
context: n,
|
|
13348
13373
|
date: r,
|
|
@@ -13353,13 +13378,13 @@ async function q_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13353
13378
|
});
|
|
13354
13379
|
break;
|
|
13355
13380
|
case "texte":
|
|
13356
|
-
|
|
13381
|
+
G_({
|
|
13357
13382
|
context: n,
|
|
13358
13383
|
logPartialReferences: a,
|
|
13359
13384
|
reference: o,
|
|
13360
13385
|
state: s,
|
|
13361
13386
|
text: c
|
|
13362
|
-
}), l !== void 0 && await
|
|
13387
|
+
}), l !== void 0 && await J_({
|
|
13363
13388
|
articleNums: e,
|
|
13364
13389
|
context: n,
|
|
13365
13390
|
date: r,
|
|
@@ -13372,7 +13397,14 @@ async function q_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13372
13397
|
default: break;
|
|
13373
13398
|
}
|
|
13374
13399
|
}
|
|
13375
|
-
var
|
|
13400
|
+
var X_ = new Set([
|
|
13401
|
+
"LEGITEXT000005634379",
|
|
13402
|
+
"LEGITEXT000006069583",
|
|
13403
|
+
"LEGITEXT000006070933",
|
|
13404
|
+
"LEGITEXT000006072026",
|
|
13405
|
+
"LEGITEXT000006073984",
|
|
13406
|
+
"LEGITEXT000006074096"
|
|
13407
|
+
]), Z_ = new Set([
|
|
13376
13408
|
"LEGITEXT000006069568",
|
|
13377
13409
|
"LEGITEXT000006069569",
|
|
13378
13410
|
"LEGITEXT000006069574",
|
|
@@ -13380,33 +13412,41 @@ var J_ = new Set([
|
|
|
13380
13412
|
"LEGITEXT000006069577",
|
|
13381
13413
|
"LEGITEXT000006069583"
|
|
13382
13414
|
]);
|
|
13383
|
-
function
|
|
13415
|
+
function Q_(e, t, n) {
|
|
13384
13416
|
let r = n.replace(/\s+/gu, " ").trim();
|
|
13385
13417
|
r !== "" && r !== t && e.add(r);
|
|
13386
13418
|
}
|
|
13387
|
-
function
|
|
13419
|
+
function $_(e, t) {
|
|
13388
13420
|
let n = new Set([e]), r = new Set([e]);
|
|
13389
13421
|
for (let i = 0; i < 3; i++) {
|
|
13390
13422
|
let i = /* @__PURE__ */ new Set();
|
|
13391
13423
|
for (let a of r) {
|
|
13392
13424
|
let r = /* @__PURE__ */ new Set();
|
|
13393
|
-
|
|
13394
|
-
for (let t of a.matchAll(/-(?=\p{L})/gu))
|
|
13395
|
-
|
|
13425
|
+
Q_(r, e, a.replace(/\s*-\s*/gu, "-")), Q_(r, e, a.replace(/^(R\*)\s*(\d)/u, "$1 $2")), t === "LEGITEXT000006069583" && (Q_(r, e, a.replace(/^(R)(\d)/u, "$1*$2")), Q_(r, e, a.replace(/^(R)(\d)/u, "$1* $2"))), Q_(r, e, a.replace(/^R\*/u, "*R")), Q_(r, e, a.replace(/^R\*/u, "R"));
|
|
13426
|
+
for (let t of a.matchAll(/-(?=\p{L})/gu)) Q_(r, e, `${a.slice(0, t.index)} ${a.slice(t.index + 1)}`);
|
|
13427
|
+
Q_(r, e, a.replace(/-O(?=\p{L}|\s|$)/gu, "-0")), Q_(r, e, a.replace(/-0(?=\p{L})/gu, "-0 "));
|
|
13396
13428
|
let o = a.match(/^((?:L\s*O|[LRDA])\*?\s*)(\d{4,})$/u);
|
|
13397
13429
|
if (o !== null) {
|
|
13398
13430
|
let [, t, n] = o;
|
|
13399
|
-
for (let i = 2; i < n.length; i++)
|
|
13431
|
+
for (let i = 2; i < n.length; i++) Q_(r, e, `${t}${n.slice(0, i)}-${n.slice(i)}`);
|
|
13400
13432
|
}
|
|
13401
|
-
/^(?:L\s*O|[LRDA])\*?/u.test(a) &&
|
|
13433
|
+
if (/^(?:L\s*O|[LRDA])\*?/u.test(a) && Q_(r, e, a.replace(/\s+(\d+)$/u, "-$1")), t === "LEGITEXT000006069576" && /^0\d+$/u.test(a) && Q_(r, e, String(Number(a))), X_.has(t) && /^\d/u.test(a)) for (let t of [
|
|
13434
|
+
"L",
|
|
13435
|
+
"R",
|
|
13436
|
+
"D",
|
|
13437
|
+
"A",
|
|
13438
|
+
"R*",
|
|
13439
|
+
"*R"
|
|
13440
|
+
]) Q_(r, e, `${t}${a}`);
|
|
13441
|
+
Q_(r, e, a.replace(/(\d)\s+0(?=\s*-?\s*\p{L})/gu, "$1-0")), Q_(r, e, a.replace(/(\p{L})\s+(\d{2})-([\p{L}])$/u, "$1-$2 $3"));
|
|
13402
13442
|
for (let e of r) n.has(e) || (n.add(e), i.add(e));
|
|
13403
13443
|
}
|
|
13404
13444
|
r = i;
|
|
13405
13445
|
}
|
|
13406
13446
|
return n.delete(e), [...n];
|
|
13407
13447
|
}
|
|
13408
|
-
function
|
|
13409
|
-
if (!
|
|
13448
|
+
function ev(e, t) {
|
|
13449
|
+
if (!Z_.has(t)) return [];
|
|
13410
13450
|
let n = [], r = e;
|
|
13411
13451
|
for (let e = 0; e < 4; e++) {
|
|
13412
13452
|
let e = r.replace(/(?:\s*-\s*|\s+)(?:[IVX]+|[1-9]\d*)(?:\s+(?:bis|ter|quater|quinquies|sexies))?$/iu, "").trim();
|
|
@@ -13415,19 +13455,91 @@ function Z_(e, t) {
|
|
|
13415
13455
|
}
|
|
13416
13456
|
return n;
|
|
13417
13457
|
}
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13458
|
+
function tv(e, t) {
|
|
13459
|
+
return `${e}\0${t}`;
|
|
13460
|
+
}
|
|
13461
|
+
var nv = new Map([
|
|
13462
|
+
...[
|
|
13463
|
+
"1594 F quinquies A",
|
|
13464
|
+
"1594 F quinquies-D",
|
|
13465
|
+
"1594 F quinquies-E",
|
|
13466
|
+
"1594 F quinquies E II",
|
|
13467
|
+
"1594 F quinquies- E-I",
|
|
13468
|
+
"1594 F quinquies K"
|
|
13469
|
+
].map((e) => [tv("LEGITEXT000006069577", e), {
|
|
13470
|
+
num: "1594 F quinquies",
|
|
13471
|
+
textId: "LEGITEXT000006069577"
|
|
13472
|
+
}]),
|
|
13473
|
+
...[
|
|
13474
|
+
"1594-0 GA",
|
|
13475
|
+
"1594-0 G-A",
|
|
13476
|
+
"1594-0 G-A-II",
|
|
13477
|
+
"1594-0 G-A-VI"
|
|
13478
|
+
].map((e) => [tv("LEGITEXT000006069577", e), {
|
|
13479
|
+
num: "1594-0 G",
|
|
13480
|
+
textId: "LEGITEXT000006069577"
|
|
13481
|
+
}]),
|
|
13482
|
+
...[
|
|
13483
|
+
["383-0 bis", "LEGITEXT000006069574"],
|
|
13484
|
+
["315 ter A", "LEGITEXT000006069574"],
|
|
13485
|
+
["318 E", "LEGITEXT000006069569"],
|
|
13486
|
+
["38 A", "LEGITEXT000006069574"],
|
|
13487
|
+
["38 B", "LEGITEXT000006069574"],
|
|
13488
|
+
["49 octies D", "LEGITEXT000006069574"],
|
|
13489
|
+
["199-0", "LEGITEXT000006069576"]
|
|
13490
|
+
].map(([e, t]) => [tv("LEGITEXT000006069577", e), {
|
|
13491
|
+
num: e,
|
|
13492
|
+
textId: t
|
|
13493
|
+
}]),
|
|
13494
|
+
[tv("LEGITEXT000006069577", "L173"), {
|
|
13495
|
+
num: "173",
|
|
13496
|
+
textId: "LEGITEXT000006069577"
|
|
13497
|
+
}],
|
|
13498
|
+
[tv("LEGITEXT000006069583", "L38 B"), {
|
|
13499
|
+
num: "L38",
|
|
13500
|
+
textId: "LEGITEXT000006069583"
|
|
13501
|
+
}],
|
|
13502
|
+
...["L311-13 C", "L311-13 D"].map((e) => [tv("LEGITEXT000006070158", e), {
|
|
13503
|
+
num: "L311-13",
|
|
13504
|
+
textId: "LEGITEXT000006070158"
|
|
13505
|
+
}]),
|
|
13506
|
+
[tv("LEGITEXT000006071154", "226-14"), {
|
|
13507
|
+
num: "226-14",
|
|
13508
|
+
textId: "LEGITEXT000006070719"
|
|
13509
|
+
}],
|
|
13510
|
+
...[
|
|
13511
|
+
"1300-1",
|
|
13512
|
+
"1300-2",
|
|
13513
|
+
"1300-4"
|
|
13514
|
+
].map((e) => [tv("LEGITEXT000006070721", e), {
|
|
13515
|
+
num: e,
|
|
13516
|
+
textId: "LEGITEXT000006070716"
|
|
13517
|
+
}])
|
|
13518
|
+
]), rv = new Map([
|
|
13519
|
+
[tv("LEGITEXT000006069574", "382-0 C bis"), "LEGIARTI000036256024"],
|
|
13520
|
+
[tv("LEGITEXT000006069577", "1586 quinquies"), "LEGIARTI000023380915"],
|
|
13521
|
+
[tv("LEGITEXT000006069577", "1681 sexies"), "LEGIARTI000037986425"],
|
|
13522
|
+
[tv("LEGITEXT000006069577", "286"), "LEGIARTI000033815246"]
|
|
13523
|
+
]);
|
|
13524
|
+
function iv(e) {
|
|
13525
|
+
let t = new Set(e.flatMap(({ num: e, textId: t }) => e === null || t === null ? [] : [tv(t, e)]));
|
|
13526
|
+
if (t.size !== 1) return;
|
|
13527
|
+
let n = rv.get([...t][0]);
|
|
13528
|
+
return e.find(({ id: e }) => e === n);
|
|
13529
|
+
}
|
|
13530
|
+
async function av({ alternatives: e, date: t, legiResolver: n }) {
|
|
13531
|
+
let r = [];
|
|
13532
|
+
for (let { num: i, textId: a } of e) {
|
|
13421
13533
|
let e = (await n.getActiveArticlesByTextAndNum({
|
|
13422
13534
|
date: t,
|
|
13423
|
-
num:
|
|
13424
|
-
textId:
|
|
13535
|
+
num: i,
|
|
13536
|
+
textId: a
|
|
13425
13537
|
})).filter(({ dateDebut: e, dateFin: n }) => e <= t && n > t);
|
|
13426
|
-
e.length > 0 &&
|
|
13538
|
+
e.length > 0 && r.push(e);
|
|
13427
13539
|
}
|
|
13428
|
-
return
|
|
13540
|
+
return r.length === 1 ? r[0] : [];
|
|
13429
13541
|
}
|
|
13430
|
-
async function
|
|
13542
|
+
async function ov({ article: e, date: t, legiResolver: n, state: r }) {
|
|
13431
13543
|
if (e.present || e.num === void 0) return !1;
|
|
13432
13544
|
let i = e.implicitText?.cid ?? r.textId;
|
|
13433
13545
|
return !(i !== void 0 && (await n.getActiveArticlesByTextAndNum({
|
|
@@ -13440,23 +13552,35 @@ async function $_({ article: e, date: t, legiResolver: n, state: r }) {
|
|
|
13440
13552
|
textId: r.defaultTextId
|
|
13441
13553
|
})).length > 0);
|
|
13442
13554
|
}
|
|
13443
|
-
async function*
|
|
13555
|
+
async function* sv({ ancestors: e, article: t, legiResolver: n, context: r, date: i, logPartialReferences: a, originalPositionsFromTransformedIterator: o, reference: s, state: c }) {
|
|
13444
13556
|
if (t.present) return;
|
|
13445
13557
|
let l = [], u = t.implicitText?.cid ?? c.textId;
|
|
13446
|
-
if (u !== void 0 && (l = await n.getActiveArticlesByTextAndNum({
|
|
13558
|
+
if (u === "LEGITEXT000006070716" && t.num !== void 0 && /^[LR]\d/u.test(t.num) && (u = "LEGITEXT000025024948"), u !== void 0 && (l = await n.getActiveArticlesByTextAndNum({
|
|
13447
13559
|
date: i,
|
|
13448
13560
|
num: t.num,
|
|
13449
13561
|
textId: u
|
|
13450
|
-
})), l.length === 0 && t.num !== void 0 && u !== void 0
|
|
13451
|
-
|
|
13562
|
+
})), l.length === 0 && t.num !== void 0 && u !== void 0) {
|
|
13563
|
+
let e = nv.get(tv(u, t.num));
|
|
13564
|
+
e !== void 0 && (l = await av({
|
|
13565
|
+
alternatives: [e],
|
|
13566
|
+
date: i,
|
|
13567
|
+
legiResolver: n
|
|
13568
|
+
}));
|
|
13569
|
+
}
|
|
13570
|
+
if (l.length === 0 && t.num !== void 0 && u !== void 0 && (l = await av({
|
|
13571
|
+
alternatives: $_(t.num, u).map((e) => ({
|
|
13572
|
+
num: e,
|
|
13573
|
+
textId: u
|
|
13574
|
+
})),
|
|
13452
13575
|
date: i,
|
|
13453
|
-
legiResolver: n
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13576
|
+
legiResolver: n
|
|
13577
|
+
})), l.length === 0 && t.num !== void 0 && u !== void 0 && (l = await av({
|
|
13578
|
+
alternatives: ev(t.num, u).map((e) => ({
|
|
13579
|
+
num: e,
|
|
13580
|
+
textId: u
|
|
13581
|
+
})),
|
|
13457
13582
|
date: i,
|
|
13458
|
-
legiResolver: n
|
|
13459
|
-
textId: u
|
|
13583
|
+
legiResolver: n
|
|
13460
13584
|
})), l.length === 0 && c.defaultTextId !== void 0 && c.defaultTextId !== u && (l = await n.getActiveArticlesByTextAndNum({
|
|
13461
13585
|
date: i,
|
|
13462
13586
|
num: t.num,
|
|
@@ -13468,7 +13592,12 @@ async function* ev({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13468
13592
|
else if (l.length === 1) c.articleId = l[0].id;
|
|
13469
13593
|
else {
|
|
13470
13594
|
let e = l.filter(({ dateDebut: e, dateFin: t }) => e <= i && t > i);
|
|
13471
|
-
|
|
13595
|
+
if (e.length === 1) c.articleId = e[0].id;
|
|
13596
|
+
else {
|
|
13597
|
+
e.length !== 0 && (l = e);
|
|
13598
|
+
let n = iv(l);
|
|
13599
|
+
n === void 0 ? (e = l.filter(({ id: e }) => !c.textId?.startsWith("JORF") || e.startsWith("JORF")), e.length === 1 ? c.articleId = e[0].id : (e.length !== 0 && (l = e), a && console.warn(`In "${r.input.slice(t.position.start, t.position.stop)}": Unable to filter article ${t.num ?? null} of text ${c.textId ?? null} among IDs ${JSON.stringify(l.map(({ id: e }) => e), null, 2)} for reference ${JSON.stringify(t, null, 2)}`), delete c.articleId)) : c.articleId = n.id;
|
|
13600
|
+
}
|
|
13472
13601
|
}
|
|
13473
13602
|
let d = e === void 0 ? t.position : t.position.start < e[0].position.start ? {
|
|
13474
13603
|
start: t.position.start,
|
|
@@ -13486,91 +13615,91 @@ async function* ev({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13486
13615
|
type: "external_article"
|
|
13487
13616
|
}).filter(([, e]) => e !== void 0));
|
|
13488
13617
|
}
|
|
13489
|
-
function*
|
|
13618
|
+
function* cv(e, { citations: t = !1 } = {}) {
|
|
13490
13619
|
switch (e.type) {
|
|
13491
13620
|
case "article":
|
|
13492
13621
|
e.num !== void 0 && (yield e.num);
|
|
13493
13622
|
break;
|
|
13494
13623
|
case "bounded-interval":
|
|
13495
|
-
yield*
|
|
13624
|
+
yield* cv(e.first, { citations: t }), yield* cv(e.last, { citations: t });
|
|
13496
13625
|
break;
|
|
13497
13626
|
case "counted-interval":
|
|
13498
|
-
yield*
|
|
13627
|
+
yield* cv(e.first, { citations: t });
|
|
13499
13628
|
break;
|
|
13500
13629
|
case "enumeration":
|
|
13501
13630
|
case "exclusion":
|
|
13502
|
-
yield*
|
|
13631
|
+
yield* cv(e.left, { citations: t }), yield* cv(e.right, { citations: t });
|
|
13503
13632
|
break;
|
|
13504
13633
|
case "parent-enfant":
|
|
13505
|
-
yield*
|
|
13634
|
+
yield* cv(e.parent, { citations: t }), yield* cv(e.child, { citations: t });
|
|
13506
13635
|
break;
|
|
13507
13636
|
case "reference_et_action":
|
|
13508
|
-
if (yield*
|
|
13637
|
+
if (yield* cv(e.reference, { citations: t }), t) {
|
|
13509
13638
|
let { originalCitations: n } = e.action;
|
|
13510
13639
|
if (n !== void 0) {
|
|
13511
|
-
for (let e of n) if (e.references !== void 0) for (let n of e.references) yield*
|
|
13640
|
+
for (let e of n) if (e.references !== void 0) for (let n of e.references) yield* cv(n, { citations: t });
|
|
13512
13641
|
}
|
|
13513
13642
|
}
|
|
13514
13643
|
break;
|
|
13515
13644
|
}
|
|
13516
13645
|
}
|
|
13517
|
-
function*
|
|
13646
|
+
function* lv(e, t, { citations: n = !1 } = {}) {
|
|
13518
13647
|
switch (t.type) {
|
|
13519
13648
|
case "bounded-interval":
|
|
13520
|
-
yield*
|
|
13649
|
+
yield* lv(e, t.first, { citations: n }), yield* lv(e, t.last, { citations: n });
|
|
13521
13650
|
break;
|
|
13522
13651
|
case "counted-interval":
|
|
13523
|
-
yield*
|
|
13652
|
+
yield* lv(e, t.first, { citations: n });
|
|
13524
13653
|
break;
|
|
13525
13654
|
case "enumeration":
|
|
13526
13655
|
case "exclusion":
|
|
13527
|
-
yield*
|
|
13656
|
+
yield* lv(e, t.left, { citations: n }), yield* lv(e, t.right, { citations: n });
|
|
13528
13657
|
break;
|
|
13529
13658
|
case "reference_et_action":
|
|
13530
|
-
if (yield*
|
|
13659
|
+
if (yield* lv(e, t.reference, { citations: n }), n) {
|
|
13531
13660
|
let { originalCitations: r } = t.action;
|
|
13532
13661
|
if (r !== void 0) {
|
|
13533
|
-
for (let t of r) if (t.references !== void 0) for (let r of t.references) yield*
|
|
13662
|
+
for (let t of r) if (t.references !== void 0) for (let r of t.references) yield* lv(e, r, { citations: n });
|
|
13534
13663
|
}
|
|
13535
13664
|
}
|
|
13536
13665
|
break;
|
|
13537
13666
|
default: yield t;
|
|
13538
13667
|
}
|
|
13539
13668
|
}
|
|
13540
|
-
function*
|
|
13669
|
+
function* uv(e, t) {
|
|
13541
13670
|
if (t.type === "texte") console.error(`iterDeepestDivisionsOrArticles must not be called with a text:\n${JSON.stringify(t, null, 2)}`);
|
|
13542
13671
|
else if (dt(t) || t.type === "article") yield t;
|
|
13543
13672
|
else if (!(ft(t) || t.type === "incomplete-header")) switch (t.type) {
|
|
13544
13673
|
case "bounded-interval":
|
|
13545
|
-
yield*
|
|
13674
|
+
yield* uv(e, t.first), yield* uv(e, t.last);
|
|
13546
13675
|
break;
|
|
13547
13676
|
case "counted-interval":
|
|
13548
|
-
yield*
|
|
13677
|
+
yield* uv(e, t.first);
|
|
13549
13678
|
break;
|
|
13550
13679
|
case "enumeration":
|
|
13551
13680
|
case "exclusion":
|
|
13552
|
-
yield*
|
|
13681
|
+
yield* uv(e, t.left), yield* uv(e, t.right);
|
|
13553
13682
|
break;
|
|
13554
13683
|
case "parent-enfant": {
|
|
13555
|
-
let n = [...
|
|
13556
|
-
n.length === 0 ? yield*
|
|
13684
|
+
let n = [...uv(e, t.child)];
|
|
13685
|
+
n.length === 0 ? yield* uv(e, t.parent) : yield* n;
|
|
13557
13686
|
break;
|
|
13558
13687
|
}
|
|
13559
13688
|
case "reference_et_action": {
|
|
13560
|
-
yield*
|
|
13689
|
+
yield* uv(e, t.reference);
|
|
13561
13690
|
let { originalCitations: n } = t.action;
|
|
13562
13691
|
if (n !== void 0) {
|
|
13563
|
-
for (let t of n) if (t.references !== void 0) for (let n of t.references) yield*
|
|
13692
|
+
for (let t of n) if (t.references !== void 0) for (let n of t.references) yield* uv(e, n);
|
|
13564
13693
|
}
|
|
13565
13694
|
break;
|
|
13566
13695
|
}
|
|
13567
13696
|
default: c("iterDeepestDivisionsOrArticles reference.type", t);
|
|
13568
13697
|
}
|
|
13569
13698
|
}
|
|
13570
|
-
function
|
|
13699
|
+
function dv(e) {
|
|
13571
13700
|
return e?.split(":")[0].trim().toLowerCase().split(/\s+/).map((e) => e.trim()).filter((e) => e !== "").join(" ");
|
|
13572
13701
|
}
|
|
13573
|
-
async function*
|
|
13702
|
+
async function* fv({ ancestors: e, legiResolver: t, context: n, date: r, division: i, divisionChildReference: a, logIgnoredReferencesTypes: o, logPartialReferences: s, originalPositionsFromTransformedIterator: c, parentSectionChildren: l, reference: u, state: d }) {
|
|
13574
13703
|
if (i.present) return;
|
|
13575
13704
|
let f;
|
|
13576
13705
|
if (l === void 0 && d.textId !== void 0 && (l = await t.getDirectSectionChildren({
|
|
@@ -13578,20 +13707,20 @@ async function* av({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13578
13707
|
parentPath: d.textId
|
|
13579
13708
|
})), l !== void 0) {
|
|
13580
13709
|
for (let e of l) {
|
|
13581
|
-
let t =
|
|
13710
|
+
let t = dv(e.title);
|
|
13582
13711
|
if (t !== void 0) {
|
|
13583
13712
|
let n = !1;
|
|
13584
|
-
if (i.index !== void 0 && (n =
|
|
13713
|
+
if (i.index !== void 0 && (n = pv(i.type, i.index).some((e) => e === t)), !n && i.num !== void 0 && (n = `${i.type} ${i.num.toLowerCase()}` === t), n) {
|
|
13585
13714
|
f = e;
|
|
13586
13715
|
break;
|
|
13587
13716
|
}
|
|
13588
13717
|
}
|
|
13589
13718
|
}
|
|
13590
13719
|
if (f === void 0 && (f = l.find((e) => {
|
|
13591
|
-
let t =
|
|
13720
|
+
let t = dv(e.title)?.split(/\s+/);
|
|
13592
13721
|
return t !== void 0 && t.length === 2 && ot.includes(t[0]) && t[1] === "législative";
|
|
13593
13722
|
}), f !== void 0)) {
|
|
13594
|
-
let e =
|
|
13723
|
+
let e = dv(f.title).split(/\s+/), t = {
|
|
13595
13724
|
start: i.position.stop,
|
|
13596
13725
|
stop: i.position.stop
|
|
13597
13726
|
}, n = c === void 0 ? void 0 : v(c, t), r = Object.fromEntries(Object.entries({
|
|
@@ -13609,8 +13738,8 @@ async function* av({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13609
13738
|
}).filter(([, e]) => e !== void 0)), i = r;
|
|
13610
13739
|
}
|
|
13611
13740
|
}
|
|
13612
|
-
let p = a === void 0 ? [] : [...
|
|
13613
|
-
if (a !== void 0) for (let l of
|
|
13741
|
+
let p = a === void 0 ? [] : [...uv(n, a.child)], m = 0;
|
|
13742
|
+
if (a !== void 0) for (let l of lv(n, a.child)) {
|
|
13614
13743
|
let h = l.type === "parent-enfant" ? l.parent : l, g = l.type === "parent-enfant" ? l : void 0;
|
|
13615
13744
|
switch (h.type) {
|
|
13616
13745
|
case "alinéa":
|
|
@@ -13618,7 +13747,7 @@ async function* av({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13618
13747
|
case "item":
|
|
13619
13748
|
case "phrase": break;
|
|
13620
13749
|
case "article":
|
|
13621
|
-
yield*
|
|
13750
|
+
yield* sv({
|
|
13622
13751
|
ancestors: p.length === 1 ? [...e ?? [], i] : void 0,
|
|
13623
13752
|
article: h,
|
|
13624
13753
|
legiResolver: t,
|
|
@@ -13644,7 +13773,7 @@ async function* av({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13644
13773
|
f !== void 0 && (a = await t.getDirectSectionChildren({
|
|
13645
13774
|
date: r,
|
|
13646
13775
|
parentPath: f.path
|
|
13647
|
-
})), yield*
|
|
13776
|
+
})), yield* fv({
|
|
13648
13777
|
ancestors: p.length === 1 ? [...e ?? [], i] : void 0,
|
|
13649
13778
|
legiResolver: t,
|
|
13650
13779
|
context: n,
|
|
@@ -13682,7 +13811,7 @@ async function* av({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13682
13811
|
}).filter(([, e]) => e !== void 0));
|
|
13683
13812
|
}
|
|
13684
13813
|
}
|
|
13685
|
-
function*
|
|
13814
|
+
function* pv(e, t) {
|
|
13686
13815
|
let n = Math.floor(t), r = Math.floor((t - n) * 1e3);
|
|
13687
13816
|
if (r === 0) {
|
|
13688
13817
|
for (let t of re(n)) yield `${t.toLowerCase()} ${e}`;
|
|
@@ -13692,9 +13821,9 @@ function* ov(e, t) {
|
|
|
13692
13821
|
for (let r of f(n)) yield `${e} ${t} ${r.toLowerCase()}`;
|
|
13693
13822
|
}
|
|
13694
13823
|
}
|
|
13695
|
-
async function*
|
|
13824
|
+
async function* mv({ articleDefinitionByNumByTextId: e, legiResolver: t, context: n, date: r, logIgnoredReferencesTypes: i, logPartialReferences: a, originalPositionsFromTransformedIterator: o, reference: s, state: c }) {
|
|
13696
13825
|
let l = e ?? {}, u = c === void 0 ? {} : c;
|
|
13697
|
-
for (let e of
|
|
13826
|
+
for (let e of lv(n, s)) {
|
|
13698
13827
|
let c = e.type === "parent-enfant" ? e.parent : e, d = e.type === "parent-enfant" ? e : void 0;
|
|
13699
13828
|
switch (c.type) {
|
|
13700
13829
|
case "alinéa":
|
|
@@ -13705,7 +13834,7 @@ async function* sv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13705
13834
|
if (c.definition && u.textId !== void 0) {
|
|
13706
13835
|
let e = l[u.textId]?.[c.num];
|
|
13707
13836
|
e !== void 0 && (e.originalTransformation === void 0 && o !== void 0 && (e.originalTransformation = v(o, e.position)), yield e);
|
|
13708
|
-
} else yield*
|
|
13837
|
+
} else yield* sv({
|
|
13709
13838
|
article: c,
|
|
13710
13839
|
legiResolver: t,
|
|
13711
13840
|
context: n,
|
|
@@ -13726,7 +13855,7 @@ async function* sv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13726
13855
|
case "sous-sous-paragraphe":
|
|
13727
13856
|
case "sous-titre":
|
|
13728
13857
|
case "titre":
|
|
13729
|
-
c.definition && u.textId !== void 0 || (yield*
|
|
13858
|
+
c.definition && u.textId !== void 0 || (yield* fv({
|
|
13730
13859
|
legiResolver: t,
|
|
13731
13860
|
context: n,
|
|
13732
13861
|
date: r,
|
|
@@ -13740,15 +13869,15 @@ async function* sv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13740
13869
|
}));
|
|
13741
13870
|
break;
|
|
13742
13871
|
case "texte": {
|
|
13743
|
-
|
|
13872
|
+
G_({
|
|
13744
13873
|
context: n,
|
|
13745
13874
|
logPartialReferences: a,
|
|
13746
13875
|
reference: s,
|
|
13747
13876
|
state: u,
|
|
13748
13877
|
text: c
|
|
13749
13878
|
});
|
|
13750
|
-
let e = d === void 0 ? [] : [...
|
|
13751
|
-
if (d !== void 0) for (let f of
|
|
13879
|
+
let e = d === void 0 ? [] : [...uv(n, d.child)], l = 0;
|
|
13880
|
+
if (d !== void 0) for (let f of lv(n, d.child)) {
|
|
13752
13881
|
let p = f.type === "parent-enfant" ? f.parent : f, m = f.type === "parent-enfant" ? f : void 0;
|
|
13753
13882
|
switch (p.type) {
|
|
13754
13883
|
case "alinéa":
|
|
@@ -13756,7 +13885,7 @@ async function* sv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13756
13885
|
case "item":
|
|
13757
13886
|
case "phrase": break;
|
|
13758
13887
|
case "article":
|
|
13759
|
-
yield*
|
|
13888
|
+
yield* sv({
|
|
13760
13889
|
ancestors: e.length === 1 ? [c] : void 0,
|
|
13761
13890
|
article: p,
|
|
13762
13891
|
legiResolver: t,
|
|
@@ -13782,7 +13911,7 @@ async function* sv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13782
13911
|
u.textId !== void 0 && (d = await t.getDirectSectionChildren({
|
|
13783
13912
|
date: r,
|
|
13784
13913
|
parentPath: u.textId
|
|
13785
|
-
})), yield*
|
|
13914
|
+
})), yield* fv({
|
|
13786
13915
|
ancestors: e.length === 1 ? [c] : void 0,
|
|
13787
13916
|
legiResolver: t,
|
|
13788
13917
|
context: n,
|
|
@@ -13833,7 +13962,7 @@ async function* sv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13833
13962
|
if (e !== void 0) {
|
|
13834
13963
|
for (let s of e) if (s.references !== void 0) {
|
|
13835
13964
|
let e = structuredClone(u);
|
|
13836
|
-
for (let c of s.references) yield*
|
|
13965
|
+
for (let c of s.references) yield* mv({
|
|
13837
13966
|
articleDefinitionByNumByTextId: l,
|
|
13838
13967
|
legiResolver: t,
|
|
13839
13968
|
context: n,
|
|
@@ -13850,13 +13979,13 @@ async function* sv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13850
13979
|
}
|
|
13851
13980
|
//#endregion
|
|
13852
13981
|
//#region src/lib/extractors/table_of_contents.ts
|
|
13853
|
-
function
|
|
13982
|
+
function hv(e) {
|
|
13854
13983
|
let t = e;
|
|
13855
13984
|
return t.items ?? [...t.articles ?? [], ...t.divisions ?? []];
|
|
13856
13985
|
}
|
|
13857
|
-
function*
|
|
13986
|
+
function* gv({ context: e, tableOfContents: t, transformation: n }) {
|
|
13858
13987
|
let r = 0, i = _e(n);
|
|
13859
|
-
for (let n of
|
|
13988
|
+
for (let n of vv(t)) {
|
|
13860
13989
|
let t = n.line.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = RegExp(`^${t}$`, "m");
|
|
13861
13990
|
a.lastIndex = r;
|
|
13862
13991
|
let o = a.exec(e.input);
|
|
@@ -13868,7 +13997,7 @@ function* lv({ context: e, tableOfContents: t, transformation: n }) {
|
|
|
13868
13997
|
l.originalTransformation = c, l.position = s, yield l, r = s.stop;
|
|
13869
13998
|
}
|
|
13870
13999
|
}
|
|
13871
|
-
function
|
|
14000
|
+
function _v(e) {
|
|
13872
14001
|
let t = new n(e), r = { items: [] }, i = [];
|
|
13873
14002
|
for (let e of Tn(t)) if (dt(e)) {
|
|
13874
14003
|
let n = i.findIndex(({ type: t }) => t === e.type);
|
|
@@ -13886,14 +14015,14 @@ function uv(e) {
|
|
|
13886
14015
|
else throw Error(`Unexpected type "${e.type}" in definition:\n${JSON.stringify(e, null, 2)}`);
|
|
13887
14016
|
return r;
|
|
13888
14017
|
}
|
|
13889
|
-
function*
|
|
14018
|
+
function* vv(e) {
|
|
13890
14019
|
e.type !== void 0 && (yield e);
|
|
13891
|
-
for (let t of
|
|
14020
|
+
for (let t of hv(e)) t.type === "article" ? yield t : yield* vv(t);
|
|
13892
14021
|
}
|
|
13893
14022
|
//#endregion
|
|
13894
14023
|
//#region src/lib/links.ts
|
|
13895
|
-
var
|
|
13896
|
-
function
|
|
14024
|
+
var yv = ["Exploratrice", "Forgejo"];
|
|
14025
|
+
function bv(e, t, n) {
|
|
13897
14026
|
let r = n.match(Ke);
|
|
13898
14027
|
if (r === null) throw Error(`Unknown ID format: ${n}`);
|
|
13899
14028
|
switch (e) {
|
|
@@ -13914,19 +14043,19 @@ function pv(e, t, n) {
|
|
|
13914
14043
|
}
|
|
13915
14044
|
//#endregion
|
|
13916
14045
|
//#region src/lib/linkers/html.ts
|
|
13917
|
-
function
|
|
14046
|
+
function xv(e, t) {
|
|
13918
14047
|
if (e !== void 0) return e;
|
|
13919
|
-
if (t !== void 0) return new
|
|
14048
|
+
if (t !== void 0) return new U_(t);
|
|
13920
14049
|
throw Error("A Canutes database or legal resolver is required");
|
|
13921
14050
|
}
|
|
13922
|
-
function
|
|
14051
|
+
function Sv(e, t) {
|
|
13923
14052
|
return t.type === "reference_et_action" ? JSON.stringify({
|
|
13924
14053
|
...e,
|
|
13925
14054
|
action: t.action
|
|
13926
14055
|
}) : JSON.stringify(e);
|
|
13927
14056
|
}
|
|
13928
|
-
async function
|
|
13929
|
-
let h = new xe("addLinksToHtml"), g =
|
|
14057
|
+
async function Cv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl: o, linkType: s, logIgnoredReferencesTypes: l, logPartialReferences: u, logReferences: d, onLink: f, previousContext: p, state: m }) {
|
|
14058
|
+
let h = new xe("addLinksToHtml"), g = xv(t, e);
|
|
13930
14059
|
await h.time("preloadTextTitlesInfos", () => g.preloadTextTitlesInfos());
|
|
13931
14060
|
let _ = h.timeSync("simplifyHtml", () => a({ removeAWithHref: !0 })(i), {
|
|
13932
14061
|
inputSize: i.length,
|
|
@@ -13935,7 +14064,7 @@ async function gv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13935
14064
|
v.currentArticle = p?.currentArticle, v.currentText = p?.currentText;
|
|
13936
14065
|
let y = [], ee = { value: 0 }, te = -1;
|
|
13937
14066
|
await h.time("extractTextLinks", async () => {
|
|
13938
|
-
for await (let e of
|
|
14067
|
+
for await (let e of W_({
|
|
13939
14068
|
legiResolver: g,
|
|
13940
14069
|
context: v,
|
|
13941
14070
|
date: r,
|
|
@@ -13948,7 +14077,7 @@ async function gv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13948
14077
|
case "article_definition": {
|
|
13949
14078
|
let { article: t, originalTransformation: n, textId: r } = e;
|
|
13950
14079
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in article definition: ${JSON.stringify(e, null, 2)}`);
|
|
13951
|
-
|
|
14080
|
+
Tv({
|
|
13952
14081
|
inputHtml: i,
|
|
13953
14082
|
originalTransformation: n,
|
|
13954
14083
|
output: { replacements: y },
|
|
@@ -13961,12 +14090,12 @@ async function gv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13961
14090
|
let { articleId: t, originalTransformation: n } = e;
|
|
13962
14091
|
if (t !== void 0) {
|
|
13963
14092
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(e, null, 2)}`);
|
|
13964
|
-
|
|
14093
|
+
Tv({
|
|
13965
14094
|
inputHtml: i,
|
|
13966
14095
|
originalTransformation: n,
|
|
13967
14096
|
output: { replacements: y },
|
|
13968
14097
|
replacementCounter: ee,
|
|
13969
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_article_externe" href="${
|
|
14098
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_article_externe" href="${bv(s, o, t)}">${e}</a>`
|
|
13970
14099
|
});
|
|
13971
14100
|
}
|
|
13972
14101
|
break;
|
|
@@ -13975,12 +14104,12 @@ async function gv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13975
14104
|
let { originalTransformation: t, sectionTaId: n } = e;
|
|
13976
14105
|
if (n !== void 0) {
|
|
13977
14106
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(e, null, 2)}`);
|
|
13978
|
-
|
|
14107
|
+
Tv({
|
|
13979
14108
|
inputHtml: i,
|
|
13980
14109
|
originalTransformation: t,
|
|
13981
14110
|
output: { replacements: y },
|
|
13982
14111
|
replacementCounter: ee,
|
|
13983
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_division_externe" href="${
|
|
14112
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_division_externe" href="${bv(s, o, n)}">${e}</a>`
|
|
13984
14113
|
});
|
|
13985
14114
|
}
|
|
13986
14115
|
break;
|
|
@@ -13992,12 +14121,12 @@ async function gv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13992
14121
|
continue;
|
|
13993
14122
|
}
|
|
13994
14123
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
13995
|
-
|
|
14124
|
+
Tv({
|
|
13996
14125
|
inputHtml: i,
|
|
13997
14126
|
originalTransformation: t,
|
|
13998
14127
|
output: { replacements: y },
|
|
13999
14128
|
replacementCounter: ee,
|
|
14000
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_texte_externe" href="${
|
|
14129
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_texte_externe" href="${bv(s, o, n.cid)}">${e}</a>`
|
|
14001
14130
|
});
|
|
14002
14131
|
break;
|
|
14003
14132
|
}
|
|
@@ -14005,7 +14134,7 @@ async function gv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
14005
14134
|
let { url: t, originalTransformation: n } = e;
|
|
14006
14135
|
if (t === void 0) continue;
|
|
14007
14136
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in european text link: ${JSON.stringify(e, null, 2)}`);
|
|
14008
|
-
|
|
14137
|
+
Tv({
|
|
14009
14138
|
inputHtml: i,
|
|
14010
14139
|
originalTransformation: n,
|
|
14011
14140
|
output: { replacements: y },
|
|
@@ -14017,7 +14146,7 @@ async function gv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
14017
14146
|
case "internal_article": {
|
|
14018
14147
|
let { definition: t, originalTransformation: n } = e;
|
|
14019
14148
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(e, null, 2)}`);
|
|
14020
|
-
|
|
14149
|
+
Tv({
|
|
14021
14150
|
inputHtml: i,
|
|
14022
14151
|
originalTransformation: n,
|
|
14023
14152
|
output: { replacements: y },
|
|
@@ -14029,7 +14158,7 @@ async function gv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
14029
14158
|
default: c("Link", e);
|
|
14030
14159
|
}
|
|
14031
14160
|
}, { count: te + 1 });
|
|
14032
|
-
let ne = h.timeSync("applyHtmlReplacements", () =>
|
|
14161
|
+
let ne = h.timeSync("applyHtmlReplacements", () => wv(i, y), {
|
|
14033
14162
|
count: y.length,
|
|
14034
14163
|
inputSize: i.length
|
|
14035
14164
|
});
|
|
@@ -14041,13 +14170,13 @@ async function gv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
14041
14170
|
output: y.length === 0 ? null : ne
|
|
14042
14171
|
};
|
|
14043
14172
|
}
|
|
14044
|
-
function
|
|
14173
|
+
function wv(e, t) {
|
|
14045
14174
|
if (t.length === 0) return e;
|
|
14046
14175
|
let n = [], r = 0;
|
|
14047
14176
|
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);
|
|
14048
14177
|
return n.push(e.slice(r)), n.join("");
|
|
14049
14178
|
}
|
|
14050
|
-
function
|
|
14179
|
+
function Tv({ inputHtml: e, originalTransformation: t, output: n, replacementCounter: r, tagHtmlFromOriginal: i }) {
|
|
14051
14180
|
let a = d(t, i(s(e, t, 0) ?? ""));
|
|
14052
14181
|
n.replacements.push({
|
|
14053
14182
|
order: r.value++,
|
|
@@ -14056,11 +14185,11 @@ function vv({ inputHtml: e, originalTransformation: t, output: n, replacementCou
|
|
|
14056
14185
|
stop: t.position.stop
|
|
14057
14186
|
});
|
|
14058
14187
|
}
|
|
14059
|
-
function
|
|
14188
|
+
function Ev({ attributes: e, inputHtml: t, originalTransformation: n, outputByType: r, replacementCounter: i }) {
|
|
14060
14189
|
let a = Object.entries(e).map(([e, t]) => `${e}="${et(t, !0)}"`).join(" ");
|
|
14061
14190
|
for (let e of ["links", "links_or_references"]) {
|
|
14062
14191
|
let o = r[e];
|
|
14063
|
-
o !== void 0 &&
|
|
14192
|
+
o !== void 0 && Tv({
|
|
14064
14193
|
inputHtml: t,
|
|
14065
14194
|
originalTransformation: n,
|
|
14066
14195
|
output: o,
|
|
@@ -14069,11 +14198,11 @@ function yv({ attributes: e, inputHtml: t, originalTransformation: n, outputByTy
|
|
|
14069
14198
|
});
|
|
14070
14199
|
}
|
|
14071
14200
|
}
|
|
14072
|
-
function
|
|
14201
|
+
function Dv({ id: e, outputByType: t }) {
|
|
14073
14202
|
return t.references !== void 0 || e === void 0 && t.links_or_references !== void 0;
|
|
14074
14203
|
}
|
|
14075
|
-
async function
|
|
14076
|
-
let h =
|
|
14204
|
+
async function Ov({ 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 }) {
|
|
14205
|
+
let h = xv(t, e);
|
|
14077
14206
|
await h.preloadTextTitlesInfos();
|
|
14078
14207
|
let g = new n(a.output), _ = {}, v = {};
|
|
14079
14208
|
for (let e of p) v[e] = {
|
|
@@ -14082,7 +14211,7 @@ async function xv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14082
14211
|
replacements: []
|
|
14083
14212
|
};
|
|
14084
14213
|
let y = { value: 0 };
|
|
14085
|
-
for await (let e of
|
|
14214
|
+
for await (let e of W_({
|
|
14086
14215
|
legiResolver: h,
|
|
14087
14216
|
context: g,
|
|
14088
14217
|
date: r,
|
|
@@ -14095,7 +14224,7 @@ async function xv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14095
14224
|
case "article_definition": {
|
|
14096
14225
|
let { article: t, originalTransformation: n, textId: r } = e;
|
|
14097
14226
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in article definition: ${JSON.stringify(e, null, 2)}`);
|
|
14098
|
-
for (let e of Object.values(v))
|
|
14227
|
+
for (let e of Object.values(v)) Tv({
|
|
14099
14228
|
inputHtml: o,
|
|
14100
14229
|
originalTransformation: n,
|
|
14101
14230
|
output: e,
|
|
@@ -14107,10 +14236,10 @@ async function xv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14107
14236
|
case "external_article": {
|
|
14108
14237
|
let { article: t, articleId: n, originalTransformation: r } = e;
|
|
14109
14238
|
if (r === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(e, null, 2)}`);
|
|
14110
|
-
if (n !== void 0 && (
|
|
14239
|
+
if (n !== void 0 && (Ev({
|
|
14111
14240
|
attributes: {
|
|
14112
14241
|
class: "lien_article_externe",
|
|
14113
|
-
href:
|
|
14242
|
+
href: bv(l, s, n)
|
|
14114
14243
|
},
|
|
14115
14244
|
inputHtml: o,
|
|
14116
14245
|
originalTransformation: r,
|
|
@@ -14120,14 +14249,14 @@ async function xv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14120
14249
|
let e = await h.getTextIdFromSegmentId(n);
|
|
14121
14250
|
e != null && (_[e] = (_[e] ?? 0) + 1);
|
|
14122
14251
|
}
|
|
14123
|
-
|
|
14252
|
+
Dv({
|
|
14124
14253
|
id: n,
|
|
14125
14254
|
outputByType: v
|
|
14126
|
-
}) &&
|
|
14255
|
+
}) && kv({
|
|
14127
14256
|
attributes: {
|
|
14128
14257
|
class: "reference_article",
|
|
14129
14258
|
style: "background-color: #eae462",
|
|
14130
|
-
title:
|
|
14259
|
+
title: Sv(t, e.reference)
|
|
14131
14260
|
},
|
|
14132
14261
|
id: n,
|
|
14133
14262
|
inputHtml: o,
|
|
@@ -14140,10 +14269,10 @@ async function xv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14140
14269
|
case "external_division": {
|
|
14141
14270
|
let { division: t, originalTransformation: n, sectionTaId: r } = e;
|
|
14142
14271
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(e, null, 2)}`);
|
|
14143
|
-
if (r !== void 0 && (
|
|
14272
|
+
if (r !== void 0 && (Ev({
|
|
14144
14273
|
attributes: {
|
|
14145
14274
|
class: "lien_division_externe",
|
|
14146
|
-
href:
|
|
14275
|
+
href: bv(l, s, r)
|
|
14147
14276
|
},
|
|
14148
14277
|
inputHtml: o,
|
|
14149
14278
|
originalTransformation: n,
|
|
@@ -14153,14 +14282,14 @@ async function xv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14153
14282
|
let e = await h.getTextIdFromSegmentId(r);
|
|
14154
14283
|
e != null && (_[e] = (_[e] ?? 0) + 1);
|
|
14155
14284
|
}
|
|
14156
|
-
|
|
14285
|
+
Dv({
|
|
14157
14286
|
id: r,
|
|
14158
14287
|
outputByType: v
|
|
14159
|
-
}) &&
|
|
14288
|
+
}) && kv({
|
|
14160
14289
|
attributes: {
|
|
14161
14290
|
class: "reference_division",
|
|
14162
14291
|
style: "background-color: #eae462",
|
|
14163
|
-
title:
|
|
14292
|
+
title: Sv(t, e.reference)
|
|
14164
14293
|
},
|
|
14165
14294
|
id: r,
|
|
14166
14295
|
inputHtml: o,
|
|
@@ -14173,7 +14302,7 @@ async function xv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14173
14302
|
case "european_text": {
|
|
14174
14303
|
let { url: t, originalTransformation: n, text: r, titleId: i } = e;
|
|
14175
14304
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14176
|
-
|
|
14305
|
+
Ev({
|
|
14177
14306
|
attributes: {
|
|
14178
14307
|
class: "lien_texte_european",
|
|
14179
14308
|
href: t,
|
|
@@ -14183,14 +14312,14 @@ async function xv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14183
14312
|
originalTransformation: n,
|
|
14184
14313
|
outputByType: v,
|
|
14185
14314
|
replacementCounter: y
|
|
14186
|
-
}),
|
|
14315
|
+
}), Dv({
|
|
14187
14316
|
id: i,
|
|
14188
14317
|
outputByType: v
|
|
14189
|
-
}) &&
|
|
14318
|
+
}) && kv({
|
|
14190
14319
|
attributes: {
|
|
14191
14320
|
class: "reference_texte",
|
|
14192
14321
|
style: "background-color: #eae462",
|
|
14193
|
-
title:
|
|
14322
|
+
title: Sv(r, e.reference)
|
|
14194
14323
|
},
|
|
14195
14324
|
id: i,
|
|
14196
14325
|
inputHtml: o,
|
|
@@ -14203,23 +14332,23 @@ async function xv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14203
14332
|
case "external_text": {
|
|
14204
14333
|
let { originalTransformation: t, text: n } = e;
|
|
14205
14334
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14206
|
-
n.cid === void 0 ? !n.present && d && console.error(`Link to text "${g.text(n.position)}" without CID: ${JSON.stringify(n, null, 2)}`) : (
|
|
14335
|
+
n.cid === void 0 ? !n.present && d && console.error(`Link to text "${g.text(n.position)}" without CID: ${JSON.stringify(n, null, 2)}`) : (Ev({
|
|
14207
14336
|
attributes: {
|
|
14208
14337
|
class: "lien_texte_externe",
|
|
14209
|
-
href:
|
|
14338
|
+
href: bv(l, s, n.cid)
|
|
14210
14339
|
},
|
|
14211
14340
|
inputHtml: o,
|
|
14212
14341
|
originalTransformation: t,
|
|
14213
14342
|
outputByType: v,
|
|
14214
14343
|
replacementCounter: y
|
|
14215
|
-
}), m && (_[n.cid] = (_[n.cid] ?? 0) + 1)),
|
|
14344
|
+
}), m && (_[n.cid] = (_[n.cid] ?? 0) + 1)), Dv({
|
|
14216
14345
|
id: n.cid,
|
|
14217
14346
|
outputByType: v
|
|
14218
|
-
}) &&
|
|
14347
|
+
}) && kv({
|
|
14219
14348
|
attributes: {
|
|
14220
14349
|
class: "reference_texte",
|
|
14221
14350
|
style: "background-color: #eae462",
|
|
14222
|
-
title:
|
|
14351
|
+
title: Sv(n, e.reference)
|
|
14223
14352
|
},
|
|
14224
14353
|
id: n.cid,
|
|
14225
14354
|
inputHtml: o,
|
|
@@ -14232,7 +14361,7 @@ async function xv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14232
14361
|
case "internal_article": {
|
|
14233
14362
|
let { definition: t, originalTransformation: n } = e;
|
|
14234
14363
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(e, null, 2)}`);
|
|
14235
|
-
for (let e of Object.values(v))
|
|
14364
|
+
for (let e of Object.values(v)) Tv({
|
|
14236
14365
|
inputHtml: o,
|
|
14237
14366
|
originalTransformation: n,
|
|
14238
14367
|
output: e,
|
|
@@ -14243,18 +14372,18 @@ async function xv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14243
14372
|
}
|
|
14244
14373
|
default: c("Link", e);
|
|
14245
14374
|
}
|
|
14246
|
-
for (let e of Object.values(v)) e.html =
|
|
14375
|
+
for (let e of Object.values(v)) e.html = wv(o, e.replacements);
|
|
14247
14376
|
return {
|
|
14248
14377
|
outputByType: v,
|
|
14249
14378
|
referredLegifranceTextCountByCid: _
|
|
14250
14379
|
};
|
|
14251
14380
|
}
|
|
14252
|
-
function
|
|
14381
|
+
function kv({ attributes: e, id: t, inputHtml: n, originalTransformation: r, outputByType: i, replacementCounter: a }) {
|
|
14253
14382
|
let o = Object.entries(e).map(([e, t]) => `${e}="${et(t, !0)}"`).join(" ");
|
|
14254
14383
|
for (let e of ["links_or_references", "references"]) {
|
|
14255
14384
|
if (e === "links_or_references" && t !== void 0) continue;
|
|
14256
14385
|
let s = i[e];
|
|
14257
|
-
s !== void 0 &&
|
|
14386
|
+
s !== void 0 && Tv({
|
|
14258
14387
|
inputHtml: n,
|
|
14259
14388
|
originalTransformation: r,
|
|
14260
14389
|
output: s,
|
|
@@ -14264,4 +14393,4 @@ function Sv({ attributes: e, id: t, inputHtml: n, originalTransformation: r, out
|
|
|
14264
14393
|
}
|
|
14265
14394
|
}
|
|
14266
14395
|
//#endregion
|
|
14267
|
-
export { Wp as $,
|
|
14396
|
+
export { Wp as $, Um as A, O as At, _m as B, ft as Bt, Qm as C, Rt as Ct, Km as D, ht as Dt, qm as E, mt as Et, Rm as F, rt as Ft, Kp as G, gm as H, lt as Ht, Am as I, it as It, Gp as J, qp as K, Om as L, at as Lt, Gm as M, tt as Mt, zm as N, nt as Nt, Bm as O, _t as Ot, Lm as P, ot as Pt, bp as Q, Em as R, ut as Rt, Ph as S, Dt as St, Ym as T, Ot as Tt, lm as U, ct as Ut, vm as V, st as Vt, $ as W, Rp as X, jp as Y, yp as Z, eg as _, qt as _t, gv as a, wn as at, Jh as b, Bt as bt, vv as c, fn as ct, U_ as d, rn as dt, dp as et, k_ as f, an as ft, A_ as g, Xt as gt, L_ as h, Qt as ht, bv as i, xn as it, Wm as j, xt as jt, Vm as k, D as kt, W_ as l, un as lt, j_ as m, sn as mt, Cv as n, _n as nt, _v as o, pn as ot, R_ as p, nn as pt, Zp as q, yv as r, vn as rt, hv as s, gn as st, Ov as t, Tn as tt, mv as u, tn as ut, Yh as v, Jt as vt, Jm as w, zt as wt, Fh as x, Vt as xt, Xh as y, Yt as yt, ym as z, dt as zt };
|