@tricoteuses/tisseuse 0.13.7 → 0.13.9
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/README.md +39 -35
- package/dist/{textes-BIJjrNwg.js → html-DhGw-Yqr.js} +3875 -5243
- package/dist/index.js +280 -147
- package/dist/resolver-DZS-DNp6.js +1848 -0
- package/dist/server-f-legi.js +532 -0
- package/dist/server.js +530 -2161
- package/dist/src/lib/extractors/links.d.ts +6 -4
- package/dist/src/lib/f_legi/resolver.d.ts +5 -7
- package/dist/src/lib/index.d.ts +2 -0
- package/dist/src/lib/legi/canutes_resolver.d.ts +5 -6
- package/dist/src/lib/legi/resolver.d.ts +15 -12
- package/dist/src/lib/legi/resolver.test.d.ts +1 -0
- package/dist/src/lib/legi/text_titles_infos.d.ts +26 -0
- package/dist/src/lib/linkers/html.d.ts +15 -4
- package/dist/src/lib/linkers/markdown.d.ts +4 -2
- package/dist/src/lib/server/databases/index.d.ts +1 -1
- package/dist/src/lib/server/f_legi/index.d.ts +1 -0
- package/dist/src/lib/server/index.d.ts +2 -1
- package/dist/src/lib/server/judilibre_search.d.ts +31 -0
- package/dist/src/lib/server/judilibre_search.test.d.ts +1 -0
- package/dist/src/lib/server/legi/resolvers.d.ts +2 -7
- package/dist/src/lib/server/linkers/html.d.ts +4 -2
- package/dist/src/scripts/enrich_senat_documents.d.ts +1 -0
- package/dist/src/scripts/index_postgres_judilibre.d.ts +1 -0
- package/package.json +8 -1
- package/dist/src/lib/f_legi/extractors/links.d.ts +0 -134
- package/dist/src/lib/f_legi/linkers/html.d.ts +0 -51
- package/dist/src/lib/server/f_legi/databases/index.d.ts +0 -2
- package/dist/src/lib/server/f_legi/linkers/html.d.ts +0 -20
- package/dist/src/scripts/f_legi/add_links_to_html_document.d.ts +0 -0
- /package/dist/src/{scripts/extract_texts_titles_infos.d.ts → lib/f_legi/resolver.test.d.ts} +0 -0
|
@@ -0,0 +1,1848 @@
|
|
|
1
|
+
//#region ../../node_modules/@tricoteuses/legifrance/dist/numbers.js
|
|
2
|
+
var e = [
|
|
3
|
+
[],
|
|
4
|
+
["un"],
|
|
5
|
+
["du"],
|
|
6
|
+
["ter"],
|
|
7
|
+
["quater"],
|
|
8
|
+
["quin"],
|
|
9
|
+
["sex"],
|
|
10
|
+
["sept"],
|
|
11
|
+
["oct"],
|
|
12
|
+
["nov"]
|
|
13
|
+
], t = [
|
|
14
|
+
[],
|
|
15
|
+
["decies"],
|
|
16
|
+
["vicies", "vecies"],
|
|
17
|
+
["tricies", "trecies"],
|
|
18
|
+
["quadragies"],
|
|
19
|
+
["quinquagies"],
|
|
20
|
+
["sexagies"],
|
|
21
|
+
["septuagies"],
|
|
22
|
+
["octogies"],
|
|
23
|
+
["nonagies"]
|
|
24
|
+
], n = [
|
|
25
|
+
[],
|
|
26
|
+
["semel"],
|
|
27
|
+
["bis"],
|
|
28
|
+
["ter"],
|
|
29
|
+
["quater"],
|
|
30
|
+
["quinquies"],
|
|
31
|
+
["sexies"],
|
|
32
|
+
["septies"],
|
|
33
|
+
["octies"],
|
|
34
|
+
["nonies", "novies"]
|
|
35
|
+
], r = [
|
|
36
|
+
1e3,
|
|
37
|
+
"M",
|
|
38
|
+
900,
|
|
39
|
+
"CM",
|
|
40
|
+
500,
|
|
41
|
+
"D",
|
|
42
|
+
400,
|
|
43
|
+
"CD",
|
|
44
|
+
100,
|
|
45
|
+
"C",
|
|
46
|
+
90,
|
|
47
|
+
"XC",
|
|
48
|
+
50,
|
|
49
|
+
"L",
|
|
50
|
+
40,
|
|
51
|
+
"XL",
|
|
52
|
+
10,
|
|
53
|
+
"X",
|
|
54
|
+
9,
|
|
55
|
+
"IX",
|
|
56
|
+
5,
|
|
57
|
+
"V",
|
|
58
|
+
4,
|
|
59
|
+
"IV",
|
|
60
|
+
1,
|
|
61
|
+
"I"
|
|
62
|
+
], i = [
|
|
63
|
+
"dix",
|
|
64
|
+
"onze",
|
|
65
|
+
"douze",
|
|
66
|
+
"treize",
|
|
67
|
+
"quatorze",
|
|
68
|
+
"quinze",
|
|
69
|
+
"seize",
|
|
70
|
+
"dix-sept",
|
|
71
|
+
"dix-huit",
|
|
72
|
+
"dix-neuf"
|
|
73
|
+
], a = [
|
|
74
|
+
"",
|
|
75
|
+
"dix",
|
|
76
|
+
"vingt",
|
|
77
|
+
"trente",
|
|
78
|
+
"quarante",
|
|
79
|
+
"cinquante",
|
|
80
|
+
"soixante",
|
|
81
|
+
"soixante-dix",
|
|
82
|
+
"quatre-vingt",
|
|
83
|
+
"quatre-vingt-dix"
|
|
84
|
+
], o = [
|
|
85
|
+
"",
|
|
86
|
+
"un",
|
|
87
|
+
"deux",
|
|
88
|
+
"trois",
|
|
89
|
+
"quatre",
|
|
90
|
+
"cinq",
|
|
91
|
+
"six",
|
|
92
|
+
"sept",
|
|
93
|
+
"huit",
|
|
94
|
+
"neuf"
|
|
95
|
+
];
|
|
96
|
+
function s(e) {
|
|
97
|
+
if (!(e < 0)) {
|
|
98
|
+
if (e === 0) return "zéro";
|
|
99
|
+
if (e < 10) return o[e];
|
|
100
|
+
if (e < 20) return i[e - 10];
|
|
101
|
+
if (e < 100) {
|
|
102
|
+
let t = Math.floor(e / 10), n = e % 10;
|
|
103
|
+
if (t === 7) return `soixante-${i[n]}`;
|
|
104
|
+
if (t === 9) return `quatre-vingt-${i[n]}`;
|
|
105
|
+
let r = a[t];
|
|
106
|
+
return n === 0 ? r : n === 1 && t !== 8 ? `${r} et ${o[n]}` : r + `-${o[n]}`;
|
|
107
|
+
}
|
|
108
|
+
if (e < 1e3) {
|
|
109
|
+
let t = Math.floor(e / 100), n = e % 100, r = t === 1 ? "cent" : `${o[t]} cents`;
|
|
110
|
+
return n === 0 ? r : (t > 1 && n > 0 && (r = r.slice(0, -1)), `${r} ${s(n)}`);
|
|
111
|
+
}
|
|
112
|
+
if (e < 1e6) {
|
|
113
|
+
let t = Math.floor(e / 1e3), n = e % 1e3, r = t === 1 ? "mille" : `${s(t)} mille`;
|
|
114
|
+
return n === 0 ? r : r + ` ${s(n)}`;
|
|
115
|
+
}
|
|
116
|
+
throw Error("Number must be a less than one million.");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function* c(e) {
|
|
120
|
+
e === 1 && (yield "premier", yield "première", yield "unique", yield "Ier", yield "Ière", yield "1er", yield "1ère");
|
|
121
|
+
let t = s(e);
|
|
122
|
+
t !== void 0 && (yield t);
|
|
123
|
+
let n = p(e);
|
|
124
|
+
n !== void 0 && (yield n), yield e.toString();
|
|
125
|
+
}
|
|
126
|
+
function* l(r) {
|
|
127
|
+
if (!(r <= 0)) if (r < 10) yield* n[r];
|
|
128
|
+
else if (r < 100) {
|
|
129
|
+
let n = Math.floor(r / 10), i = r % 10;
|
|
130
|
+
for (let r of t[n]) for (let t of e[i]) yield `${t}${[
|
|
131
|
+
2,
|
|
132
|
+
8,
|
|
133
|
+
9
|
|
134
|
+
].includes(i) && r[0] !== "o" ? "o" : ""}${r}`;
|
|
135
|
+
if (n < 9 && [8, 9].includes(i)) {
|
|
136
|
+
let e = t[n + 1];
|
|
137
|
+
for (let t of e) yield `${i === 8 ? "duo" : "un"}${t[0] === "o" ? "d" : "de"}${t}`;
|
|
138
|
+
}
|
|
139
|
+
} else throw Error("Number must be a less than 100.");
|
|
140
|
+
}
|
|
141
|
+
function* u(e) {
|
|
142
|
+
if (e === 1) yield "premier", yield "première", yield "Ier", yield "Ière", yield "1er", yield "1ère";
|
|
143
|
+
else {
|
|
144
|
+
let t = f(e);
|
|
145
|
+
t !== void 0 && (yield t);
|
|
146
|
+
let n = p(e);
|
|
147
|
+
n !== void 0 && (yield `${n}e`, yield `${n}ème`), e > 0 && (yield `${e}e`, yield `${e}ème`), e === 2 && (yield "second", yield "seconde", yield "2nd", yield "2nde");
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function d(e) {
|
|
151
|
+
e = e.toUpperCase();
|
|
152
|
+
let t = 0, n = 0;
|
|
153
|
+
for (let i = 0; i < r.length; i += 2) for (; e.substring(t, t + r[i + 1].length) === r[i + 1];) n += r[i], t += r[i + 1].length;
|
|
154
|
+
return n;
|
|
155
|
+
}
|
|
156
|
+
function f(e) {
|
|
157
|
+
if (e <= 0) return;
|
|
158
|
+
if (e === 1) return "premier";
|
|
159
|
+
let t = s(e);
|
|
160
|
+
if (t === void 0) return;
|
|
161
|
+
let n = t.match(/(^| )([^ ]+)$/)[2];
|
|
162
|
+
return n === "un" ? t.slice(0, -2) + "unième" : n === "cinq" ? t.slice(0, -4) + "cinquième" : n === "neuf" ? t.slice(0, -3) + "euvième" : n.endsWith("e") ? t.slice(0, -1) + "ième" : t + "ième";
|
|
163
|
+
}
|
|
164
|
+
function p(e) {
|
|
165
|
+
if (e < 0) return;
|
|
166
|
+
if (e === 0) return "0I";
|
|
167
|
+
let t = "";
|
|
168
|
+
for (let n = 0; n < r.length; n += 2) for (; e >= r[n];) t += r[n + 1], e -= r[n];
|
|
169
|
+
return t;
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/lib/asserts.ts
|
|
173
|
+
function m(e, t) {
|
|
174
|
+
throw `Unexpected type ${e}: ${t}`;
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/lib/text_parsers/parsers.ts
|
|
178
|
+
var h = class {
|
|
179
|
+
input;
|
|
180
|
+
offset;
|
|
181
|
+
currentArticle = void 0;
|
|
182
|
+
currentText = void 0;
|
|
183
|
+
length = 0;
|
|
184
|
+
usedInputs = void 0;
|
|
185
|
+
variables = {};
|
|
186
|
+
constructor(e, t = 0) {
|
|
187
|
+
this.input = e, this.offset = t;
|
|
188
|
+
}
|
|
189
|
+
position() {
|
|
190
|
+
return {
|
|
191
|
+
start: this.offset,
|
|
192
|
+
stop: this.offset + this.length
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
remaining() {
|
|
196
|
+
return this.input.slice(this.offset);
|
|
197
|
+
}
|
|
198
|
+
text(e) {
|
|
199
|
+
return e === void 0 ? this.input.slice(this.offset, this.offset + this.length) : this.input.slice(e.start, e.stop);
|
|
200
|
+
}
|
|
201
|
+
textFromResults(e) {
|
|
202
|
+
return e === void 0 ? "" : ie(e);
|
|
203
|
+
}
|
|
204
|
+
}, g = (...e) => (t) => {
|
|
205
|
+
for (let n of e) {
|
|
206
|
+
let e = (Array.isArray(n) ? _(n, { exportVariables: !0 }) : n)(t);
|
|
207
|
+
if (e !== void 0) return e;
|
|
208
|
+
}
|
|
209
|
+
}, _ = (e, { exportVariables: t, value: n } = {}) => (r) => {
|
|
210
|
+
let i = r.offset, a = r.variables;
|
|
211
|
+
r.variables = { ...a };
|
|
212
|
+
let o = [], s = [];
|
|
213
|
+
for (let n of e) {
|
|
214
|
+
let e = (Array.isArray(n) ? _(n, { exportVariables: t }) : n)(r);
|
|
215
|
+
if (e === void 0) {
|
|
216
|
+
r.length = 0, r.offset = i, r.usedInputs = void 0, r.variables = a;
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
r.usedInputs !== void 0 && o.push(r.usedInputs), s.push(e);
|
|
220
|
+
}
|
|
221
|
+
r.length = r.offset - i, r.offset -= r.length, r.usedInputs = o.length === 0 ? void 0 : o;
|
|
222
|
+
let c;
|
|
223
|
+
if (n === void 0) c = s;
|
|
224
|
+
else if (typeof n == "function") {
|
|
225
|
+
let e = n(s, r);
|
|
226
|
+
if (e === void 0) {
|
|
227
|
+
r.length = 0, r.offset = i, r.usedInputs = void 0, r.variables = a;
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
c = e;
|
|
231
|
+
} else c = n;
|
|
232
|
+
return r.offset += r.length, r.length = 0, t || (r.variables = a), c;
|
|
233
|
+
}, v = (e, { value: t }) => (n) => {
|
|
234
|
+
let r = n.offset, i = n.variables;
|
|
235
|
+
n.variables = { ...i };
|
|
236
|
+
let a = (Array.isArray(e) ? _(e, { exportVariables: !0 }) : e)(n);
|
|
237
|
+
if (a !== void 0) {
|
|
238
|
+
if (n.length = n.offset - r, n.offset -= n.length, typeof t == "function") {
|
|
239
|
+
let e = t(a, n);
|
|
240
|
+
if (e === void 0) {
|
|
241
|
+
n.length = 0, n.offset = r, n.usedInputs = void 0, n.variables = i;
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
return n.offset += n.length, n.length = 0, e;
|
|
245
|
+
}
|
|
246
|
+
return n.offset += n.length, n.length = 0, t;
|
|
247
|
+
}
|
|
248
|
+
}, ee = (e, t, n = 80, r) => {
|
|
249
|
+
let i = new RegExp(e, "i"), a = (e) => {
|
|
250
|
+
let r = e.input.slice(e.offset, e.offset + n);
|
|
251
|
+
if (i.test(r)) return (Array.isArray(t) ? _(t, { exportVariables: !0 }) : t)(e);
|
|
252
|
+
};
|
|
253
|
+
return a.extract = function* (t, i) {
|
|
254
|
+
let o = new RegExp(r ?? e, i?.globalRegExpFlags ?? "gimv"), s = -1, c = "";
|
|
255
|
+
for (; t.offset < t.input.length;) {
|
|
256
|
+
if (t.offset > s) {
|
|
257
|
+
o.lastIndex = t.offset;
|
|
258
|
+
let e = o.exec(t.input);
|
|
259
|
+
if (e === null) return;
|
|
260
|
+
s = e.index, c = e[0], i?.jumpExact ? t.offset = s : i?.overlapWindow !== void 0 || (t.offset = Math.max(t.offset, s - n));
|
|
261
|
+
}
|
|
262
|
+
if (i?.overlapWindow !== void 0) {
|
|
263
|
+
let e, n = -1, r = i.overlapWindowForCandidate?.(c) ?? i.overlapWindow, l = Math.max(t.offset, s - r);
|
|
264
|
+
for (let r = l; r <= s; r++) {
|
|
265
|
+
t.offset = r;
|
|
266
|
+
let i = a(t);
|
|
267
|
+
if (i !== void 0 && t.offset > s) {
|
|
268
|
+
e = i, n = t.offset;
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
e === void 0 ? (t.offset = s + 1, o.lastIndex <= t.offset ? o.lastIndex = t.offset : t.offset = o.lastIndex) : (yield e, t.offset = n, o.lastIndex = t.offset);
|
|
273
|
+
} else {
|
|
274
|
+
let e = a(t);
|
|
275
|
+
e === void 0 ? i?.jumpExact ? o.lastIndex <= t.offset ? t.offset++ : t.offset = o.lastIndex : t.offset++ : (yield e, i?.jumpExact && (o.lastIndex = t.offset));
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}, a;
|
|
279
|
+
}, te = (e, { lookbackLength: t = 50, value: n } = {}) => (r) => {
|
|
280
|
+
let i = Math.max(0, r.offset - t);
|
|
281
|
+
for (let t = r.offset; t >= i; t--) {
|
|
282
|
+
let i = new h(r.input, t);
|
|
283
|
+
i.variables = { ...r.variables }, i.currentArticle = r.currentArticle, i.currentText = r.currentText;
|
|
284
|
+
let a = (Array.isArray(e) ? _(e, { exportVariables: !0 }) : e)(i);
|
|
285
|
+
if (a !== void 0 && i.offset === r.offset) {
|
|
286
|
+
let e = a;
|
|
287
|
+
if (n !== void 0) if (typeof n == "function") {
|
|
288
|
+
let t = n(a, i);
|
|
289
|
+
if (t === void 0) continue;
|
|
290
|
+
e = t;
|
|
291
|
+
} else e = n;
|
|
292
|
+
return r.variables = i.variables, r.length = 0, r.usedInputs = void 0, e;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}, y = (e, { default: t, value: n }) => (r) => {
|
|
296
|
+
let i = (Array.isArray(e) ? _(e, { exportVariables: !0 }) : e)(r);
|
|
297
|
+
if (i === void 0) i = typeof t == "function" ? t(r) : t;
|
|
298
|
+
else if (n !== void 0) if (typeof n == "function") {
|
|
299
|
+
let e = n(i, r);
|
|
300
|
+
if (e === void 0) {
|
|
301
|
+
r.length = 0, r.usedInputs = void 0;
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
i = e;
|
|
305
|
+
} else i = n;
|
|
306
|
+
return i;
|
|
307
|
+
}, ne = (e, t) => (Array.isArray(t) ? _(t) : t)(new h(e)), b = (e, { flags: t, value: n } = {}) => {
|
|
308
|
+
let r = new RegExp(e, "gy" + (t ?? ""));
|
|
309
|
+
return (e) => {
|
|
310
|
+
r.lastIndex = e.offset;
|
|
311
|
+
let t = r.exec(e.input);
|
|
312
|
+
if (t === null) return;
|
|
313
|
+
e.length = t[0].length, e.usedInputs = t[0];
|
|
314
|
+
let i;
|
|
315
|
+
if (n === void 0) i = t[0];
|
|
316
|
+
else if (typeof n == "function") {
|
|
317
|
+
let r = n(t, e);
|
|
318
|
+
if (r === void 0) {
|
|
319
|
+
e.length = 0, e.usedInputs = void 0;
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
i = r;
|
|
323
|
+
} else i = n;
|
|
324
|
+
return e.offset += e.length, e.length = 0, i;
|
|
325
|
+
};
|
|
326
|
+
}, re = (e, { max: t, min: n, separator: r, value: i } = {}) => (a) => {
|
|
327
|
+
let o = a.offset, s = a.variables;
|
|
328
|
+
a.variables = { ...s };
|
|
329
|
+
let c = [], l = [], u = 0;
|
|
330
|
+
for (; t === void 0 || u < t; u++) {
|
|
331
|
+
let t = (u === 0 || r === void 0 ? Array.isArray(e) ? _(e) : e : _([r, e]))(a);
|
|
332
|
+
if (t === void 0) break;
|
|
333
|
+
a.usedInputs !== void 0 && c.push(a.usedInputs), l.push(t);
|
|
334
|
+
}
|
|
335
|
+
if (n !== void 0 && u < n) {
|
|
336
|
+
a.length = 0, a.offset = o, a.usedInputs = void 0, a.variables = s;
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
a.length = a.offset - o, a.offset -= a.length, a.usedInputs = c.length === 0 ? void 0 : c;
|
|
340
|
+
let d;
|
|
341
|
+
if (i === void 0) d = l;
|
|
342
|
+
else if (typeof i == "function") {
|
|
343
|
+
let e = i(l, a);
|
|
344
|
+
if (e === void 0) {
|
|
345
|
+
a.length = 0, a.offset = o, a.usedInputs = void 0, a.variables = s;
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
d = e;
|
|
349
|
+
} else d = i;
|
|
350
|
+
return a.offset += a.length, a.length = 0, d;
|
|
351
|
+
}, ie = (e) => e.filter((e) => e !== null).map((e) => typeof e == "string" ? e : ie(e)).join(""), x = (e, t, { value: n } = {}) => (r) => {
|
|
352
|
+
let i = r.offset, a = r.variables;
|
|
353
|
+
r.variables = { ...a };
|
|
354
|
+
let o = (Array.isArray(t) ? _(t, { exportVariables: !0 }) : t)(r);
|
|
355
|
+
if (o === void 0) {
|
|
356
|
+
delete r.variables[e];
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
if (n === void 0) return r.variables[e] = o, o;
|
|
360
|
+
if (r.length = r.offset - i, r.offset -= r.length, typeof n == "function") {
|
|
361
|
+
let t = n(o, r);
|
|
362
|
+
if (t === void 0) {
|
|
363
|
+
r.length = 0, r.offset = i, r.usedInputs = void 0, r.variables = a, delete r.variables[e];
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
return r.offset += r.length, r.length = 0, r.variables[e] = t, t;
|
|
367
|
+
}
|
|
368
|
+
return r.offset += r.length, r.length = 0, r.variables[e] = n, n;
|
|
369
|
+
}, S = (e, { value: t } = {}) => (n) => {
|
|
370
|
+
let r = e, i = n.offset, a = /([\-\/\d\p{Alphabetic}'°]+)($|[^\-\/\d\p{Alphabetic}°]{1,10000})/gvy;
|
|
371
|
+
a.lastIndex = n.offset;
|
|
372
|
+
let o = [], s, c = (e) => /^[IVX]+$/g.test(e) ? d(e).toString() : e.toLowerCase().replace(/^no$/, "n°");
|
|
373
|
+
for (;;) {
|
|
374
|
+
let e = a.exec(n.input);
|
|
375
|
+
if (e === null) break;
|
|
376
|
+
let t = c(e[1]);
|
|
377
|
+
if (t === "constitution" && e[1][0] !== "C") break;
|
|
378
|
+
let l = r[t];
|
|
379
|
+
if (l === void 0) {
|
|
380
|
+
let u = a.lastIndex, d = Object.entries(r).filter(([e]) => e !== "cid" && e.includes(" ")).sort((e, t) => t[0].length - e[0].length).find(([e]) => {
|
|
381
|
+
let r = e.split(" ");
|
|
382
|
+
if (r[0] !== t) return !1;
|
|
383
|
+
a.lastIndex = u;
|
|
384
|
+
for (let e of r.slice(1)) {
|
|
385
|
+
let t = a.exec(n.input);
|
|
386
|
+
if (t === null || c(t[1]) !== e) return !1;
|
|
387
|
+
}
|
|
388
|
+
return !0;
|
|
389
|
+
});
|
|
390
|
+
if (d === void 0) break;
|
|
391
|
+
l = d[1], a.lastIndex = u;
|
|
392
|
+
let f = d[0].split(" "), p = [e];
|
|
393
|
+
for (let e = 1; e < f.length; e++) p.push(a.exec(n.input));
|
|
394
|
+
for (let e of p) o.push(e[0]);
|
|
395
|
+
s = p.at(-1)[2], r = l, i = a.lastIndex;
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
s = e[2], r = l, i = a.lastIndex, o.push(e[0]);
|
|
399
|
+
}
|
|
400
|
+
if (r.cid === void 0) {
|
|
401
|
+
n.length = 0, n.usedInputs = void 0;
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
s && (i -= s.length, o[o.length - 1] = o[o.length - 1].slice(0, -s.length)), n.length = i - n.offset, n.usedInputs = o.length === 0 ? void 0 : o;
|
|
405
|
+
let l = { cid: r.cid }, u;
|
|
406
|
+
if (t === void 0) u = l;
|
|
407
|
+
else if (typeof t == "function") {
|
|
408
|
+
let e = t(l, n);
|
|
409
|
+
if (e === void 0) {
|
|
410
|
+
n.length = 0, n.usedInputs = void 0;
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
u = e;
|
|
414
|
+
} else u = t;
|
|
415
|
+
return n.offset = i, n.length = 0, u;
|
|
416
|
+
}, ae = b(" ?['’] ?", { value: "'" }), C = b(" "), oe = b(" ?", { value: "" }), se = b("[a-z]", { flags: "i" }), ce = b(String.raw`(?=$|\P{Alphabetic})`, { flags: "iv" }), w = b("n ?[°o] ?", {
|
|
417
|
+
flags: "i",
|
|
418
|
+
value: "n° "
|
|
419
|
+
}), le = b("-"), ue = b(", ?", { value: ", " }), de = b("(, ?| )", { value: ", " }), T = b("(èm)?e"), fe = g(b("1er", { value: (e, t) => ({
|
|
420
|
+
position: t.position(),
|
|
421
|
+
text: t.text(),
|
|
422
|
+
value: 1
|
|
423
|
+
}) }), b("unique", { value: (e, t) => ({
|
|
424
|
+
position: t.position(),
|
|
425
|
+
text: t.text(),
|
|
426
|
+
value: 1
|
|
427
|
+
}) }), _([b(String.raw`\d+`), y(T, { default: "" })], { value: (e, t) => ({
|
|
428
|
+
position: t.position(),
|
|
429
|
+
text: t.text(),
|
|
430
|
+
value: parseInt(e[0])
|
|
431
|
+
}) })), E = b(String.raw`\d+`, { value: (e) => parseInt(e[0]) }), pe = g(b("1er", { value: 1 }), _([b(String.raw`\d+`), T], { value: (e) => parseInt(e[0]) })), me = b(String.raw`[IVXLCDM]+`, { value: (e) => d(e[0]) }), he = g(b("IER|Ier", { value: 1 }), _([b(String.raw`[IVXLCDM]+`), T], { value: (e) => d(e[0]) })), ge = g(b("0I", { value: (e, t) => ({
|
|
432
|
+
position: t.position(),
|
|
433
|
+
text: t.text(),
|
|
434
|
+
value: 0
|
|
435
|
+
}) }), b("IER|Ier", { value: (e, t) => ({
|
|
436
|
+
position: t.position(),
|
|
437
|
+
text: t.text(),
|
|
438
|
+
value: 1
|
|
439
|
+
}) }), _([b(String.raw`[IVXLCDM]+`), y(T, { default: "" })], { value: (e, t) => ({
|
|
440
|
+
position: t.position(),
|
|
441
|
+
text: t.text(),
|
|
442
|
+
value: d(e[0])
|
|
443
|
+
}) })), _e = g(b("dix", {
|
|
444
|
+
flags: "i",
|
|
445
|
+
value: 10
|
|
446
|
+
}), b("onze?", {
|
|
447
|
+
flags: "i",
|
|
448
|
+
value: 11
|
|
449
|
+
}), b("douze?", {
|
|
450
|
+
flags: "i",
|
|
451
|
+
value: 12
|
|
452
|
+
}), b("treize?", {
|
|
453
|
+
flags: "i",
|
|
454
|
+
value: 13
|
|
455
|
+
}), b("quatorze?", {
|
|
456
|
+
flags: "i",
|
|
457
|
+
value: 14
|
|
458
|
+
}), b("quinze?", {
|
|
459
|
+
flags: "i",
|
|
460
|
+
value: 15
|
|
461
|
+
}), b("seize?", {
|
|
462
|
+
flags: "i",
|
|
463
|
+
value: 16
|
|
464
|
+
})), ve = g(b("vingt", {
|
|
465
|
+
flags: "i",
|
|
466
|
+
value: 20
|
|
467
|
+
}), b("trente?", {
|
|
468
|
+
flags: "i",
|
|
469
|
+
value: 30
|
|
470
|
+
}), b("quarante?", {
|
|
471
|
+
flags: "i",
|
|
472
|
+
value: 40
|
|
473
|
+
}), b("cinquante?", {
|
|
474
|
+
flags: "i",
|
|
475
|
+
value: 50
|
|
476
|
+
}), b("soixante?", {
|
|
477
|
+
flags: "i",
|
|
478
|
+
value: 60
|
|
479
|
+
}), b("septante?", {
|
|
480
|
+
flags: "i",
|
|
481
|
+
value: 70
|
|
482
|
+
}), b("quatre-vingt", {
|
|
483
|
+
flags: "i",
|
|
484
|
+
value: 80
|
|
485
|
+
}), b("huitante?", {
|
|
486
|
+
flags: "i",
|
|
487
|
+
value: 80
|
|
488
|
+
}), b("octante?", {
|
|
489
|
+
flags: "i",
|
|
490
|
+
value: 80
|
|
491
|
+
}), b("nonante?", {
|
|
492
|
+
flags: "i",
|
|
493
|
+
value: 90
|
|
494
|
+
})), ye = g(b("une?", {
|
|
495
|
+
flags: "i",
|
|
496
|
+
value: 1
|
|
497
|
+
}), b("deux", {
|
|
498
|
+
flags: "i",
|
|
499
|
+
value: 2
|
|
500
|
+
}), b("trois", {
|
|
501
|
+
flags: "i",
|
|
502
|
+
value: 3
|
|
503
|
+
}), b("quatre?", {
|
|
504
|
+
flags: "i",
|
|
505
|
+
value: 4
|
|
506
|
+
}), b("cinqu?", {
|
|
507
|
+
flags: "i",
|
|
508
|
+
value: 5
|
|
509
|
+
}), b("six", {
|
|
510
|
+
flags: "i",
|
|
511
|
+
value: 6
|
|
512
|
+
}), b("sept", {
|
|
513
|
+
flags: "i",
|
|
514
|
+
value: 7
|
|
515
|
+
}), b("huit", {
|
|
516
|
+
flags: "i",
|
|
517
|
+
value: 8
|
|
518
|
+
}), b("neu[fv]", {
|
|
519
|
+
flags: "i",
|
|
520
|
+
value: 9
|
|
521
|
+
})), D = _([
|
|
522
|
+
x("centaines", y([x("centaine", y([ye, le], {
|
|
523
|
+
default: 0,
|
|
524
|
+
value: (e) => e[0]
|
|
525
|
+
})), b("cent-", {
|
|
526
|
+
flags: "i",
|
|
527
|
+
value: 1
|
|
528
|
+
})], {
|
|
529
|
+
default: 0,
|
|
530
|
+
value: (e, { variables: t }) => 100 * t.centaine
|
|
531
|
+
})),
|
|
532
|
+
x("dizaines", y(ve, { default: 0 })),
|
|
533
|
+
y(b("-(et-)?", { flags: "i" }), { default: "" }),
|
|
534
|
+
x("dix", y(_e, { default: 0 })),
|
|
535
|
+
y(le, { default: "" }),
|
|
536
|
+
x("unite", y(ye, { default: 0 }))
|
|
537
|
+
], { value: (e, { variables: t }) => t.centaines + t.dizaines + t.dix + t.unite }), be = g(b("1(er|ère)", {
|
|
538
|
+
flags: "i",
|
|
539
|
+
value: 1
|
|
540
|
+
}), b("premi(er|ère)", {
|
|
541
|
+
flags: "i",
|
|
542
|
+
value: 1
|
|
543
|
+
}), E, D), xe = g(b("premi(er|ère)", {
|
|
544
|
+
flags: "i",
|
|
545
|
+
value: 1
|
|
546
|
+
}), b("seconde?", {
|
|
547
|
+
flags: "i",
|
|
548
|
+
value: 2
|
|
549
|
+
}), _([D, b("ième", { flags: "i" })], { value: (e) => e[0] })), Se = g(pe, xe), Ce = [
|
|
550
|
+
{
|
|
551
|
+
pattern: "bis",
|
|
552
|
+
value: 2
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
pattern: "ter",
|
|
556
|
+
value: 3
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
pattern: "quater",
|
|
560
|
+
value: 4
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
pattern: "quinquies",
|
|
564
|
+
value: 5
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
pattern: "sexies",
|
|
568
|
+
value: 6
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
pattern: "septies",
|
|
572
|
+
value: 7
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
pattern: "octies",
|
|
576
|
+
value: 8
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
pattern: "no[nv]ies",
|
|
580
|
+
value: 9
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
pattern: "undecies",
|
|
584
|
+
value: 11
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
pattern: "duodecies",
|
|
588
|
+
value: 12
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
pattern: "semel",
|
|
592
|
+
value: 1
|
|
593
|
+
}
|
|
594
|
+
], we = Ce.filter((e) => e.pattern !== "semel").map((e) => e.pattern).join("|"), Te = v(g(b("quinquagies", {
|
|
595
|
+
flags: "i",
|
|
596
|
+
value: 50
|
|
597
|
+
}), b("sexagies", {
|
|
598
|
+
flags: "i",
|
|
599
|
+
value: 60
|
|
600
|
+
}), b("septuagies", {
|
|
601
|
+
flags: "i",
|
|
602
|
+
value: 70
|
|
603
|
+
}), b("octogies", {
|
|
604
|
+
flags: "i",
|
|
605
|
+
value: 80
|
|
606
|
+
}), _([x("unites", y(g(b("unde?", {
|
|
607
|
+
flags: "i",
|
|
608
|
+
value: -1
|
|
609
|
+
}), b("duode?", {
|
|
610
|
+
flags: "i",
|
|
611
|
+
value: -2
|
|
612
|
+
}), b("un", {
|
|
613
|
+
flags: "i",
|
|
614
|
+
value: 1
|
|
615
|
+
}), b("duo", {
|
|
616
|
+
flags: "i",
|
|
617
|
+
value: 2
|
|
618
|
+
}), b("ter", {
|
|
619
|
+
flags: "i",
|
|
620
|
+
value: 3
|
|
621
|
+
}), b("quater", {
|
|
622
|
+
flags: "i",
|
|
623
|
+
value: 4
|
|
624
|
+
}), b("quin", {
|
|
625
|
+
flags: "i",
|
|
626
|
+
value: 5
|
|
627
|
+
}), b("sept", {
|
|
628
|
+
flags: "i",
|
|
629
|
+
value: 7
|
|
630
|
+
}), b("sex?", {
|
|
631
|
+
flags: "i",
|
|
632
|
+
value: 6
|
|
633
|
+
}), b("octo", {
|
|
634
|
+
flags: "i",
|
|
635
|
+
value: 8
|
|
636
|
+
}), b("novo", {
|
|
637
|
+
flags: "i",
|
|
638
|
+
value: 9
|
|
639
|
+
})), { default: 0 })), x("dizaines", g(b("decies", {
|
|
640
|
+
flags: "i",
|
|
641
|
+
value: 10
|
|
642
|
+
}), b("v[ei]cies", {
|
|
643
|
+
flags: "i",
|
|
644
|
+
value: 20
|
|
645
|
+
}), b("tr[ei]cies", {
|
|
646
|
+
flags: "i",
|
|
647
|
+
value: 30
|
|
648
|
+
}), b("quadragies", {
|
|
649
|
+
flags: "i",
|
|
650
|
+
value: 40
|
|
651
|
+
}), b("quinquagies", {
|
|
652
|
+
flags: "i",
|
|
653
|
+
value: 50
|
|
654
|
+
}), b("sexagies", {
|
|
655
|
+
flags: "i",
|
|
656
|
+
value: 60
|
|
657
|
+
}), b("septuagies", {
|
|
658
|
+
flags: "i",
|
|
659
|
+
value: 70
|
|
660
|
+
}), b("o?ctogies", {
|
|
661
|
+
flags: "i",
|
|
662
|
+
value: 80
|
|
663
|
+
}), b("nonagies", {
|
|
664
|
+
flags: "i",
|
|
665
|
+
value: 90
|
|
666
|
+
})))], { value: (e, { variables: t }) => t.dizaines + t.unites }), ...Ce.map((e) => b(e.pattern, {
|
|
667
|
+
flags: "i",
|
|
668
|
+
value: e.value
|
|
669
|
+
}))), { value: (e, t) => ({
|
|
670
|
+
position: t.position(),
|
|
671
|
+
text: t.text().toLowerCase(),
|
|
672
|
+
value: e
|
|
673
|
+
}) }), O = b(String.raw`[12]\d{3}`), Ee = v(g(me, b(String.raw`1[0-4]|\d`)), { value: (e) => p(parseInt(e)) }), k = g(b(String.raw`1\s*er`, {
|
|
674
|
+
flags: "i",
|
|
675
|
+
value: "01"
|
|
676
|
+
}), b(String.raw`[12]\d|3[01]`, { value: (e) => e[0] }), b(String.raw`\d`, { value: (e) => "0" + e[0] })), De = g(b(String.raw`1\s*er`, {
|
|
677
|
+
flags: "i",
|
|
678
|
+
value: "1"
|
|
679
|
+
}), b(String.raw`[12]\d|30`, { value: (e) => e[0] }), b(String.raw`\d`, { value: (e) => e[0] })), Oe = g(b("janvier", {
|
|
680
|
+
flags: "i",
|
|
681
|
+
value: "01"
|
|
682
|
+
}), b("février", {
|
|
683
|
+
flags: "i",
|
|
684
|
+
value: "02"
|
|
685
|
+
}), b("mars", {
|
|
686
|
+
flags: "i",
|
|
687
|
+
value: "03"
|
|
688
|
+
}), b("avril", {
|
|
689
|
+
flags: "i",
|
|
690
|
+
value: "04"
|
|
691
|
+
}), b("mai", {
|
|
692
|
+
flags: "i",
|
|
693
|
+
value: "05"
|
|
694
|
+
}), b("juin", {
|
|
695
|
+
flags: "i",
|
|
696
|
+
value: "06"
|
|
697
|
+
}), b("juillet", {
|
|
698
|
+
flags: "i",
|
|
699
|
+
value: "07"
|
|
700
|
+
}), b("août", {
|
|
701
|
+
flags: "i",
|
|
702
|
+
value: "08"
|
|
703
|
+
}), b("septembre", {
|
|
704
|
+
flags: "i",
|
|
705
|
+
value: "09"
|
|
706
|
+
}), b("octobre", {
|
|
707
|
+
flags: "i",
|
|
708
|
+
value: "10"
|
|
709
|
+
}), b("novembre", {
|
|
710
|
+
flags: "i",
|
|
711
|
+
value: "11"
|
|
712
|
+
}), b("décembre", {
|
|
713
|
+
flags: "i",
|
|
714
|
+
value: "12"
|
|
715
|
+
})), ke = g(b("vendémiaire", {
|
|
716
|
+
flags: "i",
|
|
717
|
+
value: "vendémiaire"
|
|
718
|
+
}), b("brumaire", {
|
|
719
|
+
flags: "i",
|
|
720
|
+
value: "brumaire"
|
|
721
|
+
}), b("frimaire", {
|
|
722
|
+
flags: "i",
|
|
723
|
+
value: "frimaire"
|
|
724
|
+
}), b("nivôse", {
|
|
725
|
+
flags: "i",
|
|
726
|
+
value: "nivôse"
|
|
727
|
+
}), b("pluviôse", {
|
|
728
|
+
flags: "i",
|
|
729
|
+
value: "pluviôse"
|
|
730
|
+
}), b("ventôse", {
|
|
731
|
+
flags: "i",
|
|
732
|
+
value: "ventôse"
|
|
733
|
+
}), b("germinal", {
|
|
734
|
+
flags: "i",
|
|
735
|
+
value: "germinal"
|
|
736
|
+
}), b("floréal", {
|
|
737
|
+
flags: "i",
|
|
738
|
+
value: "floréal"
|
|
739
|
+
}), b("prairial", {
|
|
740
|
+
flags: "i",
|
|
741
|
+
value: "prairial"
|
|
742
|
+
}), b("messidor", {
|
|
743
|
+
flags: "i",
|
|
744
|
+
value: "messidor"
|
|
745
|
+
}), b("thermidor", {
|
|
746
|
+
flags: "i",
|
|
747
|
+
value: "thermidor"
|
|
748
|
+
}), b("fructidor", {
|
|
749
|
+
flags: "i",
|
|
750
|
+
value: "fructidor"
|
|
751
|
+
})), A = g(_([
|
|
752
|
+
x("jour", k),
|
|
753
|
+
C,
|
|
754
|
+
x("mois", Oe),
|
|
755
|
+
C,
|
|
756
|
+
x("annee", O)
|
|
757
|
+
], { value: (e, { variables: t }) => `${t.annee}-${t.mois}-${t.jour}` }), _([
|
|
758
|
+
x("jour", k),
|
|
759
|
+
b("-"),
|
|
760
|
+
x("mois", g(b(String.raw`1[0-2]`, { value: (e) => e[0] }), b(String.raw`0?(\d)`, { value: (e) => "0" + e[1] }))),
|
|
761
|
+
b("-"),
|
|
762
|
+
x("annee", O)
|
|
763
|
+
], { value: (e, { variables: t }) => `${t.annee}-${t.mois}-${t.jour}` })), Ae = _([
|
|
764
|
+
x("jour", De),
|
|
765
|
+
C,
|
|
766
|
+
x("mois", ke),
|
|
767
|
+
b(" an ", { flags: "i" }),
|
|
768
|
+
x("annee", Ee)
|
|
769
|
+
], { value: (e, { variables: t }) => `${t.jour} ${t.mois} an ${t.annee}` }), j = _([y(b("du ", { flags: "i" }), { default: null }), g(_([Ae, y(_([
|
|
770
|
+
b(String.raw` \(`),
|
|
771
|
+
A,
|
|
772
|
+
b(String.raw`\)`)
|
|
773
|
+
], { value: (e) => e[1] }), { default: null })], { value: (e) => {
|
|
774
|
+
let t = { dateCalendrierRepublicain: e[0] }, n = e[1];
|
|
775
|
+
return n !== null && (t.date = n), t;
|
|
776
|
+
} }), v(A, { value: (e) => ({ date: e }) }))], { value: (e) => e[1] }), je = _([C, j], { value: (e) => e[1] }), Me = b(String.raw`(?<=^|\P{Alphabetic})(aux|des|les)( |(?=dite?s ))`, { flags: "iv" }), Ne = g(b(String.raw`(?<=^|\P{Alphabetic})(au|du|le)( |(?=dit ))`, { flags: "iv" }), b(String.raw`(?<=^|\P{Alphabetic})([àa] )?la( |(?=dite ))`, { flags: "iv" }), b(String.raw`(?<=^|\P{Alphabetic})([àa] )?l'`, { flags: "iv" })), Pe = _([g(b(String.raw`[ \n]de (?=ce(tte)?s )`, { flags: "i" }), b(String.raw`[ \n]des( |(?=dite?s ))`, { flags: "i" }))], { value: "des" }), Fe = v(g(b(String.raw`[ \n]de (?=ce(tte|t)? )`, { flags: "i" }), b(String.raw`[ \n]de l'`, { flags: "i" }), b(String.raw`[ \n]de la( |(?=dite ))`, { flags: "i" }), b(String.raw`[ \n]du( |(?=dit ))`, { flags: "i" })), { value: "de" }), Ie = b("dite?s ", {
|
|
777
|
+
flags: "i",
|
|
778
|
+
value: !0
|
|
779
|
+
}), Le = b("dite? ", {
|
|
780
|
+
flags: "i",
|
|
781
|
+
value: !0
|
|
782
|
+
}), Re = g(b("(nouvel|nouveau|nouvelle) ", {
|
|
783
|
+
flags: "i",
|
|
784
|
+
value: "new"
|
|
785
|
+
}), b("(ancien|ancienne) ", {
|
|
786
|
+
flags: "i",
|
|
787
|
+
value: "old"
|
|
788
|
+
})), M = g(b("derni(er|ère)s", {
|
|
789
|
+
flags: "i",
|
|
790
|
+
value: (e, t) => ({
|
|
791
|
+
index: -1,
|
|
792
|
+
num: t.text()
|
|
793
|
+
})
|
|
794
|
+
}), b("mêmes", {
|
|
795
|
+
flags: "i",
|
|
796
|
+
value: { relative: 0 }
|
|
797
|
+
}), b("premi(er|ère)s", {
|
|
798
|
+
flags: "i",
|
|
799
|
+
value: (e, t) => ({
|
|
800
|
+
index: 1,
|
|
801
|
+
num: t.text()
|
|
802
|
+
})
|
|
803
|
+
}), b("présente?s", {
|
|
804
|
+
flags: "i",
|
|
805
|
+
value: { present: !0 }
|
|
806
|
+
}), b("suivante?s", {
|
|
807
|
+
flags: "i",
|
|
808
|
+
value: { relative: "+∞" }
|
|
809
|
+
})), N = g(b("antépénultième", {
|
|
810
|
+
flags: "i",
|
|
811
|
+
value: (e, t) => ({
|
|
812
|
+
index: -3,
|
|
813
|
+
num: t.text()
|
|
814
|
+
})
|
|
815
|
+
}), b("avant-derni(er|ère)", {
|
|
816
|
+
flags: "i",
|
|
817
|
+
value: (e, t) => ({
|
|
818
|
+
index: -2,
|
|
819
|
+
num: t.text()
|
|
820
|
+
})
|
|
821
|
+
}), b("derni(er|ère)", {
|
|
822
|
+
flags: "i",
|
|
823
|
+
value: (e, t) => ({
|
|
824
|
+
index: -1,
|
|
825
|
+
num: t.text()
|
|
826
|
+
})
|
|
827
|
+
}), b("même", {
|
|
828
|
+
flags: "i",
|
|
829
|
+
value: { relative: 0 }
|
|
830
|
+
}), b("pénultième", {
|
|
831
|
+
flags: "i",
|
|
832
|
+
value: (e, t) => ({
|
|
833
|
+
index: -2,
|
|
834
|
+
num: t.text()
|
|
835
|
+
})
|
|
836
|
+
}), b("précédente?", {
|
|
837
|
+
flags: "i",
|
|
838
|
+
value: { relative: -1 }
|
|
839
|
+
}), b("premi(er|ère)", {
|
|
840
|
+
flags: "i",
|
|
841
|
+
value: (e, t) => ({
|
|
842
|
+
index: 1,
|
|
843
|
+
num: t.text()
|
|
844
|
+
})
|
|
845
|
+
}), b("présente?", {
|
|
846
|
+
flags: "i",
|
|
847
|
+
value: { present: !0 }
|
|
848
|
+
}), b("suivante?", {
|
|
849
|
+
flags: "i",
|
|
850
|
+
value: { relative: 1 }
|
|
851
|
+
})), P = b("ci ?- ?(après|avant|dessous|dessus)", {
|
|
852
|
+
flags: "i",
|
|
853
|
+
value: (e) => `ci-${e[1]}`
|
|
854
|
+
}), ze = _([C, P], { value: (e) => e[1] }), Be = b(" précitée?", { flags: "i" }), Ve = g(P, M), He = _([y(b("ces ", { flags: "i" }), { default: "" }), M], { value: (e) => e[1] }), Ue = g(P, N), We = _([y(b("ce(tte|t)? ", { flags: "i" }), { default: "" }), N], { value: (e) => e[1] }), F = /^<\/?(!DOCTYPE|\?XML|[A-Z][A-Z0-9]*)/i;
|
|
855
|
+
function I(e, t) {
|
|
856
|
+
return (n) => {
|
|
857
|
+
let r = [], i = n;
|
|
858
|
+
for (let e of t) {
|
|
859
|
+
let t = e(i);
|
|
860
|
+
(t.transformations !== void 0 || t.sourceMap.length !== 0) && (r.push(t), i = t.output);
|
|
861
|
+
}
|
|
862
|
+
return {
|
|
863
|
+
input: n,
|
|
864
|
+
output: i,
|
|
865
|
+
title: e,
|
|
866
|
+
transformations: r
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
function* L(e) {
|
|
871
|
+
if (e.transformations === void 0) yield e;
|
|
872
|
+
else for (let t of e.transformations) yield* L(t);
|
|
873
|
+
}
|
|
874
|
+
function* Ge(e) {
|
|
875
|
+
let t = [...L(e)].reverse(), n = { position: {
|
|
876
|
+
start: 0,
|
|
877
|
+
stop: 0
|
|
878
|
+
} }, r = t.map((e) => {
|
|
879
|
+
let t = Ke(e);
|
|
880
|
+
return t.next(n), t;
|
|
881
|
+
}), i = yield n;
|
|
882
|
+
for (; i !== void 0;) {
|
|
883
|
+
n = { position: i };
|
|
884
|
+
for (let e of r) {
|
|
885
|
+
let t = e.next(n);
|
|
886
|
+
if (t.done) return;
|
|
887
|
+
n = t.value;
|
|
888
|
+
}
|
|
889
|
+
i = yield n;
|
|
890
|
+
}
|
|
891
|
+
for (let e of r) e.next(void 0);
|
|
892
|
+
}
|
|
893
|
+
function* Ke(e) {
|
|
894
|
+
let t = yield { position: {
|
|
895
|
+
start: 0,
|
|
896
|
+
stop: 0
|
|
897
|
+
} }, n = [
|
|
898
|
+
{
|
|
899
|
+
inputIndex: 0,
|
|
900
|
+
inputLength: 0,
|
|
901
|
+
outputIndex: 0,
|
|
902
|
+
outputLength: 0
|
|
903
|
+
},
|
|
904
|
+
...e.sourceMap,
|
|
905
|
+
{
|
|
906
|
+
inputIndex: 2 ** 53 - 1,
|
|
907
|
+
inputLength: 0,
|
|
908
|
+
outputIndex: 2 ** 53 - 1,
|
|
909
|
+
outputLength: 0
|
|
910
|
+
}
|
|
911
|
+
], r = 0, i = n[r];
|
|
912
|
+
for (;;) {
|
|
913
|
+
if (t === void 0) return;
|
|
914
|
+
let { position: e } = t, a, o, s, c;
|
|
915
|
+
for (; i.outputIndex + i.outputLength > e.start;) r--, i = n[r];
|
|
916
|
+
for (let t = r + 1;; t++) {
|
|
917
|
+
let a = n[t];
|
|
918
|
+
if (a.outputIndex + a.outputLength > e.start) break;
|
|
919
|
+
r = t, i = a;
|
|
920
|
+
}
|
|
921
|
+
let l = r, u = i;
|
|
922
|
+
for (; u.outputIndex < e.stop;) l++, u = n[l];
|
|
923
|
+
let d = e.start < i.outputIndex + i.outputLength ? r : r + 1, f = e.stop > u.outputIndex ? l : l - 1;
|
|
924
|
+
for (let t = !0; t;) {
|
|
925
|
+
t = !1, a = void 0, o = void 0, s = void 0, c = void 0;
|
|
926
|
+
for (let r = d; r <= f; r++) {
|
|
927
|
+
let i = n[r].matchingSegmentIndex;
|
|
928
|
+
if (i !== void 0) {
|
|
929
|
+
if (i + 1 < d) {
|
|
930
|
+
let r = !1, o = n[i + 1];
|
|
931
|
+
if (o.openingTag !== void 0 && o.outputIndex + o.outputLength < e.start) {
|
|
932
|
+
let e = o.openingTag.match(F);
|
|
933
|
+
if (e !== null) {
|
|
934
|
+
let t = e[1], n = t.toUpperCase();
|
|
935
|
+
[
|
|
936
|
+
"B",
|
|
937
|
+
"EM",
|
|
938
|
+
"I",
|
|
939
|
+
"SPAN",
|
|
940
|
+
"STRONG",
|
|
941
|
+
"SUB",
|
|
942
|
+
"SUP"
|
|
943
|
+
].includes(n) && (s = `${s ?? ""}</${t}>`, a = `${o.openingTag}${a ?? ""}`, r = !0);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
if (!r) {
|
|
947
|
+
a = void 0, s = void 0, d = i + 1, e = {
|
|
948
|
+
start: n[d].outputIndex,
|
|
949
|
+
stop: e.stop
|
|
950
|
+
}, t = !0;
|
|
951
|
+
break;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
if (i + 1 > f) {
|
|
955
|
+
let a = !1, s = n[r], l = n[i + 1];
|
|
956
|
+
if (s.openingTag !== void 0 && e.stop < l.outputIndex) {
|
|
957
|
+
let e = s.openingTag.match(F);
|
|
958
|
+
if (e !== null) {
|
|
959
|
+
let t = e[1], n = t.toUpperCase();
|
|
960
|
+
[
|
|
961
|
+
"B",
|
|
962
|
+
"EM",
|
|
963
|
+
"I",
|
|
964
|
+
"SPAN",
|
|
965
|
+
"STRONG",
|
|
966
|
+
"SUB",
|
|
967
|
+
"SUP"
|
|
968
|
+
].includes(n) && (o = `${o ?? ""}</${t}>`, c = `${s.openingTag}${c ?? ""}`, a = !0);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
if (!a) {
|
|
972
|
+
o = void 0, c = void 0, f = i + 1;
|
|
973
|
+
let r = n[f];
|
|
974
|
+
e = {
|
|
975
|
+
start: e.start,
|
|
976
|
+
stop: r.outputIndex + r.outputLength
|
|
977
|
+
}, t = !0;
|
|
978
|
+
break;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
let p = n[d - 1], m = p.inputIndex + p.inputLength + e.start - (p.outputIndex + p.outputLength), h = n[f], g = h.inputIndex + h.inputLength + e.stop - (h.outputIndex + h.outputLength);
|
|
985
|
+
t = yield Object.fromEntries(Object.entries({
|
|
986
|
+
innerPrefix: `${a ?? ""}${t.innerPrefix ?? ""}` || void 0,
|
|
987
|
+
innerSuffix: `${t.innerSuffix ?? ""}${o ?? ""}` || void 0,
|
|
988
|
+
outerPrefix: `${t.outerPrefix ?? ""}${s ?? ""}` || void 0,
|
|
989
|
+
outerSuffix: `${c ?? ""}${t.outerSuffix ?? ""}` || void 0,
|
|
990
|
+
position: {
|
|
991
|
+
start: m,
|
|
992
|
+
stop: g
|
|
993
|
+
}
|
|
994
|
+
}).filter(([, e]) => e !== void 0));
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
function qe(e) {
|
|
998
|
+
let t = Ge(e);
|
|
999
|
+
return t.next({
|
|
1000
|
+
start: 0,
|
|
1001
|
+
stop: 0
|
|
1002
|
+
}), t;
|
|
1003
|
+
}
|
|
1004
|
+
function Je(e, t) {
|
|
1005
|
+
let n = t.map((e) => [e]);
|
|
1006
|
+
for (let { sourceMap: t } of [...L(e)].reverse()) n = Ye(t, n);
|
|
1007
|
+
return n;
|
|
1008
|
+
}
|
|
1009
|
+
function Ye(e, t) {
|
|
1010
|
+
let n = [];
|
|
1011
|
+
e = [
|
|
1012
|
+
{
|
|
1013
|
+
inputIndex: 0,
|
|
1014
|
+
inputLength: 0,
|
|
1015
|
+
outputIndex: 0,
|
|
1016
|
+
outputLength: 0
|
|
1017
|
+
},
|
|
1018
|
+
...e,
|
|
1019
|
+
{
|
|
1020
|
+
inputIndex: 2 ** 53 - 1,
|
|
1021
|
+
inputLength: 0,
|
|
1022
|
+
outputIndex: 2 ** 53 - 1,
|
|
1023
|
+
outputLength: 0
|
|
1024
|
+
}
|
|
1025
|
+
];
|
|
1026
|
+
let r = 0, i = e[r];
|
|
1027
|
+
for (let a of t) {
|
|
1028
|
+
let t = [];
|
|
1029
|
+
n.push(t);
|
|
1030
|
+
for (let n of a) {
|
|
1031
|
+
let { start: a } = n, { stop: o } = n;
|
|
1032
|
+
transformPosition: for (let n = !1; !n;) {
|
|
1033
|
+
for (; i.outputIndex + i.outputLength <= a; r++, i = e[r]);
|
|
1034
|
+
let s = r, c = e[s - 1], l = c.inputIndex + c.inputLength + a - (c.outputIndex + c.outputLength), u;
|
|
1035
|
+
for (u = s - 1; e[u + 1].outputIndex < o; u++);
|
|
1036
|
+
let d = e[u], f = d.inputIndex + d.inputLength + o - (d.outputIndex + d.outputLength);
|
|
1037
|
+
for (let n = s; n <= u; n++) {
|
|
1038
|
+
let i = e[n], c = i.matchingSegmentIndex;
|
|
1039
|
+
if (c !== void 0) {
|
|
1040
|
+
if (c + 1 < s) {
|
|
1041
|
+
let o = e[c + 1];
|
|
1042
|
+
if (o.outputIndex < a) {
|
|
1043
|
+
i.inputIndex > l && t.push({
|
|
1044
|
+
start: l,
|
|
1045
|
+
stop: i.inputIndex
|
|
1046
|
+
}), a = i.outputIndex + i.outputLength;
|
|
1047
|
+
for (let t = n, o = i; o.outputIndex + o.outputLength === a; t++, o = e[t]) r = t;
|
|
1048
|
+
continue transformPosition;
|
|
1049
|
+
}
|
|
1050
|
+
s = c + 1, l = o.inputIndex;
|
|
1051
|
+
} else if (c + 1 > u) {
|
|
1052
|
+
let s = e[c + 1];
|
|
1053
|
+
if (s.outputIndex + s.outputLength > o) {
|
|
1054
|
+
i.inputIndex > l && t.push({
|
|
1055
|
+
start: l,
|
|
1056
|
+
stop: i.inputIndex
|
|
1057
|
+
}), a = i.outputIndex + i.outputLength;
|
|
1058
|
+
for (let t = n, o = i; o.outputIndex + o.outputLength === a; t++, o = e[t]) r = t;
|
|
1059
|
+
continue transformPosition;
|
|
1060
|
+
}
|
|
1061
|
+
u = c + 1, f = s.inputIndex + s.inputLength;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
t.push({
|
|
1066
|
+
start: l,
|
|
1067
|
+
stop: f
|
|
1068
|
+
}), n = !0;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
return n;
|
|
1073
|
+
}
|
|
1074
|
+
function Xe(e, t) {
|
|
1075
|
+
let n = qe(e);
|
|
1076
|
+
return t.map((e) => Ze(n, e));
|
|
1077
|
+
}
|
|
1078
|
+
function Ze(e, t) {
|
|
1079
|
+
let n = e.next(t);
|
|
1080
|
+
if (n.done) throw Error(`Reverse transformation of position failed: ${t}`);
|
|
1081
|
+
return n.value;
|
|
1082
|
+
}
|
|
1083
|
+
var Qe = (e, t, n = 0) => t === void 0 ? e : (t.innerPrefix ?? "") + e.slice(t.position.start + n, t.position.stop + n) + (t.innerSuffix ?? ""), $e = (e, t) => (e.outerPrefix ?? "") + t + (e.outerSuffix ?? ""), et = {
|
|
1084
|
+
amp: "&",
|
|
1085
|
+
apos: "'",
|
|
1086
|
+
asymp: "≈",
|
|
1087
|
+
copy: "©",
|
|
1088
|
+
deg: "°",
|
|
1089
|
+
euro: "€",
|
|
1090
|
+
gt: ">",
|
|
1091
|
+
lt: "<",
|
|
1092
|
+
mdash: "—",
|
|
1093
|
+
nbsp: "\xA0",
|
|
1094
|
+
ndash: "–",
|
|
1095
|
+
ne: "≠",
|
|
1096
|
+
pound: "£",
|
|
1097
|
+
quot: "\"",
|
|
1098
|
+
reg: "®",
|
|
1099
|
+
trade: "™"
|
|
1100
|
+
};
|
|
1101
|
+
function tt({ removeAWithHref: e } = {}) {
|
|
1102
|
+
return (t) => {
|
|
1103
|
+
let n = 0, r = 0, i = [], a = [], o = [], s = "Conversion des éléments HTML en texte";
|
|
1104
|
+
for (; n < t.length;) {
|
|
1105
|
+
let c = t.indexOf("<", n);
|
|
1106
|
+
if (c === -1) return i.push(t.slice(n).replace(/[\n\r]/g, " ")), {
|
|
1107
|
+
input: t,
|
|
1108
|
+
output: i.join(""),
|
|
1109
|
+
sourceMap: a,
|
|
1110
|
+
title: s
|
|
1111
|
+
};
|
|
1112
|
+
let l = t.indexOf(">", c);
|
|
1113
|
+
if (l === -1) return i.push(t.slice(n).replace(/[\n\r]/g, " ")), {
|
|
1114
|
+
input: t,
|
|
1115
|
+
output: i.join(""),
|
|
1116
|
+
sourceMap: a,
|
|
1117
|
+
title: s
|
|
1118
|
+
};
|
|
1119
|
+
let u = t.slice(c, l + 1), d = u.startsWith("</"), f = u.length, p = u.match(F);
|
|
1120
|
+
if (p === null) {
|
|
1121
|
+
i.push(t.slice(n, l + 1).replace(/[\n\r]/g, " ")), n = l + 1;
|
|
1122
|
+
continue;
|
|
1123
|
+
}
|
|
1124
|
+
let h = p[1].toUpperCase();
|
|
1125
|
+
if (u.endsWith("/>") || [
|
|
1126
|
+
"!DOCTYPE",
|
|
1127
|
+
"?XML",
|
|
1128
|
+
"AREA",
|
|
1129
|
+
"BASE",
|
|
1130
|
+
"BR",
|
|
1131
|
+
"COL",
|
|
1132
|
+
"EMBED",
|
|
1133
|
+
"HR",
|
|
1134
|
+
"IMG",
|
|
1135
|
+
"INPUT",
|
|
1136
|
+
"LINK",
|
|
1137
|
+
"META",
|
|
1138
|
+
"PARAM",
|
|
1139
|
+
"SOURCE",
|
|
1140
|
+
"TRACK",
|
|
1141
|
+
"WBR"
|
|
1142
|
+
].includes(h)) if (d) c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " ")), a.push({
|
|
1143
|
+
inputIndex: c,
|
|
1144
|
+
inputLength: f,
|
|
1145
|
+
outputIndex: c + r,
|
|
1146
|
+
outputLength: 0
|
|
1147
|
+
}), r -= f;
|
|
1148
|
+
else if (["BR", "HR"].includes(h)) {
|
|
1149
|
+
c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " "));
|
|
1150
|
+
let e = l + 1 - c;
|
|
1151
|
+
i.push("\n"), a.push({
|
|
1152
|
+
inputIndex: c,
|
|
1153
|
+
inputLength: e,
|
|
1154
|
+
openingTag: u,
|
|
1155
|
+
outputIndex: c + r,
|
|
1156
|
+
outputLength: 1
|
|
1157
|
+
}), r += 1 - e;
|
|
1158
|
+
} else [
|
|
1159
|
+
"!DOCTYPE",
|
|
1160
|
+
"?XML",
|
|
1161
|
+
"COL",
|
|
1162
|
+
"IMG",
|
|
1163
|
+
"INPUT"
|
|
1164
|
+
].includes(h) ? (c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " ")), a.push({
|
|
1165
|
+
inputIndex: c,
|
|
1166
|
+
inputLength: f,
|
|
1167
|
+
openingTag: u,
|
|
1168
|
+
outputIndex: c + r,
|
|
1169
|
+
outputLength: 0
|
|
1170
|
+
}), r -= f) : i.push(t.slice(n, l + 1).replace(/[\n\r]/g, " "));
|
|
1171
|
+
else if (d) {
|
|
1172
|
+
let e = o.at(-1);
|
|
1173
|
+
if (h === e?.name) switch (o.pop(), e.action) {
|
|
1174
|
+
case void 0:
|
|
1175
|
+
i.push(t.slice(n, l + 1).replace(/[\n\r]/g, " "));
|
|
1176
|
+
break;
|
|
1177
|
+
case "ignore": {
|
|
1178
|
+
i = e.outputFragments, r = e.outputOffset, a = e.sourceMap;
|
|
1179
|
+
let t = l + 1 - e.inputIndex;
|
|
1180
|
+
a.push({
|
|
1181
|
+
inputIndex: e.inputIndex,
|
|
1182
|
+
inputLength: t,
|
|
1183
|
+
outputIndex: e.inputIndex + r,
|
|
1184
|
+
outputLength: 0
|
|
1185
|
+
}), r -= t;
|
|
1186
|
+
break;
|
|
1187
|
+
}
|
|
1188
|
+
case "keep_content": {
|
|
1189
|
+
i.push(t.slice(n, c).replace(/[\n\r]/g, " ")), e.closingTagReplacement.length !== 0 && i.push(e.closingTagReplacement);
|
|
1190
|
+
let o = l + 1 - c;
|
|
1191
|
+
a[e.openingSegmentIndex].matchingSegmentIndex = a.length, a.push({
|
|
1192
|
+
inputIndex: c,
|
|
1193
|
+
inputLength: o,
|
|
1194
|
+
matchingSegmentIndex: e.openingSegmentIndex,
|
|
1195
|
+
outputIndex: c + r,
|
|
1196
|
+
outputLength: e.closingTagReplacement.length
|
|
1197
|
+
}), r += e.closingTagReplacement.length - o;
|
|
1198
|
+
break;
|
|
1199
|
+
}
|
|
1200
|
+
default: m("TagInfos.action", e);
|
|
1201
|
+
}
|
|
1202
|
+
else c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " ")), a.push({
|
|
1203
|
+
inputIndex: c,
|
|
1204
|
+
inputLength: f,
|
|
1205
|
+
outputIndex: c + r,
|
|
1206
|
+
outputLength: 0
|
|
1207
|
+
}), r -= f;
|
|
1208
|
+
} else if ([
|
|
1209
|
+
"COLGROUP",
|
|
1210
|
+
"HEAD",
|
|
1211
|
+
"SCRIPT",
|
|
1212
|
+
"STYLE"
|
|
1213
|
+
].includes(h) || e && h === "A" && / href=/i.test(u)) c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " ")), o.push({
|
|
1214
|
+
action: "ignore",
|
|
1215
|
+
inputIndex: c,
|
|
1216
|
+
name: h,
|
|
1217
|
+
outputFragments: i,
|
|
1218
|
+
outputOffset: r,
|
|
1219
|
+
sourceMap: a
|
|
1220
|
+
}), i = [], a = [];
|
|
1221
|
+
else if ([
|
|
1222
|
+
"A",
|
|
1223
|
+
"B",
|
|
1224
|
+
"BODY",
|
|
1225
|
+
"DL",
|
|
1226
|
+
"EM",
|
|
1227
|
+
"HTML",
|
|
1228
|
+
"I",
|
|
1229
|
+
"OL",
|
|
1230
|
+
"SPAN",
|
|
1231
|
+
"STRONG",
|
|
1232
|
+
"SUB",
|
|
1233
|
+
"SUP",
|
|
1234
|
+
"TABLE",
|
|
1235
|
+
"TBODY",
|
|
1236
|
+
"THEAD",
|
|
1237
|
+
"TR",
|
|
1238
|
+
"UL"
|
|
1239
|
+
].includes(h)) {
|
|
1240
|
+
c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " "));
|
|
1241
|
+
let e = a.length;
|
|
1242
|
+
a.push({
|
|
1243
|
+
inputIndex: c,
|
|
1244
|
+
inputLength: f,
|
|
1245
|
+
openingTag: u,
|
|
1246
|
+
outputIndex: c + r,
|
|
1247
|
+
outputLength: 0
|
|
1248
|
+
}), r -= f, o.push({
|
|
1249
|
+
action: "keep_content",
|
|
1250
|
+
closingTagReplacement: "",
|
|
1251
|
+
name: h,
|
|
1252
|
+
openingSegmentIndex: e
|
|
1253
|
+
});
|
|
1254
|
+
} else if ([
|
|
1255
|
+
"CAPTION",
|
|
1256
|
+
"DD",
|
|
1257
|
+
"DT",
|
|
1258
|
+
"H1",
|
|
1259
|
+
"H2",
|
|
1260
|
+
"H3",
|
|
1261
|
+
"H4",
|
|
1262
|
+
"H5",
|
|
1263
|
+
"H6",
|
|
1264
|
+
"DIV",
|
|
1265
|
+
"FORM",
|
|
1266
|
+
"LI",
|
|
1267
|
+
"P",
|
|
1268
|
+
"TD",
|
|
1269
|
+
"TH"
|
|
1270
|
+
].includes(h)) {
|
|
1271
|
+
c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " ")), i.push("\n");
|
|
1272
|
+
let e = a.length;
|
|
1273
|
+
a.push({
|
|
1274
|
+
inputIndex: c,
|
|
1275
|
+
inputLength: f,
|
|
1276
|
+
openingTag: u,
|
|
1277
|
+
outputIndex: c + r,
|
|
1278
|
+
outputLength: 1
|
|
1279
|
+
}), r += 1 - f, o.push({
|
|
1280
|
+
action: "keep_content",
|
|
1281
|
+
closingTagReplacement: "\n",
|
|
1282
|
+
name: h,
|
|
1283
|
+
openingSegmentIndex: e
|
|
1284
|
+
});
|
|
1285
|
+
} else i.push(t.slice(n, l + 1).replace(/[\n\r]/g, " ")), o.push({ name: h });
|
|
1286
|
+
n = l + 1;
|
|
1287
|
+
}
|
|
1288
|
+
return {
|
|
1289
|
+
input: t,
|
|
1290
|
+
output: i.join(""),
|
|
1291
|
+
sourceMap: a,
|
|
1292
|
+
title: s
|
|
1293
|
+
};
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
function nt(e) {
|
|
1297
|
+
let t = 0, n = [];
|
|
1298
|
+
return {
|
|
1299
|
+
input: e,
|
|
1300
|
+
output: e.replace(/&(amp|apos|asymp|copy|deg|euro|gt|lt|mdash|nbsp|ndash|ne|pound|quot|reg|trade);/gi, (e, r, i) => {
|
|
1301
|
+
let a = et[r.toLowerCase()];
|
|
1302
|
+
return n.push({
|
|
1303
|
+
inputIndex: i,
|
|
1304
|
+
inputLength: e.length,
|
|
1305
|
+
outputIndex: i + t,
|
|
1306
|
+
outputLength: a.length
|
|
1307
|
+
}), t += a.length - e.length, a;
|
|
1308
|
+
}),
|
|
1309
|
+
sourceMap: n,
|
|
1310
|
+
title: "Décodage des entités HTML nommées"
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
function rt(e) {
|
|
1314
|
+
let t = 0, n = [];
|
|
1315
|
+
return {
|
|
1316
|
+
input: e,
|
|
1317
|
+
output: e.replace(/&#(?:(\d+)|x([0-9A-F]+));/gi, (e, r, i, a) => {
|
|
1318
|
+
let o = parseInt(r ?? i, r === void 0 ? 16 : 10), s = String.fromCharCode(o);
|
|
1319
|
+
return n.push({
|
|
1320
|
+
inputIndex: a,
|
|
1321
|
+
inputLength: e.length,
|
|
1322
|
+
outputIndex: a + t,
|
|
1323
|
+
outputLength: s.length
|
|
1324
|
+
}), t += s.length - e.length, s;
|
|
1325
|
+
}),
|
|
1326
|
+
sourceMap: n,
|
|
1327
|
+
title: "Décodage des entités HTML numériques"
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1330
|
+
function it(e) {
|
|
1331
|
+
let t = [], n = e;
|
|
1332
|
+
for (let [e, r] of [
|
|
1333
|
+
[/<!--.*?-->/gs, ""],
|
|
1334
|
+
[/<script.*?>.*?<\/script>/gis, ""],
|
|
1335
|
+
[/<style.*?>.*?<\/style>/gis, ""]
|
|
1336
|
+
]) {
|
|
1337
|
+
let i = R(e, r)(n);
|
|
1338
|
+
i.sourceMap.length !== 0 && (t.push(i), n = i.output);
|
|
1339
|
+
}
|
|
1340
|
+
return {
|
|
1341
|
+
input: e,
|
|
1342
|
+
output: n,
|
|
1343
|
+
title: "Suppression des commentaires, scripts et styles HTML et nettoyage d'expressions",
|
|
1344
|
+
transformations: t
|
|
1345
|
+
};
|
|
1346
|
+
}
|
|
1347
|
+
function R(e, t) {
|
|
1348
|
+
return (n) => {
|
|
1349
|
+
let r = [], i = n.replaceAll(e, (e, ...n) => {
|
|
1350
|
+
let i = n.at(-2), a = t;
|
|
1351
|
+
for (let [e, t] of n.slice(0, -2).entries()) a = a.replaceAll(`$${e + 1}`, t);
|
|
1352
|
+
return r.push({
|
|
1353
|
+
inputIndex: i,
|
|
1354
|
+
inputLength: e.length,
|
|
1355
|
+
outputLength: a.length
|
|
1356
|
+
}), a;
|
|
1357
|
+
}), a = 0;
|
|
1358
|
+
for (let e of r) e.outputIndex = e.inputIndex + a, a += e.outputLength - e.inputLength;
|
|
1359
|
+
return {
|
|
1360
|
+
input: n,
|
|
1361
|
+
output: i,
|
|
1362
|
+
sourceMap: r,
|
|
1363
|
+
title: `Remplacement de ${e} par ${JSON.stringify(t)}`
|
|
1364
|
+
};
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
function z(e) {
|
|
1368
|
+
let t = [], n = e;
|
|
1369
|
+
for (let [e, r] of [
|
|
1370
|
+
[/(\sn°)([^\s])/gi, "$1 $2"],
|
|
1371
|
+
[/[\u200E\u200F]/g, ""],
|
|
1372
|
+
[/[\uF031-\uF039\uF041-\uF054\uF061-\uF06A]/g, ""]
|
|
1373
|
+
]) {
|
|
1374
|
+
let i = R(e, r)(n);
|
|
1375
|
+
i.sourceMap.length !== 0 && (t.push(i), n = i.output);
|
|
1376
|
+
}
|
|
1377
|
+
return {
|
|
1378
|
+
input: e,
|
|
1379
|
+
output: n,
|
|
1380
|
+
title: "Nettoyage d'expressions et suppression de caractères non utilisés",
|
|
1381
|
+
transformations: t
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
function at({ removeAWithHref: e } = {}) {
|
|
1385
|
+
return (t) => I("Simplification du HTML", [
|
|
1386
|
+
nt,
|
|
1387
|
+
rt,
|
|
1388
|
+
it,
|
|
1389
|
+
z,
|
|
1390
|
+
V,
|
|
1391
|
+
tt({ removeAWithHref: e }),
|
|
1392
|
+
B
|
|
1393
|
+
])(t);
|
|
1394
|
+
}
|
|
1395
|
+
function ot(e) {
|
|
1396
|
+
return I("Simplification du texte brut", [
|
|
1397
|
+
z,
|
|
1398
|
+
V,
|
|
1399
|
+
B
|
|
1400
|
+
])(e);
|
|
1401
|
+
}
|
|
1402
|
+
function B(e) {
|
|
1403
|
+
let t = [], n = e;
|
|
1404
|
+
for (let [e, r, i] of [
|
|
1405
|
+
[
|
|
1406
|
+
"Remplacement des espaces multiples par une espace unique",
|
|
1407
|
+
/ +/g,
|
|
1408
|
+
" "
|
|
1409
|
+
],
|
|
1410
|
+
[
|
|
1411
|
+
"Suppression d'une espace en début de ligne",
|
|
1412
|
+
/^ /gm,
|
|
1413
|
+
""
|
|
1414
|
+
],
|
|
1415
|
+
[
|
|
1416
|
+
"Suppression d'une espace en fin de ligne",
|
|
1417
|
+
/ $/gm,
|
|
1418
|
+
""
|
|
1419
|
+
],
|
|
1420
|
+
[
|
|
1421
|
+
"Remplacement des sauts de lignes multiples par un saut de ligne unique",
|
|
1422
|
+
/\n\n+/g,
|
|
1423
|
+
"\n"
|
|
1424
|
+
],
|
|
1425
|
+
[
|
|
1426
|
+
"Suppression d'un saut de ligne en début de texte",
|
|
1427
|
+
/^\n/g,
|
|
1428
|
+
""
|
|
1429
|
+
],
|
|
1430
|
+
[
|
|
1431
|
+
"Suppression d'un saut de ligne en fin de texte",
|
|
1432
|
+
/\n$/g,
|
|
1433
|
+
""
|
|
1434
|
+
]
|
|
1435
|
+
]) {
|
|
1436
|
+
let a = 0, o = [], s = n.replaceAll(r, (e, ...t) => {
|
|
1437
|
+
let n = t.at(-2), r = i;
|
|
1438
|
+
for (let [e, n] of t.slice(0, -2).entries()) r = r.replaceAll(`$${e + 1}`, n);
|
|
1439
|
+
return o.push({
|
|
1440
|
+
inputIndex: n,
|
|
1441
|
+
inputLength: e.length,
|
|
1442
|
+
outputIndex: n + a,
|
|
1443
|
+
outputLength: r.length
|
|
1444
|
+
}), a += r.length - e.length, r;
|
|
1445
|
+
});
|
|
1446
|
+
o.length !== 0 && (t.push({
|
|
1447
|
+
input: n,
|
|
1448
|
+
output: s,
|
|
1449
|
+
sourceMap: o,
|
|
1450
|
+
title: e
|
|
1451
|
+
}), n = s);
|
|
1452
|
+
}
|
|
1453
|
+
return {
|
|
1454
|
+
input: e,
|
|
1455
|
+
output: n,
|
|
1456
|
+
title: "Simplification du texte",
|
|
1457
|
+
transformations: t
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
function V(e) {
|
|
1461
|
+
let t = [], n = e;
|
|
1462
|
+
for (let [e, r] of [
|
|
1463
|
+
[/[ \t]/g, " "],
|
|
1464
|
+
[/[‐‑–·]/g, "-"],
|
|
1465
|
+
[/’/g, "'"],
|
|
1466
|
+
["İ", "I"]
|
|
1467
|
+
]) n = n.replaceAll(e, (e, ...n) => {
|
|
1468
|
+
let i = n.at(-2), a = {
|
|
1469
|
+
inputIndex: i,
|
|
1470
|
+
inputLength: 1,
|
|
1471
|
+
outputIndex: i,
|
|
1472
|
+
outputLength: 1
|
|
1473
|
+
};
|
|
1474
|
+
return t.push(a), r;
|
|
1475
|
+
});
|
|
1476
|
+
t.sort((e, t) => e.inputIndex - t.inputIndex);
|
|
1477
|
+
let r = 0;
|
|
1478
|
+
for (let e of t) e.outputIndex = e.inputIndex + r, r += e.outputLength - e.inputLength;
|
|
1479
|
+
return {
|
|
1480
|
+
input: e,
|
|
1481
|
+
output: n,
|
|
1482
|
+
sourceMap: t,
|
|
1483
|
+
title: "Simplification des caractères unicodes"
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
//#endregion
|
|
1487
|
+
//#region src/lib/text_parsers/texts.ts
|
|
1488
|
+
var H = {}, st = {}, ct = {}, lt = {}, ut = {};
|
|
1489
|
+
function dt(e) {
|
|
1490
|
+
let t = e ?? {};
|
|
1491
|
+
U(st, t.textCidByOtherTitleWordsTree ?? {}), U(ct, t.textCidByTitleRestWordsTree ?? {}), U(H, Object.fromEntries(Object.entries(t.textInfosByCid ?? {}).map(([e, t]) => [e, Array.isArray(t) ? {
|
|
1492
|
+
nature: t[0],
|
|
1493
|
+
title: t[1]
|
|
1494
|
+
} : t]))), U(lt, t.textsCidsByNatureAndDate ?? {}), U(ut, t.textsCidsByNatureAndNum ?? {});
|
|
1495
|
+
}
|
|
1496
|
+
function U(e, t) {
|
|
1497
|
+
let n = e;
|
|
1498
|
+
for (let e of Object.keys(n)) delete n[e];
|
|
1499
|
+
Object.assign(e, t);
|
|
1500
|
+
}
|
|
1501
|
+
var ft = (e) => Array.isArray(e) ? e : [e], W = v(g(b("Constitution", { value: "CONSTITUTION" }), b("arrêtés?|circulaires?|code professionnel local|code|décret-loi|décrets?|livre(?= des procédures fiscales)|loi constitutionnelle|loi d'orientation quinquennale|loi d'orientation|loi de programme|loi locale|loi organique|loi quinquennale|loi|ordonnance (?:du Roi|locale|ministérielle|royale)|ordonnance", {
|
|
1502
|
+
flags: "i",
|
|
1503
|
+
value: (e) => {
|
|
1504
|
+
let t = e[0].toLowerCase();
|
|
1505
|
+
return t.startsWith("arrêté") ? "ARRETE" : t.startsWith("circulaire") ? "CIRCULAIRE" : t === "code professionnel local" ? "LOI" : t === "code" ? "CODE" : t === "décret-loi" ? "DECRET_LOI" : t.startsWith("décret") ? "DECRET" : t.startsWith("livre") ? "CODE" : t === "loi constitutionnelle" ? "LOI_CONSTIT" : t === "loi d'orientation quinquennale" || t === "loi d'orientation" || t === "loi de programme" || t === "loi locale" ? "LOI" : t === "loi organique" ? "LOI_ORGANIQUE" : t === "loi quinquennale" || t === "loi" ? "LOI" : t.startsWith("ordonnance") ? "ORDONNANCE" : "LOI";
|
|
1506
|
+
}
|
|
1507
|
+
})), { value: (e) => ({
|
|
1508
|
+
nature: e,
|
|
1509
|
+
type: "texte"
|
|
1510
|
+
}) }), pt = _([y(w, { default: null }), b(String.raw`\d+(-\d+)?`)], { value: (e) => e[1] }), G = g(j, _([pt, y(je, { default: null })], { value: (e) => e[1] === null ? { num: e[0] } : {
|
|
1511
|
+
...e[1],
|
|
1512
|
+
num: e[0]
|
|
1513
|
+
} }));
|
|
1514
|
+
b("décision( du Conseil constitutionnel)? (?<numero>[-/0-9A-Z]+ (QPC|DC|AN|D|ELEC|FNR|I|LOM|LP|L|ORGA|PDR|REF|SEN|AUTR|AR16))", {
|
|
1515
|
+
flags: "i",
|
|
1516
|
+
value: (e, t) => ({
|
|
1517
|
+
num: e.groups.numero,
|
|
1518
|
+
position: t.position(),
|
|
1519
|
+
type: "décision du Conseil constitutionnel"
|
|
1520
|
+
})
|
|
1521
|
+
});
|
|
1522
|
+
var K = y(g(b(" de la République française", { flags: "i" }), b(" du pays", { flags: "i" })), { default: null }), mt = g(_([
|
|
1523
|
+
W,
|
|
1524
|
+
K,
|
|
1525
|
+
C,
|
|
1526
|
+
G,
|
|
1527
|
+
b(".*")
|
|
1528
|
+
], { value: (e) => {
|
|
1529
|
+
let t = {
|
|
1530
|
+
...e[0],
|
|
1531
|
+
...e[3]
|
|
1532
|
+
}, n = e[4].trim() || void 0;
|
|
1533
|
+
return n !== void 0 && (t.titleRest = n), t;
|
|
1534
|
+
} }), _([
|
|
1535
|
+
W,
|
|
1536
|
+
b("[^()]+"),
|
|
1537
|
+
b(String.raw`\( ?`),
|
|
1538
|
+
G,
|
|
1539
|
+
b(String.raw` ?\)`)
|
|
1540
|
+
], { value: (e) => {
|
|
1541
|
+
let t = {
|
|
1542
|
+
...e[0],
|
|
1543
|
+
...e[3]
|
|
1544
|
+
}, n = e[1].trim() || void 0;
|
|
1545
|
+
return n !== void 0 && (t.titleRest = n), t;
|
|
1546
|
+
} }), _([g(b("code", {
|
|
1547
|
+
flags: "i",
|
|
1548
|
+
value: "CODE"
|
|
1549
|
+
}), b("livre(?= des procédures fiscales)", {
|
|
1550
|
+
flags: "i",
|
|
1551
|
+
value: "CODE"
|
|
1552
|
+
})), b(".+")], { value: (e) => {
|
|
1553
|
+
let t = { ...e[0] }, n = e[1].trim() || void 0;
|
|
1554
|
+
return n !== void 0 && (t.titleRest = n), t;
|
|
1555
|
+
} })), q = g(_([
|
|
1556
|
+
W,
|
|
1557
|
+
K,
|
|
1558
|
+
y([C, G], {
|
|
1559
|
+
default: null,
|
|
1560
|
+
value: (e) => e[1]
|
|
1561
|
+
}),
|
|
1562
|
+
y([C, v(S(ct), { value: (e, t) => ({
|
|
1563
|
+
...e,
|
|
1564
|
+
titleRest: t.text()
|
|
1565
|
+
}) })], {
|
|
1566
|
+
default: null,
|
|
1567
|
+
value: (e) => e[1]
|
|
1568
|
+
}),
|
|
1569
|
+
y([
|
|
1570
|
+
b(String.raw` ?\( ?`),
|
|
1571
|
+
G,
|
|
1572
|
+
b(String.raw` ?\)`)
|
|
1573
|
+
], {
|
|
1574
|
+
default: null,
|
|
1575
|
+
value: (e) => e[1]
|
|
1576
|
+
}),
|
|
1577
|
+
y(Be, { default: "" })
|
|
1578
|
+
], { value: (e) => {
|
|
1579
|
+
let { nature: t, type: n } = e[0], { date: r, num: i } = e[2] ?? e[4] ?? {}, { cid: a, titleRest: o } = e[3] ?? {};
|
|
1580
|
+
if (a === void 0 && r === void 0 && i === void 0) return;
|
|
1581
|
+
let s = /* @__PURE__ */ new Set();
|
|
1582
|
+
if (r !== void 0) {
|
|
1583
|
+
let e = lt[t]?.[r];
|
|
1584
|
+
if (e !== void 0) {
|
|
1585
|
+
let t = ft(e);
|
|
1586
|
+
s = s.size === 0 ? new Set(t) : s.intersection(new Set(t));
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
if (i !== void 0) {
|
|
1590
|
+
let e = ut[t]?.[i];
|
|
1591
|
+
if (e !== void 0) {
|
|
1592
|
+
let t = ft(e);
|
|
1593
|
+
s = s.size === 0 ? new Set(t) : s.intersection(new Set(t));
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
if (a !== void 0) {
|
|
1597
|
+
let e = Array.isArray(a) ? a : [a];
|
|
1598
|
+
s = s.size === 0 ? new Set(e) : s.intersection(new Set(e.filter((e) => H[e].nature === t)));
|
|
1599
|
+
}
|
|
1600
|
+
let c = s.size === 1 ? s.values().next().value : void 0, l = c === void 0 ? void 0 : H[c];
|
|
1601
|
+
return Object.fromEntries(Object.entries({
|
|
1602
|
+
cid: c,
|
|
1603
|
+
date: r,
|
|
1604
|
+
nature: t ?? l?.nature,
|
|
1605
|
+
num: i,
|
|
1606
|
+
title: l?.title,
|
|
1607
|
+
titleRest: o,
|
|
1608
|
+
type: n
|
|
1609
|
+
}).filter(([, e]) => e !== void 0));
|
|
1610
|
+
} }), _([S(st), y(Be, { default: "" })], { value: (e) => {
|
|
1611
|
+
let { cid: t } = e[0], n = typeof t == "string" ? H[t] : void 0;
|
|
1612
|
+
return Object.fromEntries(Object.entries({
|
|
1613
|
+
cid: t,
|
|
1614
|
+
...n ?? {},
|
|
1615
|
+
type: "texte"
|
|
1616
|
+
}).filter(([, e]) => e !== void 0));
|
|
1617
|
+
} })), ht = _([
|
|
1618
|
+
E,
|
|
1619
|
+
b("/"),
|
|
1620
|
+
E,
|
|
1621
|
+
y(b(" ?/ ?(CEE?)", { value: (e) => e[1] }), { default: "" })
|
|
1622
|
+
], { value: (e) => `${e[0]}/${e[2]}${e[3] ? `/${e[3]}` : ""}` }), gt = _([y(w, { default: "" }), ht], { value: (e) => e[1] }), J = g(_([gt, y(je, { default: null })], { value: (e) => e[1] === null ? { num: e[0] } : {
|
|
1623
|
+
...e[1],
|
|
1624
|
+
num: e[0]
|
|
1625
|
+
} }), j), _t = _([b("arrêtés?|arrêts?|avis|décisions?|déclarations?|délibérations?|directive(?: d'exécution|déléguée)?|informations?|instructions?|lettres?|règlement(?: d'exécution)?", {
|
|
1626
|
+
flags: "i",
|
|
1627
|
+
value: (e) => {
|
|
1628
|
+
let t = e[0].toLowerCase();
|
|
1629
|
+
return t.startsWith("arrêté") ? "ARRETEEURO" : t.startsWith("arrêt") ? "ARRETEURO" : t.startsWith("avis") ? "AVISEURO" : t.startsWith("décision") ? "DECISION_EURO" : t.startsWith("déclaration") ? "DECLARATIONEURO" : t.startsWith("délibération") ? "DELIBERATIONEURO" : t.startsWith("directive") ? "DIRECTIVE_EURO" : t.startsWith("information") ? "INFORMATIONEURO" : t.startsWith("instruction") ? "INSTRUCTIONEURO" : t.startsWith("lettre") ? "LETTREEURO" : (t.startsWith("règlement"), "REGLEMENTEUROPEEN");
|
|
1630
|
+
}
|
|
1631
|
+
}), y(b(String.raw` \((CE|CEE|EURATOM|UE(, EURATOM)?)\)`, { flags: "i" }), { default: "" })], { value: (e) => ({
|
|
1632
|
+
nature: e[0],
|
|
1633
|
+
legislation: "UE",
|
|
1634
|
+
type: "texte"
|
|
1635
|
+
}) }), Y = _([
|
|
1636
|
+
_t,
|
|
1637
|
+
C,
|
|
1638
|
+
J
|
|
1639
|
+
], { value: (e) => ({
|
|
1640
|
+
...e[2],
|
|
1641
|
+
...e[0]
|
|
1642
|
+
}) }), X = b("convention", {
|
|
1643
|
+
flags: "i",
|
|
1644
|
+
value: {
|
|
1645
|
+
nature: "CONVENTION",
|
|
1646
|
+
legislation: "international",
|
|
1647
|
+
type: "texte"
|
|
1648
|
+
}
|
|
1649
|
+
}), vt = _([y(Le, { default: !1 }), g(_([
|
|
1650
|
+
We,
|
|
1651
|
+
C,
|
|
1652
|
+
g(q, Y, X, W, _t)
|
|
1653
|
+
], { value: (e) => ({
|
|
1654
|
+
...e[2],
|
|
1655
|
+
...e[0] === void 0 ? {} : e[0]
|
|
1656
|
+
}) }), q, Y, X)], { value: (e, t) => {
|
|
1657
|
+
let n = {
|
|
1658
|
+
...e[1],
|
|
1659
|
+
...e[0] ? { ofTheSaid: !0 } : {},
|
|
1660
|
+
position: t.position()
|
|
1661
|
+
};
|
|
1662
|
+
return t.currentText = n, n;
|
|
1663
|
+
} }), Z = (e) => e?.replace(/\n/g, " ").replace(/ {2,}/g, " ").replace(/ \(\d+\)\.?$/, "").replace(/\.$/, ""), yt = (e) => {
|
|
1664
|
+
let t = e.META.META_SPEC.META_TEXTE_VERSION.DATE_DEBUT;
|
|
1665
|
+
return t === void 0 || ["2222-02-22", "2999-01-01"].includes(t) ? e.META.META_SPEC.META_TEXTE_CHRONICLE.DATE_PUBLI : t;
|
|
1666
|
+
}, bt = (e) => {
|
|
1667
|
+
let t = e.META.META_SPEC.META_TEXTE_CHRONICLE.DATE_TEXTE;
|
|
1668
|
+
if (!["2222-02-22", "2999-01-01"].includes(t)) return t;
|
|
1669
|
+
let n = e.META.META_SPEC.META_TEXTE_VERSION.DATE_DEBUT;
|
|
1670
|
+
if (n !== void 0 && !["2222-02-22", "2999-01-01"].includes(n)) return n;
|
|
1671
|
+
throw Error(`Missing date signature in text ${e.META.META_COMMUN.ID}`);
|
|
1672
|
+
}, xt = (e) => (t, n) => {
|
|
1673
|
+
let r = e(t), i = e(n);
|
|
1674
|
+
if (r !== i) return r.localeCompare(i);
|
|
1675
|
+
let a = t.META.META_COMMUN, o = a.ORIGINE, s = n.META.META_COMMUN, c = s.ORIGINE;
|
|
1676
|
+
if (o !== c) {
|
|
1677
|
+
if (o === "JORF") return -1;
|
|
1678
|
+
if (c === "JORF") return 1;
|
|
1679
|
+
}
|
|
1680
|
+
throw Error(`TODO: Unable to sort texts ${a.ID} & ${s.ID} by date.`);
|
|
1681
|
+
};
|
|
1682
|
+
//#endregion
|
|
1683
|
+
//#region src/lib/legi/text_titles_infos.ts
|
|
1684
|
+
function St(e, t, n, r) {
|
|
1685
|
+
n != null && ((e[t] ??= {})[n] ??= []).push(r);
|
|
1686
|
+
}
|
|
1687
|
+
function Ct(e) {
|
|
1688
|
+
return ot(e).output;
|
|
1689
|
+
}
|
|
1690
|
+
function wt(e, t, n) {
|
|
1691
|
+
let r = Ct(Z(t).replace(/[,()]/g, " ")).split(" ").map((e) => /^[IVX]+$/gi.test(e) ? d(e).toString() : e.toLowerCase().replace(/^no$/, "n°")), i = e;
|
|
1692
|
+
for (let e of r) i = i[e] ??= {};
|
|
1693
|
+
i.cid === void 0 ? i.cid = n : Array.isArray(i.cid) ? i.cid.push(n) : i.cid = [i.cid, n];
|
|
1694
|
+
}
|
|
1695
|
+
async function Tt(e, t = {}) {
|
|
1696
|
+
dt(await Et(e, t));
|
|
1697
|
+
}
|
|
1698
|
+
async function Et(e, { onProgress: t } = {}) {
|
|
1699
|
+
let n = {}, r = {}, i = {}, a = {}, o = {};
|
|
1700
|
+
t?.({
|
|
1701
|
+
count: e.length,
|
|
1702
|
+
phase: "parse:start"
|
|
1703
|
+
});
|
|
1704
|
+
for (let [s, { cid: c, dateTexte: l, nature: u, num: d, title: f }] of e.entries()) {
|
|
1705
|
+
s > 0 && s % 2e4 == 0 && (t?.({
|
|
1706
|
+
count: s,
|
|
1707
|
+
phase: "parse:progress"
|
|
1708
|
+
}), await new Promise((e) => setTimeout(e, 0)));
|
|
1709
|
+
let e = Z(f);
|
|
1710
|
+
if ([
|
|
1711
|
+
"code",
|
|
1712
|
+
"décret",
|
|
1713
|
+
"loi",
|
|
1714
|
+
"ordonnance"
|
|
1715
|
+
].includes(e.toLowerCase())) continue;
|
|
1716
|
+
i[c] = [u, e];
|
|
1717
|
+
let p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set();
|
|
1718
|
+
switch (e) {
|
|
1719
|
+
case "Constitution du 4 octobre 1958":
|
|
1720
|
+
m.add(e), p.add("Constitution");
|
|
1721
|
+
break;
|
|
1722
|
+
case "Loi contenant organisation du notariat (loi 25 ventôse an XI)":
|
|
1723
|
+
m.add("Loi du 25 ventôse an XI (16 mars 1803) contenant organisation du notariat");
|
|
1724
|
+
break;
|
|
1725
|
+
case "Loi des 16-24 août 1790 sur l'organisation judiciaire":
|
|
1726
|
+
p.add(e), m.add("Loi du 16 août 1790 sur l'organisation judiciaire");
|
|
1727
|
+
break;
|
|
1728
|
+
case "Loi des 2-17 mars 1791 portant suspension de tous les droits d'aides, de toutes les maîtrises et jurandes et établissement des droits de patente (décret d'Allarde)":
|
|
1729
|
+
p.add(e), m.add("Loi du 17 mars 1791 portant suspension de tous les droits d'aides, de toutes les maîtrises et jurandes et établissement des droits de patente (décret d'Allarde)");
|
|
1730
|
+
break;
|
|
1731
|
+
case "Loi n° 77-1423 du 27 décembre 1977 77-1423 du 27 décembre 1977 autorisant l'approbation de la convention sur le commerce international des espèces de faune et de flore sauvages menacées d'extinction, ensemble quatre annexes, ouverte à la signature à Washington jusqu'au 30 avril 1973 et, après cette date, à Berne jusqu'au 31 décembre 1974":
|
|
1732
|
+
m.add("Loi n° 77-1423 du 27 décembre 1977 autorisant l'approbation de la convention sur le commerce international des espèces de faune et de flore sauvages menacées d'extinction, ensemble quatre annexes, ouverte à la signature à Washington jusqu'au 30 avril 1973 et, après cette date, à Berne jusqu'au 31 décembre 1974");
|
|
1733
|
+
break;
|
|
1734
|
+
default: m.add(e);
|
|
1735
|
+
}
|
|
1736
|
+
for (let e of m) {
|
|
1737
|
+
let t = mt(new h(Ct(e)));
|
|
1738
|
+
if (t === void 0 && u === "DECRET" && (t = {
|
|
1739
|
+
date: l ?? void 0,
|
|
1740
|
+
nature: u,
|
|
1741
|
+
num: d ?? void 0,
|
|
1742
|
+
titleRest: e.replace(/^Décrets?\s*/i, "").trim() || void 0,
|
|
1743
|
+
type: "texte"
|
|
1744
|
+
}), t === void 0) throw Error(`Unparsable title of ${u} n° ${d ?? ""} du ${l ?? ""} (${c}): ${e}`);
|
|
1745
|
+
St(a, u, t.date, c), St(o, u, t.num, c), t.titleRest !== void 0 && wt(r, t.titleRest, c);
|
|
1746
|
+
}
|
|
1747
|
+
for (let e of p) wt(n, e, c);
|
|
1748
|
+
}
|
|
1749
|
+
t?.({
|
|
1750
|
+
count: e.length,
|
|
1751
|
+
phase: "parse:done"
|
|
1752
|
+
}), t?.({ phase: "compact:start" }), await new Promise((e) => setTimeout(e, 0));
|
|
1753
|
+
let s = {
|
|
1754
|
+
textCidByOtherTitleWordsTree: $(n),
|
|
1755
|
+
textCidByTitleRestWordsTree: $(r),
|
|
1756
|
+
textInfosByCid: i,
|
|
1757
|
+
textsCidsByNatureAndDate: Q(a),
|
|
1758
|
+
textsCidsByNatureAndNum: Q(o)
|
|
1759
|
+
};
|
|
1760
|
+
return t?.({ phase: "compact:done" }), s;
|
|
1761
|
+
}
|
|
1762
|
+
function Q(e) {
|
|
1763
|
+
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Object.fromEntries(Object.entries(t).map(([e, t]) => [e, t.length === 1 ? t[0] : t]))]));
|
|
1764
|
+
}
|
|
1765
|
+
function $(e) {
|
|
1766
|
+
let t = {};
|
|
1767
|
+
e.cid !== void 0 && (t.cid = e.cid);
|
|
1768
|
+
for (let [n, r] of Object.entries(e)) {
|
|
1769
|
+
if (n === "cid") continue;
|
|
1770
|
+
let e = n, i = r;
|
|
1771
|
+
for (; i.cid === void 0 && Object.keys(i).length === 1;) {
|
|
1772
|
+
let [[t, n]] = Object.entries(i);
|
|
1773
|
+
e += ` ${t}`, i = n;
|
|
1774
|
+
}
|
|
1775
|
+
t[e] = $(i);
|
|
1776
|
+
}
|
|
1777
|
+
return t;
|
|
1778
|
+
}
|
|
1779
|
+
//#endregion
|
|
1780
|
+
//#region src/lib/timings.ts
|
|
1781
|
+
var Dt = class {
|
|
1782
|
+
label;
|
|
1783
|
+
enabled;
|
|
1784
|
+
metrics = [];
|
|
1785
|
+
startedAt = performance.now();
|
|
1786
|
+
constructor(e, t = Ot()) {
|
|
1787
|
+
this.label = e, this.enabled = t;
|
|
1788
|
+
}
|
|
1789
|
+
add(e) {
|
|
1790
|
+
this.enabled && (this.metrics.push(e), kt() && console.info(`[timing:${this.label}]`, JSON.stringify(e)));
|
|
1791
|
+
}
|
|
1792
|
+
async time(e, t, n) {
|
|
1793
|
+
if (!this.enabled) return t();
|
|
1794
|
+
let r = performance.now();
|
|
1795
|
+
try {
|
|
1796
|
+
return await t();
|
|
1797
|
+
} finally {
|
|
1798
|
+
this.add({
|
|
1799
|
+
...n,
|
|
1800
|
+
durationMs: Math.round((performance.now() - r) * 10) / 10,
|
|
1801
|
+
phase: e
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
timeSync(e, t, n) {
|
|
1806
|
+
if (!this.enabled) return t();
|
|
1807
|
+
let r = performance.now();
|
|
1808
|
+
try {
|
|
1809
|
+
return t();
|
|
1810
|
+
} finally {
|
|
1811
|
+
this.add({
|
|
1812
|
+
...n,
|
|
1813
|
+
durationMs: Math.round((performance.now() - r) * 10) / 10,
|
|
1814
|
+
phase: e
|
|
1815
|
+
});
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
log(e) {
|
|
1819
|
+
if (!this.enabled) return;
|
|
1820
|
+
let t = Math.round((performance.now() - this.startedAt) * 10) / 10;
|
|
1821
|
+
console.info(`[timings:${this.label}]`, JSON.stringify({
|
|
1822
|
+
...e,
|
|
1823
|
+
totalMs: t,
|
|
1824
|
+
metricCount: this.metrics.length,
|
|
1825
|
+
metrics: this.metrics
|
|
1826
|
+
}, null, 2));
|
|
1827
|
+
}
|
|
1828
|
+
};
|
|
1829
|
+
function Ot() {
|
|
1830
|
+
let e = globalThis.process?.env;
|
|
1831
|
+
return e?.PJL_BUILD_TIMINGS === "1" || e?.PJL_BUILD_TIMINGS === "true";
|
|
1832
|
+
}
|
|
1833
|
+
function kt() {
|
|
1834
|
+
let e = globalThis.process?.env;
|
|
1835
|
+
return e?.PJL_BUILD_TIMINGS_PROGRESS === "1" || e?.PJL_BUILD_TIMINGS_PROGRESS === "true";
|
|
1836
|
+
}
|
|
1837
|
+
//#endregion
|
|
1838
|
+
//#region src/lib/legi/resolver.ts
|
|
1839
|
+
var At = class {
|
|
1840
|
+
getEuropeanTextUrl(e) {
|
|
1841
|
+
return Promise.resolve(void 0);
|
|
1842
|
+
}
|
|
1843
|
+
preloadActiveArticlesByTextIds(e) {
|
|
1844
|
+
return Promise.resolve();
|
|
1845
|
+
}
|
|
1846
|
+
};
|
|
1847
|
+
//#endregion
|
|
1848
|
+
export { j as $, I as A, re as At, ze as B, it as C, _ as Ct, ot as D, y as Dt, at as E, te as Et, Qe as F, l as Ft, Re as G, He as H, $e as I, u as It, Me as J, Ie as K, M as L, Je as M, S as Mt, Ze as N, m as Nt, B as O, ne as Ot, Xe as P, c as Pt, A as Q, N as R, rt as S, g as St, z as T, ee as Tt, Ue as U, Ve as V, We as W, Pe as X, Ne as Y, Fe as Z, Y as _, ce as _t, Z as a, xe as at, tt as b, de as bt, xt as c, fe as ct, W as d, he as dt, Oe as et, G as f, ge as ft, vt as g, se as gt, K as h, oe as ht, Et as i, pe as it, qe as j, x as jt, V as k, b as kt, mt as l, E as lt, pt as m, C as mt, Dt as n, D as nt, yt as o, Te as ot, gt as p, ae as pt, Le as q, Tt as r, Se as rt, bt as s, we as st, At as t, be as tt, J as u, me as ut, q as v, w as vt, R as w, v as wt, nt as x, h as xt, X as y, ue as yt, P as z };
|