@tricoteuses/tisseuse 0.21.2 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/{html-DWNF_0Ek.js → html-BTaoaqX5.js} +6688 -5737
- package/dist/index.js +72 -72
- package/dist/{src/lib → lib}/extractors/article_portions.d.ts +14 -0
- package/dist/{src/lib → lib}/extractors/links.d.ts +117 -3
- package/dist/{src/lib → lib}/f_legi/resolver.d.ts +23 -4
- package/dist/lib/legi/article_abrogation.d.ts +25 -0
- package/dist/lib/legi/article_history.d.ts +11 -0
- package/dist/lib/legi/article_structure.d.ts +9 -0
- package/dist/{src/lib → lib}/legi/canutes_resolver.d.ts +17 -16
- package/dist/lib/legi/law_article.d.ts +13 -0
- package/dist/lib/legi/named_text_article.d.ts +22 -0
- package/dist/lib/legi/publication_components.d.ts +22 -0
- package/dist/lib/legi/publication_components.fixture.d.ts +3 -0
- package/dist/{src/lib → lib}/legi/resolver.d.ts +40 -0
- package/dist/lib/linkers/enumeration_scope.fixture.d.ts +19 -0
- package/dist/{src/lib → lib}/linkers/html.d.ts +16 -3
- package/dist/lib/linkers/html_decision_capture.d.ts +18 -0
- package/dist/lib/linkers/link_decision_html.d.ts +4 -0
- package/dist/lib/linkers/link_decision_metadata.d.ts +15 -0
- package/dist/{src/lib → lib}/linkers/markdown.d.ts +7 -1
- package/dist/lib/linkers/named_text_article.d.ts +1 -0
- package/dist/lib/linkers/quoted_section.fixture.d.ts +1 -0
- package/dist/lib/linkers/table_column_texts.d.ts +4 -0
- package/dist/{src/lib → lib}/server/parsed_bills.d.ts +19 -0
- package/dist/{src/lib → lib}/text_parsers/ast.d.ts +13 -3
- package/dist/lib/text_parsers/historical_versions.d.ts +18 -0
- package/dist/{src/lib → lib}/text_parsers/parsers.d.ts +2 -0
- package/dist/{src/lib → lib}/text_parsers/repeated_actions.d.ts +1 -0
- package/dist/{src/lib → lib}/text_parsers/texts.d.ts +12 -0
- package/dist/link-decision-metadata.js +32 -0
- package/dist/{resolver-BBrU9oGB.js → resolver-GT7457lQ.js} +316 -127
- package/dist/scripts/enrich_assemblee_documents.d.ts +1 -0
- package/dist/scripts/enrich_senat_documents.d.ts +1 -0
- package/dist/scripts/html_document_to_text.d.ts +1 -0
- package/dist/scripts/index_postgres_assemblee_amendments.d.ts +1 -0
- package/dist/scripts/index_postgres_assemblee_texts.d.ts +1 -0
- package/dist/scripts/index_postgres_judilibre.d.ts +1 -0
- package/dist/scripts/index_postgres_legifrance_articles.d.ts +1 -0
- package/dist/scripts/index_postgres_legifrance_jurisprudence.d.ts +1 -0
- package/dist/scripts/index_postgres_senat_amendments.d.ts +1 -0
- package/dist/scripts/index_postgres_senat_texts.d.ts +1 -0
- package/dist/scripts/parse_akoma_ntoso_bill_raw.d.ts +1 -0
- package/dist/scripts/parse_assemblee_bill_raw.d.ts +1 -0
- package/dist/scripts/profile_assemblee_document_parsing.d.ts +1 -0
- package/dist/scripts/profile_canutes_bill.d.ts +1 -0
- package/dist/scripts/replay_linker_scope.d.ts +1 -0
- package/dist/scripts/shared/assemblee_legislature.test.d.ts +1 -0
- package/dist/scripts/shared/checkpoint_cli_options.test.d.ts +1 -0
- package/dist/scripts/simplified_html_bill_to_table_of_contents.d.ts +1 -0
- package/dist/scripts/simplify_word_html.d.ts +1 -0
- package/dist/scripts/sync_postgres_assemblee_document_content.d.ts +1 -0
- package/dist/scripts/sync_postgres_senat_document_content.d.ts +1 -0
- package/dist/scripts/test_canutes_titles_cache.d.ts +1 -0
- package/dist/scripts/warm_canutes_text_titles_cache.d.ts +1 -0
- package/dist/server-f-legi.js +200 -94
- package/dist/server.js +1080 -959
- package/package.json +9 -4
- package/dist/{src/lib → lib}/alineas/alineas_numbers.d.ts +0 -0
- package/dist/{src/lib → lib}/article_temporal_status.test.d.ts +0 -0
- package/dist/{src/lib → lib}/articles.d.ts +0 -0
- package/dist/{src/lib → lib}/articles.test.d.ts +0 -0
- package/dist/{src/lib → lib}/assemblee_document_date.d.ts +0 -0
- package/dist/{src/lib → lib}/assemblee_document_date.test.d.ts +0 -0
- package/dist/{src/lib → lib}/asserts.d.ts +0 -0
- package/dist/{src/lib → lib}/cache.d.ts +0 -0
- package/dist/{src/lib → lib}/dates.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/action_directives.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/action_directives.test.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/action_directives_cpu.test.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/article_action_effects.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/article_action_effects.test.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/article_action_effects_long.test.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/article_action_targets.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/article_action_targets.test.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/article_portions.test.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/definitions.d.ts +0 -0
- package/dist/{src/lib/extractors/links.citation_scope.test.d.ts → lib/extractors/link_decisions.test.d.ts} +0 -0
- package/dist/{src/lib/extractors/links.code_titles.test.d.ts → lib/extractors/links.citation_scope.test.d.ts} +0 -0
- package/dist/{src/lib/extractors/links.doctrinal.test.d.ts → lib/extractors/links.code_titles.test.d.ts} +0 -0
- package/dist/{src/lib/extractors/links.european.test.d.ts → lib/extractors/links.doctrinal.test.d.ts} +0 -0
- package/dist/{src/lib/extractors/links.test.d.ts → lib/extractors/links.european.test.d.ts} +0 -0
- package/dist/{src/lib/extractors/portion_references.test.d.ts → lib/extractors/links.test.d.ts} +0 -0
- package/dist/{src/lib → lib}/extractors/portion_references.d.ts +0 -0
- package/dist/{src/lib/extractors/portion_references_cpu.test.d.ts → lib/extractors/portion_references.test.d.ts} +0 -0
- package/dist/{src/lib/extractors/qualified_versions.test.d.ts → lib/extractors/portion_references_cpu.test.d.ts} +0 -0
- package/dist/{src/lib → lib}/extractors/qualified_versions.d.ts +0 -0
- package/dist/{src/lib/extractors/references.test.d.ts → lib/extractors/qualified_versions.test.d.ts} +0 -0
- package/dist/{src/lib → lib}/extractors/quoted_text.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/references.d.ts +0 -0
- package/dist/{src/lib/text_parsers → lib/extractors}/references.test.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/table_of_contents.d.ts +0 -0
- package/dist/{src/lib → lib}/extractors/table_of_contents.test.d.ts +0 -0
- package/dist/{src/lib → lib}/f_legi/resolver.test.d.ts +0 -0
- package/dist/{src/lib → lib}/index.d.ts +0 -0
- package/dist/{src/lib → lib}/json.d.ts +0 -0
- package/dist/{src/lib/legi/canutes_article_preload.test.d.ts → lib/legi/article_abrogation.test.d.ts} +0 -0
- package/dist/{src/lib/legi/canutes_candidates.test.d.ts → lib/legi/article_history.test.d.ts} +0 -0
- package/dist/{src/lib/legi/canutes_resolver.test.d.ts → lib/legi/canutes_article_preload.test.d.ts} +0 -0
- package/dist/{src/lib/legi/canutes_resolver_cache.test.d.ts → lib/legi/canutes_candidates.test.d.ts} +0 -0
- package/dist/{src/lib/legi/canutes_resolver_europe.test.d.ts → lib/legi/canutes_resolver.test.d.ts} +0 -0
- package/dist/{src/lib/legi/canutes_root_cid_index.integration.test.d.ts → lib/legi/canutes_resolver_cache.test.d.ts} +0 -0
- package/dist/{src/lib/legi/canutes_section_roots.test.d.ts → lib/legi/canutes_resolver_europe.test.d.ts} +0 -0
- 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
- package/dist/{src/lib/legi/resolver.test.d.ts → lib/legi/canutes_section_roots.test.d.ts} +0 -0
- package/dist/{src/lib → lib}/legi/canutes_sql.d.ts +0 -0
- package/dist/{src/lib → lib}/legi/canutes_text_titles_cache.d.ts +0 -0
- package/dist/{src/lib/linkers/cited-article.test.d.ts → lib/legi/canutes_text_titles_cache.integration.test.d.ts} +0 -0
- package/dist/{src/lib → lib}/legi/canutes_titles_metrics.d.ts +0 -0
- package/dist/{src/lib/linkers/reference-mode.test.d.ts → lib/legi/modifying_act_article_real.test.d.ts} +0 -0
- package/dist/{src/lib/server/administrative_acts_autocompletion.test.d.ts → lib/legi/publication_components.test.d.ts} +0 -0
- package/dist/{src/lib/server/akn_rendering.test.d.ts → lib/legi/resolver.test.d.ts} +0 -0
- package/dist/{src/lib → lib}/legi/text_titles_infos.d.ts +0 -0
- package/dist/{src/lib/server/ameli_autocompletion.test.d.ts → lib/linkers/ambiguous_publication.test.d.ts} +0 -0
- package/dist/{src/lib/server/assemblee_amendment_search.test.d.ts → lib/linkers/cited-article.test.d.ts} +0 -0
- package/dist/{src/lib/server/assemblee_document_search.test.d.ts → lib/linkers/enumeration_scope.test.d.ts} +0 -0
- package/dist/{src/lib/server/atomic_files.test.d.ts → lib/linkers/html_decision_capture.test.d.ts} +0 -0
- package/dist/{src/lib/server/bill_action_resolver_invariance.test.d.ts → lib/linkers/html_named_text_article.test.d.ts} +0 -0
- package/dist/{src/lib/server/bill_citation_anaphora.test.d.ts → lib/linkers/html_publication_93_859_real.test.d.ts} +0 -0
- package/dist/{src/lib/server/bill_comparison.test.d.ts → lib/linkers/html_structure_real.test.d.ts} +0 -0
- package/dist/{src/lib/server/bill_target_scope.test.d.ts → lib/linkers/html_undecidable_real.test.d.ts} +0 -0
- package/dist/{src/lib/server/bofip_autocompletion.test.d.ts → lib/linkers/link_decision_html.test.d.ts} +0 -0
- package/dist/{src/lib/server/boss_autocompletion.test.d.ts → lib/linkers/named_text_article.test.d.ts} +0 -0
- package/dist/{src/lib/server/canutes_only_compatibility.test.d.ts → lib/linkers/quoted_section_scope.test.d.ts} +0 -0
- package/dist/{src/lib/server/document_git_checkpoint.test.d.ts → lib/linkers/reference-mode.test.d.ts} +0 -0
- package/dist/{src/lib → lib}/links.d.ts +6 -6
- /package/dist/{src/lib/server/enriched_document_checkpoint.test.d.ts → lib/links.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/loaders/assemblee.d.ts +0 -0
- /package/dist/{src/lib → lib}/loaders/legifrance.d.ts +0 -0
- /package/dist/{src/lib → lib}/markdown.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/administrative_acts_autocompletion.d.ts +0 -0
- /package/dist/{src/lib/server/europe_autocompletion.test.d.ts → lib/server/administrative_acts_autocompletion.test.d.ts} +0 -0
- /package/dist/{src/lib/server/flegi_profiling.test.d.ts → lib/server/akn_rendering.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/alineas/alineas_images_utils.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/ameli_autocompletion.d.ts +0 -0
- /package/dist/{src/lib/server/html_simplifier.test.d.ts → lib/server/ameli_autocompletion.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/assemblee_amendment_search.d.ts +0 -0
- /package/dist/{src/lib/server/international_treaties_autocompletion.test.d.ts → lib/server/assemblee_amendment_search.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/assemblee_document_search.d.ts +0 -0
- /package/dist/{src/lib/server/judilibre_search.test.d.ts → lib/server/assemblee_document_search.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/atomic_files.d.ts +0 -0
- /package/dist/{src/lib/server/jurisprudence_citations.test.d.ts → lib/server/atomic_files.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/auditors/config.d.ts +0 -0
- /package/dist/{src/lib/server/jurisprudence_jade.test.d.ts → lib/server/bill_action_resolver_invariance.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/bill_action_target_fixtures.d.ts +0 -0
- /package/dist/{src/lib/server/jurisprudence_store.integration.test.d.ts → lib/server/bill_citation_anaphora.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/bill_comparison.d.ts +0 -0
- /package/dist/{src/lib/server/jurisprudence_store_closed.test.d.ts → lib/server/bill_comparison.test.d.ts} +0 -0
- /package/dist/{src/lib/server/legifrance_article_search.test.d.ts → lib/server/bill_target_scope.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/bofip_autocompletion.d.ts +0 -0
- /package/dist/{src/lib/server/legifrance_jurisprudence_search.test.d.ts → lib/server/bofip_autocompletion.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/boss_autocompletion.d.ts +0 -0
- /package/dist/{src/lib/server/local_acts_autocompletion.test.d.ts → lib/server/boss_autocompletion.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/canutes_legacy_candidates.d.ts +0 -0
- /package/dist/{src/lib/server/masquage-typesense.test.d.ts → lib/server/canutes_only_compatibility.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/config.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/databases/canutes_root_cid_index.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/databases/canutes_text_titles_cache.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/databases/index.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/document_git_checkpoint.d.ts +0 -0
- /package/dist/{src/lib/server/parsed_amendments.test.d.ts → lib/server/document_git_checkpoint.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/enriched_document_checkpoint.d.ts +0 -0
- /package/dist/{src/lib/server/parsed_bills.test.d.ts → lib/server/enriched_document_checkpoint.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/europe_autocompletion.d.ts +0 -0
- /package/dist/{src/lib/server/raa_autocompletion.test.d.ts → lib/server/europe_autocompletion.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/f_legi/index.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/flegi_profiling.d.ts +0 -0
- /package/dist/{src/lib/server/senat_amendment_search.test.d.ts → lib/server/flegi_profiling.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/html_simplifier.d.ts +0 -0
- /package/dist/{src/lib/server/senat_document_search.test.d.ts → lib/server/html_simplifier.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/index.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/international_treaties_autocompletion.d.ts +0 -0
- /package/dist/{src/lib/server/shared_legal_text_sections.test.d.ts → lib/server/international_treaties_autocompletion.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/judilibre_search.d.ts +0 -0
- /package/dist/{src/lib/server/sql_profiling.test.d.ts → lib/server/judilibre_search.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/jurisprudence_citations.d.ts +0 -0
- /package/dist/{src/lib/server/sync_administrative_act_titles.test.d.ts → lib/server/jurisprudence_citations.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/jurisprudence_consultation.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/jurisprudence_jade.d.ts +0 -0
- /package/dist/{src/lib/server/sync_assemblee_legal_texts.test.d.ts → lib/server/jurisprudence_jade.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/jurisprudence_store.d.ts +0 -0
- /package/dist/{src/lib/server/sync_local_act_titles.test.d.ts → lib/server/jurisprudence_store.integration.test.d.ts} +0 -0
- /package/dist/{src/lib/server/typesense_blue_green.test.d.ts → lib/server/jurisprudence_store_closed.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/legi/resolvers.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/legifrance_article_search.d.ts +0 -0
- /package/dist/{src/lib/server/typesense_index_lock.test.d.ts → lib/server/legifrance_article_search.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/legifrance_jurisprudence_search.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/action_citation_patterns.test.d.ts → lib/server/legifrance_jurisprudence_search.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/linkers/html.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/local_acts_autocompletion.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/action_directives.test.d.ts → lib/server/local_acts_autocompletion.test.d.ts} +0 -0
- /package/dist/{src/lib/text_parsers/action_occurrences.test.d.ts → lib/server/masquage-typesense.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/masquage_typesense.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/action_position_cues.test.d.ts → lib/server/named_text_article_decisions.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/parsed_amendments.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/action_words.test.d.ts → lib/server/parsed_amendments.test.d.ts} +0 -0
- /package/dist/{src/lib/text_parsers/actions.test.d.ts → lib/server/parsed_bill_abrogation.test.d.ts} +0 -0
- /package/dist/{src/lib/text_parsers/articles.test.d.ts → lib/server/parsed_bill_future_consultation.test.d.ts} +0 -0
- /package/dist/{src/lib/text_parsers/citations.test.d.ts → lib/server/parsed_bill_link_decisions.test.d.ts} +0 -0
- /package/dist/{src/lib/text_parsers/dates.test.d.ts → lib/server/parsed_bills.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/raa_autocompletion.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/divisions.test.d.ts → lib/server/raa_autocompletion.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/senat_amendment_search.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/doctrinal_references.test.d.ts → lib/server/senat_amendment_search.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/senat_document_search.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/numbers.test.d.ts → lib/server/senat_document_search.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/senat_document_sources.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/shared_legal_text_sections.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/parsers.test.d.ts → lib/server/shared_legal_text_sections.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/sql_profiling.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/portions.test.d.ts → lib/server/sql_profiling.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/sync_administrative_act_titles.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/prepositions.test.d.ts → lib/server/sync_administrative_act_titles.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/sync_ameli_titles.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/sync_assemblee_legal_texts.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/relative_locations.test.d.ts → lib/server/sync_assemblee_legal_texts.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/sync_boss_titles.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/sync_europe_titles.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/sync_international_treaty_titles.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/sync_local_act_titles.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/repeated_actions.test.d.ts → lib/server/sync_local_act_titles.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/sync_raa_titles.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/tables_of_contents.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/text_parsers/transformers.d.ts +0 -0
- /package/dist/{src/lib → lib}/server/typesense_blue_green.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/search_queries.test.d.ts → lib/server/typesense_blue_green.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/server/typesense_index_lock.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/simplifiers.test.d.ts → lib/server/typesense_index_lock.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/test/text_titles_infos.d.ts +0 -0
- /package/dist/{src/lib → lib}/text_parsers/action_citation_patterns.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/texts.test.d.ts → lib/text_parsers/action_citation_patterns.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/action_directives.d.ts +0 -0
- /package/dist/{src/lib/text_parsers/typography.test.d.ts → lib/text_parsers/action_directives.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/action_occurrences.d.ts +0 -0
- /package/dist/{src/scripts/add_links_to_assemblee_parsed_documents.d.ts → lib/text_parsers/action_occurrences.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/action_position_cues.d.ts +0 -0
- /package/dist/{src/scripts/add_links_to_html_document.d.ts → lib/text_parsers/action_position_cues.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/action_target_scopes.d.ts +0 -0
- /package/dist/{src/lib → lib}/text_parsers/action_words.d.ts +0 -0
- /package/dist/{src/scripts/add_links_to_legifrance.d.ts → lib/text_parsers/action_words.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/actions.d.ts +0 -0
- /package/dist/{src/scripts/add_links_to_senat_comptes_rendus.d.ts → lib/text_parsers/actions.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/amendment_action_directives.d.ts +0 -0
- /package/dist/{src/lib → lib}/text_parsers/articles.d.ts +0 -0
- /package/dist/{src/scripts/add_links_to_senat_parsed_documents.d.ts → lib/text_parsers/articles.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/citations.d.ts +0 -0
- /package/dist/{src/scripts/alimenter_jurisprudence_pilote.d.ts → lib/text_parsers/citations.test.d.ts} +0 -0
- /package/dist/{src/scripts/associate_jorf_textes_with_assemblee_commissions.d.ts → lib/text_parsers/code_annexes.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/dates.d.ts +0 -0
- /package/dist/{src/scripts/associate_jorf_textes_with_dossiers_legislatifs_assemblee.d.ts → lib/text_parsers/dates.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/divisions.d.ts +0 -0
- /package/dist/{src/scripts/compare_legi_bills.d.ts → lib/text_parsers/divisions.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/doctrinal_references.d.ts +0 -0
- /package/dist/{src/scripts/configure_postgres_assemblee_document_triggers.d.ts → lib/text_parsers/doctrinal_references.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/fragments.d.ts +0 -0
- /package/dist/{src/lib → lib}/text_parsers/helpers.d.ts +0 -0
- /package/dist/{src/scripts/configure_postgres_legi_resolver.d.ts → lib/text_parsers/historical_versions.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/legal_text_aliases.d.ts +0 -0
- /package/dist/{src/lib → lib}/text_parsers/numbers.d.ts +0 -0
- /package/dist/{src/scripts/configure_postgres_root_cid_index.d.ts → lib/text_parsers/numbers.test.d.ts} +0 -0
- /package/dist/{src/scripts/configure_postgres_senat_document_triggers.d.ts → lib/text_parsers/parsers.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/portions.d.ts +0 -0
- /package/dist/{src/scripts/enrich_assemblee_documents.d.ts → lib/text_parsers/portions.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/prepositions.d.ts +0 -0
- /package/dist/{src/scripts/enrich_senat_documents.d.ts → lib/text_parsers/prepositions.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/qualified_versions.d.ts +0 -0
- /package/dist/{src/lib → lib}/text_parsers/references.d.ts +0 -0
- /package/dist/{src/scripts/html_document_to_text.d.ts → lib/text_parsers/references.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/relative_locations.d.ts +0 -0
- /package/dist/{src/scripts/index_postgres_assemblee_amendments.d.ts → lib/text_parsers/relative_locations.test.d.ts} +0 -0
- /package/dist/{src/scripts/index_postgres_assemblee_texts.d.ts → lib/text_parsers/repeated_actions.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/search_queries.d.ts +0 -0
- /package/dist/{src/scripts/index_postgres_judilibre.d.ts → lib/text_parsers/search_queries.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/separators.d.ts +0 -0
- /package/dist/{src/lib → lib}/text_parsers/simplifiers.d.ts +0 -0
- /package/dist/{src/scripts/index_postgres_legifrance_articles.d.ts → lib/text_parsers/simplifiers.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/table_row_targets.d.ts +0 -0
- /package/dist/{src/lib → lib}/text_parsers/table_unit_notes.d.ts +0 -0
- /package/dist/{src/scripts/index_postgres_legifrance_jurisprudence.d.ts → lib/text_parsers/texts.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/text_parsers/transformers.d.ts +0 -0
- /package/dist/{src/lib → lib}/text_parsers/typography.d.ts +0 -0
- /package/dist/{src/scripts/index_postgres_senat_amendments.d.ts → lib/text_parsers/typography.test.d.ts} +0 -0
- /package/dist/{src/lib → lib}/textes.d.ts +0 -0
- /package/dist/{src/lib → lib}/timings.d.ts +0 -0
- /package/dist/{src/scripts/index_postgres_senat_texts.d.ts → scripts/add_links_to_assemblee_parsed_documents.d.ts} +0 -0
- /package/dist/{src/scripts/parse_akoma_ntoso_bill_raw.d.ts → scripts/add_links_to_html_document.d.ts} +0 -0
- /package/dist/{src/scripts/parse_assemblee_bill_raw.d.ts → scripts/add_links_to_legifrance.d.ts} +0 -0
- /package/dist/{src/scripts/profile_assemblee_document_parsing.d.ts → scripts/add_links_to_senat_comptes_rendus.d.ts} +0 -0
- /package/dist/{src/scripts/profile_canutes_bill.d.ts → scripts/add_links_to_senat_parsed_documents.d.ts} +0 -0
- /package/dist/{src/scripts → scripts}/add_positions_to_table_of_contents.d.ts +0 -0
- /package/dist/{src/scripts → scripts}/add_references_to_html_document.d.ts +0 -0
- /package/dist/{src/scripts/shared/assemblee_legislature.test.d.ts → scripts/alimenter_jurisprudence_pilote.d.ts} +0 -0
- /package/dist/{src/scripts/shared/checkpoint_cli_options.test.d.ts → scripts/associate_jorf_textes_with_assemblee_commissions.d.ts} +0 -0
- /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
- /package/dist/{src/scripts → scripts}/audit_doctrinal_references.d.ts +0 -0
- /package/dist/{src/scripts/simplify_word_html.d.ts → scripts/compare_legi_bills.d.ts} +0 -0
- /package/dist/{src/scripts → scripts}/configure.d.ts +0 -0
- /package/dist/{src/scripts/sync_postgres_assemblee_document_content.d.ts → scripts/configure_postgres_assemblee_document_triggers.d.ts} +0 -0
- /package/dist/{src/scripts/sync_postgres_senat_document_content.d.ts → scripts/configure_postgres_legi_resolver.d.ts} +0 -0
- /package/dist/{src/scripts/test_canutes_titles_cache.d.ts → scripts/configure_postgres_root_cid_index.d.ts} +0 -0
- /package/dist/{src/scripts/warm_canutes_text_titles_cache.d.ts → scripts/configure_postgres_senat_document_triggers.d.ts} +0 -0
- /package/dist/{src/scripts → scripts}/extract_alineas_images.d.ts +0 -0
- /package/dist/{src/scripts → scripts}/generate_alineas_numbers_review.d.ts +0 -0
- /package/dist/{src/scripts → scripts}/index_typesense.d.ts +0 -0
- /package/dist/{src/scripts → scripts}/merge_reviewed_alineas_numbers.d.ts +0 -0
- /package/dist/{src/scripts → scripts}/set_articles_missing_num.d.ts +0 -0
- /package/dist/{src/scripts → scripts}/shared/assemblee_legislature.d.ts +0 -0
- /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,
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
4
|
-
import { createHash as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
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
|
|
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
|
|
16
|
+
function Ne(e) {
|
|
17
17
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
19
|
+
function Pe(e) {
|
|
20
|
+
return Ne(b(e).text());
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
let t =
|
|
24
|
-
|
|
22
|
+
function Fe(e) {
|
|
23
|
+
let t = Ne([
|
|
24
|
+
Me(e, [
|
|
25
25
|
"corps",
|
|
26
26
|
"contenuAuteur",
|
|
27
27
|
"dispositif"
|
|
28
28
|
]),
|
|
29
|
-
|
|
29
|
+
Me(e, [
|
|
30
30
|
"corps",
|
|
31
31
|
"contenuAuteur",
|
|
32
32
|
"dispositifAmdtCreditPLF"
|
|
33
33
|
]),
|
|
34
|
-
|
|
34
|
+
Me(e, [
|
|
35
35
|
"corps",
|
|
36
36
|
"contenuAuteur",
|
|
37
37
|
"dispositifAmdtCreditPLFR"
|
|
38
38
|
])
|
|
39
|
-
].filter((e) => e !== null).map((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 ? "" :
|
|
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
|
|
55
|
-
return
|
|
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
|
|
62
|
+
function N(e) {
|
|
63
63
|
switch (e.type) {
|
|
64
|
-
case "reference_et_action": return
|
|
65
|
-
case "enumeration": return [...
|
|
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 = [...
|
|
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 ? [] :
|
|
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
|
|
93
|
-
if (
|
|
94
|
-
let
|
|
95
|
-
if (
|
|
96
|
-
let
|
|
97
|
-
return
|
|
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:
|
|
100
|
-
start: (n === 0 ?
|
|
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:
|
|
103
|
+
actionPosition: o(t.position)
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
if (
|
|
108
|
-
let
|
|
109
|
-
if (
|
|
110
|
-
let
|
|
111
|
-
if (
|
|
112
|
-
let n =
|
|
113
|
-
return n.article.num !== e.article.num || n.article.position.start !== e.article.position.start || n.article.position.stop !== e.article.position.stop || !
|
|
114
|
-
}) ? null :
|
|
115
|
-
targetId: n
|
|
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
|
-
...
|
|
117
|
+
...i,
|
|
118
118
|
reference: t.reference,
|
|
119
|
-
portionSelectors:
|
|
119
|
+
portionSelectors: fe(t.reference),
|
|
120
120
|
tableTarget: {
|
|
121
121
|
type: "table",
|
|
122
|
-
rowIndex:
|
|
123
|
-
rowEndIndex:
|
|
122
|
+
rowIndex: u[n].rowIndex,
|
|
123
|
+
rowEndIndex: u[n].rowEndIndex
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
126
|
sourceAnnotation: {
|
|
127
127
|
sourceText: e,
|
|
128
|
-
referencePosition:
|
|
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
|
|
136
|
-
if (
|
|
137
|
-
let t =
|
|
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
|
|
140
|
-
return !
|
|
141
|
-
targetId:
|
|
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:
|
|
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
|
-
...
|
|
152
|
-
reference:
|
|
151
|
+
...c[0],
|
|
152
|
+
reference: i.reference,
|
|
153
153
|
sourcePosition: {
|
|
154
154
|
start: 0,
|
|
155
|
-
stop:
|
|
155
|
+
stop: o.length
|
|
156
156
|
},
|
|
157
|
-
sourceText:
|
|
157
|
+
sourceText: o
|
|
158
158
|
}
|
|
159
159
|
}];
|
|
160
160
|
}
|
|
161
|
-
let
|
|
162
|
-
for (let e = 1; e <
|
|
163
|
-
let t =
|
|
164
|
-
t.type !== "reference_et_action" ||
|
|
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
|
-
|
|
167
|
-
let
|
|
168
|
-
for (let t of
|
|
169
|
-
let
|
|
170
|
-
if (
|
|
171
|
-
|
|
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
|
|
175
|
-
if (
|
|
176
|
-
let
|
|
177
|
-
for (let t of
|
|
178
|
-
let
|
|
179
|
-
if (!
|
|
180
|
-
|
|
181
|
-
targetId:
|
|
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:
|
|
185
|
-
actionPosition:
|
|
186
|
-
start:
|
|
187
|
-
stop:
|
|
184
|
+
referencePosition: s(t.reference.position),
|
|
185
|
+
actionPosition: s({
|
|
186
|
+
start: a,
|
|
187
|
+
stop: l
|
|
188
188
|
})
|
|
189
189
|
},
|
|
190
190
|
directive: {
|
|
191
|
-
...
|
|
192
|
-
sourceText:
|
|
191
|
+
...d,
|
|
192
|
+
sourceText: o,
|
|
193
193
|
sourcePosition: {
|
|
194
194
|
start: 0,
|
|
195
|
-
stop:
|
|
195
|
+
stop: o.length
|
|
196
196
|
},
|
|
197
197
|
reference: t.reference,
|
|
198
|
-
portionSelectors:
|
|
198
|
+
portionSelectors: fe(t.reference)
|
|
199
199
|
}
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
|
-
|
|
202
|
+
h = t + 1;
|
|
203
203
|
}
|
|
204
|
-
return
|
|
204
|
+
return g === r.length ? m : null;
|
|
205
205
|
}
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/lib/server/parsed_bills.ts
|
|
208
|
-
var
|
|
209
|
-
function
|
|
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
|
|
213
|
-
return
|
|
212
|
+
function F(e) {
|
|
213
|
+
return P(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return
|
|
215
|
+
function Be(e) {
|
|
216
|
+
return f(P(e));
|
|
217
217
|
}
|
|
218
|
-
function
|
|
219
|
-
return `_TocArt${
|
|
218
|
+
function I(e) {
|
|
219
|
+
return `_TocArt${Be(e).replace(/\s+/gu, "")}`;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function Ve(e, t) {
|
|
222
222
|
return e(t).closest(".assnatTOC6,.assnatTOC5,.assnatTOC4").length > 0;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
return
|
|
224
|
+
function He(e) {
|
|
225
|
+
return F(e).replace(/[‐‑‒–—]/gu, "-").replace(/\s*\.\s*/gu, ".");
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
return
|
|
227
|
+
function Ue(e) {
|
|
228
|
+
return He(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
|
|
229
229
|
}
|
|
230
|
-
function
|
|
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
|
|
249
|
-
let t =
|
|
250
|
-
if (n?.[1] !== void 0) return
|
|
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
|
|
253
|
-
let 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 =
|
|
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
|
|
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)
|
|
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))
|
|
276
|
+
for (let e of Object.values(n)) qe(e, t);
|
|
277
277
|
return t;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function Je(e) {
|
|
280
280
|
if (typeof e != "object" || !e) return !1;
|
|
281
|
-
if (Array.isArray(e)) return e.some(
|
|
281
|
+
if (Array.isArray(e)) return e.some(Je);
|
|
282
282
|
let t = e;
|
|
283
|
-
return t.type === "bounded-interval" || Object.values(t).some(
|
|
283
|
+
return t.type === "bounded-interval" || Object.values(t).some(Je);
|
|
284
284
|
}
|
|
285
|
-
function
|
|
286
|
-
let t =
|
|
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
|
|
290
|
-
return
|
|
289
|
+
function Xe(e) {
|
|
290
|
+
return P(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
let n = new
|
|
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
|
|
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 :
|
|
304
|
+
return e.slice(t, r).trim().length > 0 ? null : Ze(e, r);
|
|
305
305
|
}
|
|
306
|
-
function
|
|
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 =
|
|
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 =
|
|
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
|
|
327
|
-
let 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
|
|
331
|
-
return
|
|
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
|
|
333
|
+
function L(e) {
|
|
334
334
|
return e?.type === "tag";
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function nt(e, t) {
|
|
337
337
|
return e.html(t) ?? "";
|
|
338
338
|
}
|
|
339
|
-
function
|
|
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 =
|
|
347
|
+
let u = P(e(i).text()), d = (e(i).attr("data-tisseuse-warning") ?? "").split(" ");
|
|
348
348
|
n.push({
|
|
349
349
|
id: c,
|
|
350
|
-
...
|
|
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
|
|
358
|
-
let r =
|
|
359
|
-
return (
|
|
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
|
|
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 (!
|
|
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 (
|
|
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
|
|
374
|
-
return t.map((t) =>
|
|
384
|
+
function st(e, t) {
|
|
385
|
+
return t.map((t) => P(e(t).text())).filter(Boolean).join("\n");
|
|
375
386
|
}
|
|
376
|
-
function
|
|
377
|
-
let
|
|
378
|
-
return !
|
|
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
|
|
381
|
-
return t.tagName === "p" && (/pastille/iu.test(e(t).attr("class") ?? "") || e(t).is("[data-pastille]")) && /^\(\d+\)$/u.test(
|
|
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
|
|
384
|
-
let t =
|
|
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) =>
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
430
|
+
return o ?? e;
|
|
413
431
|
}
|
|
414
|
-
function
|
|
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
|
|
434
|
+
return L(r) && L(n) && e(n).parents("table").get(0) === r ? r : L(n) ? n : t;
|
|
417
435
|
}
|
|
418
|
-
function
|
|
436
|
+
function pt(e, t, n, r, i) {
|
|
419
437
|
if (n.has(i.container)) return;
|
|
420
|
-
let a = i.id ??
|
|
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 =
|
|
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
|
|
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
|
|
461
|
+
function R(e, t) {
|
|
444
462
|
return e.get(t) ?? 2 ** 53 - 1;
|
|
445
463
|
}
|
|
446
|
-
function
|
|
447
|
-
if (!e(t).hasClass("assnat9ArticleNum") && !
|
|
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 (
|
|
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
|
|
455
|
-
return
|
|
456
|
-
...
|
|
457
|
-
title:
|
|
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
|
|
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 (
|
|
464
|
-
let
|
|
465
|
-
if (!
|
|
466
|
-
let
|
|
467
|
-
|
|
468
|
-
id:
|
|
469
|
-
...
|
|
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:
|
|
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
|
|
476
|
-
|
|
477
|
-
...
|
|
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 =
|
|
483
|
-
return t.sort((e, 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
|
|
486
|
-
if (
|
|
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
|
|
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 (
|
|
496
|
-
let
|
|
497
|
-
|
|
498
|
-
...
|
|
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
|
|
505
|
-
let t =
|
|
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 :
|
|
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
|
|
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
|
|
532
|
-
let t = new
|
|
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
|
|
553
|
+
function St(e) {
|
|
536
554
|
let t = [], n = e.map((e) => ({
|
|
537
555
|
heading: e,
|
|
538
|
-
token:
|
|
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 =
|
|
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
|
|
577
|
-
let t =
|
|
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
|
|
581
|
-
let n =
|
|
582
|
-
if (n.length === 0) return t &&
|
|
583
|
-
let i =
|
|
584
|
-
let n = new Set(e.map((e) => e.container)), r = new Set(e.map((e) =>
|
|
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 =
|
|
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) =>
|
|
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 &&
|
|
591
|
-
return t &&
|
|
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
|
|
611
|
+
function Tt(e) {
|
|
594
612
|
let t = e.next;
|
|
595
613
|
for (; t !== null;) {
|
|
596
|
-
if (
|
|
614
|
+
if (L(t)) return t;
|
|
597
615
|
t = t.next;
|
|
598
616
|
}
|
|
599
617
|
return null;
|
|
600
618
|
}
|
|
601
|
-
function
|
|
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
|
|
607
|
-
if (
|
|
608
|
-
let
|
|
609
|
-
if (
|
|
610
|
-
let
|
|
611
|
-
if (!(
|
|
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
|
-
...
|
|
614
|
-
|
|
631
|
+
...c === void 0 ? [] : [c],
|
|
632
|
+
l
|
|
615
633
|
];
|
|
616
634
|
}
|
|
617
|
-
function
|
|
635
|
+
function Dt(e, t, n, r = mt(e)) {
|
|
618
636
|
let i = [t.container], a = n?.container;
|
|
619
|
-
for (let 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 =
|
|
639
|
+
let o = Et(e, t, n);
|
|
622
640
|
if (o !== void 0) return o;
|
|
623
|
-
let s =
|
|
641
|
+
let s = R(r, t.container), c = a ? R(r, a) : -1;
|
|
624
642
|
return e("body > *").get().filter((e) => {
|
|
625
|
-
let t =
|
|
643
|
+
let t = R(r, e);
|
|
626
644
|
return t >= s && (c === -1 || t < c);
|
|
627
645
|
});
|
|
628
646
|
}
|
|
629
|
-
function
|
|
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") ||
|
|
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
|
|
655
|
+
function kt(e, t, n, r) {
|
|
638
656
|
let i = [], a = !1;
|
|
639
|
-
for (let o of
|
|
640
|
-
let n = e(o).is("table.akn-quoted-table") ?
|
|
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
|
-
|
|
643
|
-
let s = a ? "noise" :
|
|
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:
|
|
666
|
+
links: rt(e, o),
|
|
649
667
|
text: n,
|
|
650
|
-
html:
|
|
668
|
+
html: nt(e, o)
|
|
651
669
|
});
|
|
652
670
|
}
|
|
653
671
|
return i;
|
|
654
672
|
}
|
|
655
|
-
function
|
|
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
|
|
661
|
-
let t =
|
|
662
|
-
for (let e of
|
|
663
|
-
let r =
|
|
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") && !
|
|
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
|
-
|
|
767
|
+
L(r) && Ft(n, a, r);
|
|
670
768
|
}
|
|
671
|
-
a &&
|
|
769
|
+
a && It(n, a, e.element), i.attr("id", r), Ft(n, r, e.element);
|
|
672
770
|
}
|
|
673
771
|
}
|
|
674
|
-
let r =
|
|
772
|
+
let r = wt(t), i = mt(t);
|
|
675
773
|
for (let [e, a] of r.entries()) {
|
|
676
|
-
let o =
|
|
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 (
|
|
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
|
-
|
|
688
|
-
} else o &&
|
|
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
|
|
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 &&
|
|
795
|
+
r && Ft(t, r, n);
|
|
698
796
|
}
|
|
699
797
|
return t;
|
|
700
798
|
}
|
|
701
|
-
function
|
|
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
|
|
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
|
|
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
|
|
714
|
-
let n =
|
|
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 =
|
|
814
|
+
let t = tt(e.text);
|
|
717
815
|
return t.length > 0 && (n.includes(t) || t.includes(n));
|
|
718
816
|
});
|
|
719
817
|
}
|
|
720
|
-
function
|
|
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
|
|
724
|
-
return e?.
|
|
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
|
|
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 =
|
|
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
|
|
732
|
-
if (!
|
|
733
|
-
let
|
|
734
|
-
if (/[«»]/u.test(
|
|
735
|
-
let
|
|
736
|
-
if (!
|
|
737
|
-
let o = n
|
|
738
|
-
if (/^\s*(\d+)°/u.exec(
|
|
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) =>
|
|
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
|
|
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
|
-
|
|
865
|
+
h.set(f[e], i[0]);
|
|
755
866
|
}
|
|
756
|
-
let
|
|
757
|
-
for (let e of
|
|
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
|
-
|
|
871
|
+
g.push(...t);
|
|
761
872
|
}
|
|
762
|
-
if (!(
|
|
873
|
+
if (!(g.length === 0 || g.some((e) => !h.has(e)))) return [...new Set(g.map((e) => h.get(e)))];
|
|
763
874
|
}
|
|
764
|
-
function
|
|
765
|
-
let t =
|
|
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
|
|
780
|
-
let n =
|
|
890
|
+
function qt(e, t) {
|
|
891
|
+
let n = P(e);
|
|
781
892
|
if (!n) return;
|
|
782
|
-
let r =
|
|
893
|
+
let r = re(n);
|
|
783
894
|
return r ? r.level : n.endsWith(":") ? (t ?? -1) + 1 : void 0;
|
|
784
895
|
}
|
|
785
|
-
function
|
|
786
|
-
let t = /* @__PURE__ */ new Map(), n = [], r =
|
|
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 =
|
|
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
|
|
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
|
|
922
|
+
function Xt(e, t, n) {
|
|
812
923
|
if (!t) return;
|
|
813
|
-
let r =
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 ?
|
|
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
|
|
889
|
-
return `${e}\0${
|
|
999
|
+
function z(e, t) {
|
|
1000
|
+
return `${e}\0${He(t)}`;
|
|
890
1001
|
}
|
|
891
|
-
function
|
|
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:
|
|
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 :
|
|
1017
|
+
return a === void 0 ? void 0 : en(a, i.contextByBlockId, i.textIdsByBlockId);
|
|
907
1018
|
};
|
|
908
1019
|
}
|
|
909
|
-
function
|
|
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 =
|
|
913
|
-
return t === void 0 ? [] :
|
|
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 =
|
|
917
|
-
if (
|
|
918
|
-
let
|
|
919
|
-
if (![...
|
|
920
|
-
let
|
|
921
|
-
if (!
|
|
922
|
-
let
|
|
923
|
-
return
|
|
924
|
-
block:
|
|
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:
|
|
927
|
-
textId:
|
|
1037
|
+
nums: n,
|
|
1038
|
+
textId: l
|
|
928
1039
|
}];
|
|
929
1040
|
});
|
|
930
1041
|
if (l.length === 0) return /* @__PURE__ */ new Map();
|
|
931
|
-
let
|
|
932
|
-
if (![...
|
|
933
|
-
let
|
|
934
|
-
let
|
|
935
|
-
if (
|
|
936
|
-
let s =
|
|
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 =
|
|
939
|
-
return c === void 0 ? [] :
|
|
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:
|
|
942
|
-
if (![...
|
|
943
|
-
let
|
|
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
|
|
949
|
-
let n = performance.now(), r = performance.now(), i =
|
|
950
|
-
for (let t of e.blocks) t.qualifiedVersion =
|
|
951
|
-
let l = performance.now() - o, u = performance.now(), 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 =
|
|
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 =
|
|
965
|
-
(e.length > 0 ||
|
|
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
|
|
969
|
-
let n =
|
|
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
|
-
...
|
|
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
|
-
...
|
|
981
|
-
sourceContextBlockIds:
|
|
982
|
-
sourceContextPosition:
|
|
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
|
-
...
|
|
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
|
-
}),
|
|
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 (
|
|
993
|
-
let n =
|
|
994
|
-
if (n === void 0 && (n =
|
|
995
|
-
let n = e.directive, r = e.targetIds?.length === 1 && n.kind === "compound" ?
|
|
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
|
|
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() -
|
|
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
|
|
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 =
|
|
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${
|
|
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:${
|
|
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
|
|
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 ? [] : [[
|
|
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 ? [] : [...
|
|
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 =
|
|
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
|
|
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
|
|
1108
|
-
return e.flatMap((e) =>
|
|
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
|
|
1121
|
-
return
|
|
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
|
|
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
|
|
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
|
|
1256
|
+
function fn(e, t, n) {
|
|
1144
1257
|
return e.find((e) => t >= e.start && n <= e.stop);
|
|
1145
1258
|
}
|
|
1146
|
-
function
|
|
1147
|
-
let r =
|
|
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 =
|
|
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 =
|
|
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
|
|
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 ?
|
|
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:
|
|
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
|
|
1204
|
-
let n = new Map(e.flatMap((e) => [...
|
|
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
|
|
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
|
|
1249
|
-
let
|
|
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 ??
|
|
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
|
-
...
|
|
1373
|
+
...f,
|
|
1260
1374
|
directives: [],
|
|
1261
1375
|
...s?.length ? { diagnostics: s } : {}
|
|
1262
1376
|
};
|
|
1263
|
-
return
|
|
1377
|
+
return l.log({
|
|
1264
1378
|
articleCount: i.length,
|
|
1265
|
-
blockCount:
|
|
1379
|
+
blockCount: u,
|
|
1266
1380
|
directiveAnalysisIncluded: !1,
|
|
1267
|
-
directiveTextSize:
|
|
1381
|
+
directiveTextSize: d.length
|
|
1268
1382
|
}), e;
|
|
1269
1383
|
}
|
|
1270
|
-
let
|
|
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 =
|
|
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 }),
|
|
1278
|
-
...
|
|
1279
|
-
...
|
|
1280
|
-
...
|
|
1281
|
-
], { count:
|
|
1282
|
-
...
|
|
1283
|
-
...
|
|
1284
|
-
...
|
|
1285
|
-
directives:
|
|
1286
|
-
...
|
|
1287
|
-
...
|
|
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
|
|
1290
|
-
annotationCount:
|
|
1403
|
+
return l.log({
|
|
1404
|
+
annotationCount: C.length,
|
|
1291
1405
|
articleCount: i.length,
|
|
1292
|
-
blockCount:
|
|
1293
|
-
definitionCount:
|
|
1294
|
-
diagnosticCount:
|
|
1406
|
+
blockCount: u,
|
|
1407
|
+
definitionCount: v.length,
|
|
1408
|
+
diagnosticCount: x.length,
|
|
1295
1409
|
directiveAnalysisIncluded: !0,
|
|
1296
|
-
directiveCount:
|
|
1297
|
-
actionDirectiveExtractionTotals:
|
|
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:
|
|
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:
|
|
1372
|
-
slowDirectiveArticles:
|
|
1373
|
-
}),
|
|
1485
|
+
directiveTextSize: d.length,
|
|
1486
|
+
slowDirectiveArticles: m.toSorted((e, t) => t.totalMs - e.totalMs).slice(0, 10)
|
|
1487
|
+
}), ee;
|
|
1374
1488
|
}
|
|
1375
|
-
function
|
|
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
|
|
1383
|
-
return Array.from(
|
|
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
|
|
1386
|
-
let i =
|
|
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
|
|
1403
|
-
let r =
|
|
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
|
|
1428
|
-
let n = new
|
|
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 =
|
|
1433
|
-
let 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:
|
|
1440
|
-
html: n.map((e) =>
|
|
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 =
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
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
|
|
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
|
|
1574
|
+
linkedHtml: await dt(e, t, t.date, ut(e), n),
|
|
1575
|
+
...n === void 0 ? {} : { linkDecisions: n }
|
|
1458
1576
|
};
|
|
1459
1577
|
}
|
|
1460
|
-
function
|
|
1578
|
+
function B(e) {
|
|
1461
1579
|
return e.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
1462
1580
|
}
|
|
1463
|
-
function
|
|
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
|
|
1589
|
+
function Tn(e) {
|
|
1472
1590
|
return /(?:<|&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
|
|
1592
|
+
function V(e) {
|
|
1475
1593
|
return e.name.replace(/^.*:/u, "");
|
|
1476
1594
|
}
|
|
1477
|
-
function
|
|
1478
|
-
return t.children.map((t) =>
|
|
1595
|
+
function En(e, t) {
|
|
1596
|
+
return t.children.map((t) => H(e, t)).filter(Boolean).join("");
|
|
1479
1597
|
}
|
|
1480
|
-
function
|
|
1481
|
-
return t.children.map((t) => t.type === "text" &&
|
|
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
|
|
1601
|
+
function H(e, t) {
|
|
1484
1602
|
if (t.type === "text") {
|
|
1485
1603
|
let e = t.data.replace(/\s+\./gu, ".");
|
|
1486
|
-
return
|
|
1604
|
+
return Tn(e) ? wn(e) : B(e);
|
|
1487
1605
|
}
|
|
1488
|
-
if (!
|
|
1489
|
-
let n =
|
|
1606
|
+
if (!L(t)) return "";
|
|
1607
|
+
let n = V(t), r = () => En(e, t);
|
|
1490
1608
|
switch (n) {
|
|
1491
|
-
case "p": return `<p${
|
|
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}${
|
|
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="${
|
|
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
|
|
1523
|
-
case "caption": return `<caption${
|
|
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
|
|
1532
|
-
case "alinea": return
|
|
1533
|
-
case "article": return
|
|
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
|
|
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
|
|
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
|
|
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 &&
|
|
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(
|
|
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 ?
|
|
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
|
|
1586
|
-
let n = e(t).find("td,th").get(), r = e(n.find((t) => e(t).hasClass("akn-quote-column") && /^»\s*;?$/u.test(
|
|
1587
|
-
return `« ${n.filter((t) => !e(t).hasClass("akn-quote-column")).map((t) =>
|
|
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
|
|
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}="${
|
|
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="${
|
|
1715
|
+
return a && i.push(`style="${B(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
|
|
1598
1716
|
}
|
|
1599
|
-
function
|
|
1600
|
-
return `<${n}${
|
|
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:
|
|
1731
|
+
], { style: Mn(e, t, n) })}>${r}</${n}>`;
|
|
1614
1732
|
}
|
|
1615
|
-
function
|
|
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 =
|
|
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
|
|
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
|
|
1624
|
-
let n = [
|
|
1625
|
-
return n.length === 0 ? "" : `<p class="akn-heading">${
|
|
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
|
|
1745
|
+
function Fn(e, t) {
|
|
1628
1746
|
if (!t) return !1;
|
|
1629
|
-
let n = (e) =>
|
|
1630
|
-
return n(
|
|
1747
|
+
let n = (e) => P(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
|
|
1748
|
+
return n(P(e.replace(/<[^>]*>/gu, " ").replace(/ /gu, " ").replace(/ /giu, " ").replace(/–/giu, "–"))).startsWith(n(t));
|
|
1631
1749
|
}
|
|
1632
|
-
function
|
|
1633
|
-
let t =
|
|
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
|
|
1637
|
-
return
|
|
1754
|
+
function Ln(e, t) {
|
|
1755
|
+
return Rn([zn({
|
|
1638
1756
|
content: e,
|
|
1639
1757
|
pastille: t
|
|
1640
1758
|
})]);
|
|
1641
1759
|
}
|
|
1642
|
-
function
|
|
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
|
|
1646
|
-
let i = n ? ` style="${
|
|
1647
|
-
return `<tr${r ? ` class="${
|
|
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
|
|
1650
|
-
let r = t ? ` style="${
|
|
1651
|
-
return `<tr${n ? ` class="${
|
|
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
|
|
1771
|
+
function Vn(e, t) {
|
|
1654
1772
|
return e(t).attr("data:pastille") ?? e(t).attr("pastille");
|
|
1655
1773
|
}
|
|
1656
|
-
function
|
|
1774
|
+
function Hn(e, t) {
|
|
1657
1775
|
return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
|
|
1658
1776
|
}
|
|
1659
|
-
function
|
|
1660
|
-
return e(t).children().get().filter((e) =>
|
|
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
|
|
1780
|
+
function Wn(e, t) {
|
|
1663
1781
|
let n = [];
|
|
1664
1782
|
return e(t).children().each((t, r) => {
|
|
1665
|
-
if (!
|
|
1666
|
-
let i =
|
|
1667
|
-
i === "num" || i === "heading" || i === "content" || n.push(
|
|
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
|
|
1671
|
-
let n = [], r =
|
|
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 = [
|
|
1674
|
-
|
|
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(
|
|
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 (!
|
|
1687
|
-
let t =
|
|
1688
|
-
t === "num" || t === "heading" || t === "content" || (t === "alinea" ||
|
|
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
|
|
1693
|
-
let i =
|
|
1694
|
-
a ? `id="${
|
|
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
|
-
|
|
1697
|
-
|
|
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 =
|
|
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 && (
|
|
1822
|
+
o.length !== 0 && (l.push(Yn(o)), o = []);
|
|
1705
1823
|
};
|
|
1706
1824
|
return e(t).children().each((t, n) => {
|
|
1707
|
-
if (!
|
|
1708
|
-
let r =
|
|
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(...
|
|
1829
|
+
o.push(...Gn(e, n));
|
|
1712
1830
|
return;
|
|
1713
1831
|
}
|
|
1714
|
-
s(),
|
|
1832
|
+
s(), l.push(H(e, n));
|
|
1715
1833
|
}
|
|
1716
|
-
}), s(),
|
|
1834
|
+
}), s(), l.push(`</${n}>`), l.join("\n");
|
|
1717
1835
|
}
|
|
1718
1836
|
if (i === "article") {
|
|
1719
|
-
let 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
|
-
},
|
|
1723
|
-
if (
|
|
1724
|
-
let r = [
|
|
1725
|
-
content:
|
|
1726
|
-
contextClass:
|
|
1727
|
-
}), ...
|
|
1728
|
-
|
|
1729
|
-
for (let n of
|
|
1730
|
-
return
|
|
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
|
-
|
|
1850
|
+
l.push(s);
|
|
1733
1851
|
}
|
|
1734
|
-
let
|
|
1852
|
+
let u = [];
|
|
1735
1853
|
for (let n of ["content", "children"]) e(t).children().each((t, r) => {
|
|
1736
|
-
if (!
|
|
1737
|
-
let i =
|
|
1738
|
-
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" ||
|
|
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
|
|
1858
|
+
let d = u.join("\n");
|
|
1741
1859
|
if (i !== "article") {
|
|
1742
|
-
let n =
|
|
1743
|
-
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
|
|
1863
|
+
return l.push(s ? Ln(d, s) : d), l.push(`</${n}>`), l.join("\n");
|
|
1746
1864
|
}
|
|
1747
|
-
function
|
|
1748
|
-
let i =
|
|
1749
|
-
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i =
|
|
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
|
|
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
|
|
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
|
|
1758
|
-
let r =
|
|
1759
|
-
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${
|
|
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
|
|
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
|
|
1786
|
-
let n =
|
|
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 (!
|
|
1790
|
-
let t =
|
|
1907
|
+
if (!L(n)) continue;
|
|
1908
|
+
let t = V(n);
|
|
1791
1909
|
if (t !== "title" && t !== "part") continue;
|
|
1792
|
-
let r =
|
|
1910
|
+
let r = er(P(e(n).children("num").first().text()));
|
|
1793
1911
|
if (r) return r;
|
|
1794
1912
|
}
|
|
1795
1913
|
}
|
|
1796
|
-
function
|
|
1797
|
-
return
|
|
1914
|
+
function $n(e, t) {
|
|
1915
|
+
return Qn(e, t);
|
|
1798
1916
|
}
|
|
1799
|
-
function
|
|
1800
|
-
let [t, ...n] =
|
|
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
|
|
1811
|
-
return `article-${
|
|
1928
|
+
function tr(e) {
|
|
1929
|
+
return `article-${P(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
|
|
1812
1930
|
}
|
|
1813
|
-
function
|
|
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
|
|
1826
|
-
return [
|
|
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
|
|
1829
|
-
let 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
|
|
1957
|
+
function ar(e, t) {
|
|
1840
1958
|
e.items.push(...t.items);
|
|
1841
1959
|
}
|
|
1842
|
-
function
|
|
1960
|
+
function or(e, t) {
|
|
1843
1961
|
let n = { items: [] };
|
|
1844
1962
|
return e(t).children().each((t, r) => {
|
|
1845
|
-
if (!
|
|
1846
|
-
let i =
|
|
1963
|
+
if (!L(r)) return;
|
|
1964
|
+
let i = V(r);
|
|
1847
1965
|
if (i === "article") {
|
|
1848
|
-
n.items.push(
|
|
1966
|
+
n.items.push(ir(e, r));
|
|
1849
1967
|
return;
|
|
1850
1968
|
}
|
|
1851
|
-
let a =
|
|
1969
|
+
let a = nr(i);
|
|
1852
1970
|
if (!a) {
|
|
1853
|
-
|
|
1971
|
+
ar(n, or(e, r));
|
|
1854
1972
|
return;
|
|
1855
1973
|
}
|
|
1856
|
-
let o =
|
|
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
|
|
1983
|
+
function sr(e) {
|
|
1866
1984
|
let t = e("body").first().get(0);
|
|
1867
|
-
return t === void 0 ? { items: [] } :
|
|
1985
|
+
return t === void 0 ? { items: [] } : or(e, t);
|
|
1868
1986
|
}
|
|
1869
|
-
function
|
|
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
|
|
1873
|
-
e("table").each((t, 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(
|
|
1876
|
-
|
|
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
|
|
1880
|
-
let t =
|
|
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 =
|
|
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
|
|
1894
|
-
return
|
|
2011
|
+
function dr(e) {
|
|
2012
|
+
return fr(b(e));
|
|
1895
2013
|
}
|
|
1896
|
-
function
|
|
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 =
|
|
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:
|
|
1902
|
-
label:
|
|
1903
|
-
num:
|
|
1904
|
-
title:
|
|
1905
|
-
text:
|
|
1906
|
-
html:
|
|
1907
|
-
directiveText:
|
|
1908
|
-
blocks:
|
|
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
|
|
1913
|
-
let t =
|
|
2030
|
+
function pr(e) {
|
|
2031
|
+
let t = b(e);
|
|
1914
2032
|
return {
|
|
1915
|
-
articles:
|
|
2033
|
+
articles: fr(t),
|
|
1916
2034
|
htmlWithLinks: t.html()
|
|
1917
2035
|
};
|
|
1918
2036
|
}
|
|
1919
|
-
async function
|
|
1920
|
-
let n = new
|
|
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 ??
|
|
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)),
|
|
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:
|
|
1931
|
-
blockCount:
|
|
1932
|
-
directiveCount:
|
|
1933
|
-
targetDirectiveCount:
|
|
1934
|
-
}),
|
|
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
|
|
1937
|
-
let n =
|
|
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
|
|
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
|
|
1948
|
-
function
|
|
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
|
|
1952
|
-
let t =
|
|
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 =
|
|
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
|
|
1971
|
-
let i = await
|
|
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 =
|
|
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), ...
|
|
2111
|
+
}).filter((e) => e !== void 0), ...yr(t)],
|
|
1991
2112
|
tableOfContents: i.tableOfContents
|
|
1992
2113
|
};
|
|
1993
2114
|
}
|
|
1994
|
-
function
|
|
1995
|
-
return
|
|
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
|
|
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
|
|
2016
|
-
return e?.trim() ?
|
|
2136
|
+
function Cr(e) {
|
|
2137
|
+
return e?.trim() ? b(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
|
|
2017
2138
|
}
|
|
2018
|
-
function
|
|
2019
|
-
let n =
|
|
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
|
|
2031
|
-
return
|
|
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
|
|
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
|
|
2166
|
+
function Er(e, t) {
|
|
2046
2167
|
return {
|
|
2047
2168
|
type: e === "start" ? "head_of_target" : "tail_after_target",
|
|
2048
|
-
unit: t ?
|
|
2169
|
+
unit: t ? r(t) : "article"
|
|
2049
2170
|
};
|
|
2050
2171
|
}
|
|
2051
|
-
function
|
|
2172
|
+
function Dr(e) {
|
|
2052
2173
|
return e === "start" ? "insert_before" : "insert_after";
|
|
2053
2174
|
}
|
|
2054
|
-
var
|
|
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:
|
|
2181
|
+
unit: r(t)
|
|
2061
2182
|
}
|
|
2062
2183
|
};
|
|
2063
|
-
} }),
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
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 }),
|
|
2072
|
-
function
|
|
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
|
|
2076
|
-
return { citation:
|
|
2196
|
+
function q(e) {
|
|
2197
|
+
return { citation: oe(e.position()) };
|
|
2077
2198
|
}
|
|
2078
|
-
var J =
|
|
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) =>
|
|
2081
|
-
}),
|
|
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) =>
|
|
2084
|
-
}),
|
|
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) =>
|
|
2087
|
-
}),
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
], { value: (e) => e[2] }),
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
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
|
|
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
|
-
}) }),
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
], { value: (e, t) =>
|
|
2108
|
-
contextText:
|
|
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
|
-
}) }),
|
|
2113
|
-
|
|
2114
|
-
E(
|
|
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) =>
|
|
2118
|
-
contextText:
|
|
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
|
-
}) }),
|
|
2123
|
-
|
|
2124
|
-
E(
|
|
2243
|
+
}) }), Gr = T([
|
|
2244
|
+
G,
|
|
2245
|
+
A(E("substituer", { flags: "i" }), E("remplacer", { flags: "i" })),
|
|
2125
2246
|
k,
|
|
2126
|
-
Sr,
|
|
2127
2247
|
Ar,
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
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
|
-
}) }),
|
|
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
|
-
|
|
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) =>
|
|
2146
|
-
contextText:
|
|
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
|
-
}) }),
|
|
2151
|
-
|
|
2271
|
+
}) }), qr = T([
|
|
2272
|
+
a,
|
|
2152
2273
|
k,
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
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) =>
|
|
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
|
-
}) }),
|
|
2163
|
-
|
|
2283
|
+
}) }), Jr = T([
|
|
2284
|
+
a,
|
|
2164
2285
|
k,
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
E(
|
|
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) =>
|
|
2291
|
+
], { value: (e, t) => U(t, {
|
|
2171
2292
|
contextText: "",
|
|
2172
2293
|
insertCitation: e[6].citation,
|
|
2173
|
-
kind:
|
|
2294
|
+
kind: p(e[0]),
|
|
2174
2295
|
targetReference: e[2]
|
|
2175
|
-
}) }),
|
|
2176
|
-
|
|
2296
|
+
}) }), Yr = T([
|
|
2297
|
+
a,
|
|
2177
2298
|
k,
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
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) =>
|
|
2304
|
+
], { value: (e, t) => U(t, {
|
|
2184
2305
|
contextText: "",
|
|
2185
2306
|
insertCitation: e[6].citation,
|
|
2186
|
-
kind:
|
|
2187
|
-
}) }),
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
E(
|
|
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
|
|
2197
|
-
contextText:
|
|
2317
|
+
return U(t, {
|
|
2318
|
+
contextText: K(n),
|
|
2198
2319
|
insertCitation: e[5].citation,
|
|
2199
|
-
kind:
|
|
2320
|
+
kind: Dr(i),
|
|
2200
2321
|
targetReference: r,
|
|
2201
|
-
targetScope:
|
|
2322
|
+
targetScope: Er(i, r)
|
|
2202
2323
|
});
|
|
2203
|
-
} }),
|
|
2204
|
-
|
|
2205
|
-
|
|
2324
|
+
} }), Zr = T([
|
|
2325
|
+
G,
|
|
2326
|
+
a,
|
|
2206
2327
|
k,
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2328
|
+
Br,
|
|
2329
|
+
E("[\\s\\S]*?(?=ins[eé]rer)"),
|
|
2330
|
+
E("ins[eé]rer", { flags: "i" }),
|
|
2210
2331
|
k,
|
|
2211
|
-
|
|
2212
|
-
], { value: (e, t) =>
|
|
2213
|
-
contextText:
|
|
2332
|
+
Rr
|
|
2333
|
+
], { value: (e, t) => U(t, {
|
|
2334
|
+
contextText: K(e[0]),
|
|
2214
2335
|
insertCitation: e[7].citation,
|
|
2215
|
-
kind:
|
|
2336
|
+
kind: p(e[1]),
|
|
2216
2337
|
targetCitation: e[3].citation,
|
|
2217
2338
|
targetReference: X(e[0])
|
|
2218
|
-
}) }),
|
|
2219
|
-
K,
|
|
2220
|
-
p,
|
|
2221
|
-
k,
|
|
2339
|
+
}) }), Qr = T([
|
|
2222
2340
|
G,
|
|
2223
|
-
|
|
2224
|
-
|
|
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) =>
|
|
2228
|
-
contextText:
|
|
2348
|
+
], { value: (e, t) => U(t, {
|
|
2349
|
+
contextText: K(e[0]),
|
|
2229
2350
|
insertCitation: e[7].citation,
|
|
2230
|
-
kind:
|
|
2351
|
+
kind: p(e[1]),
|
|
2231
2352
|
targetReference: X(e[0]) ?? e[3]
|
|
2232
|
-
}) }),
|
|
2233
|
-
|
|
2234
|
-
|
|
2353
|
+
}) }), $r = A(Xr, qr, Jr, Yr, Kr, T([
|
|
2354
|
+
G,
|
|
2355
|
+
a,
|
|
2235
2356
|
k,
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
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
|
-
|
|
2365
|
+
kr
|
|
2245
2366
|
], { value: (e) => ({
|
|
2246
2367
|
kind: e[0],
|
|
2247
2368
|
...e[2]
|
|
2248
|
-
}) }),
|
|
2249
|
-
|
|
2369
|
+
}) }), T([
|
|
2370
|
+
E("r[eé]diger\\s+ainsi", {
|
|
2250
2371
|
flags: "i",
|
|
2251
2372
|
value: "rewrite_portion"
|
|
2252
2373
|
}),
|
|
2253
2374
|
k,
|
|
2254
|
-
|
|
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
|
|
2265
|
-
contextText:
|
|
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
|
-
} }),
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
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
|
-
|
|
2399
|
+
w,
|
|
2279
2400
|
Y,
|
|
2280
|
-
|
|
2281
|
-
], { value: (e, t) =>
|
|
2401
|
+
w
|
|
2402
|
+
], { value: (e, t) => U(t, {
|
|
2282
2403
|
contextText: e[0],
|
|
2283
2404
|
insertCitation: e[8],
|
|
2284
|
-
kind:
|
|
2405
|
+
kind: p(e[3]),
|
|
2285
2406
|
targetCitation: e[6]
|
|
2286
|
-
}) }),
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
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) =>
|
|
2293
|
-
contextText:
|
|
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
|
-
}) }),
|
|
2418
|
+
}) }), Hr, Ur);
|
|
2298
2419
|
//#endregion
|
|
2299
2420
|
//#region src/lib/server/parsed_amendments.ts
|
|
2300
|
-
function
|
|
2421
|
+
function ei(e) {
|
|
2301
2422
|
return e.replace(/\s+/gu, " ").trim();
|
|
2302
2423
|
}
|
|
2303
|
-
function
|
|
2304
|
-
return e.split(/\n/gu).map(
|
|
2424
|
+
function ti(e) {
|
|
2425
|
+
return e.split(/\n/gu).map(ei).filter(Boolean).join("\n");
|
|
2305
2426
|
}
|
|
2306
|
-
function
|
|
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
|
|
2316
|
-
return ve(
|
|
2436
|
+
function ri(e, t) {
|
|
2437
|
+
return ve(xe(e), t);
|
|
2317
2438
|
}
|
|
2318
|
-
function
|
|
2439
|
+
function ii(e) {
|
|
2319
2440
|
return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
|
|
2320
2441
|
}
|
|
2321
|
-
function
|
|
2442
|
+
function ai(e) {
|
|
2322
2443
|
return {
|
|
2323
2444
|
articleLabel: e.targetArticleLabel ?? null,
|
|
2324
|
-
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
|
|
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
|
|
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
|
|
2474
|
+
function ci(e, t, n, r = ti(e.slice(n.start, n.stop))) {
|
|
2354
2475
|
return {
|
|
2355
|
-
originalTransformation:
|
|
2476
|
+
originalTransformation: ri(t, n),
|
|
2356
2477
|
position: n,
|
|
2357
2478
|
text: r
|
|
2358
2479
|
};
|
|
2359
2480
|
}
|
|
2360
|
-
function
|
|
2481
|
+
function li(e) {
|
|
2361
2482
|
let t = e.dispositifHtml ?? e.dispositifText;
|
|
2362
2483
|
if (!t) return null;
|
|
2363
|
-
let n = e.dispositifHtml ?
|
|
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 :
|
|
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
|
|
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
|
|
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
|
|
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
|
|
2400
|
-
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(
|
|
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
|
|
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
|
|
2416
|
-
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(
|
|
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
|
|
2419
|
-
return
|
|
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
|
|
2545
|
+
function gi(e) {
|
|
2425
2546
|
return /^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*(?!alin[eé]a\b)/iu.test(e.text);
|
|
2426
2547
|
}
|
|
2427
|
-
function
|
|
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),
|
|
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
|
|
2439
|
-
return
|
|
2559
|
+
function vi(e) {
|
|
2560
|
+
return h(e);
|
|
2440
2561
|
}
|
|
2441
|
-
function
|
|
2442
|
-
return
|
|
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
|
|
2566
|
+
if (n) return ci(e, t, n.position, ti(v(e, n)));
|
|
2446
2567
|
}
|
|
2447
|
-
function
|
|
2568
|
+
function bi(e, t) {
|
|
2448
2569
|
if (!e) return;
|
|
2449
2570
|
let n = structuredClone(e);
|
|
2450
|
-
for (let e of
|
|
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
|
|
2454
|
-
let i =
|
|
2574
|
+
function xi(e, t, n, r) {
|
|
2575
|
+
let i = _i(e, n);
|
|
2455
2576
|
if (!i) return null;
|
|
2456
|
-
let a =
|
|
2577
|
+
let a = yi(e, i);
|
|
2457
2578
|
if (!a) return null;
|
|
2458
|
-
let o =
|
|
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:
|
|
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:
|
|
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:
|
|
2669
|
+
targetScope: pi(a.targetScope, c)
|
|
2549
2670
|
};
|
|
2550
2671
|
}
|
|
2551
2672
|
return null;
|
|
2552
2673
|
}
|
|
2553
|
-
function
|
|
2674
|
+
function Si(e, t) {
|
|
2554
2675
|
let n = [], r = 0, i = 0;
|
|
2555
2676
|
function a(r) {
|
|
2556
|
-
let a =
|
|
2677
|
+
let a = ni(e, {
|
|
2557
2678
|
start: i,
|
|
2558
2679
|
stop: r
|
|
2559
2680
|
});
|
|
2560
|
-
a !== null && n.push(
|
|
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) &&
|
|
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
|
|
2591
|
-
let t =
|
|
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
|
|
2610
|
-
|
|
2611
|
-
let n = c ?
|
|
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 =
|
|
2741
|
+
let l = fi(o, t);
|
|
2621
2742
|
if (l !== null) {
|
|
2622
2743
|
s = l;
|
|
2623
2744
|
continue;
|
|
2624
2745
|
}
|
|
2625
|
-
|
|
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
|
-
|
|
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
|
|
2771
|
+
function wi(e) {
|
|
2651
2772
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
2652
2773
|
}
|
|
2653
|
-
function
|
|
2654
|
-
let t =
|
|
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 =
|
|
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
|
|
2668
|
-
let t =
|
|
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 =
|
|
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 =
|
|
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
|
|
2693
|
-
return
|
|
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
|
|
2701
|
-
function
|
|
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
|
|
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}`,
|
|
2707
|
-
return
|
|
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
|
|
2713
|
-
let t =
|
|
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 =
|
|
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: `${
|
|
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: `${
|
|
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
|
|
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
|
|
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
|
-
},
|
|
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
|
|
21820
|
-
let t = Object.keys(
|
|
21821
|
-
for (let n of t) if (e.includes(n)) return
|
|
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
|
|
21825
|
-
return
|
|
21945
|
+
function Hi(e) {
|
|
21946
|
+
return Ae.createHash("md5").update(e).digest("hex");
|
|
21826
21947
|
}
|
|
21827
|
-
function
|
|
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
|
|
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
|
|
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
|
|
21959
|
+
function Ki(e) {
|
|
21839
21960
|
return e ? /vertical-align\s*:\s*sub/i.test(e) : !1;
|
|
21840
21961
|
}
|
|
21841
|
-
function
|
|
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
|
|
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
|
|
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
|
|
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
|
|
21897
|
-
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a =
|
|
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 ?
|
|
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 =
|
|
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 =
|
|
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 &&
|
|
22129
|
+
n && Ji(o, i) && e.attr("align", "center"), r.replaceWith(e);
|
|
22009
22130
|
} else {
|
|
22010
|
-
let e =
|
|
22131
|
+
let e = Vi(i), t;
|
|
22011
22132
|
if (n) {
|
|
22012
|
-
let n =
|
|
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 &&
|
|
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 =
|
|
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 =
|
|
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| | |\u00a0)+/, "");
|
|
22082
22203
|
o !== i && n.html(o);
|
|
22083
|
-
}),
|
|
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 +=
|
|
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(/ /g, "\xA0"), r && (g = g.replace(/<p[^>]*>\s*( | | |\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*( | | |\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), g = g.replace(/<span[^>]*>\s*<\/span>/gi, ""), g = g.replace(/ class=""/g, ""), 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(/ /g, "\xA0"), r && (g = g.replace(/<p[^>]*>\s*( | | |\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*( | | |\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*( | | |\u00a0|\s)*\s*<\/\1>/gi, "").replace(/<(strong|em|b|i)>( | | |\u00a0)+<\/\1>/gi, " ").replace(/<br\s*\/?>/gi, "<br/>").replace(/ +/g, " ").trim(), g;
|
|
22088
22209
|
}
|
|
22089
|
-
function
|
|
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
|
|
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 &&
|
|
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
|
|
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
|
|
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
|
-
${
|
|
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
|
|
22269
|
+
function na(e, t) {
|
|
22149
22270
|
let n = "transformation_", r = {};
|
|
22150
|
-
for (let e of
|
|
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 =
|
|
22158
|
-
let { sourceMap: s, title: c } =
|
|
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
|
|
22282
|
+
return ra(r, e), r;
|
|
22162
22283
|
}
|
|
22163
|
-
function
|
|
22164
|
-
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations)
|
|
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
|
|
22168
|
-
if (
|
|
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
|
-
|
|
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())
|
|
22301
|
+
for (let [r, i] of e.transformations.entries()) ia(i, t, `${n}.${r + 1}`);
|
|
22181
22302
|
}
|
|
22182
|
-
e.output !== void 0 &&
|
|
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
|
|
22187
|
-
let _ = t ?? (e === void 0 ? void 0 : new
|
|
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
|
|
22190
|
-
a === void 0 ? (
|
|
22191
|
-
let
|
|
22192
|
-
s !== void 0 &&
|
|
22193
|
-
let { outputByType:
|
|
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:
|
|
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:
|
|
22325
|
+
outputTypes: b,
|
|
22205
22326
|
referredLegifranceTextsInfos: g !== void 0
|
|
22206
|
-
}),
|
|
22207
|
-
s !== void 0 && (
|
|
22208
|
-
for (let [e, t] of Object.entries(
|
|
22209
|
-
let n =
|
|
22210
|
-
n !== void 0 && await
|
|
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
|
-
|
|
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
|
|
22220
|
-
let i =
|
|
22221
|
-
for await (let e of
|
|
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
|
|
22347
|
+
await M.writeJson(r, s, {
|
|
22227
22348
|
encoding: "utf-8",
|
|
22228
22349
|
spaces: 2
|
|
22229
22350
|
});
|
|
22230
22351
|
}
|
|
22231
|
-
async function
|
|
22232
|
-
let r =
|
|
22233
|
-
await
|
|
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
|
|
22241
|
-
return new
|
|
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
|
|
22246
|
-
let
|
|
22247
|
-
|
|
22248
|
-
for (let
|
|
22249
|
-
let
|
|
22250
|
-
if (!("position" in
|
|
22251
|
-
let
|
|
22252
|
-
for (let
|
|
22253
|
-
let l =
|
|
22254
|
-
codeId:
|
|
22255
|
-
numero:
|
|
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
|
-
|
|
22258
|
-
mention:
|
|
22378
|
+
i.push({
|
|
22379
|
+
mention: s,
|
|
22259
22380
|
position: {
|
|
22260
|
-
start:
|
|
22261
|
-
stop:
|
|
22381
|
+
start: r.position.start,
|
|
22382
|
+
stop: r.position.stop
|
|
22262
22383
|
},
|
|
22263
22384
|
passage: e.texte,
|
|
22264
|
-
articleId: l.length === 1 &&
|
|
22385
|
+
articleId: l.length === 1 && o.length === 1 && t.length === 2 ? l[0] : null,
|
|
22265
22386
|
candidats: u,
|
|
22266
|
-
selectionPossible:
|
|
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:
|
|
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
|
|
22402
|
+
function ua(e) {
|
|
22282
22403
|
if (!e) return "";
|
|
22283
|
-
let t =
|
|
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
|
|
22409
|
+
function da(e) {
|
|
22289
22410
|
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
22290
22411
|
}
|
|
22291
|
-
function
|
|
22412
|
+
function fa(e) {
|
|
22292
22413
|
if (typeof e == "string") return e;
|
|
22293
|
-
let t =
|
|
22414
|
+
let t = da(e)?.["#text"];
|
|
22294
22415
|
return typeof t == "string" ? t : void 0;
|
|
22295
22416
|
}
|
|
22296
|
-
function
|
|
22297
|
-
let t =
|
|
22298
|
-
return
|
|
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
|
|
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:
|
|
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:
|
|
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
|
|
22321
|
-
function
|
|
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
|
|
22323
|
-
let t =
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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" || !
|
|
22359
|
-
return
|
|
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
|
|
22365
|
-
if (i.length !== 1) throw new
|
|
22366
|
-
let a = i[0], o = await
|
|
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
|
|
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
|
|
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 }) => !
|
|
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 =
|
|
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
|
|
22408
|
-
return
|
|
22409
|
-
document:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
22524
|
-
let r = await
|
|
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:
|
|
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(
|
|
22540
|
-
resultatsPossibles: t.resultatsPossibles.map(
|
|
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 {
|
|
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 };
|