@tricoteuses/tisseuse 0.21.2 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/dist/{html-DWNF_0Ek.js → html-BTaoaqX5.js} +6688 -5737
  2. package/dist/index.js +72 -72
  3. package/dist/{src/lib → lib}/extractors/article_portions.d.ts +14 -0
  4. package/dist/{src/lib → lib}/extractors/links.d.ts +117 -3
  5. package/dist/{src/lib → lib}/f_legi/resolver.d.ts +23 -4
  6. package/dist/lib/legi/article_abrogation.d.ts +25 -0
  7. package/dist/lib/legi/article_history.d.ts +11 -0
  8. package/dist/lib/legi/article_structure.d.ts +9 -0
  9. package/dist/{src/lib → lib}/legi/canutes_resolver.d.ts +17 -16
  10. package/dist/lib/legi/law_article.d.ts +13 -0
  11. package/dist/lib/legi/named_text_article.d.ts +22 -0
  12. package/dist/lib/legi/publication_components.d.ts +22 -0
  13. package/dist/lib/legi/publication_components.fixture.d.ts +3 -0
  14. package/dist/{src/lib → lib}/legi/resolver.d.ts +40 -0
  15. package/dist/lib/linkers/enumeration_scope.fixture.d.ts +19 -0
  16. package/dist/{src/lib → lib}/linkers/html.d.ts +16 -3
  17. package/dist/lib/linkers/html_decision_capture.d.ts +18 -0
  18. package/dist/lib/linkers/link_decision_html.d.ts +4 -0
  19. package/dist/lib/linkers/link_decision_metadata.d.ts +15 -0
  20. package/dist/{src/lib → lib}/linkers/markdown.d.ts +7 -1
  21. package/dist/lib/linkers/named_text_article.d.ts +1 -0
  22. package/dist/lib/linkers/quoted_section.fixture.d.ts +1 -0
  23. package/dist/lib/linkers/table_column_texts.d.ts +4 -0
  24. package/dist/{src/lib → lib}/server/parsed_bills.d.ts +19 -0
  25. package/dist/{src/lib → lib}/text_parsers/ast.d.ts +13 -3
  26. package/dist/lib/text_parsers/historical_versions.d.ts +18 -0
  27. package/dist/{src/lib → lib}/text_parsers/parsers.d.ts +2 -0
  28. package/dist/{src/lib → lib}/text_parsers/repeated_actions.d.ts +1 -0
  29. package/dist/{src/lib → lib}/text_parsers/texts.d.ts +12 -0
  30. package/dist/link-decision-metadata.js +32 -0
  31. package/dist/{resolver-BBrU9oGB.js → resolver-GT7457lQ.js} +316 -127
  32. package/dist/scripts/enrich_assemblee_documents.d.ts +1 -0
  33. package/dist/scripts/enrich_senat_documents.d.ts +1 -0
  34. package/dist/scripts/html_document_to_text.d.ts +1 -0
  35. package/dist/scripts/index_postgres_assemblee_amendments.d.ts +1 -0
  36. package/dist/scripts/index_postgres_assemblee_texts.d.ts +1 -0
  37. package/dist/scripts/index_postgres_judilibre.d.ts +1 -0
  38. package/dist/scripts/index_postgres_legifrance_articles.d.ts +1 -0
  39. package/dist/scripts/index_postgres_legifrance_jurisprudence.d.ts +1 -0
  40. package/dist/scripts/index_postgres_senat_amendments.d.ts +1 -0
  41. package/dist/scripts/index_postgres_senat_texts.d.ts +1 -0
  42. package/dist/scripts/parse_akoma_ntoso_bill_raw.d.ts +1 -0
  43. package/dist/scripts/parse_assemblee_bill_raw.d.ts +1 -0
  44. package/dist/scripts/profile_assemblee_document_parsing.d.ts +1 -0
  45. package/dist/scripts/profile_canutes_bill.d.ts +1 -0
  46. package/dist/scripts/replay_linker_scope.d.ts +1 -0
  47. package/dist/scripts/shared/assemblee_legislature.test.d.ts +1 -0
  48. package/dist/scripts/shared/checkpoint_cli_options.test.d.ts +1 -0
  49. package/dist/scripts/simplified_html_bill_to_table_of_contents.d.ts +1 -0
  50. package/dist/scripts/simplify_word_html.d.ts +1 -0
  51. package/dist/scripts/sync_postgres_assemblee_document_content.d.ts +1 -0
  52. package/dist/scripts/sync_postgres_senat_document_content.d.ts +1 -0
  53. package/dist/scripts/test_canutes_titles_cache.d.ts +1 -0
  54. package/dist/scripts/warm_canutes_text_titles_cache.d.ts +1 -0
  55. package/dist/server-f-legi.js +200 -94
  56. package/dist/server.js +1080 -959
  57. package/package.json +9 -4
  58. package/dist/{src/lib → lib}/alineas/alineas_numbers.d.ts +0 -0
  59. package/dist/{src/lib → lib}/article_temporal_status.test.d.ts +0 -0
  60. package/dist/{src/lib → lib}/articles.d.ts +0 -0
  61. package/dist/{src/lib → lib}/articles.test.d.ts +0 -0
  62. package/dist/{src/lib → lib}/assemblee_document_date.d.ts +0 -0
  63. package/dist/{src/lib → lib}/assemblee_document_date.test.d.ts +0 -0
  64. package/dist/{src/lib → lib}/asserts.d.ts +0 -0
  65. package/dist/{src/lib → lib}/cache.d.ts +0 -0
  66. package/dist/{src/lib → lib}/dates.d.ts +0 -0
  67. package/dist/{src/lib → lib}/extractors/action_directives.d.ts +0 -0
  68. package/dist/{src/lib → lib}/extractors/action_directives.test.d.ts +0 -0
  69. package/dist/{src/lib → lib}/extractors/action_directives_cpu.test.d.ts +0 -0
  70. package/dist/{src/lib → lib}/extractors/article_action_effects.d.ts +0 -0
  71. package/dist/{src/lib → lib}/extractors/article_action_effects.test.d.ts +0 -0
  72. package/dist/{src/lib → lib}/extractors/article_action_effects_long.test.d.ts +0 -0
  73. package/dist/{src/lib → lib}/extractors/article_action_targets.d.ts +0 -0
  74. package/dist/{src/lib → lib}/extractors/article_action_targets.test.d.ts +0 -0
  75. package/dist/{src/lib → lib}/extractors/article_portions.test.d.ts +0 -0
  76. package/dist/{src/lib → lib}/extractors/definitions.d.ts +0 -0
  77. package/dist/{src/lib/extractors/links.citation_scope.test.d.ts → lib/extractors/link_decisions.test.d.ts} +0 -0
  78. package/dist/{src/lib/extractors/links.code_titles.test.d.ts → lib/extractors/links.citation_scope.test.d.ts} +0 -0
  79. package/dist/{src/lib/extractors/links.doctrinal.test.d.ts → lib/extractors/links.code_titles.test.d.ts} +0 -0
  80. package/dist/{src/lib/extractors/links.european.test.d.ts → lib/extractors/links.doctrinal.test.d.ts} +0 -0
  81. package/dist/{src/lib/extractors/links.test.d.ts → lib/extractors/links.european.test.d.ts} +0 -0
  82. package/dist/{src/lib/extractors/portion_references.test.d.ts → lib/extractors/links.test.d.ts} +0 -0
  83. package/dist/{src/lib → lib}/extractors/portion_references.d.ts +0 -0
  84. package/dist/{src/lib/extractors/portion_references_cpu.test.d.ts → lib/extractors/portion_references.test.d.ts} +0 -0
  85. package/dist/{src/lib/extractors/qualified_versions.test.d.ts → lib/extractors/portion_references_cpu.test.d.ts} +0 -0
  86. package/dist/{src/lib → lib}/extractors/qualified_versions.d.ts +0 -0
  87. package/dist/{src/lib/extractors/references.test.d.ts → lib/extractors/qualified_versions.test.d.ts} +0 -0
  88. package/dist/{src/lib → lib}/extractors/quoted_text.d.ts +0 -0
  89. package/dist/{src/lib → lib}/extractors/references.d.ts +0 -0
  90. package/dist/{src/lib/text_parsers → lib/extractors}/references.test.d.ts +0 -0
  91. package/dist/{src/lib → lib}/extractors/table_of_contents.d.ts +0 -0
  92. package/dist/{src/lib → lib}/extractors/table_of_contents.test.d.ts +0 -0
  93. package/dist/{src/lib → lib}/f_legi/resolver.test.d.ts +0 -0
  94. package/dist/{src/lib → lib}/index.d.ts +0 -0
  95. package/dist/{src/lib → lib}/json.d.ts +0 -0
  96. package/dist/{src/lib/legi/canutes_article_preload.test.d.ts → lib/legi/article_abrogation.test.d.ts} +0 -0
  97. package/dist/{src/lib/legi/canutes_candidates.test.d.ts → lib/legi/article_history.test.d.ts} +0 -0
  98. package/dist/{src/lib/legi/canutes_resolver.test.d.ts → lib/legi/canutes_article_preload.test.d.ts} +0 -0
  99. package/dist/{src/lib/legi/canutes_resolver_cache.test.d.ts → lib/legi/canutes_candidates.test.d.ts} +0 -0
  100. package/dist/{src/lib/legi/canutes_resolver_europe.test.d.ts → lib/legi/canutes_resolver.test.d.ts} +0 -0
  101. package/dist/{src/lib/legi/canutes_root_cid_index.integration.test.d.ts → lib/legi/canutes_resolver_cache.test.d.ts} +0 -0
  102. package/dist/{src/lib/legi/canutes_section_roots.test.d.ts → lib/legi/canutes_resolver_europe.test.d.ts} +0 -0
  103. package/dist/{src/lib/legi/canutes_text_titles_cache.integration.test.d.ts → lib/legi/canutes_root_cid_index.integration.test.d.ts} +0 -0
  104. package/dist/{src/lib/legi/resolver.test.d.ts → lib/legi/canutes_section_roots.test.d.ts} +0 -0
  105. package/dist/{src/lib → lib}/legi/canutes_sql.d.ts +0 -0
  106. package/dist/{src/lib → lib}/legi/canutes_text_titles_cache.d.ts +0 -0
  107. package/dist/{src/lib/linkers/cited-article.test.d.ts → lib/legi/canutes_text_titles_cache.integration.test.d.ts} +0 -0
  108. package/dist/{src/lib → lib}/legi/canutes_titles_metrics.d.ts +0 -0
  109. package/dist/{src/lib/linkers/reference-mode.test.d.ts → lib/legi/modifying_act_article_real.test.d.ts} +0 -0
  110. package/dist/{src/lib/server/administrative_acts_autocompletion.test.d.ts → lib/legi/publication_components.test.d.ts} +0 -0
  111. package/dist/{src/lib/server/akn_rendering.test.d.ts → lib/legi/resolver.test.d.ts} +0 -0
  112. package/dist/{src/lib → lib}/legi/text_titles_infos.d.ts +0 -0
  113. package/dist/{src/lib/server/ameli_autocompletion.test.d.ts → lib/linkers/ambiguous_publication.test.d.ts} +0 -0
  114. package/dist/{src/lib/server/assemblee_amendment_search.test.d.ts → lib/linkers/cited-article.test.d.ts} +0 -0
  115. package/dist/{src/lib/server/assemblee_document_search.test.d.ts → lib/linkers/enumeration_scope.test.d.ts} +0 -0
  116. package/dist/{src/lib/server/atomic_files.test.d.ts → lib/linkers/html_decision_capture.test.d.ts} +0 -0
  117. package/dist/{src/lib/server/bill_action_resolver_invariance.test.d.ts → lib/linkers/html_named_text_article.test.d.ts} +0 -0
  118. package/dist/{src/lib/server/bill_citation_anaphora.test.d.ts → lib/linkers/html_publication_93_859_real.test.d.ts} +0 -0
  119. package/dist/{src/lib/server/bill_comparison.test.d.ts → lib/linkers/html_structure_real.test.d.ts} +0 -0
  120. package/dist/{src/lib/server/bill_target_scope.test.d.ts → lib/linkers/html_undecidable_real.test.d.ts} +0 -0
  121. package/dist/{src/lib/server/bofip_autocompletion.test.d.ts → lib/linkers/link_decision_html.test.d.ts} +0 -0
  122. package/dist/{src/lib/server/boss_autocompletion.test.d.ts → lib/linkers/named_text_article.test.d.ts} +0 -0
  123. package/dist/{src/lib/server/canutes_only_compatibility.test.d.ts → lib/linkers/quoted_section_scope.test.d.ts} +0 -0
  124. package/dist/{src/lib/server/document_git_checkpoint.test.d.ts → lib/linkers/reference-mode.test.d.ts} +0 -0
  125. package/dist/{src/lib → lib}/links.d.ts +6 -6
  126. /package/dist/{src/lib/server/enriched_document_checkpoint.test.d.ts → lib/links.test.d.ts} +0 -0
  127. /package/dist/{src/lib → lib}/loaders/assemblee.d.ts +0 -0
  128. /package/dist/{src/lib → lib}/loaders/legifrance.d.ts +0 -0
  129. /package/dist/{src/lib → lib}/markdown.d.ts +0 -0
  130. /package/dist/{src/lib → lib}/server/administrative_acts_autocompletion.d.ts +0 -0
  131. /package/dist/{src/lib/server/europe_autocompletion.test.d.ts → lib/server/administrative_acts_autocompletion.test.d.ts} +0 -0
  132. /package/dist/{src/lib/server/flegi_profiling.test.d.ts → lib/server/akn_rendering.test.d.ts} +0 -0
  133. /package/dist/{src/lib → lib}/server/alineas/alineas_images_utils.d.ts +0 -0
  134. /package/dist/{src/lib → lib}/server/ameli_autocompletion.d.ts +0 -0
  135. /package/dist/{src/lib/server/html_simplifier.test.d.ts → lib/server/ameli_autocompletion.test.d.ts} +0 -0
  136. /package/dist/{src/lib → lib}/server/assemblee_amendment_search.d.ts +0 -0
  137. /package/dist/{src/lib/server/international_treaties_autocompletion.test.d.ts → lib/server/assemblee_amendment_search.test.d.ts} +0 -0
  138. /package/dist/{src/lib → lib}/server/assemblee_document_search.d.ts +0 -0
  139. /package/dist/{src/lib/server/judilibre_search.test.d.ts → lib/server/assemblee_document_search.test.d.ts} +0 -0
  140. /package/dist/{src/lib → lib}/server/atomic_files.d.ts +0 -0
  141. /package/dist/{src/lib/server/jurisprudence_citations.test.d.ts → lib/server/atomic_files.test.d.ts} +0 -0
  142. /package/dist/{src/lib → lib}/server/auditors/config.d.ts +0 -0
  143. /package/dist/{src/lib/server/jurisprudence_jade.test.d.ts → lib/server/bill_action_resolver_invariance.test.d.ts} +0 -0
  144. /package/dist/{src/lib → lib}/server/bill_action_target_fixtures.d.ts +0 -0
  145. /package/dist/{src/lib/server/jurisprudence_store.integration.test.d.ts → lib/server/bill_citation_anaphora.test.d.ts} +0 -0
  146. /package/dist/{src/lib → lib}/server/bill_comparison.d.ts +0 -0
  147. /package/dist/{src/lib/server/jurisprudence_store_closed.test.d.ts → lib/server/bill_comparison.test.d.ts} +0 -0
  148. /package/dist/{src/lib/server/legifrance_article_search.test.d.ts → lib/server/bill_target_scope.test.d.ts} +0 -0
  149. /package/dist/{src/lib → lib}/server/bofip_autocompletion.d.ts +0 -0
  150. /package/dist/{src/lib/server/legifrance_jurisprudence_search.test.d.ts → lib/server/bofip_autocompletion.test.d.ts} +0 -0
  151. /package/dist/{src/lib → lib}/server/boss_autocompletion.d.ts +0 -0
  152. /package/dist/{src/lib/server/local_acts_autocompletion.test.d.ts → lib/server/boss_autocompletion.test.d.ts} +0 -0
  153. /package/dist/{src/lib → lib}/server/canutes_legacy_candidates.d.ts +0 -0
  154. /package/dist/{src/lib/server/masquage-typesense.test.d.ts → lib/server/canutes_only_compatibility.test.d.ts} +0 -0
  155. /package/dist/{src/lib → lib}/server/config.d.ts +0 -0
  156. /package/dist/{src/lib → lib}/server/databases/canutes_root_cid_index.d.ts +0 -0
  157. /package/dist/{src/lib → lib}/server/databases/canutes_text_titles_cache.d.ts +0 -0
  158. /package/dist/{src/lib → lib}/server/databases/index.d.ts +0 -0
  159. /package/dist/{src/lib → lib}/server/document_git_checkpoint.d.ts +0 -0
  160. /package/dist/{src/lib/server/parsed_amendments.test.d.ts → lib/server/document_git_checkpoint.test.d.ts} +0 -0
  161. /package/dist/{src/lib → lib}/server/enriched_document_checkpoint.d.ts +0 -0
  162. /package/dist/{src/lib/server/parsed_bills.test.d.ts → lib/server/enriched_document_checkpoint.test.d.ts} +0 -0
  163. /package/dist/{src/lib → lib}/server/europe_autocompletion.d.ts +0 -0
  164. /package/dist/{src/lib/server/raa_autocompletion.test.d.ts → lib/server/europe_autocompletion.test.d.ts} +0 -0
  165. /package/dist/{src/lib → lib}/server/f_legi/index.d.ts +0 -0
  166. /package/dist/{src/lib → lib}/server/flegi_profiling.d.ts +0 -0
  167. /package/dist/{src/lib/server/senat_amendment_search.test.d.ts → lib/server/flegi_profiling.test.d.ts} +0 -0
  168. /package/dist/{src/lib → lib}/server/html_simplifier.d.ts +0 -0
  169. /package/dist/{src/lib/server/senat_document_search.test.d.ts → lib/server/html_simplifier.test.d.ts} +0 -0
  170. /package/dist/{src/lib → lib}/server/index.d.ts +0 -0
  171. /package/dist/{src/lib → lib}/server/international_treaties_autocompletion.d.ts +0 -0
  172. /package/dist/{src/lib/server/shared_legal_text_sections.test.d.ts → lib/server/international_treaties_autocompletion.test.d.ts} +0 -0
  173. /package/dist/{src/lib → lib}/server/judilibre_search.d.ts +0 -0
  174. /package/dist/{src/lib/server/sql_profiling.test.d.ts → lib/server/judilibre_search.test.d.ts} +0 -0
  175. /package/dist/{src/lib → lib}/server/jurisprudence_citations.d.ts +0 -0
  176. /package/dist/{src/lib/server/sync_administrative_act_titles.test.d.ts → lib/server/jurisprudence_citations.test.d.ts} +0 -0
  177. /package/dist/{src/lib → lib}/server/jurisprudence_consultation.d.ts +0 -0
  178. /package/dist/{src/lib → lib}/server/jurisprudence_jade.d.ts +0 -0
  179. /package/dist/{src/lib/server/sync_assemblee_legal_texts.test.d.ts → lib/server/jurisprudence_jade.test.d.ts} +0 -0
  180. /package/dist/{src/lib → lib}/server/jurisprudence_store.d.ts +0 -0
  181. /package/dist/{src/lib/server/sync_local_act_titles.test.d.ts → lib/server/jurisprudence_store.integration.test.d.ts} +0 -0
  182. /package/dist/{src/lib/server/typesense_blue_green.test.d.ts → lib/server/jurisprudence_store_closed.test.d.ts} +0 -0
  183. /package/dist/{src/lib → lib}/server/legi/resolvers.d.ts +0 -0
  184. /package/dist/{src/lib → lib}/server/legifrance_article_search.d.ts +0 -0
  185. /package/dist/{src/lib/server/typesense_index_lock.test.d.ts → lib/server/legifrance_article_search.test.d.ts} +0 -0
  186. /package/dist/{src/lib → lib}/server/legifrance_jurisprudence_search.d.ts +0 -0
  187. /package/dist/{src/lib/text_parsers/action_citation_patterns.test.d.ts → lib/server/legifrance_jurisprudence_search.test.d.ts} +0 -0
  188. /package/dist/{src/lib → lib}/server/linkers/html.d.ts +0 -0
  189. /package/dist/{src/lib → lib}/server/local_acts_autocompletion.d.ts +0 -0
  190. /package/dist/{src/lib/text_parsers/action_directives.test.d.ts → lib/server/local_acts_autocompletion.test.d.ts} +0 -0
  191. /package/dist/{src/lib/text_parsers/action_occurrences.test.d.ts → lib/server/masquage-typesense.test.d.ts} +0 -0
  192. /package/dist/{src/lib → lib}/server/masquage_typesense.d.ts +0 -0
  193. /package/dist/{src/lib/text_parsers/action_position_cues.test.d.ts → lib/server/named_text_article_decisions.test.d.ts} +0 -0
  194. /package/dist/{src/lib → lib}/server/parsed_amendments.d.ts +0 -0
  195. /package/dist/{src/lib/text_parsers/action_words.test.d.ts → lib/server/parsed_amendments.test.d.ts} +0 -0
  196. /package/dist/{src/lib/text_parsers/actions.test.d.ts → lib/server/parsed_bill_abrogation.test.d.ts} +0 -0
  197. /package/dist/{src/lib/text_parsers/articles.test.d.ts → lib/server/parsed_bill_future_consultation.test.d.ts} +0 -0
  198. /package/dist/{src/lib/text_parsers/citations.test.d.ts → lib/server/parsed_bill_link_decisions.test.d.ts} +0 -0
  199. /package/dist/{src/lib/text_parsers/dates.test.d.ts → lib/server/parsed_bills.test.d.ts} +0 -0
  200. /package/dist/{src/lib → lib}/server/raa_autocompletion.d.ts +0 -0
  201. /package/dist/{src/lib/text_parsers/divisions.test.d.ts → lib/server/raa_autocompletion.test.d.ts} +0 -0
  202. /package/dist/{src/lib → lib}/server/senat_amendment_search.d.ts +0 -0
  203. /package/dist/{src/lib/text_parsers/doctrinal_references.test.d.ts → lib/server/senat_amendment_search.test.d.ts} +0 -0
  204. /package/dist/{src/lib → lib}/server/senat_document_search.d.ts +0 -0
  205. /package/dist/{src/lib/text_parsers/numbers.test.d.ts → lib/server/senat_document_search.test.d.ts} +0 -0
  206. /package/dist/{src/lib → lib}/server/senat_document_sources.d.ts +0 -0
  207. /package/dist/{src/lib → lib}/server/shared_legal_text_sections.d.ts +0 -0
  208. /package/dist/{src/lib/text_parsers/parsers.test.d.ts → lib/server/shared_legal_text_sections.test.d.ts} +0 -0
  209. /package/dist/{src/lib → lib}/server/sql_profiling.d.ts +0 -0
  210. /package/dist/{src/lib/text_parsers/portions.test.d.ts → lib/server/sql_profiling.test.d.ts} +0 -0
  211. /package/dist/{src/lib → lib}/server/sync_administrative_act_titles.d.ts +0 -0
  212. /package/dist/{src/lib/text_parsers/prepositions.test.d.ts → lib/server/sync_administrative_act_titles.test.d.ts} +0 -0
  213. /package/dist/{src/lib → lib}/server/sync_ameli_titles.d.ts +0 -0
  214. /package/dist/{src/lib → lib}/server/sync_assemblee_legal_texts.d.ts +0 -0
  215. /package/dist/{src/lib/text_parsers/relative_locations.test.d.ts → lib/server/sync_assemblee_legal_texts.test.d.ts} +0 -0
  216. /package/dist/{src/lib → lib}/server/sync_boss_titles.d.ts +0 -0
  217. /package/dist/{src/lib → lib}/server/sync_europe_titles.d.ts +0 -0
  218. /package/dist/{src/lib → lib}/server/sync_international_treaty_titles.d.ts +0 -0
  219. /package/dist/{src/lib → lib}/server/sync_local_act_titles.d.ts +0 -0
  220. /package/dist/{src/lib/text_parsers/repeated_actions.test.d.ts → lib/server/sync_local_act_titles.test.d.ts} +0 -0
  221. /package/dist/{src/lib → lib}/server/sync_raa_titles.d.ts +0 -0
  222. /package/dist/{src/lib → lib}/server/tables_of_contents.d.ts +0 -0
  223. /package/dist/{src/lib → lib}/server/text_parsers/transformers.d.ts +0 -0
  224. /package/dist/{src/lib → lib}/server/typesense_blue_green.d.ts +0 -0
  225. /package/dist/{src/lib/text_parsers/search_queries.test.d.ts → lib/server/typesense_blue_green.test.d.ts} +0 -0
  226. /package/dist/{src/lib → lib}/server/typesense_index_lock.d.ts +0 -0
  227. /package/dist/{src/lib/text_parsers/simplifiers.test.d.ts → lib/server/typesense_index_lock.test.d.ts} +0 -0
  228. /package/dist/{src/lib → lib}/test/text_titles_infos.d.ts +0 -0
  229. /package/dist/{src/lib → lib}/text_parsers/action_citation_patterns.d.ts +0 -0
  230. /package/dist/{src/lib/text_parsers/texts.test.d.ts → lib/text_parsers/action_citation_patterns.test.d.ts} +0 -0
  231. /package/dist/{src/lib → lib}/text_parsers/action_directives.d.ts +0 -0
  232. /package/dist/{src/lib/text_parsers/typography.test.d.ts → lib/text_parsers/action_directives.test.d.ts} +0 -0
  233. /package/dist/{src/lib → lib}/text_parsers/action_occurrences.d.ts +0 -0
  234. /package/dist/{src/scripts/add_links_to_assemblee_parsed_documents.d.ts → lib/text_parsers/action_occurrences.test.d.ts} +0 -0
  235. /package/dist/{src/lib → lib}/text_parsers/action_position_cues.d.ts +0 -0
  236. /package/dist/{src/scripts/add_links_to_html_document.d.ts → lib/text_parsers/action_position_cues.test.d.ts} +0 -0
  237. /package/dist/{src/lib → lib}/text_parsers/action_target_scopes.d.ts +0 -0
  238. /package/dist/{src/lib → lib}/text_parsers/action_words.d.ts +0 -0
  239. /package/dist/{src/scripts/add_links_to_legifrance.d.ts → lib/text_parsers/action_words.test.d.ts} +0 -0
  240. /package/dist/{src/lib → lib}/text_parsers/actions.d.ts +0 -0
  241. /package/dist/{src/scripts/add_links_to_senat_comptes_rendus.d.ts → lib/text_parsers/actions.test.d.ts} +0 -0
  242. /package/dist/{src/lib → lib}/text_parsers/amendment_action_directives.d.ts +0 -0
  243. /package/dist/{src/lib → lib}/text_parsers/articles.d.ts +0 -0
  244. /package/dist/{src/scripts/add_links_to_senat_parsed_documents.d.ts → lib/text_parsers/articles.test.d.ts} +0 -0
  245. /package/dist/{src/lib → lib}/text_parsers/citations.d.ts +0 -0
  246. /package/dist/{src/scripts/alimenter_jurisprudence_pilote.d.ts → lib/text_parsers/citations.test.d.ts} +0 -0
  247. /package/dist/{src/scripts/associate_jorf_textes_with_assemblee_commissions.d.ts → lib/text_parsers/code_annexes.test.d.ts} +0 -0
  248. /package/dist/{src/lib → lib}/text_parsers/dates.d.ts +0 -0
  249. /package/dist/{src/scripts/associate_jorf_textes_with_dossiers_legislatifs_assemblee.d.ts → lib/text_parsers/dates.test.d.ts} +0 -0
  250. /package/dist/{src/lib → lib}/text_parsers/divisions.d.ts +0 -0
  251. /package/dist/{src/scripts/compare_legi_bills.d.ts → lib/text_parsers/divisions.test.d.ts} +0 -0
  252. /package/dist/{src/lib → lib}/text_parsers/doctrinal_references.d.ts +0 -0
  253. /package/dist/{src/scripts/configure_postgres_assemblee_document_triggers.d.ts → lib/text_parsers/doctrinal_references.test.d.ts} +0 -0
  254. /package/dist/{src/lib → lib}/text_parsers/fragments.d.ts +0 -0
  255. /package/dist/{src/lib → lib}/text_parsers/helpers.d.ts +0 -0
  256. /package/dist/{src/scripts/configure_postgres_legi_resolver.d.ts → lib/text_parsers/historical_versions.test.d.ts} +0 -0
  257. /package/dist/{src/lib → lib}/text_parsers/legal_text_aliases.d.ts +0 -0
  258. /package/dist/{src/lib → lib}/text_parsers/numbers.d.ts +0 -0
  259. /package/dist/{src/scripts/configure_postgres_root_cid_index.d.ts → lib/text_parsers/numbers.test.d.ts} +0 -0
  260. /package/dist/{src/scripts/configure_postgres_senat_document_triggers.d.ts → lib/text_parsers/parsers.test.d.ts} +0 -0
  261. /package/dist/{src/lib → lib}/text_parsers/portions.d.ts +0 -0
  262. /package/dist/{src/scripts/enrich_assemblee_documents.d.ts → lib/text_parsers/portions.test.d.ts} +0 -0
  263. /package/dist/{src/lib → lib}/text_parsers/prepositions.d.ts +0 -0
  264. /package/dist/{src/scripts/enrich_senat_documents.d.ts → lib/text_parsers/prepositions.test.d.ts} +0 -0
  265. /package/dist/{src/lib → lib}/text_parsers/qualified_versions.d.ts +0 -0
  266. /package/dist/{src/lib → lib}/text_parsers/references.d.ts +0 -0
  267. /package/dist/{src/scripts/html_document_to_text.d.ts → lib/text_parsers/references.test.d.ts} +0 -0
  268. /package/dist/{src/lib → lib}/text_parsers/relative_locations.d.ts +0 -0
  269. /package/dist/{src/scripts/index_postgres_assemblee_amendments.d.ts → lib/text_parsers/relative_locations.test.d.ts} +0 -0
  270. /package/dist/{src/scripts/index_postgres_assemblee_texts.d.ts → lib/text_parsers/repeated_actions.test.d.ts} +0 -0
  271. /package/dist/{src/lib → lib}/text_parsers/search_queries.d.ts +0 -0
  272. /package/dist/{src/scripts/index_postgres_judilibre.d.ts → lib/text_parsers/search_queries.test.d.ts} +0 -0
  273. /package/dist/{src/lib → lib}/text_parsers/separators.d.ts +0 -0
  274. /package/dist/{src/lib → lib}/text_parsers/simplifiers.d.ts +0 -0
  275. /package/dist/{src/scripts/index_postgres_legifrance_articles.d.ts → lib/text_parsers/simplifiers.test.d.ts} +0 -0
  276. /package/dist/{src/lib → lib}/text_parsers/table_row_targets.d.ts +0 -0
  277. /package/dist/{src/lib → lib}/text_parsers/table_unit_notes.d.ts +0 -0
  278. /package/dist/{src/scripts/index_postgres_legifrance_jurisprudence.d.ts → lib/text_parsers/texts.test.d.ts} +0 -0
  279. /package/dist/{src/lib → lib}/text_parsers/transformers.d.ts +0 -0
  280. /package/dist/{src/lib → lib}/text_parsers/typography.d.ts +0 -0
  281. /package/dist/{src/scripts/index_postgres_senat_amendments.d.ts → lib/text_parsers/typography.test.d.ts} +0 -0
  282. /package/dist/{src/lib → lib}/textes.d.ts +0 -0
  283. /package/dist/{src/lib → lib}/timings.d.ts +0 -0
  284. /package/dist/{src/scripts/index_postgres_senat_texts.d.ts → scripts/add_links_to_assemblee_parsed_documents.d.ts} +0 -0
  285. /package/dist/{src/scripts/parse_akoma_ntoso_bill_raw.d.ts → scripts/add_links_to_html_document.d.ts} +0 -0
  286. /package/dist/{src/scripts/parse_assemblee_bill_raw.d.ts → scripts/add_links_to_legifrance.d.ts} +0 -0
  287. /package/dist/{src/scripts/profile_assemblee_document_parsing.d.ts → scripts/add_links_to_senat_comptes_rendus.d.ts} +0 -0
  288. /package/dist/{src/scripts/profile_canutes_bill.d.ts → scripts/add_links_to_senat_parsed_documents.d.ts} +0 -0
  289. /package/dist/{src/scripts → scripts}/add_positions_to_table_of_contents.d.ts +0 -0
  290. /package/dist/{src/scripts → scripts}/add_references_to_html_document.d.ts +0 -0
  291. /package/dist/{src/scripts/shared/assemblee_legislature.test.d.ts → scripts/alimenter_jurisprudence_pilote.d.ts} +0 -0
  292. /package/dist/{src/scripts/shared/checkpoint_cli_options.test.d.ts → scripts/associate_jorf_textes_with_assemblee_commissions.d.ts} +0 -0
  293. /package/dist/{src/scripts/simplified_html_bill_to_table_of_contents.d.ts → scripts/associate_jorf_textes_with_dossiers_legislatifs_assemblee.d.ts} +0 -0
  294. /package/dist/{src/scripts → scripts}/audit_doctrinal_references.d.ts +0 -0
  295. /package/dist/{src/scripts/simplify_word_html.d.ts → scripts/compare_legi_bills.d.ts} +0 -0
  296. /package/dist/{src/scripts → scripts}/configure.d.ts +0 -0
  297. /package/dist/{src/scripts/sync_postgres_assemblee_document_content.d.ts → scripts/configure_postgres_assemblee_document_triggers.d.ts} +0 -0
  298. /package/dist/{src/scripts/sync_postgres_senat_document_content.d.ts → scripts/configure_postgres_legi_resolver.d.ts} +0 -0
  299. /package/dist/{src/scripts/test_canutes_titles_cache.d.ts → scripts/configure_postgres_root_cid_index.d.ts} +0 -0
  300. /package/dist/{src/scripts/warm_canutes_text_titles_cache.d.ts → scripts/configure_postgres_senat_document_triggers.d.ts} +0 -0
  301. /package/dist/{src/scripts → scripts}/extract_alineas_images.d.ts +0 -0
  302. /package/dist/{src/scripts → scripts}/generate_alineas_numbers_review.d.ts +0 -0
  303. /package/dist/{src/scripts → scripts}/index_typesense.d.ts +0 -0
  304. /package/dist/{src/scripts → scripts}/merge_reviewed_alineas_numbers.d.ts +0 -0
  305. /package/dist/{src/scripts → scripts}/set_articles_missing_num.d.ts +0 -0
  306. /package/dist/{src/scripts → scripts}/shared/assemblee_legislature.d.ts +0 -0
  307. /package/dist/{src/scripts → scripts}/shared/checkpoint_cli_options.d.ts +0 -0
package/dist/server.js CHANGED
@@ -1,11 +1,11 @@
1
- import { A as e, C as t, E as n, F as r, Ft as i, Gt as a, K as o, Kt as s, Mt as c, N as l, Nt as u, O as d, Ot as f, P as p, Pt as m, Rt as h, S as g, T as _, Y as v, _ as ee, at as y, b, c as x, g as S, h as C, ht as w, it as te, j as ne, k as re, lt as ie, m as ae, n as oe, p as se, pt as ce, q as le, s as ue, t as de, tt as T, u as fe, v as pe, w as me, z as he } from "./html-DWNF_0Ek.js";
2
- import { A as ge, At as E, F as _e, Ft as D, Lt as O, R as ve, St as k, d as ye, ft as be, it as xe, j as Se, jt as A, kt as j, n as Ce, r as we, t as Te, yt as Ee, z as De } from "./resolver-BBrU9oGB.js";
3
- import * as Oe from "node:crypto";
4
- import { createHash as M } from "node:crypto";
5
- import N from "fs-extra";
6
- import ke from "node:path";
1
+ import { A as e, B as t, C as n, D as r, E as i, F as a, Ft as o, I as s, It as c, J as l, Kt as u, M as d, Nt as f, P as p, Pt as m, T as h, X as g, _, at as v, g as y, gt as b, h as x, i as S, j as C, k as ee, kt as te, m as ne, mt as re, n as ie, nt as w, o as ae, ot as oe, q as se, qt as ce, r as le, st as ue, t as de, ut as fe, v as pe, w as me, x as he, y as ge, zt as _e } from "./html-BTaoaqX5.js";
2
+ import { Bt as T, K as ve, Kt as E, Ot as ye, R as be, Rt as D, U as xe, Wt as O, h as Se, jt as k, o as Ce, pt as we, q as Te, s as Ee, t as De, xt as Oe, z as ke, zt as A } from "./resolver-GT7457lQ.js";
3
+ import * as Ae from "node:crypto";
4
+ import { createHash as j } from "node:crypto";
5
+ import M from "fs-extra";
6
+ import je from "node:path";
7
7
  //#region src/lib/server/assemblee_amendment_search.ts
8
- function Ae(e, t) {
8
+ function Me(e, t) {
9
9
  let n = e;
10
10
  for (let e of t) {
11
11
  if (typeof n != "object" || !n) return null;
@@ -13,34 +13,34 @@ function Ae(e, t) {
13
13
  }
14
14
  return typeof n == "string" && n.trim() ? n.trim() : null;
15
15
  }
16
- function je(e) {
16
+ function Ne(e) {
17
17
  return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
18
18
  }
19
- function Me(e) {
20
- return je(w(e).text());
19
+ function Pe(e) {
20
+ return Ne(b(e).text());
21
21
  }
22
- function Ne(e) {
23
- let t = je([
24
- Ae(e, [
22
+ function Fe(e) {
23
+ let t = Ne([
24
+ Me(e, [
25
25
  "corps",
26
26
  "contenuAuteur",
27
27
  "dispositif"
28
28
  ]),
29
- Ae(e, [
29
+ Me(e, [
30
30
  "corps",
31
31
  "contenuAuteur",
32
32
  "dispositifAmdtCreditPLF"
33
33
  ]),
34
- Ae(e, [
34
+ Me(e, [
35
35
  "corps",
36
36
  "contenuAuteur",
37
37
  "dispositifAmdtCreditPLFR"
38
38
  ])
39
- ].filter((e) => e !== null).map((e) => Me(e)).join("\n")), n = Ae(e, [
39
+ ].filter((e) => e !== null).map((e) => Pe(e)).join("\n")), n = Me(e, [
40
40
  "corps",
41
41
  "contenuAuteur",
42
42
  "exposeSommaire"
43
- ]), r = n === null ? "" : Me(n);
43
+ ]), r = n === null ? "" : Pe(n);
44
44
  return [...t ? [{
45
45
  content: t,
46
46
  itemKind: "dispositif",
@@ -51,24 +51,24 @@ function Ne(e) {
51
51
  label: "Exposé sommaire"
52
52
  }] : []];
53
53
  }
54
- function Pe(e, t) {
55
- return M("sha256").update(JSON.stringify({
54
+ function Ie(e, t) {
55
+ return j("sha256").update(JSON.stringify({
56
56
  item: e,
57
57
  metadata: t
58
58
  })).digest("hex");
59
59
  }
60
60
  //#endregion
61
61
  //#region src/lib/extractors/article_action_targets.ts
62
- function P(e) {
62
+ function N(e) {
63
63
  switch (e.type) {
64
- case "reference_et_action": return P(e.reference);
65
- case "enumeration": return [...P(e.left), ...P(e.right)];
64
+ case "reference_et_action": return N(e.reference);
65
+ case "enumeration": return [...N(e.left), ...N(e.right)];
66
66
  case "parent-enfant": {
67
- let t = [...a(e.parent)].filter((e) => e.type === "article");
67
+ let t = [...u(e.parent)].filter((e) => e.type === "article");
68
68
  return t.length === 1 ? [{
69
69
  article: t[0],
70
70
  reference: e
71
- }] : t.length > 1 ? [] : P(e.child).map((t) => ({
71
+ }] : t.length > 1 ? [] : N(e.child).map((t) => ({
72
72
  article: t.article,
73
73
  reference: {
74
74
  ...e,
@@ -89,145 +89,145 @@ function P(e) {
89
89
  }
90
90
  //#endregion
91
91
  //#region src/lib/extractors/article_action_effects.ts
92
- function Fe(e, t) {
93
- if (t < 2) return null;
94
- let n = Se(e), r = pe(e);
95
- if (r.length !== t) return null;
96
- let i = he(new j(n.output)), a = (e) => De(n, [e])[0].position;
97
- return r.map((t, n) => ({
92
+ function Le(e, n) {
93
+ if (n < 2) return null;
94
+ let r = ke(e), i = ge(e);
95
+ if (i.length !== n) return null;
96
+ let a = t(new D(r.output)), o = (e) => Te(r, [e])[0].position;
97
+ return i.map((t, n) => ({
98
98
  sourceText: e,
99
- referencePosition: a({
100
- start: (n === 0 ? i.find((e) => e.position.start <= t.reference.position.start && e.position.stop >= t.reference.position.stop) : void 0)?.position.start ?? t.reference.position.start,
99
+ referencePosition: o({
100
+ start: (n === 0 ? a.find((e) => e.position.start <= t.reference.position.start && e.position.stop >= t.reference.position.stop) : void 0)?.position.start ?? t.reference.position.start,
101
101
  stop: t.reference.position.stop
102
102
  }),
103
- actionPosition: a(t.position)
103
+ actionPosition: o(t.position)
104
104
  }));
105
105
  }
106
- function Ie(e, n, r) {
107
- if (n.length < 2) return null;
108
- let i = Se(e), a = i.output, o = (e) => De(i, [e])[0].position, s = he(new j(a)), c = s.flatMap(P);
109
- if (c.length !== n.length || c.length < 2) return null;
110
- let l = t(a);
111
- if (l.length > 0) return r?.kind !== "replace_portion" || l.length !== c.length || l.some((e, t) => {
112
- let n = c[t];
113
- return n.article.num !== e.article.num || n.article.position.start !== e.article.position.start || n.article.position.stop !== e.article.position.stop || !ie(n.reference).some((t) => t.kind === "single" && t.steps.some((t) => t.type === "alinéa" && t.index === e.alineaIndex));
114
- }) ? null : c.map((t, i) => ({
115
- targetId: n[i],
106
+ function Re(e, r, i) {
107
+ if (r.length < 2) return null;
108
+ let a = ke(e), o = a.output, s = (e) => Te(a, [e])[0].position, c = t(new D(o)), l = c.flatMap(N);
109
+ if (l.length !== r.length || l.length < 2) return null;
110
+ let u = me(o);
111
+ if (u.length > 0) return i?.kind !== "replace_portion" || u.length !== l.length || u.some((e, t) => {
112
+ let n = l[t];
113
+ return n.article.num !== e.article.num || n.article.position.start !== e.article.position.start || n.article.position.stop !== e.article.position.stop || !fe(n.reference).some((t) => t.kind === "single" && t.steps.some((t) => t.type === "alinéa" && t.index === e.alineaIndex));
114
+ }) ? null : l.map((t, n) => ({
115
+ targetId: r[n],
116
116
  directive: {
117
- ...r,
117
+ ...i,
118
118
  reference: t.reference,
119
- portionSelectors: ie(t.reference),
119
+ portionSelectors: fe(t.reference),
120
120
  tableTarget: {
121
121
  type: "table",
122
- rowIndex: l[i].rowIndex,
123
- rowEndIndex: l[i].rowEndIndex
122
+ rowIndex: u[n].rowIndex,
123
+ rowEndIndex: u[n].rowEndIndex
124
124
  }
125
125
  },
126
126
  sourceAnnotation: {
127
127
  sourceText: e,
128
- referencePosition: o(t.reference.position),
128
+ referencePosition: s(t.reference.position),
129
129
  actionPosition: {
130
130
  start: 0,
131
131
  stop: e.length
132
132
  }
133
133
  }
134
134
  }));
135
- let u = c.filter(({ reference: e }) => e.type === "parent-enfant" && e.parent.type === "texte" && e.parent.nature !== "CODE");
136
- if (u.length > 0 && u.length < c.length) {
137
- let t = c.filter((e) => !u.includes(e));
135
+ let d = l.filter(({ reference: e }) => e.type === "parent-enfant" && e.parent.type === "texte" && e.parent.nature !== "CODE");
136
+ if (d.length > 0 && d.length < l.length) {
137
+ let t = l.filter((e) => !d.includes(e));
138
138
  if (t.length !== 1) return null;
139
- let r = t[0], i = n[c.indexOf(r)], s = g(a);
140
- return !i || s.length !== 1 || s[0].kind === "compound" ? null : [{
141
- targetId: i,
139
+ let i = t[0], a = r[l.indexOf(i)], c = n(o);
140
+ return !a || c.length !== 1 || c[0].kind === "compound" ? null : [{
141
+ targetId: a,
142
142
  sourceAnnotation: {
143
143
  sourceText: e,
144
- referencePosition: o(r.reference.position),
144
+ referencePosition: s(i.reference.position),
145
145
  actionPosition: {
146
146
  start: 0,
147
147
  stop: e.length
148
148
  }
149
149
  },
150
150
  directive: {
151
- ...s[0],
152
- reference: r.reference,
151
+ ...c[0],
152
+ reference: i.reference,
153
153
  sourcePosition: {
154
154
  start: 0,
155
- stop: a.length
155
+ stop: o.length
156
156
  },
157
- sourceText: a
157
+ sourceText: o
158
158
  }
159
159
  }];
160
160
  }
161
- let d = [], f = 0;
162
- for (let e = 1; e < s.length; e += 1) {
163
- let t = s[e];
164
- t.type !== "reference_et_action" || P(t).length === 0 || s.slice(f, e).flatMap(P).length === 0 || g(a.slice(f === 0 ? 0 : s[f].position.start, t.position.start)).length === 1 && g(a.slice(t.position.start)).length === 1 && (d.push(e - 1), f = e);
161
+ let f = [], p = 0;
162
+ for (let e = 1; e < c.length; e += 1) {
163
+ let t = c[e];
164
+ t.type !== "reference_et_action" || N(t).length === 0 || c.slice(p, e).flatMap(N).length === 0 || n(o.slice(p === 0 ? 0 : c[p].position.start, t.position.start)).length === 1 && n(o.slice(t.position.start)).length === 1 && (f.push(e - 1), p = e);
165
165
  }
166
- d.push(s.length - 1);
167
- let p = [], m = 0, h = 0;
168
- for (let t of d) {
169
- let r = s.slice(m, t + 1).flatMap(P);
170
- if (r.length === 0) {
171
- m = t + 1;
166
+ f.push(c.length - 1);
167
+ let m = [], h = 0, g = 0;
168
+ for (let t of f) {
169
+ let i = c.slice(h, t + 1).flatMap(N);
170
+ if (i.length === 0) {
171
+ h = t + 1;
172
172
  continue;
173
173
  }
174
- let i = m === 0 ? 0 : s[m].position.start, c = s[t + 1]?.position.start ?? a.length, l = g(a.slice(i, c));
175
- if (l.length !== 1 || l[0].kind === "compound") return null;
176
- let u = l[0];
177
- for (let t of r) {
178
- let r = n[h++];
179
- if (!r) return null;
180
- p.push({
181
- targetId: r,
174
+ let a = h === 0 ? 0 : c[h].position.start, l = c[t + 1]?.position.start ?? o.length, u = n(o.slice(a, l));
175
+ if (u.length !== 1 || u[0].kind === "compound") return null;
176
+ let d = u[0];
177
+ for (let t of i) {
178
+ let n = r[g++];
179
+ if (!n) return null;
180
+ m.push({
181
+ targetId: n,
182
182
  sourceAnnotation: {
183
183
  sourceText: e,
184
- referencePosition: o(t.reference.position),
185
- actionPosition: o({
186
- start: i,
187
- stop: c
184
+ referencePosition: s(t.reference.position),
185
+ actionPosition: s({
186
+ start: a,
187
+ stop: l
188
188
  })
189
189
  },
190
190
  directive: {
191
- ...u,
192
- sourceText: a,
191
+ ...d,
192
+ sourceText: o,
193
193
  sourcePosition: {
194
194
  start: 0,
195
- stop: a.length
195
+ stop: o.length
196
196
  },
197
197
  reference: t.reference,
198
- portionSelectors: ie(t.reference)
198
+ portionSelectors: fe(t.reference)
199
199
  }
200
200
  });
201
201
  }
202
- m = t + 1;
202
+ h = t + 1;
203
203
  }
204
- return h === n.length ? p : null;
204
+ return g === r.length ? m : null;
205
205
  }
206
206
  //#endregion
207
207
  //#region src/lib/server/parsed_bills.ts
208
- var Le = /^expos[ée]\s+des\s+motifs\b/iu;
209
- function F(e) {
208
+ var ze = /^expos[ée]\s+des\s+motifs\b/iu;
209
+ function P(e) {
210
210
  return (e ?? "").replace(/\u00a0/g, " ").replace(/\s+/g, " ").trim();
211
211
  }
212
- function I(e) {
213
- return F(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
212
+ function F(e) {
213
+ return P(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
214
214
  }
215
- function Re(e) {
216
- return c(F(e));
215
+ function Be(e) {
216
+ return f(P(e));
217
217
  }
218
- function L(e) {
219
- return `_TocArt${Re(e).replace(/\s+/gu, "")}`;
218
+ function I(e) {
219
+ return `_TocArt${Be(e).replace(/\s+/gu, "")}`;
220
220
  }
221
- function ze(e, t) {
221
+ function Ve(e, t) {
222
222
  return e(t).closest(".assnatTOC6,.assnatTOC5,.assnatTOC4").length > 0;
223
223
  }
224
- function Be(e) {
225
- return I(e).replace(/[‐‑‒–—]/gu, "-").replace(/\s*\.\s*/gu, ".");
224
+ function He(e) {
225
+ return F(e).replace(/[‐‑‒–—]/gu, "-").replace(/\s*\.\s*/gu, ".");
226
226
  }
227
- function Ve(e) {
228
- return Be(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
227
+ function Ue(e) {
228
+ return He(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
229
229
  }
230
- function He(e) {
230
+ function We(e) {
231
231
  switch (e.kind) {
232
232
  case "insert_after":
233
233
  case "insert_before": return e.insertText;
@@ -245,12 +245,12 @@ function He(e) {
245
245
  default: return;
246
246
  }
247
247
  }
248
- function Ue(e) {
249
- let t = F(e.sourceText), n = /\b(?:ins[ée]r[ée]s?|cr[ée][ée]s?|ajout[ée]s?|compl[ée]t[ée]s?\s+par)\b[\s\S]{0,160}?\barticle\s+(.+?)\s+ainsi\s+r[ée]dig[ée]s?\b/iu.exec(t);
250
- if (n?.[1] !== void 0) return u(n[1]);
248
+ function Ge(e) {
249
+ let t = P(e.sourceText), n = /\b(?:ins[ée]r[ée]s?|cr[ée][ée]s?|ajout[ée]s?|compl[ée]t[ée]s?\s+par)\b[\s\S]{0,160}?\barticle\s+(.+?)\s+ainsi\s+r[ée]dig[ée]s?\b/iu.exec(t);
250
+ if (n?.[1] !== void 0) return m(n[1]);
251
251
  }
252
- function We(e) {
253
- let t = He(e), n = f(t ?? "");
252
+ function Ke(e) {
253
+ let t = We(e), n = te(t ?? "");
254
254
  if (n.length > 0 && t !== void 0) return n.map((e, r) => {
255
255
  let i = e.start, a = n[r + 1]?.start ?? t.length, o = t.slice(i, a).trim();
256
256
  return {
@@ -258,64 +258,64 @@ function We(e) {
258
258
  text: o
259
259
  };
260
260
  });
261
- let r = Ue(e);
261
+ let r = Ge(e);
262
262
  return r === void 0 ? [] : [{
263
263
  num: r,
264
264
  text: t ?? e.sourceText
265
265
  }];
266
266
  }
267
- function Ge(e, t = /* @__PURE__ */ new Set()) {
267
+ function qe(e, t = /* @__PURE__ */ new Set()) {
268
268
  if (e == null) return t;
269
269
  if (Array.isArray(e)) {
270
- for (let n of e) Ge(n, t);
270
+ for (let n of e) qe(n, t);
271
271
  return t;
272
272
  }
273
273
  if (typeof e != "object") return t;
274
274
  let n = e;
275
275
  n.type === "article" && typeof n.num == "string" && t.add(n.num);
276
- for (let e of Object.values(n)) Ge(e, t);
276
+ for (let e of Object.values(n)) qe(e, t);
277
277
  return t;
278
278
  }
279
- function Ke(e) {
279
+ function Je(e) {
280
280
  if (typeof e != "object" || !e) return !1;
281
- if (Array.isArray(e)) return e.some(Ke);
281
+ if (Array.isArray(e)) return e.some(Je);
282
282
  let t = e;
283
- return t.type === "bounded-interval" || Object.values(t).some(Ke);
283
+ return t.type === "bounded-interval" || Object.values(t).some(Je);
284
284
  }
285
- function qe(e) {
286
- let t = I(e.sourceText);
285
+ function Ye(e) {
286
+ let t = F(e.sourceText);
287
287
  return /\b(?:cree|cree[e]?s?|resultant|issu|prevu|mentionne)\b[\s\S]{0,80}\b(?:present|presente|pjl|projet\s+de\s+loi)\b/u.test(t);
288
288
  }
289
- function Je(e) {
290
- return F(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
289
+ function Xe(e) {
290
+ return P(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
291
291
  }
292
- function Ye(e, t) {
293
- let n = new j(e, t), r = xe(n);
292
+ function Ze(e, t) {
293
+ let n = new D(e, t), r = we(n);
294
294
  return typeof r != "string" || n.offset <= t ? null : {
295
295
  date: r,
296
296
  start: t,
297
297
  stop: n.offset
298
298
  };
299
299
  }
300
- function Xe(e, t) {
300
+ function Qe(e, t) {
301
301
  let n = /\d/u.exec(e.slice(t));
302
302
  if (!n) return null;
303
303
  let r = t + n.index;
304
- return e.slice(t, r).trim().length > 0 ? null : Ye(e, r);
304
+ return e.slice(t, r).trim().length > 0 ? null : Ze(e, r);
305
305
  }
306
- function Ze(e) {
306
+ function $e(e) {
307
307
  let t = /^la présente loi (?:s['’]appli(?:que|quent)|entr(?:e|ent) en vigueur) (?:[aà] compter (?:du|de|d['’])|au|le)\s*/u, n = /^la présente loi s['’]appli(?:que|quent)\s*:\s*/u, r = /\b[aà] compter (?:du|de|d['’])\s*/gu, i = [], a = "la présente loi", o = e.indexOf(a);
308
308
  for (; o !== -1;) {
309
309
  let s = e.indexOf(a, o + 15), c = e.slice(o, o + 1400), l = t.exec(c);
310
310
  if (l) {
311
- let e = Xe(c, l[0].length);
311
+ let e = Qe(c, l[0].length);
312
312
  e && i.push(e.date);
313
313
  }
314
314
  let u = n.exec(c);
315
315
  if (u) {
316
316
  let e = /\barticle\s+\w/iu.exec(c), t = e === null ? c.slice(u[0].length) : c.slice(u[0].length, e.index);
317
317
  for (r.lastIndex = 0; r.exec(t) !== null;) {
318
- let e = Xe(t, r.lastIndex);
318
+ let e = Qe(t, r.lastIndex);
319
319
  e && /^\s+pour\s+les\s+autres\s+dispositions\s+fiscales\b/iu.test(t.slice(e.stop)) && i.push(e.date);
320
320
  }
321
321
  }
@@ -323,20 +323,20 @@ function Ze(e) {
323
323
  }
324
324
  return i;
325
325
  }
326
- function Qe(e) {
327
- let t = Ze(Je(e).toLowerCase()), n = Array.from(new Set(t));
326
+ function et(e) {
327
+ let t = $e(Xe(e).toLowerCase()), n = Array.from(new Set(t));
328
328
  return n.length === 1 ? n[0] : void 0;
329
329
  }
330
- function $e(e) {
331
- return I(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-").replace(/^(?:(?:article\s+[^:]+|[a-z][.)]|[ivxlcdm]+\.|\d+°)\s*(?:-\s*)?)+/iu, "");
330
+ function tt(e) {
331
+ return F(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-").replace(/^(?:(?:article\s+[^:]+|[a-z][.)]|[ivxlcdm]+\.|\d+°)\s*(?:-\s*)?)+/iu, "");
332
332
  }
333
- function R(e) {
333
+ function L(e) {
334
334
  return e?.type === "tag";
335
335
  }
336
- function et(e, t) {
336
+ function nt(e, t) {
337
337
  return e.html(t) ?? "";
338
338
  }
339
- function tt(e, t) {
339
+ function rt(e, t) {
340
340
  let n = [], r = /* @__PURE__ */ new Set();
341
341
  for (let i of e(t).find("a").get()) {
342
342
  let a = e(i).attr("href") ?? "", o = /\/legifrance\/(articles|sections|textes)\/([^?#"]+)/u.exec(a);
@@ -344,49 +344,60 @@ function tt(e, t) {
344
344
  let s = o[1] === "articles" ? "article" : o[1] === "sections" ? "division" : "text", c = o[2].replace(/\.md$/u, ""), l = `${s}\0${c}`;
345
345
  if (r.has(l)) continue;
346
346
  r.add(l);
347
- let u = F(e(i).text());
347
+ let u = P(e(i).text()), d = (e(i).attr("data-tisseuse-warning") ?? "").split(" ");
348
348
  n.push({
349
349
  id: c,
350
- ...nt(e, t, i) ? { insideFrenchQuotes: !0 } : {},
350
+ ...[
351
+ "article_futur_a_date_reference",
352
+ "article_abroge_avant_date_reference",
353
+ "reference_historique_explicite",
354
+ "indice_structurel",
355
+ "composant_publication",
356
+ "structure_absente"
357
+ ].some((e) => d.includes(e)) ? { consultationOnly: !0 } : {},
358
+ ...it(e, t, i) ? { insideFrenchQuotes: !0 } : {},
351
359
  ...u ? { text: u } : {},
352
360
  type: s
353
361
  });
354
362
  }
355
363
  return n;
356
364
  }
357
- function nt(e, t, n) {
358
- let r = rt(e, t, n);
359
- return (r.match(/«/gu) ?? []).length > (r.match(/»/gu) ?? []).length;
365
+ function it(e, t, n) {
366
+ let r = ot(e, t, n);
367
+ return at(e(t).text(), r.length);
360
368
  }
361
- function rt(e, t, n) {
369
+ function at(e, t) {
370
+ return ue(e, { allowUnclosed: !0 }).some((e) => e.position.start < t && t < e.position.stop);
371
+ }
372
+ function ot(e, t, n) {
362
373
  if (t === n) return "";
363
374
  if (t.type === "text") return t.data ?? "";
364
- if (!R(t)) return "";
375
+ if (!L(t)) return "";
365
376
  let r = "";
366
377
  for (let i of e(t).contents().get()) {
367
378
  if (i === n) return r;
368
- if (R(i) && e.contains(i, n)) return r + rt(e, i, n);
379
+ if (L(i) && e.contains(i, n)) return r + ot(e, i, n);
369
380
  r += e(i).text();
370
381
  }
371
382
  return r;
372
383
  }
373
- function it(e, t) {
374
- return t.map((t) => F(e(t).text())).filter(Boolean).join("\n");
384
+ function st(e, t) {
385
+ return t.map((t) => P(e(t).text())).filter(Boolean).join("\n");
375
386
  }
376
- function at(t) {
377
- let n = I(t);
378
- return !n || Le.test(n) ? "noise" : e.test(t) ? "directive_candidate" : "context";
387
+ function ct(e) {
388
+ let t = F(e);
389
+ return !t || ze.test(t) ? "noise" : C.test(e) ? "directive_candidate" : "context";
379
390
  }
380
- function ot(e, t) {
381
- return t.tagName === "p" && (/pastille/iu.test(e(t).attr("class") ?? "") || e(t).is("[data-pastille]")) && /^\(\d+\)$/u.test(F(e(t).text()));
391
+ function lt(e, t) {
392
+ return t.tagName === "p" && (/pastille/iu.test(e(t).attr("class") ?? "") || e(t).is("[data-pastille]")) && /^\(\d+\)$/u.test(P(e(t).text()));
382
393
  }
383
- function st(e) {
384
- let t = w(e, { xml: {
394
+ function ut(e) {
395
+ let t = b(e, { xml: {
385
396
  xmlMode: !1,
386
397
  withStartIndices: !0,
387
398
  withEndIndices: !0
388
399
  } });
389
- return t("p").get().filter((e) => ot(t, e)).map((e) => {
400
+ return t("p").get().filter((e) => lt(t, e)).map((e) => {
390
401
  if (e.startIndex === null || e.endIndex === null) throw Error("Missing source positions for an Assembly pastille");
391
402
  return {
392
403
  start: e.startIndex,
@@ -394,33 +405,40 @@ function st(e) {
394
405
  };
395
406
  });
396
407
  }
397
- async function ct(e, t, n, r) {
408
+ async function dt(e, t, n, r, i) {
398
409
  if (n === void 0) throw Error("A document date is required to add links to legal references.");
399
410
  if (t.legiResolver === void 0 && t.canutesDb === void 0) throw Error("A Canutes database or an explicit legal resolver is required to add links to legal references.");
400
- let i = t.legiResolver ?? new se(t.canutesDb), { output: a } = await oe({
411
+ let a = t.legiResolver ?? new ne(t.canutesDb), { output: o } = await ie({
412
+ callerDate: t.callerDate,
401
413
  date: n,
414
+ ...i === void 0 || t.linkDecisionDocumentId === void 0 ? {} : { decisionObserver: {
415
+ documentId: t.linkDecisionDocumentId,
416
+ onDecision: (e) => i.push(e)
417
+ } },
402
418
  excludedHtmlRanges: r,
403
419
  html: e,
404
420
  includeInternalArticleLinks: t.includeInternalArticleLinks,
405
- legiResolver: i,
421
+ legiResolver: a,
406
422
  linkBaseUrl: t.linkBaseUrl,
423
+ linkDecisionDocumentId: t.linkDecisionDocumentId,
407
424
  linkType: t.linkType,
425
+ renderLinkDecisions: t.renderLinkDecisions,
408
426
  logIgnoredReferencesTypes: t.logIgnoredReferencesTypes,
409
427
  logPartialReferences: t.logPartialReferences,
410
428
  logReferences: t.logReferences
411
429
  });
412
- return a ?? e;
430
+ return o ?? e;
413
431
  }
414
- function lt(e, t) {
432
+ function ft(e, t) {
415
433
  let n = e(t).closest("h1,h2,h3,h4,h5,h6,p,td,th").get(0), r = e(t).closest("table").get(0);
416
- return R(r) && R(n) && e(n).parents("table").get(0) === r ? r : R(n) ? n : t;
434
+ return L(r) && L(n) && e(n).parents("table").get(0) === r ? r : L(n) ? n : t;
417
435
  }
418
- function ut(e, t, n, r, i) {
436
+ function pt(e, t, n, r, i) {
419
437
  if (n.has(i.container)) return;
420
- let a = i.id ?? L(i.num ?? i.label);
438
+ let a = i.id ?? I(i.num ?? i.label);
421
439
  if (r.has(a)) return;
422
440
  r.add(a), n.add(i.container);
423
- let o = i.title ? e(i.element).closest("h1,h2,h3,h4,h5,h6,p.assnat9ArticleNum").get(0) : void 0, s = R(o) ? ft(e, o) : null, c = s ? e(o).text() : "", l = R(o) && s?.label === i.label && s.title === i.title && [`${s.label}${s.title}`, `${s.label} ${s.title}`].some((e) => I(e) === I(c)) ? {
441
+ let o = i.title ? e(i.element).closest("h1,h2,h3,h4,h5,h6,p.assnat9ArticleNum").get(0) : void 0, s = L(o) ? ht(e, o) : null, c = s ? e(o).text() : "", l = L(o) && s?.label === i.label && s.title === i.title && [`${s.label}${s.title}`, `${s.label} ${s.title}`].some((e) => F(e) === F(c)) ? {
424
442
  element: o,
425
443
  text: `${s.label}\n${s.title}`
426
444
  } : void 0;
@@ -434,75 +452,75 @@ function ut(e, t, n, r, i) {
434
452
  splitAtBreak: l
435
453
  });
436
454
  }
437
- function dt(e) {
455
+ function mt(e) {
438
456
  let t = /* @__PURE__ */ new Map();
439
457
  return e("body *").each((e, n) => {
440
458
  t.set(n, e);
441
459
  }), t;
442
460
  }
443
- function z(e, t) {
461
+ function R(e, t) {
444
462
  return e.get(t) ?? 2 ** 53 - 1;
445
463
  }
446
- function ft(e, t) {
447
- if (!e(t).hasClass("assnat9ArticleNum") && !mt(e, t) || e(t).find("br").length !== 1) return null;
464
+ function ht(e, t) {
465
+ if (!e(t).hasClass("assnat9ArticleNum") && !_t(e, t) || e(t).find("br").length !== 1) return null;
448
466
  let n = "", r = "", i = !1, a = (e) => {
449
467
  if (e.type === "text") i ? r += e.data : n += e.data;
450
- else if (R(e)) if (e.tagName.toLowerCase() === "br") i = !0;
468
+ else if (L(e)) if (e.tagName.toLowerCase() === "br") i = !0;
451
469
  else for (let t of e.children) a(t);
452
470
  };
453
471
  a(t);
454
- let o = m(F(n)), s = F(r);
455
- return o && !o.title && s ? {
456
- ...o,
457
- title: s
472
+ let s = o(P(n)), c = P(r);
473
+ return s && !s.title && c ? {
474
+ ...s,
475
+ title: c
458
476
  } : null;
459
477
  }
460
- function pt(e) {
478
+ function gt(e) {
461
479
  let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
462
480
  e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
463
- if (ze(e, a)) return;
464
- let o = F(e(a).text()), s = e(a).attr("id");
465
- if (!s || r.has(s)) return;
466
- let c = lt(e, a), l = e(a).closest("h1,h2,h3,h4,h5,h6,p.assnat9ArticleNum").get(0), u = m(o) ?? (R(l) && (a === l || e(a).find("br").length === 1) ? ft(e, l) : null);
467
- u && ut(e, t, n, r, {
468
- id: s,
469
- ...u,
481
+ if (Ve(e, a)) return;
482
+ let s = P(e(a).text()), c = e(a).attr("id");
483
+ if (!c || r.has(c)) return;
484
+ let l = ft(e, a), u = e(a).closest("h1,h2,h3,h4,h5,h6,p.assnat9ArticleNum").get(0), d = o(s) ?? (L(u) && (a === u || e(a).find("br").length === 1) ? ht(e, u) : null);
485
+ d && pt(e, t, n, r, {
486
+ id: c,
487
+ ...d,
470
488
  element: a,
471
- container: c
489
+ container: l
472
490
  });
473
491
  }), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((i, a) => {
474
492
  if (n.has(a)) return;
475
- let o = m(F(e(a).text())) ?? ft(e, a);
476
- o && ut(e, t, n, r, {
477
- ...o,
493
+ let s = o(P(e(a).text())) ?? ht(e, a);
494
+ s && pt(e, t, n, r, {
495
+ ...s,
478
496
  element: a,
479
497
  container: a
480
498
  });
481
499
  });
482
- let i = dt(e);
483
- return t.sort((e, t) => z(i, e.container) - z(i, t.container)), t;
500
+ let i = mt(e);
501
+ return t.sort((e, t) => R(i, e.container) - R(i, t.container)), t;
484
502
  }
485
- function mt(e, t) {
486
- if (ze(e, t)) return !1;
503
+ function _t(e, t) {
504
+ if (Ve(e, t)) return !1;
487
505
  let n = t.tagName?.toLowerCase();
488
506
  if (n !== "p") return /^h[1-6]$/u.test(n ?? "");
489
507
  let r = e(t).attr("style") ?? "", i = e(t).html() ?? "";
490
508
  return /text-align\s*:\s*center/iu.test(r) && (/font-weight\s*:\s*bold/iu.test(r) || /font-weight\s*:\s*bold/iu.test(i) || /<(?:strong|b)(?:\s|>)/iu.test(i));
491
509
  }
492
- function ht(e) {
510
+ function vt(e) {
493
511
  let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
494
512
  return e("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6,p").each((i, a) => {
495
- if (ze(e, a) || !e(a).hasClass("assnat9ArticleNum") && !mt(e, a)) return;
496
- let o = m(e(a).text()) ?? ft(e, a);
497
- o && ut(e, t, n, r, {
498
- ...o,
513
+ if (Ve(e, a) || !e(a).hasClass("assnat9ArticleNum") && !_t(e, a)) return;
514
+ let s = o(e(a).text()) ?? ht(e, a);
515
+ s && pt(e, t, n, r, {
516
+ ...s,
499
517
  element: a,
500
518
  container: a
501
519
  });
502
520
  }), t;
503
521
  }
504
- function gt(e) {
505
- let t = Re(e ?? "").replace(/[()]/gu, "").trim();
522
+ function yt(e) {
523
+ let t = Be(e ?? "").replace(/[()]/gu, "").trim();
506
524
  if (!t || t.toLowerCase() === "liminaire") return;
507
525
  if (t.toLowerCase() === "unique") return {
508
526
  base: 1,
@@ -511,7 +529,7 @@ function gt(e) {
511
529
  };
512
530
  let n = /^(\d+|premier)(?:\s+([a-z]+))?(?:\s+([A-Z]+))?$/u.exec(t);
513
531
  if (!n) return;
514
- let r = n[1] === "premier" ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 : vt(i);
532
+ let r = n[1] === "premier" ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 : xt(i);
515
533
  if (a !== void 0) return {
516
534
  base: r,
517
535
  suffixOrder: a,
@@ -519,7 +537,7 @@ function gt(e) {
519
537
  text: t
520
538
  };
521
539
  }
522
- function _t(e, t) {
540
+ function bt(e, t) {
523
541
  if (t.base !== e.base) return t.base - e.base;
524
542
  if (t.suffixOrder !== e.suffixOrder) return t.suffixOrder - e.suffixOrder;
525
543
  for (let n = 0; n <= Math.max(e.letters?.length ?? 0, t.letters?.length ?? 0); n++) {
@@ -528,14 +546,14 @@ function _t(e, t) {
528
546
  }
529
547
  return 0;
530
548
  }
531
- function vt(e) {
532
- let t = new j(e), n = be(t);
549
+ function xt(e) {
550
+ let t = new D(e), n = Oe(t);
533
551
  if (!(n === void 0 || t.offset !== e.length) && !(typeof n != "object" || !n || !("value" in n) || typeof n.value != "number")) return n.value - 1;
534
552
  }
535
- function yt(e) {
553
+ function St(e) {
536
554
  let t = [], n = e.map((e) => ({
537
555
  heading: e,
538
- token: gt(e.num)
556
+ token: yt(e.num)
539
557
  }));
540
558
  n.filter(({ token: e }) => e?.text === "unique").length > 0 && e.length > 1 && t.push({
541
559
  code: "article_toc_out_of_order",
@@ -544,7 +562,7 @@ function yt(e) {
544
562
  let r;
545
563
  for (let { heading: e, token: i } of n) if (!(i === void 0 || i.text === "unique")) {
546
564
  if (r !== void 0) {
547
- let n = _t(r, i);
565
+ let n = bt(r, i);
548
566
  n === 0 ? t.push({
549
567
  code: "article_toc_duplicate_number",
550
568
  message: `Article ${e.num ?? e.label} is repeated`,
@@ -573,172 +591,265 @@ function yt(e) {
573
591
  }
574
592
  return t;
575
593
  }
576
- function bt(e) {
577
- let t = yt(e);
594
+ function Ct(e) {
595
+ let t = St(e);
578
596
  t.length > 0 && process.env.TISSEUSE_WARN_ASSEMBLEE_HEADING_SEQUENCE === "1" && console.warn("Incoherent Assemblée article heading sequence", { issues: t.map((e) => e.message) });
579
597
  }
580
- function xt(e, { warn: t = !0 } = {}) {
581
- let n = pt(e), r = ht(e);
582
- if (n.length === 0) return t && bt(r), r;
583
- let i = dt(e), a = (e, t) => {
584
- let n = new Set(e.map((e) => e.container)), r = new Set(e.map((e) => L(e.num ?? e.label)));
598
+ function wt(e, { warn: t = !0 } = {}) {
599
+ let n = gt(e), r = vt(e);
600
+ if (n.length === 0) return t && Ct(r), r;
601
+ let i = mt(e), a = (e, t) => {
602
+ let n = new Set(e.map((e) => e.container)), r = new Set(e.map((e) => I(e.num ?? e.label)));
585
603
  for (let i of t) {
586
- let t = L(i.num ?? i.label);
604
+ let t = I(i.num ?? i.label);
587
605
  n.has(i.container) || r.has(t) || (n.add(i.container), r.add(t), e.push(i));
588
606
  }
589
- return e.sort((e, t) => z(i, e.container) - z(i, t.container)), e;
590
- }, o = r.filter((t) => e(t.element).is("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6")), s = a([...n], o), c = a([...s], r.filter((e) => !o.includes(e))), l = s.length >= 2 && yt(c).length > yt(s).length ? s : c;
591
- return t && bt(l), l;
607
+ return e.sort((e, t) => R(i, e.container) - R(i, t.container)), e;
608
+ }, o = r.filter((t) => e(t.element).is("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6")), s = a([...n], o), c = a([...s], r.filter((e) => !o.includes(e))), l = s.length >= 2 && St(c).length > St(s).length ? s : c;
609
+ return t && Ct(l), l;
592
610
  }
593
- function St(e) {
611
+ function Tt(e) {
594
612
  let t = e.next;
595
613
  for (; t !== null;) {
596
- if (R(t)) return t;
614
+ if (L(t)) return t;
597
615
  t = t.next;
598
616
  }
599
617
  return null;
600
618
  }
601
- function Ct(e, t, n) {
619
+ function Et(e, t, n) {
602
620
  let r = e(t.container);
603
621
  if (!r.is("p.assnat9ArticleNum")) return;
604
622
  let i = r.parent(), a = i.parent();
605
623
  if (!i.is("div") || i.children().length !== 1 || !a.is("div")) return;
606
- let o = a.children().get();
607
- if (o.length !== 3 && o.length !== 4 || o[0] !== i.get(0) || o[1]?.tagName !== "span" || F(e(o[1]).text()) !== "") return;
608
- let s = o.length === 4 ? o[2] : void 0;
609
- if (s !== void 0 && (s.tagName !== "p" || !e(s).hasClass("assnat9ArticleNum") || !/^\(non modifié\)$/iu.test(F(e(s).text())))) return;
610
- let c = o.at(-1);
611
- if (!(c.tagName !== "div" || n !== void 0 && e.contains(c, n.container) || e(c).find("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6").toArray().some((t) => m(e(t).text()) !== null))) return [
624
+ let s = a.children().get();
625
+ if (s.length !== 3 && s.length !== 4 || s[0] !== i.get(0) || s[1]?.tagName !== "span" || P(e(s[1]).text()) !== "") return;
626
+ let c = s.length === 4 ? s[2] : void 0;
627
+ if (c !== void 0 && (c.tagName !== "p" || !e(c).hasClass("assnat9ArticleNum") || !/^\(non modifié\)$/iu.test(P(e(c).text())))) return;
628
+ let l = s.at(-1);
629
+ if (!(l.tagName !== "div" || n !== void 0 && e.contains(l, n.container) || e(l).find("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6").toArray().some((t) => o(e(t).text()) !== null))) return [
612
630
  t.container,
613
- ...s === void 0 ? [] : [s],
614
- c
631
+ ...c === void 0 ? [] : [c],
632
+ l
615
633
  ];
616
634
  }
617
- function wt(e, t, n, r = dt(e)) {
635
+ function Dt(e, t, n, r = mt(e)) {
618
636
  let i = [t.container], a = n?.container;
619
- for (let e = St(t.container); e !== null && e !== a; e = St(e)) i.push(e);
637
+ for (let e = Tt(t.container); e !== null && e !== a; e = Tt(e)) i.push(e);
620
638
  if (i.length > 1) return i;
621
- let o = Ct(e, t, n);
639
+ let o = Et(e, t, n);
622
640
  if (o !== void 0) return o;
623
- let s = z(r, t.container), c = a ? z(r, a) : -1;
641
+ let s = R(r, t.container), c = a ? R(r, a) : -1;
624
642
  return e("body > *").get().filter((e) => {
625
- let t = z(r, e);
643
+ let t = R(r, e);
626
644
  return t >= s && (c === -1 || t < c);
627
645
  });
628
646
  }
629
- function Tt(e, t) {
647
+ function Ot(e, t) {
630
648
  let n = [], r = /* @__PURE__ */ new Set();
631
649
  for (let i of t) {
632
650
  let t = "p,li,table", a = e(i).is(t) ? [i] : e(i).find(t).get();
633
- for (let t of a) e(t).is("table.akn-pastille-table,p.pastille") || ot(e, t) || e(t).is("p,li") && e(t).closest("table.akn-quoted-table").length > 0 || r.has(t) || (r.add(t), n.push(t));
651
+ for (let t of a) e(t).is("table.akn-pastille-table,p.pastille") || lt(e, t) || e(t).is("p,li") && e(t).closest("table.akn-quoted-table").length > 0 || r.has(t) || (r.add(t), n.push(t));
634
652
  }
635
653
  return n;
636
654
  }
637
- function Et(e, t, n, r) {
655
+ function kt(e, t, n, r) {
638
656
  let i = [], a = !1;
639
- for (let o of Tt(e, n)) {
640
- let n = e(o).is("table.akn-quoted-table") ? xn(e, o) : F(e(o).text());
657
+ for (let o of Ot(e, n)) {
658
+ let n = e(o).is("table.akn-quoted-table") ? kn(e, o) : P(e(o).text());
641
659
  if (o === r?.splitAtBreak?.element && (n = r.splitAtBreak.text), !n) continue;
642
- Le.test(n) && (a = !0);
643
- let s = a ? "noise" : at(n), c = `${t}-b${i.length + 1}`;
660
+ ze.test(n) && (a = !0);
661
+ let s = a ? "noise" : ct(n), c = `${t}-b${i.length + 1}`;
644
662
  e(o).attr("data-pjl-parsed-article-id", t), e(o).attr("data-pjl-parsed-block-id", c), i.push({
645
663
  id: c,
646
664
  articleId: t,
647
665
  kind: s,
648
- links: tt(e, o),
666
+ links: rt(e, o),
649
667
  text: n,
650
- html: et(e, o)
668
+ html: nt(e, o)
651
669
  });
652
670
  }
653
671
  return i;
654
672
  }
655
- function Dt(e, t) {
673
+ function At(e, t, n, r) {
674
+ if (n.startIndex === null || n.startIndex >= r) return "";
675
+ if (n.type === "text") return n.endIndex !== null && n.endIndex < r ? n.data : b(t.slice(n.startIndex, r), {}, !1).text();
676
+ if (!L(n)) return "";
677
+ let i = "";
678
+ for (let a of e(n).contents().get()) {
679
+ if (a.startIndex !== null && a.startIndex >= r) break;
680
+ i += At(e, t, a, r);
681
+ }
682
+ return i;
683
+ }
684
+ function jt(e, t, n, r) {
685
+ if (n === void 0 || n.length === 0) return;
686
+ let i = b(e, { xml: {
687
+ xmlMode: !1,
688
+ withStartIndices: !0,
689
+ withEndIndices: !0
690
+ } }), a = /* @__PURE__ */ new Map();
691
+ if (r === "akoma-ntoso") i("article.akn-article").each((e, t) => {
692
+ if (t.startIndex === null || t.endIndex === null) return;
693
+ let n = i(t).attr("id") ?? `akn-article-${String(e + 1).padStart(3, "0")}`;
694
+ a.set(n, {
695
+ start: t.startIndex,
696
+ stop: t.endIndex + 1
697
+ });
698
+ });
699
+ else {
700
+ let t = wt(i, { warn: !1 });
701
+ for (let [n, r] of t.entries()) {
702
+ let i = r.container.startIndex;
703
+ i !== null && a.set(r.id, {
704
+ start: i,
705
+ stop: t[n + 1]?.container.startIndex ?? e.length
706
+ });
707
+ }
708
+ }
709
+ let o = t.flatMap((e) => e.blocks), s = 0, c = [], l = /* @__PURE__ */ new Map();
710
+ for (let [e, t] of o.entries()) {
711
+ let n = l.get(t.text) ?? [];
712
+ n.push(e), l.set(t.text, n);
713
+ }
714
+ for (let e of Ot(i, (i("body").length > 0 ? i("body").children().get() : i.root().children().get()).filter(L))) {
715
+ if (e.startIndex === null || e.endIndex === null) continue;
716
+ let t = P(i(e).text());
717
+ if (!t) continue;
718
+ let n = l.get(t)?.find((t) => {
719
+ if (t < s) return !1;
720
+ let n = a.get(o[t].articleId);
721
+ return n !== void 0 && e.startIndex >= n.start && e.endIndex < n.stop;
722
+ });
723
+ if (n === void 0) continue;
724
+ let r = o[n];
725
+ c.push({
726
+ start: e.startIndex,
727
+ stop: e.endIndex + 1,
728
+ block: r,
729
+ element: e
730
+ }), s = n + 1;
731
+ }
732
+ for (let t of n) {
733
+ let { sourceStart: n, sourceStop: r } = t.occurrence, a = 0, o = c.length;
734
+ for (; a < o;) {
735
+ let e = a + o >>> 1;
736
+ c[e].start <= n ? a = e + 1 : o = e;
737
+ }
738
+ let s;
739
+ for (let e = a - 1; e >= 0; e--) {
740
+ let t = c[e];
741
+ if (r <= t.stop) {
742
+ s = t;
743
+ break;
744
+ }
745
+ }
746
+ if (s !== void 0) {
747
+ t.occurrence.blockId = s.block.id;
748
+ let r = At(i, e, s.element, n);
749
+ at(i(s.element).text(), r.length) && (t.occurrence.insideFrenchQuotes = !0), (s.block.linkDecisions ??= []).push(t);
750
+ }
751
+ }
752
+ }
753
+ function Mt(e, t) {
656
754
  if (t.length === 0) return e;
657
755
  let n = `<div style="display: none;">\n${t.map((e) => `<p class="assnatTOC6"><a href="#${e.id}"><span class="assnatHyperlink" style="font-weight:bold; text-decoration:none; color:#000000">${e.label.toUpperCase()}</span></a></p>`).join("\n")}\n</div>`;
658
756
  return e.includes("class=\"assnatSection3\"") ? e.replace(/(<div class="assnatSection3">)/u, `${n}$1`) : e.includes("id=\"formCorrection:panel:1:table\"") ? e.replace(/(<div id="formCorrection:panel:1:table">)/u, `${n}$1`) : `${n}\n${e}`;
659
757
  }
660
- function Ot(e) {
661
- let t = w(e), n = kt(t);
662
- for (let e of xt(t, { warn: !1 })) {
663
- let r = L(e.num ?? e.label.replace(/^Article\s+/iu, "")), i = t(e.element), a = i.attr("id");
758
+ function Nt(e) {
759
+ let t = b(e), n = Pt(t);
760
+ for (let e of wt(t, { warn: !1 })) {
761
+ let r = I(e.num ?? e.label.replace(/^Article\s+/iu, "")), i = t(e.element), a = i.attr("id");
664
762
  if (a !== r) {
665
- if (a?.startsWith("_Toc") && !Mt(n, a, e.element)) {
763
+ if (a?.startsWith("_Toc") && !Lt(n, a, e.element)) {
666
764
  let e = t("<span></span>").attr("id", a);
667
765
  i.before(e);
668
766
  let r = e.get(0);
669
- R(r) && At(n, a, r);
767
+ L(r) && Ft(n, a, r);
670
768
  }
671
- a && jt(n, a, e.element), i.attr("id", r), At(n, r, e.element);
769
+ a && It(n, a, e.element), i.attr("id", r), Ft(n, r, e.element);
672
770
  }
673
771
  }
674
- let r = xt(t), i = dt(t);
772
+ let r = wt(t), i = mt(t);
675
773
  for (let [e, a] of r.entries()) {
676
- let o = wt(t, a, r[e + 1], i).flatMap((e) => t(e).is("span.alinea[data-alinea]") ? [e] : t(e).find("span.alinea[data-alinea]").get());
774
+ let o = Dt(t, a, r[e + 1], i).flatMap((e) => t(e).is("span.alinea[data-alinea]") ? [e] : t(e).find("span.alinea[data-alinea]").get());
677
775
  for (let e of o) {
678
776
  let r = t(e).attr("data-alinea")?.trim();
679
777
  if (!r) continue;
680
778
  let i = `${a.id}-alinea-${r.replace(/\s+/gu, "")}`;
681
- if (Mt(n, i, e)) continue;
779
+ if (Lt(n, i, e)) continue;
682
780
  let o = t(e).attr("id");
683
781
  if (o && o !== i) {
684
782
  let r = t("<span></span>").attr("id", i);
685
783
  t(e).before(r);
686
784
  let a = r.get(0);
687
- R(a) && At(n, i, a);
688
- } else o && jt(n, o, e), t(e).attr("id", i), At(n, i, e);
785
+ L(a) && Ft(n, i, a);
786
+ } else o && It(n, o, e), t(e).attr("id", i), Ft(n, i, e);
689
787
  }
690
788
  }
691
789
  return t.html();
692
790
  }
693
- function kt(e) {
791
+ function Pt(e) {
694
792
  let t = /* @__PURE__ */ new Map();
695
793
  for (let n of e("[id]").get()) {
696
794
  let r = e(n).attr("id");
697
- r && At(t, r, n);
795
+ r && Ft(t, r, n);
698
796
  }
699
797
  return t;
700
798
  }
701
- function At(e, t, n) {
799
+ function Ft(e, t, n) {
702
800
  let r = e.get(t);
703
801
  r === void 0 && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
704
802
  }
705
- function jt(e, t, n) {
803
+ function It(e, t, n) {
706
804
  let r = e.get(t);
707
805
  r !== void 0 && (r.delete(n), r.size === 0 && e.delete(t));
708
806
  }
709
- function Mt(e, t, n) {
807
+ function Lt(e, t, n) {
710
808
  for (let r of e.get(t) ?? []) if (r !== n) return !0;
711
809
  return !1;
712
810
  }
713
- function Nt(e, t) {
714
- let n = $e("sourceText" in t ? t.sourceText : "");
811
+ function Rt(e, t) {
812
+ let n = tt("sourceText" in t ? t.sourceText : "");
715
813
  if (n) return e.filter((e) => e.kind === "directive_candidate").find((e) => {
716
- let t = $e(e.text);
814
+ let t = tt(e.text);
717
815
  return t.length > 0 && (n.includes(t) || t.includes(n));
718
816
  });
719
817
  }
720
- function Pt(e, t) {
818
+ function zt(e, t) {
721
819
  if (t) return t.blockIds.map((t) => e.get(t)).find((e) => e?.kind === "directive_candidate");
722
820
  }
723
- function Ft(e) {
724
- return e?.links.filter((t) => !t.insideFrenchQuotes && (t.type === "article" || t.type === "division") && t.id !== e.qualifiedVersion?.modifyingArticleId).map((e) => e.id) ?? [];
821
+ function Bt(e) {
822
+ return e?.linkDecisions?.some((e) => e.kind === "article" && !e.occurrence.insideFrenchQuotes) ?? !1;
823
+ }
824
+ function Vt(e) {
825
+ return e?.links.some((e) => e.type === "article") === !0 && e.linkDecisions?.some((e) => e.kind === "text" && !e.occurrence.insideFrenchQuotes) === !0 && !Bt(e);
725
826
  }
726
- function It(e) {
827
+ function Ht(e) {
828
+ if (e?.linkDecisions !== void 0 && (Bt(e) || Vt(e))) {
829
+ let t = e.linkDecisions.flatMap((e) => e.projection.mode === "etablie" && e.kind === "article" && !e.occurrence.insideFrenchQuotes ? e.projection.targetIds : []);
830
+ return [...new Set([...t.filter((t) => t !== e.qualifiedVersion?.modifyingArticleId), ...e.links.filter((e) => e.type === "division" && !e.insideFrenchQuotes).map((e) => e.id)])];
831
+ }
832
+ return e?.links.filter((t) => !t.insideFrenchQuotes && !t.consultationOnly && (t.type === "article" || t.type === "division") && t.id !== e.qualifiedVersion?.modifyingArticleId).map((e) => e.id) ?? [];
833
+ }
834
+ function Ut(e) {
835
+ return e?.links.some((e) => e.type === "article" && e.consultationOnly && !e.insideFrenchQuotes) ?? !1;
836
+ }
837
+ function Wt(e) {
727
838
  if (e.kind === "noise") return !1;
728
- let t = I(e.text.split("«", 1)[0]).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-"), n = /^(?:(?:\d+°|[ivxlcdm]+[.)]|[a-z][.)])\s*)?(?:est|sont)\s+(?:ainsi\s+)?(?:abroge|modifie|complete|supprime|remplace|retabli)\w*\b/u.test(t) ? t : t.split(/\b(?:est|sont|il|elle|ils|elles)\b/iu, 1)[0];
839
+ let t = F(e.text.split("«", 1)[0]).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-"), n = /^(?:(?:\d+°|[ivxlcdm]+[.)]|[a-z][.)])\s*)?(?:est|sont)\s+(?:ainsi\s+)?(?:abroge|modifie|complete|supprime|remplace|retabli)\w*\b/u.test(t) ? t : t.split(/\b(?:est|sont|il|elle|ils|elles)\b/iu, 1)[0];
729
840
  return /(?:\b(?:articles?|livres?|titres?|sous[- ]?titres?|chapitres?|sections?|sous[- ]?sections?|parties?|paragraphes?|sous[- ]?paragraphes?|annexes?|etats?)\s+(?:[lrda]\s*\.?\s*-?\s*\d|\d|[ivxlcdm]+(?:er|re)?(?=\s|$|[.,;:])|(?:premier|premiere|deuxieme|troisieme|quatrieme|cinquieme|sixieme|septieme|huitieme|neuvieme|dixieme)\b)|\b(?:premier|premiere|deuxieme|troisieme|quatrieme|cinquieme|sixieme|septieme|huitieme|neuvieme|dixieme)\s+(?:article|livre|titre|chapitre|section|sous[- ]?section|partie|paragraphe)\b|\b(?:annexes?|etats?)\s+[a-z](?:\s|$))/iu.test(n);
730
841
  }
731
- function Lt(e, t) {
732
- if (!t || t.articleId !== e.articleId || !/\br[ée]sultent\s+du\s+\d+°/iu.test(e.text)) return;
733
- let n = (e) => I(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-"), r = n(e.text).replace(/«[^»]*»/gu, "");
734
- if (/[«»]/u.test(r)) return;
735
- let i = /\btels? qu['’]ils resultent du (\d+)°/u.exec(r);
736
- if (!i || he(new j(r)).some((e) => [...a(e)].some((e) => e.type === "texte" && e.relative === void 0))) return;
737
- let o = n(t.text);
738
- if (/^\s*(\d+)°/u.exec(I(t.text))?.[1] !== i[1]) return;
842
+ function Gt(e, n) {
843
+ if (!n || n.articleId !== e.articleId || !/\br[ée]sultent\s+du\s+\d+°/iu.test(e.text)) return;
844
+ let r = (e) => F(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-"), i = r(e.text).replace(/«[^»]*»/gu, "");
845
+ if (/[«»]/u.test(i)) return;
846
+ let a = /\btels? qu['’]ils resultent du (\d+)°/u.exec(i);
847
+ if (!a || t(new D(i)).some((e) => [...u(e)].some((e) => e.type === "texte" && e.relative === void 0))) return;
848
+ let o = r(n.text);
849
+ if (/^\s*(\d+)°/u.exec(F(n.text))?.[1] !== a[1]) return;
739
850
  let s = /\bles articles (.+?) deviennent respectivement les articles ([^;]+);?\s*$/u.exec(o);
740
851
  if (!s) return;
741
- let c = (e) => u(e.trim().replace(/^[lrda](?=[.\s\d])/u, (e) => e.toUpperCase())), l = (e) => {
852
+ let c = (e) => m(e.trim().replace(/^[lrda](?=[.\s\d])/u, (e) => e.toUpperCase())), l = (e) => {
742
853
  let t = e.trim().split(/,\s*|\s+et\s+/u);
743
854
  if (t.length === 0 || t.length > 64) return;
744
855
  let n = t.map(c);
@@ -747,22 +858,22 @@ function Lt(e, t) {
747
858
  return new Set(r).size === r.length ? r : void 0;
748
859
  }, d = l(s[1]), f = l(s[2].replace(/;\s*$/u, ""));
749
860
  if (!d || !f || d.length !== f.length) return;
750
- let p = /* @__PURE__ */ new Map();
861
+ let p = n.linkDecisions === void 0 ? void 0 : new Set(n.linkDecisions.flatMap((e) => e.kind === "article" && !e.occurrence.insideFrenchQuotes && e.projection.mode === "etablie" ? e.projection.targetIds : [])), h = /* @__PURE__ */ new Map();
751
862
  for (let e = 0; e < d.length; e++) {
752
- let r = t.links.filter((t) => t.type === "article" && !t.insideFrenchQuotes && c(n(t.text ?? "")) === d[e]), i = [...new Set(r.map((e) => e.id))];
863
+ let t = n.links.filter((t) => t.type === "article" && !t.consultationOnly && !t.insideFrenchQuotes && (p === void 0 || p.has(t.id)) && c(r(t.text ?? "")) === d[e]), i = [...new Set(t.map((e) => e.id))];
753
864
  if (i.length !== 1 || !i[0]) return;
754
- p.set(f[e], i[0]);
865
+ h.set(f[e], i[0]);
755
866
  }
756
- let m = [];
757
- for (let e of r.matchAll(/\baux articles (.+?)(?=,?\s+tels? qu|,\s*la reference|;|$)/gu)) {
867
+ let g = [];
868
+ for (let e of i.matchAll(/\baux articles (.+?)(?=,?\s+tels? qu|,\s*la reference|;|$)/gu)) {
758
869
  let t = l(e[1]);
759
870
  if (!t) return;
760
- m.push(...t);
871
+ g.push(...t);
761
872
  }
762
- if (!(m.length === 0 || m.some((e) => !p.has(e)))) return [...new Set(m.map((e) => p.get(e)))];
873
+ if (!(g.length === 0 || g.some((e) => !h.has(e)))) return [...new Set(g.map((e) => h.get(e)))];
763
874
  }
764
- function Rt(e) {
765
- let t = o(e.text);
875
+ function Kt(e) {
876
+ let t = se(e.text);
766
877
  if (t.length !== 1) return;
767
878
  let n = e.links.filter((e) => e.type === "article" && !e.insideFrenchQuotes), r = n.filter((n) => {
768
879
  let r = n.text ?? "", i = e.text.indexOf(r);
@@ -776,21 +887,21 @@ function Rt(e) {
776
887
  modifyingArticleLabel: i.text ?? ""
777
888
  };
778
889
  }
779
- function zt(e, t) {
780
- let n = F(e);
890
+ function qt(e, t) {
891
+ let n = P(e);
781
892
  if (!n) return;
782
- let r = ce(n);
893
+ let r = re(n);
783
894
  return r ? r.level : n.endsWith(":") ? (t ?? -1) + 1 : void 0;
784
895
  }
785
- function Bt(e) {
786
- let t = /* @__PURE__ */ new Map(), n = [], r = S(e.map((e) => e.text)), i = -1;
896
+ function Jt(e) {
897
+ let t = /* @__PURE__ */ new Map(), n = [], r = _(e.map((e) => e.text)), i = -1;
787
898
  for (let [a, o] of e.entries()) {
788
899
  let e = r.get(a);
789
900
  if (e && (i = e.endIndex), a <= i) {
790
901
  t.set(o.id, [...n.map((e) => e.block), o]);
791
902
  continue;
792
903
  }
793
- let s = zt(o.text, n.at(-1)?.level);
904
+ let s = qt(o.text, n.at(-1)?.level);
794
905
  if (s === void 0) {
795
906
  t.set(o.id, [...n.map((e) => e.block), o]);
796
907
  continue;
@@ -803,14 +914,14 @@ function Bt(e) {
803
914
  }
804
915
  return t;
805
916
  }
806
- function Vt(e, t) {
917
+ function Yt(e, t) {
807
918
  let n = [], r = /* @__PURE__ */ new Set();
808
919
  for (let i of [...e ?? [], ...t]) i !== void 0 && (r.has(i.id) || (r.add(i.id), n.push(i)));
809
920
  return n;
810
921
  }
811
- function Ht(e, t, n) {
922
+ function Xt(e, t, n) {
812
923
  if (!t) return;
813
- let r = Vt(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
924
+ let r = Yt(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
814
925
  if (r.length === 0) return;
815
926
  let i = r.map((e) => e.id);
816
927
  if (i.length === t.blockIds.length && i.every((e, n) => e === t.blockIds[n])) return;
@@ -825,7 +936,7 @@ function Ht(e, t, n) {
825
936
  }
826
937
  };
827
938
  }
828
- function Ut(e) {
939
+ function Zt(e) {
829
940
  let t = [], n = 0;
830
941
  for (let r of e.blocks) {
831
942
  let i = e.directiveText.indexOf(r.text, n);
@@ -839,7 +950,7 @@ function Ut(e) {
839
950
  }
840
951
  return t;
841
952
  }
842
- function Wt(e, t, n) {
953
+ function Qt(e, t, n) {
843
954
  let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop > r && e.start < i);
844
955
  if (a.length === 0) return;
845
956
  let o = a[0], s = a[a.length - 1], c = o.start, l = s.stop;
@@ -853,7 +964,7 @@ function Wt(e, t, n) {
853
964
  }
854
965
  };
855
966
  }
856
- function Gt(e, t, n) {
967
+ function $t(e, t, n) {
857
968
  if (!t) return;
858
969
  let r = e.directiveText.indexOf(t.text);
859
970
  if (r === -1) return;
@@ -866,11 +977,11 @@ function Gt(e, t, n) {
866
977
  stop: a
867
978
  };
868
979
  }
869
- function Kt(e, t, n) {
980
+ function en(e, t, n) {
870
981
  for (let r of [...t.get(e.id) ?? [e]].reverse()) {
871
982
  let e = n.get(r.id);
872
983
  if (!n.has(r.id)) {
873
- let t = r.links.filter((e) => e.type === "text" && !e.insideFrenchQuotes), i = t.length > 0 ? le(r.text) : [], a = [], o = !1;
984
+ let t = r.links.filter((e) => e.type === "text" && !e.insideFrenchQuotes), i = t.length > 0 ? l(r.text) : [], a = [], o = !1;
874
985
  for (let e of t) {
875
986
  let t = e.text, n = t ? r.text.indexOf(t) : -1;
876
987
  if (n < 0 || r.text.indexOf(t, n + 1) !== -1) {
@@ -885,10 +996,10 @@ function Kt(e, t, n) {
885
996
  if (e.length === 1) return e[0];
886
997
  }
887
998
  }
888
- function B(e, t) {
889
- return `${e}\0${Be(t)}`;
999
+ function z(e, t) {
1000
+ return `${e}\0${He(t)}`;
890
1001
  }
891
- function qt(e) {
1002
+ function tn(e) {
892
1003
  let t = new Map(e.map((e) => [e.id, e])), n = /* @__PURE__ */ new Map();
893
1004
  return (e, r) => {
894
1005
  if (r === void 0) return;
@@ -898,57 +1009,57 @@ function qt(e) {
898
1009
  if (r === void 0) return;
899
1010
  i = {
900
1011
  blockById: new Map(r.blocks.map((e) => [e.id, e])),
901
- contextByBlockId: Bt(r.blocks),
1012
+ contextByBlockId: Jt(r.blocks),
902
1013
  textIdsByBlockId: /* @__PURE__ */ new Map()
903
1014
  }, n.set(e, i);
904
1015
  }
905
1016
  let a = i.blockById.get(r);
906
- return a === void 0 ? void 0 : Kt(a, i.contextByBlockId, i.textIdsByBlockId);
1017
+ return a === void 0 ? void 0 : en(a, i.contextByBlockId, i.textIdsByBlockId);
907
1018
  };
908
1019
  }
909
- function Jt(e, t, n, r, i) {
1020
+ function nn(e, n, r, i, a) {
910
1021
  let o = /* @__PURE__ */ new Map(), s = new Set(e.blocks.flatMap((e) => {
911
1022
  if (!e.text.includes("Art.")) return [];
912
- let t = Kt(e, i, o);
913
- return t === void 0 ? [] : f(Se(e.text).output).map(({ num: e }) => B(t, e));
1023
+ let t = en(e, a, o);
1024
+ return t === void 0 ? [] : te(ke(e.text).output).map(({ num: e }) => z(t, e));
914
1025
  }));
915
1026
  if (s.size === 0) return /* @__PURE__ */ new Map();
916
- let c = new Set([...s].map((e) => e.slice(e.indexOf("\0") + 1))), l = t.flatMap((t) => {
917
- if (Ke(t.reference)) return [];
918
- let s = new Set([...a(t.reference)].filter((e) => e.type === "article" && e.num).map((e) => e.num));
919
- if (![...s].some((e) => c.has(Be(e)))) return [];
920
- let l = Pt(n, Wt(e, r, t)) ?? Nt(e.blocks, t);
921
- if (!l) return [];
922
- let u = Kt(l, i, o);
923
- return u === void 0 ? [] : [{
924
- block: l,
1027
+ let c = new Set([...s].map((e) => e.slice(e.indexOf("\0") + 1))), l = n.flatMap((t) => {
1028
+ if (Je(t.reference)) return [];
1029
+ let n = new Set([...u(t.reference)].filter((e) => e.type === "article" && e.num).map((e) => e.num));
1030
+ if (![...n].some((e) => c.has(He(e)))) return [];
1031
+ let s = zt(r, Qt(e, i, t)) ?? Rt(e.blocks, t);
1032
+ if (!s) return [];
1033
+ let l = en(s, a, o);
1034
+ return l === void 0 ? [] : [{
1035
+ block: s,
925
1036
  directive: t,
926
- nums: s,
927
- textId: u
1037
+ nums: n,
1038
+ textId: l
928
1039
  }];
929
1040
  });
930
1041
  if (l.length === 0) return /* @__PURE__ */ new Map();
931
- let u = new Set(l.flatMap(({ nums: e, textId: t }) => [...e].map((e) => B(t, e))));
932
- if (![...u].some((e) => s.has(e))) return /* @__PURE__ */ new Map();
933
- let d = new Set(t.flatMap((t) => {
934
- let a = We(t);
935
- if (a.length === 0) return [];
936
- let s = Pt(n, Wt(e, r, t)) ?? Nt(e.blocks, t);
1042
+ let d = new Set(l.flatMap(({ nums: e, textId: t }) => [...e].map((e) => z(t, e))));
1043
+ if (![...d].some((e) => s.has(e))) return /* @__PURE__ */ new Map();
1044
+ let f = new Set(n.flatMap((t) => {
1045
+ let n = Ke(t);
1046
+ if (n.length === 0) return [];
1047
+ let s = zt(r, Qt(e, i, t)) ?? Rt(e.blocks, t);
937
1048
  if (!s) return [];
938
- let c = Kt(s, i, o);
939
- return c === void 0 ? [] : a.map(({ num: e }) => B(c, e)).filter((e) => u.has(e));
1049
+ let c = en(s, a, o);
1050
+ return c === void 0 ? [] : n.map(({ num: e }) => z(c, e)).filter((e) => d.has(e));
940
1051
  })), p = /* @__PURE__ */ new Map();
941
- for (let { block: e, directive: t, nums: n, textId: r } of l) {
942
- if (![...n].some((e) => s.has(B(r, e)))) continue;
943
- let i = new Set(he(new j(Se(t.sourceText).output)).flatMap((e) => [...a(e)].filter((e) => e.type === "article" && e.num).map((e) => e.num))), o = [...n].filter((e) => s.has(B(r, e)) && !d.has(B(r, e)) && [...i].some((t) => Be(t) === Be(e)));
1052
+ for (let { block: e, directive: n, nums: r, textId: i } of l) {
1053
+ if (![...r].some((e) => s.has(z(i, e)))) continue;
1054
+ let a = new Set(t(new D(ke(n.sourceText).output)).flatMap((e) => [...u(e)].filter((e) => e.type === "article" && e.num).map((e) => e.num))), o = [...r].filter((e) => s.has(z(i, e)) && !f.has(z(i, e)) && [...a].some((t) => He(t) === He(e)));
944
1055
  o.length > 0 && p.set(e.id, [...new Set([...p.get(e.id) ?? [], ...o])]);
945
1056
  }
946
1057
  return p;
947
1058
  }
948
- function Yt(e, t) {
949
- let n = performance.now(), r = performance.now(), i = Ut(e), a = performance.now() - r, o = performance.now(), s = new Map(e.blocks.map((e) => [e.id, e])), c = Bt(e.blocks);
950
- for (let t of e.blocks) t.qualifiedVersion = Rt(t);
951
- let l = performance.now() - o, u = performance.now(), d = ee(), f = e.blocks[0], p = e.title !== void 0 && f?.text.startsWith(`${e.label}\n`) && (e.directiveText === f.text || e.directiveText.startsWith(`${f.text}\n`)), m = p && e.text.startsWith(`${e.label} ${e.title}`) ? " " : "", h = b(p ? `${e.label}${m}${e.title}${e.directiveText.slice(f.text.length)}` : e.directiveText, t === void 0 ? void 0 : d);
1059
+ function rn(e, t) {
1060
+ let n = performance.now(), r = performance.now(), i = Zt(e), a = performance.now() - r, o = performance.now(), s = new Map(e.blocks.map((e) => [e.id, e])), c = Jt(e.blocks);
1061
+ for (let t of e.blocks) t.qualifiedVersion = Kt(t);
1062
+ let l = performance.now() - o, u = performance.now(), d = pe(), f = e.blocks[0], p = e.title !== void 0 && f?.text.startsWith(`${e.label}\n`) && (e.directiveText === f.text || e.directiveText.startsWith(`${f.text}\n`)), m = p && e.text.startsWith(`${e.label} ${e.title}`) ? " " : "", h = he(p ? `${e.label}${m}${e.title}${e.directiveText.slice(f.text.length)}` : e.directiveText, t === void 0 ? void 0 : d);
952
1063
  if (p && !m) {
953
1064
  let t = e.label.length;
954
1065
  h = h.map((e) => ({
@@ -959,46 +1070,48 @@ function Yt(e, t) {
959
1070
  }
960
1071
  }));
961
1072
  }
962
- let g = performance.now() - u, _ = performance.now(), v = Jt(e, h, s, i, c), y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), S = [], C, w;
1073
+ let g = performance.now() - u, _ = performance.now(), v = nn(e, h, s, i, c), y = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), S = [], C = [], ee, te;
963
1074
  for (let t of e.blocks) {
964
- let e = Ft(t), n = e.length === 0 ? Lt(t, w) : void 0;
965
- (e.length > 0 || n !== void 0 || t.qualifiedVersion || v.has(t.id) || It(t)) && (S = v.has(t.id) ? [] : n ?? e, C = t.qualifiedVersion), y.set(t.id, S), x.set(t.id, C), w = t;
1075
+ let e = Ht(t), n = [...new Set(t.linkDecisions?.flatMap((e) => e.projection.mode === "indicative" && e.kind === "article" && !e.occurrence.insideFrenchQuotes ? e.projection.candidateIds : []) ?? [])], r = e.length === 0 && !Bt(t) && !Ut(t) && !Vt(t) ? Gt(t, te) : void 0;
1076
+ (e.length > 0 || r !== void 0 || t.qualifiedVersion || Bt(t) || Ut(t) || Vt(t) || v.has(t.id) || Wt(t)) && (S = v.has(t.id) ? [] : r ?? e, ee = t.qualifiedVersion, C = v.has(t.id) ? [] : n), y.set(t.id, S), b.set(t.id, C), x.set(t.id, ee), te = t;
966
1077
  }
967
1078
  l += performance.now() - _;
968
- let te = performance.now(), ne = h.map((t) => {
969
- let n = Wt(e, i, t), r = Pt(s, n) ?? Nt(e.blocks, t), a = Ft(r), o = r?.id !== void 0 && v.has(r.id) ? [] : a.length > 0 ? a : r?.id === void 0 ? [] : y.get(r.id) ?? [], l = Gt(e, r, t), u = Ht(r?.id === void 0 ? void 0 : c.get(r.id), n, s);
1079
+ let ne = performance.now(), re = h.map((t) => {
1080
+ let n = Qt(e, i, t), r = zt(s, n) ?? Rt(e.blocks, t), a = [...new Set((n?.blockIds ?? (r?.id === void 0 ? [] : [r.id])).flatMap((e) => s.get(e)?.linkDecisions ?? []))], o = Ht(r), l = r?.id === void 0 || v.has(r.id) ? [] : b.get(r.id) ?? [], u = r?.id !== void 0 && v.has(r.id) ? [] : o.length > 0 ? o : r?.id === void 0 ? [] : y.get(r.id) ?? [], d = $t(e, r, t), f = Xt(r?.id === void 0 ? void 0 : c.get(r.id), n, s);
970
1081
  return {
971
1082
  articleId: e.id,
972
1083
  blockId: r?.id,
973
- ...l === void 0 ? {} : { sourceBlockPosition: l },
1084
+ ...d === void 0 ? {} : { sourceBlockPosition: d },
974
1085
  ...n === void 0 ? {} : {
975
1086
  sourceBlockIds: n.blockIds,
976
1087
  sourceBlockText: n.text,
977
1088
  sourceBlockHtml: n.html,
978
1089
  sourceBlockPosition: n.position
979
1090
  },
980
- ...u === void 0 ? {} : {
981
- sourceContextBlockIds: u.blockIds,
982
- sourceContextPosition: u.position
1091
+ ...f === void 0 ? {} : {
1092
+ sourceContextBlockIds: f.blockIds,
1093
+ sourceContextPosition: f.position
983
1094
  },
984
1095
  directive: t,
1096
+ ...a.length === 0 ? {} : { linkDecisions: a },
1097
+ ...l.length > 0 ? { indicativeTargetIds: l } : {},
985
1098
  ...r?.id !== void 0 && v.has(r.id) ? { internallyCreatedTargetNums: v.get(r.id) } : {},
986
- ...o.length > 0 || r?.id !== void 0 && v.has(r.id) ? { targetIds: o } : {},
1099
+ ...u.length > 0 || r?.id !== void 0 && v.has(r.id) ? { targetIds: u } : {},
987
1100
  ...r?.id !== void 0 && x.get(r.id) ? { qualifiedVersion: x.get(r.id) } : {}
988
1101
  };
989
- }), re = /* @__PURE__ */ new Set(), ie = /* @__PURE__ */ new Map(), ae = ne.flatMap((e) => {
1102
+ }), ie = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map(), ae = re.flatMap((e) => {
990
1103
  let t = e.blockId ? s.get(e.blockId) : void 0;
991
1104
  if (!t || e.internallyCreatedTargetNums?.length) return [e];
992
- if (re.has(t.id)) return [];
993
- let n = ie.get(t.id);
994
- if (n === void 0 && (n = Ie(t.text, Ft(t), e.directive), ie.set(t.id, n)), !n) {
995
- let n = e.directive, r = e.targetIds?.length === 1 && n.kind === "compound" ? Fe(t.text, n.operations.length) : null;
1105
+ if (ie.has(t.id)) return [];
1106
+ let n = w.get(t.id);
1107
+ if (n === void 0 && (n = Re(t.text, Ht(t), e.directive), w.set(t.id, n)), !n) {
1108
+ let n = e.directive, r = e.targetIds?.length === 1 && n.kind === "compound" ? Le(t.text, n.operations.length) : null;
996
1109
  return [r ? {
997
1110
  ...e,
998
1111
  sourceAnnotations: r
999
1112
  } : e];
1000
1113
  }
1001
- return re.add(t.id), [{
1114
+ return ie.add(t.id), [{
1002
1115
  ...e,
1003
1116
  effects: n.map((t) => ({
1004
1117
  ...t,
@@ -1009,7 +1122,7 @@ function Yt(e, t) {
1009
1122
  }
1010
1123
  }))
1011
1124
  }];
1012
- }), oe = performance.now() - te;
1125
+ }), oe = performance.now() - ne;
1013
1126
  return t?.push({
1014
1127
  actionDirectiveExtraction: d,
1015
1128
  articleId: e.id,
@@ -1023,15 +1136,15 @@ function Yt(e, t) {
1023
1136
  totalMs: Math.round((performance.now() - n) * 10) / 10
1024
1137
  }), ae;
1025
1138
  }
1026
- function Xt(e, t) {
1139
+ function an(e, t) {
1027
1140
  let n = /* @__PURE__ */ new Map(), r = [], i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
1028
1141
  for (let o of e) {
1029
- let e = We(o.directive);
1142
+ let e = Ke(o.directive);
1030
1143
  if (e.length === 0) continue;
1031
1144
  let s = t(o.articleId, o.blockId), c = e.map(({ num: e }) => {
1032
- let t = s === void 0 ? void 0 : `${o.articleId}\0${B(s, e)}`, n = t === void 0 ? void 0 : a.get(t);
1145
+ let t = s === void 0 ? void 0 : `${o.articleId}\0${z(s, e)}`, n = t === void 0 ? void 0 : a.get(t);
1033
1146
  if (n !== void 0) return n;
1034
- let r = `${o.articleId}:article:${Ve(e)}`, c = r;
1147
+ let r = `${o.articleId}:article:${Ue(e)}`, c = r;
1035
1148
  if (i.has(c)) {
1036
1149
  let e = s ?? o.blockId ?? "unknown";
1037
1150
  c = `${r}:text:${e}`;
@@ -1063,17 +1176,17 @@ function Xt(e, t) {
1063
1176
  definitions: r
1064
1177
  };
1065
1178
  }
1066
- function Zt(e, t, n, r) {
1179
+ function on(e, t, n, r) {
1067
1180
  if (t.length === 0) return e;
1068
1181
  let i = new Map(t.flatMap((e) => {
1069
1182
  let t = r(e.articleId, e.blockId);
1070
- return t === void 0 ? [] : [[B(t, e.num), e]];
1183
+ return t === void 0 ? [] : [[z(t, e.num), e]];
1071
1184
  }));
1072
1185
  return e.map((e) => {
1073
- let t = n.get(e), a = t?.[0], o = r(e.articleId, e.blockId), s = (o === void 0 ? [] : [...Ge(e.directive.reference)].map((e) => i.get(B(o, e))).filter((e) => e !== void 0 && e.definitionId !== a?.definitionId))[0], c = s === void 0 ? void 0 : {
1186
+ let t = n.get(e), a = t?.[0], o = r(e.articleId, e.blockId), s = (o === void 0 ? [] : [...qe(e.directive.reference)].map((e) => i.get(z(o, e))).filter((e) => e !== void 0 && e.definitionId !== a?.definitionId))[0], c = s === void 0 ? void 0 : {
1074
1187
  definitionId: s.definitionId,
1075
1188
  num: s.num
1076
- }, l = qe(e.directive), u = (e.targetIds?.length ?? 0) > 0;
1189
+ }, l = Ye(e.directive), u = (e.targetIds?.length ?? 0) > 0;
1077
1190
  return {
1078
1191
  ...e,
1079
1192
  ...a === void 0 ? {} : { createdArticle: a },
@@ -1086,7 +1199,7 @@ function Zt(e, t, n, r) {
1086
1199
  };
1087
1200
  });
1088
1201
  }
1089
- function Qt(e) {
1202
+ function sn(e) {
1090
1203
  switch (e.kind) {
1091
1204
  case "insert_after":
1092
1205
  case "insert_before": return [e.insertText];
@@ -1104,8 +1217,8 @@ function Qt(e) {
1104
1217
  default: return [];
1105
1218
  }
1106
1219
  }
1107
- function $t(e) {
1108
- return e.flatMap((e) => Qt(e.directive).filter((e) => /[«»]/u.test(e)).map((t) => ({
1220
+ function cn(e) {
1221
+ return e.flatMap((e) => sn(e.directive).filter((e) => /[«»]/u.test(e)).map((t) => ({
1109
1222
  code: "nested_french_quote_in_redaction",
1110
1223
  message: "Écart à la règle légistique détecté : une citation imbriquée dans une rédaction devrait utiliser des guillemets anglais et non des guillemets français.",
1111
1224
  details: {
@@ -1117,18 +1230,18 @@ function $t(e) {
1117
1230
  }
1118
1231
  })));
1119
1232
  }
1120
- function en(e) {
1121
- return Qt(e).map((t) => ({
1233
+ function ln(e) {
1234
+ return sn(e).map((t) => ({
1122
1235
  directiveKind: e.kind,
1123
1236
  text: t
1124
1237
  }));
1125
1238
  }
1126
- function tn(e) {
1239
+ function un(e) {
1127
1240
  let t = /* @__PURE__ */ new Set();
1128
1241
  for (let n of e.matchAll(/«[^«»\n]+»/gu)) t.add(n[0]);
1129
1242
  return Array.from(t);
1130
1243
  }
1131
- function nn(e, t) {
1244
+ function dn(e, t) {
1132
1245
  let n = new Map(e.blocks.map((e) => [e.id, e])), r = t.sourceBlockIds ?? e.blocks.map((e) => e.id), i = [], a = 0;
1133
1246
  for (let e of r) {
1134
1247
  let t = n.get(e);
@@ -1140,11 +1253,11 @@ function nn(e, t) {
1140
1253
  }
1141
1254
  return i;
1142
1255
  }
1143
- function rn(e, t, n) {
1256
+ function fn(e, t, n) {
1144
1257
  return e.find((e) => t >= e.start && n <= e.stop);
1145
1258
  }
1146
- function an(e, t, n) {
1147
- let r = tn(n), i = r.flatMap((t) => {
1259
+ function pn(e, t, n) {
1260
+ let r = un(n), i = r.flatMap((t) => {
1148
1261
  for (let n of e.blocks) {
1149
1262
  let e = n.text.indexOf(t);
1150
1263
  if (e !== -1) return [{
@@ -1163,7 +1276,7 @@ function an(e, t, n) {
1163
1276
  e.directiveText
1164
1277
  ].filter((e) => e !== void 0 && e.length > 0), o = a.find((e) => r.some((t) => e.includes(t))) ?? a[0];
1165
1278
  if (!o) return [];
1166
- let s = nn(e, t);
1279
+ let s = dn(e, t);
1167
1280
  if (s.length === 0) return [];
1168
1281
  let c = [], l = 0;
1169
1282
  for (let e of r) {
@@ -1171,7 +1284,7 @@ function an(e, t, n) {
1171
1284
  if (t === -1) continue;
1172
1285
  let n = t + e.length;
1173
1286
  l = n;
1174
- let r = rn(s, t, n);
1287
+ let r = fn(s, t, n);
1175
1288
  r && c.push({
1176
1289
  blockId: r.block.id,
1177
1290
  start: t - r.start,
@@ -1181,15 +1294,15 @@ function an(e, t, n) {
1181
1294
  }
1182
1295
  return c;
1183
1296
  }
1184
- function on(e, t) {
1297
+ function mn(e, t) {
1185
1298
  let n = new Map(e.map((e) => [e.id, e]));
1186
1299
  return t.flatMap((e) => {
1187
1300
  let t = n.get(e.articleId);
1188
- return t ? en(e.directive).filter(({ text: e }) => /[«»]/u.test(e)).map(({ directiveKind: n, text: r }) => ({
1301
+ return t ? ln(e.directive).filter(({ text: e }) => /[«»]/u.test(e)).map(({ directiveKind: n, text: r }) => ({
1189
1302
  articleId: e.articleId,
1190
1303
  code: "nested_french_quote_in_redaction",
1191
1304
  message: "Écart à la règle légistique détecté : une citation imbriquée dans une rédaction devrait utiliser des guillemets anglais et non des guillemets français.",
1192
- ranges: an(t, e, r),
1305
+ ranges: pn(t, e, r),
1193
1306
  severity: "warning",
1194
1307
  details: {
1195
1308
  blockId: e.blockId,
@@ -1200,8 +1313,8 @@ function on(e, t) {
1200
1313
  })) : [];
1201
1314
  });
1202
1315
  }
1203
- function sn(e, t) {
1204
- let n = new Map(e.flatMap((e) => [...S(e.blocks.map((e) => e.text))].map(([t, n]) => [e.blocks[t].id, {
1316
+ function hn(e, t) {
1317
+ let n = new Map(e.flatMap((e) => [..._(e.blocks.map((e) => e.text))].map(([t, n]) => [e.blocks[t].id, {
1205
1318
  articleId: e.id,
1206
1319
  blockIds: e.blocks.slice(t - 1, n.endIndex + 1).map((e) => e.id),
1207
1320
  ...n
@@ -1223,7 +1336,7 @@ function sn(e, t) {
1223
1336
  }];
1224
1337
  });
1225
1338
  }
1226
- function cn(e, t) {
1339
+ function gn(e, t) {
1227
1340
  let n = new Map(e.flatMap((e) => e.blocks.map((e) => [e.id, e]))), r = /* @__PURE__ */ new Set();
1228
1341
  return t.flatMap((e) => {
1229
1342
  let t = e.blockId, i = e.internallyCreatedTargetNums;
@@ -1245,56 +1358,57 @@ function cn(e, t) {
1245
1358
  }] : [];
1246
1359
  });
1247
1360
  }
1248
- function ln(e, t, n, r, i, a, o = !0, s) {
1249
- let c = new ye("parsedBill.buildParsedDocument"), l = i.reduce((e, t) => e + t.blocks.length, 0), u = c.timeSync("buildDirectiveText", () => i.map((e) => e.directiveText).filter(Boolean).join("\n")), d = {
1361
+ function _n(e, t, n, r, i, a, o = !0, s, c) {
1362
+ let l = new Se("parsedBill.buildParsedDocument"), u = i.reduce((e, t) => e + t.blocks.length, 0), d = l.timeSync("buildDirectiveText", () => i.map((e) => e.directiveText).filter(Boolean).join("\n")), f = {
1250
1363
  sourceFormat: e,
1251
1364
  documentDate: r,
1252
1365
  html: t,
1253
1366
  htmlWithLinks: n,
1254
- tableOfContents: a ?? c.timeSync("extractTableOfContents", () => x(u), { inputSize: u.length }),
1255
- articles: i
1367
+ tableOfContents: a ?? l.timeSync("extractTableOfContents", () => S(d), { inputSize: d.length }),
1368
+ articles: i,
1369
+ ...c === void 0 ? {} : { linkDecisions: c }
1256
1370
  };
1257
1371
  if (!o) {
1258
1372
  let e = {
1259
- ...d,
1373
+ ...f,
1260
1374
  directives: [],
1261
1375
  ...s?.length ? { diagnostics: s } : {}
1262
1376
  };
1263
- return c.log({
1377
+ return l.log({
1264
1378
  articleCount: i.length,
1265
- blockCount: l,
1379
+ blockCount: u,
1266
1380
  directiveAnalysisIncluded: !1,
1267
- directiveTextSize: u.length
1381
+ directiveTextSize: d.length
1268
1382
  }), e;
1269
1383
  }
1270
- let f = c.timeSync("extractGlobalApplicabilityDate", () => Qe(i.map((e) => e.text).join("\n"))), p = [], m = c.timeSync("extractDirectivesFromArticles", () => {
1384
+ let p = l.timeSync("extractGlobalApplicabilityDate", () => et(i.map((e) => e.text).join("\n"))), m = [], h = l.timeSync("extractDirectivesFromArticles", () => {
1271
1385
  let e = [];
1272
1386
  for (let t of i) {
1273
- let n = Yt(t, c.enabled ? p : void 0);
1387
+ let n = rn(t, l.enabled ? m : void 0);
1274
1388
  e.push(...n);
1275
1389
  }
1276
1390
  return e;
1277
- }, { count: i.length }), h = qt(i), { createdArticlesByDirective: g, definitions: _ } = c.timeSync("buildInternalArticleDefinitions", () => Xt(m, h), { count: m.length }), v = c.timeSync("attachInternalArticleMetadata", () => Zt(m, _, g, h), { count: m.length }), ee = c.timeSync("collectNestedFrenchQuoteDiagnostics", () => $t(v), { count: v.length }), y = [...s ?? [], ...ee], b = c.timeSync("collectNestedFrenchQuoteAnnotations", () => [
1278
- ...on(i, v),
1279
- ...sn(i, v),
1280
- ...cn(i, v)
1281
- ], { count: v.length }), S = {
1282
- ...d,
1283
- ...f ? { globalApplicabilityDate: f } : {},
1284
- ..._.length > 0 ? { internalArticleDefinitions: _ } : {},
1285
- directives: v,
1286
- ...b.length > 0 ? { annotations: b } : {},
1287
- ...y.length > 0 ? { diagnostics: y } : {}
1391
+ }, { count: i.length }), g = tn(i), { createdArticlesByDirective: _, definitions: v } = l.timeSync("buildInternalArticleDefinitions", () => an(h, g), { count: h.length }), y = l.timeSync("attachInternalArticleMetadata", () => on(h, v, _, g), { count: h.length }), b = l.timeSync("collectNestedFrenchQuoteDiagnostics", () => cn(y), { count: y.length }), x = [...s ?? [], ...b], C = l.timeSync("collectNestedFrenchQuoteAnnotations", () => [
1392
+ ...mn(i, y),
1393
+ ...hn(i, y),
1394
+ ...gn(i, y)
1395
+ ], { count: y.length }), ee = {
1396
+ ...f,
1397
+ ...p ? { globalApplicabilityDate: p } : {},
1398
+ ...v.length > 0 ? { internalArticleDefinitions: v } : {},
1399
+ directives: y,
1400
+ ...C.length > 0 ? { annotations: C } : {},
1401
+ ...x.length > 0 ? { diagnostics: x } : {}
1288
1402
  };
1289
- return c.log({
1290
- annotationCount: b.length,
1403
+ return l.log({
1404
+ annotationCount: C.length,
1291
1405
  articleCount: i.length,
1292
- blockCount: l,
1293
- definitionCount: _.length,
1294
- diagnosticCount: y.length,
1406
+ blockCount: u,
1407
+ definitionCount: v.length,
1408
+ diagnosticCount: x.length,
1295
1409
  directiveAnalysisIncluded: !0,
1296
- directiveCount: v.length,
1297
- actionDirectiveExtractionTotals: p.reduce((e, t) => ({
1410
+ directiveCount: y.length,
1411
+ actionDirectiveExtractionTotals: m.reduce((e, t) => ({
1298
1412
  applyApplicabilityDatesMs: e.applyApplicabilityDatesMs + t.actionDirectiveExtraction.applyApplicabilityDatesMs,
1299
1413
  buildListItemTreeMs: e.buildListItemTreeMs + t.actionDirectiveExtraction.buildListItemTreeMs,
1300
1414
  buildDirectivesMs: e.buildDirectivesMs + t.actionDirectiveExtraction.buildDirectivesMs,
@@ -1355,7 +1469,7 @@ function ln(e, t, n, r, i, a, o = !0, s) {
1355
1469
  referenceCount: 0,
1356
1470
  simplifyMs: 0
1357
1471
  }),
1358
- directiveExtractionTotals: p.reduce((e, t) => ({
1472
+ directiveExtractionTotals: m.reduce((e, t) => ({
1359
1473
  buildRangesMs: e.buildRangesMs + t.buildRangesMs,
1360
1474
  extractActionDirectivesMs: e.extractActionDirectivesMs + t.extractActionDirectivesMs,
1361
1475
  mapDirectivesMs: e.mapDirectivesMs + t.mapDirectivesMs,
@@ -1368,22 +1482,22 @@ function ln(e, t, n, r, i, a, o = !0, s) {
1368
1482
  prepareBlockIndexesMs: 0,
1369
1483
  totalMs: 0
1370
1484
  }),
1371
- directiveTextSize: u.length,
1372
- slowDirectiveArticles: p.toSorted((e, t) => t.totalMs - e.totalMs).slice(0, 10)
1373
- }), S;
1485
+ directiveTextSize: d.length,
1486
+ slowDirectiveArticles: m.toSorted((e, t) => t.totalMs - e.totalMs).slice(0, 10)
1487
+ }), ee;
1374
1488
  }
1375
- function un(e) {
1489
+ function vn(e) {
1376
1490
  return { items: e.map((e) => ({
1377
1491
  id: e.id,
1378
1492
  line: e.title ? `${e.label} : ${e.title}` : e.label,
1379
1493
  type: "article"
1380
1494
  })) };
1381
1495
  }
1382
- function dn(e) {
1383
- return Array.from(fe(e)).filter((e) => e.type === "article").map((e) => I(e.line.split(/[::]/u)[0]));
1496
+ function yn(e) {
1497
+ return Array.from(ae(e)).filter((e) => e.type === "article").map((e) => F(e.line.split(/[::]/u)[0]));
1384
1498
  }
1385
- function fn(e, t, n, r) {
1386
- let i = yt(e), a = new Set(Array.from(n.matchAll(/\s+id=(?:"([^"]+)"|'([^']+)')/gu), (e) => e[1] ?? e[2])), o = Array.from(fe(t)).filter((e) => e.type === "article"), s = e.map((e) => r === "akoma-ntoso" ? e.num ? L(e.num) : w(e.html)("p.TCNumArticle").first().attr("id") ?? L(e.label) : e.id), c = o.map((e) => e.id);
1499
+ function bn(e, t, n, r) {
1500
+ let i = St(e), a = new Set(Array.from(n.matchAll(/\s+id=(?:"([^"]+)"|'([^']+)')/gu), (e) => e[1] ?? e[2])), o = Array.from(ae(t)).filter((e) => e.type === "article"), s = e.map((e) => r === "akoma-ntoso" ? e.num ? I(e.num) : b(e.html)("p.TCNumArticle").first().attr("id") ?? I(e.label) : e.id), c = o.map((e) => e.id);
1387
1501
  (c.length !== s.length || c.some((e, t) => e !== s[t])) && i.push({
1388
1502
  code: "article_toc_source_heading_mismatch",
1389
1503
  message: "The table of contents differs from the parsed article headings",
@@ -1399,8 +1513,8 @@ function fn(e, t, n, r) {
1399
1513
  });
1400
1514
  return i;
1401
1515
  }
1402
- function pn(e, t, n) {
1403
- let r = dn(x(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), i = e.map((e) => I(e.label)), a = un(e), o = [...n, ...fn(e, a, t, "assemblee-html")];
1516
+ function xn(e, t, n) {
1517
+ let r = yn(S(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), i = e.map((e) => F(e.label)), a = vn(e), o = [...n, ...bn(e, a, t, "assemblee-html")];
1404
1518
  if (r.length > 0 && (r.length !== i.length || r.some((e, t) => e !== i[t]))) {
1405
1519
  let t = r.findIndex((e, t) => e !== i[t]);
1406
1520
  o.push({
@@ -1424,43 +1538,47 @@ function pn(e, t, n) {
1424
1538
  tableOfContents: a
1425
1539
  };
1426
1540
  }
1427
- async function mn(e, t) {
1428
- let n = new ye("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => hn(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => Ot(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => w(i)), o = n.timeSync("extractArticleHeadings", () => xt(a)), s = new Set(o.map((e) => e.id)), c = ht(a).filter((e) => !s.has(L(e.num ?? e.label))).map((e) => e.label), l = c.length > 0 ? [{
1541
+ async function Sn(e, t) {
1542
+ let n = new Se("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => Cn(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => Nt(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => b(i)), o = n.timeSync("extractArticleHeadings", () => wt(a)), s = new Set(o.map((e) => e.id)), c = vt(a).filter((e) => !s.has(I(e.num ?? e.label))).map((e) => e.label), l = c.length > 0 ? [{
1429
1543
  code: "article_toc_source_heading_mismatch",
1430
1544
  message: "Some structural article headings were not retained",
1431
1545
  details: { discardedCandidates: c }
1432
- }] : [], u = dt(a), d = n.timeSync("extractArticlesAndBlocks", () => o.map((e, t) => {
1433
- let n = wt(a, e, o[t + 1], u), r = Et(a, e.id, n, e), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
1546
+ }] : [], u = mt(a), d = n.timeSync("extractArticlesAndBlocks", () => o.map((e, t) => {
1547
+ let n = Dt(a, e, o[t + 1], u), r = kt(a, e.id, n, e), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
1434
1548
  return {
1435
1549
  id: e.id,
1436
1550
  label: e.label,
1437
1551
  num: e.num,
1438
1552
  title: e.title,
1439
- text: it(a, n),
1440
- html: n.map((e) => et(a, e)).join("\n"),
1553
+ text: st(a, n),
1554
+ html: n.map((e) => nt(a, e)).join("\n"),
1441
1555
  directiveText: i,
1442
1556
  blocks: r
1443
1557
  };
1444
- }), { count: o.length }), f = n.timeSync("injectHiddenArticleSummary", () => Dt(a.html(), d)), { diagnostics: p, tableOfContents: m } = n.timeSync("buildAssembleeTableOfContents", () => pn(d, f, l), { count: d.length }), h = n.timeSync("buildParsedDocument", () => ln("assemblee-html", e, f, t.date, d, m, t.includeDirectiveAnalysis, p));
1445
- return h.diagnostics?.length && process.env.TISSEUSE_WARN_PARSED_BILL_DIAGNOSTICS === "1" && console.warn("Assemblée bill parsing diagnostics", h.diagnostics), n.log({
1446
- articleCount: h.articles.length,
1447
- blockCount: h.articles.reduce((e, t) => e + t.blocks.length, 0),
1448
- directiveCount: h.directives.length,
1449
- targetDirectiveCount: h.directives.filter((e) => e.targetIds !== void 0).length
1450
- }), h;
1558
+ }), { count: o.length }), f = t.linkDecisions ?? r?.linkDecisions;
1559
+ jt(e, d, f, "assemblee-html");
1560
+ let p = n.timeSync("injectHiddenArticleSummary", () => Mt(a.html(), d)), { diagnostics: m, tableOfContents: h } = n.timeSync("buildAssembleeTableOfContents", () => xn(d, p, l), { count: d.length }), g = n.timeSync("buildParsedDocument", () => _n("assemblee-html", e, p, t.date, d, h, t.includeDirectiveAnalysis, m, f));
1561
+ return g.diagnostics?.length && process.env.TISSEUSE_WARN_PARSED_BILL_DIAGNOSTICS === "1" && console.warn("Assemblée bill parsing diagnostics", g.diagnostics), n.log({
1562
+ articleCount: g.articles.length,
1563
+ blockCount: g.articles.reduce((e, t) => e + t.blocks.length, 0),
1564
+ directiveCount: g.directives.length,
1565
+ targetDirectiveCount: g.directives.filter((e) => e.targetIds !== void 0).length
1566
+ }), g;
1451
1567
  }
1452
- async function hn(e, t) {
1568
+ async function Cn(e, t) {
1569
+ let n = t.linkDecisionDocumentId === void 0 ? void 0 : [];
1453
1570
  return {
1454
1571
  sourceFormat: "assemblee-html",
1455
1572
  documentDate: t.date,
1456
1573
  html: e,
1457
- linkedHtml: await ct(e, t, t.date, st(e))
1574
+ linkedHtml: await dt(e, t, t.date, ut(e), n),
1575
+ ...n === void 0 ? {} : { linkDecisions: n }
1458
1576
  };
1459
1577
  }
1460
- function V(e) {
1578
+ function B(e) {
1461
1579
  return e.replace(/&/gu, "&amp;").replace(/</gu, "&lt;").replace(/>/gu, "&gt;").replace(/"/gu, "&quot;");
1462
1580
  }
1463
- function gn(e) {
1581
+ function wn(e) {
1464
1582
  let t = e;
1465
1583
  for (let e = 0; e < 3; e++) {
1466
1584
  let e = t;
@@ -1468,27 +1586,27 @@ function gn(e) {
1468
1586
  }
1469
1587
  return t;
1470
1588
  }
1471
- function _n(e) {
1589
+ function Tn(e) {
1472
1590
  return /(?:&lt;|&amp;lt;)\/?(?:p|br|span|b|i|u|sup|sub|table|thead|tbody|tr|th|td|ul|ol|li)\b/iu.test(e);
1473
1591
  }
1474
- function H(e) {
1592
+ function V(e) {
1475
1593
  return e.name.replace(/^.*:/u, "");
1476
1594
  }
1477
- function vn(e, t) {
1478
- return t.children.map((t) => U(e, t)).filter(Boolean).join("");
1595
+ function En(e, t) {
1596
+ return t.children.map((t) => H(e, t)).filter(Boolean).join("");
1479
1597
  }
1480
- function yn(e, t) {
1481
- return t.children.map((t) => t.type === "text" && _n(t.data) ? gn(t.data) : U(e, t)).filter(Boolean).join("");
1598
+ function Dn(e, t) {
1599
+ return t.children.map((t) => t.type === "text" && Tn(t.data) ? wn(t.data) : H(e, t)).filter(Boolean).join("");
1482
1600
  }
1483
- function U(e, t) {
1601
+ function H(e, t) {
1484
1602
  if (t.type === "text") {
1485
1603
  let e = t.data.replace(/\s+\./gu, ".");
1486
- return _n(e) ? gn(e) : V(e);
1604
+ return Tn(e) ? wn(e) : B(e);
1487
1605
  }
1488
- if (!R(t)) return "";
1489
- let n = H(t), r = () => vn(e, t);
1606
+ if (!L(t)) return "";
1607
+ let n = V(t), r = () => En(e, t);
1490
1608
  switch (n) {
1491
- case "p": return `<p${Sn(e, t, [
1609
+ case "p": return `<p${An(e, t, [
1492
1610
  "id",
1493
1611
  "class",
1494
1612
  "align",
@@ -1502,13 +1620,13 @@ function U(e, t) {
1502
1620
  case "u":
1503
1621
  case "sup":
1504
1622
  case "sub":
1505
- case "abbr": return `<${n}${Sn(e, t, [
1623
+ case "abbr": return `<${n}${An(e, t, [
1506
1624
  "id",
1507
1625
  "class",
1508
1626
  "title",
1509
1627
  "style"
1510
1628
  ])}>${r()}</${n}>`;
1511
- case "a": return `<a href="${V(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${Sn(e, t, [
1629
+ case "a": return `<a href="${B(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${An(e, t, [
1512
1630
  "id",
1513
1631
  "class",
1514
1632
  "title",
@@ -1519,8 +1637,8 @@ function U(e, t) {
1519
1637
  case "tbody":
1520
1638
  case "tr":
1521
1639
  case "th":
1522
- case "td": return Cn(e, t, n, r());
1523
- case "caption": return `<caption${Sn(e, t, [
1640
+ case "td": return jn(e, t, n, r());
1641
+ case "caption": return `<caption${An(e, t, [
1524
1642
  "id",
1525
1643
  "class",
1526
1644
  "align",
@@ -1528,12 +1646,12 @@ function U(e, t) {
1528
1646
  ])}>${r()}</caption>`;
1529
1647
  case "num": return `<span class="akn-num">${r()}</span> `;
1530
1648
  case "heading": return `<p class="akn-heading">${r()}</p>`;
1531
- case "content": return yn(e, t);
1532
- case "alinea": return Rn(e, t, "div", "akn-alinea");
1533
- case "article": return Rn(e, t, "article", "akn-article");
1649
+ case "content": return Dn(e, t);
1650
+ case "alinea": return Kn(e, t, "div", "akn-alinea");
1651
+ case "article": return Kn(e, t, "article", "akn-article");
1534
1652
  case "blockList":
1535
1653
  case "list": return `<div class="akn-list">${r()}</div>`;
1536
- case "item": return Rn(e, t, "div", "akn-item");
1654
+ case "item": return Kn(e, t, "div", "akn-item");
1537
1655
  case "listIntroduction":
1538
1656
  case "listWrapUp":
1539
1657
  case "intro":
@@ -1549,12 +1667,12 @@ function U(e, t) {
1549
1667
  case "book":
1550
1668
  case "tome":
1551
1669
  case "subchapter":
1552
- case "subsection": return Rn(e, t, "section", `akn-${n}`);
1670
+ case "subsection": return Kn(e, t, "section", `akn-${n}`);
1553
1671
  case "crossHeading": return `<p class="akn-cross-heading">${r()}</p>`;
1554
1672
  default: return r();
1555
1673
  }
1556
1674
  }
1557
- function bn(e, t) {
1675
+ function On(e, t) {
1558
1676
  let n = e(t).text();
1559
1677
  if (!n.includes("«") || !n.includes("»") || e(t).find("table").length > 0) return;
1560
1678
  let r = e(t).find("tr").get().filter((n) => e(n).closest("table").get(0) === t);
@@ -1565,39 +1683,39 @@ function bn(e, t) {
1565
1683
  let l = s ? o[0] : void 0, u = c ? o.at(-1) : void 0;
1566
1684
  if (l) {
1567
1685
  let t = Number(e(l).attr("rowspan") ?? "1");
1568
- if (!Number.isInteger(t) || t < 1 || t > r.length - n || t > 1 && F(e(l).text()) !== "«") return [];
1686
+ if (!Number.isInteger(t) || t < 1 || t > r.length - n || t > 1 && P(e(l).text()) !== "«") return [];
1569
1687
  i = t - 1;
1570
1688
  }
1571
1689
  if (u) {
1572
1690
  let t = Number(e(u).attr("rowspan") ?? "1");
1573
- if (!Number.isInteger(t) || t < 1 || t > r.length - n || t > 1 && !/^»\s*;?$/u.test(F(e(u).text()))) return [];
1691
+ if (!Number.isInteger(t) || t < 1 || t > r.length - n || t > 1 && !/^»\s*;?$/u.test(P(e(u).text()))) return [];
1574
1692
  a = t - 1;
1575
1693
  }
1576
1694
  return [l, u];
1577
1695
  });
1578
1696
  if (o.some((e) => e.length !== 2)) return;
1579
- let s = o.map(([t]) => t ? F(e(t).text()) : ""), c = o.map(([, t]) => t ? F(e(t).text()) : "");
1697
+ let s = o.map(([t]) => t ? P(e(t).text()) : ""), c = o.map(([, t]) => t ? P(e(t).text()) : "");
1580
1698
  if (!(s.filter((e) => e === "«").length !== 1 || c.filter((e) => /^»\s*;?$/u.test(e)).length !== 1 || s.some((e) => e !== "" && e !== "«") || c.some((e) => e !== "" && !/^»\s*;?$/u.test(e)) || o.some(([t, n]) => [t, n].some((t) => t && e(t).attr("colspan") !== void 0))) && !(s.indexOf("«") > c.findIndex((e) => e.startsWith("»")))) {
1581
1699
  e(t).addClass("akn-quoted-table");
1582
1700
  for (let [t, n] of o) t && e(t).addClass("akn-quote-column"), n && e(n).addClass("akn-quote-column");
1583
1701
  }
1584
1702
  }
1585
- function xn(e, t) {
1586
- let n = e(t).find("td,th").get(), r = e(n.find((t) => e(t).hasClass("akn-quote-column") && /^»\s*;?$/u.test(F(e(t).text())))).text();
1587
- return `« ${n.filter((t) => !e(t).hasClass("akn-quote-column")).map((t) => F(e(t).text())).filter(Boolean).join(" ")} »${r.includes(";") ? " ;" : ""}`;
1703
+ function kn(e, t) {
1704
+ let n = e(t).find("td,th").get(), r = e(n.find((t) => e(t).hasClass("akn-quote-column") && /^»\s*;?$/u.test(P(e(t).text())))).text();
1705
+ return `« ${n.filter((t) => !e(t).hasClass("akn-quote-column")).map((t) => P(e(t).text())).filter(Boolean).join(" ")} »${r.includes(";") ? " ;" : ""}`;
1588
1706
  }
1589
- function Sn(e, t, n, r = {}) {
1707
+ function An(e, t, n, r = {}) {
1590
1708
  let i = [];
1591
1709
  for (let r of n) {
1592
1710
  if (r === "style") continue;
1593
1711
  let n = e(t).attr(r);
1594
- n !== void 0 && i.push(`${r}="${V(n)}"`);
1712
+ n !== void 0 && i.push(`${r}="${B(n)}"`);
1595
1713
  }
1596
1714
  let a = r.style ?? e(t).attr("style");
1597
- return a && i.push(`style="${V(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
1715
+ return a && i.push(`style="${B(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
1598
1716
  }
1599
- function Cn(e, t, n, r) {
1600
- return `<${n}${Sn(e, t, [
1717
+ function jn(e, t, n, r) {
1718
+ return `<${n}${An(e, t, [
1601
1719
  "id",
1602
1720
  "class",
1603
1721
  "colspan",
@@ -1610,155 +1728,155 @@ function Cn(e, t, n, r) {
1610
1728
  "cellspacing",
1611
1729
  "cellpadding",
1612
1730
  "style"
1613
- ], { style: wn(e, t, n) })}>${r}</${n}>`;
1731
+ ], { style: Mn(e, t, n) })}>${r}</${n}>`;
1614
1732
  }
1615
- function wn(e, t, n) {
1733
+ function Mn(e, t, n) {
1616
1734
  let r = e(t).attr("style") ?? "";
1617
- return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = Tn(r, "text-align", "center")), r || void 0;
1735
+ return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = Nn(r, "text-align", "center")), r || void 0;
1618
1736
  }
1619
- function Tn(e, t, n) {
1737
+ function Nn(e, t, n) {
1620
1738
  let r = e.trim();
1621
1739
  return `${r}${r && !r.endsWith(";") ? ";" : ""} ${t}: ${n};`.trim();
1622
1740
  }
1623
- function En(e, t) {
1624
- let n = [F(e(t).children("num").first().text()), F(e(t).children("heading").first().text())].filter(Boolean);
1625
- return n.length === 0 ? "" : `<p class="akn-heading">${V(n.join(" "))}</p>`;
1741
+ function Pn(e, t) {
1742
+ let n = [P(e(t).children("num").first().text()), P(e(t).children("heading").first().text())].filter(Boolean);
1743
+ return n.length === 0 ? "" : `<p class="akn-heading">${B(n.join(" "))}</p>`;
1626
1744
  }
1627
- function Dn(e, t) {
1745
+ function Fn(e, t) {
1628
1746
  if (!t) return !1;
1629
- let n = (e) => F(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
1630
- return n(F(e.replace(/<[^>]*>/gu, " ").replace(/&nbsp;/gu, " ").replace(/&#xa0;/giu, " ").replace(/&#x2013;/giu, "–"))).startsWith(n(t));
1747
+ let n = (e) => P(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
1748
+ return n(P(e.replace(/<[^>]*>/gu, " ").replace(/&nbsp;/gu, " ").replace(/&#xa0;/giu, " ").replace(/&#x2013;/giu, "–"))).startsWith(n(t));
1631
1749
  }
1632
- function On(e) {
1633
- let t = V(e);
1750
+ function In(e) {
1751
+ let t = B(e);
1634
1752
  return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}" data-pastille="${t}"></span></p>`;
1635
1753
  }
1636
- function kn(e, t) {
1637
- return An([jn({
1754
+ function Ln(e, t) {
1755
+ return Rn([zn({
1638
1756
  content: e,
1639
1757
  pastille: t
1640
1758
  })]);
1641
1759
  }
1642
- function An(e) {
1760
+ function Rn(e) {
1643
1761
  return `<table class="fixed-size large akn-pastille-table"><colgroup><col style="width: 5.0%;" class="texte-col-0 texte-col-pastille"><col style="width: 95.0%;" class="texte-col-1"></colgroup><tbody>${e.join("\n")}</tbody></table>`;
1644
1762
  }
1645
- function jn({ content: e, pastille: t, style: n, contextClass: r }) {
1646
- let i = n ? ` style="${V(n)}"` : "", a = r ? ` ${V(r)}` : "";
1647
- return `<tr${r ? ` class="${V(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${On(t)}</div></td><td style="overflow: hidden; width: 95.0%;" class="texte-col-1 no-right-border"><div class="tableauComparatifCell${a}"${i}>${e}</div></td></tr>`;
1763
+ function zn({ content: e, pastille: t, style: n, contextClass: r }) {
1764
+ let i = n ? ` style="${B(n)}"` : "", a = r ? ` ${B(r)}` : "";
1765
+ return `<tr${r ? ` class="${B(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${In(t)}</div></td><td style="overflow: hidden; width: 95.0%;" class="texte-col-1 no-right-border"><div class="tableauComparatifCell${a}"${i}>${e}</div></td></tr>`;
1648
1766
  }
1649
- function Mn({ content: e, style: t, contextClass: n }) {
1650
- let r = t ? ` style="${V(t)}"` : "", i = n ? ` ${V(n)}` : "";
1651
- return `<tr${n ? ` class="${V(n)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 no-right-border"><div class="tableauComparatifCell${i}"><p class="pastille"><br></p></div></td><td style="overflow: hidden; width: 95.0%;" class="texte-col-1 no-right-border"><div class="tableauComparatifCell${i}"${r}>${e}</div></td></tr>`;
1767
+ function Bn({ content: e, style: t, contextClass: n }) {
1768
+ let r = t ? ` style="${B(t)}"` : "", i = n ? ` ${B(n)}` : "";
1769
+ return `<tr${n ? ` class="${B(n)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 no-right-border"><div class="tableauComparatifCell${i}"><p class="pastille"><br></p></div></td><td style="overflow: hidden; width: 95.0%;" class="texte-col-1 no-right-border"><div class="tableauComparatifCell${i}"${r}>${e}</div></td></tr>`;
1652
1770
  }
1653
- function Nn(e, t) {
1771
+ function Vn(e, t) {
1654
1772
  return e(t).attr("data:pastille") ?? e(t).attr("pastille");
1655
1773
  }
1656
- function Pn(e, t) {
1774
+ function Hn(e, t) {
1657
1775
  return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
1658
1776
  }
1659
- function Fn(e, t) {
1660
- return e(t).children().get().filter((e) => R(e) ? H(e) === "content" : !1).map((t) => U(e, t)).filter(Boolean).join("\n");
1777
+ function Un(e, t) {
1778
+ return e(t).children().get().filter((e) => L(e) ? V(e) === "content" : !1).map((t) => H(e, t)).filter(Boolean).join("\n");
1661
1779
  }
1662
- function In(e, t) {
1780
+ function Wn(e, t) {
1663
1781
  let n = [];
1664
1782
  return e(t).children().each((t, r) => {
1665
- if (!R(r)) return;
1666
- let i = H(r);
1667
- i === "num" || i === "heading" || i === "content" || n.push(U(e, r));
1783
+ if (!L(r)) return;
1784
+ let i = V(r);
1785
+ i === "num" || i === "heading" || i === "content" || n.push(H(e, r));
1668
1786
  }), n.filter(Boolean);
1669
1787
  }
1670
- function Ln(e, t) {
1671
- let n = [], r = H(t), i = r === "alinea" ? Nn(e, t) : void 0, a = Fn(e, t), o = zn(e, t, r, i), s = Gn(e, t);
1788
+ function Gn(e, t) {
1789
+ let n = [], r = V(t), i = r === "alinea" ? Vn(e, t) : void 0, a = Un(e, t), o = qn(e, t, r, i), s = $n(e, t);
1672
1790
  if (i) {
1673
- let r = [Dn(a, F(e(t).children("num").first().text())) ? "" : En(e, t), a].filter(Boolean).join("\n");
1674
- F(r) && n.push(jn({
1791
+ let r = [Fn(a, P(e(t).children("num").first().text())) ? "" : Pn(e, t), a].filter(Boolean).join("\n");
1792
+ P(r) && n.push(zn({
1675
1793
  content: r,
1676
1794
  pastille: i,
1677
1795
  style: o,
1678
1796
  contextClass: s
1679
1797
  }));
1680
- } else a && n.push(Mn({
1798
+ } else a && n.push(Bn({
1681
1799
  content: a,
1682
1800
  style: o,
1683
1801
  contextClass: s
1684
1802
  }));
1685
1803
  for (let r of e(t).children().get()) {
1686
- if (!R(r)) continue;
1687
- let t = H(r);
1688
- t === "num" || t === "heading" || t === "content" || (t === "alinea" || Pn(e, r)) && n.push(...Ln(e, r));
1804
+ if (!L(r)) continue;
1805
+ let t = V(r);
1806
+ t === "num" || t === "heading" || t === "content" || (t === "alinea" || Hn(e, r)) && n.push(...Gn(e, r));
1689
1807
  }
1690
1808
  return n;
1691
1809
  }
1692
- function Rn(e, t, n, r) {
1693
- let i = H(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = Nn(e, t), s = zn(e, t, i, o), c = [`<${n} ${[
1694
- a ? `id="${V(a)}"` : void 0,
1810
+ function Kn(e, t, n, r) {
1811
+ let i = V(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), s = Vn(e, t), c = qn(e, t, i, s), l = [`<${n} ${[
1812
+ a ? `id="${B(a)}"` : void 0,
1695
1813
  `class="${r}"`,
1696
- o ? `data-pastille="${V(o)}"` : void 0,
1697
- s ? `style="${V(s)}"` : void 0
1814
+ s ? `data-pastille="${B(s)}"` : void 0,
1815
+ c ? `style="${B(c)}"` : void 0
1698
1816
  ].filter((e) => e !== void 0).join(" ")}>`];
1699
1817
  if (i === "part" || i === "title") {
1700
- let r = Hn(e, t, i), a = Wn(e, t), o = r ? [Mn({
1818
+ let r = Xn(e, t, i), a = Qn(e, t), o = r ? [Bn({
1701
1819
  content: r,
1702
1820
  contextClass: a
1703
1821
  })] : [], s = () => {
1704
- o.length !== 0 && (c.push(Vn(o)), o = []);
1822
+ o.length !== 0 && (l.push(Yn(o)), o = []);
1705
1823
  };
1706
1824
  return e(t).children().each((t, n) => {
1707
- if (!R(n)) return;
1708
- let r = H(n);
1825
+ if (!L(n)) return;
1826
+ let r = V(n);
1709
1827
  if (!(r === "num" || r === "heading" || r === "content")) {
1710
1828
  if (r === "alinea") {
1711
- o.push(...Ln(e, n));
1829
+ o.push(...Gn(e, n));
1712
1830
  return;
1713
1831
  }
1714
- s(), c.push(U(e, n));
1832
+ s(), l.push(H(e, n));
1715
1833
  }
1716
- }), s(), c.push(`</${n}>`), c.join("\n");
1834
+ }), s(), l.push(`</${n}>`), l.join("\n");
1717
1835
  }
1718
1836
  if (i === "article") {
1719
- let r = F(e(t).children("num").first().text()), i = F(e(t).children("heading").first().text()), a = m(r) ?? {
1837
+ let r = P(e(t).children("num").first().text()), i = P(e(t).children("heading").first().text()), a = o(r) ?? {
1720
1838
  label: r,
1721
1839
  num: r
1722
- }, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${V(`_TocArt${(a.num ?? r).replace(/\s+/gu, "")}`)}">${V(a.label)}${i ? ` : ${V(i)}` : ""}</p>`;
1723
- if (Pn(e, t)) {
1724
- let r = [Mn({
1725
- content: o,
1726
- contextClass: qn(a.label)
1727
- }), ...Ln(e, t)];
1728
- c.push(An(r));
1729
- for (let n of In(e, t)) n.includes("akn-pastille-table") || c.push(n);
1730
- return c.push(`</${n}>`), c.join("\n");
1840
+ }, s = `<p class="TCNumArticle as-text toc-article dispositif" id="${B(`_TocArt${(a.num ?? r).replace(/\s+/gu, "")}`)}">${B(a.label)}${i ? ` : ${B(i)}` : ""}</p>`;
1841
+ if (Hn(e, t)) {
1842
+ let r = [Bn({
1843
+ content: s,
1844
+ contextClass: tr(a.label)
1845
+ }), ...Gn(e, t)];
1846
+ l.push(Rn(r));
1847
+ for (let n of Wn(e, t)) n.includes("akn-pastille-table") || l.push(n);
1848
+ return l.push(`</${n}>`), l.join("\n");
1731
1849
  }
1732
- c.push(o);
1850
+ l.push(s);
1733
1851
  }
1734
- let l = [];
1852
+ let u = [];
1735
1853
  for (let n of ["content", "children"]) e(t).children().each((t, r) => {
1736
- if (!R(r)) return;
1737
- let i = H(r);
1738
- i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(U(e, r));
1854
+ if (!L(r)) return;
1855
+ let i = V(r);
1856
+ i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || u.push(H(e, r));
1739
1857
  });
1740
- let u = l.join("\n");
1858
+ let d = u.join("\n");
1741
1859
  if (i !== "article") {
1742
- let n = Dn(u, F(e(t).children("num").first().text())) ? "" : En(e, t);
1743
- n && c.push(n);
1860
+ let n = Fn(d, P(e(t).children("num").first().text())) ? "" : Pn(e, t);
1861
+ n && l.push(n);
1744
1862
  }
1745
- return c.push(o ? kn(u, o) : u), c.push(`</${n}>`), c.join("\n");
1863
+ return l.push(s ? Ln(d, s) : d), l.push(`</${n}>`), l.join("\n");
1746
1864
  }
1747
- function zn(e, t, n, r) {
1748
- let i = Bn(e(t).attr("style") ?? "", "font-family");
1749
- return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = Tn(i, "text-align", "center")), i || void 0;
1865
+ function qn(e, t, n, r) {
1866
+ let i = Jn(e(t).attr("style") ?? "", "font-family");
1867
+ return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = Nn(i, "text-align", "center")), i || void 0;
1750
1868
  }
1751
- function Bn(e, t) {
1869
+ function Jn(e, t) {
1752
1870
  return e.split(";").map((e) => e.trim()).filter(Boolean).filter((e) => !e.toLowerCase().startsWith(`${t.toLowerCase()}:`)).join(";");
1753
1871
  }
1754
- function Vn(e) {
1872
+ function Yn(e) {
1755
1873
  return `<table class="fixed-size large akn-section-table"><colgroup><col style="width: 5.0%;" class="texte-col-0 texte-col-pastille"><col style="width: 95.0%;" class="texte-col-1"></colgroup><tbody>${e.join("\n")}</tbody></table>`;
1756
1874
  }
1757
- function Hn(e, t, n) {
1758
- let r = F(e(t).children("num").first().text()), i = F(e(t).children("heading").first().text()), a = Un(n), o = [];
1759
- return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${V(r)}</span></p>`), i && o.push(`<p class="${a.heading} as-text dispositif"><span aria-label="">${V(i)}</span></p>`), o.join("\n");
1875
+ function Xn(e, t, n) {
1876
+ let r = P(e(t).children("num").first().text()), i = P(e(t).children("heading").first().text()), a = Zn(n), o = [];
1877
+ return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${B(r)}</span></p>`), i && o.push(`<p class="${a.heading} as-text dispositif"><span aria-label="">${B(i)}</span></p>`), o.join("\n");
1760
1878
  }
1761
- function Un(e) {
1879
+ function Zn(e) {
1762
1880
  switch (e) {
1763
1881
  case "part": return {
1764
1882
  num: "TCNumPartie",
@@ -1782,22 +1900,22 @@ function Un(e) {
1782
1900
  };
1783
1901
  }
1784
1902
  }
1785
- function Wn(e, t) {
1786
- let n = Kn(F(e(t).children("num").first().text()));
1903
+ function Qn(e, t) {
1904
+ let n = er(P(e(t).children("num").first().text()));
1787
1905
  if (n) return n;
1788
1906
  for (let n of e(t).parents().get()) {
1789
- if (!R(n)) continue;
1790
- let t = H(n);
1907
+ if (!L(n)) continue;
1908
+ let t = V(n);
1791
1909
  if (t !== "title" && t !== "part") continue;
1792
- let r = Kn(F(e(n).children("num").first().text()));
1910
+ let r = er(P(e(n).children("num").first().text()));
1793
1911
  if (r) return r;
1794
1912
  }
1795
1913
  }
1796
- function Gn(e, t) {
1797
- return Wn(e, t);
1914
+ function $n(e, t) {
1915
+ return Qn(e, t);
1798
1916
  }
1799
- function Kn(e) {
1800
- let [t, ...n] = F(e).split(/\s+/u);
1917
+ function er(e) {
1918
+ let [t, ...n] = P(e).split(/\s+/u);
1801
1919
  if (!t || n.length === 0) return;
1802
1920
  let r = t.toLocaleLowerCase("fr-FR");
1803
1921
  if ([
@@ -1807,10 +1925,10 @@ function Kn(e) {
1807
1925
  "section"
1808
1926
  ].includes(r)) return `${r}-${n.join("_")}`;
1809
1927
  }
1810
- function qn(e) {
1811
- return `article-${F(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
1928
+ function tr(e) {
1929
+ return `article-${P(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
1812
1930
  }
1813
- function Jn(e) {
1931
+ function nr(e) {
1814
1932
  switch (e) {
1815
1933
  case "part": return "partie";
1816
1934
  case "book": return "livre";
@@ -1822,11 +1940,11 @@ function Jn(e) {
1822
1940
  default: return;
1823
1941
  }
1824
1942
  }
1825
- function Yn(e, t) {
1826
- return [F(e(t).children("num").first().text()), F(e(t).children("heading").first().text())].filter(Boolean).join(" ");
1943
+ function rr(e, t) {
1944
+ return [P(e(t).children("num").first().text()), P(e(t).children("heading").first().text())].filter(Boolean).join(" ");
1827
1945
  }
1828
- function Xn(e, t) {
1829
- let n = F(e(t).children("num").first().text()), r = F(e(t).children("heading").first().text()), i = m(n) ?? {
1946
+ function ir(e, t) {
1947
+ let n = P(e(t).children("num").first().text()), r = P(e(t).children("heading").first().text()), i = o(n) ?? {
1830
1948
  label: n,
1831
1949
  num: n
1832
1950
  };
@@ -1836,24 +1954,24 @@ function Xn(e, t) {
1836
1954
  type: "article"
1837
1955
  };
1838
1956
  }
1839
- function Zn(e, t) {
1957
+ function ar(e, t) {
1840
1958
  e.items.push(...t.items);
1841
1959
  }
1842
- function Qn(e, t) {
1960
+ function or(e, t) {
1843
1961
  let n = { items: [] };
1844
1962
  return e(t).children().each((t, r) => {
1845
- if (!R(r)) return;
1846
- let i = H(r);
1963
+ if (!L(r)) return;
1964
+ let i = V(r);
1847
1965
  if (i === "article") {
1848
- n.items.push(Xn(e, r));
1966
+ n.items.push(ir(e, r));
1849
1967
  return;
1850
1968
  }
1851
- let a = Jn(i);
1969
+ let a = nr(i);
1852
1970
  if (!a) {
1853
- Zn(n, Qn(e, r));
1971
+ ar(n, or(e, r));
1854
1972
  return;
1855
1973
  }
1856
- let o = Yn(e, r), s = Qn(e, r);
1974
+ let o = rr(e, r), s = or(e, r);
1857
1975
  !o && s.items.length === 0 || n.items.push({
1858
1976
  ...s,
1859
1977
  id: e(r).attr("eId") ?? e(r).attr("GUID"),
@@ -1862,27 +1980,27 @@ function Qn(e, t) {
1862
1980
  });
1863
1981
  }), n;
1864
1982
  }
1865
- function $n(e) {
1983
+ function sr(e) {
1866
1984
  let t = e("body").first().get(0);
1867
- return t === void 0 ? { items: [] } : Qn(e, t);
1985
+ return t === void 0 ? { items: [] } : or(e, t);
1868
1986
  }
1869
- function er(e) {
1987
+ function cr(e) {
1870
1988
  return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
1871
1989
  }
1872
- function tr(e) {
1873
- e("table").each((t, n) => bn(e, n));
1990
+ function lr(e) {
1991
+ e("table").each((t, n) => On(e, n));
1874
1992
  let t = e("preamble").first(), n = e("body").first(), r = ["<div class=\"akn-bill\">", "<style>.akn-bill p.pastille span:empty::before{content:attr(data-pastille)}</style>"];
1875
- return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(vn(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
1876
- R(n) && r.push(H(n) === "article" ? Rn(e, n, "article", "akn-article") : U(e, n));
1993
+ return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(En(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
1994
+ L(n) && r.push(V(n) === "article" ? Kn(e, n, "article", "akn-article") : H(e, n));
1877
1995
  }), r.push("</section></div>"), r.join("\n");
1878
1996
  }
1879
- function nr(e) {
1880
- let t = w(e, { xml: {
1997
+ function ur(e) {
1998
+ let t = b(e, { xml: {
1881
1999
  decodeEntities: !1,
1882
2000
  lowerCaseTags: !1,
1883
2001
  lowerCaseAttributeNames: !1,
1884
2002
  xmlMode: !0
1885
- } }), n = er(t), r = tr(t);
2003
+ } }), n = cr(t), r = lr(t);
1886
2004
  return {
1887
2005
  sourceFormat: "akoma-ntoso",
1888
2006
  documentDate: n,
@@ -1890,68 +2008,71 @@ function nr(e) {
1890
2008
  linkedHtml: r
1891
2009
  };
1892
2010
  }
1893
- function rr(e) {
1894
- return ir(w(e));
2011
+ function dr(e) {
2012
+ return fr(b(e));
1895
2013
  }
1896
- function ir(e) {
2014
+ function fr(e) {
1897
2015
  let t = [];
1898
2016
  return e("article.akn-article").each((n, r) => {
1899
- let i = e(r).find("p.TCNumArticle").first().get(0), a = F(i ? e(i).text() : ""), o = m(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = Et(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
2017
+ let i = e(r).find("p.TCNumArticle").first().get(0), a = P(i ? e(i).text() : ""), s = o(a) ?? { label: a || `Article ${n + 1}` }, c = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, l = [r], u = kt(e, c, l), d = u.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
1900
2018
  t.push({
1901
- id: s,
1902
- label: o.label,
1903
- num: o.num,
1904
- title: o.title,
1905
- text: it(e, c),
1906
- html: et(e, r),
1907
- directiveText: u,
1908
- blocks: l
2019
+ id: c,
2020
+ label: s.label,
2021
+ num: s.num,
2022
+ title: s.title,
2023
+ text: st(e, l),
2024
+ html: nt(e, r),
2025
+ directiveText: d,
2026
+ blocks: u
1909
2027
  });
1910
2028
  }), t;
1911
2029
  }
1912
- function ar(e) {
1913
- let t = w(e);
2030
+ function pr(e) {
2031
+ let t = b(e);
1914
2032
  return {
1915
- articles: ir(t),
2033
+ articles: fr(t),
1916
2034
  htmlWithLinks: t.html()
1917
2035
  };
1918
2036
  }
1919
- async function or(e, t) {
1920
- let n = new ye("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => w(e, { xml: {
2037
+ async function mr(e, t) {
2038
+ let n = new Se("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => b(e, { xml: {
1921
2039
  decodeEntities: !1,
1922
2040
  lowerCaseTags: !1,
1923
2041
  lowerCaseAttributeNames: !1,
1924
2042
  xmlMode: !0
1925
- } })), i = t.date ?? er(r), a = n.timeSync("renderAknHtml", () => tr(r), { inputSize: e.length }), o = t.linkedHtml ?? await n.time("addLinksToRenderedAknHtml", () => ct(a, {
2043
+ } })), i = t.date ?? cr(r), a = n.timeSync("renderAknHtml", () => lr(r), { inputSize: e.length }), o = t.linkDecisions ?? (t.linkedHtml === void 0 && t.linkDecisionDocumentId !== void 0 ? [] : void 0), s = t.linkedHtml ?? await n.time("addLinksToRenderedAknHtml", () => dt(a, {
1926
2044
  ...t,
1927
2045
  date: i
1928
- }, i)), s = n.timeSync("extractRenderedAknArticles", () => rr(a)), c = n.timeSync("injectHiddenArticleSummary", () => Dt(o, s)), { articles: l, htmlWithLinks: u } = n.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => ar(c)), d = l.length > 0 ? l : s, f = n.timeSync("extractAknTableOfContents", () => $n(r)), p = n.timeSync("buildParsedDocument", () => ln("akoma-ntoso", a, l.length > 0 ? u : c, i, d, f, t.includeDirectiveAnalysis, fn(d, f, l.length > 0 ? u : c, "akoma-ntoso")));
2046
+ }, i, void 0, o)), c = n.timeSync("extractRenderedAknArticles", () => dr(a)), l = n.timeSync("injectHiddenArticleSummary", () => Mt(s, c)), { articles: u, htmlWithLinks: d } = n.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => pr(l)), f = u.length > 0 ? u : c;
2047
+ jt(a, f, o, "akoma-ntoso");
2048
+ let p = n.timeSync("extractAknTableOfContents", () => sr(r)), m = n.timeSync("buildParsedDocument", () => _n("akoma-ntoso", a, u.length > 0 ? d : l, i, f, p, t.includeDirectiveAnalysis, bn(f, p, u.length > 0 ? d : l, "akoma-ntoso"), o));
1929
2049
  return n.log({
1930
- articleCount: p.articles.length,
1931
- blockCount: p.articles.reduce((e, t) => e + t.blocks.length, 0),
1932
- directiveCount: p.directives.length,
1933
- targetDirectiveCount: p.directives.filter((e) => e.targetIds !== void 0).length
1934
- }), p;
2050
+ articleCount: m.articles.length,
2051
+ blockCount: m.articles.reduce((e, t) => e + t.blocks.length, 0),
2052
+ directiveCount: m.directives.length,
2053
+ targetDirectiveCount: m.directives.filter((e) => e.targetIds !== void 0).length
2054
+ }), m;
1935
2055
  }
1936
- async function sr(e, t) {
1937
- let n = nr(e), r = t.date ?? n.documentDate;
2056
+ async function hr(e, t) {
2057
+ let n = ur(e), r = t.date ?? n.documentDate, i = t.linkDecisionDocumentId === void 0 ? void 0 : [];
1938
2058
  return {
1939
2059
  sourceFormat: "akoma-ntoso",
1940
2060
  documentDate: r,
1941
2061
  html: n.html,
1942
- linkedHtml: await ct(n.html, t, r)
2062
+ linkedHtml: await dt(n.html, t, r, void 0, i),
2063
+ ...i === void 0 ? {} : { linkDecisions: i }
1943
2064
  };
1944
2065
  }
1945
2066
  //#endregion
1946
2067
  //#region src/lib/server/assemblee_document_search.ts
1947
- var cr = /\bexpos[ée]\s+des\s+motifs\b/giu, lr = /\barticle\s+(?:premier|1er|\d+)/iu;
1948
- function ur(e) {
2068
+ var gr = /\bexpos[ée]\s+des\s+motifs\b/giu, _r = /\barticle\s+(?:premier|1er|\d+)/iu;
2069
+ function vr(e) {
1949
2070
  return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
1950
2071
  }
1951
- function dr(e) {
1952
- let t = ur(w(e).text()), n = [...t.matchAll(cr)], r = /* @__PURE__ */ new Set(), i = [];
2072
+ function yr(e) {
2073
+ let t = vr(b(e).text()), n = [...t.matchAll(gr)], r = /* @__PURE__ */ new Set(), i = [];
1953
2074
  for (let [e, a] of n.entries()) {
1954
- let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = lr.exec(s), l = ur(s.slice(0, c?.index ?? s.length));
2075
+ let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = _r.exec(s), l = vr(s.slice(0, c?.index ?? s.length));
1955
2076
  if (l.length < 20 || r.has(l)) continue;
1956
2077
  r.add(l);
1957
2078
  let u = `expose-des-motifs-${e + 1}`;
@@ -1967,8 +2088,8 @@ function dr(e) {
1967
2088
  }
1968
2089
  return i;
1969
2090
  }
1970
- async function fr({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
1971
- let i = await mn(t, {
2091
+ async function br({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
2092
+ let i = await Sn(t, {
1972
2093
  date: e,
1973
2094
  includeDirectiveAnalysis: !1,
1974
2095
  linkBaseUrl: n,
@@ -1977,7 +2098,7 @@ async function fr({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
1977
2098
  });
1978
2099
  return {
1979
2100
  items: [...i.articles.map((e) => {
1980
- let t = ur(e.directiveText || e.text);
2101
+ let t = vr(e.directiveText || e.text);
1981
2102
  if (t) return {
1982
2103
  anchor: e.id,
1983
2104
  articleNumber: e.num ?? null,
@@ -1987,17 +2108,17 @@ async function fr({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
1987
2108
  label: e.label,
1988
2109
  title: e.title ?? null
1989
2110
  };
1990
- }).filter((e) => e !== void 0), ...dr(t)],
2111
+ }).filter((e) => e !== void 0), ...yr(t)],
1991
2112
  tableOfContents: i.tableOfContents
1992
2113
  };
1993
2114
  }
1994
- function pr(e, t) {
1995
- return M("sha256").update(JSON.stringify({
2115
+ function xr(e, t) {
2116
+ return j("sha256").update(JSON.stringify({
1996
2117
  item: e,
1997
2118
  metadata: t
1998
2119
  })).digest("hex");
1999
2120
  }
2000
- function mr(e) {
2121
+ function Sr(e) {
2001
2122
  if (typeof e != "object" || !e) return;
2002
2123
  let t = e.cycleDeVie?.chrono;
2003
2124
  if (t !== void 0) for (let e of [
@@ -2012,11 +2133,11 @@ function mr(e) {
2012
2133
  }
2013
2134
  //#endregion
2014
2135
  //#region src/lib/server/senat_amendment_search.ts
2015
- function hr(e) {
2016
- return e?.trim() ? w(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
2136
+ function Cr(e) {
2137
+ return e?.trim() ? b(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
2017
2138
  }
2018
- function gr({ dispositifHtml: e, objetHtml: t }) {
2019
- let n = hr(e), r = hr(t);
2139
+ function wr({ dispositifHtml: e, objetHtml: t }) {
2140
+ let n = Cr(e), r = Cr(t);
2020
2141
  return [...n ? [{
2021
2142
  content: n,
2022
2143
  itemKind: "dispositif",
@@ -2027,231 +2148,231 @@ function gr({ dispositifHtml: e, objetHtml: t }) {
2027
2148
  label: "Objet"
2028
2149
  }] : []];
2029
2150
  }
2030
- function _r(e, t) {
2031
- return M("sha256").update(JSON.stringify({
2151
+ function Tr(e, t) {
2152
+ return j("sha256").update(JSON.stringify({
2032
2153
  item: e,
2033
2154
  metadata: t
2034
2155
  })).digest("hex");
2035
2156
  }
2036
2157
  //#endregion
2037
2158
  //#region src/lib/text_parsers/amendment_action_directives.ts
2038
- function W(e, t) {
2159
+ function U(e, t) {
2039
2160
  return {
2040
2161
  ...t,
2041
2162
  position: e.position(),
2042
2163
  type: "amendment_action_directive"
2043
2164
  };
2044
2165
  }
2045
- function vr(e, t) {
2166
+ function Er(e, t) {
2046
2167
  return {
2047
2168
  type: e === "start" ? "head_of_target" : "tail_after_target",
2048
- unit: t ? n(t) : "article"
2169
+ unit: t ? r(t) : "article"
2049
2170
  };
2050
2171
  }
2051
- function yr(e) {
2172
+ function Dr(e) {
2052
2173
  return e === "start" ? "insert_before" : "insert_after";
2053
2174
  }
2054
- var br = D(O("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), G = E(i, A([O("les?\\s+", { flags: "i" }), h], { value: (e) => e[1] }), h, v), xr = E(A([O("la\\s+fin\\s+de\\s+", { flags: "i" }), G], { value: (e) => {
2175
+ var Or = O(E("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), W = A(c, T([E("les?\\s+", { flags: "i" }), _e], { value: (e) => e[1] }), _e, g), kr = A(T([E("la\\s+fin\\s+de\\s+", { flags: "i" }), W], { value: (e) => {
2055
2176
  let t = e[1];
2056
2177
  return {
2057
2178
  targetReference: t,
2058
2179
  targetScope: {
2059
2180
  type: "tail_after_target",
2060
- unit: n(t)
2181
+ unit: r(t)
2061
2182
  }
2062
2183
  };
2063
- } }), A([_], { value: (e) => ({ targetScope: e[0] }) })), K = D(A([
2064
- D(O("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
2065
- D(O("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
2066
- G,
2067
- D(O("\\s*,?\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*)?", { flags: "i" }), { default: "" })
2184
+ } }), T([i], { value: (e) => ({ targetScope: e[0] }) })), G = O(T([
2185
+ O(E("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
2186
+ O(E("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
2187
+ W,
2188
+ O(E("\\s*,?\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*)?", { flags: "i" }), { default: "" })
2068
2189
  ], { value: (e, t) => ({
2069
2190
  reference: e[2],
2070
2191
  text: t.text()
2071
- }) }), { default: null }), Sr = D(O(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${Ee})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
2072
- function q(e) {
2192
+ }) }), { default: null }), Ar = O(E(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${ye})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
2193
+ function K(e) {
2073
2194
  return e?.text ?? "";
2074
2195
  }
2075
- function Cr(e) {
2076
- return { citation: y(e.position()) };
2196
+ function q(e) {
2197
+ return { citation: oe(e.position()) };
2077
2198
  }
2078
- var J = E(A([T], { value: (e) => ({ citation: e[0] }) }), O("\\S[\\s\\S]*", { value: (e, t) => Cr(t) })), wr = O("\\S[\\s\\S]*", { value: (e, t) => Cr(t) }), Y = O("[^:«“\"]*(?::\\s*)?", { flags: "i" }), Tr = O("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
2199
+ var J = A(T([w], { value: (e) => ({ citation: e[0] }) }), E("\\S[\\s\\S]*", { value: (e, t) => q(t) })), jr = E("\\S[\\s\\S]*", { value: (e, t) => q(t) }), Y = E("[^:«“\"]*(?::\\s*)?", { flags: "i" }), Mr = E("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
2079
2200
  flags: "i",
2080
- value: (e, t) => Cr(t)
2081
- }), Er = O("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
2201
+ value: (e, t) => q(t)
2202
+ }), Nr = E("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
2082
2203
  flags: "i",
2083
- value: (e, t) => Cr(t)
2084
- }), Dr = O("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
2204
+ value: (e, t) => q(t)
2205
+ }), Pr = E("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
2085
2206
  flags: "i",
2086
- value: (e, t) => Cr(t)
2087
- }), Or = E(A([T], { value: (e) => ({ citation: e[0] }) }), Tr), kr = E(A([T], { value: (e) => ({ citation: e[0] }) }), Dr), Ar = A([O(`${re}s?\\s*:?\\s*`, { flags: "i" }), Or], { value: (e) => e[1] }), jr = A([O(`${d}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), kr], { value: (e) => e[1] }), Mr = E(A([T], { value: (e) => ({ citation: e[0] }) }), Er), Nr = A([
2088
- Sr,
2089
- O(`${re}s?\\s*:?\\s*`, { flags: "i" }),
2090
- Mr
2091
- ], { value: (e) => e[2] }), Pr = A([
2092
- Sr,
2093
- O(`${re}s?\\s*:?\\s*`, { flags: "i" }),
2094
- E(A([T], { value: (e) => ({ citation: e[0] }) }), wr)
2207
+ value: (e, t) => q(t)
2208
+ }), Fr = A(T([w], { value: (e) => ({ citation: e[0] }) }), Mr), Ir = A(T([w], { value: (e) => ({ citation: e[0] }) }), Pr), Lr = T([E(`${e}s?\\s*:?\\s*`, { flags: "i" }), Fr], { value: (e) => e[1] }), Rr = T([E(`${ee}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), Ir], { value: (e) => e[1] }), zr = A(T([w], { value: (e) => ({ citation: e[0] }) }), Nr), Br = T([
2209
+ Ar,
2210
+ E(`${e}s?\\s*:?\\s*`, { flags: "i" }),
2211
+ zr
2212
+ ], { value: (e) => e[2] }), Vr = T([
2213
+ Ar,
2214
+ E(`${e}s?\\s*:?\\s*`, { flags: "i" }),
2215
+ A(T([w], { value: (e) => ({ citation: e[0] }) }), jr)
2095
2216
  ], { value: (e) => e[2] });
2096
2217
  function X(e) {
2097
2218
  return e?.reference;
2098
2219
  }
2099
- var Fr = A([br, O("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => W(t, {
2220
+ var Hr = T([Or, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => U(t, {
2100
2221
  contextText: e[0],
2101
2222
  kind: "delete_article"
2102
- }) }), Ir = A([
2103
- K,
2104
- O("supprimer", { flags: "i" }),
2105
- D(A([k, G], { value: (e) => e[1] }), { default: null }),
2106
- D(A([k, Pr], { value: (e) => e[1] }), { default: null })
2107
- ], { value: (e, t) => W(t, {
2108
- contextText: q(e[0]),
2223
+ }) }), Ur = T([
2224
+ G,
2225
+ E("supprimer", { flags: "i" }),
2226
+ O(T([k, W], { value: (e) => e[1] }), { default: null }),
2227
+ O(T([k, Vr], { value: (e) => e[1] }), { default: null })
2228
+ ], { value: (e, t) => U(t, {
2229
+ contextText: K(e[0]),
2109
2230
  kind: "delete_portion",
2110
2231
  targetCitation: e[3]?.citation ?? void 0,
2111
2232
  targetReference: e[2] ?? X(e[0])
2112
- }) }), Lr = A([
2113
- K,
2114
- E(O("r[eé]diger\\s+ainsi", { flags: "i" }), O("r[eé]tablir", { flags: "i" })),
2233
+ }) }), Wr = T([
2234
+ G,
2235
+ A(E("r[eé]diger\\s+ainsi", { flags: "i" }), E("r[eé]tablir", { flags: "i" })),
2115
2236
  Y,
2116
2237
  J
2117
- ], { value: (e, t) => W(t, {
2118
- contextText: q(e[0]),
2238
+ ], { value: (e, t) => U(t, {
2239
+ contextText: K(e[0]),
2119
2240
  kind: "rewrite_portion",
2120
2241
  replacementCitation: e[3].citation,
2121
2242
  targetReference: X(e[0])
2122
- }) }), Rr = A([
2123
- K,
2124
- E(O("substituer", { flags: "i" }), O("remplacer", { flags: "i" })),
2243
+ }) }), Gr = T([
2244
+ G,
2245
+ A(E("substituer", { flags: "i" }), E("remplacer", { flags: "i" })),
2125
2246
  k,
2126
- Sr,
2127
2247
  Ar,
2128
- O("\\s*,?\\s*"),
2129
- D(O("par\\s+", { flags: "i" }), { default: "" }),
2130
- jr
2131
- ], { value: (e, t) => W(t, {
2132
- contextText: q(e[0]),
2248
+ Lr,
2249
+ E("\\s*,?\\s*"),
2250
+ O(E("par\\s+", { flags: "i" }), { default: "" }),
2251
+ Rr
2252
+ ], { value: (e, t) => U(t, {
2253
+ contextText: K(e[0]),
2133
2254
  kind: "replace",
2134
2255
  replacementCitation: e[7].citation,
2135
2256
  targetCitation: e[4].citation,
2136
2257
  targetReference: X(e[0])
2137
- }) }), zr = A([
2138
- K,
2139
- O("substituer", { flags: "i" }),
2140
- k,
2141
- D(O("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
2258
+ }) }), Kr = T([
2142
2259
  G,
2143
- O("[\\s\\S]*?(?=[«“\"]|$)"),
2260
+ E("substituer", { flags: "i" }),
2261
+ k,
2262
+ O(E("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
2263
+ W,
2264
+ E("[\\s\\S]*?(?=[«“\"]|$)"),
2144
2265
  J
2145
- ], { value: (e, t) => W(t, {
2146
- contextText: q(e[0]),
2266
+ ], { value: (e, t) => U(t, {
2267
+ contextText: K(e[0]),
2147
2268
  kind: "rewrite_portion",
2148
2269
  replacementCitation: e[6].citation,
2149
2270
  targetReference: e[4] ?? X(e[0])
2150
- }) }), Br = A([
2151
- p,
2271
+ }) }), qr = T([
2272
+ a,
2152
2273
  k,
2153
- O("l['’ ]article", { flags: "i" }),
2154
- O("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
2155
- O("ins[eé]rer", { flags: "i" }),
2274
+ E("l['’ ]article", { flags: "i" }),
2275
+ E("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
2276
+ E("ins[eé]rer", { flags: "i" }),
2156
2277
  Y,
2157
2278
  J
2158
- ], { value: (e, t) => W(t, {
2279
+ ], { value: (e, t) => U(t, {
2159
2280
  contextText: "",
2160
2281
  insertCitation: e[6].citation,
2161
2282
  kind: e[0] === "before" ? "insert_article_before" : "insert_article_after"
2162
- }) }), Vr = A([
2163
- p,
2283
+ }) }), Jr = T([
2284
+ a,
2164
2285
  k,
2165
- G,
2166
- O("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
2167
- E(O("ins[eé]rer", { flags: "i" }), O("ajouter", { flags: "i" })),
2286
+ W,
2287
+ E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
2288
+ A(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
2168
2289
  Y,
2169
2290
  J
2170
- ], { value: (e, t) => W(t, {
2291
+ ], { value: (e, t) => U(t, {
2171
2292
  contextText: "",
2172
2293
  insertCitation: e[6].citation,
2173
- kind: l(e[0]),
2294
+ kind: p(e[0]),
2174
2295
  targetReference: e[2]
2175
- }) }), Hr = A([
2176
- p,
2296
+ }) }), Yr = T([
2297
+ a,
2177
2298
  k,
2178
- O("l['’ ]alin[eé]a", { flags: "i" }),
2179
- O("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
2180
- O("ins[eé]rer", { flags: "i" }),
2299
+ E("l['’ ]alin[eé]a", { flags: "i" }),
2300
+ E("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
2301
+ E("ins[eé]rer", { flags: "i" }),
2181
2302
  Y,
2182
2303
  J
2183
- ], { value: (e, t) => W(t, {
2304
+ ], { value: (e, t) => U(t, {
2184
2305
  contextText: "",
2185
2306
  insertCitation: e[6].citation,
2186
- kind: l(e[0])
2187
- }) }), Ur = A([
2188
- K,
2189
- ne,
2190
- O("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
2191
- E(O("ins[eé]rer", { flags: "i" }), O("ajouter", { flags: "i" })),
2307
+ kind: p(e[0])
2308
+ }) }), Xr = T([
2309
+ G,
2310
+ d,
2311
+ E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
2312
+ A(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
2192
2313
  Y,
2193
2314
  J
2194
2315
  ], { value: (e, t) => {
2195
2316
  let n = e[0], r = X(n), i = e[1];
2196
- return W(t, {
2197
- contextText: q(n),
2317
+ return U(t, {
2318
+ contextText: K(n),
2198
2319
  insertCitation: e[5].citation,
2199
- kind: yr(i),
2320
+ kind: Dr(i),
2200
2321
  targetReference: r,
2201
- targetScope: vr(i, r)
2322
+ targetScope: Er(i, r)
2202
2323
  });
2203
- } }), Wr = A([
2204
- K,
2205
- p,
2324
+ } }), Zr = T([
2325
+ G,
2326
+ a,
2206
2327
  k,
2207
- Nr,
2208
- O("[\\s\\S]*?(?=ins[eé]rer)"),
2209
- O("ins[eé]rer", { flags: "i" }),
2328
+ Br,
2329
+ E("[\\s\\S]*?(?=ins[eé]rer)"),
2330
+ E("ins[eé]rer", { flags: "i" }),
2210
2331
  k,
2211
- jr
2212
- ], { value: (e, t) => W(t, {
2213
- contextText: q(e[0]),
2332
+ Rr
2333
+ ], { value: (e, t) => U(t, {
2334
+ contextText: K(e[0]),
2214
2335
  insertCitation: e[7].citation,
2215
- kind: l(e[1]),
2336
+ kind: p(e[1]),
2216
2337
  targetCitation: e[3].citation,
2217
2338
  targetReference: X(e[0])
2218
- }) }), Gr = A([
2219
- K,
2220
- p,
2221
- k,
2339
+ }) }), Qr = T([
2222
2340
  G,
2223
- O("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
2224
- E(O("ins[eé]rer", { flags: "i" }), O("ajouter", { flags: "i" })),
2341
+ a,
2342
+ k,
2343
+ W,
2344
+ E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
2345
+ A(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
2225
2346
  Y,
2226
2347
  J
2227
- ], { value: (e, t) => W(t, {
2228
- contextText: q(e[0]),
2348
+ ], { value: (e, t) => U(t, {
2349
+ contextText: K(e[0]),
2229
2350
  insertCitation: e[7].citation,
2230
- kind: l(e[1]),
2351
+ kind: p(e[1]),
2231
2352
  targetReference: X(e[0]) ?? e[3]
2232
- }) }), Kr = E(Ur, Br, Vr, Hr, zr, A([
2233
- K,
2234
- p,
2353
+ }) }), $r = A(Xr, qr, Jr, Yr, Kr, T([
2354
+ G,
2355
+ a,
2235
2356
  k,
2236
- Nr,
2237
- O("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
2238
- E(A([
2239
- O("supprimer", {
2357
+ Br,
2358
+ E("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
2359
+ A(T([
2360
+ E("supprimer", {
2240
2361
  flags: "i",
2241
2362
  value: "delete_portion"
2242
2363
  }),
2243
2364
  k,
2244
- xr
2365
+ kr
2245
2366
  ], { value: (e) => ({
2246
2367
  kind: e[0],
2247
2368
  ...e[2]
2248
- }) }), A([
2249
- O("r[eé]diger\\s+ainsi", {
2369
+ }) }), T([
2370
+ E("r[eé]diger\\s+ainsi", {
2250
2371
  flags: "i",
2251
2372
  value: "rewrite_portion"
2252
2373
  }),
2253
2374
  k,
2254
- xr,
2375
+ kr,
2255
2376
  Y,
2256
2377
  J
2257
2378
  ], { value: (e) => ({
@@ -2261,49 +2382,49 @@ var Fr = A([br, O("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
2261
2382
  }) }))
2262
2383
  ], { value: (e, t) => {
2263
2384
  let n = e[5];
2264
- return W(t, {
2265
- contextText: q(e[0]),
2385
+ return U(t, {
2386
+ contextText: K(e[0]),
2266
2387
  kind: n.kind,
2267
2388
  replacementCitation: n.replacementCitation,
2268
2389
  targetCitation: e[3].citation,
2269
2390
  targetReference: X(e[0]) ?? n.targetReference,
2270
2391
  targetScope: n.targetScope
2271
2392
  });
2272
- } }), Wr, Gr, A([
2273
- br,
2274
- O("ins[eé]rer", { flags: "i" }),
2275
- O(`[\\s\\S]*?(?=${r})`, { flags: "i" }),
2276
- p,
2393
+ } }), Zr, Qr, T([
2394
+ Or,
2395
+ E("ins[eé]rer", { flags: "i" }),
2396
+ E(`[\\s\\S]*?(?=${s})`, { flags: "i" }),
2397
+ a,
2277
2398
  Y,
2278
- T,
2399
+ w,
2279
2400
  Y,
2280
- T
2281
- ], { value: (e, t) => W(t, {
2401
+ w
2402
+ ], { value: (e, t) => U(t, {
2282
2403
  contextText: e[0],
2283
2404
  insertCitation: e[8],
2284
- kind: l(e[3]),
2405
+ kind: p(e[3]),
2285
2406
  targetCitation: e[6]
2286
- }) }), Rr, Lr, A([
2287
- K,
2288
- O("compl[eé]ter", { flags: "i" }),
2289
- D(A([k, G], { value: (e) => e[1] }), { default: null }),
2407
+ }) }), Gr, Wr, T([
2408
+ G,
2409
+ E("compl[eé]ter", { flags: "i" }),
2410
+ O(T([k, W], { value: (e) => e[1] }), { default: null }),
2290
2411
  Y,
2291
2412
  J
2292
- ], { value: (e, t) => W(t, {
2293
- contextText: q(e[0]),
2413
+ ], { value: (e, t) => U(t, {
2414
+ contextText: K(e[0]),
2294
2415
  insertCitation: e[4].citation,
2295
2416
  kind: "insert_after",
2296
2417
  targetReference: e[2] ?? X(e[0])
2297
- }) }), Fr, Ir);
2418
+ }) }), Hr, Ur);
2298
2419
  //#endregion
2299
2420
  //#region src/lib/server/parsed_amendments.ts
2300
- function qr(e) {
2421
+ function ei(e) {
2301
2422
  return e.replace(/\s+/gu, " ").trim();
2302
2423
  }
2303
- function Jr(e) {
2304
- return e.split(/\n/gu).map(qr).filter(Boolean).join("\n");
2424
+ function ti(e) {
2425
+ return e.split(/\n/gu).map(ei).filter(Boolean).join("\n");
2305
2426
  }
2306
- function Yr(e, t) {
2427
+ function ni(e, t) {
2307
2428
  let { start: n, stop: r } = t;
2308
2429
  for (; n < r && /\s/u.test(e[n]);) n++;
2309
2430
  for (; r > n && /\s/u.test(e[r - 1]);) r--;
@@ -2312,16 +2433,16 @@ function Yr(e, t) {
2312
2433
  stop: r
2313
2434
  } : null;
2314
2435
  }
2315
- function Xr(e, t) {
2316
- return ve(_e(e), t);
2436
+ function ri(e, t) {
2437
+ return ve(xe(e), t);
2317
2438
  }
2318
- function Zr(e) {
2439
+ function ii(e) {
2319
2440
  return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
2320
2441
  }
2321
- function Qr(e) {
2442
+ function ai(e) {
2322
2443
  return {
2323
2444
  articleLabel: e.targetArticleLabel ?? null,
2324
- targetPosition: Zr(e.targetPosition),
2445
+ targetPosition: ii(e.targetPosition),
2325
2446
  alinea: e.targetAlinea ?? null,
2326
2447
  alineaLabel: e.targetAlineaLabel ?? null,
2327
2448
  subdivisionSourceId: e.targetSubdivisionSourceId ?? null,
@@ -2336,36 +2457,36 @@ function Z(e) {
2336
2457
  sourceText: e.text
2337
2458
  };
2338
2459
  }
2339
- function $r(e) {
2460
+ function oi(e) {
2340
2461
  return {
2341
2462
  ...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
2342
2463
  sourcePosition: e.position,
2343
2464
  sourceText: e.text
2344
2465
  };
2345
2466
  }
2346
- function ei(e) {
2467
+ function si(e) {
2347
2468
  return {
2348
2469
  ...e?.originalTransformation === void 0 ? {} : { dispositifOriginalTransformation: e.originalTransformation },
2349
2470
  ...e === null ? {} : { dispositifPosition: e.position },
2350
2471
  dispositifText: e?.text ?? null
2351
2472
  };
2352
2473
  }
2353
- function ti(e, t, n, r = Jr(e.slice(n.start, n.stop))) {
2474
+ function ci(e, t, n, r = ti(e.slice(n.start, n.stop))) {
2354
2475
  return {
2355
- originalTransformation: Xr(t, n),
2476
+ originalTransformation: ri(t, n),
2356
2477
  position: n,
2357
2478
  text: r
2358
2479
  };
2359
2480
  }
2360
- function ni(e) {
2481
+ function li(e) {
2361
2482
  let t = e.dispositifHtml ?? e.dispositifText;
2362
2483
  if (!t) return null;
2363
- let n = e.dispositifHtml ? ge()(t) : Se(t), r = n.output, i = Yr(r, {
2484
+ let n = e.dispositifHtml ? be()(t) : ke(t), r = n.output, i = ni(r, {
2364
2485
  start: 0,
2365
2486
  stop: r.length
2366
2487
  });
2367
2488
  return {
2368
- dispositif: i === null ? null : ti(r, n, i),
2489
+ dispositif: i === null ? null : ci(r, n, i),
2369
2490
  simplifiedText: r,
2370
2491
  transformation: n
2371
2492
  };
@@ -2382,10 +2503,10 @@ function Q(e) {
2382
2503
  return t === void 0 ? [] : Array.from({ length: e.count }, (e, n) => t + n);
2383
2504
  }
2384
2505
  if (e.type === "exclusion") return Q(e.left);
2385
- for (let t of a(e)) if (t.type === "alinéa" && typeof t.index == "number" && t.index > 0) return [t.index];
2506
+ for (let t of u(e)) if (t.type === "alinéa" && typeof t.index == "number" && t.index > 0) return [t.index];
2386
2507
  return [];
2387
2508
  }
2388
- function ri(e, t) {
2509
+ function ui(e, t) {
2389
2510
  let n = Q(t);
2390
2511
  return {
2391
2512
  ...e,
@@ -2393,11 +2514,11 @@ function ri(e, t) {
2393
2514
  ...n.length > 0 ? { alineas: n } : {}
2394
2515
  };
2395
2516
  }
2396
- function ii(e) {
2517
+ function di(e) {
2397
2518
  return e.replace(/^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*/iu, "").replace(/^\s*(?:\d+°|[a-z]\))\s*/iu, "").trim();
2398
2519
  }
2399
- function ai(e, t) {
2400
- let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(ii(t.text));
2520
+ function fi(e, t) {
2521
+ let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(di(t.text));
2401
2522
  if (!n) return null;
2402
2523
  let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10);
2403
2524
  return !Number.isFinite(r) || r < 1 ? null : {
@@ -2406,25 +2527,25 @@ function ai(e, t) {
2406
2527
  alineas: [r]
2407
2528
  };
2408
2529
  }
2409
- function oi(e, t) {
2530
+ function pi(e, t) {
2410
2531
  if (e) return e.unit === "article" && t.alinea !== null ? {
2411
2532
  ...e,
2412
2533
  unit: "alinéa"
2413
2534
  } : e;
2414
2535
  }
2415
- function si(e) {
2416
- return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(ii(e.text));
2536
+ function mi(e) {
2537
+ return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(di(e.text));
2417
2538
  }
2418
- function ci(e, t, n, r) {
2419
- return ti(e, t, {
2539
+ function hi(e, t, n, r) {
2540
+ return ci(e, t, {
2420
2541
  start: n.position.start,
2421
2542
  stop: r.position.stop
2422
2543
  });
2423
2544
  }
2424
- function li(e) {
2545
+ function gi(e) {
2425
2546
  return /^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*(?!alin[eé]a\b)/iu.test(e.text);
2426
2547
  }
2427
- function ui(e, t) {
2548
+ function _i(e, t) {
2428
2549
  let n = { ...t.position };
2429
2550
  function r(t) {
2430
2551
  let r = t.exec(e.slice(n.start, n.stop));
@@ -2433,29 +2554,29 @@ function ui(e, t) {
2433
2554
  stop: n.stop
2434
2555
  });
2435
2556
  }
2436
- return r(/^(?:(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*|[a-z]\)\s*(?:[.\-–—]\s*)*|\d+°\s*)/iu), r(/^[.\-–—]\s*/u), r(/^en\s+cons[ée]quence\s*,\s*/iu), Yr(e, n);
2557
+ return r(/^(?:(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*|[a-z]\)\s*(?:[.\-–—]\s*)*|\d+°\s*)/iu), r(/^[.\-–—]\s*/u), r(/^en\s+cons[ée]quence\s*,\s*/iu), ni(e, n);
2437
2558
  }
2438
- function di(e) {
2439
- return me(e);
2559
+ function vi(e) {
2560
+ return h(e);
2440
2561
  }
2441
- function fi(e, t) {
2442
- return Kr(new j(e.slice(0, t.stop), t.start)) ?? null;
2562
+ function yi(e, t) {
2563
+ return $r(new D(e.slice(0, t.stop), t.start)) ?? null;
2443
2564
  }
2444
2565
  function $(e, t, n) {
2445
- if (n) return ti(e, t, n.position, Jr(te(e, n)));
2566
+ if (n) return ci(e, t, n.position, ti(v(e, n)));
2446
2567
  }
2447
- function pi(e, t) {
2568
+ function bi(e, t) {
2448
2569
  if (!e) return;
2449
2570
  let n = structuredClone(e);
2450
- for (let e of s(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = Xr(t, e.position));
2571
+ for (let e of ce(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = ri(t, e.position));
2451
2572
  return n;
2452
2573
  }
2453
- function mi(e, t, n, r) {
2454
- let i = ui(e, n);
2574
+ function xi(e, t, n, r) {
2575
+ let i = _i(e, n);
2455
2576
  if (!i) return null;
2456
- let a = fi(e, i);
2577
+ let a = yi(e, i);
2457
2578
  if (!a) return null;
2458
- let o = ti(e, t, i), s = pi(a.targetReference, t), c = ri(r, s), l = di(o.text);
2579
+ let o = ci(e, t, i), s = bi(a.targetReference, t), c = ui(r, s), l = vi(o.text);
2459
2580
  if (a.kind === "delete_article") return {
2460
2581
  kind: "delete_article",
2461
2582
  ...Z(o),
@@ -2473,7 +2594,7 @@ function mi(e, t, n, r) {
2473
2594
  },
2474
2595
  targetOccurrence: l,
2475
2596
  targetReference: s,
2476
- targetScope: oi(a.targetScope, c)
2597
+ targetScope: pi(a.targetScope, c)
2477
2598
  };
2478
2599
  }
2479
2600
  if (a.kind === "rewrite_portion") {
@@ -2490,7 +2611,7 @@ function mi(e, t, n, r) {
2490
2611
  },
2491
2612
  targetOccurrence: l,
2492
2613
  targetReference: s,
2493
- targetScope: oi(a.targetScope, c),
2614
+ targetScope: pi(a.targetScope, c),
2494
2615
  replacementCitation: n,
2495
2616
  replacementText: n.text
2496
2617
  };
@@ -2545,19 +2666,19 @@ function mi(e, t, n, r) {
2545
2666
  targetReference: s,
2546
2667
  insertCitation: n,
2547
2668
  insertText: n.text,
2548
- targetScope: oi(a.targetScope, c)
2669
+ targetScope: pi(a.targetScope, c)
2549
2670
  };
2550
2671
  }
2551
2672
  return null;
2552
2673
  }
2553
- function hi(e, t) {
2674
+ function Si(e, t) {
2554
2675
  let n = [], r = 0, i = 0;
2555
2676
  function a(r) {
2556
- let a = Yr(e, {
2677
+ let a = ni(e, {
2557
2678
  start: i,
2558
2679
  stop: r
2559
2680
  });
2560
- a !== null && n.push(ti(e, t, a));
2681
+ a !== null && n.push(ci(e, t, a));
2561
2682
  }
2562
2683
  function o(t) {
2563
2684
  let n = Math.max(e.lastIndexOf("\n", t - 1), e.lastIndexOf("\r", t - 1));
@@ -2575,7 +2696,7 @@ function hi(e, t) {
2575
2696
  continue;
2576
2697
  }
2577
2698
  if (r > 0) continue;
2578
- let s = e.slice(t + 1), c = /[\n\r]/u.test(n), l = /[.;]/u.test(n), u = e.slice(i, l ? t + 1 : t), d = /^\s*(?:(?:[IVXLCDM]+)\s*[.\-–—]+\s*|\d+°\s*|[a-z]\)\s*|(?:Supprimer|Après|Avant|Compléter|Rédiger|Substituer|Remplacer)\b)/iu.test(s), f = c && /^\s*(?:R[eé]diger|Ins[eé]rer|Ajouter|Supprimer)\b/iu.test(s) && si({
2699
+ let s = e.slice(t + 1), c = /[\n\r]/u.test(n), l = /[.;]/u.test(n), u = e.slice(i, l ? t + 1 : t), d = /^\s*(?:(?:[IVXLCDM]+)\s*[.\-–—]+\s*|\d+°\s*|[a-z]\)\s*|(?:Supprimer|Après|Avant|Compléter|Rédiger|Substituer|Remplacer)\b)/iu.test(s), f = c && /^\s*(?:R[eé]diger|Ins[eé]rer|Ajouter|Supprimer)\b/iu.test(s) && mi({
2579
2700
  originalTransformation: void 0,
2580
2701
  position: {
2581
2702
  start: i,
@@ -2587,8 +2708,8 @@ function hi(e, t) {
2587
2708
  }
2588
2709
  return a(e.length), n;
2589
2710
  }
2590
- function gi(e) {
2591
- let t = ni(e), n = t?.dispositif ?? null, r = ei(n), i = [], a = [], o = Qr(e);
2711
+ function Ci(e) {
2712
+ let t = li(e), n = t?.dispositif ?? null, r = si(n), i = [], a = [], o = ai(e);
2592
2713
  if (e.sourceFormat === "senat-ameli" && e.sourceKind === "S") return i.push({
2593
2714
  code: "unsupported_sub_amendment",
2594
2715
  message: "Les sous-amendements ne sont pas encore projetés."
@@ -2606,9 +2727,9 @@ function gi(e) {
2606
2727
  });
2607
2728
  else {
2608
2729
  let { simplifiedText: e, transformation: r } = t, s = o, c = null;
2609
- for (let t of hi(e, r)) {
2610
- li(t) && (s = o, c = null);
2611
- let n = c ? ci(e, r, c, t) : t, i = mi(e, r, n, s);
2730
+ for (let t of Si(e, r)) {
2731
+ gi(t) && (s = o, c = null);
2732
+ let n = c ? hi(e, r, c, t) : t, i = xi(e, r, n, s);
2612
2733
  if (i) {
2613
2734
  a.push(i), c = null, (i.target.alinea !== null || i.target.alineas) && (s = i.target);
2614
2735
  continue;
@@ -2617,12 +2738,12 @@ function gi(e) {
2617
2738
  c = n;
2618
2739
  continue;
2619
2740
  }
2620
- let l = ai(o, t);
2741
+ let l = fi(o, t);
2621
2742
  if (l !== null) {
2622
2743
  s = l;
2623
2744
  continue;
2624
2745
  }
2625
- si(t) && (c = t);
2746
+ mi(t) && (c = t);
2626
2747
  }
2627
2748
  a.length === 0 && (o.targetPosition === "after_article" || o.targetPosition === "before_article") && a.push({
2628
2749
  kind: o.targetPosition === "before_article" ? "insert_article_before" : "insert_article_after",
@@ -2633,7 +2754,7 @@ function gi(e) {
2633
2754
  }), a.length === 0 && i.push({
2634
2755
  code: "unrecognized_dispositif",
2635
2756
  message: "Le dispositif est présent mais aucune directive d'amendement n'a été reconnue.",
2636
- ...$r(n)
2757
+ ...oi(n)
2637
2758
  });
2638
2759
  }
2639
2760
  return {
@@ -2647,25 +2768,25 @@ function gi(e) {
2647
2768
  }
2648
2769
  //#endregion
2649
2770
  //#region src/lib/server/senat_document_search.ts
2650
- function _i(e) {
2771
+ function wi(e) {
2651
2772
  return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
2652
2773
  }
2653
- function vi(e) {
2654
- let t = m(e);
2774
+ function Ti(e) {
2775
+ let t = o(e);
2655
2776
  if (!t) return {
2656
2777
  articleNumber: null,
2657
2778
  label: e,
2658
2779
  title: null
2659
2780
  };
2660
- let n = _i(t.num ?? "") || null, r = _i(t.title ?? "") || null;
2781
+ let n = wi(t.num ?? "") || null, r = wi(t.title ?? "") || null;
2661
2782
  return {
2662
2783
  articleNumber: n,
2663
2784
  label: t.label,
2664
2785
  title: r
2665
2786
  };
2666
2787
  }
2667
- function yi(e) {
2668
- let t = w(e), n = [], r = _i(t("section.akn-preamble").text());
2788
+ function Ei(e) {
2789
+ let t = b(e), n = [], r = wi(t("section.akn-preamble").text());
2669
2790
  return r && n.push({
2670
2791
  anchor: "senat-expose-des-motifs",
2671
2792
  articleNumber: null,
@@ -2675,9 +2796,9 @@ function yi(e) {
2675
2796
  label: "Exposé des motifs",
2676
2797
  title: null
2677
2798
  }), t("article.akn-article").each((e, r) => {
2678
- let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o = _i(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = vi(o || s), l = i.clone();
2799
+ let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o = wi(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = Ti(o || s), l = i.clone();
2679
2800
  l.children("p.TCNumArticle").remove();
2680
- let u = _i(l.text());
2801
+ let u = wi(l.text());
2681
2802
  u && n.push({
2682
2803
  anchor: i.attr("id") || null,
2683
2804
  articleNumber: c.articleNumber,
@@ -2689,40 +2810,40 @@ function yi(e) {
2689
2810
  });
2690
2811
  }), n;
2691
2812
  }
2692
- function bi(e, t) {
2693
- return M("sha256").update(JSON.stringify({
2813
+ function Di(e, t) {
2814
+ return j("sha256").update(JSON.stringify({
2694
2815
  item: e,
2695
2816
  metadata: t
2696
2817
  })).digest("hex");
2697
2818
  }
2698
2819
  //#endregion
2699
2820
  //#region src/lib/server/senat_document_sources.ts
2700
- var xi = new Set(["senat.fr", "www.senat.fr"]), Si = "https://www.senat.fr";
2701
- function Ci(e) {
2821
+ var Oi = new Set(["senat.fr", "www.senat.fr"]), ki = "https://www.senat.fr";
2822
+ function Ai(e) {
2702
2823
  return e?.trim() || void 0;
2703
2824
  }
2704
- function wi(e) {
2825
+ function ji(e) {
2705
2826
  try {
2706
- let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`, Si);
2707
- return xi.has(n.hostname.toLowerCase()) ? n : void 0;
2827
+ let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`, ki);
2828
+ return Oi.has(n.hostname.toLowerCase()) ? n : void 0;
2708
2829
  } catch {
2709
2830
  return;
2710
2831
  }
2711
2832
  }
2712
- function Ti(e) {
2713
- let t = Ci(e);
2833
+ function Mi(e) {
2834
+ let t = Ai(e);
2714
2835
  if (t === void 0) return {
2715
2836
  publicUrl: null,
2716
2837
  status: "no_url"
2717
2838
  };
2718
- let n = wi(t);
2839
+ let n = ji(t);
2719
2840
  if (n === void 0) return {
2720
2841
  publicUrl: t,
2721
2842
  status: "unsupported_source"
2722
2843
  };
2723
2844
  let r = n.pathname;
2724
2845
  if (/^\/akomantoso\/[^/]+\.akn\.xml$/iu.test(r)) return {
2725
- akomaNtosoUrl: `${Si}${r}`,
2846
+ akomaNtosoUrl: `${ki}${r}`,
2726
2847
  publicUrl: n.toString(),
2727
2848
  status: "available"
2728
2849
  };
@@ -2731,17 +2852,17 @@ function Ti(e) {
2731
2852
  publicUrl: n.toString(),
2732
2853
  status: "unsupported_source"
2733
2854
  } : {
2734
- akomaNtosoUrl: `${Si}/akomantoso/${i.replace(/\.html$/iu, ".akn.xml")}`,
2855
+ akomaNtosoUrl: `${ki}/akomantoso/${i.replace(/\.html$/iu, ".akn.xml")}`,
2735
2856
  publicUrl: n.toString(),
2736
2857
  status: "available"
2737
2858
  };
2738
2859
  }
2739
- function Ei(e) {
2860
+ function Ni(e) {
2740
2861
  return /^\s*(?:<\?xml\b[^>]*>\s*)?<akomaNtoso[\s/>]/iu.test(e);
2741
2862
  }
2742
2863
  //#endregion
2743
2864
  //#region src/lib/alineas/alineas_numbers.ts
2744
- var Di = {
2865
+ var Pi = {
2745
2866
  "0150a855548f15a2af52ea057be53f5d": 1,
2746
2867
  "039826cf379b94afefe90b25c6045ca0": 1,
2747
2868
  "03a7e564b84662f4d957c51018e26244": 1,
@@ -21715,7 +21836,7 @@ var Di = {
21715
21836
  d16d29c923bd60c7b095b66c6058fe60: 1664,
21716
21837
  "1c14c2adf5cfda3220b2057160e10e91": 1665,
21717
21838
  e44c55ca1ac46ff46420686a466c9fc6: 1665
21718
- }, Oi = "\np:has(.alinea) {\n margin: 0.6em 0;\n}\n.alinea {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 1.5em;\n height: 1.5em;\n padding: 0 0.3em;\n margin-right: 0.3em;\n font-size: 0.75em;\n font-weight: bold;\n color: #555;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 1em;\n vertical-align: middle;\n}\n", ki = "\nh1 {\n font-size: 1.8em;\n margin: 1em 0 0.5em 0;\n}\nh2 {\n font-size: 1.5em;\n margin: 0.9em 0 0.4em 0;\n}\nh3 {\n font-size: 1.3em;\n margin: 0.8em 0 0.4em 0;\n}\nh4 {\n font-size: 1.15em;\n margin: 0.7em 0 0.3em 0;\n}\nh5 {\n font-size: 1.05em;\n margin: 0.6em 0 0.3em 0;\n}\nh6 {\n font-size: 1em;\n margin: 0.5em 0 0.3em 0;\n}\n", Ai = "\n.expose-motifs-titre {\n font-size: 1.1em;\n font-weight: bold;\n color: #0070b9;\n margin: 1em 0 0.5em 0;\n}\n.expose-motifs {\n border-left: 3px solid #0070b9;\n padding-left: 1em;\n margin: 0.5em 0 1em 0;\n color: #333;\n}\n.expose-motifs p {\n margin: 0.5em 0;\n}\n", ji = "\nol {\n list-style: none;\n padding-left: 0;\n margin: 0.5em 0;\n counter-reset: list-counter;\n}\nol > li {\n counter-increment: list-counter;\n margin: 0.3em 0;\n padding-left: 2.3em;\n position: relative;\n}\nol > li::before {\n content: counter(list-counter);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 1.5em;\n height: 1.5em;\n padding: 0 0.3em;\n font-size: 0.75em;\n font-weight: bold;\n color: #555;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 1em;\n position: absolute;\n left: 0;\n top: 0.1em;\n}\n", Mi = "\n.cover-title {\n font-size: 1.8em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 1em 0;\n}\n.cover-subtitle {\n font-size: 1.4em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 0.8em 0;\n}\n.cover-info {\n text-align: center;\n margin: 0.3em 0;\n color: #333;\n}\n.cover-year {\n font-size: 2em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 1em 0;\n}\n", Ni = {
21839
+ }, Fi = "\np:has(.alinea) {\n margin: 0.6em 0;\n}\n.alinea {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 1.5em;\n height: 1.5em;\n padding: 0 0.3em;\n margin-right: 0.3em;\n font-size: 0.75em;\n font-weight: bold;\n color: #555;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 1em;\n vertical-align: middle;\n}\n", Ii = "\nh1 {\n font-size: 1.8em;\n margin: 1em 0 0.5em 0;\n}\nh2 {\n font-size: 1.5em;\n margin: 0.9em 0 0.4em 0;\n}\nh3 {\n font-size: 1.3em;\n margin: 0.8em 0 0.4em 0;\n}\nh4 {\n font-size: 1.15em;\n margin: 0.7em 0 0.3em 0;\n}\nh5 {\n font-size: 1.05em;\n margin: 0.6em 0 0.3em 0;\n}\nh6 {\n font-size: 1em;\n margin: 0.5em 0 0.3em 0;\n}\n", Li = "\n.expose-motifs-titre {\n font-size: 1.1em;\n font-weight: bold;\n color: #0070b9;\n margin: 1em 0 0.5em 0;\n}\n.expose-motifs {\n border-left: 3px solid #0070b9;\n padding-left: 1em;\n margin: 0.5em 0 1em 0;\n color: #333;\n}\n.expose-motifs p {\n margin: 0.5em 0;\n}\n", Ri = "\nol {\n list-style: none;\n padding-left: 0;\n margin: 0.5em 0;\n counter-reset: list-counter;\n}\nol > li {\n counter-increment: list-counter;\n margin: 0.3em 0;\n padding-left: 2.3em;\n position: relative;\n}\nol > li::before {\n content: counter(list-counter);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 1.5em;\n height: 1.5em;\n padding: 0 0.3em;\n font-size: 0.75em;\n font-weight: bold;\n color: #555;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 1em;\n position: absolute;\n left: 0;\n top: 0.1em;\n}\n", zi = "\n.cover-title {\n font-size: 1.8em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 1em 0;\n}\n.cover-subtitle {\n font-size: 1.4em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 0.8em 0;\n}\n.cover-info {\n text-align: center;\n margin: 0.3em 0;\n color: #333;\n}\n.cover-year {\n font-size: 2em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 1em 0;\n}\n", Bi = {
21719
21840
  assnatetatagr: { bold: !0 },
21720
21841
  assnatetatagrgr: { bold: !0 },
21721
21842
  assnatetatatr: { bold: !0 },
@@ -21816,29 +21937,29 @@ var Di = {
21816
21937
  assnatxl67: { align: "center" },
21817
21938
  assnatenteteequilibre: { align: "center" }
21818
21939
  };
21819
- function Pi(e) {
21820
- let t = Object.keys(Ni).sort((e, t) => t.length - e.length);
21821
- for (let n of t) if (e.includes(n)) return Ni[n];
21940
+ function Vi(e) {
21941
+ let t = Object.keys(Bi).sort((e, t) => t.length - e.length);
21942
+ for (let n of t) if (e.includes(n)) return Bi[n];
21822
21943
  return null;
21823
21944
  }
21824
- function Fi(e) {
21825
- return Oe.createHash("md5").update(e).digest("hex");
21945
+ function Hi(e) {
21946
+ return Ae.createHash("md5").update(e).digest("hex");
21826
21947
  }
21827
- function Ii(e) {
21948
+ function Ui(e) {
21828
21949
  return e ? /font-weight\s*:\s*(bold|[6-9]00|1000)/i.test(e) || /font-family\s*:\s*[^;]*\bBold\b/i.test(e) : !1;
21829
21950
  }
21830
- function Li(e) {
21951
+ function Wi(e) {
21831
21952
  return e ? /font-style\s*:\s*italic/i.test(e) || /font-family\s*:\s*[^;]*\bItalic\b/i.test(e) : !1;
21832
21953
  }
21833
- function Ri(e) {
21954
+ function Gi(e) {
21834
21955
  if (!e || !/vertical-align\s*:\s*super/i.test(e)) return !1;
21835
21956
  let t = e.match(/font-size\s*:\s*([\d.]+)pt/i);
21836
21957
  return !(t && parseFloat(t[1]) < 8);
21837
21958
  }
21838
- function zi(e) {
21959
+ function Ki(e) {
21839
21960
  return e ? /vertical-align\s*:\s*sub/i.test(e) : !1;
21840
21961
  }
21841
- function Bi(e) {
21962
+ function qi(e) {
21842
21963
  if (!e) return;
21843
21964
  let t = [
21844
21965
  "width",
@@ -21873,15 +21994,15 @@ function Bi(e) {
21873
21994
  }
21874
21995
  return n.length > 0 ? n.join("; ") : void 0;
21875
21996
  }
21876
- function Vi(e, t) {
21997
+ function Ji(e, t) {
21877
21998
  return !!(e && /text-align\s*:\s*center/i.test(e) || t && /center/i.test(t));
21878
21999
  }
21879
- function Hi(e) {
22000
+ function Yi(e) {
21880
22001
  if (!e) return null;
21881
22002
  let t = e.match(/text-align\s*:\s*(left|center|right|justify)/i);
21882
22003
  return t ? t[1].toLowerCase() : null;
21883
22004
  }
21884
- function Ui(e) {
22005
+ function Xi(e) {
21885
22006
  if (!e) return null;
21886
22007
  for (let [t, n] of [
21887
22008
  [/assnat1Tome|assnatAN1PARTIE/i, 1],
@@ -21893,8 +22014,8 @@ function Ui(e) {
21893
22014
  ]) if (t.test(e)) return n;
21894
22015
  return null;
21895
22016
  }
21896
- function Wi(e, t = {}) {
21897
- let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = w(e, { xml: { decodeEntities: !1 } });
22017
+ function Zi(e, t = {}) {
22018
+ let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = b(e, { xml: { decodeEntities: !1 } });
21898
22019
  a("style, script, meta, link").remove(), a(".assnatHeader, .assnatFooter, .assnatHeaderLeft, .assnatHeaderandFooter").remove(), a(".assnatFARSautApres, .assnatFARSautAvant, .assnatFARSautPageNiv0, .assnatFARSautPageNiv1, .assnatFARSautPageNiv1PG").remove(), a(".assnatFARTT08Bleu").each((e, t) => {
21899
22020
  let n = a(t).closest("table");
21900
22021
  n.length > 0 && n.remove();
@@ -21919,7 +22040,7 @@ function Wi(e, t = {}) {
21919
22040
  if (i.length !== 0 && !(n.parents("del").length > 0 || n.find("del img").length > 0) && !(i.parent("del").length > 0)) {
21920
22041
  let e = i.attr();
21921
22042
  if (e && (e.width === "45" && (e.height === "31" || e.height === "30") || parseInt(e.width || "0", 10) < 50 && parseInt(e.height || "0", 10) < 50) && r.includes("position:absolute")) {
21922
- let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? Fi(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
22043
+ let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? Hi(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
21923
22044
  n.replaceWith(`<span class="alinea"${i}></span>`);
21924
22045
  return;
21925
22046
  }
@@ -21938,7 +22059,7 @@ function Wi(e, t = {}) {
21938
22059
  (!r || r === "\xA0") && n.remove();
21939
22060
  }), a("span[style*=\"display:block\"][style*=\"position:absolute\"]:not(.alinea)").remove(), a("del").remove();
21940
22061
  function o(e) {
21941
- let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = Ii(n) || r === "b" || r === "strong", o = Li(n) || r === "i" || r === "em", s = Ri(n) || r === "sup", c = zi(n) || r === "sub", l = t.attr("class") || "";
22062
+ let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = Ui(n) || r === "b" || r === "strong", o = Wi(n) || r === "i" || r === "em", s = Gi(n) || r === "sup", c = Ki(n) || r === "sub", l = t.attr("class") || "";
21942
22063
  return /bold/i.test(l) && (i = !0), /strongemphasis/i.test(l) ? i = !0 : /italic|emphasis/i.test(l) && (o = !0), {
21943
22064
  bold: i,
21944
22065
  italic: o,
@@ -21972,7 +22093,7 @@ function Wi(e, t = {}) {
21972
22093
  c = e;
21973
22094
  }
21974
22095
  for (a("p").each((e, t) => {
21975
- let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s = Ui(i);
22096
+ let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s = Xi(i);
21976
22097
  if (i.includes("assnatFARCouvTitreD")) {
21977
22098
  let e = r.html() || "";
21978
22099
  r.replaceWith(`<p class="cover-subtitle">${e}</p>`);
@@ -22005,11 +22126,11 @@ function Wi(e, t = {}) {
22005
22126
  let c = r.text().trim().startsWith("«");
22006
22127
  if (s && !c) {
22007
22128
  let e = a(`<h${s}>${r.html() || ""}</h${s}>`);
22008
- n && Vi(o, i) && e.attr("align", "center"), r.replaceWith(e);
22129
+ n && Ji(o, i) && e.attr("align", "center"), r.replaceWith(e);
22009
22130
  } else {
22010
- let e = Pi(i), t;
22131
+ let e = Vi(i), t;
22011
22132
  if (n) {
22012
- let n = Hi(o);
22133
+ let n = Yi(o);
22013
22134
  n && n !== "justify" && n !== "left" ? t = n : e?.align && (t = e.align);
22014
22135
  }
22015
22136
  if (r.removeAttr("style").removeAttr("class"), t && r.attr("align", t), e?.bold) {
@@ -22019,7 +22140,7 @@ function Wi(e, t = {}) {
22019
22140
  }
22020
22141
  }), a("h1, h2, h3, h4, h5, h6").each((e, t) => {
22021
22142
  let r = a(t), i = r.attr("style"), o = r.attr("class");
22022
- n && Vi(i, o) ? (r.removeAttr("style").removeAttr("class"), r.attr("align", "center")) : r.removeAttr("style").removeAttr("class");
22143
+ n && Ji(i, o) ? (r.removeAttr("style").removeAttr("class"), r.attr("align", "center")) : r.removeAttr("style").removeAttr("class");
22023
22144
  }), a("a").each((e, t) => {
22024
22145
  let n = a(t), r = n.attr("href"), i = n.attr("id"), o = { ...t.attribs || {} };
22025
22146
  for (let e of Object.keys(o)) e !== "href" && e !== "id" && n.removeAttr(e);
@@ -22058,7 +22179,7 @@ function Wi(e, t = {}) {
22058
22179
  }), a("br").each((e, t) => {
22059
22180
  a(t).removeAttr("style").removeAttr("class");
22060
22181
  }), a("table, tr, td, th, thead, tbody, tfoot").each((e, t) => {
22061
- let n = a(t), r = Bi(n.attr("style"));
22182
+ let n = a(t), r = qi(n.attr("style"));
22062
22183
  n.removeAttr("style").removeAttr("class"), r && n.attr("style", r);
22063
22184
  }), a("td, th").each((e, t) => {
22064
22185
  let n = a(t), r = n.children();
@@ -22076,17 +22197,17 @@ function Wi(e, t = {}) {
22076
22197
  !isNaN(e) && e > 1 && n.attr("style", `counter-reset: list-counter ${e - 1}`), n.attr("start", r);
22077
22198
  }
22078
22199
  }), a("li").each((e, t) => {
22079
- let n = a(t), r = Hi(n.attr("style"));
22200
+ let n = a(t), r = Yi(n.attr("style"));
22080
22201
  n.removeAttr("style").removeAttr("class"), r === "center" && n.attr("style", "text-align: center");
22081
22202
  let i = n.html() || "", o = i.replace(/^(\s|&#xa0;|&#160;|\u00a0)+/, "");
22082
22203
  o !== i && n.html(o);
22083
- }), Gi(a), Ki(a, i);
22204
+ }), Qi(a), $i(a, i);
22084
22205
  let l = a("body").html() || a.html(), u = l.includes("class=\"alinea"), d = a("ol").length > 0, f = a("h1, h2, h3, h4, h5, h6").length > 0, p = l.includes("class=\"expose-motifs"), m = l.includes("class=\"cover-title\"") || l.includes("class=\"cover-subtitle\"") || l.includes("class=\"cover-info\"") || l.includes("class=\"cover-year\""), h = "";
22085
- m && (h += Mi), f && (h += ki), p && (h += Ai), u && (h += Oi), d && (h += ji);
22206
+ m && (h += zi), f && (h += Ii), p && (h += Li), u && (h += Fi), d && (h += Ri);
22086
22207
  let g = h ? `<style>${h}</style>\n${l}` : l;
22087
- return g = g.replace(/>\s+</g, "> <").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n{3,}/g, "\n\n").split("\n").map((e) => e.trim()).filter((e) => e.length > 0).join("\n"), g = g.replace(/&nbsp;/g, "\xA0"), r && (g = g.replace(/<p[^>]*>\s*(&nbsp;|&#xa0;|&#160;|\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*(&nbsp;|&#xa0;|&#160;|\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), g = g.replace(/<span[^>]*>\s*<\/span>/gi, ""), g = g.replace(/ class=""/g, ""), g = qi(g), g = g.replace(/<(strong|em|b|i|sup|sub)>\s*(&nbsp;|&#xa0;|&#160;|\u00a0|\s)*\s*<\/\1>/gi, "").replace(/<(strong|em|b|i)>(&nbsp;|&#xa0;|&#160;|\u00a0)+<\/\1>/gi, " ").replace(/<br\s*\/?>/gi, "<br/>").replace(/ +/g, " ").trim(), g;
22208
+ return g = g.replace(/>\s+</g, "> <").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n{3,}/g, "\n\n").split("\n").map((e) => e.trim()).filter((e) => e.length > 0).join("\n"), g = g.replace(/&nbsp;/g, "\xA0"), r && (g = g.replace(/<p[^>]*>\s*(&nbsp;|&#xa0;|&#160;|\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*(&nbsp;|&#xa0;|&#160;|\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), g = g.replace(/<span[^>]*>\s*<\/span>/gi, ""), g = g.replace(/ class=""/g, ""), g = ea(g), g = g.replace(/<(strong|em|b|i|sup|sub)>\s*(&nbsp;|&#xa0;|&#160;|\u00a0|\s)*\s*<\/\1>/gi, "").replace(/<(strong|em|b|i)>(&nbsp;|&#xa0;|&#160;|\u00a0)+<\/\1>/gi, " ").replace(/<br\s*\/?>/gi, "<br/>").replace(/ +/g, " ").trim(), g;
22088
22209
  }
22089
- function Gi(e) {
22210
+ function Qi(e) {
22090
22211
  e("span[id]").each((t, n) => {
22091
22212
  let r = e(n), i = r.attr("id"), a = n.attribs || {}, o = Object.keys(a);
22092
22213
  if (o.length !== 1 || o[0] !== "id") return;
@@ -22109,13 +22230,13 @@ function Gi(e) {
22109
22230
  l.trim() === u.trim() && (s.attr("id", i), r.replaceWith(r.html() || ""));
22110
22231
  });
22111
22232
  }
22112
- function Ki(e, t = !1) {
22233
+ function $i(e, t = !1) {
22113
22234
  let n = e("body");
22114
22235
  if (n.length === 0) return;
22115
22236
  let r = n.find("span.alinea[data-image-hash]"), i = -1;
22116
22237
  r.each((n, r) => {
22117
22238
  let a = e(r), o = a.attr("data-image-hash"), s;
22118
- if (o && Di[o] !== void 0 && (s = Di[o]), s === void 0) {
22239
+ if (o && Pi[o] !== void 0 && (s = Pi[o]), s === void 0) {
22119
22240
  if (t) throw Error(`Missing alinea number mapping for image hash: "${o}". Please extract images, review them, and update the mapping in "src/lib/alineas/alineas_numbers.ts".`);
22120
22241
  a.remove();
22121
22242
  return;
@@ -22127,11 +22248,11 @@ function Ki(e, t = !1) {
22127
22248
  i = s, a.attr("data-alinea", String(s)), a.text(String(s)), a.removeAttr("data-image-hash");
22128
22249
  });
22129
22250
  }
22130
- function qi(e) {
22251
+ function ea(e) {
22131
22252
  let t = e;
22132
22253
  return t = t.replace(/<\/strong>(\s*)<strong>/gi, "$1"), t = t.replace(/<\/em>(\s*)<em>/gi, "$1"), t = t.replace(/<\/sup>(\s*)<sup>/gi, "$1"), t = t.replace(/<\/sub>(\s*)<sub>/gi, "$1"), t;
22133
22254
  }
22134
- function Ji(e, t = {}) {
22255
+ function ta(e, t = {}) {
22135
22256
  return `<!DOCTYPE html>
22136
22257
  <html lang="fr">
22137
22258
  <head>
@@ -22139,33 +22260,33 @@ function Ji(e, t = {}) {
22139
22260
  <title>Document simplifié</title>
22140
22261
  </head>
22141
22262
  <body>
22142
- ${Wi(e, t)}
22263
+ ${Zi(e, t)}
22143
22264
  </body>
22144
22265
  </html>`;
22145
22266
  }
22146
22267
  //#endregion
22147
22268
  //#region src/lib/server/text_parsers/transformers.ts
22148
- function Yi(e, t) {
22269
+ function na(e, t) {
22149
22270
  let n = "transformation_", r = {};
22150
- for (let e of N.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
22271
+ for (let e of M.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
22151
22272
  let i = e.slice(15, -5), a = i.split(".").map((e) => parseInt(e) - 1), o = r;
22152
22273
  for (let e of a.slice(1)) {
22153
22274
  let t = o.transformations ??= [];
22154
22275
  for (; e >= t.length;) t.push({});
22155
22276
  o = t[e];
22156
22277
  }
22157
- o.output = N.readFileSync(ke.join(t, `${n}${i}.html`), { encoding: "utf-8" });
22158
- let { sourceMap: s, title: c } = N.readJsonSync(ke.join(t, e), { encoding: "utf-8" });
22278
+ o.output = M.readFileSync(je.join(t, `${n}${i}.html`), { encoding: "utf-8" });
22279
+ let { sourceMap: s, title: c } = M.readJsonSync(je.join(t, e), { encoding: "utf-8" });
22159
22280
  o.sourceMap = s ?? [], o.title = c;
22160
22281
  }
22161
- return Xi(r, e), r;
22282
+ return ra(r, e), r;
22162
22283
  }
22163
- function Xi(e, t) {
22164
- if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) Xi(n, t), t = n.output;
22284
+ function ra(e, t) {
22285
+ if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) ra(n, t), t = n.output;
22165
22286
  return t;
22166
22287
  }
22167
- function Zi(e, t, n = "1") {
22168
- if (N.ensureDirSync(t), e.transformations === void 0) N.writeJsonSync(ke.join(t, `transformation_${n}.json`), {
22288
+ function ia(e, t, n = "1") {
22289
+ if (M.ensureDirSync(t), e.transformations === void 0) M.writeJsonSync(je.join(t, `transformation_${n}.json`), {
22169
22290
  sourceMap: e.sourceMap,
22170
22291
  title: e.title
22171
22292
  }, {
@@ -22173,97 +22294,97 @@ function Zi(e, t, n = "1") {
22173
22294
  spaces: 2
22174
22295
  });
22175
22296
  else {
22176
- N.writeJsonSync(ke.join(t, `transformation_${n}.json`), { title: e.title }, {
22297
+ M.writeJsonSync(je.join(t, `transformation_${n}.json`), { title: e.title }, {
22177
22298
  encoding: "utf-8",
22178
22299
  spaces: 2
22179
22300
  });
22180
- for (let [r, i] of e.transformations.entries()) Zi(i, t, `${n}.${r + 1}`);
22301
+ for (let [r, i] of e.transformations.entries()) ia(i, t, `${n}.${r + 1}`);
22181
22302
  }
22182
- e.output !== void 0 && N.writeFileSync(ke.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
22303
+ e.output !== void 0 && M.writeFileSync(je.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
22183
22304
  }
22184
22305
  //#endregion
22185
22306
  //#region src/lib/server/linkers/html.ts
22186
- async function Qi({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, htmlFilePath: i, htmlTransformationsInputDir: a, htmlTransformationsOutputDir: o, htmlWithLinksFilePath: s, htmlWithLinksOrReferencesFilePath: c, htmlWithLinksTransformationsOutputDir: l, htmlWithReferencesFilePath: u, linkBaseUrl: d, linkType: f, logIgnoredReferencesTypes: p, logPartialReferences: m, logReferences: h, referredLegifranceTextsInfosFilePath: g }) {
22187
- let _ = t ?? (e === void 0 ? void 0 : new se(e));
22307
+ async function aa({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, htmlFilePath: i, htmlTransformationsInputDir: a, htmlTransformationsOutputDir: o, htmlWithLinksFilePath: s, htmlWithLinksOrReferencesFilePath: c, htmlWithLinksTransformationsOutputDir: l, htmlWithReferencesFilePath: u, linkBaseUrl: d, linkType: f, logIgnoredReferencesTypes: p, logPartialReferences: m, logReferences: h, referredLegifranceTextsInfosFilePath: g }) {
22308
+ let _ = t ?? (e === void 0 ? void 0 : new ne(e));
22188
22309
  if (_ === void 0) throw Error("A Canutes database or legal resolver is required");
22189
- let v = await N.readFile(i, { encoding: "utf-8" }), ee;
22190
- a === void 0 ? (ee = ge({ removeAWithHref: !0 })(v), o !== void 0 && Zi(ee, o)) : ee = Yi(v, a);
22191
- let y = [];
22192
- s !== void 0 && y.push("links"), c !== void 0 && y.push("links_or_references"), u !== void 0 && y.push("references");
22193
- let { outputByType: b, referredLegifranceTextCountByCid: x } = await de({
22310
+ let v = await M.readFile(i, { encoding: "utf-8" }), y;
22311
+ a === void 0 ? (y = be({ removeAWithHref: !0 })(v), o !== void 0 && ia(y, o)) : y = na(v, a);
22312
+ let b = [];
22313
+ s !== void 0 && b.push("links"), c !== void 0 && b.push("links_or_references"), u !== void 0 && b.push("references");
22314
+ let { outputByType: x, referredLegifranceTextCountByCid: S } = await de({
22194
22315
  legiResolver: _,
22195
22316
  date: n,
22196
22317
  defaultTextId: r,
22197
- htmlTransformation: ee,
22318
+ htmlTransformation: y,
22198
22319
  inputHtml: v,
22199
22320
  linkBaseUrl: d,
22200
22321
  linkType: f,
22201
22322
  logIgnoredReferencesTypes: p,
22202
22323
  logPartialReferences: m,
22203
22324
  logReferences: h,
22204
- outputTypes: y,
22325
+ outputTypes: b,
22205
22326
  referredLegifranceTextsInfos: g !== void 0
22206
- }), S = {};
22207
- s !== void 0 && (S.links = s), c !== void 0 && (S.links_or_references = c), u !== void 0 && (S.references = u);
22208
- for (let [e, t] of Object.entries(b)) {
22209
- let n = S[e];
22210
- n !== void 0 && await N.writeFile(n, t.html, { encoding: "utf-8" });
22327
+ }), C = {};
22328
+ s !== void 0 && (C.links = s), c !== void 0 && (C.links_or_references = c), u !== void 0 && (C.references = u);
22329
+ for (let [e, t] of Object.entries(x)) {
22330
+ let n = C[e];
22331
+ n !== void 0 && await M.writeFile(n, t.html, { encoding: "utf-8" });
22211
22332
  }
22212
- b.links !== void 0 && l !== void 0 && Zi(ge()(b.links.html), l), g !== void 0 && await N.writeJson(g, x, {
22333
+ x.links !== void 0 && l !== void 0 && ia(be()(x.links.html), l), g !== void 0 && await M.writeJson(g, S, {
22213
22334
  encoding: "utf-8",
22214
22335
  spaces: 2
22215
22336
  });
22216
22337
  }
22217
22338
  //#endregion
22218
22339
  //#region src/lib/server/tables_of_contents.ts
22219
- async function $i(e, t, n, r) {
22220
- let i = Yi(await N.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new j(a), s = await N.readJson(n, { encoding: "utf-8" });
22221
- for await (let e of ue({
22340
+ async function oa(e, t, n, r) {
22341
+ let i = na(await M.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new D(a), s = await M.readJson(n, { encoding: "utf-8" });
22342
+ for await (let e of le({
22222
22343
  context: o,
22223
22344
  tableOfContents: s,
22224
22345
  transformation: i
22225
22346
  }));
22226
- await N.writeJson(r, s, {
22347
+ await M.writeJson(r, s, {
22227
22348
  encoding: "utf-8",
22228
22349
  spaces: 2
22229
22350
  });
22230
22351
  }
22231
- async function ea(e, t, n) {
22232
- let r = Yi(await N.readFile(e, { encoding: "utf-8" }), t).output, i = x(r);
22233
- await N.writeJson(n, i, {
22352
+ async function sa(e, t, n) {
22353
+ let r = na(await M.readFile(e, { encoding: "utf-8" }), t).output, i = S(r);
22354
+ await M.writeJson(n, i, {
22234
22355
  encoding: "utf-8",
22235
22356
  spaces: 2
22236
22357
  });
22237
22358
  }
22238
22359
  //#endregion
22239
22360
  //#region src/lib/server/legi/resolvers.ts
22240
- function ta({ canutesDb: e }) {
22241
- return new se(e);
22361
+ function ca({ canutesDb: e }) {
22362
+ return new ne(e);
22242
22363
  }
22243
22364
  //#endregion
22244
22365
  //#region src/lib/server/jurisprudence_citations.ts
22245
- async function na({ document: e, resolve: t, textTitlesInfos: n }) {
22246
- let r = [], i = new j(e.texte);
22247
- i.textTitlesInfos = n;
22248
- for (let n of he(i)) {
22249
- let i = [...a(n)], o = i.filter((e) => e.type === "texte" && e.nature === "CODE" && e.cid !== void 0), s = i.filter((e) => e.type === "article");
22250
- if (!("position" in n) || n.position === void 0 || s.length === 0) continue;
22251
- let c = e.texte.slice(n.position.start, n.position.stop);
22252
- for (let a of s) {
22253
- let l = o.length === 1 && a.num ? await t({
22254
- codeId: o[0].cid,
22255
- numero: a.num
22366
+ async function la({ document: e, resolve: n, textTitlesInfos: r }) {
22367
+ let i = [], a = new D(e.texte);
22368
+ a.textTitlesInfos = r;
22369
+ for (let r of t(a)) {
22370
+ let t = [...u(r)], a = t.filter((e) => e.type === "texte" && e.nature === "CODE" && e.cid !== void 0), o = t.filter((e) => e.type === "article");
22371
+ if (!("position" in r) || r.position === void 0 || o.length === 0) continue;
22372
+ let s = e.texte.slice(r.position.start, r.position.stop);
22373
+ for (let c of o) {
22374
+ let l = a.length === 1 && c.num ? await n({
22375
+ codeId: a[0].cid,
22376
+ numero: c.num
22256
22377
  }) : [], u = [...new Set(l)];
22257
- r.push({
22258
- mention: c,
22378
+ i.push({
22379
+ mention: s,
22259
22380
  position: {
22260
- start: n.position.start,
22261
- stop: n.position.stop
22381
+ start: r.position.start,
22382
+ stop: r.position.stop
22262
22383
  },
22263
22384
  passage: e.texte,
22264
- articleId: l.length === 1 && s.length === 1 && i.length === 2 ? l[0] : null,
22385
+ articleId: l.length === 1 && o.length === 1 && t.length === 2 ? l[0] : null,
22265
22386
  candidats: u,
22266
- selectionPossible: s.length === 1 && i.length === 2 && o.length === 1,
22387
+ selectionPossible: o.length === 1 && t.length === 2 && a.length === 1,
22267
22388
  redaction: "indéterminée",
22268
22389
  origine: "indéterminée",
22269
22390
  relation: "citation"
@@ -22272,34 +22393,34 @@ async function na({ document: e, resolve: t, textTitlesInfos: n }) {
22272
22393
  }
22273
22394
  return {
22274
22395
  document: e,
22275
- citations: r,
22396
+ citations: i,
22276
22397
  perimetre: "citations explicites d'articles de code"
22277
22398
  };
22278
22399
  }
22279
22400
  //#endregion
22280
22401
  //#region src/lib/server/legifrance_article_search.ts
22281
- function ra(e) {
22402
+ function ua(e) {
22282
22403
  if (!e) return "";
22283
- let t = w(e);
22404
+ let t = b(e);
22284
22405
  return t("script, style").remove(), t.text().replace(/\u00a0/g, " ").replace(/\s+/g, " ").trim();
22285
22406
  }
22286
22407
  //#endregion
22287
22408
  //#region src/lib/server/legifrance_jurisprudence_search.ts
22288
- function ia(e) {
22409
+ function da(e) {
22289
22410
  return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
22290
22411
  }
22291
- function aa(e) {
22412
+ function fa(e) {
22292
22413
  if (typeof e == "string") return e;
22293
- let t = ia(e)?.["#text"];
22414
+ let t = da(e)?.["#text"];
22294
22415
  return typeof t == "string" ? t : void 0;
22295
22416
  }
22296
- function oa(e) {
22297
- let t = ia(e), n = aa(ia(t?.BLOC_TEXTUEL)?.CONTENU), r = aa(ia(ia(t?.TEXTE)?.BLOC_TEXTUEL)?.CONTENU);
22298
- return ra(n ?? r);
22417
+ function pa(e) {
22418
+ let t = da(e), n = fa(da(t?.BLOC_TEXTUEL)?.CONTENU), r = fa(da(da(t?.TEXTE)?.BLOC_TEXTUEL)?.CONTENU);
22419
+ return ua(n ?? r);
22299
22420
  }
22300
- function sa({ data: e, dataset: t, dateDec: n, id: r, juridiction: i, nature: a, numero: o, path: s, solution: c, titre: l }) {
22421
+ function ma({ data: e, dataset: t, dateDec: n, id: r, juridiction: i, nature: a, numero: o, path: s, solution: c, titre: l }) {
22301
22422
  let u = {
22302
- content: oa(e),
22423
+ content: pa(e),
22303
22424
  dataset: t,
22304
22425
  dateDec: n,
22305
22426
  id: r,
@@ -22312,22 +22433,22 @@ function sa({ data: e, dataset: t, dateDec: n, id: r, juridiction: i, nature: a,
22312
22433
  };
22313
22434
  return {
22314
22435
  ...u,
22315
- sourceHash: M("sha256").update(JSON.stringify(u)).digest("hex")
22436
+ sourceHash: j("sha256").update(JSON.stringify(u)).digest("hex")
22316
22437
  };
22317
22438
  }
22318
22439
  //#endregion
22319
22440
  //#region src/lib/server/jurisprudence_jade.ts
22320
- var ca = class extends Error {}, la = class extends Error {};
22321
- function ua(e) {
22322
- if (e.dataset !== "JADE" || !e.path.trim() || !/^CETATEXT\d{12}$/.test(e.id) || !/^conseil d['’]état$/iu.test(e.juridiction.trim()) || !/^\d{4}-\d{2}-\d{2}$/.test(e.dateDec)) throw new ca("Représentation JADE CE invalide");
22323
- let t = sa({
22441
+ var ha = class extends Error {}, ga = class extends Error {};
22442
+ function _a(e) {
22443
+ if (e.dataset !== "JADE" || !e.path.trim() || !/^CETATEXT\d{12}$/.test(e.id) || !/^conseil d['’]état$/iu.test(e.juridiction.trim()) || !/^\d{4}-\d{2}-\d{2}$/.test(e.dateDec)) throw new ha("Représentation JADE CE invalide");
22444
+ let t = ma({
22324
22445
  ...e,
22325
22446
  nature: "",
22326
22447
  numero: "",
22327
22448
  solution: "",
22328
22449
  titre: ""
22329
22450
  });
22330
- if (!t.content.trim()) throw new ca("Contenu JADE absent");
22451
+ if (!t.content.trim()) throw new ha("Contenu JADE absent");
22331
22452
  return {
22332
22453
  dataset: "JADE",
22333
22454
  path: e.path,
@@ -22336,10 +22457,10 @@ function ua(e) {
22336
22457
  dateDecision: e.dateDec,
22337
22458
  ...e.titre?.trim() ? { titre: e.titre } : {},
22338
22459
  texte: t.content,
22339
- revision: M("sha256").update(JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e.localeCompare(t))) : t)).digest("hex")
22460
+ revision: j("sha256").update(JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e.localeCompare(t))) : t)).digest("hex")
22340
22461
  };
22341
22462
  }
22342
- function da(e) {
22463
+ function va(e) {
22343
22464
  return async ({ codeId: t, numero: n }) => (await e`
22344
22465
  SELECT id FROM legifrance.article
22345
22466
  WHERE data -> 'CONTEXTE' -> 'TEXTE' ->> '@cid' = ${t}
@@ -22348,33 +22469,33 @@ function da(e) {
22348
22469
  ORDER BY id
22349
22470
  `).map(({ id: e }) => e);
22350
22471
  }
22351
- function fa(e) {
22472
+ function ya(e) {
22352
22473
  if (!e || !/^\d{4}-\d{2}-\d{2}$/.test(e)) return !1;
22353
22474
  let t = new Date(e);
22354
22475
  return !Number.isNaN(t.valueOf()) && t.toISOString().slice(0, 10) === e;
22355
22476
  }
22356
- async function pa(e, t, n) {
22477
+ async function ba(e, t, n) {
22357
22478
  let r = n ? Array.isArray(n) ? n : [n] : [];
22358
- if (r.some((e) => !e || typeof e.dateReference != "string" || !fa(e.dateReference) || typeof e.articleId != "string" || !e.articleId.trim() || Array.isArray(n) && !e.reference || e.reference && (e.reference.dataset !== "JADE" || typeof e.reference.path != "string" || typeof e.reference.revision != "string" || typeof e.reference.mention != "string" || !e.reference.position || !Number.isSafeInteger(e.reference.position.start) || !Number.isSafeInteger(e.reference.position.stop)))) throw Error("Sélection d'article invalide");
22359
- return C(e, async (e) => {
22479
+ if (r.some((e) => !e || typeof e.dateReference != "string" || !ya(e.dateReference) || typeof e.articleId != "string" || !e.articleId.trim() || Array.isArray(n) && !e.reference || e.reference && (e.reference.dataset !== "JADE" || typeof e.reference.path != "string" || typeof e.reference.revision != "string" || typeof e.reference.mention != "string" || !e.reference.position || !Number.isSafeInteger(e.reference.position.start) || !Number.isSafeInteger(e.reference.position.stop)))) throw Error("Sélection d'article invalide");
22480
+ return y(e, async (e) => {
22360
22481
  let i = await e`
22361
22482
  SELECT dataset, path, id, juridiction, date_dec::text AS "dateDec", titre, data
22362
22483
  FROM legifrance.jurisprudence WHERE dataset = 'JADE' AND path = ${t}
22363
22484
  `;
22364
- if (i.length === 0) throw new ca("Représentation JADE absente");
22365
- if (i.length !== 1) throw new ca("Représentation JADE ambiguë");
22366
- let a = i[0], o = await ae(e), s = await we(o), c = /* @__PURE__ */ new Set(), l = da(e), u = await ma(a, async (e) => {
22485
+ if (i.length === 0) throw new ha("Représentation JADE absente");
22486
+ if (i.length !== 1) throw new ha("Représentation JADE ambiguë");
22487
+ let a = i[0], o = await x(e), s = await Ee(o), c = /* @__PURE__ */ new Set(), l = va(e), u = await xa(a, async (e) => {
22367
22488
  let t = await l(e);
22368
22489
  return t.forEach((e) => c.add(e)), t;
22369
22490
  }, s);
22370
22491
  for (let e of r) {
22371
22492
  let t = e.reference;
22372
- if (t && (t.dataset !== u.document.dataset || t.path !== u.document.path || t.revision !== u.document.revision || !u.citations.some((e) => e.mention === t.mention && e.position.start === t.position.start && e.position.stop === t.position.stop))) throw new la("Sélection de référence obsolète");
22493
+ if (t && (t.dataset !== u.document.dataset || t.path !== u.document.path || t.revision !== u.document.revision || !u.citations.some((e) => e.mention === t.mention && e.position.start === t.position.start && e.position.stop === t.position.stop))) throw new ga("Sélection de référence obsolète");
22373
22494
  }
22374
22495
  for (let e of r) {
22375
22496
  if (e.reference) continue;
22376
22497
  let t = u.citations.filter((t) => t.candidats.includes(e.articleId));
22377
- if (t.length > 1 || t.length === 0 && u.citations.length > 1) throw new la("Sélection sans occurrence ambiguë");
22498
+ if (t.length > 1 || t.length === 0 && u.citations.length > 1) throw new ga("Sélection sans occurrence ambiguë");
22378
22499
  }
22379
22500
  let d = c.size ? await e`SELECT id, data #>> '{META,META_SPEC,META_ARTICLE,DATE_DEBUT}' AS debut,
22380
22501
  data #>> '{META,META_SPEC,META_ARTICLE,DATE_FIN}' AS fin
@@ -22387,13 +22508,13 @@ async function pa(e, t, n) {
22387
22508
  });
22388
22509
  if (t.length === 0 || (e.articleId = null, t.length !== 1 || !e.selectionPossible)) continue;
22389
22510
  let n = t[0], i = d.filter((t) => e.candidats.includes(t.id));
22390
- if (i.length !== e.candidats.length || i.some(({ debut: e, fin: t }) => !fa(e) || !fa(t) || e >= t)) continue;
22511
+ if (i.length !== e.candidats.length || i.some(({ debut: e, fin: t }) => !ya(e) || !ya(t) || e >= t)) continue;
22391
22512
  let a = i.filter(({ debut: e, fin: t }) => e <= n.dateReference && n.dateReference < t);
22392
22513
  a.length === 1 && a[0].id === n.articleId && (e.articleId = n.articleId);
22393
22514
  }
22394
22515
  let p = [...c].sort(), m = p.length === 0 ? [] : await e`
22395
22516
  SELECT id, num, data FROM legifrance.article WHERE id = ANY(${e.array(p)}) ORDER BY id
22396
- `, h = (e) => JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e.localeCompare(t))) : t), g = M("sha256").update(h({
22517
+ `, h = (e) => JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e.localeCompare(t))) : t), g = j("sha256").update(h({
22397
22518
  titles: o.map(h).sort(),
22398
22519
  articles: m
22399
22520
  })).digest("hex");
@@ -22404,27 +22525,27 @@ async function pa(e, t, n) {
22404
22525
  };
22405
22526
  });
22406
22527
  }
22407
- async function ma(e, t, n) {
22408
- return na({
22409
- document: ua(e),
22528
+ async function xa(e, t, n) {
22529
+ return la({
22530
+ document: _a(e),
22410
22531
  resolve: t,
22411
22532
  textTitlesInfos: n
22412
22533
  });
22413
22534
  }
22414
22535
  //#endregion
22415
22536
  //#region src/lib/server/jurisprudence_store.ts
22416
- async function ha(e, t) {
22537
+ async function Sa(e, t) {
22417
22538
  if (!t || t.includes("\0")) throw Error("Schéma invalide");
22418
22539
  await e`CREATE TABLE IF NOT EXISTS ${e(`${t}.citations_jade`)} (path text PRIMARY KEY, extraction jsonb NOT NULL, traite_le timestamptz NOT NULL)`;
22419
22540
  }
22420
- async function ga(e, t, n = {}) {
22541
+ async function Ca(e, t, n = {}) {
22421
22542
  if (!t || t.includes("\0")) throw Error("Schéma invalide");
22422
22543
  let r = process.env.JURISPRUDENCE_MAX_EXTRACTIONS_ARTICLE, i = n.maxExtractionsArticle ?? (r === void 0 ? 100 : Number(r));
22423
22544
  if (!Number.isSafeInteger(i) || i < 1 || i > 1e3) throw Error("Limite de consultations JADE invalide (1 à 1000)");
22424
22545
  let a = e(`${t}.citations_jade`);
22425
22546
  return {
22426
22547
  async capture(t, n) {
22427
- let r = await pa(e, t, n), [i] = await e`
22548
+ let r = await ba(e, t, n), [i] = await e`
22428
22549
  INSERT INTO ${a} (path, extraction, traite_le)
22429
22550
  VALUES (${t}, ${e.json(r)}, clock_timestamp())
22430
22551
  ON CONFLICT (path) DO UPDATE SET extraction = excluded.extraction, traite_le = excluded.traite_le
@@ -22435,7 +22556,7 @@ async function ga(e, t, n = {}) {
22435
22556
  };
22436
22557
  },
22437
22558
  async consultDecision(t) {
22438
- return C(e, async (e) => {
22559
+ return y(e, async (e) => {
22439
22560
  let [n] = await e`
22440
22561
  SELECT extraction, traite_le::text AS "traiteLe" FROM ${a} WHERE path = ${t}`;
22441
22562
  return n ? {
@@ -22448,7 +22569,7 @@ async function ga(e, t, n = {}) {
22448
22569
  });
22449
22570
  },
22450
22571
  async consultArticle(t) {
22451
- return C(e, async (e) => {
22572
+ return y(e, async (e) => {
22452
22573
  if ((await e`
22453
22574
  SELECT path FROM ${a} ORDER BY path LIMIT ${i + 1}`).length > i) throw Error(`Consultation JADE indisponible : limite de ${i} extractions dépassée`);
22454
22575
  let n = await e`
@@ -22472,7 +22593,7 @@ async function ga(e, t, n = {}) {
22472
22593
  });
22473
22594
  },
22474
22595
  async byDecision(t) {
22475
- return C(e, async (e) => {
22596
+ return y(e, async (e) => {
22476
22597
  let [n] = await e`
22477
22598
  SELECT extraction, traite_le::text AS "traiteLe" FROM ${a} WHERE path = ${t}`;
22478
22599
  return n ? {
@@ -22482,7 +22603,7 @@ async function ga(e, t, n = {}) {
22482
22603
  });
22483
22604
  },
22484
22605
  async byArticle(t) {
22485
- return C(e, async (e) => {
22606
+ return y(e, async (e) => {
22486
22607
  let n = await e`
22487
22608
  SELECT path, extraction, traite_le::text AS "traiteLe" FROM ${a} ORDER BY path`, r = [];
22488
22609
  for (let e of n) e.extraction.citations.some((e) => e.articleId === t) && r.push({
@@ -22497,7 +22618,7 @@ async function ga(e, t, n = {}) {
22497
22618
  }
22498
22619
  //#endregion
22499
22620
  //#region src/lib/server/jurisprudence_consultation.ts
22500
- function _a(e) {
22621
+ function wa(e) {
22501
22622
  let { document: t, citations: n, perimetre: r, traiteLe: i, referenceRevision: a } = e;
22502
22623
  return {
22503
22624
  decision: {
@@ -22520,15 +22641,15 @@ function _a(e) {
22520
22641
  ...e.selection ? Array.isArray(e.selection) ? { selectionsReference: e.selection } : { selectionReference: e.selection } : {}
22521
22642
  };
22522
22643
  }
22523
- async function va(e, t, n = {}) {
22524
- let r = await ga(e, t, n);
22644
+ async function Ta(e, t, n = {}) {
22645
+ let r = await Ca(e, t, n);
22525
22646
  return {
22526
22647
  async parDecision(e) {
22527
22648
  if (e.dataset !== "JADE" || !e.path.trim()) throw Error("Identité de décision JADE invalide");
22528
22649
  let t = await r.consultDecision(e.path);
22529
22650
  return t.etat === "capture" ? {
22530
22651
  etat: "capture",
22531
- resultat: _a(t.resultat)
22652
+ resultat: wa(t.resultat)
22532
22653
  } : t;
22533
22654
  },
22534
22655
  async parArticle(e) {
@@ -22536,8 +22657,8 @@ async function va(e, t, n = {}) {
22536
22657
  let t = await r.consultArticle(e.articleId);
22537
22658
  return {
22538
22659
  ...t,
22539
- resultats: t.resultats.map(_a),
22540
- resultatsPossibles: t.resultatsPossibles.map(_a),
22660
+ resultats: t.resultats.map(wa),
22661
+ resultatsPossibles: t.resultatsPossibles.map(wa),
22541
22662
  couverture: "inconnue",
22542
22663
  fraicheur: "non-verifiee"
22543
22664
  };
@@ -22545,4 +22666,4 @@ async function va(e, t, n = {}) {
22545
22666
  };
22546
22667
  }
22547
22668
  //#endregion
22548
- export { Te as LegiResolver, Qi as addLinksOrReferencesToHtmlFile, $i as addPositionsToTableOfContentsFile, Ce as buildAndInstallTextTitlesInfos, we as buildTextTitlesInfos, va as createJurisprudenceConsultation, ga as createJurisprudenceStore, ta as createLegiResolver, Ne as extractAssembleeAmendmentSearchItems, dr as extractAssembleeExposesDesMotifs, gr as extractSenatAmendmentSearchItems, Pe as hashAssembleeAmendmentSearchItem, pr as hashAssembleeSearchItem, _r as hashSenatAmendmentSearchItem, bi as hashSenatSearchItem, ha as initializeJurisprudenceStore, Ei as isAkomaNtosoXml, mr as isoDateFromAssembleeDocument, sr as linkAkomaNtosoBillRaw, hn as linkAssembleeBillRaw, or as parseAkomaNtosoBillRaw, gi as parseAmendment, mn as parseAssembleeBillRaw, fr as parseAssembleeDocumentSearchContent, yi as parseSenatDocumentSearchContent, Yi as readTransformation, nr as renderAkomaNtosoBillRaw, Ti as resolveSenatAkomaNtosoSource, ea as simplifiedHtmlBillFileToTableOfContentsFile, Wi as simplifyWordHtml, Ji as simplifyWordHtmlToDocument, Zi as writeTransformation };
22669
+ export { De as LegiResolver, aa as addLinksOrReferencesToHtmlFile, oa as addPositionsToTableOfContentsFile, Ce as buildAndInstallTextTitlesInfos, Ee as buildTextTitlesInfos, Ta as createJurisprudenceConsultation, Ca as createJurisprudenceStore, ca as createLegiResolver, Fe as extractAssembleeAmendmentSearchItems, yr as extractAssembleeExposesDesMotifs, wr as extractSenatAmendmentSearchItems, Ie as hashAssembleeAmendmentSearchItem, xr as hashAssembleeSearchItem, Tr as hashSenatAmendmentSearchItem, Di as hashSenatSearchItem, Sa as initializeJurisprudenceStore, Ni as isAkomaNtosoXml, Sr as isoDateFromAssembleeDocument, hr as linkAkomaNtosoBillRaw, Cn as linkAssembleeBillRaw, mr as parseAkomaNtosoBillRaw, Ci as parseAmendment, Sn as parseAssembleeBillRaw, br as parseAssembleeDocumentSearchContent, Ei as parseSenatDocumentSearchContent, na as readTransformation, ur as renderAkomaNtosoBillRaw, Mi as resolveSenatAkomaNtosoSource, sa as simplifiedHtmlBillFileToTableOfContentsFile, Zi as simplifyWordHtml, ta as simplifyWordHtmlToDocument, ia as writeTransformation };