@tricoteuses/tisseuse 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{html-DfrdIKTl.js → html-Ds2IZ1nn.js} +2106 -2074
- package/dist/index.js +596 -327
- package/dist/server.js +1 -1
- package/dist/{lib → src/lib}/extractors/action_directives.d.ts +4 -3
- package/dist/{lib → src/lib}/extractors/article_portions.d.ts +1 -1
- package/dist/src/lib/extractors/definitions.d.ts +3 -0
- package/dist/{lib → src/lib}/extractors/links.d.ts +4 -4
- package/dist/{lib → src/lib}/extractors/references.d.ts +3 -3
- package/dist/{lib → src/lib}/extractors/table_of_contents.d.ts +4 -4
- package/dist/{lib → src/lib}/linkers/html.d.ts +4 -4
- package/dist/{lib → src/lib}/linkers/markdown.d.ts +2 -2
- package/dist/{lib → src/lib}/loaders/assemblee.d.ts +1 -1
- package/dist/{lib → src/lib}/loaders/legifrance.d.ts +1 -1
- package/dist/src/lib/server/auditors/config.d.ts +1 -0
- package/dist/{lib → src/lib}/server/config.d.ts +1 -1
- package/dist/{lib → src/lib}/server/linkers/html.d.ts +1 -1
- package/dist/{lib → src/lib}/server/text_parsers/transformers.d.ts +1 -1
- package/dist/{lib → src/lib}/text_parsers/numbers.d.ts +5 -0
- package/dist/src/scripts/simplify_word_html.d.ts +1 -0
- package/package.json +11 -9
- package/dist/lib/extractors/definitions.d.ts +0 -3
- package/dist/lib/server/auditors/config.d.ts +0 -4
- /package/dist/{lib → src/lib}/alineas/alineas_numbers.d.ts +0 -0
- /package/dist/{lib → src/lib}/articles.d.ts +0 -0
- /package/dist/{lib → src/lib}/articles.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/asserts.d.ts +0 -0
- /package/dist/{lib → src/lib}/cache.d.ts +0 -0
- /package/dist/{lib → src/lib}/dates.d.ts +0 -0
- /package/dist/{lib → src/lib}/extractors/action_directives.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/extractors/article_portions.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/extractors/links.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/extractors/references.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/index.d.ts +0 -0
- /package/dist/{lib → src/lib}/json.d.ts +0 -0
- /package/dist/{lib → src/lib}/links.d.ts +0 -0
- /package/dist/{lib → src/lib}/markdown.d.ts +0 -0
- /package/dist/{lib → src/lib}/server/alineas/alineas_images_utils.d.ts +0 -0
- /package/dist/{lib → src/lib}/server/databases/index.d.ts +0 -0
- /package/dist/{lib → src/lib}/server/html_simplifier.d.ts +0 -0
- /package/dist/{lib → src/lib}/server/html_simplifier.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/server/index.d.ts +0 -0
- /package/dist/{lib → src/lib}/server/tables_of_contents.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/actions.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/actions.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/articles.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/articles.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/ast.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/citations.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/citations.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/dates.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/dates.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/divisions.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/divisions.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/fragments.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/helpers.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/numbers.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/parsers.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/parsers.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/portions.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/portions.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/prepositions.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/prepositions.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/references.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/references.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/relative_locations.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/relative_locations.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/search_queries.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/search_queries.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/separators.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/simplifiers.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/simplifiers.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/texts.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/texts.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/transformers.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/typography.d.ts +0 -0
- /package/dist/{lib → src/lib}/text_parsers/typography.test.d.ts +0 -0
- /package/dist/{lib → src/lib}/textes.d.ts +0 -0
- /package/dist/{scripts → src/scripts}/add_links_to_assemblee_parsed_documents.d.ts +0 -0
- /package/dist/{scripts → src/scripts}/add_links_to_html_document.d.ts +0 -0
- /package/dist/{scripts → src/scripts}/add_links_to_legifrance.d.ts +0 -0
- /package/dist/{scripts → src/scripts}/add_links_to_senat_parsed_documents.d.ts +0 -0
- /package/dist/{scripts → src/scripts}/add_positions_to_table_of_contents.d.ts +0 -0
- /package/dist/{scripts → src/scripts}/add_references_to_html_document.d.ts +0 -0
- /package/dist/{scripts → src/scripts}/associate_jorf_textes_with_assemblee_commissions.d.ts +0 -0
- /package/dist/{scripts → src/scripts}/associate_jorf_textes_with_dossiers_legislatifs_assemblee.d.ts +0 -0
- /package/dist/{scripts → src/scripts}/configure.d.ts +0 -0
- /package/dist/{scripts → src/scripts}/enrich_assemblee_documents.d.ts +0 -0
- /package/dist/{scripts/extract_texts_titles_infos.d.ts → src/scripts/enrich_senat_documents.d.ts} +0 -0
- /package/dist/{scripts → src/scripts}/extract_alineas_images.d.ts +0 -0
- /package/dist/{scripts/html_document_to_text.d.ts → src/scripts/extract_texts_titles_infos.d.ts} +0 -0
- /package/dist/{scripts → src/scripts}/generate_alineas_numbers_review.d.ts +0 -0
- /package/dist/{scripts/simplified_html_bill_to_table_of_contents.d.ts → src/scripts/html_document_to_text.d.ts} +0 -0
- /package/dist/{scripts → src/scripts}/index_typesense.d.ts +0 -0
- /package/dist/{scripts → src/scripts}/merge_reviewed_alineas_numbers.d.ts +0 -0
- /package/dist/{scripts → src/scripts}/set_articles_missing_num.d.ts +0 -0
- /package/dist/{scripts/simplify_word_html.d.ts → src/scripts/simplified_html_bill_to_table_of_contents.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as e, $t as t, A as n, An as r, At as i, B as a, Bt as o, C as s, Cn as c, Ct as l, D as u, Dn as d, Dt as f, E as p, En as m, Et as
|
|
1
|
+
import { $ as e, $t as t, A as n, An as r, At as i, B as a, Bt as o, C as s, Cn as c, Ct as l, D as u, Dn as d, Dt as f, E as p, En as m, Et as h, F as g, Fn as _, Ft as ee, G as te, Gt as ne, H as re, Ht as ie, I as ae, In as v, It as oe, J as se, Jt as ce, K as le, Kt as ue, L as de, Lt as y, M as fe, Mn as pe, Mt as b, N as me, Nn as he, Nt as ge, O as _e, On as ve, Ot as ye, P as be, Pn as xe, Pt as Se, Q as Ce, Qt as we, R as Te, Rt as Ee, S as De, Sn as x, St as Oe, T as ke, Tn as Ae, Tt as je, U as Me, Ut as Ne, V as Pe, Vt as S, W as Fe, Wt as Ie, X as Le, Xt as Re, Y as ze, Yt as Be, Z as Ve, Zt as He, _ as C, _n as w, _t as Ue, a as We, an as Ge, at as Ke, b as qe, bn as T, bt as Je, c as Ye, cn as Xe, ct as Ze, d as Qe, dn as $e, dt as et, en as tt, et as nt, f as rt, fn as it, ft as at, g as ot, gn as E, gt as st, h as ct, hn as lt, ht as ut, i as D, in as dt, it as ft, j as O, jn as pt, jt as mt, k as ht, kn as k, kt as gt, l as _t, ln as vt, lt as yt, m as bt, mn as xt, mt as St, n as Ct, nn as wt, nt as Tt, o as Et, on as Dt, ot as Ot, p as kt, pn as At, pt as jt, q as Mt, qt as Nt, r as Pt, rn as Ft, rt as It, s as Lt, sn as Rt, st as zt, t as Bt, tn as Vt, tt as Ht, u as Ut, un as Wt, ut as Gt, v as Kt, vn as A, vt as qt, w as Jt, wn as Yt, wt as Xt, x as Zt, xn as Qt, xt as $t, y as en, yn as tn, yt as nn, z as rn, zt as an } from "./html-Ds2IZ1nn.js";
|
|
2
2
|
//#region ../../node_modules/@tricoteuses/legifrance/dist/legal/index.js
|
|
3
3
|
function on(e, t) {
|
|
4
4
|
if (e != null) {
|
|
@@ -7,53 +7,53 @@ function on(e, t) {
|
|
|
7
7
|
return e[0];
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
function*
|
|
11
|
-
yield e, e.TM !== void 0 && (yield*
|
|
10
|
+
function* j(e) {
|
|
11
|
+
yield e, e.TM !== void 0 && (yield* j(e.TM));
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/lib/articles.ts
|
|
15
|
-
var
|
|
15
|
+
var M = ["2222-02-22", "2999-01-01"], sn = (e) => {
|
|
16
16
|
if (e !== void 0) for (let t = 0; t < e.length; ++t) {
|
|
17
|
-
let n =
|
|
17
|
+
let n = tt(new E(e, t));
|
|
18
18
|
if (typeof n == "string") return n;
|
|
19
19
|
}
|
|
20
20
|
}, cn = (e) => (e === void 0 ? [] : Array.isArray(e) ? e : [e]).map((e) => sn(e["#text"])).find((e) => e !== void 0), ln = (e) => {
|
|
21
21
|
let t = e.META.META_SPEC.META_ARTICLE.DATE_DEBUT;
|
|
22
|
-
if (t !== void 0 && !
|
|
23
|
-
let n = e.CONTEXTE.TEXTE, r = n.TITRE_TXT, i = [...r === void 0 ? [] : (Array.isArray(r) ? r : [r]).map((e) => e["@debut"]), ...n.TM === void 0 ? [] :
|
|
22
|
+
if (t !== void 0 && !M.includes(t)) return t;
|
|
23
|
+
let n = e.CONTEXTE.TEXTE, r = n.TITRE_TXT, i = [...r === void 0 ? [] : (Array.isArray(r) ? r : [r]).map((e) => e["@debut"]), ...n.TM === void 0 ? [] : j(n.TM).map((e) => (Array.isArray(e.TITRE_TM) ? e.TITRE_TM : [e.TITRE_TM]).map((e) => e["@debut"])).toArray().flat()].filter((e) => !M.includes(e));
|
|
24
24
|
if (i.length > 0) return i.sort().at(-1);
|
|
25
25
|
let a = n["@date_publi"];
|
|
26
|
-
if (a !== void 0 && !
|
|
26
|
+
if (a !== void 0 && !M.includes(a)) return a;
|
|
27
27
|
let o = n["@date_signature"];
|
|
28
|
-
if (o !== void 0 && !
|
|
28
|
+
if (o !== void 0 && !M.includes(o)) return o;
|
|
29
29
|
let s = e.META.META_SPEC.META_ARTICLE.DATE_FIN;
|
|
30
|
-
if (s !== void 0 && !
|
|
30
|
+
if (s !== void 0 && !M.includes(s)) return s;
|
|
31
31
|
let c = cn(r);
|
|
32
32
|
if (c !== void 0) return c;
|
|
33
|
-
if (
|
|
33
|
+
if (M.includes(t ?? "")) return t;
|
|
34
34
|
throw Error(`Missing date signature in article ${e.META.META_COMMUN.ID}`);
|
|
35
|
-
},
|
|
35
|
+
}, N = (e) => {
|
|
36
36
|
let t = e.META.META_SPEC.META_ARTICLE.DATE_DEBUT;
|
|
37
|
-
if (t !== void 0 && !
|
|
37
|
+
if (t !== void 0 && !M.includes(t)) return t;
|
|
38
38
|
let n = e.CONTEXTE.TEXTE, r = n["@date_signature"];
|
|
39
|
-
if (r !== void 0 && !
|
|
39
|
+
if (r !== void 0 && !M.includes(r)) return r;
|
|
40
40
|
let i = n["@date_publi"];
|
|
41
|
-
if (i !== void 0 && !
|
|
42
|
-
let a = n.TITRE_TXT, o = [...a === void 0 ? [] : (Array.isArray(a) ? a : [a]).map((e) => e["@debut"]), ...n.TM === void 0 ? [] :
|
|
41
|
+
if (i !== void 0 && !M.includes(i)) return i;
|
|
42
|
+
let a = n.TITRE_TXT, o = [...a === void 0 ? [] : (Array.isArray(a) ? a : [a]).map((e) => e["@debut"]), ...n.TM === void 0 ? [] : j(n.TM).map((e) => (Array.isArray(e.TITRE_TM) ? e.TITRE_TM : [e.TITRE_TM]).map((e) => e["@debut"])).toArray().flat()].filter((e) => !M.includes(e));
|
|
43
43
|
if (o.length > 0) return o.sort().at(-1);
|
|
44
44
|
let s = e.META.META_SPEC.META_ARTICLE.DATE_FIN;
|
|
45
|
-
if (s !== void 0 && !
|
|
45
|
+
if (s !== void 0 && !M.includes(s)) return s;
|
|
46
46
|
let c = cn(a);
|
|
47
47
|
if (c !== void 0) return c;
|
|
48
|
-
if (
|
|
48
|
+
if (M.includes(t ?? "")) return t;
|
|
49
49
|
throw Error(`Missing date signature in article ${e.META.META_COMMUN.ID}`);
|
|
50
50
|
};
|
|
51
51
|
async function un(e, t, n, r) {
|
|
52
|
-
let i = await
|
|
52
|
+
let i = await d(e, t, n);
|
|
53
53
|
if (i === void 0) return;
|
|
54
|
-
let a =
|
|
54
|
+
let a = N(i), o = i.META.META_COMMUN.ORIGINE, s = i.CONTEXTE.TEXTE;
|
|
55
55
|
if (s.TM === void 0) return;
|
|
56
|
-
let c =
|
|
56
|
+
let c = j(s.TM).toArray().reverse(), l;
|
|
57
57
|
switch (o) {
|
|
58
58
|
case "JORF":
|
|
59
59
|
l = c.map((e) => e.TITRE_TM["@id"]);
|
|
@@ -61,14 +61,14 @@ async function un(e, t, n, r) {
|
|
|
61
61
|
case "LEGI":
|
|
62
62
|
l = c.map((e) => on(e.TITRE_TM, a)?.["@id"]);
|
|
63
63
|
break;
|
|
64
|
-
default:
|
|
64
|
+
default: v("getOrLoadArticleSiblingId origine", o);
|
|
65
65
|
}
|
|
66
|
-
return await (r === -1 ?
|
|
66
|
+
return await (r === -1 ? I : F)(e, t, n, a, i.num, l);
|
|
67
67
|
}
|
|
68
68
|
async function dn(e, t, n, r, i, a) {
|
|
69
69
|
let o = r[n];
|
|
70
70
|
if (o === void 0) {
|
|
71
|
-
let s = await
|
|
71
|
+
let s = await k(e, t, n);
|
|
72
72
|
if (s === void 0) return;
|
|
73
73
|
let c = s.STRUCTURE_TA;
|
|
74
74
|
if (c === void 0) return;
|
|
@@ -96,8 +96,8 @@ async function dn(e, t, n, r, i, a) {
|
|
|
96
96
|
}
|
|
97
97
|
return o;
|
|
98
98
|
}
|
|
99
|
-
async function
|
|
100
|
-
let r = await
|
|
99
|
+
async function P(e, t, n) {
|
|
100
|
+
let r = await k(e, t, n);
|
|
101
101
|
if (r === void 0) return;
|
|
102
102
|
let i = r.STRUCTURE_TA;
|
|
103
103
|
if (i === void 0) return;
|
|
@@ -105,86 +105,86 @@ async function fn(e, t, n) {
|
|
|
105
105
|
if (a !== void 0) return a[0]["@id"];
|
|
106
106
|
let o = i.LIEN_SECTION_TA;
|
|
107
107
|
if (o !== void 0) for (let n of o) {
|
|
108
|
-
let r = await
|
|
108
|
+
let r = await P(e, t, n["@id"]);
|
|
109
109
|
if (r !== void 0) return r;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
async function
|
|
113
|
-
let r = await
|
|
112
|
+
async function fn(e, t, n) {
|
|
113
|
+
let r = await k(e, t, n);
|
|
114
114
|
if (r === void 0) return;
|
|
115
115
|
let i = r.STRUCTURE_TA;
|
|
116
116
|
if (i === void 0) return;
|
|
117
117
|
let a = i.LIEN_SECTION_TA;
|
|
118
118
|
if (a !== void 0) for (let n of a.toReversed()) {
|
|
119
|
-
let r = await
|
|
119
|
+
let r = await fn(e, t, n["@id"]);
|
|
120
120
|
if (r !== void 0) return r;
|
|
121
121
|
}
|
|
122
122
|
return i.LIEN_ART?.at(-1)?.["@id"];
|
|
123
123
|
}
|
|
124
|
-
async function
|
|
124
|
+
async function F(e, t, n, r, i, a, o = 0, s = {}, c = void 0) {
|
|
125
125
|
let l = a[o];
|
|
126
126
|
if (l === void 0) return;
|
|
127
127
|
let u = await dn(e, t, l, s, n, c);
|
|
128
128
|
if (u === void 0) return;
|
|
129
|
-
let { area:
|
|
130
|
-
switch (
|
|
129
|
+
let { area: f, index: p, sectionTa: m } = u, h = m.STRUCTURE_TA;
|
|
130
|
+
switch (f) {
|
|
131
131
|
case "LIEN_ART": {
|
|
132
|
-
let c =
|
|
133
|
-
for (let n =
|
|
132
|
+
let c = h.LIEN_ART;
|
|
133
|
+
for (let n = p + 1; n < c.length; n++) {
|
|
134
134
|
let a = c[n];
|
|
135
135
|
if (a["@num"] !== i) {
|
|
136
|
-
let n = await
|
|
137
|
-
if (n !== void 0 &&
|
|
136
|
+
let n = await d(e, t, a["@id"]);
|
|
137
|
+
if (n !== void 0 && N(n) <= r) return a["@id"];
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
let u =
|
|
140
|
+
let u = h.LIEN_SECTION_TA;
|
|
141
141
|
if (u !== void 0) for (let n of u) {
|
|
142
|
-
let r = await
|
|
142
|
+
let r = await P(e, t, n["@id"]);
|
|
143
143
|
if (r !== void 0) return r;
|
|
144
144
|
}
|
|
145
|
-
return await
|
|
145
|
+
return await F(e, t, n, r, i, a, o + 1, s, l);
|
|
146
146
|
}
|
|
147
147
|
case "LIEN_SECTION_TA": {
|
|
148
|
-
let c =
|
|
149
|
-
for (let n =
|
|
150
|
-
let r = await
|
|
148
|
+
let c = h.LIEN_SECTION_TA;
|
|
149
|
+
for (let n = p + 1; n < c.length; n++) {
|
|
150
|
+
let r = await P(e, t, c[n]["@id"]);
|
|
151
151
|
if (r !== void 0) return r;
|
|
152
152
|
}
|
|
153
|
-
return await
|
|
153
|
+
return await F(e, t, n, r, i, a, o + 1, s, l);
|
|
154
154
|
}
|
|
155
|
-
default:
|
|
155
|
+
default: v("moveToNextArticleId area", f);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
async function
|
|
158
|
+
async function I(e, t, n, r, i, a, o = 0, s = {}, c = void 0) {
|
|
159
159
|
let l = a[o];
|
|
160
160
|
if (l === void 0) return;
|
|
161
161
|
let u = await dn(e, t, l, s, n, c);
|
|
162
162
|
if (u === void 0) return;
|
|
163
|
-
let { area:
|
|
164
|
-
switch (
|
|
163
|
+
let { area: f, index: p, sectionTa: m } = u, h = m.STRUCTURE_TA;
|
|
164
|
+
switch (f) {
|
|
165
165
|
case "LIEN_ART": {
|
|
166
|
-
let c =
|
|
167
|
-
for (let n =
|
|
166
|
+
let c = h.LIEN_ART;
|
|
167
|
+
for (let n = p - 1; n >= 0; n--) {
|
|
168
168
|
let a = c[n];
|
|
169
169
|
if (a["@num"] !== i) {
|
|
170
|
-
let n = await
|
|
171
|
-
if (n !== void 0 &&
|
|
170
|
+
let n = await d(e, t, a["@id"]);
|
|
171
|
+
if (n !== void 0 && N(n) <= r) return a["@id"];
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
return await
|
|
174
|
+
return await I(e, t, n, r, i, a, o + 1, s, l);
|
|
175
175
|
}
|
|
176
176
|
case "LIEN_SECTION_TA": {
|
|
177
|
-
for (let n =
|
|
178
|
-
let r = await
|
|
177
|
+
for (let n = p - 1; n >= 0; n--) {
|
|
178
|
+
let r = await fn(e, t, h.LIEN_SECTION_TA[n]["@id"]);
|
|
179
179
|
if (r !== void 0) return r;
|
|
180
180
|
}
|
|
181
|
-
let c =
|
|
182
|
-
return c === void 0 ? await
|
|
181
|
+
let c = h.LIEN_ART;
|
|
182
|
+
return c === void 0 ? await I(e, t, n, r, i, a, o + 1, s, l) : (u.area = "LIEN_ART", u.index = c.length, await I(e, t, n, r, i, a, o, s));
|
|
183
183
|
}
|
|
184
|
-
default:
|
|
184
|
+
default: v("moveToPreviousArticleId area", f);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
var
|
|
187
|
+
var pn = (e) => (t, n) => {
|
|
188
188
|
let r = e(t), i = e(n);
|
|
189
189
|
if (r !== i) return r.localeCompare(i);
|
|
190
190
|
let a = t.META.META_COMMUN, o = a.ORIGINE, s = n.META.META_COMMUN, c = s.ORIGINE;
|
|
@@ -203,13 +203,13 @@ var mn = (e) => (t, n) => {
|
|
|
203
203
|
if (m <= i) return 1;
|
|
204
204
|
}
|
|
205
205
|
throw Error(`TODO: Unable to sort articles ${a.ID} & ${s.ID} by date.`);
|
|
206
|
-
},
|
|
207
|
-
function
|
|
208
|
-
return
|
|
206
|
+
}, mn = new Intl.DateTimeFormat("fr-FR", { dateStyle: "long" });
|
|
207
|
+
function hn(e) {
|
|
208
|
+
return mn.format(new Date(e)).replace(/^1 /, "1er ");
|
|
209
209
|
}
|
|
210
210
|
//#endregion
|
|
211
211
|
//#region src/lib/extractors/article_portions.ts
|
|
212
|
-
var
|
|
212
|
+
var L = new RegExp(String.raw`^\s*([IVXLCDM]+|[A-Z]|[a-z]|\d+)(?:\s+(?:${Ge}))?(?:\s*(?:°|\.|\)|-|–|—))+(?:\s+(?:${Ge}))?(?:\s+|(?=[\p{L}\p{N}]))`, "iu"), gn = /^\s*(partie|livre|titre|sous-titre|chapitre|section|sous-section|paragraphe|sous-paragraphe|sous-sous-paragraphe)\s+([IVXLCDM]+|[A-Z]|\d+)(?:\s*(?:°|\.|\)|-))?\s*/iu, _n = /^(partie|livre|titre|sous-titre|chapitre|section|sous-section|paragraphe|sous-paragraphe|sous-sous-paragraphe)\b/i, vn = {
|
|
213
213
|
partie: 0,
|
|
214
214
|
livre: 1,
|
|
215
215
|
titre: 2,
|
|
@@ -221,9 +221,16 @@ var P = /^\s*([IVXLCDM]+|[A-Z]|[a-z]|\d+)(?:\s*(?:°|\.|\)|-|–|—))+(?:\s+|(?
|
|
|
221
221
|
"sous-paragraphe": 8,
|
|
222
222
|
"sous-sous-paragraphe": 9
|
|
223
223
|
};
|
|
224
|
-
function
|
|
224
|
+
function R(e) {
|
|
225
225
|
return /^[IVXLCDM]+$/i.test(e);
|
|
226
226
|
}
|
|
227
|
+
function yn(e) {
|
|
228
|
+
let t = Qt(e, Ue);
|
|
229
|
+
return t && typeof t == "object" && t.type === "item" && typeof t.index == "number" && typeof t.num == "string" ? {
|
|
230
|
+
num: t.num,
|
|
231
|
+
index: t.index
|
|
232
|
+
} : null;
|
|
233
|
+
}
|
|
227
234
|
function bn(e) {
|
|
228
235
|
let t = {
|
|
229
236
|
I: 1,
|
|
@@ -241,15 +248,26 @@ function bn(e) {
|
|
|
241
248
|
}
|
|
242
249
|
return n || void 0;
|
|
243
250
|
}
|
|
244
|
-
function
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
function z(e) {
|
|
252
|
+
let t = e.trim(), n = t.split(/\s+/), r = n[0] ? n[0].replace(/[^\p{L}\p{N}]+/gu, "") : t, i = n.length > 1 ? n.slice(1).join(" ") : void 0, a = (() => {
|
|
253
|
+
if (/^\d+$/.test(r)) return Number(r);
|
|
254
|
+
if (/^[A-Z]$/i.test(r)) return r.toLowerCase().charCodeAt(0) - 97 + 1;
|
|
255
|
+
if (R(r)) return bn(r);
|
|
256
|
+
})();
|
|
257
|
+
if (a === void 0) return;
|
|
258
|
+
if (!i) return a;
|
|
259
|
+
let o = Qt(i, dt);
|
|
260
|
+
if (o && typeof o == "object" && "value" in o) {
|
|
261
|
+
let e = o.value;
|
|
262
|
+
if (typeof e == "number") return a + e / 1e3;
|
|
263
|
+
}
|
|
264
|
+
return a;
|
|
248
265
|
}
|
|
249
266
|
function xn(e) {
|
|
250
|
-
|
|
267
|
+
let t = e.trim().split(/\s+/)[0] ?? e, n = t.replace(/[^\p{L}\p{N}]+/gu, "");
|
|
268
|
+
return /^[ivxlcdm]+$/.test(n) && (n.length > 1 || /^[ivx]$/.test(n)) ? 105 : /^[A-Z]$/.test(n) ? 101 : /^\d+$/.test(n) && /°/.test(t) ? 103 : /^\d+$/.test(n) ? 102 : /^[a-z]$/.test(n) ? 104 : R(n) ? 100 : 105;
|
|
251
269
|
}
|
|
252
|
-
function
|
|
270
|
+
function B(e) {
|
|
253
271
|
return e.children.filter((e) => e.type === "alinéa").length + 1;
|
|
254
272
|
}
|
|
255
273
|
function Sn(t) {
|
|
@@ -283,36 +301,36 @@ function Sn(t) {
|
|
|
283
301
|
let l = (e, n, r) => {
|
|
284
302
|
let a = e, o = n;
|
|
285
303
|
for (;;) {
|
|
286
|
-
let e = o.match(
|
|
304
|
+
let e = o.match(L);
|
|
287
305
|
if (!e) break;
|
|
288
|
-
let t = e[
|
|
306
|
+
let t = yn(e[0]), n = t?.num ?? e[1], r = {
|
|
289
307
|
type: "item",
|
|
290
|
-
index:
|
|
291
|
-
num:
|
|
308
|
+
index: t?.index ?? z(n),
|
|
309
|
+
num: n,
|
|
292
310
|
label: void 0,
|
|
293
311
|
children: []
|
|
294
312
|
};
|
|
295
|
-
a.children.push(
|
|
296
|
-
level: xn(
|
|
297
|
-
node:
|
|
298
|
-
}), a =
|
|
313
|
+
a.children.push(r), i.push({
|
|
314
|
+
level: xn(n),
|
|
315
|
+
node: r
|
|
316
|
+
}), a = r, o = o.slice(e[0].length).trim();
|
|
299
317
|
}
|
|
300
318
|
o && a.children.push({
|
|
301
319
|
type: "alinéa",
|
|
302
|
-
index:
|
|
320
|
+
index: B(a),
|
|
303
321
|
text: o,
|
|
304
322
|
html: r,
|
|
305
323
|
paragraphIndex: t
|
|
306
324
|
});
|
|
307
325
|
};
|
|
308
326
|
for (let e of c) {
|
|
309
|
-
let n = e.text, a = n.match(
|
|
327
|
+
let n = e.text, a = n.match(gn);
|
|
310
328
|
if (a) {
|
|
311
|
-
let o = a[1].toLowerCase(), s = a[2], c =
|
|
329
|
+
let o = a[1].toLowerCase(), s = a[2], c = vn[o];
|
|
312
330
|
for (; i.length > 0 && i[i.length - 1].level >= c;) i.pop();
|
|
313
331
|
let u = i[i.length - 1]?.node ?? r, d = {
|
|
314
332
|
type: o,
|
|
315
|
-
index:
|
|
333
|
+
index: z(s),
|
|
316
334
|
num: s,
|
|
317
335
|
label: void 0,
|
|
318
336
|
children: []
|
|
@@ -322,35 +340,35 @@ function Sn(t) {
|
|
|
322
340
|
node: d
|
|
323
341
|
});
|
|
324
342
|
let f = n.slice(a[0].length).trim();
|
|
325
|
-
f && (
|
|
343
|
+
f && (_n.test(f) ? d.label = f : L.test(f) ? l(d, f, e.html) : d.children.push({
|
|
326
344
|
type: "alinéa",
|
|
327
|
-
index:
|
|
345
|
+
index: B(d),
|
|
328
346
|
text: f,
|
|
329
347
|
html: e.html,
|
|
330
348
|
paragraphIndex: t
|
|
331
349
|
}));
|
|
332
350
|
continue;
|
|
333
351
|
}
|
|
334
|
-
let o = n.match(
|
|
352
|
+
let o = n.match(L);
|
|
335
353
|
if (o) {
|
|
336
|
-
let a = o[
|
|
337
|
-
for (; i.length > 0 && i[i.length - 1].level >=
|
|
338
|
-
let
|
|
354
|
+
let a = yn(o[0]), s = a?.num ?? o[1], c = xn(s);
|
|
355
|
+
for (; i.length > 0 && i[i.length - 1].level >= c;) i.pop();
|
|
356
|
+
let u = i[i.length - 1]?.node ?? r, d = {
|
|
339
357
|
type: "item",
|
|
340
|
-
index:
|
|
341
|
-
num:
|
|
358
|
+
index: a?.index ?? z(s),
|
|
359
|
+
num: s,
|
|
342
360
|
label: void 0,
|
|
343
361
|
children: []
|
|
344
362
|
};
|
|
345
|
-
|
|
346
|
-
level:
|
|
347
|
-
node:
|
|
363
|
+
u.children.push(d), i.push({
|
|
364
|
+
level: c,
|
|
365
|
+
node: d
|
|
348
366
|
});
|
|
349
|
-
let
|
|
350
|
-
|
|
367
|
+
let f = n.slice(o[0].length).trim();
|
|
368
|
+
f && (_n.test(f) ? d.label = f : L.test(f) ? l(d, f, e.html) : d.children.push({
|
|
351
369
|
type: "alinéa",
|
|
352
|
-
index:
|
|
353
|
-
text:
|
|
370
|
+
index: B(d),
|
|
371
|
+
text: f,
|
|
354
372
|
html: e.html,
|
|
355
373
|
paragraphIndex: t
|
|
356
374
|
}));
|
|
@@ -359,7 +377,7 @@ function Sn(t) {
|
|
|
359
377
|
let s = i[i.length - 1]?.node ?? r;
|
|
360
378
|
s.children.push({
|
|
361
379
|
type: "alinéa",
|
|
362
|
-
index:
|
|
380
|
+
index: B(s),
|
|
363
381
|
text: n,
|
|
364
382
|
html: e.html,
|
|
365
383
|
paragraphIndex: t
|
|
@@ -367,8 +385,8 @@ function Sn(t) {
|
|
|
367
385
|
}
|
|
368
386
|
}), r;
|
|
369
387
|
}
|
|
370
|
-
function
|
|
371
|
-
return e.type === "parent-enfant" ? [...
|
|
388
|
+
function V(e) {
|
|
389
|
+
return e.type === "parent-enfant" ? [...V(e.parent), ...V(e.child)] : ne(e) && (ue(e) || Nt(e)) ? [{
|
|
372
390
|
type: e.type,
|
|
373
391
|
index: e.index,
|
|
374
392
|
num: e.num,
|
|
@@ -376,10 +394,41 @@ function R(e) {
|
|
|
376
394
|
present: e.present
|
|
377
395
|
}] : [];
|
|
378
396
|
}
|
|
379
|
-
function
|
|
380
|
-
if (e.type === "reference_et_action") return
|
|
397
|
+
function H(e) {
|
|
398
|
+
if (e.type === "reference_et_action") return H(e.reference);
|
|
399
|
+
if (e.type === "parent-enfant") {
|
|
400
|
+
let t = H(e.parent), n = H(e.child);
|
|
401
|
+
if (t.length === 0) return n;
|
|
402
|
+
if (n.length === 0) return t;
|
|
403
|
+
let r = [];
|
|
404
|
+
for (let e of t) for (let t of n) {
|
|
405
|
+
if (e.kind === "single" && t.kind === "single") {
|
|
406
|
+
r.push({
|
|
407
|
+
kind: "single",
|
|
408
|
+
steps: [...e.steps, ...t.steps]
|
|
409
|
+
});
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
if (e.kind === "single" && t.kind === "range") {
|
|
413
|
+
r.push({
|
|
414
|
+
kind: "range",
|
|
415
|
+
first: [...e.steps, ...t.first],
|
|
416
|
+
last: [...e.steps, ...t.last],
|
|
417
|
+
count: t.count
|
|
418
|
+
});
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
e.kind === "range" && t.kind === "single" && r.push({
|
|
422
|
+
kind: "range",
|
|
423
|
+
first: [...e.first, ...t.steps],
|
|
424
|
+
last: [...e.last, ...t.steps],
|
|
425
|
+
count: e.count
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
return r;
|
|
429
|
+
}
|
|
381
430
|
if (e.type === "bounded-interval") {
|
|
382
|
-
let t =
|
|
431
|
+
let t = V(e.first), n = V(e.last);
|
|
383
432
|
return t.length === 0 || n.length === 0 ? [] : [{
|
|
384
433
|
kind: "range",
|
|
385
434
|
first: t,
|
|
@@ -387,7 +436,7 @@ function z(e) {
|
|
|
387
436
|
}];
|
|
388
437
|
}
|
|
389
438
|
if (e.type === "counted-interval") {
|
|
390
|
-
let t =
|
|
439
|
+
let t = V(e.first);
|
|
391
440
|
return t.length === 0 ? [] : [{
|
|
392
441
|
kind: "range",
|
|
393
442
|
first: t,
|
|
@@ -395,16 +444,16 @@ function z(e) {
|
|
|
395
444
|
count: e.count
|
|
396
445
|
}];
|
|
397
446
|
}
|
|
398
|
-
if (e.type === "enumeration") return [...
|
|
399
|
-
if (e.type === "exclusion") return
|
|
400
|
-
let t =
|
|
447
|
+
if (e.type === "enumeration") return [...H(e.left), ...H(e.right)];
|
|
448
|
+
if (e.type === "exclusion") return H(e.left);
|
|
449
|
+
let t = V(e);
|
|
401
450
|
return t.length === 0 ? [] : [{
|
|
402
451
|
kind: "single",
|
|
403
452
|
steps: t
|
|
404
453
|
}];
|
|
405
454
|
}
|
|
406
455
|
function Cn(e) {
|
|
407
|
-
let t =
|
|
456
|
+
let t = H(e);
|
|
408
457
|
if (t.length === 0) return t;
|
|
409
458
|
let n = t[0];
|
|
410
459
|
if (n?.kind === "single" && n.steps.length > 1) {
|
|
@@ -417,18 +466,17 @@ function Cn(e) {
|
|
|
417
466
|
return t;
|
|
418
467
|
}
|
|
419
468
|
function wn(e, t) {
|
|
420
|
-
if (t.index !== void 0 && e.index !== void 0) return t.index === e.index;
|
|
421
469
|
if (t.num !== void 0 && e.num !== void 0) {
|
|
422
|
-
let n = (e) => e.toLowerCase().replace(/[
|
|
423
|
-
|
|
470
|
+
let n = (e) => e.toLowerCase().replace(/[.)]/g, "").trim();
|
|
471
|
+
if (n(t.num) !== n(e.num)) return !1;
|
|
424
472
|
}
|
|
425
|
-
return
|
|
473
|
+
return t.index !== void 0 && e.index !== void 0 ? t.index === e.index : t.num !== void 0 && e.num !== void 0;
|
|
426
474
|
}
|
|
427
475
|
function Tn(e, t) {
|
|
428
|
-
let n = (e) => "children" in e && (e.type === "article" || e.type === "item" ||
|
|
429
|
-
if (
|
|
476
|
+
let n = (e) => "children" in e && (e.type === "article" || e.type === "item" || S.includes(e.type)) ? e.children : [], r = (e) => e.type === "alinéa" ? [e] : e.type === "article" || e.type === "item" || S.includes(e.type) ? e.children.flatMap(r) : [];
|
|
477
|
+
if (S.includes(t.type)) {
|
|
430
478
|
let r = n(e);
|
|
431
|
-
for (let e of r) if (
|
|
479
|
+
for (let e of r) if (S.includes(e.type) && e.type === t.type && wn(e, t)) return {
|
|
432
480
|
node: e,
|
|
433
481
|
path: [e]
|
|
434
482
|
};
|
|
@@ -467,29 +515,34 @@ function Tn(e, t) {
|
|
|
467
515
|
return null;
|
|
468
516
|
}
|
|
469
517
|
if (t.type === "phrase") {
|
|
470
|
-
if (
|
|
471
|
-
let
|
|
472
|
-
if (
|
|
473
|
-
let
|
|
518
|
+
if (t.index === void 0) return null;
|
|
519
|
+
let r = e.type === "alinéa" ? [e] : n(e).filter((e) => e.type === "alinéa");
|
|
520
|
+
if (r.length === 0) return null;
|
|
521
|
+
let i = r.flatMap((e) => e.text.split(/(?<=[.!?;:])\s+/).map((e) => e.trim()).filter(Boolean).map((t) => ({
|
|
522
|
+
alinea: e,
|
|
523
|
+
text: t
|
|
524
|
+
}))), a = t.index, o = a < 0 ? i.length + a + 1 : a;
|
|
525
|
+
if (o < 1 || o > i.length) return null;
|
|
526
|
+
let s = i[o - 1];
|
|
474
527
|
return {
|
|
475
528
|
node: {
|
|
476
529
|
type: "alinéa",
|
|
477
|
-
index:
|
|
478
|
-
text:
|
|
479
|
-
html:
|
|
480
|
-
paragraphIndex:
|
|
530
|
+
index: s.alinea.index,
|
|
531
|
+
text: s.text,
|
|
532
|
+
html: s.alinea.html,
|
|
533
|
+
paragraphIndex: s.alinea.paragraphIndex
|
|
481
534
|
},
|
|
482
|
-
path: [
|
|
535
|
+
path: [s.alinea]
|
|
483
536
|
};
|
|
484
537
|
}
|
|
485
538
|
return null;
|
|
486
539
|
}
|
|
487
|
-
function
|
|
540
|
+
function U(e, t) {
|
|
488
541
|
if (t.kind === "range") {
|
|
489
|
-
let n =
|
|
542
|
+
let n = U(e, {
|
|
490
543
|
kind: "single",
|
|
491
544
|
steps: t.first
|
|
492
|
-
}), r =
|
|
545
|
+
}), r = U(e, {
|
|
493
546
|
kind: "single",
|
|
494
547
|
steps: t.last
|
|
495
548
|
});
|
|
@@ -515,11 +568,11 @@ function B(e, t) {
|
|
|
515
568
|
}
|
|
516
569
|
//#endregion
|
|
517
570
|
//#region src/lib/extractors/action_directives.ts
|
|
518
|
-
function
|
|
571
|
+
function W(e) {
|
|
519
572
|
return e.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
520
573
|
}
|
|
521
|
-
function
|
|
522
|
-
return e.replace(
|
|
574
|
+
function G(e) {
|
|
575
|
+
return e.replace(L, "");
|
|
523
576
|
}
|
|
524
577
|
function En(e) {
|
|
525
578
|
let t = e.split("\n"), n = [], r = 0;
|
|
@@ -534,124 +587,254 @@ function En(e) {
|
|
|
534
587
|
return n;
|
|
535
588
|
}
|
|
536
589
|
function Dn(e) {
|
|
537
|
-
return
|
|
590
|
+
return L.test(e);
|
|
538
591
|
}
|
|
539
592
|
function On(e) {
|
|
540
|
-
let t =
|
|
593
|
+
let t = L.exec(e);
|
|
541
594
|
if (!t) return null;
|
|
542
595
|
let n = t[1] ?? "";
|
|
543
596
|
return n ? /^\d+$/.test(n) ? {
|
|
544
597
|
marker: n,
|
|
545
598
|
level: 2
|
|
546
|
-
} :
|
|
599
|
+
} : /^[ivxlcdm]+$/.test(n) && (n.length > 1 || /^[ivx]$/.test(n)) ? {
|
|
547
600
|
marker: n,
|
|
548
|
-
level:
|
|
601
|
+
level: 4
|
|
549
602
|
} : /^[a-z]$/.test(n) ? {
|
|
550
603
|
marker: n,
|
|
551
604
|
level: 3
|
|
552
|
-
} : (/^[A-Z]$/.test(n)
|
|
605
|
+
} : R(n) || /^[A-Z]$/.test(n) ? {
|
|
606
|
+
marker: n,
|
|
607
|
+
level: 1
|
|
608
|
+
} : {
|
|
553
609
|
marker: n,
|
|
554
610
|
level: 2
|
|
555
|
-
}
|
|
611
|
+
} : null;
|
|
556
612
|
}
|
|
557
613
|
function kn(e) {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
return /\bainsi\s+modifie/.test(t);
|
|
561
|
-
}
|
|
562
|
-
function U(e) {
|
|
563
|
-
return /\b(inséré|insere|ajouté|ajoute|remplacé|remplace|supprimé|supprime|abrogé|abroge|complété|complete)\b/i.exec(e)?.index ?? null;
|
|
564
|
-
}
|
|
565
|
-
function W(e) {
|
|
566
|
-
return e.type === "reference_et_action" ? e.reference : e;
|
|
614
|
+
let t = W(e), n = /(?:^|[^\p{L}])(insere(?:e|es|s)?|ajoute(?:e|es|s)?|remplace(?:e|es|s)?|supprime(?:e|es|s)?|abroge(?:e|es|s)?|complete(?:e|es|s)?|retabli(?:e|es|s)?)(?=$|[^\p{L}])/u.exec(t);
|
|
615
|
+
return n ? (n.index ?? 0) + (n[0].length - n[1].length) : null;
|
|
567
616
|
}
|
|
568
617
|
function An(e) {
|
|
569
|
-
return
|
|
618
|
+
return e.type === "reference_et_action" ? e.reference : e;
|
|
570
619
|
}
|
|
571
620
|
function jn(e) {
|
|
572
|
-
|
|
573
|
-
return s(new D(e)).map(W).filter((e) => !K(e.position, n) && h(e) !== "article" && (e.position?.start ?? 0) < t).sort((e, t) => (e.position?.start ?? 0) - (t.position?.start ?? 0))[0] ?? null;
|
|
621
|
+
return s(new E(e)).map(An).find((e) => b(e) === "article") || (lr(e)?.reference ?? null);
|
|
574
622
|
}
|
|
575
623
|
function Mn(e) {
|
|
576
|
-
let t =
|
|
577
|
-
|
|
624
|
+
let t = kn(e) ?? e.length, n = $n(e), r = s(new E(e)).map(An).filter((e) => !er(e.position, n) && b(e) !== "article" && (e.position?.start ?? 0) < t).sort((e, t) => (e.position?.start ?? 0) - (t.position?.start ?? 0));
|
|
625
|
+
if (r[0]) return r[0];
|
|
626
|
+
let i = e.slice(0, t).trimEnd();
|
|
627
|
+
return J(i, 0) ?? J(i.replace(/\b(?:est|sont)\s*$/iu, "").trimEnd(), 0);
|
|
578
628
|
}
|
|
579
629
|
function Nn(e) {
|
|
580
|
-
let t =
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
630
|
+
let t = kn(e) ?? e.length, n = $n(e), r = s(new E(e)).map(An).filter((e) => !er(e.position, n) && (e.position?.start ?? 0) < t).sort((e, t) => (e.position?.start ?? 0) - (t.position?.start ?? 0));
|
|
631
|
+
return r.length === 0 ? null : r.find((e) => b(e) !== "article") ?? null ?? r[0] ?? null;
|
|
632
|
+
}
|
|
633
|
+
function Pn(e) {
|
|
634
|
+
let t = [e, G(e)].map((e) => e.trim()).filter((e, t, n) => e && n.indexOf(e) === t);
|
|
635
|
+
for (let e of t) {
|
|
636
|
+
let t = J(e, 0) ?? sr(e) ?? Nn(e) ?? jn(e);
|
|
637
|
+
if (t) return t;
|
|
638
|
+
}
|
|
639
|
+
return null;
|
|
640
|
+
}
|
|
641
|
+
function Fn(e) {
|
|
642
|
+
return e?.toLowerCase().replace(/[.)]/g, "").trim();
|
|
643
|
+
}
|
|
644
|
+
function In(e, t) {
|
|
645
|
+
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 && Fn(e.num) !== Fn(t.num));
|
|
646
|
+
}
|
|
647
|
+
function Ln(e) {
|
|
648
|
+
let t = null;
|
|
649
|
+
for (let n of y(e)) t = n;
|
|
650
|
+
return t;
|
|
651
|
+
}
|
|
652
|
+
function Rn(e, t) {
|
|
653
|
+
return t && e.type === "parent-enfant" && In(e.parent, t) ? e.child : e;
|
|
654
|
+
}
|
|
655
|
+
function zn(e, t) {
|
|
656
|
+
let n = null;
|
|
657
|
+
for (let r of y(e)) r.type === t && r.relative === void 0 && (r.index === void 0 && r.num === void 0 || (n = r));
|
|
658
|
+
return n;
|
|
659
|
+
}
|
|
660
|
+
function Bn(e, t) {
|
|
661
|
+
if (!t) return e;
|
|
662
|
+
let n = structuredClone(e), r = (e) => {
|
|
663
|
+
if (e.type !== "parent-enfant" && e.type !== "bounded-interval" && e.type !== "counted-interval" && e.type !== "enumeration" && e.type !== "exclusion" && e.type !== "reference_et_action") {
|
|
664
|
+
if (e.relative === 0) {
|
|
665
|
+
let n = zn(t, e.type);
|
|
666
|
+
n && (e.index = n.index, e.num = n.num, delete e.relative);
|
|
593
667
|
}
|
|
594
|
-
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
switch (e.type) {
|
|
671
|
+
case "parent-enfant":
|
|
672
|
+
r(e.parent), r(e.child);
|
|
673
|
+
break;
|
|
674
|
+
case "bounded-interval":
|
|
675
|
+
r(e.first), r(e.last);
|
|
676
|
+
break;
|
|
677
|
+
case "counted-interval":
|
|
678
|
+
r(e.first);
|
|
679
|
+
break;
|
|
680
|
+
case "enumeration":
|
|
681
|
+
case "exclusion":
|
|
682
|
+
r(e.left), r(e.right);
|
|
683
|
+
break;
|
|
684
|
+
case "reference_et_action":
|
|
685
|
+
r(e.reference);
|
|
686
|
+
break;
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
return r(n), n;
|
|
690
|
+
}
|
|
691
|
+
function Vn(e) {
|
|
692
|
+
let t = (e) => {
|
|
693
|
+
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;
|
|
694
|
+
switch (e.type) {
|
|
695
|
+
case "parent-enfant": return t(e.parent) || t(e.child);
|
|
696
|
+
case "bounded-interval": return t(e.first) || t(e.last);
|
|
697
|
+
case "counted-interval": return t(e.first);
|
|
698
|
+
case "enumeration":
|
|
699
|
+
case "exclusion": return t(e.left) || t(e.right);
|
|
700
|
+
case "reference_et_action": return t(e.reference);
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
return t(e);
|
|
704
|
+
}
|
|
705
|
+
function Hn(e) {
|
|
706
|
+
let t = [], n = [];
|
|
707
|
+
for (let r of e) {
|
|
708
|
+
if (!Dn(r.text)) {
|
|
709
|
+
n[n.length - 1]?.body.push(r);
|
|
710
|
+
continue;
|
|
595
711
|
}
|
|
712
|
+
let e = On(r.text)?.level ?? 0, i = {
|
|
713
|
+
body: [],
|
|
714
|
+
children: [],
|
|
715
|
+
level: e,
|
|
716
|
+
line: r
|
|
717
|
+
};
|
|
718
|
+
for (; n.length > 0 && n[n.length - 1].level >= e;) n.pop();
|
|
719
|
+
n.length === 0 ? t.push(i) : n[n.length - 1]?.children.push(i), n.push(i);
|
|
596
720
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
721
|
+
return t;
|
|
722
|
+
}
|
|
723
|
+
function Un(e, t) {
|
|
724
|
+
if (!e) return t;
|
|
725
|
+
if (!t) return e;
|
|
726
|
+
let n = Rn(t, Ln(e));
|
|
727
|
+
return n.type === "article" || b(n), ge(e, n);
|
|
728
|
+
}
|
|
729
|
+
function Wn(e) {
|
|
730
|
+
return [G(e.line.text), ...e.body.map((e) => e.text)].join("\n").trim();
|
|
731
|
+
}
|
|
732
|
+
function Gn(e) {
|
|
733
|
+
return e.body[e.body.length - 1]?.end ?? e.line.end;
|
|
734
|
+
}
|
|
735
|
+
function Kn(e, t) {
|
|
736
|
+
let n = [], r = t;
|
|
737
|
+
for (let i of e) {
|
|
738
|
+
let e = G(i.line.text), a = Wn(i);
|
|
739
|
+
if (!a) continue;
|
|
740
|
+
let o = Pn(e), s = Un(t, o), c = kn(a) !== null;
|
|
741
|
+
if (i.children.length > 0) {
|
|
742
|
+
let e = s ?? t, a = Kn(i.children, e);
|
|
743
|
+
a.length > 0 && (n.push(...a), r = a[a.length - 1]?.reference ?? r);
|
|
744
|
+
continue;
|
|
745
|
+
}
|
|
746
|
+
if (!c) {
|
|
747
|
+
r = s ?? r;
|
|
614
748
|
continue;
|
|
615
749
|
}
|
|
616
|
-
let
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
let
|
|
750
|
+
let l = jn(a), u = Un(t, Mn(a) ?? l ?? o) ?? l ?? s;
|
|
751
|
+
if (!u) continue;
|
|
752
|
+
u = Bn(u, Vn(u) ? r ?? t : t);
|
|
753
|
+
let d = Y({
|
|
620
754
|
action: { action: "modifier" },
|
|
621
|
-
reference:
|
|
755
|
+
reference: u,
|
|
622
756
|
sourcePosition: {
|
|
623
|
-
start:
|
|
624
|
-
stop:
|
|
757
|
+
start: i.line.start,
|
|
758
|
+
stop: Gn(i)
|
|
625
759
|
},
|
|
626
|
-
sourceText:
|
|
760
|
+
sourceText: a
|
|
627
761
|
});
|
|
628
|
-
|
|
762
|
+
if (!d) {
|
|
763
|
+
r = u;
|
|
764
|
+
continue;
|
|
765
|
+
}
|
|
766
|
+
Array.isArray(d) ? n.push(...d) : n.push(d), r = u;
|
|
629
767
|
}
|
|
630
|
-
return
|
|
768
|
+
return n;
|
|
631
769
|
}
|
|
632
|
-
function
|
|
770
|
+
function qn(e) {
|
|
771
|
+
let t = En(e), n = t.findIndex((e) => Dn(e.text));
|
|
772
|
+
if (n === -1) return null;
|
|
773
|
+
let r = t.slice(0, n).reverse().map((e) => Pn(e.text)).find((e) => e !== null) ?? null, i = Kn(Hn(t.slice(n)), r);
|
|
774
|
+
return i.length > 0 ? i : null;
|
|
775
|
+
}
|
|
776
|
+
function Jn(e) {
|
|
633
777
|
return e.split(/\n+/).map((e) => e.replace(/^\s*[«“"]\s*/u, "").trim()).filter((e) => e.length > 0).join("\n").replace(/[»”"]\s*$/u, "").trim();
|
|
634
778
|
}
|
|
635
|
-
function
|
|
779
|
+
function Yn(e) {
|
|
636
780
|
let t = [], n = 0;
|
|
637
781
|
for (; n < e.length;) {
|
|
638
782
|
let r = e.indexOf("«", n);
|
|
639
783
|
if (r === -1) break;
|
|
640
|
-
let i = new
|
|
784
|
+
let i = new E(e);
|
|
641
785
|
i.offset = r;
|
|
642
|
-
let a =
|
|
786
|
+
let a = ze(i);
|
|
643
787
|
if (!a) {
|
|
644
788
|
n = r + 1;
|
|
645
789
|
continue;
|
|
646
790
|
}
|
|
647
|
-
let o =
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
791
|
+
let o = Jn(Ce(i, a).output), s = a.position ?? {
|
|
792
|
+
start: r,
|
|
793
|
+
stop: r + 1
|
|
794
|
+
};
|
|
795
|
+
t.push({
|
|
796
|
+
text: o,
|
|
797
|
+
start: s.start,
|
|
798
|
+
end: s.stop
|
|
799
|
+
});
|
|
800
|
+
let c = s.stop ?? r + 1;
|
|
801
|
+
n = Math.max(c, r + 1);
|
|
651
802
|
}
|
|
652
803
|
return t;
|
|
653
804
|
}
|
|
654
|
-
function
|
|
805
|
+
function Xn(e, t) {
|
|
806
|
+
if (t.length === 0) return e;
|
|
807
|
+
let n = 0, r = [];
|
|
808
|
+
for (let { start: i, end: a } of t) {
|
|
809
|
+
let t = Math.max(0, Math.min(i, e.length)), o = Math.max(t, Math.min(a, e.length));
|
|
810
|
+
t > n && r.push(e.slice(n, t)), o > t && r.push(" "), n = o;
|
|
811
|
+
}
|
|
812
|
+
return n < e.length && r.push(e.slice(n)), r.join("");
|
|
813
|
+
}
|
|
814
|
+
function Zn(e) {
|
|
815
|
+
let t = e.trim();
|
|
816
|
+
if (!t) return null;
|
|
817
|
+
let n = wt(new E(t));
|
|
818
|
+
if (typeof n == "number") return n;
|
|
819
|
+
if (n && typeof n == "object" && "value" in n) {
|
|
820
|
+
let e = n.value;
|
|
821
|
+
return Number.isFinite(e) ? e : null;
|
|
822
|
+
}
|
|
823
|
+
let r = Dt(new E(t));
|
|
824
|
+
if (r && typeof r == "object" && "value" in r) {
|
|
825
|
+
let e = r.value;
|
|
826
|
+
return Number.isFinite(e) ? e : null;
|
|
827
|
+
}
|
|
828
|
+
return typeof r == "number" ? r : null;
|
|
829
|
+
}
|
|
830
|
+
function Qn(e, t) {
|
|
831
|
+
let n = e.slice(0, t), r = /([0-9A-Za-zÀ-ÖØ-öø-ÿ'’.-]+)\s+occurrence\b/giu, i = null, a;
|
|
832
|
+
for (; (a = r.exec(n)) !== null;) i = a;
|
|
833
|
+
if (!i) return null;
|
|
834
|
+
let o = i[1], s = Zn(o);
|
|
835
|
+
return !s || s < 1 ? null : s;
|
|
836
|
+
}
|
|
837
|
+
function $n(e) {
|
|
655
838
|
let t = [], n = 0;
|
|
656
839
|
for (; n < e.length;) {
|
|
657
840
|
let r = e.indexOf("«", n);
|
|
@@ -671,10 +854,10 @@ function G(e) {
|
|
|
671
854
|
}
|
|
672
855
|
return t;
|
|
673
856
|
}
|
|
674
|
-
function
|
|
857
|
+
function er(e, t) {
|
|
675
858
|
return e ? t.some((t) => e.start >= t.start && e.stop <= t.end) : !1;
|
|
676
859
|
}
|
|
677
|
-
function
|
|
860
|
+
function tr(e) {
|
|
678
861
|
if (!e.includes("«")) return e;
|
|
679
862
|
let t = e.split(""), n = !1;
|
|
680
863
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -691,109 +874,180 @@ function In(e) {
|
|
|
691
874
|
}
|
|
692
875
|
return t.join("");
|
|
693
876
|
}
|
|
694
|
-
function
|
|
877
|
+
function K(e, t) {
|
|
695
878
|
e && (e.start += t, e.stop += t);
|
|
696
879
|
}
|
|
697
|
-
function
|
|
880
|
+
function q(e, t) {
|
|
698
881
|
if (e.type === "parent-enfant") {
|
|
699
|
-
|
|
882
|
+
q(e.parent, t), q(e.child, t), K(e.position, t);
|
|
700
883
|
return;
|
|
701
884
|
}
|
|
702
885
|
if (e.type === "bounded-interval") {
|
|
703
|
-
|
|
886
|
+
q(e.first, t), q(e.last, t), K(e.position, t);
|
|
704
887
|
return;
|
|
705
888
|
}
|
|
706
889
|
if (e.type === "counted-interval") {
|
|
707
|
-
|
|
890
|
+
q(e.first, t), K(e.position, t);
|
|
708
891
|
return;
|
|
709
892
|
}
|
|
710
893
|
if (e.type === "enumeration" || e.type === "exclusion") {
|
|
711
|
-
|
|
894
|
+
q(e.left, t), q(e.right, t), K(e.position, t);
|
|
712
895
|
return;
|
|
713
896
|
}
|
|
714
897
|
if (e.type === "reference_et_action") {
|
|
715
|
-
|
|
898
|
+
q(e.reference, t), K(e.position, t);
|
|
716
899
|
return;
|
|
717
900
|
}
|
|
718
|
-
|
|
901
|
+
K(e.position, t);
|
|
719
902
|
}
|
|
720
|
-
function
|
|
903
|
+
function nr(e) {
|
|
721
904
|
return e.replace(/\b(de\s+l['’]?|de\s+la|de\s+le|du|des)\s*$/i, "");
|
|
722
905
|
}
|
|
723
|
-
function
|
|
724
|
-
let
|
|
906
|
+
function rr(e) {
|
|
907
|
+
let t = W(e);
|
|
908
|
+
return t.startsWith("alinea") ? "alinéa" : t.startsWith("phrase") ? "phrase" : null;
|
|
909
|
+
}
|
|
910
|
+
function ir(e) {
|
|
911
|
+
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();
|
|
912
|
+
return n ? {
|
|
913
|
+
text: n,
|
|
914
|
+
offset: t
|
|
915
|
+
} : null;
|
|
916
|
+
}
|
|
917
|
+
function ar(e) {
|
|
918
|
+
let t = new E(e), n = qt(t);
|
|
919
|
+
return !n || t.remaining().trim().length !== 0 ? null : n;
|
|
920
|
+
}
|
|
921
|
+
function J(e, t) {
|
|
922
|
+
let n = e.trim().replace(/[;:,]\s*$/u, "").trim();
|
|
725
923
|
if (!n) return null;
|
|
726
924
|
let r = [...n.matchAll(/\p{L}/gu)];
|
|
727
925
|
for (let e of r) {
|
|
926
|
+
let r = e.index ?? 0, i = n.slice(r).trim(), a = /\b(alinéas?|phrases?)\b\s*$/iu.exec(i);
|
|
927
|
+
if (!a || a.index === void 0) continue;
|
|
928
|
+
let o = rr(a[1] ?? "");
|
|
929
|
+
if (!o) continue;
|
|
930
|
+
let s = i.slice(0, a.index).trim();
|
|
931
|
+
if (!s) continue;
|
|
932
|
+
let c = /\s*(,|\bet\b|\bou\b)\s*/giu, l = [], u = 0, d;
|
|
933
|
+
for (; (d = c.exec(s)) !== null;) {
|
|
934
|
+
let e = W(d[1] ?? "");
|
|
935
|
+
l.push({
|
|
936
|
+
separator: e === "ou" ? "ou" : e === "," ? "," : "et",
|
|
937
|
+
start: u,
|
|
938
|
+
text: s.slice(u, d.index)
|
|
939
|
+
}), u = c.lastIndex;
|
|
940
|
+
}
|
|
941
|
+
if (l.push({
|
|
942
|
+
start: u,
|
|
943
|
+
text: s.slice(u)
|
|
944
|
+
}), l.length < 2) continue;
|
|
945
|
+
let f = [], p = [], m = !0, h;
|
|
946
|
+
for (let [e, n] of l.entries()) {
|
|
947
|
+
let i = ir(n.text);
|
|
948
|
+
if (!i) {
|
|
949
|
+
f.length = 0;
|
|
950
|
+
break;
|
|
951
|
+
}
|
|
952
|
+
let a = ar(`${i.text} ${o}`);
|
|
953
|
+
if (!a) {
|
|
954
|
+
f.length = 0;
|
|
955
|
+
break;
|
|
956
|
+
}
|
|
957
|
+
q(a, t + r + n.start + i.offset), f.push(a), a.type !== o || a.index === void 0 || a.index < 1 || h !== void 0 && a.index !== h + 1 ? m = !1 : h = a.index, e < l.length - 1 && (p.push(n.separator ?? "et"), (n.separator ?? "et") === "ou" && (m = !1));
|
|
958
|
+
}
|
|
959
|
+
let [g, ..._] = f;
|
|
960
|
+
if (!g || _.length === 0) continue;
|
|
961
|
+
let ee = {
|
|
962
|
+
start: t + r + l[0].start,
|
|
963
|
+
stop: t + r + i.length
|
|
964
|
+
};
|
|
965
|
+
return m ? {
|
|
966
|
+
first: g,
|
|
967
|
+
last: f[f.length - 1],
|
|
968
|
+
position: ee,
|
|
969
|
+
type: "bounded-interval"
|
|
970
|
+
} : Se(g, _.map((e, t) => [p[t] ?? "et", e]), ee);
|
|
971
|
+
}
|
|
972
|
+
return null;
|
|
973
|
+
}
|
|
974
|
+
function or(e, t) {
|
|
975
|
+
let n = nr(e);
|
|
976
|
+
if (!n) return null;
|
|
977
|
+
let r = J(n, t);
|
|
978
|
+
if (r) return r;
|
|
979
|
+
let i = [...n.matchAll(/\p{L}/gu)];
|
|
980
|
+
for (let e of i) {
|
|
728
981
|
let r = e.index ?? 0, i = n.slice(r);
|
|
729
982
|
if (!i) continue;
|
|
730
|
-
let a = new
|
|
731
|
-
if (!(!o || a.offset === 0) && i.slice(a.offset).trim().length === 0) return
|
|
983
|
+
let a = new E(i), o = qt(a);
|
|
984
|
+
if (!(!o || a.offset === 0) && i.slice(a.offset).trim().length === 0) return q(o, t + r), o;
|
|
732
985
|
}
|
|
733
986
|
return null;
|
|
734
987
|
}
|
|
735
|
-
function
|
|
988
|
+
function sr(e) {
|
|
736
989
|
let t = /\barticle\b/i.exec(e);
|
|
737
990
|
if (!t || t.index === void 0) return null;
|
|
738
|
-
let n = t.index, r = zt(new
|
|
991
|
+
let n = t.index, r = zt(new E(e.slice(n)));
|
|
739
992
|
if (!r) return null;
|
|
740
|
-
|
|
741
|
-
let i =
|
|
742
|
-
return i ?
|
|
993
|
+
q(r, n);
|
|
994
|
+
let i = or(e.slice(0, n), 0);
|
|
995
|
+
return i ? ge(r, i) : null;
|
|
743
996
|
}
|
|
744
|
-
function
|
|
745
|
-
let
|
|
746
|
-
if (t.action === "supprimer" ||
|
|
997
|
+
function cr(e, t, n, r, i) {
|
|
998
|
+
let a = W(e), o = W(Xn(e, r)), s = /\bredige\b|\bredigee\b|\bredigees\b|\brediges\b|\bainsi\b/.test(a) || /\bdispositions suivantes\b/.test(a), c = /\bapres\b/.test(o) || /\bapres (la|les) reference\b|\bapres (le|les) mots\b|\bapres la mention\b/.test(o), l = /\bavant\b/.test(o) || /\bavant (la|les) reference\b|\bavant (le|les) mots\b|\bavant la mention\b/.test(o), u = t.action === "rétablir" || /\bretabl/.test(a), d = /\binsere(?:e|es|s)?\b|\bajoute\b|\bajoutee\b|\bajoutes\b|\bajoutees\b|\bcomplete\b/.test(a) || u, f = /\bremplace\b|\bremplacee\b|\bremplaces\b|\bremplacees\b/.test(a), p = /\bsupprime\b|\bsupprimee\b|\bsupprimes\b|\bsupprimees\b|\babroge\b|\babrogee\b|\babroges\b|\babrogees\b/.test(a);
|
|
999
|
+
if (t.action === "supprimer" || p) return n === "article" && i.length === 0 ? { kind: "delete_article" } : i.length >= 1 ? {
|
|
747
1000
|
kind: "delete",
|
|
748
|
-
targetText:
|
|
1001
|
+
targetText: i[0],
|
|
1002
|
+
extraTargetTexts: i.slice(1)
|
|
749
1003
|
} : { kind: "delete_portion" };
|
|
750
|
-
if (
|
|
1004
|
+
if (f && i.length >= 2) return {
|
|
751
1005
|
kind: "replace",
|
|
752
|
-
targetText:
|
|
753
|
-
replacementText:
|
|
1006
|
+
targetText: i[0],
|
|
1007
|
+
replacementText: i[1]
|
|
754
1008
|
};
|
|
755
|
-
if (
|
|
1009
|
+
if (f && i.length === 1 && s) return {
|
|
756
1010
|
kind: "replace_portion",
|
|
757
|
-
replacementText:
|
|
1011
|
+
replacementText: i[0]
|
|
758
1012
|
};
|
|
759
|
-
if (
|
|
760
|
-
if (
|
|
1013
|
+
if (d && i.length >= 2) {
|
|
1014
|
+
if (c) return {
|
|
761
1015
|
kind: "insert_after",
|
|
762
|
-
targetText:
|
|
763
|
-
insertText:
|
|
1016
|
+
targetText: i[0],
|
|
1017
|
+
insertText: i[1]
|
|
764
1018
|
};
|
|
765
|
-
if (
|
|
1019
|
+
if (l) return {
|
|
766
1020
|
kind: "insert_before",
|
|
767
|
-
targetText:
|
|
768
|
-
insertText:
|
|
1021
|
+
targetText: i[0],
|
|
1022
|
+
insertText: i[1]
|
|
769
1023
|
};
|
|
770
1024
|
}
|
|
771
|
-
return
|
|
1025
|
+
return d && i.length === 1 ? c ? {
|
|
772
1026
|
kind: "insert_after",
|
|
773
1027
|
targetText: "",
|
|
774
|
-
insertText:
|
|
775
|
-
} :
|
|
1028
|
+
insertText: i[0]
|
|
1029
|
+
} : l ? {
|
|
776
1030
|
kind: "insert_before",
|
|
777
1031
|
targetText: "",
|
|
778
|
-
insertText:
|
|
1032
|
+
insertText: i[0]
|
|
779
1033
|
} : {
|
|
780
1034
|
kind: "insert_after",
|
|
781
1035
|
targetText: "",
|
|
782
|
-
insertText:
|
|
1036
|
+
insertText: i[0]
|
|
783
1037
|
} : null;
|
|
784
1038
|
}
|
|
785
1039
|
function Y({ action: e, reference: t, sourcePosition: n, sourceText: r, fullText: i }) {
|
|
786
|
-
let a = e.target ??
|
|
787
|
-
if (!
|
|
788
|
-
switch (
|
|
1040
|
+
let a = e.target ?? b(t), o = Cn(t), s = i && n.start < i.length ? i.slice(n.start) : r, c = Yn(s), l = cr(r, e, a, c, c.map((e) => e.text));
|
|
1041
|
+
if (!l) return null;
|
|
1042
|
+
switch (l.kind) {
|
|
789
1043
|
case "insert_after":
|
|
790
1044
|
case "insert_before": return {
|
|
791
|
-
kind:
|
|
1045
|
+
kind: l.kind,
|
|
792
1046
|
targetType: a,
|
|
793
1047
|
reference: t,
|
|
794
1048
|
portionSelectors: o,
|
|
795
|
-
targetText:
|
|
796
|
-
insertText:
|
|
1049
|
+
targetText: l.targetText,
|
|
1050
|
+
insertText: l.insertText,
|
|
797
1051
|
sourcePosition: n,
|
|
798
1052
|
sourceText: r
|
|
799
1053
|
};
|
|
@@ -802,8 +1056,8 @@ function Y({ action: e, reference: t, sourcePosition: n, sourceText: r, fullText
|
|
|
802
1056
|
targetType: a,
|
|
803
1057
|
reference: t,
|
|
804
1058
|
portionSelectors: o,
|
|
805
|
-
targetText:
|
|
806
|
-
replacementText:
|
|
1059
|
+
targetText: l.targetText,
|
|
1060
|
+
replacementText: l.replacementText,
|
|
807
1061
|
sourcePosition: n,
|
|
808
1062
|
sourceText: r
|
|
809
1063
|
};
|
|
@@ -812,19 +1066,34 @@ function Y({ action: e, reference: t, sourcePosition: n, sourceText: r, fullText
|
|
|
812
1066
|
targetType: a,
|
|
813
1067
|
reference: t,
|
|
814
1068
|
portionSelectors: o,
|
|
815
|
-
replacementText:
|
|
816
|
-
sourcePosition: n,
|
|
817
|
-
sourceText: r
|
|
818
|
-
};
|
|
819
|
-
case "delete": return {
|
|
820
|
-
kind: "delete",
|
|
821
|
-
targetType: a,
|
|
822
|
-
reference: t,
|
|
823
|
-
portionSelectors: o,
|
|
824
|
-
targetText: s.targetText,
|
|
1069
|
+
replacementText: l.replacementText,
|
|
825
1070
|
sourcePosition: n,
|
|
826
1071
|
sourceText: r
|
|
827
1072
|
};
|
|
1073
|
+
case "delete": {
|
|
1074
|
+
let e = c.map((e) => Qn(s, e.start)), i = /* @__PURE__ */ new Map();
|
|
1075
|
+
for (let [t, n] of c.entries()) i.has(n.text) || i.set(n.text, e[t] ?? null);
|
|
1076
|
+
let u = [l.targetText, ...l.extraTargetTexts ?? []].filter((e) => e && e.trim().length > 0).filter((e, t, n) => n.indexOf(e) === t);
|
|
1077
|
+
return u.length > 1 ? u.map((e) => ({
|
|
1078
|
+
kind: "delete",
|
|
1079
|
+
targetType: a,
|
|
1080
|
+
reference: t,
|
|
1081
|
+
portionSelectors: o,
|
|
1082
|
+
targetText: e,
|
|
1083
|
+
occurrenceIndex: i.get(e) ?? void 0,
|
|
1084
|
+
sourcePosition: n,
|
|
1085
|
+
sourceText: r
|
|
1086
|
+
})) : {
|
|
1087
|
+
kind: "delete",
|
|
1088
|
+
targetType: a,
|
|
1089
|
+
reference: t,
|
|
1090
|
+
portionSelectors: o,
|
|
1091
|
+
targetText: l.targetText,
|
|
1092
|
+
occurrenceIndex: i.get(l.targetText) ?? void 0,
|
|
1093
|
+
sourcePosition: n,
|
|
1094
|
+
sourceText: r
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
828
1097
|
case "delete_portion": return {
|
|
829
1098
|
kind: "delete_portion",
|
|
830
1099
|
targetType: a,
|
|
@@ -844,7 +1113,7 @@ function Y({ action: e, reference: t, sourcePosition: n, sourceText: r, fullText
|
|
|
844
1113
|
default: return null;
|
|
845
1114
|
}
|
|
846
1115
|
}
|
|
847
|
-
function
|
|
1116
|
+
function lr(e) {
|
|
848
1117
|
let t = /\barticle\s+([0-9]+(?:-[0-9]+)?(?:\s*[A-Z])?(?:\s+[a-z]+)?)\b/i.exec(e);
|
|
849
1118
|
if (!t || t.index === void 0) return null;
|
|
850
1119
|
let n = t.index, r = t.index + t[0].length;
|
|
@@ -863,22 +1132,22 @@ function Vn(e) {
|
|
|
863
1132
|
}
|
|
864
1133
|
};
|
|
865
1134
|
}
|
|
866
|
-
function
|
|
867
|
-
let n =
|
|
1135
|
+
function ur(e, t) {
|
|
1136
|
+
let n = C(e).output;
|
|
868
1137
|
if (t.allowListExtraction) {
|
|
869
|
-
let e =
|
|
1138
|
+
let e = qn(n);
|
|
870
1139
|
if (e) return e;
|
|
871
1140
|
}
|
|
872
|
-
let r =
|
|
873
|
-
if (r.length > 0 && (a = a.filter((e) => !
|
|
874
|
-
let e =
|
|
1141
|
+
let r = $n(n), i = tr(n), a = s(new E(n));
|
|
1142
|
+
if (r.length > 0 && (a = a.filter((e) => !er(e.position, r))), a.length === 0 && (a = s(new E(i.split(",")[0] ?? i))), a.length === 0) {
|
|
1143
|
+
let e = lr(i);
|
|
875
1144
|
e && (a = [{
|
|
876
1145
|
...e.reference,
|
|
877
1146
|
position: e.position
|
|
878
1147
|
}]);
|
|
879
1148
|
}
|
|
880
1149
|
if (a.length === 1 && a[0]?.type === "article") {
|
|
881
|
-
let e =
|
|
1150
|
+
let e = sr(i);
|
|
882
1151
|
e && (a = [e]);
|
|
883
1152
|
}
|
|
884
1153
|
let o = [];
|
|
@@ -894,7 +1163,7 @@ function Hn(e, t) {
|
|
|
894
1163
|
sourceText: i,
|
|
895
1164
|
fullText: n
|
|
896
1165
|
});
|
|
897
|
-
a && o.push(a);
|
|
1166
|
+
a && (Array.isArray(a) ? o.push(...a) : o.push(a));
|
|
898
1167
|
continue;
|
|
899
1168
|
}
|
|
900
1169
|
let t = Y({
|
|
@@ -907,10 +1176,10 @@ function Hn(e, t) {
|
|
|
907
1176
|
sourceText: n,
|
|
908
1177
|
fullText: n
|
|
909
1178
|
});
|
|
910
|
-
t && o.push(t);
|
|
1179
|
+
t && (Array.isArray(t) ? o.push(...t) : o.push(t));
|
|
911
1180
|
}
|
|
912
1181
|
if (o.length === 0) {
|
|
913
|
-
let e =
|
|
1182
|
+
let e = lr(i);
|
|
914
1183
|
if (e) {
|
|
915
1184
|
let t = Y({
|
|
916
1185
|
action: { action: "modifier" },
|
|
@@ -919,54 +1188,54 @@ function Hn(e, t) {
|
|
|
919
1188
|
sourceText: n,
|
|
920
1189
|
fullText: n
|
|
921
1190
|
});
|
|
922
|
-
t && o.push(t);
|
|
1191
|
+
t && (Array.isArray(t) ? o.push(...t) : o.push(t));
|
|
923
1192
|
}
|
|
924
1193
|
}
|
|
925
1194
|
return o;
|
|
926
1195
|
}
|
|
927
|
-
function
|
|
928
|
-
return
|
|
1196
|
+
function dr(e) {
|
|
1197
|
+
return ur(e, { allowListExtraction: !0 });
|
|
929
1198
|
}
|
|
930
|
-
function
|
|
931
|
-
let t =
|
|
1199
|
+
function fr(e) {
|
|
1200
|
+
let t = W(e);
|
|
932
1201
|
return t.includes("«") || t.includes("»") || !e.trim().endsWith(":") ? !1 : /\b(remplace|modifie|redige|rediges|redigee|redigees)\b/.test(t);
|
|
933
1202
|
}
|
|
934
|
-
function
|
|
1203
|
+
function pr(e, t) {
|
|
935
1204
|
let n = [], r = !1, i = t + 1;
|
|
936
1205
|
for (; i < e.length;) {
|
|
937
|
-
let t = e[i], a =
|
|
1206
|
+
let t = e[i], a = G(t);
|
|
938
1207
|
if (!r && a.includes("«") && (r = !0), r) {
|
|
939
1208
|
if (n.push(a), a.includes("»")) break;
|
|
940
1209
|
} else if (a.trim().length > 0) break;
|
|
941
1210
|
i += 1;
|
|
942
1211
|
}
|
|
943
1212
|
return !r || n.length === 0 ? null : {
|
|
944
|
-
combinedText: [
|
|
1213
|
+
combinedText: [G(e[t]), ...n].join("\n"),
|
|
945
1214
|
endIndex: i
|
|
946
1215
|
};
|
|
947
1216
|
}
|
|
948
|
-
function
|
|
949
|
-
let t =
|
|
1217
|
+
function mr(e) {
|
|
1218
|
+
let t = ot()(e).output.split("\n").map((e) => e.trim()).filter((e) => e.length > 0), n = [];
|
|
950
1219
|
for (let e = 0; e < t.length; e += 1) {
|
|
951
1220
|
let r = t[e];
|
|
952
|
-
if (
|
|
953
|
-
let r =
|
|
1221
|
+
if (fr(r)) {
|
|
1222
|
+
let r = pr(t, e);
|
|
954
1223
|
if (r) {
|
|
955
|
-
let t =
|
|
1224
|
+
let t = dr(r.combinedText);
|
|
956
1225
|
if (t.length > 0) {
|
|
957
1226
|
n.push(...t), e = r.endIndex;
|
|
958
1227
|
continue;
|
|
959
1228
|
}
|
|
960
1229
|
}
|
|
961
1230
|
}
|
|
962
|
-
let i =
|
|
1231
|
+
let i = ur(r, { allowListExtraction: !1 });
|
|
963
1232
|
i.length > 0 && n.push(...i);
|
|
964
1233
|
}
|
|
965
1234
|
return n;
|
|
966
1235
|
}
|
|
967
1236
|
//#endregion
|
|
968
1237
|
//#region src/lib/json.ts
|
|
969
|
-
var
|
|
1238
|
+
var hr = (e, t) => t instanceof Object && !Array.isArray(t) ? Object.keys(t).sort().reduce((e, n) => (e[n] = t[n], e), {}) : t;
|
|
970
1239
|
//#endregion
|
|
971
1240
|
//#region src/lib/markdown.ts
|
|
972
1241
|
function X(e) {
|
|
@@ -974,11 +1243,11 @@ function X(e) {
|
|
|
974
1243
|
}
|
|
975
1244
|
//#endregion
|
|
976
1245
|
//#region src/lib/linkers/markdown.ts
|
|
977
|
-
async function
|
|
978
|
-
let s =
|
|
1246
|
+
async function gr({ canutesDb: e, date: t, linkBaseUrl: r, linkType: i, previousContext: a, text: o }) {
|
|
1247
|
+
let s = C(o), c = new E(s.output);
|
|
979
1248
|
c.currentArticle = a?.currentArticle, c.currentText = a?.currentText;
|
|
980
1249
|
let l = o, u = 0;
|
|
981
|
-
for await (let a of
|
|
1250
|
+
for await (let a of Ye({
|
|
982
1251
|
canutesDb: e,
|
|
983
1252
|
context: c,
|
|
984
1253
|
date: t,
|
|
@@ -989,7 +1258,7 @@ async function Jn({ canutesDb: e, date: t, linkBaseUrl: r, linkType: i, previous
|
|
|
989
1258
|
let { articleId: e, originalTransformation: t } = a;
|
|
990
1259
|
if (e !== void 0) {
|
|
991
1260
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(a, null, 2)}`);
|
|
992
|
-
let o =
|
|
1261
|
+
let o = O(t, `[${X(n(l, t, u))}](${D(i, r, e)})`);
|
|
993
1262
|
l = l.slice(0, t.position.start + u) + o + l.slice(t.position.stop + u), u += o.length - (t.position.stop - t.position.start);
|
|
994
1263
|
}
|
|
995
1264
|
break;
|
|
@@ -998,7 +1267,7 @@ async function Jn({ canutesDb: e, date: t, linkBaseUrl: r, linkType: i, previous
|
|
|
998
1267
|
let { originalTransformation: e, sectionTaId: t } = a;
|
|
999
1268
|
if (t !== void 0) {
|
|
1000
1269
|
if (e === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(a, null, 2)}`);
|
|
1001
|
-
let o =
|
|
1270
|
+
let o = O(e, `[${X(n(l, e, u))}](${D(i, r, t)})`);
|
|
1002
1271
|
l = l.slice(0, e.position.start + u) + o + l.slice(e.position.stop + u), u += o.length - (e.position.stop - e.position.start);
|
|
1003
1272
|
}
|
|
1004
1273
|
break;
|
|
@@ -1010,14 +1279,14 @@ async function Jn({ canutesDb: e, date: t, linkBaseUrl: r, linkType: i, previous
|
|
|
1010
1279
|
continue;
|
|
1011
1280
|
}
|
|
1012
1281
|
if (e === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(a, null, 2)}`);
|
|
1013
|
-
let o =
|
|
1282
|
+
let o = O(e, `[${X(n(l, e, u))}](${D(i, r, t.cid)})`);
|
|
1014
1283
|
l = l.slice(0, e.position.start + u) + o + l.slice(e.position.stop + u), u += o.length - (e.position.stop - e.position.start);
|
|
1015
1284
|
break;
|
|
1016
1285
|
}
|
|
1017
1286
|
case "internal_article": {
|
|
1018
1287
|
let { definition: e, originalTransformation: t } = a;
|
|
1019
1288
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(a, null, 2)}`);
|
|
1020
|
-
let r =
|
|
1289
|
+
let r = O(t, `[${X(n(l, t, u))}](#definition_article_${e.textId}_${e.article.num.replaceAll(" ", "_")})`);
|
|
1021
1290
|
l = l.slice(0, t.position.start + u) + r + l.slice(t.position.stop + u), u += r.length - (t.position.stop - t.position.start);
|
|
1022
1291
|
break;
|
|
1023
1292
|
}
|
|
@@ -1025,11 +1294,11 @@ async function Jn({ canutesDb: e, date: t, linkBaseUrl: r, linkType: i, previous
|
|
|
1025
1294
|
let { url: e, originalTransformation: t } = a;
|
|
1026
1295
|
if (e === void 0) continue;
|
|
1027
1296
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in european text link: ${JSON.stringify(a, null, 2)}`);
|
|
1028
|
-
let r =
|
|
1297
|
+
let r = O(t, `<a class="lien_texte_european" href="${e}" target="_blank">${n(l, t, u)}</a>`);
|
|
1029
1298
|
l = l.slice(0, t.position.start + u) + r + l.slice(t.position.stop + u), u += r.length - (t.position.stop - t.position.start);
|
|
1030
1299
|
break;
|
|
1031
1300
|
}
|
|
1032
|
-
default:
|
|
1301
|
+
default: v("Link", a);
|
|
1033
1302
|
}
|
|
1034
1303
|
return {
|
|
1035
1304
|
context: c,
|
|
@@ -1038,7 +1307,7 @@ async function Jn({ canutesDb: e, date: t, linkBaseUrl: r, linkType: i, previous
|
|
|
1038
1307
|
}
|
|
1039
1308
|
//#endregion
|
|
1040
1309
|
//#region src/lib/loaders/assemblee.ts
|
|
1041
|
-
async function
|
|
1310
|
+
async function _r(e, t, n) {
|
|
1042
1311
|
let r = t.get("Document");
|
|
1043
1312
|
r === void 0 && (r = /* @__PURE__ */ new Map(), t.set("Document", r));
|
|
1044
1313
|
let i = r.get(n);
|
|
@@ -1048,7 +1317,7 @@ async function Yn(e, t, n) {
|
|
|
1048
1317
|
WHERE uid = ${n}
|
|
1049
1318
|
`)[0]?.data, r.set(n, i ?? null)), i ?? void 0;
|
|
1050
1319
|
}
|
|
1051
|
-
async function
|
|
1320
|
+
async function vr(e, t, n) {
|
|
1052
1321
|
let r = t.get("Document");
|
|
1053
1322
|
return r === void 0 && (r = /* @__PURE__ */ new Map(), t.set("Document", r)), (await e`
|
|
1054
1323
|
SELECT data, uid
|
|
@@ -1056,7 +1325,7 @@ async function Xn(e, t, n) {
|
|
|
1056
1325
|
WHERE dossier_uid = ${n}
|
|
1057
1326
|
`).map(({ data: e, uid: t }) => (r.set(t, e ?? null), e));
|
|
1058
1327
|
}
|
|
1059
|
-
async function
|
|
1328
|
+
async function yr(e, t, n) {
|
|
1060
1329
|
let r = t.get("DossierParlementaire");
|
|
1061
1330
|
r === void 0 && (r = /* @__PURE__ */ new Map(), t.set("DossierParlementaire", r));
|
|
1062
1331
|
let i = r.get(n);
|
|
@@ -1068,15 +1337,15 @@ async function Zn(e, t, n) {
|
|
|
1068
1337
|
}
|
|
1069
1338
|
//#endregion
|
|
1070
1339
|
//#region src/lib/text_parsers/search_queries.ts
|
|
1071
|
-
var
|
|
1072
|
-
|
|
1073
|
-
|
|
1340
|
+
var br = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i" }), Z = A([
|
|
1341
|
+
br,
|
|
1342
|
+
T($e, { default: "" }),
|
|
1074
1343
|
w(jt, St)
|
|
1075
1344
|
], { value: (e, t) => ({
|
|
1076
1345
|
num: e[2],
|
|
1077
1346
|
position: t.position(),
|
|
1078
1347
|
type: "article"
|
|
1079
|
-
}) }),
|
|
1348
|
+
}) }), xr = w(x("c(?:ode|\\.)? ?civ(?:il)?", {
|
|
1080
1349
|
flags: "i",
|
|
1081
1350
|
value: (e, t) => ({
|
|
1082
1351
|
cid: "LEGITEXT000006070721",
|
|
@@ -1085,7 +1354,7 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1085
1354
|
title: "Code civil",
|
|
1086
1355
|
type: "texte"
|
|
1087
1356
|
})
|
|
1088
|
-
}),
|
|
1357
|
+
}), x("c(?:ode|\\.)? ?trav(?:ail)?", {
|
|
1089
1358
|
flags: "i",
|
|
1090
1359
|
value: (e, t) => ({
|
|
1091
1360
|
cid: "LEGITEXT000006072050",
|
|
@@ -1094,7 +1363,7 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1094
1363
|
title: "Code du travail",
|
|
1095
1364
|
type: "texte"
|
|
1096
1365
|
})
|
|
1097
|
-
}),
|
|
1366
|
+
}), x("c(?:ode|\\.)? ?p[eé]n(?:al)?", {
|
|
1098
1367
|
flags: "i",
|
|
1099
1368
|
value: (e, t) => ({
|
|
1100
1369
|
cid: "LEGITEXT000006070719",
|
|
@@ -1103,7 +1372,7 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1103
1372
|
title: "Code pénal",
|
|
1104
1373
|
type: "texte"
|
|
1105
1374
|
})
|
|
1106
|
-
}),
|
|
1375
|
+
}), x("c(?:ode|\\.)? ?pr(?:oc(?:[eé]dure)?)? ?p[eé]n(?:al)?|cpp", {
|
|
1107
1376
|
flags: "i",
|
|
1108
1377
|
value: (e, t) => ({
|
|
1109
1378
|
cid: "LEGITEXT000006071154",
|
|
@@ -1112,7 +1381,7 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1112
1381
|
title: "Code de procédure pénale",
|
|
1113
1382
|
type: "texte"
|
|
1114
1383
|
})
|
|
1115
|
-
}),
|
|
1384
|
+
}), x("c(?:ode|\\.)? ?pr(?:oc(?:[eé]dure)?)? ?civ(?:il)?|cpc", {
|
|
1116
1385
|
flags: "i",
|
|
1117
1386
|
value: (e, t) => ({
|
|
1118
1387
|
cid: "LEGITEXT000006070716",
|
|
@@ -1121,7 +1390,7 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1121
1390
|
title: "Code de procédure civile",
|
|
1122
1391
|
type: "texte"
|
|
1123
1392
|
})
|
|
1124
|
-
}),
|
|
1393
|
+
}), x("c(?:ode|\\.)? ?s[eé]cur(?:it[eé])? ?soc(?:iale)?|css", {
|
|
1125
1394
|
flags: "i",
|
|
1126
1395
|
value: (e, t) => ({
|
|
1127
1396
|
cid: "LEGITEXT000006073189",
|
|
@@ -1130,7 +1399,7 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1130
1399
|
title: "Code de la sécurité sociale",
|
|
1131
1400
|
type: "texte"
|
|
1132
1401
|
})
|
|
1133
|
-
}),
|
|
1402
|
+
}), x("c(?:ode|\\.)? ?rur(?:al)?(?: et de la p[êe]che maritime)?", {
|
|
1134
1403
|
flags: "i",
|
|
1135
1404
|
value: (e, t) => ({
|
|
1136
1405
|
cid: "LEGITEXT000006071367",
|
|
@@ -1139,7 +1408,7 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1139
1408
|
title: "Code rural et de la pêche maritime",
|
|
1140
1409
|
type: "texte"
|
|
1141
1410
|
})
|
|
1142
|
-
}),
|
|
1411
|
+
}), x("c(?:ode|\\.)? ?env(?:ironnement)?", {
|
|
1143
1412
|
flags: "i",
|
|
1144
1413
|
value: (e, t) => ({
|
|
1145
1414
|
cid: "LEGITEXT000006074220",
|
|
@@ -1148,7 +1417,7 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1148
1417
|
title: "Code de l'environnement",
|
|
1149
1418
|
type: "texte"
|
|
1150
1419
|
})
|
|
1151
|
-
}),
|
|
1420
|
+
}), x("c(?:ode|\\.)? ?urb(?:anisme)?", {
|
|
1152
1421
|
flags: "i",
|
|
1153
1422
|
value: (e, t) => ({
|
|
1154
1423
|
cid: "LEGITEXT000006074075",
|
|
@@ -1157,7 +1426,7 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1157
1426
|
title: "Code de l'urbanisme",
|
|
1158
1427
|
type: "texte"
|
|
1159
1428
|
})
|
|
1160
|
-
}),
|
|
1429
|
+
}), x("c(?:ode|\\.)? ?jus(?:tice)? ?adm(?:in(?:istrative)?)?|cja", {
|
|
1161
1430
|
flags: "i",
|
|
1162
1431
|
value: (e, t) => ({
|
|
1163
1432
|
cid: "LEGITEXT000006070933",
|
|
@@ -1166,7 +1435,7 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1166
1435
|
title: "Code de justice administrative",
|
|
1167
1436
|
type: "texte"
|
|
1168
1437
|
})
|
|
1169
|
-
}),
|
|
1438
|
+
}), x("cgi", {
|
|
1170
1439
|
flags: "i",
|
|
1171
1440
|
value: (e, t) => ({
|
|
1172
1441
|
cid: "LEGITEXT000006069577",
|
|
@@ -1175,7 +1444,7 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1175
1444
|
title: "Code général des impôts",
|
|
1176
1445
|
type: "texte"
|
|
1177
1446
|
})
|
|
1178
|
-
}),
|
|
1447
|
+
}), x("c(?:ode|\\.)? ?com(?:merce)?", {
|
|
1179
1448
|
flags: "i",
|
|
1180
1449
|
value: (e, t) => ({
|
|
1181
1450
|
cid: "LEGITEXT000005634379",
|
|
@@ -1184,27 +1453,27 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1184
1453
|
title: "Code de commerce",
|
|
1185
1454
|
type: "texte"
|
|
1186
1455
|
})
|
|
1187
|
-
})), Q = w(
|
|
1456
|
+
})), Q = w(xr, tn(le, { value: (e, t) => e === void 0 ? void 0 : {
|
|
1188
1457
|
...e,
|
|
1189
1458
|
position: t.position()
|
|
1190
|
-
} }),
|
|
1459
|
+
} }), tn(te, { value: (e, t) => ({
|
|
1191
1460
|
...e,
|
|
1192
1461
|
position: t.position()
|
|
1193
|
-
}) })), $ =
|
|
1462
|
+
}) })), $ = T(x(" (?:du |de la |de l'|des |de |d')?", { flags: "i" }), { default: "" }), Sr = x(".+?(?=\\s*(?:du |de la |de l'|des |de |d')?\\s*(?:art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?))", {
|
|
1194
1463
|
flags: "i",
|
|
1195
1464
|
value: (e, t) => ({
|
|
1196
1465
|
type: "texte",
|
|
1197
1466
|
title: e[0].trim(),
|
|
1198
1467
|
position: t.position()
|
|
1199
1468
|
})
|
|
1200
|
-
}),
|
|
1469
|
+
}), Cr = x(".+", {
|
|
1201
1470
|
flags: "i",
|
|
1202
1471
|
value: (e, t) => ({
|
|
1203
1472
|
type: "texte",
|
|
1204
1473
|
title: e[0].trim(),
|
|
1205
1474
|
position: t.position()
|
|
1206
1475
|
})
|
|
1207
|
-
}),
|
|
1476
|
+
}), wr = w(A([
|
|
1208
1477
|
Q,
|
|
1209
1478
|
$,
|
|
1210
1479
|
Z
|
|
@@ -1216,7 +1485,7 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1216
1485
|
position: t.position(),
|
|
1217
1486
|
type: "parent-enfant"
|
|
1218
1487
|
};
|
|
1219
|
-
} }),
|
|
1488
|
+
} }), A([
|
|
1220
1489
|
Z,
|
|
1221
1490
|
$,
|
|
1222
1491
|
Q
|
|
@@ -1225,8 +1494,8 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1225
1494
|
parent: e[2],
|
|
1226
1495
|
position: t.position(),
|
|
1227
1496
|
type: "parent-enfant"
|
|
1228
|
-
}) }),
|
|
1229
|
-
|
|
1497
|
+
}) }), A([
|
|
1498
|
+
Sr,
|
|
1230
1499
|
$,
|
|
1231
1500
|
Z
|
|
1232
1501
|
], { value: (e, t) => {
|
|
@@ -1237,25 +1506,25 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1237
1506
|
position: t.position(),
|
|
1238
1507
|
type: "parent-enfant"
|
|
1239
1508
|
};
|
|
1240
|
-
} }),
|
|
1509
|
+
} }), A([
|
|
1241
1510
|
Z,
|
|
1242
1511
|
$,
|
|
1243
|
-
|
|
1512
|
+
Cr
|
|
1244
1513
|
], { value: (e, t) => ({
|
|
1245
1514
|
child: e[0],
|
|
1246
1515
|
parent: e[2],
|
|
1247
1516
|
position: t.position(),
|
|
1248
1517
|
type: "parent-enfant"
|
|
1249
|
-
}) }), Z, Q,
|
|
1518
|
+
}) }), Z, Q, Cr), Tr = (e) => e?.replace(/\n/g, " ").replace(/ {2,}/g, " ").replace(/ \(\d+\)\.?$/, "").replace(/\.$/, ""), Er = (e) => {
|
|
1250
1519
|
let t = e.META.META_SPEC.META_TEXTE_VERSION.DATE_DEBUT;
|
|
1251
1520
|
return t === void 0 || ["2222-02-22", "2999-01-01"].includes(t) ? e.META.META_SPEC.META_TEXTE_CHRONICLE.DATE_PUBLI : t;
|
|
1252
|
-
},
|
|
1521
|
+
}, Dr = (e) => {
|
|
1253
1522
|
let t = e.META.META_SPEC.META_TEXTE_CHRONICLE.DATE_TEXTE;
|
|
1254
1523
|
if (!["2222-02-22", "2999-01-01"].includes(t)) return t;
|
|
1255
1524
|
let n = e.META.META_SPEC.META_TEXTE_VERSION.DATE_DEBUT;
|
|
1256
1525
|
if (n !== void 0 && !["2222-02-22", "2999-01-01"].includes(n)) return n;
|
|
1257
1526
|
throw Error(`Missing date signature in text ${e.META.META_COMMUN.ID}`);
|
|
1258
|
-
},
|
|
1527
|
+
}, Or = (e) => (t, n) => {
|
|
1259
1528
|
let r = e(t), i = e(n);
|
|
1260
1529
|
if (r !== i) return r.localeCompare(i);
|
|
1261
1530
|
let a = t.META.META_COMMUN, o = a.ORIGINE, s = n.META.META_COMMUN, c = s.ORIGINE;
|
|
@@ -1264,6 +1533,6 @@ var Qn = S("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
|
|
|
1264
1533
|
if (c === "JORF") return 1;
|
|
1265
1534
|
}
|
|
1266
1535
|
throw Error(`TODO: Unable to sort texts ${a.ID} & ${s.ID} by date.`);
|
|
1267
|
-
},
|
|
1536
|
+
}, kr = gr;
|
|
1268
1537
|
//#endregion
|
|
1269
|
-
export {
|
|
1538
|
+
export { E as TextParserContext, se as action, an as actionTargets, ge as addChildLeftToLastChild, Bt as addLinksOrReferencesToHtmlPage, Ct as addLinksToHtml, gr as addLinksToMarkdown, kr as addLinksToText, We as addPositionsToTableOfContentsItems, Ft as adjectifNumeralOrdinalCourt, je as adjectifTemporelSingulier, dt as adverbeMultiplicatifLatin, $t as adverbeRelatif, w as alternatives, zt as article, Ze as articles, v as assertNever, ut as auPortion, st as auxPortions, Sn as buildArticlePortionTreeFromHtml, A as chain, ke as chainTransformers, ze as citation, Le as citationLigne, Ve as citationSimple, Tr as cleanTexteTitle, o as compoundReferencesSeparators, tn as convert, Ut as convertHtmlElementsToText, Se as createEnumerationOrBoundedInterval, ee as createParentChildTreeFromReferences, tt as date, Qe as decodeNamedHtmlEntities, rt as decodeNumericHtmlEntities, yt as definitionArticleDansCitation, Gt as definitionArticleDansProjetOuPropositionLoi, Ht as definitionDivision, de as definitionTexteFrancais, et as designationArticle, Tt as designationDivision, h as ditPluriel, f as ditSingulier, It as division, S as divisionTypes, ft as divisions, Vt as duDate, $e as espace, Oe as espaceAdverbeRelatif, ie as europeanLawNatures, m as extendLoadedArticle, mr as extractActionDirectivesFromHtml, dr as extractActionDirectivesFromText, nt as extractBillDefinitions, qe as extractCitationReferences, Cn as extractPortionSelectors, Zt as extractReferences, De as extractReferencesWithOriginalTransformations, Ye as extractTextLinks, hn as formatLongDate, Ne as frenchLawNatures, ln as getArticleDateDebut, N as getArticleDateSignature, s as getExtractedReferences, Jt as getExtractedReferencesWithOriginalTransformations, Et as getExtractedTableOfContentsFromTextBill, d as getOrLoadArticle, un as getOrLoadArticleSiblingId, _r as getOrLoadDocument, vr as getOrLoadDocumentsByDossierParlementaireUid, yr as getOrLoadDossierParlementaire, ve as getOrLoadJo, k as getOrLoadSectionTa, r as getOrLoadSectionsTa, pt as getOrLoadTexteVersion, pe as getOrLoadTextelr, he as getOrLoadTextesVersions, xe as getOrLoadTexteslr, Er as getTexteVersionDateDebut, Dr as getTexteVersionDateSignature, Te as identificationTexteEuropeen, Ie as internationalLawNatures, ye as introPluriel, gt as introSingulier, ne as isTextAstAtomicReference, ue as isTextAstDivision, Nt as isTextAstPortion, oe as iterAtomicFirstParentReferences, y as iterAtomicReferences, Ee as iterIncludedReferences, _t as iterReferenceLinks, hr as jsonReplacer, ce as lawNatures, it as lettreAscii, i as liaisonPluriel, mt as liaisonSingulier, Pt as linkTypes, at as listeArticles, fe as listeReferencesSeules, _ as loadArticles, Be as localizationAdverbs, Ke as natureDivisionSingulier, rn as natureTexteFrancais, He as newAssembleeObjectCache, we as newLegifranceObjectCache, t as newObjectCache, p as newReverseTransformationsMergedFromPositionsIterator, jt as nomArticle, St as nomSpecialArticle, Dt as nombreAsTextAstNumber, Rt as nombreCardinal, Xe as nombreRomainCardinal, vt as nombreRomainOrdinal, Wt as nombreRomainOu0iAsTextAstNumber, At as nonLettre, xt as numero, Ot as numeroDivision, a as numeroEtOuDateTexteFrancais, Ue as numeroPortion, Pe as numeroTexteEuropeen, re as numeroTexteFrancais, T as optional, Me as optionalEspaceDuTerritoire, Qt as parseText, Re as portionTypes, nn as portions, me as reference, be as referenceSeule, x as regExp, l as relatifPlurielPrepose, Xt as relatifSingulierPrepose, c as repeat, kt as replaceHtmlPatterns, bt as replacePattern, ct as replaceTextPatterns, U as resolvePortionSelector, u as reversePositionsSplitFromPositions, _e as reverseTransformationFromPosition, ht as reverseTransformationsMergedFromPositions, n as reverseTransformedInnerFragment, O as reverseTransformedReplacement, Z as searchArticle, br as searchArticleKeyword, wr as searchQueryReference, Q as searchTexte, xr as searchTexteAbbreviations, ot as simplifyHtml, C as simplifyPlainText, Kt as simplifyText, en as simplifyUnicodeCharacters, pn as sortArticlesByDate, Or as sortTextesVersionsByDate, Fe as texte, te as texteEuropeen, le as texteFrancais, Mt as texteInternational, Je as unePortion, g as uniteBasePreciseeSingulier, ae as uniteBaseSingulier, D as urlFromLegalId, Yt as variable, lt as virguleOuEspace, Lt as walkTableOfContents, Ae as wordsTree };
|