From e4ebc2b317d75b33203d1a6124173ee2045498b8 Mon Sep 17 00:00:00 2001 From: Hamid Reza Ghavami Date: Thu, 9 Jul 2026 23:43:04 +0300 Subject: [PATCH] fs: return Buffer from mkdtemp when prefix is a Buffer Signed-off-by: Hamid Reza Ghavami --- .github/PULL_REQUEST_TEMPLATE.md | 4 - .github/workflows/benchmark.yml | 203 - .github/workflows/build-tarball.yml | 12 +- .github/workflows/codeql.yml | 8 +- .github/workflows/commit-lint.yml | 2 +- .github/workflows/commit-queue.yml | 2 +- .../workflows/coverage-linux-without-intl.yml | 8 +- .github/workflows/coverage-linux.yml | 8 +- .github/workflows/coverage-windows.yml | 9 +- .github/workflows/create-release-proposal.yml | 2 +- .github/workflows/daily-wpt-fyi.yml | 10 +- .github/workflows/daily.yml | 4 +- .github/workflows/doc.yml | 4 +- .../workflows/find-inactive-collaborators.yml | 2 +- .github/workflows/find-inactive-tsc.yml | 4 +- .github/workflows/license-builder.yml | 2 +- .github/workflows/lint-release-proposal.yml | 24 +- .github/workflows/linters.yml | 42 +- .github/workflows/notify-on-push.yml | 4 +- .github/workflows/notify-on-review-wanted.yml | 2 +- .github/workflows/scorecard.yml | 4 +- .github/workflows/stale.yml | 2 +- .github/workflows/stress-test.yml | 114 - .github/workflows/test-internet.yml | 6 +- .github/workflows/test-linux-quic.yml | 8 +- .github/workflows/test-linux.yml | 8 +- .github/workflows/test-macos.yml | 8 +- .github/workflows/test-shared.yml | 2 +- .github/workflows/timezone-update.yml | 4 +- .github/workflows/tools.yml | 4 +- .github/workflows/update-openssl.yml | 2 +- .github/workflows/update-v8.yml | 4 +- .github/workflows/update-wpt.yml | 2 +- BUILDING.md | 4 +- CHANGELOG.md | 3 +- CONTRIBUTING.md | 5 - Makefile | 36 +- README.md | 11 +- SECURITY.md | 40 +- benchmark/crypto/argon2.js | 10 +- benchmark/dgram/send-to-ip.js | 43 - .../webstreams/readable-async-iterator.js | 37 +- common.gypi | 3 +- configure.py | 86 +- deps/cares/CMakeLists.txt | 29 +- deps/cares/README.md | 4 +- deps/cares/RELEASE-NOTES.md | 110 - deps/cares/aminclude_static.am | 2 +- deps/cares/configure | 22 +- deps/cares/configure.ac | 4 +- deps/cares/docs/ares_dns_record.3 | 2 +- deps/cares/docs/ares_getaddrinfo.3 | 23 - deps/cares/docs/ares_gethostbyaddr.3 | 11 +- deps/cares/docs/ares_gethostbyname.3 | 11 +- deps/cares/docs/ares_getnameinfo.3 | 26 +- deps/cares/docs/ares_query.3 | 10 - deps/cares/docs/ares_search.3 | 9 - deps/cares/docs/ares_send.3 | 10 - deps/cares/include/ares.h | 8 - deps/cares/include/ares_dns_record.h | 5 +- deps/cares/include/ares_version.h | 4 +- deps/cares/src/lib/CMakeLists.txt | 4 - deps/cares/src/lib/Makefile.in | 2 +- deps/cares/src/lib/ares_addrinfo_localhost.c | 40 +- deps/cares/src/lib/ares_close_sockets.c | 8 +- deps/cares/src/lib/ares_conn.h | 8 +- deps/cares/src/lib/ares_cookie.c | 4 +- deps/cares/src/lib/ares_getaddrinfo.c | 85 +- deps/cares/src/lib/ares_gethostbyname.c | 4 - deps/cares/src/lib/ares_hosts_file.c | 3 - deps/cares/src/lib/ares_init.c | 14 - deps/cares/src/lib/ares_library_init.c | 21 - deps/cares/src/lib/ares_private.h | 17 +- deps/cares/src/lib/ares_process.c | 329 +- deps/cares/src/lib/ares_qcache.c | 8 +- deps/cares/src/lib/ares_socket.c | 2 - deps/cares/src/lib/ares_sysconfig.c | 9 +- deps/cares/src/lib/ares_sysconfig_files.c | 26 +- deps/cares/src/lib/ares_sysconfig_win.c | 167 +- deps/cares/src/lib/ares_timeout.c | 11 - deps/cares/src/lib/ares_update_servers.c | 22 +- deps/cares/src/lib/dsa/ares_array.c | 25 +- deps/cares/src/lib/dsa/ares_htable.c | 6 +- deps/cares/src/lib/dsa/ares_htable_dict.c | 2 - deps/cares/src/lib/dsa/ares_llist.c | 5 +- .../src/lib/event/ares_event_configchg.c | 6 +- .../src/lib/event/ares_event_wake_pipe.c | 8 +- deps/cares/src/lib/event/ares_event_win32.c | 3 - deps/cares/src/lib/include/ares_mem.h | 3 - deps/cares/src/lib/include/ares_str.h | 17 - deps/cares/src/lib/legacy/ares_expand_name.c | 2 +- .../src/lib/legacy/ares_parse_ns_reply.c | 4 +- .../src/lib/legacy/ares_parse_ptr_reply.c | 4 +- deps/cares/src/lib/record/ares_dns_mapping.c | 8 +- .../src/lib/record/ares_dns_multistring.c | 4 +- deps/cares/src/lib/record/ares_dns_name.c | 71 +- deps/cares/src/lib/record/ares_dns_parse.c | 99 +- deps/cares/src/lib/record/ares_dns_record.c | 54 +- deps/cares/src/lib/str/ares_buf.c | 44 +- deps/cares/src/lib/str/ares_str.c | 54 - deps/cares/src/lib/util/ares_iface_ips.c | 32 +- deps/cares/src/lib/util/ares_iface_ips.h | 1 - deps/cares/src/lib/util/ares_math.c | 13 +- deps/cares/src/lib/util/ares_math.h | 5 - deps/cares/src/lib/util/ares_threads.c | 3 +- deps/cares/src/lib/util/ares_time.h | 1 - deps/cares/src/lib/util/ares_uri.c | 5 +- deps/cares/src/tools/adig.c | 12 +- deps/cares/src/tools/ahost.c | 7 - deps/crates/Cargo.lock | 149 +- deps/crates/Cargo.toml | 28 +- .../vendor/autocfg/.cargo-checksum.json | 2 +- .../vendor/autocfg/.cargo_vcs_info.json | 6 - deps/crates/vendor/autocfg/Cargo.toml.orig | 15 - .../.cargo-checksum.json | 2 +- .../.cargo_vcs_info.json | 6 - .../calendrical_calculations/Cargo.lock | 79 - .../calendrical_calculations/Cargo.toml | 57 +- .../calendrical_calculations/Cargo.toml.orig | 42 - .../calendrical_calculations/src/astronomy.rs | 23 +- .../src/chinese_based.rs | 83 +- .../calendrical_calculations/src/coptic.rs | 7 - .../calendrical_calculations/src/gregorian.rs | 19 +- .../calendrical_calculations/src/hebrew.rs | 11 +- .../src/hebrew_keviyah.rs | 304 +- .../calendrical_calculations/src/helpers.rs | 14 +- .../calendrical_calculations/src/islamic.rs | 32 +- .../calendrical_calculations/src/julian.rs | 133 +- .../calendrical_calculations/src/lib.rs | 28 +- .../calendrical_calculations/src/persian.rs | 8 +- .../calendrical_calculations/src/rata_die.rs | 12 +- .../vendor/core_maths/.cargo-checksum.json | 2 +- .../vendor/core_maths/.cargo_vcs_info.json | 6 - deps/crates/vendor/core_maths/Cargo.toml.orig | 11 - .../diplomat-runtime/.cargo-checksum.json | 2 +- .../diplomat-runtime/.cargo_vcs_info.json | 6 - .../crates/vendor/diplomat-runtime/Cargo.lock | 288 - .../crates/vendor/diplomat-runtime/Cargo.toml | 2 +- .../vendor/diplomat-runtime/Cargo.toml.orig | 23 - .../vendor/diplomat/.cargo-checksum.json | 2 +- .../vendor/diplomat/.cargo_vcs_info.json | 6 - deps/crates/vendor/diplomat/Cargo.lock | 299 - deps/crates/vendor/diplomat/Cargo.toml | 4 +- deps/crates/vendor/diplomat/Cargo.toml.orig | 27 - .../vendor/diplomat_core/.cargo-checksum.json | 2 +- .../vendor/diplomat_core/.cargo_vcs_info.json | 6 - deps/crates/vendor/diplomat_core/Cargo.lock | 236 - deps/crates/vendor/diplomat_core/Cargo.toml | 2 +- .../vendor/diplomat_core/Cargo.toml.orig | 35 - .../vendor/diplomat_core/src/ast/methods.rs | 10 +- .../vendor/diplomat_core/src/ast/modules.rs | 41 +- ...re__ast__methods__tests__cfged_method.snap | 7 +- ...__methods__tests__nonstatic_methods-2.snap | 7 +- ...st__methods__tests__nonstatic_methods.snap | 7 +- ...ast__methods__tests__static_methods-2.snap | 7 +- ...__ast__methods__tests__static_methods.snap | 7 +- ...st__modules__tests__method_visibility.snap | 5 - ...core__ast__modules__tests__simple_mod.snap | 20 - .../vendor/diplomat_core/src/hir/attrs.rs | 4 +- .../vendor/diplomat_core/src/hir/elision.rs | 9 +- .../vendor/diplomat_core/src/hir/lowering.rs | 52 +- .../vendor/diplomat_core/src/hir/methods.rs | 6 +- .../diplomat_core/src/hir/ty_position.rs | 45 +- .../diplomat_core/src/hir/type_context.rs | 19 +- .../vendor/displaydoc/.cargo-checksum.json | 2 +- .../vendor/displaydoc/.cargo_vcs_info.json | 6 - .../displaydoc/.github/workflows/ci.yml | 120 - deps/crates/vendor/displaydoc/Cargo.toml.orig | 81 - .../vendor/icu_calendar/.cargo-checksum.json | 2 +- .../vendor/icu_calendar/.cargo_vcs_info.json | 6 - deps/crates/vendor/icu_calendar/Cargo.lock | 1317 --- deps/crates/vendor/icu_calendar/Cargo.toml | 71 +- .../vendor/icu_calendar/Cargo.toml.orig | 75 - .../vendor/icu_calendar/benches/convert.rs | 26 +- .../vendor/icu_calendar/benches/date.rs | 167 +- .../icu_calendar/benches/fixtures/mod.rs | 18 + .../vendor/icu_calendar/src/any_calendar.rs | 741 +- .../src/cal/abstract_gregorian.rs | 367 - .../vendor/icu_calendar/src/cal/buddhist.rs | 164 +- .../vendor/icu_calendar/src/cal/chinese.rs | 1039 +++ .../icu_calendar/src/cal/chinese_based.rs | 446 + .../vendor/icu_calendar/src/cal/coptic.rs | 221 +- .../vendor/icu_calendar/src/cal/dangi.rs | 932 ++ .../src/cal/east_asian_traditional.rs | 1940 ---- .../cal/east_asian_traditional/china_data.rs | 225 - .../cal/east_asian_traditional/korea_data.rs | 225 - .../cal/east_asian_traditional/qing_data.rs | 32 - .../src/cal/east_asian_traditional/simple.rs | 190 - .../vendor/icu_calendar/src/cal/ethiopian.rs | 321 +- .../vendor/icu_calendar/src/cal/gregorian.rs | 218 +- .../vendor/icu_calendar/src/cal/hebrew.rs | 437 +- .../vendor/icu_calendar/src/cal/hijri.rs | 1853 ++-- .../src/cal/hijri/simulated_mecca_data.rs | 269 - .../src/cal/hijri/ummalqura_data.rs | 697 +- .../vendor/icu_calendar/src/cal/indian.rs | 244 +- .../crates/vendor/icu_calendar/src/cal/iso.rs | 300 +- .../vendor/icu_calendar/src/cal/japanese.rs | 815 +- .../vendor/icu_calendar/src/cal/julian.rs | 227 +- .../crates/vendor/icu_calendar/src/cal/mod.rs | 68 +- .../vendor/icu_calendar/src/cal/persian.rs | 213 +- .../crates/vendor/icu_calendar/src/cal/roc.rs | 170 +- .../vendor/icu_calendar/src/calendar.rs | 103 +- .../icu_calendar/src/calendar_arithmetic.rs | 876 +- deps/crates/vendor/icu_calendar/src/date.rs | 207 +- .../vendor/icu_calendar/src/duration.rs | 288 +- deps/crates/vendor/icu_calendar/src/error.rs | 392 +- deps/crates/vendor/icu_calendar/src/ixdtf.rs | 12 +- deps/crates/vendor/icu_calendar/src/lib.rs | 8 +- .../crates/vendor/icu_calendar/src/options.rs | 559 -- .../vendor/icu_calendar/src/provider.rs | 15 +- .../src/provider/chinese_based.rs | 298 + .../vendor/icu_calendar/src/provider/hijri.rs | 165 + .../icu_calendar/src/tests/continuity_test.rs | 204 +- .../vendor/icu_calendar/src/tests/extrema.rs | 69 - .../vendor/icu_calendar/src/tests/mod.rs | 2 - .../src/tests/not_enough_fields.rs | 237 - deps/crates/vendor/icu_calendar/src/types.rs | 435 +- deps/crates/vendor/icu_calendar/src/week.rs | 10 +- .../vendor/icu_calendar/tests/arithmetic.rs | 251 - .../vendor/icu_calendar/tests/exhaustive.rs | 201 - .../icu_calendar/tests/extended_year.rs | 85 - .../icu_calendar/tests/reference_year.rs | 323 - .../icu_calendar_data/.cargo-checksum.json | 2 +- .../icu_calendar_data/.cargo_vcs_info.json | 6 - .../vendor/icu_calendar_data/Cargo.lock | 7 - .../vendor/icu_calendar_data/Cargo.toml | 8 +- .../vendor/icu_calendar_data/Cargo.toml.orig | 27 - .../crates/vendor/icu_calendar_data/README.md | 2 +- .../data/calendar_chinese_v1.rs.data | 75 + .../data/calendar_dangi_v1.rs.data | 75 + .../calendar_hijri_simulated_mecca_v1.rs.data | 75 + .../calendar_japanese_extended_v1.rs.data | 19 +- .../data/calendar_japanese_modern_v1.rs.data | 19 +- .../data/calendar_week_v1.rs.data | 17 +- .../vendor/icu_calendar_data/data/mod.rs | 13 +- .../vendor/icu_calendar_data/src/lib.rs | 2 +- .../icu_collections/.cargo-checksum.json | 2 +- .../icu_collections/.cargo_vcs_info.json | 6 - deps/crates/vendor/icu_collections/Cargo.lock | 287 +- deps/crates/vendor/icu_collections/Cargo.toml | 26 +- .../vendor/icu_collections/Cargo.toml.orig | 66 - .../icu_collections/benches/inv_list.rs | 2 +- .../examples/unicode_bmp_blocks_selector.rs | 71 + .../icu_collections/src/char16trie/trie.rs | 5 +- .../src/codepointinvlist/builder.rs | 14 +- .../src/codepointinvlist/conversions.rs | 2 +- .../src/codepointinvlist/cpinvlist.rs | 18 +- .../src/codepointinvlist/mod.rs | 2 + .../src/codepointinvlist/utils.rs | 6 +- .../src/codepointinvliststringlist/mod.rs | 1 - .../src/codepointtrie/cptrie.rs | 625 +- .../src/codepointtrie/error.rs | 6 - .../icu_collections/src/codepointtrie/mod.rs | 6 +- .../src/codepointtrie/planes.rs | 6 +- .../src/codepointtrie/serde.rs | 28 +- .../icu_collections/src/codepointtrie/toml.rs | 3 +- .../icu_collections/src/iterator_utils.rs | 2 +- .../vendor/icu_collections/tests/cpt.rs | 4 +- .../vendor/icu_locale/.cargo-checksum.json | 2 +- .../vendor/icu_locale/.cargo_vcs_info.json | 6 - deps/crates/vendor/icu_locale/Cargo.lock | 845 -- deps/crates/vendor/icu_locale/Cargo.toml | 25 +- deps/crates/vendor/icu_locale/Cargo.toml.orig | 62 - .../vendor/icu_locale/src/canonicalizer.rs | 5 +- deps/crates/vendor/icu_locale/src/expander.rs | 2 +- .../icu_locale/src/fallback/algorithms.rs | 2 + .../vendor/icu_locale/src/fallback/mod.rs | 9 +- .../icu_locale/tests/locale_canonicalizer.rs | 12 +- .../icu_locale_core/.cargo-checksum.json | 2 +- .../icu_locale_core/.cargo_vcs_info.json | 7 - deps/crates/vendor/icu_locale_core/Cargo.lock | 165 - deps/crates/vendor/icu_locale_core/Cargo.toml | 51 +- .../vendor/icu_locale_core/Cargo.toml.orig | 55 - .../crates/vendor/icu_locale_core/src/data.rs | 7 +- .../icu_locale_core/src/extensions/mod.rs | 6 +- .../src/extensions/other/mod.rs | 20 +- .../src/extensions/private/mod.rs | 9 +- .../src/extensions/transform/fields.rs | 20 +- .../src/extensions/transform/mod.rs | 9 +- .../src/extensions/transform/value.rs | 7 +- .../src/extensions/unicode/attributes.rs | 29 - .../src/extensions/unicode/keywords.rs | 35 - .../src/extensions/unicode/mod.rs | 27 +- .../src/extensions/unicode/subdivision.rs | 4 +- .../src/extensions/unicode/value.rs | 31 +- .../vendor/icu_locale_core/src/helpers.rs | 34 +- .../vendor/icu_locale_core/src/langid.rs | 29 +- deps/crates/vendor/icu_locale_core/src/lib.rs | 2 +- .../vendor/icu_locale_core/src/locale.rs | 31 +- .../vendor/icu_locale_core/src/macros.rs | 2 + .../icu_locale_core/src/parser/langid.rs | 4 +- .../icu_locale_core/src/parser/locale.rs | 2 +- .../vendor/icu_locale_core/src/parser/mod.rs | 2 +- .../extensions/unicode/keywords/calendar.rs | 3 + .../extensions/unicode/keywords/collation.rs | 4 + .../unicode/keywords/currency_format.rs | 2 + .../unicode/keywords/dictionary_break.rs | 9 +- .../extensions/unicode/keywords/emoji.rs | 2 + .../extensions/unicode/keywords/first_day.rs | 2 + .../extensions/unicode/keywords/hour_cycle.rs | 2 + .../extensions/unicode/keywords/line_break.rs | 2 + .../unicode/keywords/line_break_word.rs | 2 + .../unicode/keywords/measurement_system.rs | 2 + .../keywords/measurement_unit_override.rs | 2 + .../extensions/unicode/keywords/mod.rs | 2 - .../unicode/keywords/regional_subdivision.rs | 17 +- .../unicode/keywords/sentence_supression.rs | 2 + .../extensions/unicode/keywords/variant.rs | 2 + .../extensions/unicode/macros/enum_keyword.rs | 26 +- .../extensions/unicode/macros/mod.rs | 2 + .../icu_locale_core/src/preferences/locale.rs | 3 +- .../icu_locale_core/src/preferences/mod.rs | 68 +- .../vendor/icu_locale_core/src/serde.rs | 113 +- .../icu_locale_core/src/shortvec/litemap.rs | 2 - .../icu_locale_core/src/shortvec/mod.rs | 42 +- .../vendor/icu_locale_core/src/subtags/mod.rs | 2 +- .../icu_locale_core/src/subtags/variants.rs | 2 - .../vendor/icu_locale_core/src/zerovec.rs | 2 +- .../icu_locale_core/tests/fixtures/mod.rs | 2 +- .../icu_locale_data/.cargo-checksum.json | 2 +- .../icu_locale_data/.cargo_vcs_info.json | 6 - deps/crates/vendor/icu_locale_data/Cargo.lock | 7 - deps/crates/vendor/icu_locale_data/Cargo.toml | 8 +- .../vendor/icu_locale_data/Cargo.toml.orig | 27 - deps/crates/vendor/icu_locale_data/README.md | 2 +- .../data/locale_aliases_v1.rs.data | 23 +- ...e_exemplar_characters_auxiliary_v1.rs.data | 65 +- ...ocale_exemplar_characters_index_v1.rs.data | 60 +- ...locale_exemplar_characters_main_v1.rs.data | 75 +- ...ale_exemplar_characters_numbers_v1.rs.data | 58 +- ...exemplar_characters_punctuation_v1.rs.data | 69 +- .../locale_likely_subtags_extended_v1.rs.data | 31 +- .../locale_likely_subtags_language_v1.rs.data | 28 +- ...le_likely_subtags_script_region_v1.rs.data | 25 +- .../data/locale_parents_v1.rs.data | 23 +- .../data/locale_script_direction_v1.rs.data | 23 +- .../crates/vendor/icu_locale_data/data/mod.rs | 8 +- deps/crates/vendor/icu_locale_data/src/lib.rs | 2 +- .../vendor/icu_provider/.cargo-checksum.json | 2 +- .../vendor/icu_provider/.cargo_vcs_info.json | 6 - deps/crates/vendor/icu_provider/Cargo.lock | 803 -- deps/crates/vendor/icu_provider/Cargo.toml | 51 +- .../vendor/icu_provider/Cargo.toml.orig | 90 - deps/crates/vendor/icu_provider/src/baked.rs | 4 - .../vendor/icu_provider/src/baked/zerotrie.rs | 48 +- .../vendor/icu_provider/src/buf/serde.rs | 4 +- .../vendor/icu_provider/src/constructors.rs | 6 +- .../vendor/icu_provider/src/data_provider.rs | 10 +- .../crates/vendor/icu_provider/src/dynutil.rs | 2 +- deps/crates/vendor/icu_provider/src/error.rs | 6 +- .../vendor/icu_provider/src/export/payload.rs | 2 +- .../vendor/icu_provider/src/hello_world.rs | 12 +- deps/crates/vendor/icu_provider/src/lib.rs | 7 +- deps/crates/vendor/icu_provider/src/marker.rs | 12 +- .../crates/vendor/icu_provider/src/request.rs | 12 +- .../vendor/icu_provider/src/response.rs | 35 +- .../vendor/icu_provider/src/varule_traits.rs | 38 +- .../vendor/ixdtf-0.5.0/.cargo-checksum.json | 1 + deps/crates/vendor/ixdtf-0.5.0/Cargo.toml | 66 + deps/crates/vendor/ixdtf-0.5.0/LICENSE | 46 + deps/crates/vendor/ixdtf-0.5.0/README.md | 380 + deps/crates/vendor/ixdtf-0.5.0/src/error.rs | 115 + deps/crates/vendor/ixdtf-0.5.0/src/lib.rs | 399 + .../ixdtf-0.5.0/src/parsers/annotations.rs | 175 + .../ixdtf-0.5.0/src/parsers/datetime.rs | 327 + .../ixdtf-0.5.0/src/parsers/duration.rs | 213 + .../vendor/ixdtf-0.5.0/src/parsers/grammar.rs | 169 + .../vendor/ixdtf-0.5.0/src/parsers/mod.rs | 542 ++ .../vendor/ixdtf-0.5.0/src/parsers/records.rs | 359 + .../vendor/ixdtf-0.5.0/src/parsers/tests.rs | 1395 +++ .../vendor/ixdtf-0.5.0/src/parsers/time.rs | 173 + .../ixdtf-0.5.0/src/parsers/timezone.rs | 205 + deps/crates/vendor/ixdtf/.cargo-checksum.json | 2 +- deps/crates/vendor/ixdtf/.cargo_vcs_info.json | 6 - deps/crates/vendor/ixdtf/Cargo.lock | 557 -- deps/crates/vendor/ixdtf/Cargo.toml | 62 +- deps/crates/vendor/ixdtf/Cargo.toml.orig | 42 - deps/crates/vendor/ixdtf/src/core.rs | 79 +- deps/crates/vendor/ixdtf/src/encoding.rs | 85 - deps/crates/vendor/ixdtf/src/error.rs | 4 + deps/crates/vendor/ixdtf/src/lib.rs | 36 +- .../vendor/ixdtf/src/parsers/annotations.rs | 2 +- .../vendor/ixdtf/src/parsers/datetime.rs | 20 +- .../vendor/ixdtf/src/parsers/duration.rs | 46 +- deps/crates/vendor/ixdtf/src/parsers/mod.rs | 12 +- deps/crates/vendor/ixdtf/src/parsers/tests.rs | 4 +- deps/crates/vendor/ixdtf/src/parsers/time.rs | 2 +- .../vendor/ixdtf/src/parsers/timezone.rs | 31 +- deps/crates/vendor/ixdtf/src/records.rs | 12 +- deps/crates/vendor/libm/.cargo-checksum.json | 2 +- deps/crates/vendor/libm/.cargo_vcs_info.json | 6 - deps/crates/vendor/libm/CHANGELOG.md | 16 - deps/crates/vendor/libm/Cargo.lock | 56 - deps/crates/vendor/libm/Cargo.toml | 10 +- deps/crates/vendor/libm/Cargo.toml.orig | 52 - deps/crates/vendor/libm/README.md | 2 +- deps/crates/vendor/libm/configure.rs | 75 +- deps/crates/vendor/libm/src/libm_helper.rs | 2 +- deps/crates/vendor/libm/src/math/acos.rs | 2 +- deps/crates/vendor/libm/src/math/acosf.rs | 2 +- deps/crates/vendor/libm/src/math/acosh.rs | 2 +- deps/crates/vendor/libm/src/math/acoshf.rs | 2 +- .../vendor/libm/src/math/arch/aarch64.rs | 6 - deps/crates/vendor/libm/src/math/arch/i586.rs | 144 +- deps/crates/vendor/libm/src/math/arch/mod.rs | 5 - .../vendor/libm/src/math/arch/x86/detect.rs | 2 - deps/crates/vendor/libm/src/math/asin.rs | 2 +- deps/crates/vendor/libm/src/math/asinf.rs | 2 +- deps/crates/vendor/libm/src/math/asinh.rs | 2 +- deps/crates/vendor/libm/src/math/asinhf.rs | 2 +- deps/crates/vendor/libm/src/math/atan.rs | 22 +- deps/crates/vendor/libm/src/math/atan2.rs | 2 +- deps/crates/vendor/libm/src/math/atan2f.rs | 2 +- deps/crates/vendor/libm/src/math/atanf.rs | 2 +- deps/crates/vendor/libm/src/math/atanh.rs | 2 +- deps/crates/vendor/libm/src/math/atanhf.rs | 2 +- deps/crates/vendor/libm/src/math/cbrt.rs | 2 +- deps/crates/vendor/libm/src/math/cbrtf.rs | 4 +- deps/crates/vendor/libm/src/math/ceil.rs | 8 +- deps/crates/vendor/libm/src/math/copysign.rs | 18 +- deps/crates/vendor/libm/src/math/copysignf.rs | 8 + .../vendor/libm/src/math/copysignf128.rs | 8 + .../vendor/libm/src/math/copysignf16.rs | 8 + deps/crates/vendor/libm/src/math/cos.rs | 2 +- deps/crates/vendor/libm/src/math/cosf.rs | 2 +- deps/crates/vendor/libm/src/math/cosh.rs | 2 +- deps/crates/vendor/libm/src/math/coshf.rs | 2 +- deps/crates/vendor/libm/src/math/erf.rs | 2 +- deps/crates/vendor/libm/src/math/erff.rs | 2 +- deps/crates/vendor/libm/src/math/exp.rs | 8 +- deps/crates/vendor/libm/src/math/exp10.rs | 8 +- deps/crates/vendor/libm/src/math/exp10f.rs | 8 +- deps/crates/vendor/libm/src/math/exp2.rs | 8 +- deps/crates/vendor/libm/src/math/exp2f.rs | 8 +- deps/crates/vendor/libm/src/math/expf.rs | 8 +- deps/crates/vendor/libm/src/math/expm1.rs | 4 +- deps/crates/vendor/libm/src/math/expm1f.rs | 6 +- deps/crates/vendor/libm/src/math/expo2.rs | 2 +- deps/crates/vendor/libm/src/math/fabs.rs | 8 +- deps/crates/vendor/libm/src/math/fabsf.rs | 39 + deps/crates/vendor/libm/src/math/fabsf128.rs | 31 + deps/crates/vendor/libm/src/math/fabsf16.rs | 31 + deps/crates/vendor/libm/src/math/fdim.rs | 8 +- deps/crates/vendor/libm/src/math/fdimf.rs | 12 + deps/crates/vendor/libm/src/math/fdimf128.rs | 12 + deps/crates/vendor/libm/src/math/fdimf16.rs | 12 + deps/crates/vendor/libm/src/math/floor.rs | 8 +- deps/crates/vendor/libm/src/math/floorf.rs | 13 + deps/crates/vendor/libm/src/math/floorf128.rs | 7 + deps/crates/vendor/libm/src/math/floorf16.rs | 7 + deps/crates/vendor/libm/src/math/fma.rs | 8 +- deps/crates/vendor/libm/src/math/fmin_fmax.rs | 138 +- .../vendor/libm/src/math/fminimum_fmaximum.rs | 142 +- .../libm/src/math/fminimum_fmaximum_num.rs | 154 +- deps/crates/vendor/libm/src/math/fmod.rs | 8 +- deps/crates/vendor/libm/src/math/fmodf.rs | 5 + deps/crates/vendor/libm/src/math/fmodf128.rs | 5 + deps/crates/vendor/libm/src/math/fmodf16.rs | 5 + deps/crates/vendor/libm/src/math/frexp.rs | 2 +- deps/crates/vendor/libm/src/math/frexpf.rs | 2 +- .../vendor/libm/src/math/generic/fmax.rs | 3 +- .../vendor/libm/src/math/generic/fmaximum.rs | 7 +- .../libm/src/math/generic/fmaximum_num.rs | 24 +- .../vendor/libm/src/math/generic/fmin.rs | 3 +- .../vendor/libm/src/math/generic/fminimum.rs | 7 +- .../libm/src/math/generic/fminimum_num.rs | 24 +- .../vendor/libm/src/math/generic/fmod.rs | 66 +- .../vendor/libm/src/math/generic/scalbn.rs | 4 +- deps/crates/vendor/libm/src/math/hypot.rs | 4 +- deps/crates/vendor/libm/src/math/hypotf.rs | 4 +- deps/crates/vendor/libm/src/math/ilogb.rs | 2 +- deps/crates/vendor/libm/src/math/ilogbf.rs | 2 +- deps/crates/vendor/libm/src/math/j0.rs | 4 +- deps/crates/vendor/libm/src/math/j0f.rs | 4 +- deps/crates/vendor/libm/src/math/j1.rs | 4 +- deps/crates/vendor/libm/src/math/j1f.rs | 7 +- deps/crates/vendor/libm/src/math/jn.rs | 4 +- deps/crates/vendor/libm/src/math/jnf.rs | 4 +- deps/crates/vendor/libm/src/math/k_cos.rs | 2 +- deps/crates/vendor/libm/src/math/k_cosf.rs | 2 +- deps/crates/vendor/libm/src/math/k_expo2.rs | 2 +- deps/crates/vendor/libm/src/math/k_expo2f.rs | 2 +- deps/crates/vendor/libm/src/math/k_sin.rs | 2 +- deps/crates/vendor/libm/src/math/k_sinf.rs | 2 +- deps/crates/vendor/libm/src/math/k_tan.rs | 2 +- deps/crates/vendor/libm/src/math/k_tanf.rs | 2 +- deps/crates/vendor/libm/src/math/ldexp.rs | 8 +- deps/crates/vendor/libm/src/math/ldexpf.rs | 4 + deps/crates/vendor/libm/src/math/ldexpf128.rs | 4 + deps/crates/vendor/libm/src/math/ldexpf16.rs | 4 + deps/crates/vendor/libm/src/math/lgamma.rs | 2 +- deps/crates/vendor/libm/src/math/lgamma_r.rs | 2 +- deps/crates/vendor/libm/src/math/lgammaf.rs | 2 +- deps/crates/vendor/libm/src/math/lgammaf_r.rs | 2 +- deps/crates/vendor/libm/src/math/log.rs | 2 +- deps/crates/vendor/libm/src/math/log10.rs | 4 +- deps/crates/vendor/libm/src/math/log10f.rs | 4 +- deps/crates/vendor/libm/src/math/log1p.rs | 4 +- deps/crates/vendor/libm/src/math/log1pf.rs | 4 +- deps/crates/vendor/libm/src/math/log2.rs | 4 +- deps/crates/vendor/libm/src/math/log2f.rs | 4 +- deps/crates/vendor/libm/src/math/logf.rs | 2 +- deps/crates/vendor/libm/src/math/mod.rs | 2 - deps/crates/vendor/libm/src/math/modf.rs | 2 +- deps/crates/vendor/libm/src/math/modff.rs | 2 +- deps/crates/vendor/libm/src/math/nextafter.rs | 2 +- .../crates/vendor/libm/src/math/nextafterf.rs | 2 +- deps/crates/vendor/libm/src/math/pow.rs | 2 +- deps/crates/vendor/libm/src/math/powf.rs | 2 +- deps/crates/vendor/libm/src/math/rem_pio2.rs | 4 +- .../vendor/libm/src/math/rem_pio2_large.rs | 14 +- deps/crates/vendor/libm/src/math/rem_pio2f.rs | 4 +- deps/crates/vendor/libm/src/math/remainder.rs | 2 +- .../crates/vendor/libm/src/math/remainderf.rs | 2 +- deps/crates/vendor/libm/src/math/remquo.rs | 2 +- deps/crates/vendor/libm/src/math/remquof.rs | 2 +- deps/crates/vendor/libm/src/math/rint.rs | 8 +- deps/crates/vendor/libm/src/math/round.rs | 8 +- deps/crates/vendor/libm/src/math/roundeven.rs | 8 +- deps/crates/vendor/libm/src/math/roundf.rs | 5 + deps/crates/vendor/libm/src/math/roundf128.rs | 5 + deps/crates/vendor/libm/src/math/roundf16.rs | 5 + deps/crates/vendor/libm/src/math/scalbn.rs | 8 +- deps/crates/vendor/libm/src/math/scalbnf.rs | 4 + .../crates/vendor/libm/src/math/scalbnf128.rs | 4 + deps/crates/vendor/libm/src/math/scalbnf16.rs | 4 + deps/crates/vendor/libm/src/math/sin.rs | 2 +- deps/crates/vendor/libm/src/math/sincos.rs | 2 +- deps/crates/vendor/libm/src/math/sincosf.rs | 2 +- deps/crates/vendor/libm/src/math/sinf.rs | 2 +- deps/crates/vendor/libm/src/math/sinh.rs | 2 +- deps/crates/vendor/libm/src/math/sinhf.rs | 2 +- deps/crates/vendor/libm/src/math/sqrt.rs | 8 +- deps/crates/vendor/libm/src/math/sqrtf.rs | 15 + deps/crates/vendor/libm/src/math/sqrtf128.rs | 5 + deps/crates/vendor/libm/src/math/sqrtf16.rs | 11 + .../vendor/libm/src/math/support/big.rs | 133 +- .../vendor/libm/src/math/support/big/tests.rs | 89 +- .../libm/src/math/support/float_traits.rs | 17 +- .../vendor/libm/src/math/support/hex_float.rs | 207 +- .../libm/src/math/support/int_traits.rs | 50 +- .../math/support/int_traits/narrowing_div.rs | 175 - .../vendor/libm/src/math/support/macros.rs | 10 +- .../vendor/libm/src/math/support/mod.rs | 11 +- .../vendor/libm/src/math/support/modular.rs | 304 - deps/crates/vendor/libm/src/math/tan.rs | 2 +- deps/crates/vendor/libm/src/math/tanf.rs | 2 +- deps/crates/vendor/libm/src/math/tanh.rs | 2 +- deps/crates/vendor/libm/src/math/tanhf.rs | 2 +- deps/crates/vendor/libm/src/math/tgamma.rs | 2 +- deps/crates/vendor/libm/src/math/tgammaf.rs | 2 +- deps/crates/vendor/libm/src/math/trunc.rs | 8 +- deps/crates/vendor/libm/src/math/truncf.rs | 23 + deps/crates/vendor/libm/src/math/truncf128.rs | 7 + deps/crates/vendor/libm/src/math/truncf16.rs | 7 + .../vendor/litemap/.cargo-checksum.json | 2 +- .../vendor/litemap/.cargo_vcs_info.json | 6 - deps/crates/vendor/litemap/Cargo.lock | 202 +- deps/crates/vendor/litemap/Cargo.toml | 60 +- deps/crates/vendor/litemap/Cargo.toml.orig | 83 - deps/crates/vendor/litemap/src/databake.rs | 2 +- deps/crates/vendor/litemap/src/lib.rs | 29 +- deps/crates/vendor/litemap/src/map.rs | 4 +- deps/crates/vendor/litemap/src/serde.rs | 4 +- deps/crates/vendor/litemap/src/store/mod.rs | 16 +- .../vendor/litemap/src/store/vec_impl.rs | 2 +- deps/crates/vendor/litemap/src/testing.rs | 4 +- deps/crates/vendor/litemap/tests/store.rs | 2 +- .../vendor/num-traits/.cargo-checksum.json | 2 +- .../vendor/num-traits/.cargo_vcs_info.json | 6 - deps/crates/vendor/num-traits/Cargo.toml.orig | 34 - .../vendor/potential_utf/.cargo-checksum.json | 2 +- .../vendor/potential_utf/.cargo_vcs_info.json | 6 - deps/crates/vendor/potential_utf/Cargo.lock | 152 - deps/crates/vendor/potential_utf/Cargo.toml | 66 +- .../vendor/potential_utf/Cargo.toml.orig | 38 - deps/crates/vendor/potential_utf/src/lib.rs | 6 +- deps/crates/vendor/potential_utf/src/uchar.rs | 2 +- deps/crates/vendor/potential_utf/src/ustr.rs | 14 +- .../vendor/proc-macro2/.cargo-checksum.json | 2 +- .../vendor/proc-macro2/.cargo_vcs_info.json | 6 - .../vendor/proc-macro2/.github/FUNDING.yml | 1 - .../proc-macro2/.github/workflows/ci.yml | 232 - deps/crates/vendor/proc-macro2/Cargo.lock | 251 - deps/crates/vendor/proc-macro2/Cargo.toml | 4 +- .../crates/vendor/proc-macro2/Cargo.toml.orig | 67 - deps/crates/vendor/proc-macro2/README.md | 2 +- .../crates/vendor/proc-macro2/src/fallback.rs | 71 +- deps/crates/vendor/proc-macro2/src/lib.rs | 48 +- deps/crates/vendor/proc-macro2/src/parse.rs | 58 +- .../proc-macro2/src/probe/proc_macro_span.rs | 4 - .../src/probe/proc_macro_span_file.rs | 5 - .../src/probe/proc_macro_span_location.rs | 4 - deps/crates/vendor/proc-macro2/src/rcvec.rs | 2 +- .../proc-macro2/src/rustc_literal_escaper.rs | 8 +- deps/crates/vendor/proc-macro2/src/wrapper.rs | 18 +- deps/crates/vendor/proc-macro2/tests/test.rs | 5 +- .../vendor/proc-macro2/tests/test_size.rs | 2 + deps/crates/vendor/quote/.cargo-checksum.json | 2 +- deps/crates/vendor/quote/.cargo_vcs_info.json | 6 - deps/crates/vendor/quote/.github/FUNDING.yml | 1 - .../vendor/quote/.github/workflows/ci.yml | 112 - deps/crates/vendor/quote/Cargo.lock | 256 - deps/crates/vendor/quote/Cargo.toml | 6 +- deps/crates/vendor/quote/Cargo.toml.orig | 39 - deps/crates/vendor/quote/README.md | 1 + deps/crates/vendor/quote/src/ext.rs | 6 +- deps/crates/vendor/quote/src/format.rs | 14 +- .../crates/vendor/quote/src/ident_fragment.rs | 3 +- deps/crates/vendor/quote/src/lib.rs | 52 +- deps/crates/vendor/quote/src/runtime.rs | 7 +- deps/crates/vendor/quote/src/to_tokens.rs | 14 +- deps/crates/vendor/quote/tests/test.rs | 7 - ...does-not-have-iter-interpolated-dup.stderr | 4 +- .../ui/does-not-have-iter-interpolated.stderr | 4 +- .../ui/does-not-have-iter-separated.stderr | 4 +- .../quote/tests/ui/does-not-have-iter.stderr | 4 +- .../vendor/quote/tests/ui/not-quotable.stderr | 2 +- .../quote/tests/ui/not-repeatable.stderr | 28 +- deps/crates/vendor/serde/.cargo-checksum.json | 2 +- deps/crates/vendor/serde/.cargo_vcs_info.json | 6 - deps/crates/vendor/serde/Cargo.lock | 66 - deps/crates/vendor/serde/Cargo.toml.orig | 62 - .../vendor/serde_core/.cargo-checksum.json | 2 +- .../vendor/serde_core/.cargo_vcs_info.json | 6 - deps/crates/vendor/serde_core/Cargo.lock | 63 - deps/crates/vendor/serde_core/Cargo.toml.orig | 70 - .../vendor/serde_derive/.cargo-checksum.json | 2 +- .../vendor/serde_derive/.cargo_vcs_info.json | 6 - deps/crates/vendor/serde_derive/Cargo.lock | 77 - .../vendor/serde_derive/Cargo.toml.orig | 42 - .../vendor/smallvec/.cargo-checksum.json | 2 +- .../vendor/smallvec/.cargo_vcs_info.json | 6 - .../smallvec/.github/workflows/main.yml | 114 - deps/crates/vendor/smallvec/Cargo.lock | 198 - deps/crates/vendor/smallvec/Cargo.toml.orig | 54 - .../stable_deref_trait/.cargo-checksum.json | 2 +- .../stable_deref_trait/.cargo_vcs_info.json | 6 - .../vendor/stable_deref_trait/Cargo.lock | 7 - .../vendor/stable_deref_trait/Cargo.toml.orig | 17 - deps/crates/vendor/strck/.cargo-checksum.json | 2 +- deps/crates/vendor/strck/.cargo_vcs_info.json | 6 - deps/crates/vendor/strck/Cargo.toml.orig | 30 - deps/crates/vendor/syn/.cargo-checksum.json | 2 +- deps/crates/vendor/syn/.cargo_vcs_info.json | 6 - deps/crates/vendor/syn/Cargo.lock | 2305 ----- deps/crates/vendor/syn/Cargo.toml | 6 +- deps/crates/vendor/syn/Cargo.toml.orig | 95 - deps/crates/vendor/syn/benches/rust.rs | 3 +- deps/crates/vendor/syn/src/attr.rs | 13 +- deps/crates/vendor/syn/src/bigint.rs | 4 +- deps/crates/vendor/syn/src/buffer.rs | 12 +- deps/crates/vendor/syn/src/classify.rs | 4 +- .../vendor/syn/src/custom_punctuation.rs | 2 +- deps/crates/vendor/syn/src/data.rs | 1 - deps/crates/vendor/syn/src/derive.rs | 1 - deps/crates/vendor/syn/src/discouraged.rs | 6 +- deps/crates/vendor/syn/src/drops.rs | 12 +- deps/crates/vendor/syn/src/error.rs | 21 +- deps/crates/vendor/syn/src/export.rs | 28 +- deps/crates/vendor/syn/src/expr.rs | 26 +- deps/crates/vendor/syn/src/ext.rs | 3 +- deps/crates/vendor/syn/src/file.rs | 3 - deps/crates/vendor/syn/src/gen/debug.rs | 2 +- deps/crates/vendor/syn/src/gen/eq.rs | 2 - deps/crates/vendor/syn/src/gen/fold.rs | 4 - deps/crates/vendor/syn/src/gen/hash.rs | 4 +- deps/crates/vendor/syn/src/gen/visit_mut.rs | 2 - deps/crates/vendor/syn/src/generics.rs | 17 +- deps/crates/vendor/syn/src/ident.rs | 1 - deps/crates/vendor/syn/src/item.rs | 124 +- deps/crates/vendor/syn/src/lib.rs | 11 +- deps/crates/vendor/syn/src/lifetime.rs | 6 +- deps/crates/vendor/syn/src/lit.rs | 36 +- deps/crates/vendor/syn/src/lookahead.rs | 6 +- deps/crates/vendor/syn/src/macros.rs | 2 +- deps/crates/vendor/syn/src/meta.rs | 2 +- deps/crates/vendor/syn/src/parse.rs | 29 +- deps/crates/vendor/syn/src/parse_quote.rs | 6 +- deps/crates/vendor/syn/src/pat.rs | 4 - deps/crates/vendor/syn/src/path.rs | 19 +- deps/crates/vendor/syn/src/precedence.rs | 2 +- deps/crates/vendor/syn/src/punctuated.rs | 17 +- deps/crates/vendor/syn/src/restriction.rs | 2 - deps/crates/vendor/syn/src/spanned.rs | 4 +- deps/crates/vendor/syn/src/stmt.rs | 4 - deps/crates/vendor/syn/src/thread.rs | 4 +- deps/crates/vendor/syn/src/token.rs | 23 +- deps/crates/vendor/syn/src/tt.rs | 3 +- deps/crates/vendor/syn/src/ty.rs | 8 +- deps/crates/vendor/syn/src/verbatim.rs | 2 +- deps/crates/vendor/syn/tests/common/eq.rs | 65 +- deps/crates/vendor/syn/tests/common/parse.rs | 3 +- deps/crates/vendor/syn/tests/debug/gen.rs | 2 +- deps/crates/vendor/syn/tests/repo/progress.rs | 2 +- deps/crates/vendor/syn/tests/test_generics.rs | 11 - deps/crates/vendor/syn/tests/test_item.rs | 54 - .../vendor/syn/tests/test_parse_buffer.rs | 1 - .../vendor/syn/tests/test_precedence.rs | 6 +- .../vendor/syn/tests/test_round_trip.rs | 41 +- .../vendor/synstructure/.cargo-checksum.json | 2 +- .../vendor/synstructure/.cargo_vcs_info.json | 6 - deps/crates/vendor/synstructure/Cargo.lock | 54 - .../vendor/synstructure/Cargo.toml.orig | 35 - .../vendor/temporal_capi/.cargo-checksum.json | 2 +- .../vendor/temporal_capi/.cargo_vcs_info.json | 6 - deps/crates/vendor/temporal_capi/Cargo.lock | 490 - deps/crates/vendor/temporal_capi/Cargo.toml | 19 +- .../vendor/temporal_capi/Cargo.toml.orig | 36 - .../bindings/c/AnyCalendarKind.d.h | 31 +- .../bindings/c/ArithmeticOverflow.h | 2 +- .../bindings/c/DifferenceSettings.h | 2 +- .../temporal_capi/bindings/c/Disambiguation.h | 2 +- .../bindings/c/DisplayCalendar.h | 2 +- .../temporal_capi/bindings/c/DisplayOffset.h | 2 +- .../bindings/c/DisplayTimeZone.h | 2 +- .../temporal_capi/bindings/c/ErrorKind.h | 2 +- .../bindings/c/OffsetDisambiguation.h | 2 +- .../temporal_capi/bindings/c/PartialDate.h | 2 +- .../bindings/c/PartialDateTime.h | 2 +- .../temporal_capi/bindings/c/PartialTime.h | 2 +- .../bindings/c/PartialZonedDateTime.h | 2 +- .../temporal_capi/bindings/c/Precision.h | 2 +- .../temporal_capi/bindings/c/RelativeTo.h | 2 +- .../temporal_capi/bindings/c/RoundingMode.h | 2 +- .../bindings/c/RoundingOptions.h | 2 +- .../vendor/temporal_capi/bindings/c/Sign.h | 2 +- .../temporal_capi/bindings/c/TemporalError.h | 2 +- .../bindings/c/ToStringRoundingOptions.h | 2 +- .../bindings/c/TransitionDirection.h | 2 +- .../vendor/temporal_capi/bindings/c/Unit.h | 2 +- .../bindings/c/UnsignedRoundingMode.h | 2 +- .../cpp/temporal_rs/AnyCalendarKind.d.hpp | 64 +- .../cpp/temporal_rs/AnyCalendarKind.hpp | 3 +- .../cpp/temporal_rs/ArithmeticOverflow.hpp | 2 + .../cpp/temporal_rs/DifferenceSettings.hpp | 2 + .../cpp/temporal_rs/Disambiguation.hpp | 2 + .../cpp/temporal_rs/DisplayCalendar.hpp | 2 + .../cpp/temporal_rs/DisplayOffset.hpp | 2 + .../cpp/temporal_rs/DisplayTimeZone.hpp | 2 + .../bindings/cpp/temporal_rs/ErrorKind.hpp | 2 + .../cpp/temporal_rs/OffsetDisambiguation.hpp | 2 + .../bindings/cpp/temporal_rs/PartialDate.hpp | 2 + .../cpp/temporal_rs/PartialDateTime.hpp | 2 + .../bindings/cpp/temporal_rs/PartialTime.hpp | 2 + .../cpp/temporal_rs/PartialZonedDateTime.hpp | 2 + .../bindings/cpp/temporal_rs/Precision.hpp | 2 + .../bindings/cpp/temporal_rs/RelativeTo.hpp | 2 + .../bindings/cpp/temporal_rs/RoundingMode.hpp | 2 + .../cpp/temporal_rs/RoundingOptions.hpp | 2 + .../bindings/cpp/temporal_rs/Sign.hpp | 2 + .../cpp/temporal_rs/TemporalError.hpp | 2 + .../temporal_rs/ToStringRoundingOptions.hpp | 2 + .../cpp/temporal_rs/TransitionDirection.hpp | 2 + .../bindings/cpp/temporal_rs/Unit.hpp | 2 + .../cpp/temporal_rs/UnsignedRoundingMode.hpp | 2 + .../cpp/temporal_rs/diplomat_runtime.hpp | 7 +- .../vendor/temporal_capi/src/calendar.rs | 8 +- .../vendor/temporal_rs/.cargo-checksum.json | 2 +- .../vendor/temporal_rs/.cargo/config.toml | 3 - .../vendor/temporal_rs/.cargo_vcs_info.json | 7 - deps/crates/vendor/temporal_rs/CHANGELOG.md | 42 +- deps/crates/vendor/temporal_rs/Cargo.lock | 632 -- deps/crates/vendor/temporal_rs/Cargo.toml | 22 +- .../crates/vendor/temporal_rs/Cargo.toml.orig | 117 - .../src/builtins/compiled/duration/tests.rs | 21 +- .../temporal_rs/src/builtins/core/calendar.rs | 358 +- .../src/builtins/core/calendar/era.rs | 159 + .../src/builtins/core/calendar/fields.rs | 38 +- .../src/builtins/core/calendar/types.rs | 570 +- .../temporal_rs/src/builtins/core/duration.rs | 21 +- .../src/builtins/core/duration/normalized.rs | 135 +- .../src/builtins/core/duration/tests.rs | 72 +- .../temporal_rs/src/builtins/core/instant.rs | 6 +- .../temporal_rs/src/builtins/core/now.rs | 17 +- .../src/builtins/core/plain_date.rs | 14 +- .../src/builtins/core/plain_date_time.rs | 25 +- .../src/builtins/core/plain_month_day.rs | 52 +- .../src/builtins/core/plain_year_month.rs | 11 +- .../src/builtins/core/time_zone.rs | 28 +- .../src/builtins/core/zoned_date_time.rs | 101 +- .../builtins/core/zoned_date_time/tests.rs | 72 +- deps/crates/vendor/temporal_rs/src/error.rs | 67 +- deps/crates/vendor/temporal_rs/src/host.rs | 12 +- deps/crates/vendor/temporal_rs/src/lib.rs | 2 +- .../temporal_rs/src/options/relative_to.rs | 2 +- .../temporal_rs/src/parsed_intermediates.rs | 5 +- deps/crates/vendor/temporal_rs/src/parsers.rs | 21 +- .../temporal_rs/src/parsers/time_zone.rs | 2 +- .../vendor/temporal_rs/src/primitive.rs | 44 - deps/crates/vendor/temporal_rs/src/sys.rs | 15 +- .../timezone_provider/.cargo-checksum.json | 2 +- .../timezone_provider/.cargo_vcs_info.json | 6 - .../vendor/timezone_provider/Cargo.lock | 422 - .../vendor/timezone_provider/Cargo.toml | 12 +- .../vendor/timezone_provider/Cargo.toml.orig | 75 - .../src/data/iana_normalizer.rs.data | 2 +- .../src/experimental_tzif/posix.rs | 10 +- .../vendor/timezone_provider/src/provider.rs | 137 - .../timezone_provider/src/tzdb/datagen.rs | 27 +- .../vendor/timezone_provider/src/tzif.rs | 2 +- .../vendor/tinystr/.cargo-checksum.json | 2 +- .../vendor/tinystr/.cargo_vcs_info.json | 6 - deps/crates/vendor/tinystr/Cargo.lock | 738 -- deps/crates/vendor/tinystr/Cargo.toml | 61 +- deps/crates/vendor/tinystr/Cargo.toml.orig | 78 - deps/crates/vendor/tinystr/src/ascii.rs | 73 +- deps/crates/vendor/tinystr/src/asciibyte.rs | 13 +- deps/crates/vendor/tinystr/src/databake.rs | 10 +- deps/crates/vendor/tinystr/src/int_ops.rs | 62 +- deps/crates/vendor/tinystr/src/lib.rs | 39 +- deps/crates/vendor/tinystr/src/unvalidated.rs | 17 +- .../vendor/unicode-ident/.cargo-checksum.json | 2 +- .../vendor/unicode-ident/.cargo_vcs_info.json | 6 - .../vendor/unicode-ident/.github/FUNDING.yml | 1 - .../unicode-ident/.github/workflows/ci.yml | 110 - deps/crates/vendor/unicode-ident/Cargo.lock | 781 -- deps/crates/vendor/unicode-ident/Cargo.toml | 16 +- .../vendor/unicode-ident/Cargo.toml.orig | 42 - deps/crates/vendor/unicode-ident/src/lib.rs | 2 +- .../crates/vendor/unicode-ident/src/tables.rs | 184 +- .../vendor/unicode-ident/tests/static_size.rs | 2 +- .../vendor/writeable/.cargo-checksum.json | 2 +- .../vendor/writeable/.cargo_vcs_info.json | 6 - deps/crates/vendor/writeable/Cargo.lock | 134 +- deps/crates/vendor/writeable/Cargo.toml | 57 +- deps/crates/vendor/writeable/Cargo.toml.orig | 48 - .../vendor/writeable/benches/writeable.rs | 8 +- .../writeable/examples/writeable_message.rs | 3 +- deps/crates/vendor/writeable/src/cmp.rs | 20 - deps/crates/vendor/writeable/src/concat.rs | 146 - deps/crates/vendor/writeable/src/impls.rs | 9 +- deps/crates/vendor/writeable/src/lib.rs | 15 +- .../writeable/src/parts_write_adapter.rs | 2 - deps/crates/vendor/writeable/src/testing.rs | 2 - .../vendor/writeable/src/try_writeable.rs | 1 - .../vendor/yoke-derive/.cargo-checksum.json | 2 +- .../vendor/yoke-derive/.cargo_vcs_info.json | 6 - deps/crates/vendor/yoke-derive/Cargo.lock | 18 +- deps/crates/vendor/yoke-derive/Cargo.toml | 59 +- .../crates/vendor/yoke-derive/Cargo.toml.orig | 35 - .../yoke-derive/examples/yoke_derive.rs | 354 +- deps/crates/vendor/yoke-derive/src/lib.rs | 652 +- .../vendor/yoke-derive/src/lifetimes.rs | 114 - deps/crates/vendor/yoke-derive/src/visitor.rs | 311 +- deps/crates/vendor/yoke/.cargo-checksum.json | 2 +- deps/crates/vendor/yoke/.cargo_vcs_info.json | 6 - deps/crates/vendor/yoke/Cargo.lock | 178 - deps/crates/vendor/yoke/Cargo.toml | 60 +- deps/crates/vendor/yoke/Cargo.toml.orig | 49 - deps/crates/vendor/yoke/src/cartable_ptr.rs | 7 +- .../vendor/yoke/src/kinda_sorta_dangling.rs | 6 +- deps/crates/vendor/yoke/src/lib.rs | 28 +- deps/crates/vendor/yoke/src/macro_impls.rs | 17 +- deps/crates/vendor/yoke/src/utils.rs | 4 +- deps/crates/vendor/yoke/src/yoke.rs | 160 +- deps/crates/vendor/yoke/src/yokeable.rs | 32 +- .../zerofrom-derive/.cargo-checksum.json | 2 +- .../zerofrom-derive/.cargo_vcs_info.json | 6 - deps/crates/vendor/zerofrom-derive/Cargo.lock | 22 +- deps/crates/vendor/zerofrom-derive/Cargo.toml | 60 +- .../vendor/zerofrom-derive/Cargo.toml.orig | 36 - .../zerofrom-derive/examples/zf_derive.rs | 36 +- deps/crates/vendor/zerofrom-derive/src/lib.rs | 15 +- .../vendor/zerofrom-derive/src/visitor.rs | 2 +- .../vendor/zerofrom/.cargo-checksum.json | 2 +- .../vendor/zerofrom/.cargo_vcs_info.json | 6 - deps/crates/vendor/zerofrom/Cargo.lock | 68 - deps/crates/vendor/zerofrom/Cargo.toml | 71 +- deps/crates/vendor/zerofrom/Cargo.toml.orig | 37 - deps/crates/vendor/zerofrom/src/lib.rs | 14 +- .../vendor/zerotrie/.cargo-checksum.json | 2 +- .../vendor/zerotrie/.cargo_vcs_info.json | 6 - deps/crates/vendor/zerotrie/Cargo.lock | 760 +- deps/crates/vendor/zerotrie/Cargo.toml | 121 +- deps/crates/vendor/zerotrie/Cargo.toml.orig | 89 - deps/crates/vendor/zerotrie/README.md | 10 - .../vendor/zerotrie/src/builder/bytestr.rs | 128 + .../vendor/zerotrie/src/builder/dense.rs | 204 - .../zerotrie/src/builder/konst/builder.rs | 155 +- .../zerotrie/src/builder/konst/store.rs | 37 +- .../vendor/zerotrie/src/builder/litemap.rs | 30 +- .../crates/vendor/zerotrie/src/builder/mod.rs | 46 +- .../zerotrie/src/builder/nonconst/builder.rs | 81 +- .../zerotrie/src/builder/nonconst/store.rs | 4 +- .../zerotrie/src/builder/slice_indices.rs | 128 - .../vendor/zerotrie/src/byte_phf/builder.rs | 2 +- .../vendor/zerotrie/src/byte_phf/mod.rs | 5 +- deps/crates/vendor/zerotrie/src/dense.rs | 236 - deps/crates/vendor/zerotrie/src/error.rs | 28 - deps/crates/vendor/zerotrie/src/helpers.rs | 15 +- deps/crates/vendor/zerotrie/src/lib.rs | 43 +- deps/crates/vendor/zerotrie/src/options.rs | 8 +- deps/crates/vendor/zerotrie/src/reader.rs | 10 +- deps/crates/vendor/zerotrie/src/serde.rs | 107 +- deps/crates/vendor/zerotrie/src/varint.rs | 4 +- deps/crates/vendor/zerotrie/src/zerotrie.rs | 91 +- .../vendor/zerotrie/tests/builder_test.rs | 2 +- .../crates/vendor/zerotrie/tests/data/data.rs | 1055 +-- .../vendor/zerotrie/tests/dense_test.rs | 316 - .../vendor/zerotrie/tests/locale_aux_test.rs | 36 +- .../zerovec-derive/.cargo-checksum.json | 2 +- .../zerovec-derive/.cargo_vcs_info.json | 6 - deps/crates/vendor/zerovec-derive/Cargo.lock | 44 +- deps/crates/vendor/zerovec-derive/Cargo.toml | 57 +- .../vendor/zerovec-derive/Cargo.toml.orig | 52 - .../vendor/zerovec-derive/examples/derives.rs | 18 +- .../vendor/zerovec-derive/examples/make.rs | 16 +- .../zerovec-derive/examples/make_var.rs | 4 +- deps/crates/vendor/zerovec-derive/src/lib.rs | 13 - .../vendor/zerovec-derive/src/make_ule.rs | 11 +- .../vendor/zerovec-derive/src/make_varule.rs | 22 +- deps/crates/vendor/zerovec-derive/src/ule.rs | 2 +- .../crates/vendor/zerovec-derive/src/utils.rs | 10 +- .../vendor/zerovec-derive/src/varule.rs | 4 +- .../vendor/zerovec/.cargo-checksum.json | 2 +- .../vendor/zerovec/.cargo_vcs_info.json | 6 - deps/crates/vendor/zerovec/Cargo.lock | 967 +- deps/crates/vendor/zerovec/Cargo.toml | 119 +- deps/crates/vendor/zerovec/Cargo.toml.orig | 102 - deps/crates/vendor/zerovec/README.md | 6 +- deps/crates/vendor/zerovec/benches/zeromap.rs | 10 +- deps/crates/vendor/zerovec/src/cow.rs | 4 +- deps/crates/vendor/zerovec/src/lib.rs | 39 +- deps/crates/vendor/zerovec/src/map/map.rs | 4 +- deps/crates/vendor/zerovec/src/map/serde.rs | 2 +- .../crates/vendor/zerovec/src/map2d/cursor.rs | 6 +- deps/crates/vendor/zerovec/src/map2d/map.rs | 10 +- deps/crates/vendor/zerovec/src/map2d/serde.rs | 6 +- deps/crates/vendor/zerovec/src/samples.rs | 10 +- deps/crates/vendor/zerovec/src/schemars.rs | 134 - ...chemars__tests__schema_varzerovec_str.snap | 12 - ...s__tests__schema_varzerovec_zeroslice.snap | 17 - ...hemars__tests__schema_zeromap_u32_str.snap | 15 - ..._schemars__tests__schema_zerovec_char.snap | 14 - ...__schemars__tests__schema_zerovec_u32.snap | 14 - deps/crates/vendor/zerovec/src/ule/encode.rs | 24 +- deps/crates/vendor/zerovec/src/ule/mod.rs | 28 +- deps/crates/vendor/zerovec/src/ule/multi.rs | 39 +- deps/crates/vendor/zerovec/src/ule/niche.rs | 24 +- deps/crates/vendor/zerovec/src/ule/option.rs | 12 +- deps/crates/vendor/zerovec/src/ule/plain.rs | 172 +- deps/crates/vendor/zerovec/src/ule/slices.rs | 2 +- .../vendor/zerovec/src/ule/test_utils.rs | 4 +- deps/crates/vendor/zerovec/src/ule/tuple.rs | 9 +- .../crates/vendor/zerovec/src/ule/tuplevar.rs | 11 +- .../crates/vendor/zerovec/src/ule/vartuple.rs | 15 +- .../zerovec/src/varzerovec/components.rs | 45 +- .../vendor/zerovec/src/varzerovec/databake.rs | 8 +- .../vendor/zerovec/src/varzerovec/error.rs | 2 +- .../zerovec/src/varzerovec/lengthless.rs | 13 +- .../vendor/zerovec/src/varzerovec/owned.rs | 12 +- .../vendor/zerovec/src/varzerovec/slice.rs | 22 +- .../vendor/zerovec/src/varzerovec/vec.rs | 16 +- deps/crates/vendor/zerovec/src/yoke_impls.rs | 22 +- .../vendor/zerovec/src/zerovec/databake.rs | 4 +- deps/crates/vendor/zerovec/src/zerovec/mod.rs | 54 +- .../vendor/zerovec/src/zerovec/serde.rs | 24 +- .../vendor/zerovec/src/zerovec/slice.rs | 20 +- .../vendor/zoneinfo64/.cargo-checksum.json | 2 +- .../vendor/zoneinfo64/.cargo_vcs_info.json | 6 - deps/crates/vendor/zoneinfo64/Cargo.lock | 581 -- deps/crates/vendor/zoneinfo64/Cargo.toml | 14 +- deps/crates/vendor/zoneinfo64/Cargo.toml.orig | 40 - deps/crates/vendor/zoneinfo64/README.md | 21 +- deps/crates/vendor/zoneinfo64/src/lib.rs | 27 +- deps/crates/vendor/zoneinfo64/src/rule.rs | 47 +- .../include/gtest/gtest-assertion-result.h | 3 +- .../googletest/include/gtest/gtest-matchers.h | 49 +- .../googletest/include/gtest/gtest-printers.h | 6 +- deps/googletest/include/gtest/gtest.h | 4 +- deps/libffi/libffi.gyp | 7 - deps/ncrypto/engine.cc | 37 +- deps/ncrypto/ncrypto.cc | 1802 +--- deps/ncrypto/ncrypto.gyp | 58 +- deps/ncrypto/ncrypto.h | 196 +- deps/ncrypto/unofficial.gni | 6 +- .../nghttp3/lib/includes/nghttp3/nghttp3.h | 88 - .../nghttp3/lib/includes/nghttp3/version.h | 4 +- deps/ngtcp2/nghttp3/lib/nghttp3_conn.c | 22 - deps/ngtcp2/nghttp3/lib/nghttp3_conv.c | 9 - deps/ngtcp2/nghttp3/lib/nghttp3_conv.h | 40 + deps/ngtcp2/nghttp3/lib/nghttp3_http.c | 9 +- .../nghttp3/lib/nghttp3_qpack_huffman.c | 8 +- .../nghttp3/lib/nghttp3_qpack_huffman.h | 25 +- .../nghttp3/lib/nghttp3_qpack_huffman_data.c | 8227 ++++++++--------- deps/ngtcp2/nghttp3/lib/nghttp3_str.c | 132 +- deps/ngtcp2/nghttp3/lib/nghttp3_str.h | 10 - deps/ngtcp2/nghttp3/lib/sfparse/sfparse.c | 38 +- deps/ngtcp2/nghttp3/lib/sfparse/sfparse.h | 4 +- .../content/commands/npm-approve-scripts.md | 8 - deps/npm/docs/content/commands/npm-ci.md | 16 +- deps/npm/docs/content/commands/npm-dedupe.md | 12 +- deps/npm/docs/content/commands/npm-exec.md | 4 - .../docs/content/commands/npm-find-dupes.md | 12 +- .../content/commands/npm-install-ci-test.md | 16 +- .../content/commands/npm-install-scripts.md | 166 - .../docs/content/commands/npm-install-test.md | 26 +- deps/npm/docs/content/commands/npm-install.md | 26 +- deps/npm/docs/content/commands/npm-link.md | 12 +- deps/npm/docs/content/commands/npm-ls.md | 2 +- .../npm/docs/content/commands/npm-outdated.md | 10 - deps/npm/docs/content/commands/npm-query.md | 10 - deps/npm/docs/content/commands/npm-rebuild.md | 4 - deps/npm/docs/content/commands/npm-update.md | 26 +- deps/npm/docs/content/commands/npm.md | 2 +- deps/npm/docs/content/using-npm/config.md | 35 +- deps/npm/docs/content/using-npm/developers.md | 18 - deps/npm/docs/output/commands/npm-access.html | 4 +- .../npm/docs/output/commands/npm-adduser.html | 4 +- .../output/commands/npm-approve-scripts.html | 11 +- deps/npm/docs/output/commands/npm-audit.html | 4 +- deps/npm/docs/output/commands/npm-bugs.html | 4 +- deps/npm/docs/output/commands/npm-cache.html | 4 +- deps/npm/docs/output/commands/npm-ci.html | 18 +- .../docs/output/commands/npm-completion.html | 4 +- deps/npm/docs/output/commands/npm-config.html | 4 +- deps/npm/docs/output/commands/npm-dedupe.html | 15 +- .../output/commands/npm-deny-scripts.html | 4 +- .../docs/output/commands/npm-deprecate.html | 4 +- deps/npm/docs/output/commands/npm-diff.html | 4 +- .../docs/output/commands/npm-dist-tag.html | 4 +- deps/npm/docs/output/commands/npm-docs.html | 4 +- deps/npm/docs/output/commands/npm-doctor.html | 4 +- deps/npm/docs/output/commands/npm-edit.html | 4 +- deps/npm/docs/output/commands/npm-exec.html | 7 +- .../npm/docs/output/commands/npm-explain.html | 4 +- .../npm/docs/output/commands/npm-explore.html | 4 +- .../docs/output/commands/npm-find-dupes.html | 15 +- deps/npm/docs/output/commands/npm-fund.html | 4 +- deps/npm/docs/output/commands/npm-get.html | 4 +- .../docs/output/commands/npm-help-search.html | 4 +- deps/npm/docs/output/commands/npm-help.html | 4 +- deps/npm/docs/output/commands/npm-init.html | 4 +- .../output/commands/npm-install-ci-test.html | 18 +- .../output/commands/npm-install-scripts.html | 341 - .../output/commands/npm-install-test.html | 25 +- .../npm/docs/output/commands/npm-install.html | 25 +- deps/npm/docs/output/commands/npm-link.html | 15 +- deps/npm/docs/output/commands/npm-ll.html | 4 +- deps/npm/docs/output/commands/npm-login.html | 4 +- deps/npm/docs/output/commands/npm-logout.html | 4 +- deps/npm/docs/output/commands/npm-ls.html | 6 +- deps/npm/docs/output/commands/npm-org.html | 4 +- .../docs/output/commands/npm-outdated.html | 11 +- deps/npm/docs/output/commands/npm-owner.html | 4 +- deps/npm/docs/output/commands/npm-pack.html | 4 +- deps/npm/docs/output/commands/npm-ping.html | 4 +- deps/npm/docs/output/commands/npm-pkg.html | 4 +- deps/npm/docs/output/commands/npm-prefix.html | 4 +- .../npm/docs/output/commands/npm-profile.html | 4 +- deps/npm/docs/output/commands/npm-prune.html | 4 +- .../npm/docs/output/commands/npm-publish.html | 4 +- deps/npm/docs/output/commands/npm-query.html | 11 +- .../npm/docs/output/commands/npm-rebuild.html | 7 +- deps/npm/docs/output/commands/npm-repo.html | 4 +- .../npm/docs/output/commands/npm-restart.html | 4 +- deps/npm/docs/output/commands/npm-root.html | 4 +- deps/npm/docs/output/commands/npm-run.html | 4 +- deps/npm/docs/output/commands/npm-sbom.html | 4 +- deps/npm/docs/output/commands/npm-search.html | 4 +- deps/npm/docs/output/commands/npm-set.html | 4 +- .../docs/output/commands/npm-shrinkwrap.html | 4 +- deps/npm/docs/output/commands/npm-stage.html | 4 +- deps/npm/docs/output/commands/npm-star.html | 4 +- deps/npm/docs/output/commands/npm-stars.html | 4 +- deps/npm/docs/output/commands/npm-start.html | 4 +- deps/npm/docs/output/commands/npm-stop.html | 4 +- deps/npm/docs/output/commands/npm-team.html | 4 +- deps/npm/docs/output/commands/npm-test.html | 4 +- deps/npm/docs/output/commands/npm-token.html | 4 +- deps/npm/docs/output/commands/npm-trust.html | 4 +- .../docs/output/commands/npm-undeprecate.html | 4 +- .../docs/output/commands/npm-uninstall.html | 4 +- .../docs/output/commands/npm-unpublish.html | 4 +- deps/npm/docs/output/commands/npm-unstar.html | 4 +- deps/npm/docs/output/commands/npm-update.html | 25 +- .../npm/docs/output/commands/npm-version.html | 4 +- deps/npm/docs/output/commands/npm-view.html | 4 +- deps/npm/docs/output/commands/npm-whoami.html | 4 +- deps/npm/docs/output/commands/npm.html | 6 +- deps/npm/docs/output/commands/npx.html | 4 +- .../docs/output/configuring-npm/folders.html | 4 +- .../docs/output/configuring-npm/install.html | 4 +- .../output/configuring-npm/npm-global.html | 4 +- .../docs/output/configuring-npm/npm-json.html | 4 +- .../configuring-npm/npm-shrinkwrap-json.html | 4 +- .../docs/output/configuring-npm/npmrc.html | 4 +- .../output/configuring-npm/package-json.html | 4 +- .../configuring-npm/package-lock-json.html | 4 +- deps/npm/docs/output/using-npm/config.html | 33 +- .../using-npm/dependency-selectors.html | 4 +- .../npm/docs/output/using-npm/developers.html | 20 +- deps/npm/docs/output/using-npm/logging.html | 4 +- deps/npm/docs/output/using-npm/orgs.html | 4 +- .../docs/output/using-npm/package-spec.html | 4 +- deps/npm/docs/output/using-npm/registry.html | 4 +- deps/npm/docs/output/using-npm/removal.html | 4 +- deps/npm/docs/output/using-npm/scope.html | 4 +- deps/npm/docs/output/using-npm/scripts.html | 4 +- .../npm/docs/output/using-npm/workspaces.html | 4 +- deps/npm/lib/commands/audit.js | 13 - deps/npm/lib/commands/exec.js | 6 +- deps/npm/lib/commands/install-scripts.js | 53 - deps/npm/lib/commands/link.js | 17 +- deps/npm/lib/commands/ls.js | 36 +- deps/npm/lib/commands/query.js | 38 +- deps/npm/lib/commands/rebuild.js | 4 +- deps/npm/lib/commands/token.js | 10 +- deps/npm/lib/utils/allow-scripts-cmd.js | 126 +- deps/npm/lib/utils/allow-scripts-prune.js | 47 - deps/npm/lib/utils/allow-scripts-writer.js | 42 +- deps/npm/lib/utils/cmd-list.js | 1 - deps/npm/lib/utils/reify-output.js | 9 +- deps/npm/lib/utils/sbom-cyclonedx.js | 2 +- deps/npm/lib/utils/sbom-spdx.js | 2 +- .../utils/strict-allow-scripts-preflight.js | 16 +- deps/npm/man/man1/npm-access.1 | 2 +- deps/npm/man/man1/npm-adduser.1 | 2 +- deps/npm/man/man1/npm-approve-scripts.1 | 4 +- deps/npm/man/man1/npm-audit.1 | 2 +- deps/npm/man/man1/npm-bugs.1 | 2 +- deps/npm/man/man1/npm-cache.1 | 2 +- deps/npm/man/man1/npm-ci.1 | 8 +- deps/npm/man/man1/npm-completion.1 | 2 +- deps/npm/man/man1/npm-config.1 | 2 +- deps/npm/man/man1/npm-dedupe.1 | 6 +- deps/npm/man/man1/npm-deny-scripts.1 | 2 +- deps/npm/man/man1/npm-deprecate.1 | 2 +- deps/npm/man/man1/npm-diff.1 | 2 +- deps/npm/man/man1/npm-dist-tag.1 | 2 +- deps/npm/man/man1/npm-docs.1 | 2 +- deps/npm/man/man1/npm-doctor.1 | 2 +- deps/npm/man/man1/npm-edit.1 | 2 +- deps/npm/man/man1/npm-exec.1 | 4 +- deps/npm/man/man1/npm-explain.1 | 2 +- deps/npm/man/man1/npm-explore.1 | 2 +- deps/npm/man/man1/npm-find-dupes.1 | 6 +- deps/npm/man/man1/npm-fund.1 | 2 +- deps/npm/man/man1/npm-get.1 | 2 +- deps/npm/man/man1/npm-help-search.1 | 2 +- deps/npm/man/man1/npm-help.1 | 2 +- deps/npm/man/man1/npm-init.1 | 2 +- deps/npm/man/man1/npm-install-ci-test.1 | 8 +- deps/npm/man/man1/npm-install-scripts.1 | 133 - deps/npm/man/man1/npm-install-test.1 | 13 +- deps/npm/man/man1/npm-install.1 | 13 +- deps/npm/man/man1/npm-link.1 | 6 +- deps/npm/man/man1/npm-ll.1 | 2 +- deps/npm/man/man1/npm-login.1 | 2 +- deps/npm/man/man1/npm-logout.1 | 2 +- deps/npm/man/man1/npm-ls.1 | 4 +- deps/npm/man/man1/npm-org.1 | 2 +- deps/npm/man/man1/npm-outdated.1 | 7 +- deps/npm/man/man1/npm-owner.1 | 2 +- deps/npm/man/man1/npm-pack.1 | 2 +- deps/npm/man/man1/npm-ping.1 | 2 +- deps/npm/man/man1/npm-pkg.1 | 2 +- deps/npm/man/man1/npm-prefix.1 | 2 +- deps/npm/man/man1/npm-profile.1 | 2 +- deps/npm/man/man1/npm-prune.1 | 2 +- deps/npm/man/man1/npm-publish.1 | 2 +- deps/npm/man/man1/npm-query.1 | 7 +- deps/npm/man/man1/npm-rebuild.1 | 4 +- deps/npm/man/man1/npm-repo.1 | 2 +- deps/npm/man/man1/npm-restart.1 | 2 +- deps/npm/man/man1/npm-root.1 | 2 +- deps/npm/man/man1/npm-run.1 | 2 +- deps/npm/man/man1/npm-sbom.1 | 2 +- deps/npm/man/man1/npm-search.1 | 2 +- deps/npm/man/man1/npm-set.1 | 2 +- deps/npm/man/man1/npm-shrinkwrap.1 | 2 +- deps/npm/man/man1/npm-stage.1 | 2 +- deps/npm/man/man1/npm-star.1 | 2 +- deps/npm/man/man1/npm-stars.1 | 2 +- deps/npm/man/man1/npm-start.1 | 2 +- deps/npm/man/man1/npm-stop.1 | 2 +- deps/npm/man/man1/npm-team.1 | 2 +- deps/npm/man/man1/npm-test.1 | 2 +- deps/npm/man/man1/npm-token.1 | 2 +- deps/npm/man/man1/npm-trust.1 | 2 +- deps/npm/man/man1/npm-undeprecate.1 | 2 +- deps/npm/man/man1/npm-uninstall.1 | 2 +- deps/npm/man/man1/npm-unpublish.1 | 2 +- deps/npm/man/man1/npm-unstar.1 | 2 +- deps/npm/man/man1/npm-update.1 | 13 +- deps/npm/man/man1/npm-version.1 | 2 +- deps/npm/man/man1/npm-view.1 | 2 +- deps/npm/man/man1/npm-whoami.1 | 2 +- deps/npm/man/man1/npm.1 | 4 +- deps/npm/man/man1/npx.1 | 2 +- deps/npm/man/man5/folders.5 | 2 +- deps/npm/man/man5/install.5 | 2 +- deps/npm/man/man5/npm-global.5 | 2 +- deps/npm/man/man5/npm-json.5 | 2 +- deps/npm/man/man5/npm-shrinkwrap-json.5 | 2 +- deps/npm/man/man5/npmrc.5 | 2 +- deps/npm/man/man5/package-json.5 | 2 +- deps/npm/man/man5/package-lock-json.5 | 2 +- deps/npm/man/man7/config.7 | 17 +- deps/npm/man/man7/dependency-selectors.7 | 2 +- deps/npm/man/man7/developers.7 | 19 +- deps/npm/man/man7/logging.7 | 2 +- deps/npm/man/man7/orgs.7 | 2 +- deps/npm/man/man7/package-spec.7 | 2 +- deps/npm/man/man7/registry.7 | 2 +- deps/npm/man/man7/removal.7 | 2 +- deps/npm/man/man7/scope.7 | 2 +- deps/npm/man/man7/scripts.7 | 2 +- deps/npm/man/man7/workspaces.7 | 2 +- .../arborist/lib/arborist/build-ideal-tree.js | 47 +- .../arborist/lib/arborist/isolated-reifier.js | 4 +- .../arborist/lib/arborist/load-actual.js | 70 +- .../@npmcli/arborist/lib/arborist/rebuild.js | 37 +- .../@npmcli/arborist/lib/arborist/reify.js | 294 +- .../@npmcli/arborist/lib/audit-report.js | 69 +- .../@npmcli/arborist/lib/calc-dep-flags.js | 32 +- .../@npmcli/arborist/lib/isolated-classes.js | 9 +- .../node_modules/@npmcli/arborist/lib/link.js | 38 +- .../node_modules/@npmcli/arborist/lib/node.js | 3 +- .../arborist/lib/query-selector-all.js | 3 +- .../@npmcli/arborist/lib/script-allowed.js | 22 +- .../@npmcli/arborist/lib/shrinkwrap.js | 29 - .../arborist/lib/unreviewed-scripts.js | 7 - .../node_modules/@npmcli/arborist/lib/vuln.js | 4 - .../@npmcli/arborist/package.json | 2 +- .../config/lib/definitions/definitions.js | 36 +- .../node_modules/@npmcli/config/package.json | 2 +- .../brace-expansion/dist/commonjs/index.js | 38 +- .../brace-expansion/dist/esm/index.js | 38 +- .../node_modules/brace-expansion/package.json | 4 +- deps/npm/node_modules/libnpmdiff/package.json | 4 +- deps/npm/node_modules/libnpmexec/lib/index.js | 10 +- deps/npm/node_modules/libnpmexec/package.json | 4 +- deps/npm/node_modules/libnpmfund/package.json | 4 +- deps/npm/node_modules/libnpmpack/package.json | 4 +- .../npm/node_modules/npm-profile/lib/index.js | 29 +- .../npm/node_modules/npm-profile/package.json | 10 +- deps/npm/node_modules/semver/classes/range.js | 8 +- deps/npm/node_modules/semver/package.json | 2 +- .../node_modules/tar/dist/commonjs/header.js | 9 +- .../tar/dist/commonjs/index.min.js | 6 +- .../dist/commonjs/normalize-windows-path.js | 4 +- .../node_modules/tar/dist/commonjs/parse.js | 43 +- .../npm/node_modules/tar/dist/commonjs/pax.js | 36 +- .../node_modules/tar/dist/commonjs/unpack.js | 4 +- deps/npm/node_modules/tar/dist/esm/header.js | 9 +- .../node_modules/tar/dist/esm/index.min.js | 6 +- .../tar/dist/esm/normalize-windows-path.js | 4 +- deps/npm/node_modules/tar/dist/esm/parse.js | 43 +- deps/npm/node_modules/tar/dist/esm/pax.js | 36 +- deps/npm/node_modules/tar/dist/esm/unpack.js | 4 +- deps/npm/node_modules/tar/package.json | 2 +- .../undici/docs/docs/api/Client.md | 1 - .../undici/lib/dispatcher/client-h1.js | 73 +- .../undici/lib/dispatcher/dispatcher-base.js | 1 - .../undici/lib/web/cookies/parse.js | 39 +- .../undici/lib/web/websocket/receiver.js | 39 +- .../undici/lib/web/websocket/websocket.js | 5 +- deps/npm/node_modules/undici/package.json | 2 +- deps/npm/package.json | 20 +- .../test/lib/commands/publish.js.test.cjs | 1 - .../tap-snapshots/test/lib/docs.js.test.cjs | 82 +- .../tap-snapshots/test/lib/npm.js.test.cjs | 70 +- .../test/lib/utils/reify-output.js.test.cjs | 5 - .../test/lib/utils/sbom-cyclonedx.js.test.cjs | 2 +- .../test/lib/utils/sbom-spdx.js.test.cjs | 2 +- deps/npm/test/lib/commands/approve-scripts.js | 56 +- deps/npm/test/lib/commands/audit.js | 80 - deps/npm/test/lib/commands/deny-scripts.js | 5 +- deps/npm/test/lib/commands/exec.js | 35 - deps/npm/test/lib/commands/install-scripts.js | 336 - deps/npm/test/lib/commands/link.js | 108 - deps/npm/test/lib/commands/login.js | 13 - deps/npm/test/lib/commands/ls.js | 35 +- deps/npm/test/lib/commands/query.js | 76 - deps/npm/test/lib/commands/token.js | 12 +- .../npm/test/lib/utils/allow-scripts-prune.js | 90 - .../test/lib/utils/allow-scripts-writer.js | 88 +- deps/npm/test/lib/utils/reify-output.js | 21 +- deps/npm/test/lib/utils/sbom-cyclonedx.js | 11 - deps/npm/test/lib/utils/sbom-spdx.js | 11 - .../utils/strict-allow-scripts-preflight.js | 17 +- deps/sqlite/sqlite3.c | 781 +- deps/sqlite/sqlite3.h | 16 +- deps/undici/src/CONTRIBUTING.md | 154 +- deps/undici/src/README.md | 5 +- deps/undici/src/SECURITY.md | 12 - .../{getting-started.md => GettingStarted.md} | 41 +- deps/undici/src/docs/docs/api/Agent.md | 292 +- deps/undici/src/docs/docs/api/BalancedPool.md | 294 +- deps/undici/src/docs/docs/api/CacheStorage.md | 184 +- deps/undici/src/docs/docs/api/CacheStore.md | 392 +- deps/undici/src/docs/docs/api/Client.md | 544 +- deps/undici/src/docs/docs/api/ClientStats.md | 94 +- deps/undici/src/docs/docs/api/Connector.md | 154 +- deps/undici/src/docs/docs/api/ContentType.md | 90 +- deps/undici/src/docs/docs/api/Cookies.md | 193 +- deps/undici/src/docs/docs/api/Debug.md | 52 +- .../src/docs/docs/api/DiagnosticsChannel.md | 528 +- deps/undici/src/docs/docs/api/Dispatcher.md | 1581 +++- .../src/docs/docs/api/EnvHttpProxyAgent.md | 188 +- deps/undici/src/docs/docs/api/Errors.md | 543 +- deps/undici/src/docs/docs/api/EventSource.md | 326 +- deps/undici/src/docs/docs/api/Fetch.md | 711 +- .../src/docs/docs/api/GlobalInstallation.md | 176 +- deps/undici/src/docs/docs/api/H2CClient.md | 474 +- deps/undici/src/docs/docs/api/Interceptors.md | 355 - deps/undici/src/docs/docs/api/MockAgent.md | 636 +- .../src/docs/docs/api/MockCallHistory.md | 370 +- .../src/docs/docs/api/MockCallHistoryLog.md | 215 +- deps/undici/src/docs/docs/api/MockClient.md | 184 +- deps/undici/src/docs/docs/api/MockErrors.md | 61 +- deps/undici/src/docs/docs/api/MockPool.md | 562 +- deps/undici/src/docs/docs/api/Pool.md | 278 +- deps/undici/src/docs/docs/api/PoolStats.md | 132 +- deps/undici/src/docs/docs/api/ProxyAgent.md | 339 +- .../src/docs/docs/api/RedirectHandler.md | 301 +- deps/undici/src/docs/docs/api/RetryAgent.md | 139 +- deps/undici/src/docs/docs/api/RetryHandler.md | 238 +- .../src/docs/docs/api/RoundRobinPool.md | 238 +- .../undici/src/docs/docs/api/SnapshotAgent.md | 806 +- .../src/docs/docs/api/Socks5ProxyAgent.md | 349 +- deps/undici/src/docs/docs/api/Util.md | 79 +- deps/undici/src/docs/docs/api/WebSocket.md | 555 +- .../undici/src/docs/docs/api/api-lifecycle.md | 132 +- .../docs/best-practices/client-certificate.md | 2 - .../src/docs/docs/best-practices/crawling.md | 4 +- .../best-practices/migrating-from-v7-to-v8.md | 10 +- .../docs/best-practices/mocking-request.md | 16 +- .../src/docs/docs/best-practices/proxy.md | 4 +- .../best-practices/undici-vs-builtin-fetch.md | 18 +- .../docs/docs/best-practices/writing-tests.md | 2 - deps/undici/src/docs/docs/index.md | 779 -- deps/undici/src/docs/docs/site.json | 125 - deps/undici/src/docs/docs/type-map.json | 79 - deps/undici/src/lib/api/api-request.js | 8 +- deps/undici/src/lib/api/readable.js | 49 +- deps/undici/src/lib/core/errors.js | 20 - deps/undici/src/lib/core/request.js | 2 +- deps/undici/src/lib/core/util.js | 25 +- deps/undici/src/lib/dispatcher/client-h1.js | 23 - deps/undici/src/lib/dispatcher/client-h2.js | 354 +- deps/undici/src/lib/dispatcher/proxy-agent.js | 46 +- .../src/lib/handler/redirect-handler.js | 1 - deps/undici/src/lib/handler/retry-handler.js | 76 +- deps/undici/src/lib/llhttp/wasm_build_env.txt | 2 +- deps/undici/src/lib/web/cookies/parse.js | 5 +- deps/undici/src/lib/web/cookies/util.js | 2 +- deps/undici/src/lib/web/eventsource/util.js | 2 +- deps/undici/src/lib/web/fetch/constants.js | 2 +- deps/undici/src/lib/web/fetch/index.js | 13 +- deps/undici/src/lib/web/fetch/util.js | 5 +- deps/undici/src/package-lock.json | 237 +- deps/undici/src/package.json | 2 +- deps/undici/src/types/client.d.ts | 2 +- deps/undici/src/types/cookies.d.ts | 2 +- deps/undici/src/types/errors.d.ts | 10 - deps/undici/src/types/handlers.d.ts | 2 - deps/undici/src/types/proxy-agent.d.ts | 7 - deps/undici/undici.js | 414 +- deps/v8/include/v8-template.h | 7 - deps/v8/src/api/api.cc | 2 - deps/v8/src/execution/execution.cc | 16 +- deps/v8/src/objects/api-callbacks-inl.h | 2 - deps/v8/src/objects/api-callbacks.h | 1 - deps/v8/src/objects/api-callbacks.tq | 1 - deps/v8/src/objects/js-objects.cc | 18 - deps/v8/src/objects/js-objects.h | 5 - deps/v8/test/cctest/test-api-interceptors.cc | 43 - deps/zlib/contrib/minizip/unzip.c | 2 - deps/zlib/contrib/tests/utils_unittest.cc | 23 - .../google/test/data/enc_flag_mismatch.zip | Bin 182 -> 0 bytes deps/zlib/google/test_data.filelist | 1 - deps/zlib/google/zip_reader_unittest.cc | 18 - ...0015-minizip-unzip-enable-decryption.patch | 28 - doc/api/buffer.md | 2 +- doc/api/cli.md | 30 +- doc/api/dgram.md | 2 - doc/api/diagnostics_channel.md | 2 +- doc/api/errors.md | 24 +- doc/api/ffi.md | 28 +- doc/api/http.md | 24 - doc/api/http2.md | 20 +- doc/api/modules.md | 7 +- doc/api/perf_hooks.md | 2 +- doc/api/quic.md | 13 +- doc/api/test.md | 42 - doc/api/tls.md | 45 +- doc/api/vfs.md | 39 +- doc/api/webstreams.md | 22 - doc/api/zlib.md | 6 +- doc/changelogs/CHANGELOG_V26.md | 152 - doc/contributing/collaborator-guide.md | 2 +- doc/contributing/first-contributions.md | 244 - doc/contributing/pull-requests.md | 7 - doc/contributing/releases.md | 137 +- doc/contributing/strategic-initiatives.md | 26 +- doc/node.1 | 17 +- lib/_http_client.js | 196 +- lib/_http_outgoing.js | 6 - lib/buffer.js | 8 +- lib/child_process.js | 18 +- lib/ffi.js | 2 - lib/fs.js | 12 +- lib/internal/blob.js | 21 +- lib/internal/debugger/inspect_repl.js | 20 +- lib/internal/dgram.js | 20 +- lib/internal/errors.js | 42 +- lib/internal/fs/promises.js | 9 +- lib/internal/http2/compat.js | 53 +- lib/internal/http2/core.js | 335 +- lib/internal/http2/util.js | 36 +- lib/internal/modules/cjs/loader.js | 12 +- lib/internal/modules/esm/loader.js | 14 +- lib/internal/modules/esm/module_job.js | 176 +- lib/internal/modules/esm/translators.js | 2 +- lib/internal/modules/esm/utils.js | 10 - lib/internal/modules/helpers.js | 19 +- lib/internal/per_context/domexception.js | 2 +- lib/internal/process/finalization.js | 33 +- lib/internal/quic/quic.js | 8 +- lib/internal/quic/state.js | 3 +- lib/internal/stream_base_commons.js | 11 +- lib/internal/streams/iter/broadcast.js | 13 +- lib/internal/streams/iter/consumers.js | 80 +- lib/internal/streams/iter/from.js | 13 +- lib/internal/streams/iter/pull.js | 83 +- lib/internal/streams/iter/utils.js | 84 - lib/internal/streams/readable.js | 116 +- lib/internal/test_runner/mock/mock.js | 17 +- lib/internal/test_runner/mock/mock_timers.js | 5 +- lib/internal/test_runner/runner.js | 6 +- lib/internal/timers.js | 31 - lib/internal/validators.js | 2 +- lib/internal/vfs/file_handle.js | 16 +- lib/internal/vfs/providers/memory.js | 99 +- lib/internal/vfs/setup.js | 38 +- lib/internal/webstreams/readablestream.js | 235 +- lib/internal/webstreams/transfer.js | 4 +- lib/internal/webstreams/transformstream.js | 44 +- lib/internal/webstreams/util.js | 216 +- lib/internal/webstreams/writablestream.js | 99 +- lib/stream/web.js | 21 - lib/tls.js | 10 +- lib/zlib.js | 6 - node.gyp | 2 - onboarding.md | 6 +- src/crypto/crypto_common.cc | 19 +- src/crypto/crypto_context.cc | 84 +- src/crypto/crypto_context.h | 8 - src/crypto/crypto_dh.cc | 63 +- src/crypto/crypto_ec.cc | 44 +- src/crypto/crypto_hash.cc | 6 +- src/crypto/crypto_keys.cc | 67 +- src/crypto/crypto_rsa.cc | 10 - src/crypto/crypto_tls.cc | 4 - src/crypto/crypto_util.cc | 8 +- src/crypto/crypto_x509.cc | 27 +- src/env.cc | 12 +- src/env_properties.h | 1 - src/inspector/tracing_agent.cc | 14 +- src/inspector_socket.cc | 4 +- src/module_wrap.cc | 20 +- src/node.cc | 5 - src/node_binding.cc | 3 - src/node_buffer.cc | 81 +- src/node_constants.cc | 50 - src/node_contextify.cc | 94 +- src/node_errors.h | 23 + src/node_ffi.cc | 12 - src/node_ffi.h | 1 - src/node_http2.cc | 76 +- src/node_http2.h | 23 +- src/node_options.h | 2 +- src/node_sqlite.cc | 6 +- src/node_task_runner.cc | 4 +- src/node_trace_events.cc | 14 +- src/node_v8_platform-inl.h | 113 +- src/quic/README.md | 12 +- src/quic/application.cc | 460 +- src/quic/application.h | 56 + src/quic/endpoint.cc | 18 - src/quic/http3.cc | 129 +- src/quic/session.cc | 489 +- src/quic/session.h | 64 - src/quic/streams.cc | 63 +- src/quic/streams.h | 14 - src/quic/transportparams.cc | 10 - src/quic/transportparams.h | 3 - src/tracing/agent.cc | 254 +- src/tracing/agent.h | 175 +- src/tracing/agent_legacy.cc | 320 - src/tracing/agent_legacy.h | 142 - src/tracing/node_trace_buffer.cc | 11 +- src/tracing/node_trace_buffer.h | 18 +- src/tracing/node_trace_writer.h | 6 +- src/tracing/trace_event.cc | 15 + src/tracing/trace_event.h | 14 +- src/undici_version.h | 2 +- src/zlib_version.h | 2 +- test-fs-utf8.js | 24 + test-mkdtemp.js | 24 + test/cctest/node_test_fixture.cc | 6 +- test/cctest/node_test_fixture.h | 3 +- test/cctest/test_node_task_runner.cc | 6 +- test/client-proxy/test-http-proxy-fetch.mjs | 14 +- ...-request-absolute-path-authority-match.mjs | 70 - ...p-proxy-request-authority-construction.mjs | 82 - ...st-http-proxy-request-origin-form-path.mjs | 45 - ...t-http-proxy-request-validation-errors.mjs | 119 - ...et-global-proxy-from-env-fetch-default.mjs | 14 +- ...et-global-proxy-from-env-fetch-restore.mjs | 14 +- ...t-http-set-global-proxy-from-env-fetch.mjs | 14 +- ...t-global-proxy-from-env-override-fetch.mjs | 16 +- .../test-use-env-proxy-cli-http.mjs | 16 +- test/common/assertSnapshot.js | 19 +- test/common/child_process.js | 4 +- test/common/debugger-probe.js | 18 +- test/common/index.js | 25 +- test/common/proxy-server.js | 8 +- .../test-defer-import-eval-with-tla.mjs | 23 - .../test-defer-import-with-regular-import.mjs | 24 - .../test-require-module-cached-tla.js | 5 +- .../test-require-module-tla-error-metadata.js | 26 - ...test-require-module-tla-error-snapshot.mjs | 38 - .../test-require-module-tla-execution.js | 14 +- ...-require-module-tla-instantiation-error.js | 21 - .../test-require-module-tla-nested.js | 4 +- ...test-require-module-tla-print-execution.js | 20 +- .../test-require-module-tla-rejected.js | 4 +- .../test-require-module-tla-resolved.js | 4 +- .../test-require-module-tla-unresolved.js | 4 +- test/ffi/test-ffi-module.js | 33 - test/ffi/test-ffi-permissions.js | 4 - .../es-modules/dep-module-top-level-await.mjs | 10 - .../es-modules/module-deferred-eval.mjs | 4 +- test/fixtures/es-modules/tla/awaitusing.mjs | 5 - test/fixtures/es-modules/tla/preload-main.js | 1 - .../es-modules/tla/preload-main.snapshot | 15 - .../es-modules/tla/require-awaitusing.js | 1 - .../tla/require-awaitusing.snapshot | 15 - .../es-modules/tla/require-execution.snapshot | 15 - .../es-modules/tla/require-indented.js | 1 - .../es-modules/tla/require-indented.snapshot | 20 - .../es-modules/tla/require-nested-dep.js | 1 - .../fixtures/es-modules/tla/require-nested.js | 1 - .../es-modules/tla/require-nested.snapshot | 16 - .../es-modules/tla/tla-and-missing-export.mjs | 3 - test/fixtures/es-modules/tla/tla-indented.mjs | 9 - .../fixtures/process/finalization-cleanup.mjs | 34 - .../node_modules/.bin/positional-args | 2 +- .../node_modules/.bin/positional-args.bat | 2 +- .../test-runner/entry-file/a.test.mjs | 3 - .../test-runner/entry-file/b.test.mjs | 3 - .../test-runner/entry-file/helper.mjs | 3 - .../test-runner/output/lcov_reporter.js | 15 +- .../urlpattern-empty-regexp-group.html | 12 - test/fixtures/wpt/versions.json | 2 +- test/fuzzers/fuzz_env.cc | 5 +- test/fuzzers/fuzz_strings.cc | 5 +- test/node-api/test_fatal/test2.js | 2 +- test/parallel/test-blob-stream-gc.js | 56 - test/parallel/test-blob.js | 6 +- .../test-buffer-isutf8-isascii-fast.js | 34 - test/parallel/test-crypto-dh-curves.js | 57 - test/parallel/test-crypto-key-objects.js | 35 - test/parallel/test-dgram-custom-lookup.js | 14 +- test/parallel/test-dgram-default-lookup-ip.js | 80 - test/parallel/test-fs-mkdtemp-buffer.js | 26 + test/parallel/test-fs-mkdtemp.js | 5 +- .../test-http-connect-default-host-header.js | 37 - .../parallel/test-http-response-drain-cork.js | 64 - .../test-http-server-consumed-timeout.js | 2 +- ...ompat-serverresponse-trailers-streaming.js | 70 - .../test-internal-validators-validateport.js | 14 - .../test-net-allow-half-open-async-iter.js | 80 - test/parallel/test-node-run.js | 8 +- ...n-child-process-inherit-flags-substring.js | 96 - test/parallel/test-permission-drop-addons.js | 38 - ...rocess-env-allowed-flags-are-documented.js | 1 - test/parallel/test-process-finalization.mjs | 1 - ...st-quic-session-preferred-address-ipv6.mjs | 3 - .../test-quic-session-preferred-address.mjs | 3 - ...st-quic-session-unobserved-error-close.mjs | 47 - .../test-quic-stream-uni-no-onstream.mjs | 47 - ...quic-version-negotiation-oversized-cid.mjs | 89 - test/parallel/test-runner-entry-file.mjs | 59 - test/parallel/test-runner-v8-deserializer.mjs | 28 +- test/parallel/test-sqlite-statement-sync.js | 69 - .../test-stream-iter-broadcast-from.js | 25 - .../test-stream-iter-consumers-bytes.js | 52 - .../test-stream-iter-consumers-merge.js | 47 - test/parallel/test-stream-iter-from-sync.js | 28 +- test/parallel/test-stream-iter-validation.js | 3 +- ...am-readable-async-iter-half-open-duplex.js | 41 - .../test-tls-check-server-identity.js | 21 - .../test-tls-client-getephemeralkeyinfo.js | 57 +- .../test-tls-connect-secure-context.js | 3 - test/parallel/test-tls-over-http-tunnel.js | 2 +- test/parallel/test-vfs-fd.js | 20 - test/parallel/test-vfs-file-handle.js | 6 - test/parallel/test-vfs-fs-openSync.js | 13 - test/parallel/test-vfs-fs-writeFileSync.js | 59 - test/parallel/test-vfs-mkdir.js | 60 +- .../test-vfs-readdir-symlink-recursive.js | 55 +- test/parallel/test-vfs-rename.js | 14 - .../test-vm-global-restricted-property.js | 20 - ...test-vm-property-definer-partial-update.js | 56 - .../test-webstreams-queue-wraparound.js | 178 - test/parallel/test-whatwg-readablestream.js | 23 - .../test-worker-stack-overflow-stack-size.js | 9 - .../test-zlib-brotli-flush-invalid-kind.js | 92 - test/sea/sea.status | 5 + test/sequential/sequential.status | 4 + .../test-dgram-implicit-bind-failure.js | 13 +- tools/dep_updaters/c-ares.kbx | Bin 4217 -> 0 bytes tools/dep_updaters/update-c-ares.sh | 33 +- tools/doc/man-page.doc-kit.config.mjs | 21 - tools/doc/package-lock.json | 3773 +++++--- tools/doc/package.json | 2 +- tools/eslint/package-lock.json | 357 +- tools/eslint/package.json | 16 +- tools/nix/benchmarkTools.nix | 4 +- tools/nix/pkgs.nix | 4 +- tools/v8_gypfiles/v8.gyp | 14 +- 1626 files changed, 33819 insertions(+), 70651 deletions(-) delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/stress-test.yml delete mode 100644 benchmark/dgram/send-to-ip.js delete mode 100644 deps/crates/vendor/autocfg/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/autocfg/Cargo.toml.orig delete mode 100644 deps/crates/vendor/calendrical_calculations/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/calendrical_calculations/Cargo.lock delete mode 100644 deps/crates/vendor/calendrical_calculations/Cargo.toml.orig delete mode 100644 deps/crates/vendor/core_maths/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/core_maths/Cargo.toml.orig delete mode 100644 deps/crates/vendor/diplomat-runtime/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/diplomat-runtime/Cargo.lock delete mode 100644 deps/crates/vendor/diplomat-runtime/Cargo.toml.orig delete mode 100644 deps/crates/vendor/diplomat/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/diplomat/Cargo.lock delete mode 100644 deps/crates/vendor/diplomat/Cargo.toml.orig delete mode 100644 deps/crates/vendor/diplomat_core/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/diplomat_core/Cargo.lock delete mode 100644 deps/crates/vendor/diplomat_core/Cargo.toml.orig delete mode 100644 deps/crates/vendor/displaydoc/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/displaydoc/.github/workflows/ci.yml delete mode 100644 deps/crates/vendor/displaydoc/Cargo.toml.orig delete mode 100644 deps/crates/vendor/icu_calendar/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/icu_calendar/Cargo.lock delete mode 100644 deps/crates/vendor/icu_calendar/Cargo.toml.orig create mode 100644 deps/crates/vendor/icu_calendar/benches/fixtures/mod.rs delete mode 100644 deps/crates/vendor/icu_calendar/src/cal/abstract_gregorian.rs create mode 100644 deps/crates/vendor/icu_calendar/src/cal/chinese.rs create mode 100644 deps/crates/vendor/icu_calendar/src/cal/chinese_based.rs create mode 100644 deps/crates/vendor/icu_calendar/src/cal/dangi.rs delete mode 100644 deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional.rs delete mode 100644 deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/china_data.rs delete mode 100644 deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/korea_data.rs delete mode 100644 deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/qing_data.rs delete mode 100644 deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/simple.rs delete mode 100644 deps/crates/vendor/icu_calendar/src/cal/hijri/simulated_mecca_data.rs delete mode 100644 deps/crates/vendor/icu_calendar/src/options.rs create mode 100644 deps/crates/vendor/icu_calendar/src/provider/chinese_based.rs create mode 100644 deps/crates/vendor/icu_calendar/src/provider/hijri.rs delete mode 100644 deps/crates/vendor/icu_calendar/src/tests/extrema.rs delete mode 100644 deps/crates/vendor/icu_calendar/src/tests/not_enough_fields.rs delete mode 100644 deps/crates/vendor/icu_calendar/tests/arithmetic.rs delete mode 100644 deps/crates/vendor/icu_calendar/tests/exhaustive.rs delete mode 100644 deps/crates/vendor/icu_calendar/tests/extended_year.rs delete mode 100644 deps/crates/vendor/icu_calendar/tests/reference_year.rs delete mode 100644 deps/crates/vendor/icu_calendar_data/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/icu_calendar_data/Cargo.lock delete mode 100644 deps/crates/vendor/icu_calendar_data/Cargo.toml.orig create mode 100644 deps/crates/vendor/icu_calendar_data/data/calendar_chinese_v1.rs.data create mode 100644 deps/crates/vendor/icu_calendar_data/data/calendar_dangi_v1.rs.data create mode 100644 deps/crates/vendor/icu_calendar_data/data/calendar_hijri_simulated_mecca_v1.rs.data delete mode 100644 deps/crates/vendor/icu_collections/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/icu_collections/Cargo.toml.orig create mode 100644 deps/crates/vendor/icu_collections/examples/unicode_bmp_blocks_selector.rs delete mode 100644 deps/crates/vendor/icu_locale/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/icu_locale/Cargo.lock delete mode 100644 deps/crates/vendor/icu_locale/Cargo.toml.orig delete mode 100644 deps/crates/vendor/icu_locale_core/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/icu_locale_core/Cargo.lock delete mode 100644 deps/crates/vendor/icu_locale_core/Cargo.toml.orig delete mode 100644 deps/crates/vendor/icu_locale_data/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/icu_locale_data/Cargo.lock delete mode 100644 deps/crates/vendor/icu_locale_data/Cargo.toml.orig delete mode 100644 deps/crates/vendor/icu_provider/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/icu_provider/Cargo.lock delete mode 100644 deps/crates/vendor/icu_provider/Cargo.toml.orig create mode 100644 deps/crates/vendor/ixdtf-0.5.0/.cargo-checksum.json create mode 100644 deps/crates/vendor/ixdtf-0.5.0/Cargo.toml create mode 100644 deps/crates/vendor/ixdtf-0.5.0/LICENSE create mode 100644 deps/crates/vendor/ixdtf-0.5.0/README.md create mode 100644 deps/crates/vendor/ixdtf-0.5.0/src/error.rs create mode 100644 deps/crates/vendor/ixdtf-0.5.0/src/lib.rs create mode 100644 deps/crates/vendor/ixdtf-0.5.0/src/parsers/annotations.rs create mode 100644 deps/crates/vendor/ixdtf-0.5.0/src/parsers/datetime.rs create mode 100644 deps/crates/vendor/ixdtf-0.5.0/src/parsers/duration.rs create mode 100644 deps/crates/vendor/ixdtf-0.5.0/src/parsers/grammar.rs create mode 100644 deps/crates/vendor/ixdtf-0.5.0/src/parsers/mod.rs create mode 100644 deps/crates/vendor/ixdtf-0.5.0/src/parsers/records.rs create mode 100644 deps/crates/vendor/ixdtf-0.5.0/src/parsers/tests.rs create mode 100644 deps/crates/vendor/ixdtf-0.5.0/src/parsers/time.rs create mode 100644 deps/crates/vendor/ixdtf-0.5.0/src/parsers/timezone.rs delete mode 100644 deps/crates/vendor/ixdtf/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/ixdtf/Cargo.lock delete mode 100644 deps/crates/vendor/ixdtf/Cargo.toml.orig delete mode 100644 deps/crates/vendor/ixdtf/src/encoding.rs delete mode 100644 deps/crates/vendor/libm/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/libm/Cargo.lock delete mode 100644 deps/crates/vendor/libm/Cargo.toml.orig create mode 100644 deps/crates/vendor/libm/src/math/copysignf.rs create mode 100644 deps/crates/vendor/libm/src/math/copysignf128.rs create mode 100644 deps/crates/vendor/libm/src/math/copysignf16.rs create mode 100644 deps/crates/vendor/libm/src/math/fabsf.rs create mode 100644 deps/crates/vendor/libm/src/math/fabsf128.rs create mode 100644 deps/crates/vendor/libm/src/math/fabsf16.rs create mode 100644 deps/crates/vendor/libm/src/math/fdimf.rs create mode 100644 deps/crates/vendor/libm/src/math/fdimf128.rs create mode 100644 deps/crates/vendor/libm/src/math/fdimf16.rs create mode 100644 deps/crates/vendor/libm/src/math/floorf.rs create mode 100644 deps/crates/vendor/libm/src/math/floorf128.rs create mode 100644 deps/crates/vendor/libm/src/math/floorf16.rs create mode 100644 deps/crates/vendor/libm/src/math/fmodf.rs create mode 100644 deps/crates/vendor/libm/src/math/fmodf128.rs create mode 100644 deps/crates/vendor/libm/src/math/fmodf16.rs create mode 100644 deps/crates/vendor/libm/src/math/ldexpf.rs create mode 100644 deps/crates/vendor/libm/src/math/ldexpf128.rs create mode 100644 deps/crates/vendor/libm/src/math/ldexpf16.rs create mode 100644 deps/crates/vendor/libm/src/math/roundf.rs create mode 100644 deps/crates/vendor/libm/src/math/roundf128.rs create mode 100644 deps/crates/vendor/libm/src/math/roundf16.rs create mode 100644 deps/crates/vendor/libm/src/math/scalbnf.rs create mode 100644 deps/crates/vendor/libm/src/math/scalbnf128.rs create mode 100644 deps/crates/vendor/libm/src/math/scalbnf16.rs create mode 100644 deps/crates/vendor/libm/src/math/sqrtf.rs create mode 100644 deps/crates/vendor/libm/src/math/sqrtf128.rs create mode 100644 deps/crates/vendor/libm/src/math/sqrtf16.rs delete mode 100644 deps/crates/vendor/libm/src/math/support/int_traits/narrowing_div.rs delete mode 100644 deps/crates/vendor/libm/src/math/support/modular.rs create mode 100644 deps/crates/vendor/libm/src/math/truncf.rs create mode 100644 deps/crates/vendor/libm/src/math/truncf128.rs create mode 100644 deps/crates/vendor/libm/src/math/truncf16.rs delete mode 100644 deps/crates/vendor/litemap/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/litemap/Cargo.toml.orig delete mode 100644 deps/crates/vendor/num-traits/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/num-traits/Cargo.toml.orig delete mode 100644 deps/crates/vendor/potential_utf/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/potential_utf/Cargo.lock delete mode 100644 deps/crates/vendor/potential_utf/Cargo.toml.orig delete mode 100644 deps/crates/vendor/proc-macro2/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/proc-macro2/.github/FUNDING.yml delete mode 100644 deps/crates/vendor/proc-macro2/.github/workflows/ci.yml delete mode 100644 deps/crates/vendor/proc-macro2/Cargo.lock delete mode 100644 deps/crates/vendor/proc-macro2/Cargo.toml.orig delete mode 100644 deps/crates/vendor/quote/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/quote/.github/FUNDING.yml delete mode 100644 deps/crates/vendor/quote/.github/workflows/ci.yml delete mode 100644 deps/crates/vendor/quote/Cargo.lock delete mode 100644 deps/crates/vendor/quote/Cargo.toml.orig delete mode 100644 deps/crates/vendor/serde/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/serde/Cargo.lock delete mode 100644 deps/crates/vendor/serde/Cargo.toml.orig delete mode 100644 deps/crates/vendor/serde_core/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/serde_core/Cargo.lock delete mode 100644 deps/crates/vendor/serde_core/Cargo.toml.orig delete mode 100644 deps/crates/vendor/serde_derive/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/serde_derive/Cargo.lock delete mode 100644 deps/crates/vendor/serde_derive/Cargo.toml.orig delete mode 100644 deps/crates/vendor/smallvec/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/smallvec/.github/workflows/main.yml delete mode 100644 deps/crates/vendor/smallvec/Cargo.lock delete mode 100644 deps/crates/vendor/smallvec/Cargo.toml.orig delete mode 100644 deps/crates/vendor/stable_deref_trait/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/stable_deref_trait/Cargo.lock delete mode 100644 deps/crates/vendor/stable_deref_trait/Cargo.toml.orig delete mode 100644 deps/crates/vendor/strck/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/strck/Cargo.toml.orig delete mode 100644 deps/crates/vendor/syn/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/syn/Cargo.lock delete mode 100644 deps/crates/vendor/syn/Cargo.toml.orig delete mode 100644 deps/crates/vendor/synstructure/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/synstructure/Cargo.lock delete mode 100644 deps/crates/vendor/synstructure/Cargo.toml.orig delete mode 100644 deps/crates/vendor/temporal_capi/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/temporal_capi/Cargo.lock delete mode 100644 deps/crates/vendor/temporal_capi/Cargo.toml.orig delete mode 100644 deps/crates/vendor/temporal_rs/.cargo/config.toml delete mode 100644 deps/crates/vendor/temporal_rs/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/temporal_rs/Cargo.lock delete mode 100644 deps/crates/vendor/temporal_rs/Cargo.toml.orig create mode 100644 deps/crates/vendor/temporal_rs/src/builtins/core/calendar/era.rs delete mode 100644 deps/crates/vendor/timezone_provider/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/timezone_provider/Cargo.lock delete mode 100644 deps/crates/vendor/timezone_provider/Cargo.toml.orig delete mode 100644 deps/crates/vendor/tinystr/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/tinystr/Cargo.lock delete mode 100644 deps/crates/vendor/tinystr/Cargo.toml.orig delete mode 100644 deps/crates/vendor/unicode-ident/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/unicode-ident/.github/FUNDING.yml delete mode 100644 deps/crates/vendor/unicode-ident/.github/workflows/ci.yml delete mode 100644 deps/crates/vendor/unicode-ident/Cargo.lock delete mode 100644 deps/crates/vendor/unicode-ident/Cargo.toml.orig delete mode 100644 deps/crates/vendor/writeable/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/writeable/Cargo.toml.orig delete mode 100644 deps/crates/vendor/writeable/src/concat.rs delete mode 100644 deps/crates/vendor/yoke-derive/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/yoke-derive/Cargo.toml.orig delete mode 100644 deps/crates/vendor/yoke-derive/src/lifetimes.rs delete mode 100644 deps/crates/vendor/yoke/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/yoke/Cargo.lock delete mode 100644 deps/crates/vendor/yoke/Cargo.toml.orig delete mode 100644 deps/crates/vendor/zerofrom-derive/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/zerofrom-derive/Cargo.toml.orig delete mode 100644 deps/crates/vendor/zerofrom/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/zerofrom/Cargo.lock delete mode 100644 deps/crates/vendor/zerofrom/Cargo.toml.orig delete mode 100644 deps/crates/vendor/zerotrie/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/zerotrie/Cargo.toml.orig create mode 100644 deps/crates/vendor/zerotrie/src/builder/bytestr.rs delete mode 100644 deps/crates/vendor/zerotrie/src/builder/dense.rs delete mode 100644 deps/crates/vendor/zerotrie/src/builder/slice_indices.rs delete mode 100644 deps/crates/vendor/zerotrie/src/dense.rs delete mode 100644 deps/crates/vendor/zerotrie/tests/dense_test.rs delete mode 100644 deps/crates/vendor/zerovec-derive/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/zerovec-derive/Cargo.toml.orig delete mode 100644 deps/crates/vendor/zerovec/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/zerovec/Cargo.toml.orig delete mode 100644 deps/crates/vendor/zerovec/src/schemars.rs delete mode 100644 deps/crates/vendor/zerovec/src/snapshots/zerovec__schemars__tests__schema_varzerovec_str.snap delete mode 100644 deps/crates/vendor/zerovec/src/snapshots/zerovec__schemars__tests__schema_varzerovec_zeroslice.snap delete mode 100644 deps/crates/vendor/zerovec/src/snapshots/zerovec__schemars__tests__schema_zeromap_u32_str.snap delete mode 100644 deps/crates/vendor/zerovec/src/snapshots/zerovec__schemars__tests__schema_zerovec_char.snap delete mode 100644 deps/crates/vendor/zerovec/src/snapshots/zerovec__schemars__tests__schema_zerovec_u32.snap delete mode 100644 deps/crates/vendor/zoneinfo64/.cargo_vcs_info.json delete mode 100644 deps/crates/vendor/zoneinfo64/Cargo.lock delete mode 100644 deps/crates/vendor/zoneinfo64/Cargo.toml.orig delete mode 100644 deps/npm/docs/content/commands/npm-install-scripts.md delete mode 100644 deps/npm/docs/output/commands/npm-install-scripts.html delete mode 100644 deps/npm/lib/commands/install-scripts.js delete mode 100644 deps/npm/lib/utils/allow-scripts-prune.js delete mode 100644 deps/npm/man/man1/npm-install-scripts.1 delete mode 100644 deps/npm/test/lib/commands/install-scripts.js delete mode 100644 deps/npm/test/lib/utils/allow-scripts-prune.js rename deps/undici/src/docs/docs/{getting-started.md => GettingStarted.md} (84%) delete mode 100644 deps/undici/src/docs/docs/api/Interceptors.md delete mode 100644 deps/undici/src/docs/docs/index.md delete mode 100644 deps/undici/src/docs/docs/site.json delete mode 100644 deps/undici/src/docs/docs/type-map.json delete mode 100644 deps/zlib/google/test/data/enc_flag_mismatch.zip delete mode 100644 doc/contributing/first-contributions.md delete mode 100644 src/tracing/agent_legacy.cc delete mode 100644 src/tracing/agent_legacy.h create mode 100644 test-fs-utf8.js create mode 100644 test-mkdtemp.js delete mode 100644 test/client-proxy/test-http-proxy-request-absolute-path-authority-match.mjs delete mode 100644 test/client-proxy/test-http-proxy-request-authority-construction.mjs delete mode 100644 test/client-proxy/test-http-proxy-request-origin-form-path.mjs delete mode 100644 test/client-proxy/test-http-proxy-request-validation-errors.mjs delete mode 100644 test/es-module/test-defer-import-eval-with-tla.mjs delete mode 100644 test/es-module/test-defer-import-with-regular-import.mjs delete mode 100644 test/es-module/test-require-module-tla-error-metadata.js delete mode 100644 test/es-module/test-require-module-tla-error-snapshot.mjs delete mode 100644 test/es-module/test-require-module-tla-instantiation-error.js delete mode 100644 test/fixtures/es-modules/dep-module-top-level-await.mjs delete mode 100644 test/fixtures/es-modules/tla/awaitusing.mjs delete mode 100644 test/fixtures/es-modules/tla/preload-main.js delete mode 100644 test/fixtures/es-modules/tla/preload-main.snapshot delete mode 100644 test/fixtures/es-modules/tla/require-awaitusing.js delete mode 100644 test/fixtures/es-modules/tla/require-awaitusing.snapshot delete mode 100644 test/fixtures/es-modules/tla/require-execution.snapshot delete mode 100644 test/fixtures/es-modules/tla/require-indented.js delete mode 100644 test/fixtures/es-modules/tla/require-indented.snapshot delete mode 100644 test/fixtures/es-modules/tla/require-nested-dep.js delete mode 100644 test/fixtures/es-modules/tla/require-nested.js delete mode 100644 test/fixtures/es-modules/tla/require-nested.snapshot delete mode 100644 test/fixtures/es-modules/tla/tla-and-missing-export.mjs delete mode 100644 test/fixtures/es-modules/tla/tla-indented.mjs delete mode 100644 test/fixtures/process/finalization-cleanup.mjs delete mode 100644 test/fixtures/test-runner/entry-file/a.test.mjs delete mode 100644 test/fixtures/test-runner/entry-file/b.test.mjs delete mode 100644 test/fixtures/test-runner/entry-file/helper.mjs delete mode 100644 test/fixtures/wpt/urlpattern/urlpattern-empty-regexp-group.html delete mode 100644 test/parallel/test-blob-stream-gc.js delete mode 100644 test/parallel/test-buffer-isutf8-isascii-fast.js delete mode 100644 test/parallel/test-dgram-default-lookup-ip.js create mode 100644 test/parallel/test-fs-mkdtemp-buffer.js delete mode 100644 test/parallel/test-http-connect-default-host-header.js delete mode 100644 test/parallel/test-http-response-drain-cork.js delete mode 100644 test/parallel/test-http2-compat-serverresponse-trailers-streaming.js delete mode 100644 test/parallel/test-net-allow-half-open-async-iter.js delete mode 100644 test/parallel/test-permission-child-process-inherit-flags-substring.js delete mode 100644 test/parallel/test-permission-drop-addons.js delete mode 100644 test/parallel/test-quic-session-unobserved-error-close.mjs delete mode 100644 test/parallel/test-quic-stream-uni-no-onstream.mjs delete mode 100644 test/parallel/test-quic-version-negotiation-oversized-cid.mjs delete mode 100644 test/parallel/test-runner-entry-file.mjs delete mode 100644 test/parallel/test-stream-readable-async-iter-half-open-duplex.js delete mode 100644 test/parallel/test-vm-global-restricted-property.js delete mode 100644 test/parallel/test-vm-property-definer-partial-update.js delete mode 100644 test/parallel/test-webstreams-queue-wraparound.js delete mode 100644 test/parallel/test-zlib-brotli-flush-invalid-kind.js delete mode 100644 tools/dep_updaters/c-ares.kbx delete mode 100644 tools/doc/man-page.doc-kit.config.mjs diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 3950bc702eb58b..936c2a06125795 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,8 +1,4 @@ " -replace="\n\n# [Unreleased] - ReleaseDate" -exactly=1 - -# Disable this replacement on the very first release -[[package.metadata.release.pre-release-replacements]] -file = "CHANGELOG.md" -search = "\\.\\.\\.HEAD" -replace="...{{tag_name}}" -exactly = 1 -# END SECTION, do not comment out the replacement below this, and do not reorder them - -[[package.metadata.release.pre-release-replacements]] -file="CHANGELOG.md" -search="" -replace="\n[Unreleased]: https://github.com/yaahc/{{crate_name}}/compare/{{tag_name}}...HEAD" -exactly=1 - diff --git a/deps/crates/vendor/icu_calendar/.cargo-checksum.json b/deps/crates/vendor/icu_calendar/.cargo-checksum.json index d80a2b2841be47..24c90d80a0e937 100644 --- a/deps/crates/vendor/icu_calendar/.cargo-checksum.json +++ b/deps/crates/vendor/icu_calendar/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo_vcs_info.json":"5bf4d11031ba6544415af89fa62cacac923c8dddf49d4e292d24daff57d87571","Cargo.lock":"7c97bb97524646eb50dcb495e070eb99d6df27527119437923ff9f366023b76e","Cargo.toml":"5f2b9d93ec859d508a5c12f4f131cd7bc6cde61b65d63e824c0730d43e71d01b","Cargo.toml.orig":"93770e7fde059818db19ffdc3668cead2f95b4d4645a118b92e2386a586cf734","LICENSE":"f367c1b8e1aa262435251e442901da4607b4650e0e63a026f5044473ecfb90f2","README.md":"c51a6704a477876d2ebe131267a2a8023d3deaa3a2f208b9895dda192a2ff880","benches/convert.rs":"14b05e5328a2ffa347f4adba079de9bce8c0dad67bd0e2c7825e50c46affe342","benches/date.rs":"e1272dc8a6f4fac843ca1231983adaf7264a364932a9a3e06cadb32fd6e62013","benches/fixtures/datetimes.json":"ad8db74905ad8837b5e75ddc0bb51c1f277a8aa20e486d6927438a8fc7f094a6","src/any_calendar.rs":"fe0ddeccfeeb47dad36f88297e85d4823556b999079136b385dbdadb373c804f","src/cal/abstract_gregorian.rs":"ff0f57b889450cc0b376b02f46464e2bf86059e1faef649906eab86c07b46532","src/cal/buddhist.rs":"bc03a42366af670672db24a88ffadb4487bf6f31efcd47eaa68c76bac2d0dafe","src/cal/coptic.rs":"a06067a8585f74b96fe1a3995fc44e3547f0d843672d88af143ed5b3671b9cb6","src/cal/east_asian_traditional.rs":"6a54a8f8167703393c937db04e79f56851b8b5d77521f8d1afca998adc4336fa","src/cal/east_asian_traditional/china_data.rs":"f57440be085f5076125b2efcd92c66196a652655cb287ce124319dfd45052df5","src/cal/east_asian_traditional/korea_data.rs":"715ec9fe69500adfeba704143ebaabdeecc078ae7974b3db362e58b36e5d2189","src/cal/east_asian_traditional/qing_data.rs":"e8097d4ba4651863644ef2ed7247d57640e949eb2c2ef207a2d8ebf9b5c4f69e","src/cal/east_asian_traditional/simple.rs":"b362f75297198eaf71b6f84b39991e39705637198ae941ded8bf9a7563ddb867","src/cal/ethiopian.rs":"e315c63c36fea55b8626497489a1382cbc4cbcac521079d3ea6a77923128a72a","src/cal/gregorian.rs":"42f30696460caee5af1981b76100a8cf3e8460876d8f733b4828db99d5a9beea","src/cal/hebrew.rs":"6f995191f5205d6858a0afe28f9aed3ecb4f48e0e17075c5ebba7a294cf282a3","src/cal/hijri.rs":"17cca441ad57a596dcc44481f631d97fa3de413581c3aa9b437c0ea0921edfbb","src/cal/hijri/simulated_mecca_data.rs":"f1defaee03b91a503dd2d8039257ba297cda238cc23f6ba75ef35d622b70f483","src/cal/hijri/ummalqura_data.rs":"15118990b415f15ebf5d63502bebc0d6a99a5e021e14d87da4beb6fb136fdfa0","src/cal/indian.rs":"2b71744ee7a7beba6054424fcaa34acc96e7a2d293ac340600ecd448c0026425","src/cal/iso.rs":"b3e415ecc0aa5a44318fd7e24c879e5e2f2f03fc9a8c102a4613edb9c450744f","src/cal/japanese.rs":"baa085cf698af3ba88c31b0f9d876b082193b5004dde52d77f6594ebfcae8653","src/cal/julian.rs":"ffeac88c5bbe9c5288cbc9e89ac5c3366a7039e828ba48729e9266e447a5fcf7","src/cal/mod.rs":"2e65ce43eb8a19b0141407e3806d74d57724655605cd9cf1698ba836d69c2a12","src/cal/persian.rs":"10cd0d17116dd0887d20fa2fbf9c34eda7f3833817226f48e9fce2ef603e0e41","src/cal/roc.rs":"6c716c6fa00982ffbeaa905333c795022b7559e627a80920d72d5c9eefcaf7a0","src/calendar.rs":"961a67f72a1c5733b97c16c3b3e3bc1bda55f61e1f6819f7f40be0af4923c84c","src/calendar_arithmetic.rs":"8850422da53f06d19691b374b3476680cd0854f6c69e0816eaac3a750b477934","src/date.rs":"479681ce9eddd15b3dc10b6d96a597169932e5e6828722baccc3a414de823f3e","src/duration.rs":"7dd00f9f702c0f57796e0f9ec5d3f4a002a5739fda78879e482982b0a5c61385","src/error.rs":"a1e8bdf73bcbf533aac005050c2ebcc5e1decdec45091f2b0a3765b92544fec5","src/ixdtf.rs":"a9f3cddafd209e6f828825a2c42bf4280eb1a0456e9bae7e293d72072cc9c007","src/lib.rs":"03bab72eafec685d861d3ba075114483e751447a53c44455de81011e49ad2672","src/options.rs":"a6051b983427f035e9aea38be3607e4363998d6ad1adb341b63af4cce130fb9a","src/provider.rs":"37a27cd8f3ca98b58e0ca82ec570314ecb951371fcab772fd48af5eabc4daa98","src/tests/continuity_test.rs":"16ce3029e79a6b7148e898eac299c5a2d4efb9af51fa1d1d7157529be37cba7d","src/tests/extrema.rs":"4f752bfeb0fde51470c22bdb8cd2fbd74eb436af027a2ef2e3ba7ab7887d2d9a","src/tests/mod.rs":"aed1fc2784f1d66671477645ef6e6007a456977cc1502205ad5057ef62fc86a1","src/tests/not_enough_fields.rs":"570dc9696e1afa068aa6ca30625a01901003fc8689e316cda13adfac017a419b","src/types.rs":"a7bdc94f5a6bb44b08d188cf5e3a6e877fbf27b0a731285883b98afdc1e684b3","src/week.rs":"a69c1ad8b9399dcc4446f7bc259c6c0da281ac0b4fb3f6093ff897287674177c","tests/arithmetic.rs":"21ae8051246d706b3e5eb4d41010b1011e9ac82a19fdc687e38b0222ca84c4ca","tests/exhaustive.rs":"9bda342cfa8db3d73ebfd5cd03ab0c6692f5e8c0bd28ffd8d119242b705614e3","tests/extended_year.rs":"e63f358426bd6c5d290565822420fc313c4f31ac99e5cd35122024e6273e1a8e","tests/reference_year.rs":"fd2bbc54b5a932490669de2ba8cf62f36539e56737f6f296a076856712e0b6bb"},"package":"d6f0e52e009b6b16ba9c0693578796f2dd4aaa59a7f8f920423706714a89ac4e"} \ No newline at end of file +{"files":{"Cargo.toml":"133164f2c7c66053988a55b15ca4364f8ae03ae52836f2094630cde3eaf9351c","LICENSE":"f367c1b8e1aa262435251e442901da4607b4650e0e63a026f5044473ecfb90f2","README.md":"c51a6704a477876d2ebe131267a2a8023d3deaa3a2f208b9895dda192a2ff880","benches/convert.rs":"e266633d7a07629f1ab716084ee17aa8a919d9729ca482246406925a4e333369","benches/date.rs":"c614ace643c9121d92a742b03cd4748004fc99e708d012c0f49cc00994a294cd","benches/fixtures/datetimes.json":"ad8db74905ad8837b5e75ddc0bb51c1f277a8aa20e486d6927438a8fc7f094a6","benches/fixtures/mod.rs":"c927a527009af7d29bb16fdb893704178ac577ec2688baffa924f24da7f6b040","src/any_calendar.rs":"9437638ef54108b3aab83702eeb60ba02da17f18938787c9997cd60de766ab97","src/cal/buddhist.rs":"eac3e9ad36e24fdfc96b90775f7ef0e0ab3453f0c1ca4eb15559432910f275cf","src/cal/chinese.rs":"fb195492ca130c4264067b49a9b4145a32de6a33671cc66e4040daedde0e8949","src/cal/chinese_based.rs":"cd2d806da42fd9507109f5f8438d61f11a3a0cbbc94c0334afe60135f83fa879","src/cal/coptic.rs":"2462e5f644e3dbeeef8f907f35cb4768ec629360783e327b584bbc1f34d6a5ff","src/cal/dangi.rs":"a4e9e6f20f32b4e6900333ce5067301df0894892866ae035372b7c007fd58fc2","src/cal/ethiopian.rs":"34a9116c624c649909ff75dfe1920ea409d30b6d3ec7582ecce8f495abd66ed7","src/cal/gregorian.rs":"0f17844e2e5e7b6e318f1ab45c0dea9115826a3234a137861f8ef3938bf7287a","src/cal/hebrew.rs":"6d19e5219dd63e2ba7bac805653710b0cd84df758e7a85ab1944a8bef519e550","src/cal/hijri.rs":"a80e7c07c3fe8bced24716ef55e993f29f3ed191d93a44ee9d60b38329d9a164","src/cal/hijri/ummalqura_data.rs":"9e489ef9fd0fc7205213ca3c7ed1edb5523d8cf89d66d7e626a859b49dcbbe30","src/cal/indian.rs":"3d93134cd78b1e49c264eb0d345038e6448bf9ced1d0e1d3067b9cb6c4d8550a","src/cal/iso.rs":"101b81918a873cb58cdca2e98fa4349ca04c88b2cb6401c56244c7df44bebba9","src/cal/japanese.rs":"80ae17bb05141e2d91065f49b2aa8a41d37f6ecafed676ed94fa6b047fc44bc2","src/cal/julian.rs":"f5191def5442543bae6c1ae6a443ffd8ccd69c87361e21c035da52c190fac3d7","src/cal/mod.rs":"77450c6949e36e8496350d3664bd35aead278f4898ba543acfd8b1ca90ce848d","src/cal/persian.rs":"90b27551fe24de57d859c732ee034cc2cc4a60581472dc2ece174fa62f3deaef","src/cal/roc.rs":"c82aca51e24dd038cdc7a1b36d86b5c058f92753df20db8aac7282c057d6a079","src/calendar.rs":"976ef558a0574c717d214cb4d1464885ed79d0fc1f3668d775106f8eb66870be","src/calendar_arithmetic.rs":"f22cd14476b67e59c9b18d211c79bc2b9f0a5e9904d88add497cccd624c8d855","src/date.rs":"91a3b142b48783d6fd4e508bc9bf07026c668ec72f795c269379324507d230d3","src/duration.rs":"65bde57c0af6bd8b146b92bb45bb14f661c918defe6bd388b51569503ec8bd33","src/error.rs":"c01e5adebd4be2b6287173a02623a2ff20afa2269d9e2ba4ecc01b643c7189cf","src/ixdtf.rs":"691dd80767b1d9f4f5aa2202303b49df38f2cf6699c6976ba44d5aae74fa3073","src/lib.rs":"2a10cdd624c9dbce2d8490acaf7f115ce96219bf659dfcc0d6181c132968ed19","src/provider.rs":"89aabfc8fdae13f8e1d7ebfa14f54c9f0249cc17c4436ba24766873a5f4ad128","src/provider/chinese_based.rs":"75fa2be19454674c892b2ac4e54c2b08fbb7fdfcad091ae338c30a8693be9396","src/provider/hijri.rs":"bc2d77aae6c347ba2700381eb64abf1c8118a81a2ccd6f66be6eb5b8f4c10a7c","src/tests/continuity_test.rs":"d3c97c72efc0b23d0cdf55e2911f4962fa0f55e8261019a929f2fc7d8c6a680b","src/tests/mod.rs":"0925663ff594ebac9892d652d3576a9bc1ed938b2e4ee7a6d23a641899e8bf5a","src/types.rs":"fced40c1477ca7d66edbea8597c21bf233deb7d3fe0e72addbff03a6291862fc","src/week.rs":"803b68991584f3cee05bf051db601c0207f266b9139fa27731d0bc55b1cae88d"},"package":"362941891d17750e05cd8fdfca4a89a86552825d625a937020ee1a65580da1f9"} \ No newline at end of file diff --git a/deps/crates/vendor/icu_calendar/.cargo_vcs_info.json b/deps/crates/vendor/icu_calendar/.cargo_vcs_info.json deleted file mode 100644 index d75612e253d45c..00000000000000 --- a/deps/crates/vendor/icu_calendar/.cargo_vcs_info.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "git": { - "sha1": "38a49da495248dd1ded84cf306e4ca42e64d5bb3" - }, - "path_in_vcs": "components/calendar" -} \ No newline at end of file diff --git a/deps/crates/vendor/icu_calendar/Cargo.lock b/deps/crates/vendor/icu_calendar/Cargo.lock deleted file mode 100644 index 80249d10b9ad78..00000000000000 --- a/deps/crates/vendor/icu_calendar/Cargo.lock +++ /dev/null @@ -1,1317 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "anes" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" - -[[package]] -name = "anstyle" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" - -[[package]] -name = "autocfg" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bumpalo" -version = "3.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" - -[[package]] -name = "bytes" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" - -[[package]] -name = "calendrical_calculations" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a0b39595c6ee54a8d0900204ba4c401d0ab4eb45adaf07178e8d017541529e7" -dependencies = [ - "core_maths", - "displaydoc", - "log", -] - -[[package]] -name = "cast" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" - -[[package]] -name = "cc" -version = "1.2.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "739eb0f94557554b3ca9a86d2d37bebd49c5e6d0c1d2bda35ba5bdac830befc2" -dependencies = [ - "find-msvc-tools", - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" - -[[package]] -name = "ciborium" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" -dependencies = [ - "ciborium-io", - "ciborium-ll", - "serde", -] - -[[package]] -name = "ciborium-io" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" - -[[package]] -name = "ciborium-ll" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" -dependencies = [ - "ciborium-io", - "half", -] - -[[package]] -name = "clap" -version = "4.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" -dependencies = [ - "clap_builder", -] - -[[package]] -name = "clap_builder" -version = "4.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" -dependencies = [ - "anstyle", - "clap_lex", -] - -[[package]] -name = "clap_lex" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" - -[[package]] -name = "cobs" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" -dependencies = [ - "thiserror", -] - -[[package]] -name = "colored" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "core_maths" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30" -dependencies = [ - "libm", -] - -[[package]] -name = "crc32fast" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "criterion" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" -dependencies = [ - "anes", - "cast", - "ciborium", - "clap", - "criterion-plot", - "is-terminal", - "itertools 0.10.5", - "num-traits", - "once_cell", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", -] - -[[package]] -name = "criterion-plot" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" -dependencies = [ - "cast", - "itertools 0.10.5", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" - -[[package]] -name = "databake" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6ee9e2d2afb173bcdeee45934c89ec341ab26f91c9933774fc15c2b58f83ef" -dependencies = [ - "databake-derive", - "proc-macro2", - "quote", -] - -[[package]] -name = "databake-derive" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6834770958c7b84223607e49758ec0dde273c4df915e734aad50f62968a4c134" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "deranged" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "either" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" - -[[package]] -name = "erased-serde" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "259d404d09818dec19332e31d94558aeb442fea04c817006456c24b5460bbd4b" -dependencies = [ - "serde", - "serde_core", - "typeid", -] - -[[package]] -name = "find-msvc-tools" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" - -[[package]] -name = "flate2" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "getrandom" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "half" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" -dependencies = [ - "cfg-if", - "crunchy", -] - -[[package]] -name = "hermit-abi" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" - -[[package]] -name = "http" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - -[[package]] -name = "icu_calendar" -version = "2.1.1" -dependencies = [ - "calendrical_calculations", - "criterion", - "databake", - "displaydoc", - "icu_calendar_data", - "icu_locale", - "icu_locale_core", - "icu_provider", - "itertools 0.14.0", - "ixdtf", - "serde", - "serde_json", - "simple_logger", - "tinystr", - "ureq", - "zerovec", -] - -[[package]] -name = "icu_calendar_data" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527f04223b17edfe0bd43baf14a0cb1b017830db65f3950dc00224860a9a446d" - -[[package]] -name = "icu_collections" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" -dependencies = [ - "displaydoc", - "potential_utf", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532b11722e350ab6bf916ba6eb0efe3ee54b932666afec989465f9243fe6dd60" -dependencies = [ - "icu_collections", - "icu_locale_core", - "icu_locale_data", - "icu_provider", - "potential_utf", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" -dependencies = [ - "displaydoc", - "litemap", - "serde", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locale_data" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f03e2fcaefecdf05619f3d6f91740e79ab969b4dd54f77cbf546b1d0d28e3147" - -[[package]] -name = "icu_provider" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" -dependencies = [ - "databake", - "displaydoc", - "erased-serde", - "icu_locale_core", - "postcard", - "serde", - "stable_deref_trait", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "is-terminal" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "ixdtf" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84de9d95a6d2547d9b77ee3f25fa0ee32e3c3a6484d47a55adebc0439c077992" - -[[package]] -name = "js-sys" -version = "0.3.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "libc" -version = "0.2.177" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" - -[[package]] -name = "libm" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" - -[[package]] -name = "litemap" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" - -[[package]] -name = "log" -version = "0.4.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" - -[[package]] -name = "memchr" -version = "2.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" - -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", - "simd-adler32", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_threads" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" -dependencies = [ - "libc", -] - -[[package]] -name = "once_cell" -version = "1.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" - -[[package]] -name = "oorandom" -version = "11.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" - -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - -[[package]] -name = "plotters" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" -dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "plotters-backend" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" - -[[package]] -name = "plotters-svg" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" -dependencies = [ - "plotters-backend", -] - -[[package]] -name = "postcard" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" -dependencies = [ - "cobs", - "serde", -] - -[[package]] -name = "potential_utf" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" -dependencies = [ - "serde_core", - "writeable", - "zerovec", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "proc-macro2" -version = "1.0.103" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "regex" -version = "1.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" - -[[package]] -name = "ring" -version = "0.17.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" -dependencies = [ - "cc", - "cfg-if", - "getrandom", - "libc", - "untrusted", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustls" -version = "0.23.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9586e9ee2b4f8fab52a0048ca7334d7024eef48e2cb9407e3497bb7cab7fa7" -dependencies = [ - "log", - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-pemfile" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "rustls-pki-types" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a" -dependencies = [ - "zeroize", -] - -[[package]] -name = "rustls-webpki" -version = "0.103.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10b3f4191e8a80e6b43eebabfac91e5dcecebb27a71f04e820c47ec41d314bf" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - -[[package]] -name = "rustversion" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" - -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "serde" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_core" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.145" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", - "serde_core", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - -[[package]] -name = "simple_logger" -version = "5.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291bee647ce7310b0ea721bfd7e0525517b4468eb7c7e15eb8bd774343179702" -dependencies = [ - "colored", - "log", - "time", - "windows-sys 0.61.2", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "syn" -version = "2.0.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thiserror" -version = "2.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "time" -version = "0.3.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" -dependencies = [ - "deranged", - "itoa", - "libc", - "num-conv", - "num_threads", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" - -[[package]] -name = "time-macros" -version = "0.2.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tinystr" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" -dependencies = [ - "databake", - "displaydoc", - "serde_core", - "zerovec", -] - -[[package]] -name = "tinytemplate" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "typeid" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" - -[[package]] -name = "unicode-ident" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "ureq" -version = "3.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ba1025f18a4a3fc3e9b48c868e9beb4f24f4b4b1a325bada26bd4119f46537" -dependencies = [ - "base64", - "flate2", - "log", - "percent-encoding", - "rustls", - "rustls-pemfile", - "rustls-pki-types", - "ureq-proto", - "utf-8", - "webpki-roots", -] - -[[package]] -name = "ureq-proto" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b4531c118335662134346048ddb0e54cc86bd7e81866757873055f0e38f5d2" -dependencies = [ - "base64", - "http", - "httparse", - "log", -] - -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasm-bindgen" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "web-sys" -version = "0.3.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki-roots" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b130c0d2d49f8b6889abc456e795e82525204f27c42cf767cf0d7734e089b8" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "writeable" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" - -[[package]] -name = "yoke" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zeroize" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" - -[[package]] -name = "zerotrie" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" -dependencies = [ - "displaydoc", -] - -[[package]] -name = "zerovec" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" -dependencies = [ - "databake", - "serde", - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] diff --git a/deps/crates/vendor/icu_calendar/Cargo.toml b/deps/crates/vendor/icu_calendar/Cargo.toml index 2987c1c4be7f9e..79be24ad34b964 100644 --- a/deps/crates/vendor/icu_calendar/Cargo.toml +++ b/deps/crates/vendor/icu_calendar/Cargo.toml @@ -11,9 +11,9 @@ [package] edition = "2021" -rust-version = "1.83" +rust-version = "1.82" name = "icu_calendar" -version = "2.1.1" +version = "2.0.6" authors = ["The ICU4X Project Developers"] build = false include = [ @@ -42,15 +42,8 @@ repository = "https://github.com/unicode-org/icu4x" [package.metadata.docs.rs] all-features = true -[package.metadata.cargo-semver-checks.lints] -workspace = true - [features] -alloc = [ - "icu_locale_core/alloc", - "tinystr/alloc", - "serde?/alloc", -] +alloc = [] compiled_data = [ "dep:icu_calendar_data", "dep:icu_locale", @@ -77,29 +70,11 @@ serde = [ "tinystr/serde", "icu_provider/serde", ] -unstable = [] [lib] name = "icu_calendar" path = "src/lib.rs" -[[test]] -name = "arithmetic" -path = "tests/arithmetic.rs" -required-features = ["ixdtf"] - -[[test]] -name = "exhaustive" -path = "tests/exhaustive.rs" - -[[test]] -name = "extended_year" -path = "tests/extended_year.rs" - -[[test]] -name = "reference_year" -path = "tests/reference_year.rs" - [[bench]] name = "convert" path = "benches/convert.rs" @@ -111,7 +86,7 @@ path = "benches/date.rs" harness = false [dependencies.calendrical_calculations] -version = "0.2.3" +version = "0.2.2" default-features = false [dependencies.databake] @@ -125,49 +100,58 @@ version = "0.2.3" default-features = false [dependencies.icu_calendar_data] -version = "~2.1.1" +version = "~2.0.0" optional = true default-features = false [dependencies.icu_locale] -version = "~2.1.1" +version = "~2.0.0" optional = true default-features = false [dependencies.icu_locale_core] -version = "2.1.1" +version = "2.0.0" +features = ["alloc"] default-features = false [dependencies.icu_provider] -version = "2.1.1" +version = "2.0.0" +features = ["alloc"] default-features = false [dependencies.ixdtf] -version = "0.6.0" +version = "0.5.0" optional = true default-features = false [dependencies.serde] -version = "1.0.220" -features = ["derive"] +version = "1.0.110" +features = [ + "derive", + "alloc", +] optional = true default-features = false [dependencies.tinystr] version = "0.8.0" -features = ["zerovec"] +features = [ + "alloc", + "zerovec", +] +default-features = false + +[dependencies.writeable] +version = "0.6.0" default-features = false [dependencies.zerovec] -version = "0.11.3" +version = "0.11.1" features = ["derive"] default-features = false -[dev-dependencies.itertools] -version = "0.14.0" - [dev-dependencies.serde] -version = "1.0.220" +version = "1.0.110" features = [ "derive", "alloc", @@ -180,8 +164,5 @@ version = "1.0.45" [dev-dependencies.simple_logger] version = "5.0.0" -[dev-dependencies.ureq] -version = "3.0.0" - [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies.criterion] version = "0.5.0" diff --git a/deps/crates/vendor/icu_calendar/Cargo.toml.orig b/deps/crates/vendor/icu_calendar/Cargo.toml.orig deleted file mode 100644 index 1567ce4a40b65b..00000000000000 --- a/deps/crates/vendor/icu_calendar/Cargo.toml.orig +++ /dev/null @@ -1,75 +0,0 @@ -# This file is part of ICU4X. For terms of use, please see the file -# called LICENSE at the top level of the ICU4X source tree -# (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -[package] -name = "icu_calendar" -description = "Date APIs for Gregorian and non-Gregorian calendars" -version.workspace = true - -authors.workspace = true -categories.workspace = true -edition.workspace = true -homepage.workspace = true -include.workspace = true -license.workspace = true -repository.workspace = true -rust-version.workspace = true - -[package.metadata.docs.rs] -all-features = true - -[dependencies] -calendrical_calculations = { workspace = true } -displaydoc = { workspace = true } -icu_provider = { workspace = true } -icu_locale_core = { workspace = true } -ixdtf = { workspace = true, optional = true } -tinystr = { workspace = true, features = ["zerovec"] } -zerovec = { workspace = true, features = ["derive"] } - -databake = { workspace = true, features = ["derive"], optional = true } -serde = { workspace = true, features = ["derive"], optional = true } - -icu_calendar_data = { workspace = true, optional = true } -icu_locale = { workspace = true, optional = true } - -[dev-dependencies] -icu_provider = { path = "../../provider/core", features = ["logging"] } -icu = { path = "../../components/icu", default-features = false } -itertools = { workspace = true } -serde = { workspace = true, features = ["derive", "alloc"] } -serde_json = { workspace = true } -simple_logger = { workspace = true } -ureq = { workspace = true } - - -[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] -criterion = { workspace = true } - - -[features] -default = ["compiled_data", "ixdtf"] -ixdtf = ["dep:ixdtf"] -logging = ["calendrical_calculations/logging"] -serde = ["dep:serde", "zerovec/serde", "tinystr/serde", "icu_provider/serde"] -datagen = ["serde", "dep:databake", "zerovec/databake", "tinystr/databake", "alloc", "icu_provider/export"] -compiled_data = ["dep:icu_calendar_data", "dep:icu_locale", "icu_locale?/compiled_data", "icu_provider/baked"] -unstable = [] - -alloc = ["icu_locale_core/alloc", "tinystr/alloc", "serde?/alloc"] - -[[bench]] -name = "date" -harness = false - -[[bench]] -name = "convert" -harness = false - -[[test]] -name = "arithmetic" -required-features = ["ixdtf"] - -[package.metadata.cargo-semver-checks.lints] -workspace = true diff --git a/deps/crates/vendor/icu_calendar/benches/convert.rs b/deps/crates/vendor/icu_calendar/benches/convert.rs index 7e84fb364f31f2..90b18f256cc8d6 100644 --- a/deps/crates/vendor/icu_calendar/benches/convert.rs +++ b/deps/crates/vendor/icu_calendar/benches/convert.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +mod fixtures; + use criterion::{ black_box, criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion, }; @@ -47,10 +49,16 @@ fn convert_benches(c: &mut Criterion) { bench_calendar(&mut group, "calendar/julian", icu::calendar::cal::Julian); + bench_calendar( + &mut group, + "calendar/chinese_calculating", + icu::calendar::cal::Chinese::new_always_calculating(), + ); + bench_calendar( &mut group, "calendar/chinese_cached", - icu::calendar::cal::ChineseTraditional::new(), + icu::calendar::cal::Chinese::new(), ); bench_calendar( @@ -64,30 +72,30 @@ fn convert_benches(c: &mut Criterion) { bench_calendar( &mut group, "calendar/islamic/observational", - icu::calendar::cal::Hijri::new_simulated_mecca(), + icu::calendar::cal::HijriSimulated::new_mecca_always_calculating(), ); bench_calendar( &mut group, "calendar/islamic/civil", - icu::calendar::cal::Hijri::new_tabular( - icu::calendar::cal::hijri::TabularAlgorithmLeapYears::TypeII, - icu::calendar::cal::hijri::TabularAlgorithmEpoch::Friday, + icu::calendar::cal::HijriTabular::new( + icu::calendar::cal::HijriTabularLeapYears::TypeII, + icu::calendar::cal::HijriTabularEpoch::Friday, ), ); bench_calendar( &mut group, "calendar/islamic/ummalqura", - icu::calendar::cal::Hijri::new_umm_al_qura(), + icu::calendar::cal::HijriUmmAlQura::new(), ); bench_calendar( &mut group, "calendar/islamic/tabular", - icu::calendar::cal::Hijri::new_tabular( - icu::calendar::cal::hijri::TabularAlgorithmLeapYears::TypeII, - icu::calendar::cal::hijri::TabularAlgorithmEpoch::Thursday, + icu::calendar::cal::HijriTabular::new( + icu::calendar::cal::HijriTabularLeapYears::TypeII, + icu::calendar::cal::HijriTabularEpoch::Thursday, ), ); diff --git a/deps/crates/vendor/icu_calendar/benches/date.rs b/deps/crates/vendor/icu_calendar/benches/date.rs index 25786ac3f458ae..4cd5e5fecd22b9 100644 --- a/deps/crates/vendor/icu_calendar/benches/date.rs +++ b/deps/crates/vendor/icu_calendar/benches/date.rs @@ -2,45 +2,23 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct DateFixture(pub Vec); - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct Test { - pub year: i32, - pub month: u8, - pub day: u8, - pub hour: u8, - pub minute: u8, - pub second: u8, -} +mod fixtures; use criterion::{ black_box, criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion, }; -use icu_calendar::{ - options::{DateAddOptions, Overflow}, - types, AsCalendar, Calendar, Date, -}; +use fixtures::DateFixture; +use icu_calendar::{AsCalendar, Calendar, Date, DateDuration}; fn bench_date(date: &mut Date) { // black_box used to avoid compiler optimization. // Arithmetic - let mut options = DateAddOptions::default(); - options.overflow = Some(Overflow::Constrain); - date.try_add_with_options( - types::DateDuration { - is_negative: false, - years: black_box(1), - months: black_box(2), - weeks: black_box(3), - days: black_box(4), - }, - options, - ) - .unwrap(); + date.add(DateDuration::new( + black_box(1), + black_box(2), + black_box(3), + black_box(4), + )); // Retrieving vals let _ = black_box(date.year()); @@ -56,14 +34,13 @@ fn bench_calendar( name: &str, fxs: &DateFixture, calendar: C, - calendar_date_init: impl Fn(i32, u8, u8, C) -> Date, + calendar_date_init: impl Fn(i32, u8, u8) -> Date, ) { group.bench_function(name, |b| { b.iter(|| { for fx in &fxs.0 { // Instantion from int - let mut instantiated_date_calendar = - calendar_date_init(fx.year, fx.month, fx.day, calendar.clone()); + let mut instantiated_date_calendar = calendar_date_init(fx.year, fx.month, fx.day); // Conversion from ISO let date_iso = Date::try_new_iso(fx.year, fx.month, fx.day).unwrap(); @@ -85,7 +62,7 @@ fn date_benches(c: &mut Criterion) { "calendar/overview", &fxs, icu::calendar::cal::Iso, - |y, m, d, _| Date::try_new_iso(y, m, d).unwrap(), + |y, m, d| Date::try_new_iso(y, m, d).unwrap(), ); bench_calendar( @@ -93,7 +70,7 @@ fn date_benches(c: &mut Criterion) { "calendar/buddhist", &fxs, icu::calendar::cal::Buddhist, - |y, m, d, _| Date::try_new_buddhist(y, m, d).unwrap(), + |y, m, d| Date::try_new_buddhist(y, m, d).unwrap(), ); bench_calendar( @@ -101,7 +78,7 @@ fn date_benches(c: &mut Criterion) { "calendar/coptic", &fxs, icu::calendar::cal::Coptic, - |y, m, d, _| Date::try_new_coptic(y, m, d).unwrap(), + |y, m, d| Date::try_new_coptic(y, m, d).unwrap(), ); bench_calendar( @@ -109,7 +86,7 @@ fn date_benches(c: &mut Criterion) { "calendar/ethiopic", &fxs, icu::calendar::cal::Ethiopian::new(), - |y, m, d, _| { + |y, m, d| { Date::try_new_ethiopian(icu::calendar::cal::EthiopianEraStyle::AmeteMihret, y, m, d) .unwrap() }, @@ -120,7 +97,7 @@ fn date_benches(c: &mut Criterion) { "calendar/indian", &fxs, icu::calendar::cal::Indian, - |y, m, d, _| Date::try_new_indian(y, m, d).unwrap(), + |y, m, d| Date::try_new_indian(y, m, d).unwrap(), ); bench_calendar( @@ -128,7 +105,7 @@ fn date_benches(c: &mut Criterion) { "calendar/persian", &fxs, icu::calendar::cal::Persian, - |y, m, d, _| Date::try_new_persian(y, m, d).unwrap(), + |y, m, d| Date::try_new_persian(y, m, d).unwrap(), ); bench_calendar( @@ -136,7 +113,7 @@ fn date_benches(c: &mut Criterion) { "calendar/roc", &fxs, icu::calendar::cal::Roc, - |y, m, d, _| Date::try_new_roc(y, m, d).unwrap(), + |y, m, d| Date::try_new_roc(y, m, d).unwrap(), ); bench_calendar( @@ -144,28 +121,59 @@ fn date_benches(c: &mut Criterion) { "calendar/julian", &fxs, icu::calendar::cal::Julian, - |y, m, d, _| Date::try_new_julian(y, m, d).unwrap(), + |y, m, d| Date::try_new_julian(y, m, d).unwrap(), + ); + + bench_calendar( + &mut group, + "calendar/chinese_calculating", + &fxs, + icu::calendar::cal::Chinese::new_always_calculating(), + |y, m, d| { + Date::try_new_chinese_with_calendar( + y, + m, + d, + icu::calendar::cal::Chinese::new_always_calculating(), + ) + .unwrap() + }, ); bench_calendar( &mut group, "calendar/chinese_cached", &fxs, - icu::calendar::cal::ChineseTraditional::new(), - |y, m, d, c| { - Date::try_new_from_codes(None, y, types::MonthCode::new_normal(m).unwrap(), d, c) + icu::calendar::cal::Chinese::new(), + |y, m, d| { + Date::try_new_chinese_with_calendar(y, m, d, icu::calendar::cal::Chinese::new()) .unwrap() }, ); + bench_calendar( + &mut group, + "calendar/dangi_calculating", + &fxs, + icu::calendar::cal::Dangi::new_always_calculating(), + |y, m, d| { + Date::try_new_dangi_with_calendar( + y, + m, + d, + icu::calendar::cal::Dangi::new_always_calculating(), + ) + .unwrap() + }, + ); + bench_calendar( &mut group, "calendar/dangi_cached", &fxs, - icu::calendar::cal::KoreanTraditional::new(), - |y, m, d, c| { - Date::try_new_from_codes(None, y, types::MonthCode::new_normal(m).unwrap(), d, c) - .unwrap() + icu::calendar::cal::Dangi::new(), + |y, m, d| { + Date::try_new_dangi_with_calendar(y, m, d, icu::calendar::cal::Dangi::new()).unwrap() }, ); @@ -174,10 +182,7 @@ fn date_benches(c: &mut Criterion) { "calendar/hebrew", &fxs, icu::calendar::cal::Hebrew, - |y, m, d, c| { - Date::try_new_from_codes(None, y, types::MonthCode::new_normal(m).unwrap(), d, c) - .unwrap() - }, + |y, m, d| Date::try_new_hebrew(y, m, d).unwrap(), ); bench_calendar( @@ -185,45 +190,75 @@ fn date_benches(c: &mut Criterion) { "calendar/gregorian", &fxs, icu::calendar::cal::Gregorian, - |y, m, d, _| Date::try_new_gregorian(y, m, d).unwrap(), + |y, m, d| Date::try_new_gregorian(y, m, d).unwrap(), ); bench_calendar( &mut group, "calendar/islamic/civil", &fxs, - icu::calendar::cal::Hijri::new_tabular( - icu::calendar::cal::hijri::TabularAlgorithmLeapYears::TypeII, - icu::calendar::cal::hijri::TabularAlgorithmEpoch::Friday, + icu::calendar::cal::HijriTabular::new( + icu::calendar::cal::HijriTabularLeapYears::TypeII, + icu::calendar::cal::HijriTabularEpoch::Friday, ), - |y, m, d, c| Date::try_new_hijri_with_calendar(y, m, d, c).unwrap(), + |y, m, d| { + Date::try_new_hijri_tabular_with_calendar( + y, + m, + d, + icu::calendar::cal::HijriTabular::new( + icu::calendar::cal::HijriTabularLeapYears::TypeII, + icu::calendar::cal::HijriTabularEpoch::Friday, + ), + ) + .unwrap() + }, ); bench_calendar( &mut group, "calendar/islamic/tabular", &fxs, - icu::calendar::cal::Hijri::new_tabular( - icu::calendar::cal::hijri::TabularAlgorithmLeapYears::TypeII, - icu::calendar::cal::hijri::TabularAlgorithmEpoch::Thursday, + icu::calendar::cal::HijriTabular::new( + icu::calendar::cal::HijriTabularLeapYears::TypeII, + icu::calendar::cal::HijriTabularEpoch::Thursday, ), - |y, m, d, c| Date::try_new_hijri_with_calendar(y, m, d, c).unwrap(), + |y, m, d| { + Date::try_new_hijri_tabular_with_calendar( + y, + m, + d, + icu::calendar::cal::HijriTabular::new( + icu::calendar::cal::HijriTabularLeapYears::TypeII, + icu::calendar::cal::HijriTabularEpoch::Thursday, + ), + ) + .unwrap() + }, ); bench_calendar( &mut group, "calendar/islamic/ummalqura", &fxs, - icu::calendar::cal::Hijri::new_umm_al_qura(), - |y, m, d, c| Date::try_new_hijri_with_calendar(y, m, d, c).unwrap(), + icu::calendar::cal::HijriUmmAlQura::new(), + |y, m, d| Date::try_new_ummalqura(y, m, d).unwrap(), ); bench_calendar( &mut group, "calendar/islamic/observational", &fxs, - icu::calendar::cal::Hijri::new_simulated_mecca(), - |y, m, d, c| Date::try_new_hijri_with_calendar(y, m, d, c).unwrap(), + icu::calendar::cal::HijriSimulated::new_mecca_always_calculating(), + |y, m, d| { + Date::try_new_simulated_hijri_with_calendar( + y, + m, + d, + icu::calendar::cal::HijriSimulated::new_mecca_always_calculating(), + ) + .unwrap() + }, ); group.finish(); diff --git a/deps/crates/vendor/icu_calendar/benches/fixtures/mod.rs b/deps/crates/vendor/icu_calendar/benches/fixtures/mod.rs new file mode 100644 index 00000000000000..c4bc9336ea0aee --- /dev/null +++ b/deps/crates/vendor/icu_calendar/benches/fixtures/mod.rs @@ -0,0 +1,18 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct DateFixture(pub Vec); + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct Test { + pub year: i32, + pub month: u8, + pub day: u8, + pub hour: u8, + pub minute: u8, + pub second: u8, +} diff --git a/deps/crates/vendor/icu_calendar/src/any_calendar.rs b/deps/crates/vendor/icu_calendar/src/any_calendar.rs index 3032034600d8c2..6ce6ed1164e6bd 100644 --- a/deps/crates/vendor/icu_calendar/src/any_calendar.rs +++ b/deps/crates/vendor/icu_calendar/src/any_calendar.rs @@ -4,16 +4,20 @@ //! Module for working with multiple calendars at once +use crate::cal::hijri::HijriSimulatedLocation; use crate::cal::iso::IsoDateInner; -use crate::cal::*; -use crate::error::{DateError, DateFromFieldsError}; -use crate::options::DateFromFieldsOptions; -use crate::options::{DateAddOptions, DateDifferenceOptions}; -use crate::types::{DateFields, YearInfo}; -use crate::{types, AsCalendar, Calendar, Date, Ref}; +use crate::cal::{ + Buddhist, Chinese, Coptic, Dangi, Ethiopian, EthiopianEraStyle, Gregorian, Hebrew, + HijriSimulated, HijriTabular, HijriTabularEpoch, HijriTabularLeapYears, HijriUmmAlQura, Indian, + Iso, Japanese, JapaneseExtended, Persian, Roc, +}; +use crate::error::DateError; +use crate::types::YearInfo; +use crate::{types, AsCalendar, Calendar, Date, DateDuration, DateDurationUnit, Ref}; use crate::preferences::{CalendarAlgorithm, HijriCalendarAlgorithm}; use icu_locale_core::preferences::define_preferences; +use icu_locale_core::subtags::region; use icu_provider::prelude::*; use core::fmt; @@ -40,7 +44,7 @@ define_preferences!( /// /// There are many ways of constructing an AnyCalendar'd date: /// ``` -/// use icu::calendar::{AnyCalendar, AnyCalendarKind, Date, cal::{Japanese, Gregorian}, types::MonthCode}; +/// use icu::calendar::{AnyCalendar, AnyCalendarKind, Date, cal::Japanese, types::MonthCode}; /// use icu::locale::locale; /// use tinystr::tinystr; /// # use std::rc::Rc; @@ -48,26 +52,26 @@ define_preferences!( /// let locale = locale!("en-u-ca-japanese"); // English with the Japanese calendar /// /// let calendar = AnyCalendar::new(AnyCalendarKind::new(locale.into())); +/// let calendar = Rc::new(calendar); // Avoid cloning it each time +/// // If everything is a local reference, you may use icu::calendar::Ref instead. +/// +/// // construct from era code, year, month code, day, and a calendar +/// // This is March 28, 15 Heisei +/// let manual_date = Date::try_new_from_codes(Some("heisei"), 15, MonthCode(tinystr!(4, "M03")), 28, calendar.clone()) +/// .expect("Failed to construct Date manually"); /// -/// // This is a Date -/// let any_japanese_date = Date::try_new_gregorian(2020, 9, 1) -/// .expect("Failed to construct Gregorian Date.") -/// .to_calendar(calendar) -/// .to_any(); +/// +/// // construct another date by converting from ISO +/// let iso_date = Date::try_new_iso(2020, 9, 1) +/// .expect("Failed to construct ISO Date."); +/// let iso_converted = iso_date.to_calendar(calendar); /// /// // Construct a date in the appropriate typed calendar and convert /// let japanese_calendar = Japanese::new(); -/// let japanese_date = Date::try_new_japanese_with_calendar("reiwa", 2, 9, 1, +/// let japanese_date = Date::try_new_japanese_with_calendar("heisei", 15, 3, 28, /// japanese_calendar).unwrap(); -/// assert_eq!(japanese_date.to_any(), any_japanese_date); -/// -/// // this is also Date, but it uses a different calendar -/// let any_gregorian_date = any_japanese_date.to_calendar(Gregorian).to_any(); -/// -/// // Date does not have a total order -/// assert!(any_gregorian_date <= any_gregorian_date); -/// assert!(any_japanese_date <= any_japanese_date); -/// assert!(!(any_gregorian_date <= any_japanese_date) && !(any_japanese_date <= any_gregorian_date)); +/// // This is a Date +/// let any_japanese_date = japanese_date.to_any(); /// ``` #[derive(Debug, Clone)] #[non_exhaustive] @@ -75,11 +79,11 @@ pub enum AnyCalendar { /// A [`Buddhist`] calendar Buddhist(Buddhist), /// A [`Chinese`] calendar - Chinese(ChineseTraditional), + Chinese(Chinese), /// A [`Coptic`] calendar Coptic(Coptic), /// A [`Dangi`] calendar - Dangi(KoreanTraditional), + Dangi(Dangi), /// An [`Ethiopian`] calendar Ethiopian(Ethiopian), /// A [`Gregorian`] calendar @@ -89,11 +93,11 @@ pub enum AnyCalendar { /// An [`Indian`] calendar Indian(Indian), /// A [`HijriTabular`] calendar - HijriTabular(Hijri), + HijriTabular(HijriTabular), /// A [`HijriSimulated`] calendar - HijriSimulated(Hijri), + HijriSimulated(HijriSimulated), /// A [`HijriUmmAlQura`] calendar - HijriUmmAlQura(Hijri), + HijriUmmAlQura(HijriUmmAlQura), /// An [`Iso`] calendar Iso(Iso), /// A [`Japanese`] calendar @@ -114,11 +118,11 @@ pub enum AnyDateInner { /// A date for a [`Buddhist`] calendar Buddhist(::DateInner), /// A date for a [`Chinese`] calendar - Chinese(::DateInner), + Chinese(::DateInner), /// A date for a [`Coptic`] calendar Coptic(::DateInner), /// A date for a [`Dangi`] calendar - Dangi(::DateInner), + Dangi(::DateInner), /// A date for an [`Ethiopian`] calendar Ethiopian(::DateInner), /// A date for a [`Gregorian`] calendar @@ -129,13 +133,14 @@ pub enum AnyDateInner { Indian(::DateInner), /// A date for a [`HijriTabular`] calendar HijriTabular( - as Calendar>::DateInner, - hijri::TabularAlgorithm, + ::DateInner, + HijriTabularLeapYears, + HijriTabularEpoch, ), /// A date for a [`HijriSimulated`] calendar - HijriSimulated( as Calendar>::DateInner), + HijriSimulated(::DateInner), /// A date for a [`HijriUmmAlQura`] calendar - HijriUmmAlQura( as Calendar>::DateInner), + HijriUmmAlQura(::DateInner), /// A date for an [`Iso`] calendar Iso(::DateInner), /// A date for a [`Japanese`] calendar @@ -148,32 +153,6 @@ pub enum AnyDateInner { Roc(::DateInner), } -impl PartialOrd for AnyDateInner { - #[rustfmt::skip] - fn partial_cmp(&self, other: &Self) -> Option { - use AnyDateInner::*; - match (self, other) { - (Buddhist(d1), Buddhist(d2)) => d1.partial_cmp(d2), - (Chinese(d1), Chinese(d2)) => d1.partial_cmp(d2), - (Coptic(d1), Coptic(d2)) => d1.partial_cmp(d2), - (Dangi(d1), Dangi(d2)) => d1.partial_cmp(d2), - (Ethiopian(d1), Ethiopian(d2)) => d1.partial_cmp(d2), - (Gregorian(d1), Gregorian(d2)) => d1.partial_cmp(d2), - (Hebrew(d1), Hebrew(d2)) => d1.partial_cmp(d2), - (Indian(d1), Indian(d2)) => d1.partial_cmp(d2), - (&HijriTabular(ref d1, s1), &HijriTabular(ref d2, s2)) if s1 == s2 => d1.partial_cmp(d2), - (HijriSimulated(d1), HijriSimulated(d2)) => d1.partial_cmp(d2), - (HijriUmmAlQura(d1), HijriUmmAlQura(d2)) => d1.partial_cmp(d2), - (Iso(d1), Iso(d2)) => d1.partial_cmp(d2), - (Japanese(d1), Japanese(d2)) => d1.partial_cmp(d2), - (JapaneseExtended(d1), JapaneseExtended(d2)) => d1.partial_cmp(d2), - (Persian(d1), Persian(d2)) => d1.partial_cmp(d2), - (Roc(d1), Roc(d2)) => d1.partial_cmp(d2), - _ => None, - } - } -} - macro_rules! match_cal_and_date { (match ($cal:ident, $date:ident): ($cal_matched:ident, $date_matched:ident) => $e:expr) => { match ($cal, $date) { @@ -187,8 +166,8 @@ macro_rules! match_cal_and_date { (&Self::Indian(ref $cal_matched), &AnyDateInner::Indian(ref $date_matched)) => $e, ( &Self::HijriTabular(ref $cal_matched), - &AnyDateInner::HijriTabular(ref $date_matched, sighting), - ) if $cal_matched.0 == sighting => $e, + &AnyDateInner::HijriTabular(ref $date_matched, leap_years, epoch), + ) if $cal_matched.epoch == epoch && $cal_matched.leap_years == leap_years => $e, ( &Self::HijriSimulated(ref $cal_matched), &AnyDateInner::HijriSimulated(ref $date_matched), @@ -205,8 +184,11 @@ macro_rules! match_cal_and_date { ) => $e, (&Self::Persian(ref $cal_matched), &AnyDateInner::Persian(ref $date_matched)) => $e, (&Self::Roc(ref $cal_matched), &AnyDateInner::Roc(ref $date_matched)) => $e, - // This is only reached from misuse of from_raw, a semi-internal api - _ => panic!("AnyCalendar with mismatched date type"), + _ => panic!( + "Found AnyCalendar with mixed calendar type {:?} and date type {:?}!", + $cal.kind().debug_name(), + $date.kind().debug_name() + ), } }; } @@ -223,7 +205,9 @@ macro_rules! match_cal { &Self::Hebrew(ref $cal_matched) => AnyDateInner::Hebrew($e), &Self::Indian(ref $cal_matched) => AnyDateInner::Indian($e), &Self::HijriSimulated(ref $cal_matched) => AnyDateInner::HijriSimulated($e), - &Self::HijriTabular(ref $cal_matched) => AnyDateInner::HijriTabular($e, $cal_matched.0), + &Self::HijriTabular(ref $cal_matched) => { + AnyDateInner::HijriTabular($e, $cal_matched.leap_years, $cal_matched.epoch) + } &Self::HijriUmmAlQura(ref $cal_matched) => AnyDateInner::HijriUmmAlQura($e), &Self::Iso(ref $cal_matched) => AnyDateInner::Iso($e), &Self::Japanese(ref $cal_matched) => AnyDateInner::Japanese($e), @@ -234,45 +218,10 @@ macro_rules! match_cal { }; } -/// Error returned when comparing two [`Date`]s with [`AnyCalendar`]. -#[derive(Clone, Copy, PartialEq, Debug)] -#[non_exhaustive] -#[doc(hidden)] // unstable, not yet graduated -pub enum AnyCalendarDifferenceError { - /// The calendars of the two dates being compared are not equal. - /// - /// To compare dates in different calendars, convert them to the same calendar first. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::cal::AnyCalendarDifferenceError; - /// use icu::calendar::Date; - /// - /// let d1 = Date::try_new_gregorian(2000, 1, 1).unwrap().to_any(); - /// let d2 = Date::try_new_persian(1562, 1, 1).unwrap().to_any(); - /// - /// assert_eq!( - /// d1.try_until_with_options(&d2, Default::default()) - /// .unwrap_err(), - /// AnyCalendarDifferenceError::MismatchedCalendars, - /// ); - /// - /// // To compare the dates, convert them to the same calendar, - /// // such as ISO. - /// - /// d1.to_iso() - /// .try_until_with_options(&d2.to_iso(), Default::default()) - /// .unwrap(); - /// ``` - MismatchedCalendars, -} - impl crate::cal::scaffold::UnstableSealed for AnyCalendar {} impl Calendar for AnyCalendar { type DateInner = AnyDateInner; type Year = YearInfo; - type DifferenceError = AnyCalendarDifferenceError; fn from_codes( &self, @@ -284,44 +233,10 @@ impl Calendar for AnyCalendar { Ok(match_cal!(match self: (c) => c.from_codes(era, year, month_code, day)?)) } - #[cfg(feature = "unstable")] - fn from_fields( - &self, - fields: DateFields, - options: DateFromFieldsOptions, - ) -> Result { - Ok(match_cal!(match self: (c) => c.from_fields(fields, options)?)) - } - - fn has_cheap_iso_conversion(&self) -> bool { - match self { - Self::Buddhist(ref c) => c.has_cheap_iso_conversion(), - Self::Chinese(ref c) => c.has_cheap_iso_conversion(), - Self::Coptic(ref c) => c.has_cheap_iso_conversion(), - Self::Dangi(ref c) => c.has_cheap_iso_conversion(), - Self::Ethiopian(ref c) => c.has_cheap_iso_conversion(), - Self::Gregorian(ref c) => c.has_cheap_iso_conversion(), - Self::Hebrew(ref c) => c.has_cheap_iso_conversion(), - Self::Indian(ref c) => c.has_cheap_iso_conversion(), - Self::HijriSimulated(ref c) => c.has_cheap_iso_conversion(), - Self::HijriTabular(ref c) => c.has_cheap_iso_conversion(), - Self::HijriUmmAlQura(ref c) => c.has_cheap_iso_conversion(), - Self::Iso(ref c) => c.has_cheap_iso_conversion(), - Self::Japanese(ref c) => c.has_cheap_iso_conversion(), - Self::JapaneseExtended(ref c) => c.has_cheap_iso_conversion(), - Self::Persian(ref c) => c.has_cheap_iso_conversion(), - Self::Roc(ref c) => c.has_cheap_iso_conversion(), - } - } - fn from_iso(&self, iso: IsoDateInner) -> AnyDateInner { match_cal!(match self: (c) => c.from_iso(iso)) } - fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { - match_cal_and_date!(match (self, date): (c, d) => c.to_iso(d)) - } - fn from_rata_die(&self, rd: calendrical_calculations::rata_die::RataDie) -> Self::DateInner { match_cal!(match self: (c) => c.from_rata_die(rd)) } @@ -330,6 +245,10 @@ impl Calendar for AnyCalendar { match_cal_and_date!(match (self, date): (c, d) => c.to_rata_die(d)) } + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + match_cal_and_date!(match (self, date): (c, d) => c.to_iso(d)) + } + fn months_in_year(&self, date: &Self::DateInner) -> u8 { match_cal_and_date!(match (self, date): (c, d) => c.months_in_year(d)) } @@ -342,141 +261,222 @@ impl Calendar for AnyCalendar { match_cal_and_date!(match (self, date): (c, d) => c.days_in_month(d)) } - #[cfg(feature = "unstable")] - fn add( - &self, - date: &Self::DateInner, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result { - let mut date = *date; - match (self, &mut date) { + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + match (self, date) { (Self::Buddhist(c), AnyDateInner::Buddhist(ref mut d)) => { - *d = c.add(d, duration, options)? + c.offset_date(d, offset.cast_unit()) } (Self::Chinese(c), AnyDateInner::Chinese(ref mut d)) => { - *d = c.add(d, duration, options)? + c.offset_date(d, offset.cast_unit()) } (Self::Coptic(c), AnyDateInner::Coptic(ref mut d)) => { - *d = c.add(d, duration, options)? + c.offset_date(d, offset.cast_unit()) + } + (Self::Dangi(c), AnyDateInner::Dangi(ref mut d)) => { + c.offset_date(d, offset.cast_unit()) } - (Self::Dangi(c), AnyDateInner::Dangi(ref mut d)) => *d = c.add(d, duration, options)?, (Self::Ethiopian(c), AnyDateInner::Ethiopian(ref mut d)) => { - *d = c.add(d, duration, options)? + c.offset_date(d, offset.cast_unit()) } (Self::Gregorian(c), AnyDateInner::Gregorian(ref mut d)) => { - *d = c.add(d, duration, options)? + c.offset_date(d, offset.cast_unit()) } (Self::Hebrew(c), AnyDateInner::Hebrew(ref mut d)) => { - *d = c.add(d, duration, options)? + c.offset_date(d, offset.cast_unit()) } (Self::Indian(c), AnyDateInner::Indian(ref mut d)) => { - *d = c.add(d, duration, options)? + c.offset_date(d, offset.cast_unit()) } - (Self::HijriTabular(c), AnyDateInner::HijriTabular(ref mut d, sighting)) - if c.0 == *sighting => - { - *d = c.add(d, duration, options)? + ( + Self::HijriTabular(c), + &mut AnyDateInner::HijriTabular(ref mut d, leap_years, epoch), + ) if c.epoch == epoch && c.leap_years == leap_years => { + c.offset_date(d, offset.cast_unit()) } (Self::HijriSimulated(c), AnyDateInner::HijriSimulated(ref mut d)) => { - *d = c.add(d, duration, options)? + c.offset_date(d, offset.cast_unit()) } (Self::HijriUmmAlQura(c), AnyDateInner::HijriUmmAlQura(ref mut d)) => { - *d = c.add(d, duration, options)? + c.offset_date(d, offset.cast_unit()) } - (Self::Iso(c), AnyDateInner::Iso(ref mut d)) => *d = c.add(d, duration, options)?, + (Self::Iso(c), AnyDateInner::Iso(ref mut d)) => c.offset_date(d, offset.cast_unit()), (Self::Japanese(c), AnyDateInner::Japanese(ref mut d)) => { - *d = c.add(d, duration, options)? + c.offset_date(d, offset.cast_unit()) } (Self::JapaneseExtended(c), AnyDateInner::JapaneseExtended(ref mut d)) => { - *d = c.add(d, duration, options)? + c.offset_date(d, offset.cast_unit()) } (Self::Persian(c), AnyDateInner::Persian(ref mut d)) => { - *d = c.add(d, duration, options)? + c.offset_date(d, offset.cast_unit()) } - (Self::Roc(c), AnyDateInner::Roc(ref mut d)) => *d = c.add(d, duration, options)?, + (Self::Roc(c), AnyDateInner::Roc(ref mut d)) => c.offset_date(d, offset.cast_unit()), // This is only reached from misuse of from_raw, a semi-internal api - #[expect(clippy::panic)] - _ => panic!("AnyCalendar with mismatched date type"), + #[allow(clippy::panic)] + (_, d) => panic!( + "Found AnyCalendar with mixed calendar type {} and date type {}!", + self.kind().debug_name(), + d.kind().debug_name() + ), } - Ok(date) } - #[cfg(feature = "unstable")] fn until( &self, date1: &Self::DateInner, date2: &Self::DateInner, - options: DateDifferenceOptions, - ) -> Result { - let Ok(r) = match (self, date1, date2) { - (Self::Buddhist(c1), AnyDateInner::Buddhist(d1), AnyDateInner::Buddhist(d2)) => { - c1.until(d1, d2, options) - } - (Self::Chinese(c1), AnyDateInner::Chinese(d1), AnyDateInner::Chinese(d2)) => { - c1.until(d1, d2, options) - } - (Self::Coptic(c1), AnyDateInner::Coptic(d1), AnyDateInner::Coptic(d2)) => { - c1.until(d1, d2, options) - } - (Self::Dangi(c1), AnyDateInner::Dangi(d1), AnyDateInner::Dangi(d2)) => { - c1.until(d1, d2, options) - } - (Self::Ethiopian(c1), AnyDateInner::Ethiopian(d1), AnyDateInner::Ethiopian(d2)) => { - c1.until(d1, d2, options) - } - (Self::Gregorian(c1), AnyDateInner::Gregorian(d1), AnyDateInner::Gregorian(d2)) => { - c1.until(d1, d2, options) - } - (Self::Hebrew(c1), AnyDateInner::Hebrew(d1), AnyDateInner::Hebrew(d2)) => { - c1.until(d1, d2, options) - } - (Self::Indian(c1), AnyDateInner::Indian(d1), AnyDateInner::Indian(d2)) => { - c1.until(d1, d2, options) - } + calendar2: &Self, + largest_unit: DateDurationUnit, + smallest_unit: DateDurationUnit, + ) -> DateDuration { + match (self, calendar2, date1, date2) { + ( + Self::Buddhist(c1), + Self::Buddhist(c2), + AnyDateInner::Buddhist(d1), + AnyDateInner::Buddhist(d2), + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), + ( + Self::Chinese(c1), + Self::Chinese(c2), + AnyDateInner::Chinese(d1), + AnyDateInner::Chinese(d2), + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), + ( + Self::Coptic(c1), + Self::Coptic(c2), + AnyDateInner::Coptic(d1), + AnyDateInner::Coptic(d2), + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), + ( + Self::Dangi(c1), + Self::Dangi(c2), + AnyDateInner::Dangi(d1), + AnyDateInner::Dangi(d2), + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), + ( + Self::Ethiopian(c1), + Self::Ethiopian(c2), + AnyDateInner::Ethiopian(d1), + AnyDateInner::Ethiopian(d2), + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), + ( + Self::Gregorian(c1), + Self::Gregorian(c2), + AnyDateInner::Gregorian(d1), + AnyDateInner::Gregorian(d2), + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), + ( + Self::Hebrew(c1), + Self::Hebrew(c2), + AnyDateInner::Hebrew(d1), + AnyDateInner::Hebrew(d2), + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), + ( + Self::Indian(c1), + Self::Indian(c2), + AnyDateInner::Indian(d1), + AnyDateInner::Indian(d2), + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), ( Self::HijriTabular(c1), - &AnyDateInner::HijriTabular(ref d1, s1), - &AnyDateInner::HijriTabular(ref d2, s2), - ) if c1.0 == s1 && s1 == s2 => c1.until(d1, d2, options), + Self::HijriTabular(c2), + &AnyDateInner::HijriTabular(ref d1, l1, e1), + &AnyDateInner::HijriTabular(ref d2, l2, e2), + ) if c1.epoch == c2.epoch + && c2.epoch == e1 + && e1 == e2 + && c1.leap_years == c2.leap_years + && c2.leap_years == l1 + && l1 == l2 => + { + c1.until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit() + } ( Self::HijriSimulated(c1), + Self::HijriSimulated(c2), AnyDateInner::HijriSimulated(d1), AnyDateInner::HijriSimulated(d2), - ) => c1.until(d1, d2, options), + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), ( Self::HijriUmmAlQura(c1), + Self::HijriUmmAlQura(c2), AnyDateInner::HijriUmmAlQura(d1), AnyDateInner::HijriUmmAlQura(d2), - ) => c1.until(d1, d2, options), - (Self::Iso(c1), AnyDateInner::Iso(d1), AnyDateInner::Iso(d2)) => { - c1.until(d1, d2, options) - } - (Self::Japanese(c1), AnyDateInner::Japanese(d1), AnyDateInner::Japanese(d2)) => { - c1.until(d1, d2, options) - } + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), + (Self::Iso(c1), Self::Iso(c2), AnyDateInner::Iso(d1), AnyDateInner::Iso(d2)) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), + ( + Self::Japanese(c1), + Self::Japanese(c2), + AnyDateInner::Japanese(d1), + AnyDateInner::Japanese(d2), + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), ( Self::JapaneseExtended(c1), + Self::JapaneseExtended(c2), AnyDateInner::JapaneseExtended(d1), AnyDateInner::JapaneseExtended(d2), - ) => c1.until(d1, d2, options), - (Self::Persian(c1), AnyDateInner::Persian(d1), AnyDateInner::Persian(d2)) => { - c1.until(d1, d2, options) - } - (Self::Roc(c1), AnyDateInner::Roc(d1), AnyDateInner::Roc(d2)) => { - c1.until(d1, d2, options) - } + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), + ( + Self::Persian(c1), + Self::Persian(c2), + AnyDateInner::Persian(d1), + AnyDateInner::Persian(d2), + ) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), + (Self::Roc(c1), Self::Roc(c2), AnyDateInner::Roc(d1), AnyDateInner::Roc(d2)) => c1 + .until(d1, d2, c2, largest_unit, smallest_unit) + .cast_unit(), _ => { - return Err(AnyCalendarDifferenceError::MismatchedCalendars); + // attempt to convert + let iso = calendar2.to_iso(date2); + + match_cal_and_date!(match (self, date1): + (c1, d1) => { + let d2 = c1.from_iso(iso); + let until = c1.until(d1, &d2, c1, largest_unit, smallest_unit); + until.cast_unit::() + } + ) } - }; - Ok(r) + } } fn year_info(&self, date: &Self::DateInner) -> types::YearInfo { match_cal_and_date!(match (self, date): (c, d) => c.year_info(d).into()) } + fn extended_year(&self, date: &Self::DateInner) -> i32 { + match_cal_and_date!(match (self, date): (c, d) => c.extended_year(d)) + } + /// The calendar-specific check if `date` is in a leap year fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { match_cal_and_date!(match (self, date): (c, d) => c.is_in_leap_year(d)) @@ -556,9 +556,9 @@ impl AnyCalendar { pub const fn new(kind: AnyCalendarKind) -> Self { match kind { AnyCalendarKind::Buddhist => AnyCalendar::Buddhist(Buddhist), - AnyCalendarKind::Chinese => AnyCalendar::Chinese(ChineseTraditional::new()), + AnyCalendarKind::Chinese => AnyCalendar::Chinese(Chinese::new()), AnyCalendarKind::Coptic => AnyCalendar::Coptic(Coptic), - AnyCalendarKind::Dangi => AnyCalendar::Dangi(KoreanTraditional::new()), + AnyCalendarKind::Dangi => AnyCalendar::Dangi(Dangi::new()), AnyCalendarKind::Ethiopian => AnyCalendar::Ethiopian(Ethiopian::new_with_era_style( EthiopianEraStyle::AmeteMihret, )), @@ -569,23 +569,21 @@ impl AnyCalendar { AnyCalendarKind::Hebrew => AnyCalendar::Hebrew(Hebrew), AnyCalendarKind::Indian => AnyCalendar::Indian(Indian), AnyCalendarKind::HijriTabularTypeIIFriday => { - AnyCalendar::HijriTabular(Hijri::new_tabular( - hijri::TabularAlgorithmLeapYears::TypeII, - hijri::TabularAlgorithmEpoch::Friday, + AnyCalendar::HijriTabular(HijriTabular::new( + crate::cal::hijri::HijriTabularLeapYears::TypeII, + HijriTabularEpoch::Friday, )) } AnyCalendarKind::HijriSimulatedMecca => { - AnyCalendar::HijriSimulated(Hijri::new_simulated_mecca()) + AnyCalendar::HijriSimulated(HijriSimulated::new_mecca()) } AnyCalendarKind::HijriTabularTypeIIThursday => { - AnyCalendar::HijriTabular(Hijri::new_tabular( - hijri::TabularAlgorithmLeapYears::TypeII, - hijri::TabularAlgorithmEpoch::Thursday, + AnyCalendar::HijriTabular(HijriTabular::new( + crate::cal::hijri::HijriTabularLeapYears::TypeII, + HijriTabularEpoch::Thursday, )) } - AnyCalendarKind::HijriUmmAlQura => { - AnyCalendar::HijriUmmAlQura(Hijri::new_umm_al_qura()) - } + AnyCalendarKind::HijriUmmAlQura => AnyCalendar::HijriUmmAlQura(HijriUmmAlQura::new()), AnyCalendarKind::Iso => AnyCalendar::Iso(Iso), AnyCalendarKind::Japanese => AnyCalendar::Japanese(Japanese::new()), AnyCalendarKind::JapaneseExtended => { @@ -607,9 +605,13 @@ impl AnyCalendar { { Ok(match kind { AnyCalendarKind::Buddhist => AnyCalendar::Buddhist(Buddhist), - AnyCalendarKind::Chinese => AnyCalendar::Chinese(ChineseTraditional::new()), + AnyCalendarKind::Chinese => { + AnyCalendar::Chinese(Chinese::try_new_with_buffer_provider(provider)?) + } AnyCalendarKind::Coptic => AnyCalendar::Coptic(Coptic), - AnyCalendarKind::Dangi => AnyCalendar::Dangi(KoreanTraditional::new()), + AnyCalendarKind::Dangi => { + AnyCalendar::Dangi(Dangi::try_new_with_buffer_provider(provider)?) + } AnyCalendarKind::Ethiopian => AnyCalendar::Ethiopian(Ethiopian::new_with_era_style( EthiopianEraStyle::AmeteMihret, )), @@ -620,23 +622,21 @@ impl AnyCalendar { AnyCalendarKind::Hebrew => AnyCalendar::Hebrew(Hebrew), AnyCalendarKind::Indian => AnyCalendar::Indian(Indian), AnyCalendarKind::HijriTabularTypeIIFriday => { - AnyCalendar::HijriTabular(Hijri::new_tabular( - hijri::TabularAlgorithmLeapYears::TypeII, - hijri::TabularAlgorithmEpoch::Friday, + AnyCalendar::HijriTabular(HijriTabular::new( + crate::cal::hijri::HijriTabularLeapYears::TypeII, + HijriTabularEpoch::Friday, )) } - AnyCalendarKind::HijriSimulatedMecca => { - AnyCalendar::HijriSimulated(Hijri::new_simulated_mecca()) - } + AnyCalendarKind::HijriSimulatedMecca => AnyCalendar::HijriSimulated( + HijriSimulated::try_new_mecca_with_buffer_provider(provider)?, + ), AnyCalendarKind::HijriTabularTypeIIThursday => { - AnyCalendar::HijriTabular(Hijri::new_tabular( - hijri::TabularAlgorithmLeapYears::TypeII, - hijri::TabularAlgorithmEpoch::Thursday, + AnyCalendar::HijriTabular(HijriTabular::new( + crate::cal::hijri::HijriTabularLeapYears::TypeII, + HijriTabularEpoch::Thursday, )) } - AnyCalendarKind::HijriUmmAlQura => { - AnyCalendar::HijriUmmAlQura(Hijri::new_umm_al_qura()) - } + AnyCalendarKind::HijriUmmAlQura => AnyCalendar::HijriUmmAlQura(HijriUmmAlQura::new()), AnyCalendarKind::Iso => AnyCalendar::Iso(Iso), AnyCalendarKind::Japanese => { AnyCalendar::Japanese(Japanese::try_new_with_buffer_provider(provider)?) @@ -654,13 +654,16 @@ impl AnyCalendar { where P: DataProvider + DataProvider + + DataProvider + + DataProvider + + DataProvider + ?Sized, { Ok(match kind { AnyCalendarKind::Buddhist => AnyCalendar::Buddhist(Buddhist), - AnyCalendarKind::Chinese => AnyCalendar::Chinese(ChineseTraditional::new()), + AnyCalendarKind::Chinese => AnyCalendar::Chinese(Chinese::try_new_unstable(provider)?), AnyCalendarKind::Coptic => AnyCalendar::Coptic(Coptic), - AnyCalendarKind::Dangi => AnyCalendar::Dangi(KoreanTraditional::new()), + AnyCalendarKind::Dangi => AnyCalendar::Dangi(Dangi::try_new_unstable(provider)?), AnyCalendarKind::Ethiopian => AnyCalendar::Ethiopian(Ethiopian::new_with_era_style( EthiopianEraStyle::AmeteMihret, )), @@ -671,23 +674,21 @@ impl AnyCalendar { AnyCalendarKind::Hebrew => AnyCalendar::Hebrew(Hebrew), AnyCalendarKind::Indian => AnyCalendar::Indian(Indian), AnyCalendarKind::HijriTabularTypeIIFriday => { - AnyCalendar::HijriTabular(Hijri::new_tabular( - hijri::TabularAlgorithmLeapYears::TypeII, - hijri::TabularAlgorithmEpoch::Friday, + AnyCalendar::HijriTabular(HijriTabular::new( + crate::cal::hijri::HijriTabularLeapYears::TypeII, + HijriTabularEpoch::Friday, )) } AnyCalendarKind::HijriSimulatedMecca => { - AnyCalendar::HijriSimulated(Hijri::new_simulated_mecca()) + AnyCalendar::HijriSimulated(HijriSimulated::try_new_mecca_unstable(provider)?) } AnyCalendarKind::HijriTabularTypeIIThursday => { - AnyCalendar::HijriTabular(Hijri::new_tabular( - hijri::TabularAlgorithmLeapYears::TypeII, - hijri::TabularAlgorithmEpoch::Thursday, + AnyCalendar::HijriTabular(HijriTabular::new( + crate::cal::hijri::HijriTabularLeapYears::TypeII, + HijriTabularEpoch::Thursday, )) } - AnyCalendarKind::HijriUmmAlQura => { - AnyCalendar::HijriUmmAlQura(Hijri::new_umm_al_qura()) - } + AnyCalendarKind::HijriUmmAlQura => AnyCalendar::HijriUmmAlQura(HijriUmmAlQura::new()), AnyCalendarKind::Iso => AnyCalendar::Iso(Iso), AnyCalendarKind::Japanese => { AnyCalendar::Japanese(Japanese::try_new_unstable(provider)?) @@ -737,107 +738,127 @@ impl> Date { } } +impl AnyDateInner { + fn kind(&self) -> AnyCalendarKind { + match *self { + AnyDateInner::Buddhist(_) => AnyCalendarKind::Buddhist, + AnyDateInner::Chinese(_) => AnyCalendarKind::Chinese, + AnyDateInner::Coptic(_) => AnyCalendarKind::Coptic, + AnyDateInner::Dangi(_) => AnyCalendarKind::Dangi, + AnyDateInner::Ethiopian(_) => AnyCalendarKind::Ethiopian, + AnyDateInner::Gregorian(_) => AnyCalendarKind::Gregorian, + AnyDateInner::Hebrew(_) => AnyCalendarKind::Hebrew, + AnyDateInner::Indian(_) => AnyCalendarKind::Indian, + AnyDateInner::HijriTabular( + _, + HijriTabularLeapYears::TypeII, + HijriTabularEpoch::Friday, + ) => AnyCalendarKind::HijriTabularTypeIIFriday, + AnyDateInner::HijriSimulated(_) => AnyCalendarKind::HijriSimulatedMecca, + AnyDateInner::HijriTabular( + _, + HijriTabularLeapYears::TypeII, + HijriTabularEpoch::Thursday, + ) => AnyCalendarKind::HijriTabularTypeIIThursday, + AnyDateInner::HijriUmmAlQura(_) => AnyCalendarKind::HijriUmmAlQura, + AnyDateInner::Iso(_) => AnyCalendarKind::Iso, + AnyDateInner::Japanese(_) => AnyCalendarKind::Japanese, + AnyDateInner::JapaneseExtended(_) => AnyCalendarKind::JapaneseExtended, + AnyDateInner::Persian(_) => AnyCalendarKind::Persian, + AnyDateInner::Roc(_) => AnyCalendarKind::Roc, + } + } +} + /// Convenient type for selecting the kind of AnyCalendar to construct #[non_exhaustive] #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] pub enum AnyCalendarKind { /// The kind of a [`Buddhist`] calendar - /// - /// This corresponds to the `"buddhist"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). Buddhist, /// The kind of a [`Chinese`] calendar - /// - /// This corresponds to the `"chinese"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). Chinese, /// The kind of a [`Coptic`] calendar - /// - /// This corresponds to the `"coptic"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). Coptic, /// The kind of a [`Dangi`] calendar - /// - /// This corresponds to the `"dangi"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). Dangi, /// The kind of an [`Ethiopian`] calendar, with Amete Mihret era - /// - /// This corresponds to the `"ethiopic"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). Ethiopian, /// The kind of an [`Ethiopian`] calendar, with Amete Alem era - /// - /// This corresponds to the `"ethioaa"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). EthiopianAmeteAlem, /// The kind of a [`Gregorian`] calendar - /// - /// This corresponds to the `"gregory"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). Gregorian, /// The kind of a [`Hebrew`] calendar - /// - /// This corresponds to the `"hebrew"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). Hebrew, /// The kind of a [`Indian`] calendar - /// - /// This corresponds to the `"indian"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). Indian, /// The kind of an [`HijriTabular`] calendar using [`HijriTabularLeapYears::TypeII`] and [`HijriTabularEpoch::Friday`] - /// - /// This corresponds to the `"islamic-civil"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). HijriTabularTypeIIFriday, /// The kind of an [`HijriSimulated`], Mecca calendar - /// - /// This corresponds to the `"islamic-rgsa"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). HijriSimulatedMecca, /// The kind of an [`HijriTabular`] calendar using [`HijriTabularLeapYears::TypeII`] and [`HijriTabularEpoch::Thursday`] - /// - /// This corresponds to the `"islamic-tbla"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). HijriTabularTypeIIThursday, /// The kind of an [`HijriUmmAlQura`] calendar - /// - /// This corresponds to the `"islamic-umalqura"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). HijriUmmAlQura, /// The kind of an [`Iso`] calendar - /// - /// This corresponds to the `"iso8601"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). Iso, /// The kind of a [`Japanese`] calendar - /// - /// This corresponds to the `"japanese"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). Japanese, /// The kind of a [`JapaneseExtended`] calendar - /// - /// This corresponds to the `"japanext"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). JapaneseExtended, /// The kind of a [`Persian`] calendar - /// - /// This corresponds to the `"persian"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). Persian, /// The kind of a [`Roc`] calendar - /// - /// This corresponds to the `"roc"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). Roc, } impl AnyCalendarKind { /// Selects the [`AnyCalendarKind`] appropriate for the given [`CalendarPreferences`]. pub fn new(prefs: CalendarPreferences) -> Self { - if let Some(kind) = prefs.calendar_algorithm.and_then(|a| a.try_into().ok()) { + let algo = prefs.calendar_algorithm; + let region = prefs.locale_preferences.region(); + if let Some(kind) = algo.and_then(|a| a.try_into().ok()) { return kind; } + if region == Some(region!("TH")) { + AnyCalendarKind::Buddhist + } else if region == Some(region!("AF")) || region == Some(region!("IR")) { + AnyCalendarKind::Persian + } else if region == Some(region!("SA")) && algo == Some(CalendarAlgorithm::Hijri(None)) { + AnyCalendarKind::HijriSimulatedMecca + } else { + AnyCalendarKind::Gregorian + } + } - // This is tested to be consistent with CLDR in icu_provider_source::calendar::test_calendar_resolution - match ( - prefs.calendar_algorithm, - prefs - .locale_preferences - .region() - .as_ref() - .map(|r| r.as_str()), - ) { - (Some(CalendarAlgorithm::Hijri(None)), Some("AE" | "BH" | "KW" | "QA" | "SA")) => { - AnyCalendarKind::HijriUmmAlQura - } - (Some(CalendarAlgorithm::Hijri(None)), _) => AnyCalendarKind::HijriTabularTypeIIFriday, - (_, Some("TH")) => AnyCalendarKind::Buddhist, - (_, Some("AF" | "IR")) => AnyCalendarKind::Persian, - _ => AnyCalendarKind::Gregorian, + fn debug_name(self) -> &'static str { + match self { + AnyCalendarKind::Buddhist => Buddhist.debug_name(), + AnyCalendarKind::Chinese => Chinese::DEBUG_NAME, + AnyCalendarKind::Coptic => Coptic.debug_name(), + AnyCalendarKind::Dangi => Dangi::DEBUG_NAME, + AnyCalendarKind::Ethiopian => Ethiopian(false).debug_name(), + AnyCalendarKind::EthiopianAmeteAlem => Ethiopian(true).debug_name(), + AnyCalendarKind::Gregorian => Gregorian.debug_name(), + AnyCalendarKind::Hebrew => Hebrew.debug_name(), + AnyCalendarKind::Indian => Indian.debug_name(), + AnyCalendarKind::HijriTabularTypeIIFriday => HijriTabular::new( + crate::cal::hijri::HijriTabularLeapYears::TypeII, + HijriTabularEpoch::Friday, + ) + .debug_name(), + AnyCalendarKind::HijriSimulatedMecca => HijriSimulated::DEBUG_NAME, + AnyCalendarKind::HijriTabularTypeIIThursday => HijriTabular::new( + crate::cal::hijri::HijriTabularLeapYears::TypeII, + HijriTabularEpoch::Thursday, + ) + .debug_name(), + AnyCalendarKind::HijriUmmAlQura => HijriUmmAlQura::DEBUG_NAME, + AnyCalendarKind::Iso => Iso.debug_name(), + AnyCalendarKind::Japanese => Japanese::DEBUG_NAME, + AnyCalendarKind::JapaneseExtended => JapaneseExtended::DEBUG_NAME, + AnyCalendarKind::Persian => Persian.debug_name(), + AnyCalendarKind::Roc => Roc.debug_name(), } } } @@ -970,7 +991,7 @@ impl From for AnyCalendar { } } -impl IntoAnyCalendar for ChineseTraditional { +impl IntoAnyCalendar for Chinese { #[inline] fn to_any(self) -> AnyCalendar { AnyCalendar::Chinese(self) @@ -1001,8 +1022,8 @@ impl IntoAnyCalendar for ChineseTraditional { } } -impl From for AnyCalendar { - fn from(value: ChineseTraditional) -> AnyCalendar { +impl From for AnyCalendar { + fn from(value: Chinese) -> AnyCalendar { value.to_any() } } @@ -1044,7 +1065,7 @@ impl From for AnyCalendar { } } -impl IntoAnyCalendar for KoreanTraditional { +impl IntoAnyCalendar for Dangi { #[inline] fn to_any(self) -> AnyCalendar { AnyCalendar::Dangi(self) @@ -1075,8 +1096,8 @@ impl IntoAnyCalendar for KoreanTraditional { } } -impl From for AnyCalendar { - fn from(value: KoreanTraditional) -> AnyCalendar { +impl From for AnyCalendar { + fn from(value: Dangi) -> AnyCalendar { value.to_any() } } @@ -1089,9 +1110,10 @@ impl IntoAnyCalendar for Ethiopian { } #[inline] fn kind(&self) -> AnyCalendarKind { - match self.era_style() { - EthiopianEraStyle::AmeteAlem => AnyCalendarKind::EthiopianAmeteAlem, - EthiopianEraStyle::AmeteMihret => AnyCalendarKind::Ethiopian, + if self.0 { + AnyCalendarKind::EthiopianAmeteAlem + } else { + AnyCalendarKind::Ethiopian } } #[inline] @@ -1233,22 +1255,20 @@ impl From for AnyCalendar { } } -impl IntoAnyCalendar for Hijri { +impl IntoAnyCalendar for HijriTabular { #[inline] fn to_any(self) -> AnyCalendar { AnyCalendar::HijriTabular(self) } #[inline] fn kind(&self) -> AnyCalendarKind { - match self.0 { - hijri::TabularAlgorithm { - leap_years: hijri::TabularAlgorithmLeapYears::TypeII, - epoch: hijri::TabularAlgorithmEpoch::Friday, - } => AnyCalendarKind::HijriTabularTypeIIFriday, - hijri::TabularAlgorithm { - leap_years: hijri::TabularAlgorithmLeapYears::TypeII, - epoch: hijri::TabularAlgorithmEpoch::Thursday, - } => AnyCalendarKind::HijriTabularTypeIIThursday, + match (self.leap_years, self.epoch) { + (HijriTabularLeapYears::TypeII, HijriTabularEpoch::Friday) => { + AnyCalendarKind::HijriTabularTypeIIFriday + } + (HijriTabularLeapYears::TypeII, HijriTabularEpoch::Thursday) => { + AnyCalendarKind::HijriTabularTypeIIThursday + } } } #[inline] @@ -1269,27 +1289,25 @@ impl IntoAnyCalendar for Hijri { } #[inline] fn date_to_any(&self, d: &Self::DateInner) -> AnyDateInner { - AnyDateInner::HijriTabular(*d, self.0) + AnyDateInner::HijriTabular(*d, self.leap_years, self.epoch) } } -impl From> for AnyCalendar { - fn from(value: Hijri) -> AnyCalendar { +impl From for AnyCalendar { + fn from(value: HijriTabular) -> AnyCalendar { value.to_any() } } -impl IntoAnyCalendar for Hijri { +impl IntoAnyCalendar for HijriSimulated { #[inline] fn to_any(self) -> AnyCalendar { AnyCalendar::HijriSimulated(self) } #[inline] fn kind(&self) -> AnyCalendarKind { - match self.0.location { - crate::cal::hijri_internal::SimulatedLocation::Mecca => { - AnyCalendarKind::HijriSimulatedMecca - } + match self.location { + HijriSimulatedLocation::Mecca => AnyCalendarKind::HijriSimulatedMecca, } } #[inline] @@ -1314,13 +1332,13 @@ impl IntoAnyCalendar for Hijri { } } -impl From> for AnyCalendar { - fn from(value: Hijri) -> AnyCalendar { +impl From for AnyCalendar { + fn from(value: HijriSimulated) -> AnyCalendar { value.to_any() } } -impl IntoAnyCalendar for Hijri { +impl IntoAnyCalendar for HijriUmmAlQura { #[inline] fn to_any(self) -> AnyCalendar { AnyCalendar::HijriUmmAlQura(self) @@ -1351,8 +1369,8 @@ impl IntoAnyCalendar for Hijri { } } -impl From> for AnyCalendar { - fn from(value: Hijri) -> AnyCalendar { +impl From for AnyCalendar { + fn from(value: HijriUmmAlQura) -> AnyCalendar { value.to_any() } } @@ -1569,37 +1587,29 @@ mod tests { }); let roundtrip_year = date.year(); + // FIXME: these APIs should be improved + let roundtrip_year = roundtrip_year.era_year_or_related_iso(); let roundtrip_month = date.month().standard_code; let roundtrip_day = date.day_of_month().0; assert_eq!( - (month, day), - (roundtrip_month, roundtrip_day), + (year, month, day), + (roundtrip_year, roundtrip_month, roundtrip_day), "Failed to roundtrip for calendar {}", calendar.debug_name() ); if let Some((era_code, era_index)) = era { let roundtrip_era_year = date.year().era().expect("year type should be era"); - - let roundtrip_year = roundtrip_year.era_year_or_related_iso(); assert_eq!( - (era_code, era_index, year), + (era_code, era_index), ( roundtrip_era_year.era.as_str(), - roundtrip_era_year.era_index, - roundtrip_year + roundtrip_era_year.era_index ), "Failed to roundtrip era for calendar {}", calendar.debug_name() ) - } else { - assert_eq!( - year, - date.extended_year(), - "Failed to roundtrip year for calendar {}", - calendar.debug_name() - ); } let iso = date.to_iso(); @@ -1668,8 +1678,7 @@ mod tests { let roc = Ref(&roc); single_test_roundtrip(buddhist, Some(("be", Some(0))), 100, "M03", 1); - single_test_roundtrip(buddhist, None, 100, "M03", 1); - single_test_roundtrip(buddhist, None, -100, "M03", 1); + single_test_roundtrip(buddhist, None, 2000, "M03", 1); single_test_roundtrip(buddhist, Some(("be", Some(0))), -100, "M03", 1); single_test_error( buddhist, @@ -1682,7 +1691,6 @@ mod tests { single_test_roundtrip(coptic, Some(("am", Some(0))), 100, "M03", 1); single_test_roundtrip(coptic, None, 2000, "M03", 1); - single_test_roundtrip(coptic, None, -100, "M03", 1); single_test_roundtrip(coptic, Some(("am", Some(0))), -99, "M03", 1); single_test_roundtrip(coptic, Some(("am", Some(0))), 100, "M13", 1); single_test_error( @@ -1696,11 +1704,8 @@ mod tests { single_test_roundtrip(ethiopian, Some(("am", Some(1))), 100, "M03", 1); single_test_roundtrip(ethiopian, None, 2000, "M03", 1); - single_test_roundtrip(ethiopian, None, -100, "M03", 1); single_test_roundtrip(ethiopian, Some(("am", Some(1))), 2000, "M13", 1); single_test_roundtrip(ethiopian, Some(("aa", Some(0))), 5400, "M03", 1); - // Since #6910, the era range is not enforced in try_from_codes - /* single_test_error( ethiopian, Some(("am", Some(0))), @@ -1727,7 +1732,6 @@ mod tests { max: 5500, }, ); - */ single_test_error( ethiopian, Some(("am", Some(0))), @@ -1739,7 +1743,6 @@ mod tests { single_test_roundtrip(ethioaa, Some(("aa", Some(0))), 7000, "M13", 1); single_test_roundtrip(ethioaa, None, 7000, "M13", 1); - single_test_roundtrip(ethioaa, None, -100, "M13", 1); single_test_roundtrip(ethioaa, Some(("aa", Some(0))), 100, "M03", 1); single_test_error( ethiopian, @@ -1752,10 +1755,7 @@ mod tests { single_test_roundtrip(gregorian, Some(("ce", Some(1))), 100, "M03", 1); single_test_roundtrip(gregorian, None, 2000, "M03", 1); - single_test_roundtrip(gregorian, None, -100, "M03", 1); single_test_roundtrip(gregorian, Some(("bce", Some(0))), 100, "M03", 1); - // Since #6910, the era range is not enforced in try_from_codes - /* single_test_error( gregorian, Some(("ce", Some(1))), @@ -1782,7 +1782,7 @@ mod tests { max: i32::MAX, }, ); - */ + single_test_error( gregorian, Some(("bce", Some(0))), @@ -1834,11 +1834,7 @@ mod tests { single_test_roundtrip(japanese, Some(("meiji", None)), 10, "M03", 1); single_test_roundtrip(japanese, Some(("ce", None)), 1000, "M03", 1); single_test_roundtrip(japanese, None, 1000, "M03", 1); - single_test_roundtrip(japanese, None, -100, "M03", 1); - single_test_roundtrip(japanese, None, 2024, "M03", 1); single_test_roundtrip(japanese, Some(("bce", None)), 10, "M03", 1); - // Since #6910, the era range is not enforced in try_from_codes - /* single_test_error( japanese, Some(("ce", None)), @@ -1865,7 +1861,7 @@ mod tests { max: i32::MAX, }, ); - */ + single_test_error( japanese, Some(("reiwa", None)), @@ -1881,8 +1877,6 @@ mod tests { single_test_roundtrip(japanext, Some(("tenpyokampo-749", None)), 1, "M04", 20); single_test_roundtrip(japanext, Some(("ce", None)), 100, "M03", 1); single_test_roundtrip(japanext, Some(("bce", None)), 10, "M03", 1); - // Since #6910, the era range is not enforced in try_from_codes - /* single_test_error( japanext, Some(("ce", None)), @@ -1909,7 +1903,7 @@ mod tests { max: i32::MAX, }, ); - */ + single_test_error( japanext, Some(("reiwa", None)), @@ -1921,7 +1915,6 @@ mod tests { single_test_roundtrip(persian, Some(("ap", Some(0))), 477, "M03", 1); single_test_roundtrip(persian, None, 2083, "M07", 21); - single_test_roundtrip(persian, None, -100, "M07", 21); single_test_roundtrip(persian, Some(("ap", Some(0))), 1600, "M12", 20); single_test_error( persian, @@ -1934,7 +1927,6 @@ mod tests { single_test_roundtrip(hebrew, Some(("am", Some(0))), 5773, "M03", 1); single_test_roundtrip(hebrew, None, 4993, "M07", 21); - single_test_roundtrip(hebrew, None, -100, "M07", 21); single_test_roundtrip(hebrew, Some(("am", Some(0))), 5012, "M12", 20); single_test_error( hebrew, @@ -1948,11 +1940,9 @@ mod tests { single_test_roundtrip(roc, Some(("roc", Some(1))), 10, "M05", 3); single_test_roundtrip(roc, Some(("broc", Some(0))), 15, "M01", 10); single_test_roundtrip(roc, None, 100, "M10", 30); - single_test_roundtrip(roc, None, -100, "M10", 30); single_test_roundtrip(hijri_simulated, Some(("ah", Some(0))), 477, "M03", 1); single_test_roundtrip(hijri_simulated, None, 2083, "M07", 21); - single_test_roundtrip(hijri_simulated, None, -100, "M07", 21); single_test_roundtrip(hijri_simulated, Some(("ah", Some(0))), 1600, "M12", 20); single_test_error( hijri_simulated, @@ -1965,7 +1955,6 @@ mod tests { single_test_roundtrip(hijri_civil, Some(("ah", Some(0))), 477, "M03", 1); single_test_roundtrip(hijri_civil, None, 2083, "M07", 21); - single_test_roundtrip(hijri_civil, None, -100, "M07", 21); single_test_roundtrip(hijri_civil, Some(("ah", Some(0))), 1600, "M12", 20); single_test_error( hijri_civil, @@ -1978,7 +1967,6 @@ mod tests { single_test_roundtrip(hijri_umm_al_qura, Some(("ah", Some(0))), 477, "M03", 1); single_test_roundtrip(hijri_umm_al_qura, None, 2083, "M07", 21); - single_test_roundtrip(hijri_umm_al_qura, None, -100, "M07", 21); single_test_roundtrip(hijri_umm_al_qura, Some(("ah", Some(0))), 1600, "M12", 20); single_test_error( hijri_umm_al_qura, @@ -1991,7 +1979,6 @@ mod tests { single_test_roundtrip(hijri_astronomical, Some(("ah", Some(0))), 477, "M03", 1); single_test_roundtrip(hijri_astronomical, None, 2083, "M07", 21); - single_test_roundtrip(hijri_astronomical, None, -100, "M07", 21); single_test_roundtrip(hijri_astronomical, Some(("ah", Some(0))), 1600, "M12", 20); single_test_error( hijri_astronomical, diff --git a/deps/crates/vendor/icu_calendar/src/cal/abstract_gregorian.rs b/deps/crates/vendor/icu_calendar/src/cal/abstract_gregorian.rs deleted file mode 100644 index 17cd85e3f581e6..00000000000000 --- a/deps/crates/vendor/icu_calendar/src/cal/abstract_gregorian.rs +++ /dev/null @@ -1,367 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -use crate::cal::iso::{IsoDateInner, IsoEra}; -use crate::calendar_arithmetic::{ArithmeticDate, DateFieldsResolver}; -use crate::error::{DateError, DateFromFieldsError, EcmaReferenceYearError, UnknownEraError}; -use crate::options::DateFromFieldsOptions; -use crate::options::{DateAddOptions, DateDifferenceOptions}; -use crate::preferences::CalendarAlgorithm; -use crate::types::EraYear; -use crate::{types, Calendar, RangeError}; -use calendrical_calculations::helpers::I32CastError; -use calendrical_calculations::rata_die::RataDie; - -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub(crate) struct AbstractGregorian(pub Y); - -pub(crate) trait GregorianYears: Clone + core::fmt::Debug { - // Positive if after 0 CE - const EXTENDED_YEAR_OFFSET: i32 = 0; - - fn extended_from_era_year(&self, era: Option<&[u8]>, year: i32) - -> Result; - - fn era_year_from_extended(&self, extended_year: i32, month: u8, day: u8) -> EraYear; - - fn calendar_algorithm(&self) -> Option { - None - } - - fn debug_name(&self) -> &'static str; -} - -impl ArithmeticDate> { - pub(crate) fn new_gregorian( - year: i32, - month: u8, - day: u8, - ) -> Result { - ArithmeticDate::try_from_ymd(year + Y::EXTENDED_YEAR_OFFSET, month, day) - } -} - -pub(crate) const REFERENCE_YEAR: i32 = 1972; -#[cfg(test)] -pub(crate) const LAST_DAY_OF_REFERENCE_YEAR: RataDie = - calendrical_calculations::gregorian::day_before_year(REFERENCE_YEAR + 1); - -impl DateFieldsResolver for AbstractGregorian { - // Gregorian year - type YearInfo = i32; - - fn days_in_provided_month(year: i32, month: u8) -> u8 { - // https://www.youtube.com/watch?v=J9KijLyP-yg&t=1394s - if month == 2 { - 28 + calendrical_calculations::gregorian::is_leap_year(year) as u8 - } else { - 30 | month ^ (month >> 3) - } - } - - fn months_in_provided_year(_: i32) -> u8 { - 12 - } - - #[inline] - fn year_info_from_era( - &self, - era: &[u8], - era_year: i32, - ) -> Result { - Ok(self.0.extended_from_era_year(Some(era), era_year)? + Y::EXTENDED_YEAR_OFFSET) - } - - #[inline] - fn year_info_from_extended(&self, extended_year: i32) -> Self::YearInfo { - extended_year + Y::EXTENDED_YEAR_OFFSET - } - - #[inline] - fn reference_year_from_month_day( - &self, - _month_code: types::ValidMonthCode, - _day: u8, - ) -> Result { - Ok(REFERENCE_YEAR) - } -} - -impl crate::cal::scaffold::UnstableSealed for AbstractGregorian {} - -impl Calendar for AbstractGregorian { - type DateInner = ArithmeticDate>; - type Year = types::EraYear; - type DifferenceError = core::convert::Infallible; - - fn from_codes( - &self, - era: Option<&str>, - year: i32, - month_code: types::MonthCode, - day: u8, - ) -> Result { - ArithmeticDate::from_codes(era, year, month_code, day, self).map(ArithmeticDate::cast) - } - - #[cfg(feature = "unstable")] - fn from_fields( - &self, - fields: types::DateFields, - options: DateFromFieldsOptions, - ) -> Result { - ArithmeticDate::from_fields(fields, options, self).map(ArithmeticDate::cast) - } - - fn from_rata_die(&self, date: RataDie) -> Self::DateInner { - let iso = match calendrical_calculations::gregorian::gregorian_from_fixed(date) { - Err(I32CastError::BelowMin) => { - ArithmeticDate::>::new_unchecked(i32::MIN, 1, 1) - } - Err(I32CastError::AboveMax) => ArithmeticDate::new_unchecked(i32::MAX, 12, 31), - Ok((year, month, day)) => ArithmeticDate::new_unchecked(year, month, day), - }; - - if iso.year.checked_sub(Y::EXTENDED_YEAR_OFFSET).is_none() { - if Y::EXTENDED_YEAR_OFFSET < 0 { - ArithmeticDate::new_unchecked(i32::MIN - Y::EXTENDED_YEAR_OFFSET, 1, 1) - } else { - ArithmeticDate::new_unchecked(i32::MAX - Y::EXTENDED_YEAR_OFFSET, 12, 31) - } - } else { - iso - } - } - - fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { - calendrical_calculations::gregorian::fixed_from_gregorian(date.year, date.month, date.day) - } - - fn has_cheap_iso_conversion(&self) -> bool { - true - } - - fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner { - iso.0 - } - - fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { - IsoDateInner(*date) - } - - fn months_in_year(&self, date: &Self::DateInner) -> u8 { - AbstractGregorian::::months_in_provided_year(date.year) - } - - fn days_in_year(&self, date: &Self::DateInner) -> u16 { - 365 + calendrical_calculations::gregorian::is_leap_year(date.year) as u16 - } - - fn days_in_month(&self, date: &Self::DateInner) -> u8 { - AbstractGregorian::::days_in_provided_month(date.year, date.month) - } - - #[cfg(feature = "unstable")] - fn add( - &self, - date: &Self::DateInner, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result { - date.added(duration, &AbstractGregorian(IsoEra), options) - } - - #[cfg(feature = "unstable")] - fn until( - &self, - date1: &Self::DateInner, - date2: &Self::DateInner, - options: DateDifferenceOptions, - ) -> Result { - Ok(date1.until(date2, &AbstractGregorian(IsoEra), options)) - } - - fn year_info(&self, date: &Self::DateInner) -> Self::Year { - self.0 - .era_year_from_extended(date.year - Y::EXTENDED_YEAR_OFFSET, date.month, date.day) - } - - fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { - calendrical_calculations::gregorian::is_leap_year(date.year) - } - - fn month(&self, date: &Self::DateInner) -> types::MonthInfo { - types::MonthInfo::non_lunisolar(date.month) - } - - fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { - types::DayOfMonth(date.day) - } - - fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { - types::DayOfYear( - calendrical_calculations::gregorian::days_before_month(date.year, date.month) - + date.day as u16, - ) - } - - fn debug_name(&self) -> &'static str { - self.0.debug_name() - } - - fn calendar_algorithm(&self) -> Option { - self.0.calendar_algorithm() - } -} - -macro_rules! impl_with_abstract_gregorian { - ($cal_ty:ty, $inner_date_ty:ident, $eras_ty:ty, $self_ident:ident, $eras_expr:expr) => { - #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] - pub struct $inner_date_ty( - pub(crate) ArithmeticDate< - crate::cal::abstract_gregorian::AbstractGregorian, - >, - ); - - impl crate::cal::scaffold::UnstableSealed for $cal_ty {} - impl crate::Calendar for $cal_ty { - type DateInner = $inner_date_ty; - type Year = types::EraYear; - type DifferenceError = core::convert::Infallible; - - fn from_codes( - &self, - era: Option<&str>, - year: i32, - month_code: types::MonthCode, - day: u8, - ) -> Result { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr) - .from_codes(era, year, month_code, day) - .map($inner_date_ty) - } - - #[cfg(feature = "unstable")] - fn from_fields( - &self, - fields: crate::types::DateFields, - options: crate::options::DateFromFieldsOptions, - ) -> Result { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr) - .from_fields(fields, options) - .map($inner_date_ty) - } - - fn from_rata_die(&self, rd: crate::types::RataDie) -> Self::DateInner { - let $self_ident = self; - $inner_date_ty( - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr).from_rata_die(rd), - ) - } - - fn to_rata_die(&self, date: &Self::DateInner) -> crate::types::RataDie { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr).to_rata_die(&date.0) - } - - fn has_cheap_iso_conversion(&self) -> bool { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr) - .has_cheap_iso_conversion() - } - - fn from_iso(&self, iso: crate::cal::iso::IsoDateInner) -> Self::DateInner { - let $self_ident = self; - $inner_date_ty( - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr).from_iso(iso), - ) - } - - fn to_iso(&self, date: &Self::DateInner) -> crate::cal::iso::IsoDateInner { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr).to_iso(&date.0) - } - - fn months_in_year(&self, date: &Self::DateInner) -> u8 { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr) - .months_in_year(&date.0) - } - - fn days_in_year(&self, date: &Self::DateInner) -> u16 { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr).days_in_year(&date.0) - } - - fn days_in_month(&self, date: &Self::DateInner) -> u8 { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr).days_in_month(&date.0) - } - - #[cfg(feature = "unstable")] - fn add( - &self, - date: &Self::DateInner, - duration: crate::types::DateDuration, - options: crate::options::DateAddOptions, - ) -> Result { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr) - .add(&date.0, duration, options) - .map($inner_date_ty) - } - - #[cfg(feature = "unstable")] - fn until( - &self, - date1: &Self::DateInner, - date2: &Self::DateInner, - options: crate::options::DateDifferenceOptions, - ) -> Result { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr) - .until(&date1.0, &date2.0, options) - } - - fn year_info(&self, date: &Self::DateInner) -> Self::Year { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr).year_info(&date.0) - } - - fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr) - .is_in_leap_year(&date.0) - } - - fn month(&self, date: &Self::DateInner) -> types::MonthInfo { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr).month(&date.0) - } - - fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr).day_of_month(&date.0) - } - - fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr).day_of_year(&date.0) - } - - fn debug_name(&self) -> &'static str { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr).debug_name() - } - - fn calendar_algorithm(&self) -> Option { - let $self_ident = self; - crate::cal::abstract_gregorian::AbstractGregorian($eras_expr).calendar_algorithm() - } - } - }; -} -pub(crate) use impl_with_abstract_gregorian; diff --git a/deps/crates/vendor/icu_calendar/src/cal/buddhist.rs b/deps/crates/vendor/icu_calendar/src/cal/buddhist.rs index f60f03e42f50b6..0e56b890d1eee9 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/buddhist.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/buddhist.rs @@ -2,74 +2,158 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::error::UnknownEraError; -use crate::preferences::CalendarAlgorithm; -use crate::{ - cal::abstract_gregorian::{impl_with_abstract_gregorian, GregorianYears}, - calendar_arithmetic::ArithmeticDate, - types, Date, DateError, RangeError, -}; +//! This module contains types and implementations for the Buddhist calendar. +//! +//! ```rust +//! use icu::calendar::{cal::Buddhist, Date}; +//! +//! let date_iso = Date::try_new_iso(1970, 1, 2) +//! .expect("Failed to initialize ISO Date instance."); +//! let date_buddhist = Date::new_from_iso(date_iso, Buddhist); +//! +//! assert_eq!(date_buddhist.era_year().year, 2513); +//! assert_eq!(date_buddhist.month().ordinal, 1); +//! assert_eq!(date_buddhist.day_of_month().0, 2); +//! ``` + +use crate::cal::iso::{Iso, IsoDateInner}; +use crate::calendar_arithmetic::ArithmeticDate; +use crate::error::DateError; +use crate::{types, Calendar, Date, DateDuration, DateDurationUnit, RangeError}; +use calendrical_calculations::rata_die::RataDie; use tinystr::tinystr; +/// The number of years the Buddhist Era is ahead of C.E. by +/// +/// (1 AD = 544 BE) +const BUDDHIST_ERA_OFFSET: i32 = 543; + #[derive(Copy, Clone, Debug, Default)] -/// The [Thai Solar Buddhist Calendar](https://en.wikipedia.org/wiki/Thai_solar_calendar) +/// The [Thai Solar Buddhist Calendar][cal] /// -/// The Thai Solar Buddhist Calendar is a variant of the [`Gregorian`](crate::cal::Gregorian) calendar -/// created by the Thai government. It is identical to the Gregorian calendar except that is uses -/// the Buddhist Era (-543 CE) instead of the Common Era. +/// The [Thai Solar Buddhist Calendar][cal] is a solar calendar used in Thailand, with twelve months. +/// The months and days are identical to that of the Gregorian calendar, however the years are counted +/// differently using the Buddhist Era. /// -/// This implementation extends proleptically for dates before the calendar's creation -/// in 2484 BE (1941 CE). +/// This type can be used with [`Date`] to represent dates in this calendar. /// -/// This corresponds to the `"buddhist"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). +/// [cal]: https://en.wikipedia.org/wiki/Thai_solar_calendar /// /// # Era codes /// /// This calendar uses a single era code `be`, with 1 Buddhist Era being 543 BCE. Dates before this era use negative years. +/// +/// # Month codes +/// +/// This calendar supports 12 solar month codes (`"M01" - "M12"`) #[allow(clippy::exhaustive_structs)] // this type is stable pub struct Buddhist; -impl_with_abstract_gregorian!( - crate::cal::Buddhist, - BuddhistDateInner, - BuddhistEra, - _x, - BuddhistEra -); +impl crate::cal::scaffold::UnstableSealed for Buddhist {} +impl Calendar for Buddhist { + type DateInner = IsoDateInner; + type Year = types::EraYear; -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub(crate) struct BuddhistEra; - -impl GregorianYears for BuddhistEra { - const EXTENDED_YEAR_OFFSET: i32 = -543; - - fn extended_from_era_year( + fn from_codes( &self, - era: Option<&[u8]>, + era: Option<&str>, year: i32, - ) -> Result { + month_code: types::MonthCode, + day: u8, + ) -> Result { match era { - Some(b"be") | None => Ok(year), - _ => Err(UnknownEraError), + Some("be") | None => {} + _ => return Err(DateError::UnknownEra), } + let year = year - BUDDHIST_ERA_OFFSET; + + ArithmeticDate::new_from_codes(self, year, month_code, day).map(IsoDateInner) + } + + fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner { + iso } - fn era_year_from_extended(&self, extended_year: i32, _month: u8, _day: u8) -> types::EraYear { + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + *date + } + + fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { + Iso.from_rata_die(rd) + } + + fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { + Iso.to_rata_die(date) + } + + fn months_in_year(&self, date: &Self::DateInner) -> u8 { + Iso.months_in_year(date) + } + + fn days_in_year(&self, date: &Self::DateInner) -> u16 { + Iso.days_in_year(date) + } + + fn days_in_month(&self, date: &Self::DateInner) -> u8 { + Iso.days_in_month(date) + } + + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + Iso.offset_date(date, offset.cast_unit()) + } + + #[allow(clippy::field_reassign_with_default)] // it's more clear this way + fn until( + &self, + date1: &Self::DateInner, + date2: &Self::DateInner, + _calendar2: &Self, + largest_unit: DateDurationUnit, + smallest_unit: DateDurationUnit, + ) -> DateDuration { + Iso.until(date1, date2, &Iso, largest_unit, smallest_unit) + .cast_unit() + } + + /// The calendar-specific year represented by `date` + fn year_info(&self, date: &Self::DateInner) -> Self::Year { types::EraYear { era: tinystr!(16, "be"), era_index: Some(0), - year: extended_year, - extended_year, + year: self.extended_year(date), ambiguity: types::YearAmbiguity::CenturyRequired, } } + fn extended_year(&self, date: &Self::DateInner) -> i32 { + Iso.extended_year(date) + BUDDHIST_ERA_OFFSET + } + + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { + Iso.is_in_leap_year(date) + } + + /// The calendar-specific month represented by `date` + fn month(&self, date: &Self::DateInner) -> types::MonthInfo { + Iso.month(date) + } + + /// The calendar-specific day-of-month represented by `date` + fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { + Iso.day_of_month(date) + } + + /// Information of the day of the year + fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { + Iso.day_of_year(date) + } + fn debug_name(&self) -> &'static str { "Buddhist" } - fn calendar_algorithm(&self) -> Option { - Some(CalendarAlgorithm::Buddhist) + fn calendar_algorithm(&self) -> Option { + Some(crate::preferences::CalendarAlgorithm::Buddhist) } } @@ -89,15 +173,13 @@ impl Date { /// assert_eq!(date_buddhist.day_of_month().0, 2); /// ``` pub fn try_new_buddhist(year: i32, month: u8, day: u8) -> Result, RangeError> { - ArithmeticDate::new_gregorian::(year, month, day) - .map(BuddhistDateInner) - .map(|i| Date::from_raw(i, Buddhist)) + Date::try_new_iso(year - BUDDHIST_ERA_OFFSET, month, day) + .map(|d| Date::new_from_iso(d, Buddhist)) } } #[cfg(test)] mod test { - use crate::cal::Iso; use calendrical_calculations::rata_die::RataDie; use super::*; diff --git a/deps/crates/vendor/icu_calendar/src/cal/chinese.rs b/deps/crates/vendor/icu_calendar/src/cal/chinese.rs new file mode 100644 index 00000000000000..43ec385369438a --- /dev/null +++ b/deps/crates/vendor/icu_calendar/src/cal/chinese.rs @@ -0,0 +1,1039 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +//! This module contains types and implementations for the Chinese calendar. +//! +//! ```rust +//! use icu::calendar::{cal::Chinese, Date}; +//! +//! let chinese = Chinese::new(); +//! let chinese_date = Date::try_new_chinese_with_calendar(2023, 6, 6, chinese) +//! .expect("Failed to initialize Chinese Date instance."); +//! +//! assert_eq!(chinese_date.cyclic_year().related_iso, 2023); +//! assert_eq!(chinese_date.cyclic_year().year, 40); +//! assert_eq!(chinese_date.month().ordinal, 6); +//! assert_eq!(chinese_date.day_of_month().0, 6); +//! ``` + +use crate::cal::chinese_based::{ChineseBasedPrecomputedData, ChineseBasedWithDataLoading}; +use crate::cal::iso::{Iso, IsoDateInner}; +use crate::calendar_arithmetic::PrecomputedDataSource; +use crate::calendar_arithmetic::{ArithmeticDate, CalendarArithmetic}; +use crate::error::DateError; +use crate::provider::chinese_based::CalendarChineseV1; +use crate::AsCalendar; +use crate::{types, Calendar, Date, DateDuration, DateDurationUnit}; +use calendrical_calculations::chinese_based; +use calendrical_calculations::rata_die::RataDie; +use core::cmp::Ordering; +use icu_provider::prelude::*; + +/// The [Chinese Calendar](https://en.wikipedia.org/wiki/Chinese_calendar) +/// +/// The Chinese Calendar is a lunisolar calendar used traditionally in China as well as in other +/// countries particularly in, but not limited to, East Asia. It is often used today to track important +/// cultural events and holidays like the Chinese Lunar New Year. +/// +/// This type can be used with [`Date`] to represent dates in the Chinese calendar. +/// +/// # Months +/// +/// The Chinese calendar is an astronomical calendar which uses the phases of the moon to track months. +/// Each month starts on the date of the new moon as observed from China, meaning that months last 29 +/// or 30 days. +/// +/// One year in the Chinese calendar is typically 12 lunar months; however, because 12 lunar months does +/// not line up to one solar year, the Chinese calendar will add an intercalary leap month approximately +/// every three years to keep Chinese calendar months in line with the solar year. +/// +/// Leap months can happen after any month; the month in which a leap month occurs is based on the alignment +/// of months with 24 solar terms into which the solar year is divided. +/// +/// # Year and Era codes +/// +/// Unlike the Gregorian calendar, the Chinese calendar does not traditionally count years in an infinitely +/// increasing sequence. Instead, 10 "celestial stems" and 12 "terrestrial branches" are combined to form a +/// cycle of year names which repeats every 60 years. However, for the purposes of calendar calculations and +/// conversions, this calendar also counts years based on the ISO (Gregorian) calendar. This "related ISO year" +/// marks the ISO year in which a Chinese year begins. +/// +/// Because the Chinese calendar does not traditionally count years, era codes are not used in this calendar. +/// +/// For more information, suggested reading materials include: +/// * _Calendrical Calculations_ by Reingold & Dershowitz +/// * _The Mathematics of the Chinese Calendar_ by Helmer Aslaksen +/// * Wikipedia: +/// +/// # Month codes +/// +/// This calendar is a lunisolar calendar. It supports regular month codes `"M01" - "M12"` as well +/// as leap month codes `"M01L" - "M12L"`. +/// +/// This calendar is currently in a preview state: formatting for this calendar is not +/// going to be perfect. +#[derive(Clone, Debug, Default)] +pub struct Chinese { + data: Option>, +} + +/// The inner date type used for representing [`Date`]s of [`Chinese`]. See [`Date`] and [`Chinese`] for more details. +#[derive(Debug, Eq, PartialEq, PartialOrd, Ord)] +pub struct ChineseDateInner(ArithmeticDate); + +// we want these impls without the `C: Copy/Clone` bounds +impl Copy for ChineseDateInner {} +impl Clone for ChineseDateInner { + fn clone(&self) -> Self { + *self + } +} + +// These impls just make custom derives on types containing C +// work. They're basically no-ops +impl PartialEq for Chinese { + fn eq(&self, _: &Self) -> bool { + true + } +} +impl Eq for Chinese {} +#[allow(clippy::non_canonical_partial_ord_impl)] // this is intentional +impl PartialOrd for Chinese { + fn partial_cmp(&self, _: &Self) -> Option { + Some(Ordering::Equal) + } +} + +impl Ord for Chinese { + fn cmp(&self, _: &Self) -> Ordering { + Ordering::Equal + } +} + +impl Chinese { + /// Creates a new [`Chinese`] with some precomputed calendrical calculations. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [📚 Help choosing a constructor](icu_provider::constructors) + #[cfg(feature = "compiled_data")] + pub const fn new() -> Self { + Self { + data: Some(DataPayload::from_static_ref( + crate::provider::Baked::SINGLETON_CALENDAR_CHINESE_V1, + )), + } + } + + icu_provider::gen_buffer_data_constructors!(() -> error: DataError, + functions: [ + new: skip, + try_new_with_buffer_provider, + try_new_unstable, + Self, + ]); + + #[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new)] + pub fn try_new_unstable + ?Sized>( + provider: &D, + ) -> Result { + Ok(Self { + data: Some(provider.load(Default::default())?.payload), + }) + } + + /// Construct a new [`Chinese`] without any precomputed calendrical calculations. + pub fn new_always_calculating() -> Self { + Chinese { data: None } + } + + pub(crate) const DEBUG_NAME: &'static str = "Chinese"; +} + +impl crate::cal::scaffold::UnstableSealed for Chinese {} +impl Calendar for Chinese { + type DateInner = ChineseDateInner; + type Year = types::CyclicYear; + + // Construct a date from era/month codes and fields + fn from_codes( + &self, + era: Option<&str>, + year: i32, + month_code: types::MonthCode, + day: u8, + ) -> Result { + match era { + None => {} + _ => return Err(DateError::UnknownEra), + } + + let year = self.get_precomputed_data().load_or_compute_info(year); + + let Some(month) = year.parse_month_code(month_code) else { + return Err(DateError::UnknownMonthCode(month_code)); + }; + + year.validate_md(month, day)?; + + Ok(ChineseDateInner(ArithmeticDate::new_unchecked( + year, month, day, + ))) + } + + fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { + let iso = Iso.from_rata_die(rd); + let y = self + .get_precomputed_data() + .load_or_compute_info_for_rd(rd, iso.0); + let (m, d) = y.md_from_rd(rd); + ChineseDateInner(ArithmeticDate::new_unchecked(y, m, d)) + } + + fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { + date.0.year.rd_from_md(date.0.month, date.0.day) + } + + fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner { + let rd = Iso.to_rata_die(&iso); + let y = self + .get_precomputed_data() + .load_or_compute_info_for_rd(rd, iso.0); + let (m, d) = y.md_from_rd(rd); + ChineseDateInner(ArithmeticDate::new_unchecked(y, m, d)) + } + + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + Iso.from_rata_die(self.to_rata_die(date)) + } + + // Count the number of months in a given year, specified by providing a date + // from that year + fn days_in_year(&self, date: &Self::DateInner) -> u16 { + date.0.days_in_year() + } + + fn days_in_month(&self, date: &Self::DateInner) -> u8 { + date.0.days_in_month() + } + + #[doc(hidden)] // unstable + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + date.0.offset_date(offset, &self.get_precomputed_data()); + } + + #[doc(hidden)] // unstable + #[allow(clippy::field_reassign_with_default)] + /// Calculate `date2 - date` as a duration + /// + /// `calendar2` is the calendar object associated with `date2`. In case the specific calendar objects + /// differ on date, the date for the first calendar is used, and `date2` may be converted if necessary. + fn until( + &self, + date1: &Self::DateInner, + date2: &Self::DateInner, + _calendar2: &Self, + _largest_unit: DateDurationUnit, + _smallest_unit: DateDurationUnit, + ) -> DateDuration { + date1.0.until(date2.0, _largest_unit, _smallest_unit) + } + + /// Obtain a name for the calendar for debug printing + fn debug_name(&self) -> &'static str { + Self::DEBUG_NAME + } + + fn year_info(&self, date: &Self::DateInner) -> Self::Year { + let year = date.0.year; + types::CyclicYear { + year: (year.related_iso - 4).rem_euclid(60) as u8 + 1, + related_iso: year.related_iso, + } + } + + fn extended_year(&self, date: &Self::DateInner) -> i32 { + chinese_based::extended_from_iso::(date.0.year.related_iso) + } + + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { + Self::provided_year_is_leap(date.0.year) + } + + /// The calendar-specific month code represented by `date`; + /// since the Chinese calendar has leap months, an "L" is appended to the month code for + /// leap months. For example, in a year where an intercalary month is added after the second + /// month, the month codes for ordinal months 1, 2, 3, 4, 5 would be "M01", "M02", "M02L", "M03", "M04". + fn month(&self, date: &Self::DateInner) -> types::MonthInfo { + date.0.year.month(date.0.month) + } + + /// The calendar-specific day-of-month represented by `date` + fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { + date.0.day_of_month() + } + + /// Information of the day of the year + fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { + types::DayOfYear(date.0.year.day_of_year(date.0.month, date.0.day)) + } + + fn calendar_algorithm(&self) -> Option { + Some(crate::preferences::CalendarAlgorithm::Chinese) + } + + fn months_in_year(&self, date: &Self::DateInner) -> u8 { + date.0.months_in_year() + } +} + +impl> Date { + /// Construct a new Chinese date from a `year`, `month`, and `day`. + /// `year` represents the [ISO](crate::Iso) year that roughly matches the Chinese year; + /// `month` represents the month of the year ordinally (ex. if it is a leap year, the last month will be 13, not 12); + /// `day` indicates the day of month + /// + /// This date will not use any precomputed calendrical calculations, + /// one that loads such data from a provider will be added in the future (#3933) + /// + /// ```rust + /// use icu::calendar::{cal::Chinese, Date}; + /// + /// let chinese = Chinese::new_always_calculating(); + /// + /// let date_chinese = + /// Date::try_new_chinese_with_calendar(2023, 6, 11, chinese) + /// .expect("Failed to initialize Chinese Date instance."); + /// + /// assert_eq!(date_chinese.cyclic_year().related_iso, 2023); + /// assert_eq!(date_chinese.cyclic_year().year, 40); + /// assert_eq!(date_chinese.month().ordinal, 6); + /// assert_eq!(date_chinese.day_of_month().0, 11); + /// ``` + pub fn try_new_chinese_with_calendar( + related_iso_year: i32, + month: u8, + day: u8, + calendar: A, + ) -> Result, DateError> { + let year = calendar + .as_calendar() + .get_precomputed_data() + .load_or_compute_info(related_iso_year); + year.validate_md(month, day)?; + Ok(Date::from_raw( + ChineseDateInner(ArithmeticDate::new_unchecked(year, month, day)), + calendar, + )) + } +} + +type ChineseCB = calendrical_calculations::chinese_based::Chinese; +impl ChineseBasedWithDataLoading for Chinese { + type CB = ChineseCB; + fn get_precomputed_data(&self) -> ChineseBasedPrecomputedData { + ChineseBasedPrecomputedData::new(self.data.as_ref().map(|d| d.get())) + } +} + +#[cfg(test)] +mod test { + use super::*; + use crate::types::MonthCode; + use calendrical_calculations::{iso::fixed_from_iso, rata_die::RataDie}; + use tinystr::tinystr; + + /// Run a test twice, with two calendars + fn do_twice( + chinese_calculating: &Chinese, + chinese_cached: &Chinese, + test: impl Fn(crate::Ref, &'static str), + ) { + test(crate::Ref(chinese_calculating), "calculating"); + test(crate::Ref(chinese_cached), "cached"); + } + + #[test] + fn test_chinese_from_rd() { + #[derive(Debug)] + struct TestCase { + rd: i64, + expected_year: i32, + expected_month: u8, + expected_day: u8, + } + + let cases = [ + TestCase { + rd: -964192, + expected_year: -2, + expected_month: 1, + expected_day: 1, + }, + TestCase { + rd: -963838, + expected_year: -1, + expected_month: 1, + expected_day: 1, + }, + TestCase { + rd: -963129, + expected_year: 0, + expected_month: 13, + expected_day: 1, + }, + TestCase { + rd: -963100, + expected_year: 0, + expected_month: 13, + expected_day: 30, + }, + TestCase { + rd: -963099, + expected_year: 1, + expected_month: 1, + expected_day: 1, + }, + TestCase { + rd: 738700, + expected_year: 4660, + expected_month: 6, + expected_day: 12, + }, + TestCase { + rd: fixed_from_iso(2319, 2, 20).to_i64_date(), + expected_year: 2319 + 2636, + expected_month: 13, + expected_day: 30, + }, + TestCase { + rd: fixed_from_iso(2319, 2, 21).to_i64_date(), + expected_year: 2319 + 2636 + 1, + expected_month: 1, + expected_day: 1, + }, + TestCase { + rd: 738718, + expected_year: 4660, + expected_month: 6, + expected_day: 30, + }, + TestCase { + rd: 738747, + expected_year: 4660, + expected_month: 7, + expected_day: 29, + }, + TestCase { + rd: 738748, + expected_year: 4660, + expected_month: 8, + expected_day: 1, + }, + TestCase { + rd: 738865, + expected_year: 4660, + expected_month: 11, + expected_day: 29, + }, + TestCase { + rd: 738895, + expected_year: 4660, + expected_month: 12, + expected_day: 29, + }, + TestCase { + rd: 738925, + expected_year: 4660, + expected_month: 13, + expected_day: 30, + }, + ]; + + let chinese_calculating = Chinese::new_always_calculating(); + let chinese_cached = Chinese::new(); + for case in cases { + let rata_die = RataDie::new(case.rd); + + do_twice( + &chinese_calculating, + &chinese_cached, + |chinese, calendar_type| { + let chinese = Date::from_rata_die(rata_die, chinese); + assert_eq!( + case.expected_year, + chinese.extended_year(), + "[{calendar_type}] Chinese from RD failed, case: {case:?}" + ); + assert_eq!( + case.expected_month, + chinese.month().ordinal, + "[{calendar_type}] Chinese from RD failed, case: {case:?}" + ); + assert_eq!( + case.expected_day, + chinese.day_of_month().0, + "[{calendar_type}] Chinese from RD failed, case: {case:?}" + ); + }, + ); + } + } + + #[test] + fn test_rd_from_chinese() { + #[derive(Debug)] + struct TestCase { + year: i32, + month: u8, + day: u8, + expected: i64, + } + + let cases = [ + TestCase { + year: 2023, + month: 6, + day: 6, + // June 23 2023 + expected: 738694, + }, + TestCase { + year: -2636, + month: 1, + day: 1, + expected: -963099, + }, + ]; + + let chinese_calculating = Chinese::new_always_calculating(); + let chinese_cached = Chinese::new(); + for case in cases { + do_twice( + &chinese_calculating, + &chinese_cached, + |chinese, calendar_type| { + let date = Date::try_new_chinese_with_calendar( + case.year, case.month, case.day, chinese, + ) + .unwrap(); + let rd = date.to_rata_die().to_i64_date(); + let expected = case.expected; + assert_eq!(rd, expected, "[{calendar_type}] RD from Chinese failed, with expected: {expected} and calculated: {rd}, for test case: {case:?}"); + }, + ); + } + } + + #[test] + fn test_rd_chinese_roundtrip() { + let mut rd = -1963020; + let max_rd = 1963020; + let mut iters = 0; + let max_iters = 560; + let chinese_calculating = Chinese::new_always_calculating(); + let chinese_cached = Chinese::new(); + while rd < max_rd && iters < max_iters { + let rata_die = RataDie::new(rd); + + do_twice( + &chinese_calculating, + &chinese_cached, + |chinese, calendar_type| { + let chinese = Date::from_rata_die(rata_die, chinese); + let result = chinese.to_rata_die(); + assert_eq!(result, rata_die, "[{calendar_type}] Failed roundtrip RD -> Chinese -> RD for RD: {rata_die:?}, with calculated: {result:?} from Chinese date:\n{chinese:?}"); + }, + ); + rd += 7043; + iters += 1; + } + } + + #[test] + fn test_chinese_epoch() { + let iso = Date::try_new_iso(-2636, 2, 15).unwrap(); + + do_twice( + &Chinese::new_always_calculating(), + &Chinese::new(), + |chinese, _calendar_type| { + let chinese = iso.to_calendar(chinese); + + assert_eq!(chinese.cyclic_year().related_iso, -2636); + assert_eq!(chinese.month().ordinal, 1); + assert_eq!(chinese.month().standard_code.0, "M01"); + assert_eq!(chinese.day_of_month().0, 1); + assert_eq!(chinese.cyclic_year().year, 1); + assert_eq!(chinese.cyclic_year().related_iso, -2636); + }, + ) + } + + #[test] + fn test_iso_to_chinese_negative_years() { + #[derive(Debug)] + struct TestCase { + iso_year: i32, + iso_month: u8, + iso_day: u8, + expected_year: i32, + expected_month: u8, + expected_day: u8, + } + + let cases = [ + TestCase { + iso_year: -2636, + iso_month: 2, + iso_day: 14, + expected_year: -2637, + expected_month: 13, + expected_day: 30, + }, + TestCase { + iso_year: -2636, + iso_month: 1, + iso_day: 15, + expected_year: -2637, + expected_month: 12, + expected_day: 30, + }, + ]; + + let chinese_calculating = Chinese::new_always_calculating(); + let chinese_cached = Chinese::new(); + + for case in cases { + let iso = Date::try_new_iso(case.iso_year, case.iso_month, case.iso_day).unwrap(); + do_twice( + &chinese_calculating, + &chinese_cached, + |chinese, calendar_type| { + let chinese = iso.to_calendar(chinese); + assert_eq!( + case.expected_year, + chinese.cyclic_year().related_iso, + "[{calendar_type}] ISO to Chinese failed for case: {case:?}" + ); + assert_eq!( + case.expected_month, + chinese.month().ordinal, + "[{calendar_type}] ISO to Chinese failed for case: {case:?}" + ); + assert_eq!( + case.expected_day, + chinese.day_of_month().0, + "[{calendar_type}] ISO to Chinese failed for case: {case:?}" + ); + }, + ); + } + } + + #[test] + fn test_chinese_leap_months() { + let expected = [ + (1933, 6), + (1938, 8), + (1984, 11), + (2009, 6), + (2017, 7), + (2028, 6), + ]; + let chinese_calculating = Chinese::new_always_calculating(); + let chinese_cached = Chinese::new(); + + for case in expected { + let year = case.0; + let expected_month = case.1; + let iso = Date::try_new_iso(year, 6, 1).unwrap(); + do_twice( + &chinese_calculating, + &chinese_cached, + |chinese, calendar_type| { + let chinese_date = iso.to_calendar(chinese); + assert!( + chinese_date.is_in_leap_year(), + "[{calendar_type}] {year} should be a leap year" + ); + let new_year = chinese_date.inner.0.year.new_year(); + assert_eq!( + expected_month, + calendrical_calculations::chinese_based::get_leap_month_from_new_year::< + calendrical_calculations::chinese_based::Chinese, + >(new_year), + "[{calendar_type}] {year} have leap month {expected_month}" + ); + }, + ); + } + } + + #[test] + fn test_month_days() { + let year = + ChineseBasedPrecomputedData::<::CB>::default() + .load_or_compute_info(2023); + let cases = [ + (1, 29), + (2, 30), + (3, 29), + (4, 29), + (5, 30), + (6, 30), + (7, 29), + (8, 30), + (9, 30), + (10, 29), + (11, 30), + (12, 29), + (13, 30), + ]; + for case in cases { + let days_in_month = Chinese::days_in_provided_month(year, case.0); + assert_eq!( + case.1, days_in_month, + "month_days test failed for case: {case:?}" + ); + } + } + + #[test] + fn test_ordinal_to_month_code() { + #[derive(Debug)] + struct TestCase { + year: i32, + month: u8, + day: u8, + expected_code: &'static str, + } + + let cases = [ + TestCase { + year: 2023, + month: 1, + day: 9, + expected_code: "M12", + }, + TestCase { + year: 2023, + month: 2, + day: 9, + expected_code: "M01", + }, + TestCase { + year: 2023, + month: 3, + day: 9, + expected_code: "M02", + }, + TestCase { + year: 2023, + month: 4, + day: 9, + expected_code: "M02L", + }, + TestCase { + year: 2023, + month: 5, + day: 9, + expected_code: "M03", + }, + TestCase { + year: 2023, + month: 6, + day: 9, + expected_code: "M04", + }, + TestCase { + year: 2023, + month: 7, + day: 9, + expected_code: "M05", + }, + TestCase { + year: 2023, + month: 8, + day: 9, + expected_code: "M06", + }, + TestCase { + year: 2023, + month: 9, + day: 9, + expected_code: "M07", + }, + TestCase { + year: 2023, + month: 10, + day: 9, + expected_code: "M08", + }, + TestCase { + year: 2023, + month: 11, + day: 9, + expected_code: "M09", + }, + TestCase { + year: 2023, + month: 12, + day: 9, + expected_code: "M10", + }, + TestCase { + year: 2024, + month: 1, + day: 9, + expected_code: "M11", + }, + TestCase { + year: 2024, + month: 2, + day: 9, + expected_code: "M12", + }, + TestCase { + year: 2024, + month: 2, + day: 10, + expected_code: "M01", + }, + ]; + + let chinese_calculating = Chinese::new_always_calculating(); + let chinese_cached = Chinese::new(); + + for case in cases { + let iso = Date::try_new_iso(case.year, case.month, case.day).unwrap(); + do_twice( + &chinese_calculating, + &chinese_cached, + |chinese, calendar_type| { + let chinese = iso.to_calendar(chinese); + let result_code = chinese.month().standard_code.0; + let expected_code = case.expected_code.to_string(); + assert_eq!( + expected_code, result_code, + "[{calendar_type}] Month codes did not match for test case: {case:?}" + ); + }, + ); + } + } + + #[test] + fn test_month_code_to_ordinal() { + // construct using ::default() to force recomputation + let year = + ChineseBasedPrecomputedData::<::CB>::default() + .load_or_compute_info(2023); + let codes = [ + (1, tinystr!(4, "M01")), + (2, tinystr!(4, "M02")), + (3, tinystr!(4, "M02L")), + (4, tinystr!(4, "M03")), + (5, tinystr!(4, "M04")), + (6, tinystr!(4, "M05")), + (7, tinystr!(4, "M06")), + (8, tinystr!(4, "M07")), + (9, tinystr!(4, "M08")), + (10, tinystr!(4, "M09")), + (11, tinystr!(4, "M10")), + (12, tinystr!(4, "M11")), + (13, tinystr!(4, "M12")), + ]; + for ordinal_code_pair in codes { + let code = MonthCode(ordinal_code_pair.1); + let ordinal = year.parse_month_code(code); + assert_eq!( + ordinal, + Some(ordinal_code_pair.0), + "Code to ordinal failed for year: {}, code: {code}", + year.related_iso + ); + } + } + + #[test] + fn check_invalid_month_code_to_ordinal() { + let non_leap_year = 4659; + let leap_year = 4660; + let invalid_codes = [ + (non_leap_year, tinystr!(4, "M2")), + (leap_year, tinystr!(4, "M0")), + (non_leap_year, tinystr!(4, "J01")), + (leap_year, tinystr!(4, "3M")), + (non_leap_year, tinystr!(4, "M04L")), + (leap_year, tinystr!(4, "M04L")), + (non_leap_year, tinystr!(4, "M13")), + (leap_year, tinystr!(4, "M13")), + ]; + for (year, code) in invalid_codes { + // construct using ::default() to force recomputation + let year = ChineseBasedPrecomputedData::< + ::CB, + >::default() + .load_or_compute_info(year); + let code = MonthCode(code); + let ordinal = year.parse_month_code(code); + assert_eq!( + ordinal, None, + "Invalid month code failed for year: {}, code: {code}", + year.related_iso + ); + } + } + + #[test] + fn test_iso_chinese_roundtrip() { + let chinese_calculating = Chinese::new_always_calculating(); + let chinese_cached = Chinese::new(); + + for i in -1000..=1000 { + let year = i; + let month = i as u8 % 12 + 1; + let day = i as u8 % 28 + 1; + let iso = Date::try_new_iso(year, month, day).unwrap(); + do_twice( + &chinese_calculating, + &chinese_cached, + |chinese, calendar_type| { + let chinese = iso.to_calendar(chinese); + let result = chinese.to_calendar(Iso); + assert_eq!(iso, result, "[{calendar_type}] ISO to Chinese roundtrip failed!\nIso: {iso:?}\nChinese: {chinese:?}\nResult: {result:?}"); + }, + ); + } + } + + #[test] + fn test_consistent_with_icu() { + #[derive(Debug)] + struct TestCase { + iso_year: i32, + iso_month: u8, + iso_day: u8, + expected_rel_iso: i32, + expected_cyclic: u8, + expected_month: u8, + expected_day: u8, + } + + let cases = [ + TestCase { + iso_year: -2332, + iso_month: 3, + iso_day: 1, + expected_rel_iso: -2332, + expected_cyclic: 5, + expected_month: 1, + expected_day: 16, + }, + TestCase { + iso_year: -2332, + iso_month: 2, + iso_day: 15, + expected_rel_iso: -2332, + expected_cyclic: 5, + expected_month: 1, + expected_day: 1, + }, + TestCase { + // This test case fails to match ICU + iso_year: -2332, + iso_month: 2, + iso_day: 14, + expected_rel_iso: -2333, + expected_cyclic: 4, + expected_month: 13, + expected_day: 30, + }, + TestCase { + // This test case fails to match ICU + iso_year: -2332, + iso_month: 1, + iso_day: 17, + expected_rel_iso: -2333, + expected_cyclic: 4, + expected_month: 13, + expected_day: 2, + }, + TestCase { + // This test case fails to match ICU + iso_year: -2332, + iso_month: 1, + iso_day: 16, + expected_rel_iso: -2333, + expected_cyclic: 4, + expected_month: 13, + expected_day: 1, + }, + TestCase { + iso_year: -2332, + iso_month: 1, + iso_day: 15, + expected_rel_iso: -2333, + expected_cyclic: 4, + expected_month: 12, + expected_day: 29, + }, + TestCase { + iso_year: -2332, + iso_month: 1, + iso_day: 1, + expected_rel_iso: -2333, + expected_cyclic: 4, + expected_month: 12, + expected_day: 15, + }, + TestCase { + iso_year: -2333, + iso_month: 1, + iso_day: 16, + expected_rel_iso: -2334, + expected_cyclic: 3, + expected_month: 12, + expected_day: 19, + }, + ]; + + let chinese_calculating = Chinese::new_always_calculating(); + let chinese_cached = Chinese::new(); + + for case in cases { + let iso = Date::try_new_iso(case.iso_year, case.iso_month, case.iso_day).unwrap(); + + do_twice( + &chinese_calculating, + &chinese_cached, + |chinese, calendar_type| { + let chinese = iso.to_calendar(chinese); + let chinese_rel_iso = chinese.cyclic_year().related_iso; + let chinese_cyclic = chinese.cyclic_year().year; + let chinese_month = chinese.month().ordinal; + let chinese_day = chinese.day_of_month().0; + + assert_eq!( + chinese_rel_iso, case.expected_rel_iso, + "[{calendar_type}] Related ISO failed for test case: {case:?}" + ); + assert_eq!( + chinese_cyclic, case.expected_cyclic, + "[{calendar_type}] Cyclic year failed for test case: {case:?}" + ); + assert_eq!( + chinese_month, case.expected_month, + "[{calendar_type}] Month failed for test case: {case:?}" + ); + assert_eq!( + chinese_day, case.expected_day, + "[{calendar_type}] Day failed for test case: {case:?}" + ); + }, + ); + } + } +} diff --git a/deps/crates/vendor/icu_calendar/src/cal/chinese_based.rs b/deps/crates/vendor/icu_calendar/src/cal/chinese_based.rs new file mode 100644 index 00000000000000..08ca5c81620104 --- /dev/null +++ b/deps/crates/vendor/icu_calendar/src/cal/chinese_based.rs @@ -0,0 +1,446 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +//! This module contains types and traits for use in the Chinese traditional lunar calendar, +//! as well as in related and derived calendars such as the Korean and Vietnamese lunar calendars. + +use crate::{ + calendar_arithmetic::{ArithmeticDate, CalendarArithmetic, PrecomputedDataSource}, + error::DateError, + provider::chinese_based::{ChineseBasedCache, PackedChineseBasedYearInfo}, + types::{MonthCode, MonthInfo}, + Calendar, Iso, +}; + +use calendrical_calculations::chinese_based::{self, ChineseBased, YearBounds}; +use calendrical_calculations::rata_die::RataDie; +use core::marker::PhantomData; +use tinystr::tinystr; + +/// The trait ChineseBased is used by Chinese-based calendars to perform computations shared by such calendar. +/// +/// For an example of how to use this trait, see `impl ChineseBasedWithDataLoading for Chinese` in [`Chinese`]. +pub(crate) trait ChineseBasedWithDataLoading: Calendar { + type CB: ChineseBased; + /// Get the compiled const data for a ChineseBased calendar; can return `None` if the given year + /// does not correspond to any compiled data. + fn get_precomputed_data(&self) -> ChineseBasedPrecomputedData<'_, Self::CB>; +} + +/// Contains any loaded precomputed data. If constructed with Default, will +/// *not* contain any extra data and will always compute stuff from scratch +#[derive(Default)] +pub(crate) struct ChineseBasedPrecomputedData<'a, CB: ChineseBased> { + data: Option<&'a ChineseBasedCache<'a>>, + _cb: PhantomData, +} + +impl PrecomputedDataSource + for ChineseBasedPrecomputedData<'_, CB> +{ + fn load_or_compute_info(&self, related_iso: i32) -> ChineseBasedYearInfo { + self.data + .and_then(|d| { + Some(ChineseBasedYearInfo { + packed_data: d + .data + .get(usize::try_from(related_iso - d.first_related_iso_year).ok()?)?, + related_iso, + }) + }) + .unwrap_or_else(|| ChineseBasedYearInfo::compute::(related_iso)) + } +} + +impl<'b, CB: ChineseBased> ChineseBasedPrecomputedData<'b, CB> { + pub(crate) fn new(data: Option<&'b ChineseBasedCache<'b>>) -> Self { + Self { + data, + _cb: PhantomData, + } + } + + /// Given an ISO date (in both ArithmeticDate and R.D. format), returns the ChineseBasedYearInfo and extended year for that date, loading + /// from cache or computing. + pub(crate) fn load_or_compute_info_for_rd( + &self, + rd: RataDie, + iso: ArithmeticDate, + ) -> ChineseBasedYearInfo { + if let Some(cached) = self.data.and_then(|d| { + let delta = usize::try_from(iso.year - d.first_related_iso_year).ok()?; + if delta == 0 { + return None; + } + + let packed_data = d.data.get(delta)?; + if iso.day_of_year().0 > packed_data.ny_offset() as u16 { + Some(ChineseBasedYearInfo { + packed_data, + related_iso: iso.year, + }) + } else { + // We're dealing with an ISO day in the beginning of the year, before Chinese New Year. + // Return data for the previous Chinese year instead. + if delta <= 1 { + return None; + } + Some(ChineseBasedYearInfo { + packed_data: d.data.get(delta - 1)?, + related_iso: iso.year - 1, + }) + } + }) { + return cached; + }; + // compute + + let mid_year = calendrical_calculations::iso::fixed_from_iso(iso.year, 7, 1); + let year_bounds = YearBounds::compute::(mid_year); + let YearBounds { new_year, .. } = year_bounds; + if rd >= new_year { + ChineseBasedYearInfo::compute_with_yb::(iso.year, year_bounds) + } else { + ChineseBasedYearInfo::compute::(iso.year - 1) + } + } +} + +/// A data struct used to load and use information for a set of ChineseBasedDates +#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] +// TODO(#3933): potentially make this smaller +pub(crate) struct ChineseBasedYearInfo { + /// Contains: + /// - length of each month in the year + /// - whether or not there is a leap month, and which month it is + /// - the date of Chinese New Year in the related ISO year + packed_data: PackedChineseBasedYearInfo, + pub(crate) related_iso: i32, +} + +impl From for i32 { + fn from(value: ChineseBasedYearInfo) -> Self { + value.related_iso + } +} + +impl ChineseBasedYearInfo { + /// Compute ChineseBasedYearInfo for a given extended year + fn compute(related_iso: i32) -> Self { + let mid_year = calendrical_calculations::iso::fixed_from_iso(related_iso, 7, 1); + let year_bounds = YearBounds::compute::(mid_year); + Self::compute_with_yb::(related_iso, year_bounds) + } + + /// Compute ChineseBasedYearInfo for a given extended year, for which you have already computed the YearBounds + fn compute_with_yb(related_iso: i32, year_bounds: YearBounds) -> Self { + let YearBounds { + new_year, + next_new_year, + .. + } = year_bounds; + let (month_lengths, leap_month) = + chinese_based::month_structure_for_year::(new_year, next_new_year); + + let ny_offset = new_year - calendrical_calculations::iso::fixed_from_iso(related_iso, 1, 1); + Self { + packed_data: PackedChineseBasedYearInfo::new(month_lengths, leap_month, ny_offset), + related_iso, + } + } + + /// Get the new year R.D. + pub(crate) fn new_year(self) -> RataDie { + calendrical_calculations::iso::fixed_from_iso(self.related_iso, 1, 1) + + self.packed_data.ny_offset() as i64 + } + + /// Get the next new year R.D. + fn next_new_year(self) -> RataDie { + self.new_year() + i64::from(self.days_in_year()) + } + + /// Get which month is the leap month. This produces the month *number* + /// that is the leap month (not the ordinal month). In other words, for + /// a year with an M05L, this will return Some(5). Note that the regular month precedes + /// the leap month. + fn leap_month(self) -> Option { + self.packed_data.leap_month() + } + + /// The last day of year in the previous month. + /// `month` is 1-indexed, and the returned value is also + /// a 1-indexed day of year + /// + /// Will be zero for the first month as the last day of the previous month + /// is not in this year + fn last_day_of_previous_month(self, month: u8) -> u16 { + debug_assert!((1..=13).contains(&month), "Month out of bounds!"); + // Get the last day of the previous month. + // Since `month` is 1-indexed, this needs to check if the month is 1 for the zero case + if month == 1 { + 0 + } else { + self.packed_data.last_day_of_month(month - 1) + } + } + + fn days_in_year(self) -> u16 { + self.last_day_of_month(self.months_in_year()) + } + + /// Return the number of months in a given year, which is 13 in a leap year, and 12 in a common year. + fn months_in_year(self) -> u8 { + if self.leap_month().is_some() { + 13 + } else { + 12 + } + } + + /// The last day of year in the current month. + /// `month` is 1-indexed, and the returned value is also + /// a 1-indexed day of year + /// + /// Will be zero for the first month as the last day of the previous month + /// is not in this year + fn last_day_of_month(self, month: u8) -> u16 { + debug_assert!((1..=13).contains(&month), "Month out of bounds!"); + self.packed_data.last_day_of_month(month) + } + + fn days_in_month(self, month: u8) -> u8 { + if self.packed_data.month_has_30_days(month) { + 30 + } else { + 29 + } + } + + pub(crate) fn md_from_rd(self, rd: RataDie) -> (u8, u8) { + debug_assert!( + rd < self.next_new_year(), + "Stored date {rd:?} out of bounds!" + ); + // 1-indexed day of year + let day_of_year = u16::try_from(rd - self.new_year() + 1); + debug_assert!(day_of_year.is_ok(), "Somehow got a very large year in data"); + let day_of_year = day_of_year.unwrap_or(1); + let mut month = 1; + // TODO(#3933) perhaps use a binary search + for iter_month in 1..=13 { + month = iter_month; + if self.last_day_of_month(iter_month) >= day_of_year { + break; + } + } + + debug_assert!((1..=13).contains(&month), "Month out of bounds!"); + + debug_assert!( + month < 13 || self.leap_month().is_some(), + "Cannot have 13 months in a non-leap year!" + ); + let day_before_month_start = self.last_day_of_previous_month(month); + let day_of_month = day_of_year - day_before_month_start; + let day_of_month = u8::try_from(day_of_month); + debug_assert!(day_of_month.is_ok(), "Month too big!"); + let day_of_month = day_of_month.unwrap_or(1); + + (month, day_of_month) + } + + pub(crate) fn rd_from_md(self, month: u8, day: u8) -> RataDie { + self.new_year() + self.day_of_year(month, day) as i64 - 1 + } + + /// Calculate the number of days in the year so far for a ChineseBasedDate; + /// similar to `CalendarArithmetic::day_of_year` + pub(crate) fn day_of_year(self, month: u8, day: u8) -> u16 { + self.last_day_of_previous_month(month) + day as u16 + } + + /// The calendar-specific month code represented by `month`; + /// since the Chinese calendar has leap months, an "L" is appended to the month code for + /// leap months. For example, in a year where an intercalary month is added after the second + /// month, the month codes for ordinal months 1, 2, 3, 4, 5 would be "M01", "M02", "M02L", "M03", "M04". + pub(crate) fn month(self, month: u8) -> MonthInfo { + // 1 indexed leap month name. This is also the ordinal for the leap month + // in the year (e.g. in `M01, M01L, M02, ..`, the leap month is for month 1, and it is also + // ordinally `month 2`, zero-indexed) + // 14 is a sentinel value + let leap_month = self.leap_month().unwrap_or(14); + let code_inner = if leap_month == month { + // Month cannot be 1 because a year cannot have a leap month before the first actual month, + // and the maximum num of months ina leap year is 13. + debug_assert!((2..=13).contains(&month)); + match month { + 2 => tinystr!(4, "M01L"), + 3 => tinystr!(4, "M02L"), + 4 => tinystr!(4, "M03L"), + 5 => tinystr!(4, "M04L"), + 6 => tinystr!(4, "M05L"), + 7 => tinystr!(4, "M06L"), + 8 => tinystr!(4, "M07L"), + 9 => tinystr!(4, "M08L"), + 10 => tinystr!(4, "M09L"), + 11 => tinystr!(4, "M10L"), + 12 => tinystr!(4, "M11L"), + 13 => tinystr!(4, "M12L"), + _ => tinystr!(4, "und"), + } + } else { + let mut adjusted_ordinal = month; + if month > leap_month { + // Before adjusting for leap month, if ordinal > leap_month, + // the month cannot be 1 because this implies the leap month is < 1, which is impossible; + // cannot be 2 because that implies the leap month is = 1, which is impossible, + // and cannot be more than 13 because max number of months in a year is 13. + debug_assert!((2..=13).contains(&month)); + adjusted_ordinal -= 1; + } + debug_assert!((1..=12).contains(&adjusted_ordinal)); + match adjusted_ordinal { + 1 => tinystr!(4, "M01"), + 2 => tinystr!(4, "M02"), + 3 => tinystr!(4, "M03"), + 4 => tinystr!(4, "M04"), + 5 => tinystr!(4, "M05"), + 6 => tinystr!(4, "M06"), + 7 => tinystr!(4, "M07"), + 8 => tinystr!(4, "M08"), + 9 => tinystr!(4, "M09"), + 10 => tinystr!(4, "M10"), + 11 => tinystr!(4, "M11"), + 12 => tinystr!(4, "M12"), + _ => tinystr!(4, "und"), + } + }; + let code = MonthCode(code_inner); + MonthInfo { + ordinal: month, + standard_code: code, + formatting_code: code, + } + } + + /// Create a new arithmetic date from a year, month ordinal, and day with bounds checking; returns the + /// result of creating this arithmetic date, as well as a ChineseBasedYearInfo - either the one passed in + /// optionally as an argument, or a new ChineseBasedYearInfo for the given year, month, and day args. + pub(crate) fn validate_md(self, month: u8, day: u8) -> Result<(), DateError> { + let max_month = self.months_in_year(); + if month == 0 || !(1..=max_month).contains(&month) { + return Err(DateError::Range { + field: "month", + value: month as i32, + min: 1, + max: max_month as i32, + }); + } + + let max_day = self.days_in_month(month); + if day == 0 || day > max_day { + return Err(DateError::Range { + field: "day", + value: day as i32, + min: 1, + max: max_day as i32, + }); + } + Ok(()) + } + + /// Get the ordinal lunar month from a code for chinese-based calendars. + pub(crate) fn parse_month_code(self, code: MonthCode) -> Option { + // 14 is a sentinel value, greater than all other months, for the purpose of computation only; + // it is impossible to actually have 14 months in a year. + let leap_month = self.leap_month().unwrap_or(14); + + if code.0.len() < 3 { + return None; + } + let bytes = code.0.all_bytes(); + if bytes[0] != b'M' { + return None; + } + if code.0.len() == 4 && bytes[3] != b'L' { + return None; + } + // Unadjusted is zero-indexed month index, must add one to it to use + let mut unadjusted = 0; + if bytes[1] == b'0' { + if bytes[2] >= b'1' && bytes[2] <= b'9' { + unadjusted = bytes[2] - b'0'; + } + } else if bytes[1] == b'1' && bytes[2] >= b'0' && bytes[2] <= b'2' { + unadjusted = 10 + bytes[2] - b'0'; + } + if bytes[3] == b'L' { + // Asked for a leap month that doesn't exist + if unadjusted + 1 != leap_month { + return None; + } else { + // The leap month occurs after the regular month of the same name + return Some(unadjusted + 1); + } + } + if unadjusted != 0 { + // If the month has an index greater than that of the leap month, + // bump it up by one + if unadjusted + 1 > leap_month { + return Some(unadjusted + 1); + } else { + return Some(unadjusted); + } + } + None + } +} + +impl CalendarArithmetic for C { + type YearInfo = ChineseBasedYearInfo; + + fn days_in_provided_month(year: ChineseBasedYearInfo, month: u8) -> u8 { + year.days_in_month(month) + } + + /// Returns the number of months in a given year, which is 13 in a leap year, and 12 in a common year. + fn months_in_provided_year(year: ChineseBasedYearInfo) -> u8 { + year.months_in_year() + } + + /// Returns true if the given year is a leap year, and false if not. + fn provided_year_is_leap(year: ChineseBasedYearInfo) -> bool { + year.leap_month().is_some() + } + + /// Returns the (month, day) of the last day in a Chinese year (the day before Chinese New Year). + /// The last month in a year will always be 12 in a common year or 13 in a leap year. The day is + /// determined by finding the day immediately before the next new year and calculating the number + /// of days since the last new moon (beginning of the last month in the year). + fn last_month_day_in_provided_year(year: ChineseBasedYearInfo) -> (u8, u8) { + if year.leap_month().is_some() { + (13, year.days_in_month(13)) + } else { + (12, year.days_in_month(12)) + } + } + + fn days_in_provided_year(year: ChineseBasedYearInfo) -> u16 { + year.days_in_year() + } +} + +#[cfg(feature = "datagen")] +impl ChineseBasedCache<'_> { + /// Compute this data for a range of years + pub fn compute_for(related_isos: core::ops::Range) -> Self { + ChineseBasedCache { + first_related_iso_year: related_isos.start, + data: related_isos + .map(|related_iso| ChineseBasedYearInfo::compute::(related_iso).packed_data) + .collect(), + } + } +} diff --git a/deps/crates/vendor/icu_calendar/src/cal/coptic.rs b/deps/crates/vendor/icu_calendar/src/cal/coptic.rs index 3878168f9c9b4b..4eb8bd7f148909 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/coptic.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/coptic.rs @@ -2,49 +2,46 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::calendar_arithmetic::ArithmeticDate; -use crate::calendar_arithmetic::DateFieldsResolver; -use crate::error::{ - DateError, DateFromFieldsError, EcmaReferenceYearError, MonthCodeError, UnknownEraError, -}; -use crate::options::DateFromFieldsOptions; -use crate::options::{DateAddOptions, DateDifferenceOptions}; -use crate::{types, Calendar, Date, RangeError}; +//! This module contains types and implementations for the Coptic calendar. +//! +//! ```rust +//! use icu::calendar::{cal::Coptic, Date}; +//! +//! let date_iso = Date::try_new_iso(1970, 1, 2) +//! .expect("Failed to initialize ISO Date instance."); +//! let date_coptic = Date::new_from_iso(date_iso, Coptic); +//! +//! assert_eq!(date_coptic.era_year().year, 1686); +//! assert_eq!(date_coptic.month().ordinal, 4); +//! assert_eq!(date_coptic.day_of_month().0, 24); +//! ``` + +use crate::cal::iso::{Iso, IsoDateInner}; +use crate::calendar_arithmetic::{ArithmeticDate, CalendarArithmetic}; +use crate::error::DateError; +use crate::{types, Calendar, Date, DateDuration, DateDurationUnit, RangeError}; use calendrical_calculations::helpers::I32CastError; use calendrical_calculations::rata_die::RataDie; use tinystr::tinystr; -/// The [Coptic Calendar](https://en.wikipedia.org/wiki/Coptic_calendar) +/// The [Coptic Calendar] /// -/// The Coptic calendar, also called the Alexandrian Calendar, is a solar calendar that -/// is influenced by both the ancient Egpytian calendar and the [`Julian`](crate::cal::Julian) -/// calendar. It was introduced in Egypt under Roman rule in the first century BCE, and -/// replaced for civil use in 1875, however continues to be used liturgically. +/// The [Coptic calendar] is a solar calendar used by the Coptic Orthodox Church, with twelve normal months +/// and a thirteenth small epagomenal month. /// -/// This implementation extends proleptically for dates before the calendar's creation. +/// This type can be used with [`Date`] to represent dates in this calendar. /// -/// This corresponds to the `"coptic"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). +/// [Coptic calendar]: https://en.wikipedia.org/wiki/Coptic_calendar /// /// # Era codes /// /// This calendar uses a single code: `am`, corresponding to the After Diocletian/Anno Martyrum /// era. 1 A.M. is equivalent to 284 C.E. /// -/// # Months and days +/// # Month codes /// -/// The 13 months are called Thout (`M01`, 30 days), Paopi (`M02`, 30 days), Hathor (`M03`, 30 days), -/// Koiak (`M04`, 30 days), Tobi (`M05`, 30 days), Meshir (`M06`, 30 days), Paremhat (`M07`, 30 days), -/// Parmouti (`M08`, 30 days), Pashons (`M09`, 30 days), Paoni (`M10`, 30 days), Epip (`M11`, 30 days), -/// Mesori (`M12`, 30 days), Pi Kogi Enavot (`M13`, 5 days). -/// -/// In leap years (years divisible by 4), Pi Kogi Enavot gains a 6th day. -/// -/// Standard years thus have 365 days, and leap years 366. -/// -/// # Calendar drift -/// -/// The Coptic calendar has the same year lengths and leap year rules as the Julian calendar, -/// so it experiences the same drift of 1 day in ~128 years with respect to the seasons. +/// This calendar supports 13 solar month codes (`"M01" - "M13"`), with `"M13"` being used for the short epagomenal month +/// at the end of the year. #[derive(Copy, Clone, Debug, Hash, Default, Eq, PartialEq, PartialOrd, Ord)] #[allow(clippy::exhaustive_structs)] // this type is stable pub struct Coptic; @@ -53,14 +50,14 @@ pub struct Coptic; #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] pub struct CopticDateInner(pub(crate) ArithmeticDate); -impl DateFieldsResolver for Coptic { +impl CalendarArithmetic for Coptic { type YearInfo = i32; fn days_in_provided_month(year: i32, month: u8) -> u8 { if (1..=12).contains(&month) { 30 } else if month == 13 { - if year.rem_euclid(4) == 3 { + if Self::provided_year_is_leap(year) { 6 } else { 5 @@ -73,66 +70,25 @@ impl DateFieldsResolver for Coptic { fn months_in_provided_year(_: i32) -> u8 { 13 } - #[inline] - fn year_info_from_era( - &self, - era: &[u8], - era_year: i32, - ) -> Result { - match era { - b"am" => Ok(era_year), - _ => Err(UnknownEraError), - } - } - - #[inline] - fn year_info_from_extended(&self, extended_year: i32) -> Self::YearInfo { - extended_year - } - #[inline] - fn reference_year_from_month_day( - &self, - month_code: types::ValidMonthCode, - day: u8, - ) -> Result { - Coptic::reference_year_from_month_day(month_code, day) + fn provided_year_is_leap(year: i32) -> bool { + year.rem_euclid(4) == 3 } - #[inline] - fn ordinal_month_from_code( - &self, - _year: &Self::YearInfo, - month_code: types::ValidMonthCode, - _options: DateFromFieldsOptions, - ) -> Result { - match month_code.to_tuple() { - (month_number @ 1..=13, false) => Ok(month_number), - _ => Err(MonthCodeError::NotInCalendar), + fn last_month_day_in_provided_year(year: i32) -> (u8, u8) { + if Self::provided_year_is_leap(year) { + (13, 6) + } else { + (13, 5) } } -} -impl Coptic { - pub(crate) fn reference_year_from_month_day( - month_code: types::ValidMonthCode, - day: u8, - ) -> Result { - let (ordinal_month, false) = month_code.to_tuple() else { - return Err(EcmaReferenceYearError::MonthCodeNotInCalendar); - }; - // December 31, 1972 occurs on 4th month, 22nd day, 1689 AM - let anno_martyrum_year = if ordinal_month < 4 || (ordinal_month == 4 && day <= 22) { - 1689 - // Note: this must be >=6, not just == 6, since we have not yet - // applied a potential Overflow::Constrain. - } else if ordinal_month == 13 && day >= 6 { - // 1687 AM is a leap year - 1687 + fn days_in_provided_year(year: i32) -> u16 { + if Self::provided_year_is_leap(year) { + 366 } else { - 1688 - }; - Ok(anno_martyrum_year) + 365 + } } } @@ -140,8 +96,6 @@ impl crate::cal::scaffold::UnstableSealed for Coptic {} impl Calendar for Coptic { type DateInner = CopticDateInner; type Year = types::EraYear; - type DifferenceError = core::convert::Infallible; - fn from_codes( &self, era: Option<&str>, @@ -149,23 +103,19 @@ impl Calendar for Coptic { month_code: types::MonthCode, day: u8, ) -> Result { - ArithmeticDate::from_codes(era, year, month_code, day, self).map(CopticDateInner) - } + let year = match era { + Some("am") | None => year, + Some(_) => return Err(DateError::UnknownEra), + }; - #[cfg(feature = "unstable")] - fn from_fields( - &self, - fields: types::DateFields, - options: DateFromFieldsOptions, - ) -> Result { - ArithmeticDate::from_fields(fields, options, self).map(CopticDateInner) + ArithmeticDate::new_from_codes(self, year, month_code, day).map(CopticDateInner) } fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { CopticDateInner( match calendrical_calculations::coptic::coptic_from_fixed(rd) { - Err(I32CastError::BelowMin) => ArithmeticDate::new_unchecked(i32::MIN, 1, 1), - Err(I32CastError::AboveMax) => ArithmeticDate::new_unchecked(i32::MAX, 13, 6), + Err(I32CastError::BelowMin) => ArithmeticDate::min_date(), + Err(I32CastError::AboveMax) => ArithmeticDate::max_date(), Ok((year, month, day)) => ArithmeticDate::new_unchecked(year, month, day), }, ) @@ -175,71 +125,70 @@ impl Calendar for Coptic { calendrical_calculations::coptic::fixed_from_coptic(date.0.year, date.0.month, date.0.day) } - fn has_cheap_iso_conversion(&self) -> bool { - false + fn from_iso(&self, iso: IsoDateInner) -> CopticDateInner { + self.from_rata_die(Iso.to_rata_die(&iso)) + } + + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + Iso.from_rata_die(self.to_rata_die(date)) } fn months_in_year(&self, date: &Self::DateInner) -> u8 { - Self::months_in_provided_year(date.0.year) + date.0.months_in_year() } fn days_in_year(&self, date: &Self::DateInner) -> u16 { - if self.is_in_leap_year(date) { - 366 - } else { - 365 - } + date.0.days_in_year() } fn days_in_month(&self, date: &Self::DateInner) -> u8 { - Self::days_in_provided_month(date.0.year, date.0.month) + date.0.days_in_month() } - #[cfg(feature = "unstable")] - fn add( - &self, - date: &Self::DateInner, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result { - date.0.added(duration, self, options).map(CopticDateInner) + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + date.0.offset_date(offset, &()); } - #[cfg(feature = "unstable")] + #[allow(clippy::field_reassign_with_default)] fn until( &self, date1: &Self::DateInner, date2: &Self::DateInner, - options: DateDifferenceOptions, - ) -> Result { - Ok(date1.0.until(&date2.0, self, options)) + _calendar2: &Self, + _largest_unit: DateDurationUnit, + _smallest_unit: DateDurationUnit, + ) -> DateDuration { + date1.0.until(date2.0, _largest_unit, _smallest_unit) } fn year_info(&self, date: &Self::DateInner) -> Self::Year { - let year = date.0.year; + let year = self.extended_year(date); types::EraYear { era: tinystr!(16, "am"), era_index: Some(0), year, - extended_year: year, ambiguity: types::YearAmbiguity::CenturyRequired, } } + fn extended_year(&self, date: &Self::DateInner) -> i32 { + date.0.extended_year() + } + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { - date.0.year.rem_euclid(4) == 3 + Self::provided_year_is_leap(date.0.year) } fn month(&self, date: &Self::DateInner) -> types::MonthInfo { - types::MonthInfo::non_lunisolar(date.0.month) + date.0.month() } fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { - types::DayOfMonth(date.0.day) + date.0.day_of_month() } fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { - types::DayOfYear(30 * (date.0.month as u16 - 1) + date.0.day as u16) + date.0.day_of_year() } fn debug_name(&self) -> &'static str { @@ -265,7 +214,7 @@ impl Date { /// assert_eq!(date_coptic.day_of_month().0, 6); /// ``` pub fn try_new_coptic(year: i32, month: u8, day: u8) -> Result, RangeError> { - ArithmeticDate::try_from_ymd(year, month, day) + ArithmeticDate::new_from_ordinals(year, month, day) .map(CopticDateInner) .map(|inner| Date::from_raw(inner, Coptic)) } @@ -274,9 +223,6 @@ impl Date { #[cfg(test)] mod tests { use super::*; - use crate::options::{DateFromFieldsOptions, MissingFieldsStrategy, Overflow}; - use crate::types::DateFields; - #[test] fn test_coptic_regression() { // https://github.com/unicode-org/icu4x/issues/2254 @@ -285,23 +231,4 @@ mod tests { let recovered_iso = coptic.to_iso(); assert_eq!(iso_date, recovered_iso); } - - #[test] - fn test_from_fields_monthday_constrain() { - // M13-7 is not a real day, however this should resolve to M12-6 - // with Overflow::Constrain - let fields = DateFields { - month_code: Some(b"M13"), - day: Some(7), - ..Default::default() - }; - let options = DateFromFieldsOptions { - overflow: Some(Overflow::Constrain), - missing_fields_strategy: Some(MissingFieldsStrategy::Ecma), - ..Default::default() - }; - - let date = Date::try_from_fields(fields, options, Coptic).unwrap(); - assert_eq!(date.day_of_month().0, 6, "Day was successfully constrained"); - } } diff --git a/deps/crates/vendor/icu_calendar/src/cal/dangi.rs b/deps/crates/vendor/icu_calendar/src/cal/dangi.rs new file mode 100644 index 00000000000000..e0eef839a53d85 --- /dev/null +++ b/deps/crates/vendor/icu_calendar/src/cal/dangi.rs @@ -0,0 +1,932 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +//! This module contains types and implementations for the Korean Dangi calendar. +//! +//! ```rust +//! use icu::calendar::cal::Dangi; +//! use icu::calendar::Date; +//! +//! let dangi = Dangi::new(); +//! let dangi_date = Date::try_new_dangi_with_calendar(2023, 6, 6, dangi) +//! .expect("Failed to initialize Dangi Date instance."); +//! +//! assert_eq!(dangi_date.cyclic_year().related_iso, 2023); +//! assert_eq!(dangi_date.cyclic_year().year, 40); +//! assert_eq!(dangi_date.month().ordinal, 6); +//! assert_eq!(dangi_date.day_of_month().0, 6); +//! ``` + +use crate::cal::chinese_based::{ChineseBasedPrecomputedData, ChineseBasedWithDataLoading}; +use crate::cal::iso::{Iso, IsoDateInner}; +use crate::calendar_arithmetic::PrecomputedDataSource; +use crate::calendar_arithmetic::{ArithmeticDate, CalendarArithmetic}; +use crate::error::DateError; +use crate::provider::chinese_based::CalendarDangiV1; +use crate::types::CyclicYear; +use crate::AsCalendar; +use crate::{types, Calendar, Date}; +use calendrical_calculations::chinese_based; +use calendrical_calculations::rata_die::RataDie; +use core::cmp::Ordering; +use icu_provider::prelude::*; + +/// The [Traditional Korean (Dangi) Calendar](https://en.wikipedia.org/wiki/Korean_calendar) +/// +/// The Dangi Calendar is a lunisolar calendar used traditionally in North and South Korea. +/// It is often used today to track important cultural events and holidays like Seollal +/// (Korean lunar new year). It is similar to the Chinese lunar calendar (see [`Chinese`](super::Chinese)), +/// except that observations are based in Korea (currently UTC+9) rather than China (UTC+8). +/// This can cause some differences; for example, 2012 was a leap year, but in the Dangi +/// calendar the leap month was 3, while in the Chinese calendar the leap month was 4. +/// +/// This calendar is currently in a preview state: formatting for this calendar is not +/// going to be perfect. +/// +/// ```rust +/// use icu::calendar::cal::{Chinese, Dangi}; +/// use icu::calendar::Date; +/// use tinystr::tinystr; +/// +/// let iso_a = Date::try_new_iso(2012, 4, 23).unwrap(); +/// let dangi_a = iso_a.to_calendar(Dangi::new()); +/// let chinese_a = iso_a.to_calendar(Chinese::new()); +/// +/// assert_eq!(dangi_a.month().standard_code.0, tinystr!(4, "M03L")); +/// assert_eq!(chinese_a.month().standard_code.0, tinystr!(4, "M04")); +/// +/// let iso_b = Date::try_new_iso(2012, 5, 23).unwrap(); +/// let dangi_b = iso_b.to_calendar(Dangi::new()); +/// let chinese_b = iso_b.to_calendar(Chinese::new()); +/// +/// assert_eq!(dangi_b.month().standard_code.0, tinystr!(4, "M04")); +/// assert_eq!(chinese_b.month().standard_code.0, tinystr!(4, "M04L")); +/// ``` +/// # Era codes +/// +/// This calendar does not use era codes. +/// +/// # Month codes +/// +/// This calendar is a lunisolar calendar. It supports regular month codes `"M01" - "M12"` as well +/// as leap month codes `"M01L" - "M12L"`. +#[derive(Clone, Debug, Default)] +pub struct Dangi { + data: Option>, +} + +/// The inner date type used for representing [`Date`]s of [`Dangi`]. See [`Date`] and [`Dangi`] for more detail. +#[derive(Debug, Eq, PartialEq, PartialOrd, Ord)] +pub struct DangiDateInner(ArithmeticDate); + +// we want these impls without the `C: Copy/Clone` bounds +impl Copy for DangiDateInner {} +impl Clone for DangiDateInner { + fn clone(&self) -> Self { + *self + } +} + +// These impls just make custom derives on types containing C +// work. They're basically no-ops +impl PartialEq for Dangi { + fn eq(&self, _: &Self) -> bool { + true + } +} +impl Eq for Dangi {} +#[allow(clippy::non_canonical_partial_ord_impl)] // this is intentional +impl PartialOrd for Dangi { + fn partial_cmp(&self, _: &Self) -> Option { + Some(Ordering::Equal) + } +} + +impl Ord for Dangi { + fn cmp(&self, _: &Self) -> Ordering { + Ordering::Equal + } +} + +impl Dangi { + /// Creates a new [`Dangi`] with some precomputed calendrical calculations. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [📚 Help choosing a constructor](icu_provider::constructors) + #[cfg(feature = "compiled_data")] + pub const fn new() -> Self { + Self { + data: Some(DataPayload::from_static_ref( + crate::provider::Baked::SINGLETON_CALENDAR_DANGI_V1, + )), + } + } + + icu_provider::gen_buffer_data_constructors!(() -> error: DataError, + functions: [ + new: skip, + try_new_with_buffer_provider, + try_new_unstable, + Self, + ]); + + #[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new)] + pub fn try_new_unstable + ?Sized>( + provider: &D, + ) -> Result { + Ok(Self { + data: Some(provider.load(Default::default())?.payload), + }) + } + + /// Construct a new [`Dangi`] without any precomputed calendrical calculations. + pub fn new_always_calculating() -> Self { + Dangi { data: None } + } + + pub(crate) const DEBUG_NAME: &'static str = "Dangi"; +} + +impl crate::cal::scaffold::UnstableSealed for Dangi {} +impl Calendar for Dangi { + type DateInner = DangiDateInner; + type Year = CyclicYear; + + fn from_codes( + &self, + era: Option<&str>, + year: i32, + month_code: crate::types::MonthCode, + day: u8, + ) -> Result { + match era { + None => {} + _ => return Err(DateError::UnknownEra), + } + + let year = self.get_precomputed_data().load_or_compute_info(year); + + let Some(month) = year.parse_month_code(month_code) else { + return Err(DateError::UnknownMonthCode(month_code)); + }; + + year.validate_md(month, day)?; + + Ok(DangiDateInner(ArithmeticDate::new_unchecked( + year, month, day, + ))) + } + + fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { + let iso = Iso.from_rata_die(rd); + let y = self + .get_precomputed_data() + .load_or_compute_info_for_rd(rd, iso.0); + let (m, d) = y.md_from_rd(rd); + DangiDateInner(ArithmeticDate::new_unchecked(y, m, d)) + } + + fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { + date.0.year.rd_from_md(date.0.month, date.0.day) + } + + fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner { + let rd = Iso.to_rata_die(&iso); + let y = self + .get_precomputed_data() + .load_or_compute_info_for_rd(rd, iso.0); + let (m, d) = y.md_from_rd(rd); + DangiDateInner(ArithmeticDate::new_unchecked(y, m, d)) + } + + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + Iso.from_rata_die(self.to_rata_die(date)) + } + + fn months_in_year(&self, date: &Self::DateInner) -> u8 { + date.0.months_in_year() + } + + fn days_in_year(&self, date: &Self::DateInner) -> u16 { + date.0.days_in_year() + } + + fn days_in_month(&self, date: &Self::DateInner) -> u8 { + date.0.days_in_month() + } + + fn offset_date(&self, date: &mut Self::DateInner, offset: crate::DateDuration) { + date.0.offset_date(offset, &self.get_precomputed_data()); + } + + fn until( + &self, + date1: &Self::DateInner, + date2: &Self::DateInner, + _calendar2: &Self, + largest_unit: crate::DateDurationUnit, + smallest_unit: crate::DateDurationUnit, + ) -> crate::DateDuration { + date1.0.until(date2.0, largest_unit, smallest_unit) + } + + fn debug_name(&self) -> &'static str { + Self::DEBUG_NAME + } + + fn year_info(&self, date: &Self::DateInner) -> Self::Year { + let year = date.0.year; + CyclicYear { + year: (year.related_iso as i64 - 4).rem_euclid(60) as u8 + 1, + related_iso: year.related_iso, + } + } + + fn extended_year(&self, date: &Self::DateInner) -> i32 { + chinese_based::extended_from_iso::(date.0.year.related_iso) + } + + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { + Self::provided_year_is_leap(date.0.year) + } + + fn month(&self, date: &Self::DateInner) -> crate::types::MonthInfo { + date.0.year.month(date.0.month) + } + + fn day_of_month(&self, date: &Self::DateInner) -> crate::types::DayOfMonth { + date.0.day_of_month() + } + + fn day_of_year(&self, date: &Self::DateInner) -> crate::types::DayOfYear { + types::DayOfYear(date.0.year.day_of_year(date.0.month, date.0.day)) + } + + fn calendar_algorithm(&self) -> Option { + Some(crate::preferences::CalendarAlgorithm::Dangi) + } +} + +impl> Date { + /// Construct a new Dangi date from a `year`, `month`, and `day`. + /// `year` represents the [ISO](crate::Iso) year that roughly matches the Dangi year; + /// `month` represents the month of the year ordinally (ex. if it is a leap year, the last month will be 13, not 12); + /// `day` indicates day of month. + /// + /// This date will not use any precomputed calendrical calculations, + /// one that loads such data from a provider will be added in the future (#3933) + /// + /// ```rust + /// use icu::calendar::cal::Dangi; + /// use icu::calendar::Date; + /// + /// let dangi = Dangi::new(); + /// + /// let date_dangi = Date::try_new_dangi_with_calendar(2023, 6, 18, dangi) + /// .expect("Failed to initialize Dangi Date instance."); + /// + /// assert_eq!(date_dangi.cyclic_year().related_iso, 2023); + /// assert_eq!(date_dangi.cyclic_year().year, 40); + /// assert_eq!(date_dangi.month().ordinal, 6); + /// assert_eq!(date_dangi.day_of_month().0, 18); + /// ``` + pub fn try_new_dangi_with_calendar( + related_iso_year: i32, + month: u8, + day: u8, + calendar: A, + ) -> Result, DateError> { + let year = calendar + .as_calendar() + .get_precomputed_data() + .load_or_compute_info(related_iso_year); + year.validate_md(month, day)?; + Ok(Date::from_raw( + DangiDateInner(ArithmeticDate::new_unchecked(year, month, day)), + calendar, + )) + } +} + +impl ChineseBasedWithDataLoading for Dangi { + type CB = calendrical_calculations::chinese_based::Dangi; + fn get_precomputed_data(&self) -> ChineseBasedPrecomputedData { + ChineseBasedPrecomputedData::new(self.data.as_ref().map(|d| d.get())) + } +} + +#[cfg(test)] +mod test { + + use super::*; + use crate::cal::Chinese; + use calendrical_calculations::rata_die::RataDie; + + /// Run a test twice, with two calendars + fn do_twice( + dangi_calculating: &Dangi, + dangi_cached: &Dangi, + test: impl Fn(crate::Ref, &'static str), + ) { + test(crate::Ref(dangi_calculating), "calculating"); + test(crate::Ref(dangi_cached), "cached"); + } + + fn check_cyclic_and_rel_iso(year: i32) { + let iso = Date::try_new_iso(year, 6, 6).unwrap(); + let chinese = iso.to_calendar(Chinese::new_always_calculating()); + let dangi = iso.to_calendar(Dangi::new_always_calculating()); + let chinese_year = chinese.cyclic_year(); + let korean_year = dangi.cyclic_year(); + assert_eq!( + chinese_year, korean_year, + "Cyclic year failed for year: {year}" + ); + let chinese_rel_iso = chinese_year.related_iso; + let korean_rel_iso = korean_year.related_iso; + assert_eq!( + chinese_rel_iso, korean_rel_iso, + "Rel. ISO year equality failed for year: {year}" + ); + assert_eq!(korean_rel_iso, year, "Dangi Rel. ISO failed!"); + } + + #[test] + fn test_cyclic_same_as_chinese_near_present_day() { + for year in 1923..=2123 { + check_cyclic_and_rel_iso(year); + } + } + + #[test] + fn test_cyclic_same_as_chinese_near_rd_zero() { + for year in -100..=100 { + check_cyclic_and_rel_iso(year); + } + } + + #[test] + fn test_iso_to_dangi_roundtrip() { + let mut rd = -1963020; + let max_rd = 1963020; + let mut iters = 0; + let max_iters = 560; + let dangi_calculating = Dangi::new_always_calculating(); + let dangi_cached = Dangi::new(); + while rd < max_rd && iters < max_iters { + let rata_die = RataDie::new(rd); + let iso = Date::from_rata_die(rata_die, Iso); + do_twice(&dangi_calculating, &dangi_cached, |dangi, calendar_type| { + let korean = iso.to_calendar(dangi); + let result = korean.to_calendar(Iso); + assert_eq!( + iso, result, + "[{calendar_type}] Failed roundtrip ISO -> Dangi -> ISO for RD: {rd}" + ); + }); + + rd += 7043; + iters += 1; + } + } + + #[test] + fn test_dangi_consistent_with_icu() { + // Test cases for this test are derived from existing ICU Intl.DateTimeFormat. If there is a bug in ICU, + // these test cases may be affected, and this calendar's output may not be entirely valid. + + // There are a number of test cases which do not match ICU for dates very far in the past or future, + // see #3709. + + #[derive(Debug)] + struct TestCase { + iso_year: i32, + iso_month: u8, + iso_day: u8, + expected_rel_iso: i32, + expected_cyclic: u8, + expected_month: u8, + expected_day: u8, + } + + let cases = [ + TestCase { + // #3709: This test case fails to match ICU + iso_year: 4321, + iso_month: 1, + iso_day: 23, + expected_rel_iso: 4320, + expected_cyclic: 57, + expected_month: 13, + expected_day: 12, + }, + TestCase { + iso_year: 3649, + iso_month: 9, + iso_day: 20, + expected_rel_iso: 3649, + expected_cyclic: 46, + expected_month: 9, + expected_day: 1, + }, + TestCase { + iso_year: 3333, + iso_month: 3, + iso_day: 3, + expected_rel_iso: 3333, + expected_cyclic: 30, + expected_month: 1, + expected_day: 25, + }, + TestCase { + iso_year: 3000, + iso_month: 3, + iso_day: 30, + expected_rel_iso: 3000, + expected_cyclic: 57, + expected_month: 3, + expected_day: 3, + }, + TestCase { + iso_year: 2772, + iso_month: 7, + iso_day: 27, + expected_rel_iso: 2772, + expected_cyclic: 9, + expected_month: 7, + expected_day: 5, + }, + TestCase { + iso_year: 2525, + iso_month: 2, + iso_day: 25, + expected_rel_iso: 2525, + expected_cyclic: 2, + expected_month: 2, + expected_day: 3, + }, + TestCase { + iso_year: 2345, + iso_month: 3, + iso_day: 21, + expected_rel_iso: 2345, + expected_cyclic: 2, + expected_month: 2, + expected_day: 17, + }, + TestCase { + iso_year: 2222, + iso_month: 2, + iso_day: 22, + expected_rel_iso: 2222, + expected_cyclic: 59, + expected_month: 1, + expected_day: 11, + }, + TestCase { + iso_year: 2167, + iso_month: 6, + iso_day: 22, + expected_rel_iso: 2167, + expected_cyclic: 4, + expected_month: 5, + expected_day: 6, + }, + TestCase { + iso_year: 2121, + iso_month: 2, + iso_day: 12, + expected_rel_iso: 2120, + expected_cyclic: 17, + expected_month: 13, + expected_day: 25, + }, + TestCase { + iso_year: 2080, + iso_month: 12, + iso_day: 31, + expected_rel_iso: 2080, + expected_cyclic: 37, + expected_month: 12, + expected_day: 21, + }, + TestCase { + iso_year: 2030, + iso_month: 3, + iso_day: 20, + expected_rel_iso: 2030, + expected_cyclic: 47, + expected_month: 2, + expected_day: 17, + }, + TestCase { + iso_year: 2027, + iso_month: 2, + iso_day: 7, + expected_rel_iso: 2027, + expected_cyclic: 44, + expected_month: 1, + expected_day: 1, + }, + TestCase { + iso_year: 2023, + iso_month: 7, + iso_day: 1, + expected_rel_iso: 2023, + expected_cyclic: 40, + expected_month: 6, + expected_day: 14, + }, + TestCase { + iso_year: 2022, + iso_month: 3, + iso_day: 1, + expected_rel_iso: 2022, + expected_cyclic: 39, + expected_month: 1, + expected_day: 29, + }, + TestCase { + iso_year: 2021, + iso_month: 2, + iso_day: 1, + expected_rel_iso: 2020, + expected_cyclic: 37, + expected_month: 13, + expected_day: 20, + }, + TestCase { + iso_year: 2016, + iso_month: 3, + iso_day: 30, + expected_rel_iso: 2016, + expected_cyclic: 33, + expected_month: 2, + expected_day: 22, + }, + TestCase { + iso_year: 2016, + iso_month: 7, + iso_day: 30, + expected_rel_iso: 2016, + expected_cyclic: 33, + expected_month: 6, + expected_day: 27, + }, + TestCase { + iso_year: 2015, + iso_month: 9, + iso_day: 22, + expected_rel_iso: 2015, + expected_cyclic: 32, + expected_month: 8, + expected_day: 10, + }, + TestCase { + iso_year: 2013, + iso_month: 10, + iso_day: 1, + expected_rel_iso: 2013, + expected_cyclic: 30, + expected_month: 8, + expected_day: 27, + }, + TestCase { + iso_year: 2010, + iso_month: 2, + iso_day: 1, + expected_rel_iso: 2009, + expected_cyclic: 26, + expected_month: 13, + expected_day: 18, + }, + TestCase { + iso_year: 2000, + iso_month: 8, + iso_day: 30, + expected_rel_iso: 2000, + expected_cyclic: 17, + expected_month: 8, + expected_day: 2, + }, + TestCase { + iso_year: 1990, + iso_month: 11, + iso_day: 11, + expected_rel_iso: 1990, + expected_cyclic: 7, + expected_month: 10, + expected_day: 24, + }, + TestCase { + iso_year: 1970, + iso_month: 6, + iso_day: 10, + expected_rel_iso: 1970, + expected_cyclic: 47, + expected_month: 5, + expected_day: 7, + }, + TestCase { + iso_year: 1970, + iso_month: 1, + iso_day: 1, + expected_rel_iso: 1969, + expected_cyclic: 46, + expected_month: 11, + expected_day: 24, + }, + TestCase { + iso_year: 1941, + iso_month: 12, + iso_day: 7, + expected_rel_iso: 1941, + expected_cyclic: 18, + expected_month: 11, + expected_day: 19, + }, + TestCase { + iso_year: 1812, + iso_month: 5, + iso_day: 4, + expected_rel_iso: 1812, + expected_cyclic: 9, + expected_month: 3, + expected_day: 24, + }, + TestCase { + iso_year: 1655, + iso_month: 6, + iso_day: 15, + expected_rel_iso: 1655, + expected_cyclic: 32, + expected_month: 5, + expected_day: 12, + }, + TestCase { + iso_year: 1333, + iso_month: 3, + iso_day: 10, + expected_rel_iso: 1333, + expected_cyclic: 10, + expected_month: 2, + expected_day: 16, + }, + TestCase { + iso_year: 1000, + iso_month: 10, + iso_day: 10, + expected_rel_iso: 1000, + expected_cyclic: 37, + expected_month: 9, + expected_day: 5, + }, + TestCase { + iso_year: 842, + iso_month: 2, + iso_day: 15, + expected_rel_iso: 841, + expected_cyclic: 58, + expected_month: 13, + expected_day: 28, + }, + TestCase { + iso_year: 101, + iso_month: 1, + iso_day: 10, + expected_rel_iso: 100, + expected_cyclic: 37, + expected_month: 12, + expected_day: 24, + }, + TestCase { + iso_year: -1, + iso_month: 3, + iso_day: 28, + expected_rel_iso: -1, + expected_cyclic: 56, + expected_month: 2, + expected_day: 25, + }, + TestCase { + iso_year: -3, + iso_month: 2, + iso_day: 28, + expected_rel_iso: -3, + expected_cyclic: 54, + expected_month: 2, + expected_day: 5, + }, + TestCase { + iso_year: -365, + iso_month: 7, + iso_day: 24, + expected_rel_iso: -365, + expected_cyclic: 52, + expected_month: 6, + expected_day: 24, + }, + TestCase { + iso_year: -999, + iso_month: 9, + iso_day: 9, + expected_rel_iso: -999, + expected_cyclic: 18, + expected_month: 7, + expected_day: 27, + }, + TestCase { + iso_year: -1500, + iso_month: 1, + iso_day: 5, + expected_rel_iso: -1501, + expected_cyclic: 56, + expected_month: 12, + expected_day: 2, + }, + TestCase { + iso_year: -2332, + iso_month: 3, + iso_day: 1, + expected_rel_iso: -2332, + expected_cyclic: 5, + expected_month: 1, + expected_day: 16, + }, + TestCase { + iso_year: -2332, + iso_month: 2, + iso_day: 15, + expected_rel_iso: -2332, + expected_cyclic: 5, + expected_month: 1, + expected_day: 1, + }, + TestCase { + // #3709: This test case fails to match ICU + iso_year: -2332, + iso_month: 2, + iso_day: 14, + expected_rel_iso: -2333, + expected_cyclic: 4, + expected_month: 13, + expected_day: 30, + }, + TestCase { + // #3709: This test case fails to match ICU + iso_year: -2332, + iso_month: 1, + iso_day: 17, + expected_rel_iso: -2333, + expected_cyclic: 4, + expected_month: 13, + expected_day: 2, + }, + TestCase { + // #3709: This test case fails to match ICU + iso_year: -2332, + iso_month: 1, + iso_day: 16, + expected_rel_iso: -2333, + expected_cyclic: 4, + expected_month: 13, + expected_day: 1, + }, + TestCase { + iso_year: -2332, + iso_month: 1, + iso_day: 15, + expected_rel_iso: -2333, + expected_cyclic: 4, + expected_month: 12, + expected_day: 29, + }, + TestCase { + iso_year: -2332, + iso_month: 1, + iso_day: 1, + expected_rel_iso: -2333, + expected_cyclic: 4, + expected_month: 12, + expected_day: 15, + }, + TestCase { + iso_year: -2333, + iso_month: 1, + iso_day: 16, + expected_rel_iso: -2334, + expected_cyclic: 3, + expected_month: 12, + expected_day: 19, + }, + TestCase { + iso_year: -2333, + iso_month: 1, + iso_day: 27, + expected_rel_iso: -2333, + expected_cyclic: 4, + expected_month: 1, + expected_day: 1, + }, + TestCase { + iso_year: -2333, + iso_month: 1, + iso_day: 26, + expected_rel_iso: -2334, + expected_cyclic: 3, + expected_month: 12, + expected_day: 29, + }, + TestCase { + iso_year: -2600, + iso_month: 9, + iso_day: 16, + expected_rel_iso: -2600, + expected_cyclic: 37, + expected_month: 8, + expected_day: 16, + }, + TestCase { + iso_year: -2855, + iso_month: 2, + iso_day: 3, + expected_rel_iso: -2856, + expected_cyclic: 21, + expected_month: 12, + expected_day: 30, + }, + TestCase { + // #3709: This test case fails to match ICU + iso_year: -3000, + iso_month: 5, + iso_day: 15, + expected_rel_iso: -3000, + expected_cyclic: 57, + expected_month: 4, + expected_day: 1, + }, + TestCase { + // #3709: This test case fails to match ICU + iso_year: -3649, + iso_month: 9, + iso_day: 20, + expected_rel_iso: -3649, + expected_cyclic: 8, + expected_month: 8, + expected_day: 10, + }, + TestCase { + // #3709: This test case fails to match ICU + iso_year: -3649, + iso_month: 3, + iso_day: 30, + expected_rel_iso: -3649, + expected_cyclic: 8, + expected_month: 2, + expected_day: 14, + }, + TestCase { + // #3709: This test case fails to match ICU + iso_year: -3650, + iso_month: 3, + iso_day: 30, + expected_rel_iso: -3650, + expected_cyclic: 7, + expected_month: 3, + expected_day: 3, + }, + ]; + + let dangi_calculating = Dangi::new_always_calculating(); + let dangi_cached = Dangi::new(); + + for case in cases { + let iso = Date::try_new_iso(case.iso_year, case.iso_month, case.iso_day).unwrap(); + do_twice(&dangi_calculating, &dangi_cached, |dangi, calendar_type| { + let dangi = iso.to_calendar(dangi); + let dangi_cyclic = dangi.cyclic_year(); + let dangi_month = dangi.month().ordinal; + let dangi_day = dangi.day_of_month().0; + + assert_eq!( + dangi_cyclic.related_iso, case.expected_rel_iso, + "[{calendar_type}] Related ISO failed for test case: {case:?}" + ); + assert_eq!( + dangi_cyclic.year, case.expected_cyclic, + "[{calendar_type}] Cyclic year failed for test case: {case:?}" + ); + assert_eq!( + dangi_month, case.expected_month, + "[{calendar_type}] Month failed for test case: {case:?}" + ); + assert_eq!( + dangi_day, case.expected_day, + "[{calendar_type}] Day failed for test case: {case:?}" + ); + }); + } + } +} diff --git a/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional.rs b/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional.rs deleted file mode 100644 index 879c4a6f2c8fd9..00000000000000 --- a/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional.rs +++ /dev/null @@ -1,1940 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -use crate::cal::iso::Iso; -use crate::calendar_arithmetic::DateFieldsResolver; -use crate::calendar_arithmetic::{ArithmeticDate, ToExtendedYear}; -use crate::error::{ - DateError, DateFromFieldsError, EcmaReferenceYearError, MonthCodeError, UnknownEraError, -}; -use crate::options::{DateAddOptions, DateDifferenceOptions}; -use crate::options::{DateFromFieldsOptions, Overflow}; -use crate::types::ValidMonthCode; -use crate::AsCalendar; -use crate::{types, Calendar, Date}; -use calendrical_calculations::chinese_based::{ - self, ChineseBased, YearBounds, WELL_BEHAVED_ASTRONOMICAL_RANGE, -}; -use calendrical_calculations::rata_die::RataDie; -use icu_locale_core::preferences::extensions::unicode::keywords::CalendarAlgorithm; -use icu_provider::prelude::*; - -#[path = "east_asian_traditional/china_data.rs"] -mod china_data; -#[path = "east_asian_traditional/korea_data.rs"] -mod korea_data; -#[path = "east_asian_traditional/qing_data.rs"] -mod qing_data; -#[path = "east_asian_traditional/simple.rs"] -mod simple; - -/// The traditional East-Asian lunisolar calendar. -/// -/// This calendar used traditionally in China as well as in other countries in East Asia is -/// often used today to track important cultural events and holidays like the Lunar New Year. -/// -/// The type parameter specifies a particular set of calculation rules and local -/// time information, which differs by country and over time. -/// It must implement the currently-unstable `Rules` trait, at the moment this crate exports two stable -/// implementors of `Rules`: [`China`] and [`Korea`]. Please comment on [this issue](https://github.com/unicode-org/icu4x/issues/6962) -/// if you would like to see this trait stabilized. -/// -/// This corresponds to the `"chinese"` and `"dangi"` [CLDR calendars](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier) -/// respectively, when used with the [`China`] and [`Korea`] [`Rules`] types. -/// -/// # Year and Era codes -/// -/// Unlike most calendars, the traditional East-Asian calendar does not traditionally count years in an infinitely -/// increasing sequence. Instead, 10 "celestial stems" and 12 "terrestrial branches" are combined to form a -/// cycle of year names which repeats every 60 years. However, for the purposes of calendar calculations and -/// conversions, this calendar also counts years based on the [`Gregorian`](crate::cal::Gregorian) (ISO) calendar. -/// This "related ISO year" marks the Gregorian year in which a traditional East-Asian year begins. -/// -/// Because the traditional East-Asian calendar does not traditionally count years, era codes are not used in this calendar. -/// -/// For more information, suggested reading materials include: -/// * _Calendrical Calculations_ by Reingold & Dershowitz -/// * _The Mathematics of the Chinese Calendar_ by Helmer Aslaksen -/// * Wikipedia: -/// -/// # Months and days -/// -/// The 12 months (`M01`-`M12`) don't use names in modern usage, instead they are referred to as -/// e.g. 三月 (third month) using Chinese characters. -/// -/// As a lunar calendar, the lengths of the months depend on the lunar cycle (a month starts on the day of -/// local new moon), and will be either 29 or 30 days. As 12 such months fall short of a solar year, a leap -/// month is inserted roughly every 3 years; this can be after any month (e.g. `M02L`). -/// -/// Both the lengths of the months and the occurence of leap months are determined by the -/// concrete [`Rules`] implementation. -/// -/// The length of the year is 353-355 days, and the length of the leap year 383-385 days. -/// -/// # Calendar drift -/// -/// As leap months are determined with respect to the solar year, this calendar stays anchored -/// to the seasons. -#[derive(Clone, Debug, Default, Copy, PartialEq, Eq, PartialOrd, Ord)] -#[allow(clippy::exhaustive_structs)] // newtype -pub struct EastAsianTraditional(pub R); - -/// The rules for the [`EastAsianTraditional`] calendar. -/// -/// The calendar depends on both astronomical calculations and local time. -/// The rules for how to perform these calculations, as well as how local -/// time is determined differ between countries and have changed over time. -/// -/// This crate currently provides [`Rules`] for [`China`] and [`Korea`]. -/// -///
-/// 🚫 This trait is sealed; it should not be implemented by user code. If an API requests an item that implements this -/// trait, please consider using a type from the implementors listed below. -/// -/// It is still possible to implement this trait in userland (since `UnstableSealed` is public), -/// do not do so unless you are prepared for things to occasionally break. -///
-pub trait Rules: Clone + core::fmt::Debug + crate::cal::scaffold::UnstableSealed { - /// Returns data about the given year. - fn year_data(&self, related_iso: i32) -> EastAsianTraditionalYearData; - - /// Returns an ECMA reference year that contains the given month-day combination. - /// - /// If the day is out of range, it will return a year that contains the given month - /// and the maximum day possible for that month. See [the spec][spec] for the - /// precise algorithm used. - /// - /// This API only matters when using [`MissingFieldsStrategy::Ecma`] to compute - /// a date without providing a year in [`Date::try_from_fields()`]. The default impl - /// will just error, and custom calendars who do not care about ECMA/Temporal - /// reference years do not need to override this. - /// - /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-nonisomonthdaytoisoreferencedate - /// [`MissingFieldsStrategy::Ecma`]: crate::options::MissingFieldsStrategy::Ecma - fn ecma_reference_year( - &self, - // TODO: Consider accepting ValidMonthCode - _month_code: (u8, bool), - _day: u8, - ) -> Result { - Err(EcmaReferenceYearError::Unimplemented) - } - - /// The debug name for the calendar defined by these [`Rules`]. - fn debug_name(&self) -> &'static str { - "Chinese (custom)" - } - - /// The BCP-47 [`CalendarAlgorithm`] for the calendar defined by these [`Rules`], if defined. - fn calendar_algorithm(&self) -> Option { - None - } -} - -/// The [Chinese](https://en.wikipedia.org/wiki/Chinese_calendar) variant of the [`EastAsianTraditional`] calendar. -/// -/// This type agrees with the official data published by the -/// [Purple Mountain Observatory for the years 1900-2025], as well as with -/// the data published by the [Hong Kong Observatory for the years 1901-2100]. -/// -/// For years since 1912, this uses the [GB/T 33661-2017] rules. -/// As accurate computation is computationally expensive, years until -/// 2100 are precomputed, and after that this type regresses to a simplified -/// calculation. If accuracy beyond 2100 is required, clients -/// can implement their own [`Rules`] type containing more precomputed data. -/// We note that the calendar is inherently uncertain for some future dates. -/// -/// Before 1912 [different rules](https://ytliu.epizy.com/Shixian/Shixian_summary.html) -/// were used. This type produces correct data for the years 1900-1912, and -/// falls back to a simplified calculation before 1900. If accuracy is -/// required before 1900, clients can implement their own [`Rules`] type -/// using data such as from the excellent compilation by [Yuk Tung Liu]. -/// -/// The precise behavior of this calendar may change in the future if: -/// - New ground truth is established by published government sources -/// - We decide to tweak the simplified calculation -/// - We decide to expand or reduce the range where we are correctly handling past dates. -/// -/// [Purple Mountain Observatory for the years 1900-2025]: http://www.pmo.cas.cn/xwdt2019/kpdt2019/202203/P020250414456381274062.pdf -/// [Hong Kong Observatory for the years 1901-2100]: https://www.hko.gov.hk/en/gts/time/conversion.htm -/// [GB/T 33661-2017]: China::gb_t_33661_2017 -/// [Yuk Tung Liu]: https://ytliu0.github.io/ChineseCalendar/table.html -pub type ChineseTraditional = EastAsianTraditional; - -/// The [`Rules`] used in China. -/// -/// See [`ChineseTraditional`] for more information. -#[derive(Copy, Clone, Debug, Default)] -#[non_exhaustive] -pub struct China; - -impl China { - /// Computes [`EastAsianTraditionalYearData`] according to [GB/T 33661-2017], - /// as implemented by [`calendrical_calculations::chinese_based::Chinese`]. - /// - /// The rules specified in [GB/T 33661-2017] have only been used - /// since 1912, applying them proleptically to years before 1912 will not - /// necessarily match historical calendars. - /// - /// Note that for future years there is a small degree of uncertainty, as - /// [GB/T 33661-2017] depends on the uncertain future [difference between UT1 - /// and UTC](https://en.wikipedia.org/wiki/Leap_second#Future). - /// As noted by - /// [Yuk Tung Liu](https://ytliu0.github.io/ChineseCalendar/computation.html#modern), - /// years as early as 2057, 2089, and 2097 have lunar events very close to - /// local midnight, which might affect the start of a (single) month if additional - /// leap seconds are introduced. - /// - /// [GB/T 33661-2017]: https://openstd.samr.gov.cn/bzgk/gb/newGbInfo?hcno=E107EA4DE9725EDF819F33C60A44B296 - pub fn gb_t_33661_2017(related_iso: i32) -> EastAsianTraditionalYearData { - EastAsianTraditionalYearData::calendrical_calculations::( - related_iso, - ) - } -} - -impl crate::cal::scaffold::UnstableSealed for China {} -impl Rules for China { - fn year_data(&self, related_iso: i32) -> EastAsianTraditionalYearData { - if let Some(year) = EastAsianTraditionalYearData::lookup( - related_iso, - china_data::STARTING_YEAR, - china_data::DATA, - ) { - year - } else if related_iso > china_data::STARTING_YEAR { - EastAsianTraditionalYearData::simple(simple::UTC_PLUS_8, related_iso) - } else if let Some(year) = EastAsianTraditionalYearData::lookup( - related_iso, - qing_data::STARTING_YEAR, - qing_data::DATA, - ) { - year - } else { - EastAsianTraditionalYearData::simple(simple::BEIJING_UTC_OFFSET, related_iso) - } - } - - fn ecma_reference_year( - &self, - month_code: (u8, bool), - day: u8, - ) -> Result { - let (number, is_leap) = month_code; - // Computed by `generate_reference_years` - let extended_year = match (number, is_leap, day > 29) { - (1, false, false) => 1972, - (1, false, true) => 1970, - (1, true, false) => 1898, - (1, true, true) => 1898, - (2, false, false) => 1972, - (2, false, true) => 1972, - (2, true, false) => 1947, - (2, true, true) => 1830, - (3, false, false) => 1972, - (3, false, true) => 1966, - (3, true, false) => 1966, - (3, true, true) => 1955, - (4, false, false) => 1972, - (4, false, true) => 1970, - (4, true, false) => 1963, - (4, true, true) => 1944, - (5, false, false) => 1972, - (5, false, true) => 1972, - (5, true, false) => 1971, - (5, true, true) => 1952, - (6, false, false) => 1972, - (6, false, true) => 1971, - (6, true, false) => 1960, - (6, true, true) => 1941, - (7, false, false) => 1972, - (7, false, true) => 1972, - (7, true, false) => 1968, - (7, true, true) => 1938, - (8, false, false) => 1972, - (8, false, true) => 1971, - (8, true, false) => 1957, - (8, true, true) => 1691, - (9, false, false) => 1972, - (9, false, true) => 1972, - (9, true, false) => 2014, - (9, true, true) => 1843, - (10, false, false) => 1972, - (10, false, true) => 1972, - (10, true, false) => 1984, - (10, true, true) => 1737, - // Dec 31, 1972 is 1972-M11-26, dates after that - // are in the next year - (11, false, false) if day > 26 => 1971, - (11, false, false) => 1972, - (11, false, true) => 1969, - (11, true, false) => 2033, - (11, true, true) => 1889, - (12, false, false) => 1971, - (12, false, true) => 1971, - (12, true, false) => 1878, - (12, true, true) => 1783, - _ => return Err(EcmaReferenceYearError::MonthCodeNotInCalendar), - }; - Ok(extended_year) - } - - fn calendar_algorithm(&self) -> Option { - Some(CalendarAlgorithm::Chinese) - } - - fn debug_name(&self) -> &'static str { - "Chinese" - } -} - -/// The [Korean](https://en.wikipedia.org/wiki/Korean_calendar) variant of the [`EastAsianTraditional`] calendar. -/// -/// This type agrees with the official data published by the -/// [Korea Astronomy and Space Science Institute for the years 1900-2050]. -/// -/// For years since 1912, this uses [adapted GB/T 33661-2017] rules, -/// using Korea time instead of Beijing Time. -/// As accurate computation is computationally expensive, years until -/// 2100 are precomputed, and after that this type regresses to a simplified -/// calculation. If accuracy beyond 2100 is required, clients -/// can implement their own [`Rules`] type containing more precomputed data. -/// We note that the calendar is inherently uncertain for some future dates. -/// -/// Before 1912 [different rules](https://ytliu.epizy.com/Shixian/Shixian_summary.html) -/// were used (those of Qing-dynasty China). This type produces correct data -/// for the years 1900-1912, and falls back to a simplified calculation -/// before 1900. If accuracy is required before 1900, clients can implement -/// their own [`Rules`] type using data such as from the excellent compilation -/// by [Yuk Tung Liu]. -/// -/// The precise behavior of this calendar may change in the future if: -/// - New ground truth is established by published government sources -/// - We decide to tweak the simplified calculation -/// - We decide to expand or reduce the range where we are correctly handling past dates. -/// -/// [Korea Astronomy and Space Science Institute for the years 1900-2050]: https://astro.kasi.re.kr/life/pageView/5 -/// [adapted GB/T 33661-2017]: Korea::adapted_gb_t_33661_2017 -/// [GB/T 33661-2017]: China::gb_t_33661_2017 -/// [Yuk Tung Liu]: https://ytliu0.github.io/ChineseCalendar/table.html -/// -/// ```rust -/// use icu::calendar::cal::{ChineseTraditional, KoreanTraditional}; -/// use icu::calendar::Date; -/// -/// let iso_a = Date::try_new_iso(2012, 4, 23).unwrap(); -/// let korean_a = iso_a.to_calendar(KoreanTraditional::new()); -/// let chinese_a = iso_a.to_calendar(ChineseTraditional::new()); -/// -/// assert_eq!(korean_a.month().standard_code.0, "M03L"); -/// assert_eq!(chinese_a.month().standard_code.0, "M04"); -/// -/// let iso_b = Date::try_new_iso(2012, 5, 23).unwrap(); -/// let korean_b = iso_b.to_calendar(KoreanTraditional::new()); -/// let chinese_b = iso_b.to_calendar(ChineseTraditional::new()); -/// -/// assert_eq!(korean_b.month().standard_code.0, "M04"); -/// assert_eq!(chinese_b.month().standard_code.0, "M04L"); -/// ``` -pub type KoreanTraditional = EastAsianTraditional; - -/// The [`Rules`] used in Korea. -/// -/// See [`KoreanTraditional`] for more information. -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] -#[non_exhaustive] -pub struct Korea; - -impl Korea { - /// A version of [`China::gb_t_33661_2017`] adapted for Korean time. - /// - /// See [`China::gb_t_33661_2017`] for caveats. - pub fn adapted_gb_t_33661_2017(related_iso: i32) -> EastAsianTraditionalYearData { - EastAsianTraditionalYearData::calendrical_calculations::(related_iso) - } -} - -impl KoreanTraditional { - /// Creates a new [`KoreanTraditional`] calendar. - pub const fn new() -> Self { - Self(Korea) - } - - /// Use [`Self::new`]. - #[cfg(feature = "serde")] - #[doc = icu_provider::gen_buffer_unstable_docs!(BUFFER,Self::new)] - #[deprecated(since = "2.1.0", note = "use `Self::new()")] - pub fn try_new_with_buffer_provider( - _provider: &(impl icu_provider::buf::BufferProvider + ?Sized), - ) -> Result { - Ok(Self::new()) - } - - /// Use [`Self::new`]. - #[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new)] - #[deprecated(since = "2.1.0", note = "use `Self::new()")] - pub fn try_new_unstable(_provider: &D) -> Result { - Ok(Self::new()) - } - - /// Use [`Self::new`]. - #[deprecated(since = "2.1.0", note = "use `Self::new()")] - pub fn new_always_calculating() -> Self { - Self::new() - } -} - -impl crate::cal::scaffold::UnstableSealed for Korea {} -impl Rules for Korea { - fn year_data(&self, related_iso: i32) -> EastAsianTraditionalYearData { - if let Some(year) = EastAsianTraditionalYearData::lookup( - related_iso, - korea_data::STARTING_YEAR, - korea_data::DATA, - ) { - year - } else if related_iso > korea_data::STARTING_YEAR { - EastAsianTraditionalYearData::simple(simple::UTC_PLUS_9, related_iso) - } else if let Some(year) = EastAsianTraditionalYearData::lookup( - related_iso, - qing_data::STARTING_YEAR, - qing_data::DATA, - ) { - // Korea used Qing-dynasty rules before 1912 - // https://github.com/unicode-org/icu4x/issues/6455#issuecomment-3282175550 - year - } else { - EastAsianTraditionalYearData::simple(simple::BEIJING_UTC_OFFSET, related_iso) - } - } - - fn ecma_reference_year( - &self, - month_code: (u8, bool), - day: u8, - ) -> Result { - let (number, is_leap) = month_code; - // Computed by `generate_reference_years` - let extended_year = match (number, is_leap, day > 29) { - (1, false, false) => 1972, - (1, false, true) => 1970, - (1, true, false) => 1898, - (1, true, true) => 1898, - (2, false, false) => 1972, - (2, false, true) => 1972, - (2, true, false) => 1947, - (2, true, true) => 1830, - (3, false, false) => 1972, - (3, false, true) => 1968, - (3, true, false) => 1966, - (3, true, true) => 1955, - (4, false, false) => 1972, - (4, false, true) => 1970, - (4, true, false) => 1963, - (4, true, true) => 1944, - (5, false, false) => 1972, - (5, false, true) => 1972, - (5, true, false) => 1971, - (5, true, true) => 1952, - (6, false, false) => 1972, - (6, false, true) => 1971, - (6, true, false) => 1960, - (6, true, true) => 1941, - (7, false, false) => 1972, - (7, false, true) => 1972, - (7, true, false) => 1968, - (7, true, true) => 1938, - (8, false, false) => 1972, - (8, false, true) => 1971, - (8, true, false) => 1957, - (8, true, true) => 1691, - (9, false, false) => 1972, - (9, false, true) => 1972, - (9, true, false) => 2014, - (9, true, true) => 1843, - (10, false, false) => 1972, - (10, false, true) => 1972, - (10, true, false) => 1984, - (10, true, true) => 1737, - // Dec 31, 1972 is 1972-M11-26, dates after that - // are in the next year - (11, false, false) if day > 26 => 1971, - (11, false, false) => 1972, - (11, false, true) => 1969, - (11, true, false) => 2033, - (11, true, true) => 1889, - (12, false, false) => 1971, - (12, false, true) => 1971, - (12, true, false) => 1878, - (12, true, true) => 1783, - _ => return Err(EcmaReferenceYearError::MonthCodeNotInCalendar), - }; - Ok(extended_year) - } - - fn calendar_algorithm(&self) -> Option { - Some(CalendarAlgorithm::Dangi) - } - fn debug_name(&self) -> &'static str { - "Korean" - } -} - -impl> Date
{ - /// This method uses an ordinal month, which is probably not what you want. - /// - /// Use [`Date::try_new_from_codes`] - #[deprecated(since = "2.1.0", note = "use `Date::try_new_from_codes`")] - pub fn try_new_dangi_with_calendar( - related_iso_year: i32, - ordinal_month: u8, - day: u8, - calendar: A, - ) -> Result, DateError> { - ArithmeticDate::try_from_ymd( - calendar.as_calendar().0.year_data(related_iso_year), - ordinal_month, - day, - ) - .map(ChineseDateInner) - .map(|inner| Date::from_raw(inner, calendar)) - .map_err(Into::into) - } -} - -/// The inner date type used for representing [`Date`]s of [`EastAsianTraditional`]. -#[derive(Debug, Clone)] -pub struct ChineseDateInner(ArithmeticDate>); - -impl Copy for ChineseDateInner {} -impl PartialEq for ChineseDateInner { - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } -} -impl Eq for ChineseDateInner {} -impl PartialOrd for ChineseDateInner { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} -impl Ord for ChineseDateInner { - fn cmp(&self, other: &Self) -> core::cmp::Ordering { - self.0.cmp(&other.0) - } -} - -impl ChineseTraditional { - /// Creates a new [`ChineseTraditional`] calendar. - pub const fn new() -> Self { - EastAsianTraditional(China) - } - - #[cfg(feature = "serde")] - #[doc = icu_provider::gen_buffer_unstable_docs!(BUFFER,Self::new)] - #[deprecated(since = "2.1.0", note = "use `Self::new()")] - pub fn try_new_with_buffer_provider( - _provider: &(impl icu_provider::buf::BufferProvider + ?Sized), - ) -> Result { - Ok(Self::new()) - } - - #[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new)] - #[deprecated(since = "2.1.0", note = "use `Self::new()")] - pub fn try_new_unstable(_provider: &D) -> Result { - Ok(Self::new()) - } - - /// Use [`Self::new()`]. - #[deprecated(since = "2.1.0", note = "use `Self::new()")] - pub fn new_always_calculating() -> Self { - Self::new() - } -} - -impl DateFieldsResolver for EastAsianTraditional { - type YearInfo = EastAsianTraditionalYearData; - - fn days_in_provided_month(year: EastAsianTraditionalYearData, month: u8) -> u8 { - 29 + year.packed.month_has_30_days(month) as u8 - } - - /// Returns the number of months in a given year, which is 13 in a leap year, and 12 in a common year. - fn months_in_provided_year(year: EastAsianTraditionalYearData) -> u8 { - 12 + year.packed.leap_month().is_some() as u8 - } - - #[inline] - fn year_info_from_era( - &self, - _era: &[u8], - _era_year: i32, - ) -> Result { - // This calendar has no era codes - Err(UnknownEraError) - } - - #[inline] - fn year_info_from_extended(&self, extended_year: i32) -> Self::YearInfo { - self.0.year_data(extended_year) - } - - #[inline] - fn reference_year_from_month_day( - &self, - month_code: types::ValidMonthCode, - day: u8, - ) -> Result { - self.0 - .ecma_reference_year(month_code.to_tuple(), day) - .map(|y| self.0.year_data(y)) - } - - fn ordinal_month_from_code( - &self, - year: &Self::YearInfo, - month_code: types::ValidMonthCode, - options: DateFromFieldsOptions, - ) -> Result { - // 14 is a sentinel value, greater than all other months, for the purpose of computation only; - // it is impossible to actually have 14 months in a year. - let leap_month = year.packed.leap_month().unwrap_or(14); - - // leap_month identifies the ordinal month number of the leap month, - // so its month number will be leap_month - 1 - if month_code == ValidMonthCode::new_unchecked(leap_month - 1, true) { - return Ok(leap_month); - } - - let (number @ 1..13, leap) = month_code.to_tuple() else { - return Err(MonthCodeError::NotInCalendar); - }; - - if leap && options.overflow != Some(Overflow::Constrain) { - // wrong leap month and not constraining - return Err(MonthCodeError::NotInYear); - } - - // add one if there was a leap month before - Ok(number + (number >= leap_month) as u8) - } - - fn month_code_from_ordinal(&self, year: &Self::YearInfo, ordinal_month: u8) -> ValidMonthCode { - // 14 is a sentinel value, greater than all other months, for the purpose of computation only; - // it is impossible to actually have 14 months in a year. - let leap_month = year.packed.leap_month().unwrap_or(14); - ValidMonthCode::new_unchecked( - // subtract one if there was a leap month before - ordinal_month - (ordinal_month >= leap_month) as u8, - ordinal_month == leap_month, - ) - } -} - -impl crate::cal::scaffold::UnstableSealed for EastAsianTraditional {} -impl Calendar for EastAsianTraditional { - type DateInner = ChineseDateInner; - type Year = types::CyclicYear; - type DifferenceError = core::convert::Infallible; - - fn from_codes( - &self, - era: Option<&str>, - year: i32, - month_code: types::MonthCode, - day: u8, - ) -> Result { - ArithmeticDate::from_codes(era, year, month_code, day, self).map(ChineseDateInner) - } - - #[cfg(feature = "unstable")] - fn from_fields( - &self, - fields: types::DateFields, - options: DateFromFieldsOptions, - ) -> Result { - ArithmeticDate::from_fields(fields, options, self).map(ChineseDateInner) - } - - fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { - let iso = Iso.from_rata_die(rd); - let year = { - let candidate = self.0.year_data(iso.0.year); - - if rd >= candidate.new_year() { - candidate - } else { - self.0.year_data(iso.0.year - 1) - } - }; - - // Clamp the RD to our year - let rd = rd.clamp( - year.new_year(), - year.new_year() + year.packed.days_in_year() as i64, - ); - - let day_of_year = (rd - year.new_year()) as u16; - - // We divide by 30, not 29, to account for the case where all months before this - // were length 30 (possible near the beginning of the year) - let mut month = (day_of_year / 30) as u8 + 1; - let mut last_day_of_month = year.packed.last_day_of_month(month); - let mut last_day_of_prev_month = year.packed.last_day_of_month(month - 1); - - while day_of_year >= last_day_of_month { - month += 1; - last_day_of_prev_month = last_day_of_month; - last_day_of_month = year.packed.last_day_of_month(month); - } - - let day = (day_of_year + 1 - last_day_of_prev_month) as u8; - - ChineseDateInner(ArithmeticDate::new_unchecked(year, month, day)) - } - - fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { - date.0.year.new_year() - + date.0.year.packed.last_day_of_month(date.0.month - 1) as i64 - + (date.0.day - 1) as i64 - } - - fn has_cheap_iso_conversion(&self) -> bool { - false - } - - // Count the number of months in a given year, specified by providing a date - // from that year - fn days_in_year(&self, date: &Self::DateInner) -> u16 { - date.0.year.packed.days_in_year() - } - - fn days_in_month(&self, date: &Self::DateInner) -> u8 { - Self::days_in_provided_month(date.0.year, date.0.month) - } - - #[cfg(feature = "unstable")] - fn add( - &self, - date: &Self::DateInner, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result { - date.0.added(duration, self, options).map(ChineseDateInner) - } - - #[cfg(feature = "unstable")] - fn until( - &self, - date1: &Self::DateInner, - date2: &Self::DateInner, - options: DateDifferenceOptions, - ) -> Result { - Ok(date1.0.until(&date2.0, self, options)) - } - - /// Obtain a name for the calendar for debug printing - fn debug_name(&self) -> &'static str { - self.0.debug_name() - } - - fn year_info(&self, date: &Self::DateInner) -> Self::Year { - let year = date.0.year; - types::CyclicYear { - year: (year.related_iso - 4).rem_euclid(60) as u8 + 1, - related_iso: year.related_iso, - } - } - - fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { - date.0.year.packed.leap_month().is_some() - } - - /// The calendar-specific month code represented by `date`; - /// since the Chinese calendar has leap months, an "L" is appended to the month code for - /// leap months. For example, in a year where an intercalary month is added after the second - /// month, the month codes for ordinal months 1, 2, 3, 4, 5 would be "M01", "M02", "M02L", "M03", "M04". - fn month(&self, date: &Self::DateInner) -> types::MonthInfo { - types::MonthInfo::for_code_and_ordinal( - self.month_code_from_ordinal(&date.0.year, date.0.month), - date.0.month, - ) - } - - /// The calendar-specific day-of-month represented by `date` - fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { - types::DayOfMonth(date.0.day) - } - - /// Information of the day of the year - fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { - types::DayOfYear(date.0.year.packed.last_day_of_month(date.0.month - 1) + date.0.day as u16) - } - - fn calendar_algorithm(&self) -> Option { - self.0.calendar_algorithm() - } - - fn months_in_year(&self, date: &Self::DateInner) -> u8 { - Self::months_in_provided_year(date.0.year) - } -} - -impl> Date { - /// This method uses an ordinal month, which is probably not what you want. - /// - /// Use [`Date::try_new_from_codes`] - #[deprecated(since = "2.1.0", note = "use `Date::try_new_from_codes`")] - pub fn try_new_chinese_with_calendar( - related_iso_year: i32, - ordinal_month: u8, - day: u8, - calendar: A, - ) -> Result, DateError> { - ArithmeticDate::try_from_ymd( - calendar.as_calendar().0.year_data(related_iso_year), - ordinal_month, - day, - ) - .map(ChineseDateInner) - .map(|inner| Date::from_raw(inner, calendar)) - .map_err(Into::into) - } -} - -/// Information about a [`EastAsianTraditional`] year. -#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] -// TODO(#3933): potentially make this smaller -pub struct EastAsianTraditionalYearData { - /// Contains: - /// - length of each month in the year - /// - whether or not there is a leap month, and which month it is - /// - the date of Chinese New Year in the related ISO year - packed: PackedEastAsianTraditionalYearData, - related_iso: i32, -} - -impl ToExtendedYear for EastAsianTraditionalYearData { - fn to_extended_year(&self) -> i32 { - self.related_iso - } -} - -impl EastAsianTraditionalYearData { - /// Creates [`EastAsianTraditionalYearData`] from the given parts. - /// - /// `start_day` is the date for the first day of the year, see [`Date::to_rata_die`] - /// to obtain a [`RataDie`] from a [`Date`] in an arbitrary calendar. - /// - /// `leap_month` is the ordinal number of the leap month, for example if a year - /// has months 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, the `leap_month` - /// would be `Some(4)`. - /// - /// `month_lengths[n - 1]` is true if the nth month has 30 days, and false otherwise. - /// The leap month does not necessarily have the same number of days as the previous - /// month, which is why this has length 13. In non-leap years, the last value is ignored. - pub fn new( - related_iso: i32, - start_day: RataDie, - month_lengths: [bool; 13], - leap_month: Option, - ) -> Self { - Self { - packed: PackedEastAsianTraditionalYearData::new( - related_iso, - month_lengths, - leap_month, - start_day, - ), - related_iso, - } - } - - fn lookup( - related_iso: i32, - starting_year: i32, - data: &[PackedEastAsianTraditionalYearData], - ) -> Option { - Some(related_iso) - .and_then(|e| usize::try_from(e.checked_sub(starting_year)?).ok()) - .and_then(|i| data.get(i)) - .map(|&packed| Self { - related_iso, - packed, - }) - } - - fn calendrical_calculations( - related_iso: i32, - ) -> EastAsianTraditionalYearData { - let mid_year = calendrical_calculations::gregorian::fixed_from_gregorian(related_iso, 7, 1); - let year_bounds = YearBounds::compute::(mid_year); - - let YearBounds { - new_year, - next_new_year, - .. - } = year_bounds; - let (month_lengths, leap_month) = - chinese_based::month_structure_for_year::(new_year, next_new_year); - - EastAsianTraditionalYearData { - packed: PackedEastAsianTraditionalYearData::new( - related_iso, - month_lengths, - leap_month, - new_year, - ), - related_iso, - } - } - - /// Get the new year R.D. - fn new_year(self) -> RataDie { - self.packed.new_year(self.related_iso) - } -} - -/// The struct containing compiled ChineseData -/// -/// Bit structure (little endian: note that shifts go in the opposite direction!) -/// -/// ```text -/// Bit: 0 1 2 3 4 5 6 7 -/// Byte 0: [ month lengths ............. -/// Byte 1: .. month lengths ] | [ leap month index .. -/// Byte 2: ] | [ NY offset ] | unused -/// ``` -/// -/// Where the New Year Offset is the offset from ISO Jan 19 of that year for Chinese New Year, -/// the month lengths are stored as 1 = 30, 0 = 29 for each month including the leap month. -/// The largest possible offset is 33, which requires 6 bits of storage. -/// -///
-/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, -/// including in SemVer minor releases. While the serde representation of data structs is guaranteed -/// to be stable, their Rust representation might not be. Use with caution. -///
-#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] -struct PackedEastAsianTraditionalYearData(u8, u8, u8); - -impl PackedEastAsianTraditionalYearData { - /// The first day on which Chinese New Year may occur - /// - /// According to Reingold & Dershowitz, ch 19.6, Chinese New Year occurs on Jan 21 - Feb 21 inclusive. - /// - /// Our simple approximation sometimes returns Feb 22. - /// - /// We allow it to occur as early as January 19 which is the earliest the second new moon - /// could occur after the Winter Solstice if the solstice is pinned to December 20. - const fn earliest_ny(related_iso: i32) -> RataDie { - calendrical_calculations::gregorian::fixed_from_gregorian(related_iso, 1, 19) - } - - /// It clamps some values to avoid debug assertions on calendrical invariants. - const fn new( - related_iso: i32, - month_lengths: [bool; 13], - leap_month: Option, - new_year: RataDie, - ) -> Self { - // These assertions are API correctness assertions and even bad calendar arithmetic - // should not produce this - if let Some(l) = leap_month { - debug_assert!(2 <= l && l <= 13, "Leap month indices must be 2 <= i <= 13"); - } else { - debug_assert!( - !month_lengths[12], - "Last month length should not be set for non-leap years" - ) - } - - let ny_offset = new_year.since(Self::earliest_ny(related_iso)); - - #[cfg(debug_assertions)] - let out_of_valid_astronomical_range = WELL_BEHAVED_ASTRONOMICAL_RANGE.start.to_i64_date() - > new_year.to_i64_date() - || new_year.to_i64_date() > WELL_BEHAVED_ASTRONOMICAL_RANGE.end.to_i64_date(); - - // Assert the offset is in range, but allow it to be out of - // range when out_of_valid_astronomical_range=true - #[cfg(debug_assertions)] - debug_assert!( - ny_offset >= 0 || out_of_valid_astronomical_range, - "Year offset too small to store" - ); - // The maximum new-year's offset we have found is 34 - #[cfg(debug_assertions)] - debug_assert!( - ny_offset < 35 || out_of_valid_astronomical_range, - "Year offset too big to store" - ); - - // Just clamp to something we can represent when things get of range. - // - // This will typically happen when out_of_valid_astronomical_range - // is true. - // - // We can store up to 6 bytes for ny_offset, even if our - // maximum asserted value is otherwise 33. - let ny_offset = ny_offset & (0x40 - 1); - - let mut all = 0u32; // last byte unused - - let mut month = 0; - while month < month_lengths.len() { - #[allow(clippy::indexing_slicing)] // const iteration - if month_lengths[month] { - all |= 1 << month as u32; - } - month += 1; - } - let leap_month_idx = if let Some(leap_month_idx) = leap_month { - leap_month_idx - } else { - 0 - }; - all |= (leap_month_idx as u32) << (8 + 5); - all |= (ny_offset as u32) << (16 + 1); - let le = all.to_le_bytes(); - Self(le[0], le[1], le[2]) - } - - fn new_year(self, related_iso: i32) -> RataDie { - Self::earliest_ny(related_iso) + (self.2 as i64 >> 1) - } - - fn leap_month(self) -> Option { - let bits = (self.1 >> 5) + ((self.2 & 0b1) << 3); - - (bits != 0).then_some(bits) - } - - // Whether a particular month has 30 days (month is 1-indexed) - fn month_has_30_days(self, month: u8) -> bool { - let months = u16::from_le_bytes([self.0, self.1]); - months & (1 << (month - 1) as u16) != 0 - } - - // month is 1-indexed, but 0 is a valid input, producing 0 - fn last_day_of_month(self, month: u8) -> u16 { - let months = u16::from_le_bytes([self.0, self.1]); - // month is 1-indexed, so `29 * month` includes the current month - let mut prev_month_lengths = 29 * month as u16; - // month is 1-indexed, so `1 << month` is a mask with all zeroes except - // for a 1 at the bit index at the next month. Subtracting 1 from it gets us - // a bitmask for all months up to now - let long_month_bits = months & ((1 << month as u16) - 1); - prev_month_lengths += long_month_bits.count_ones().try_into().unwrap_or(0); - prev_month_lengths - } - - fn days_in_year(self) -> u16 { - self.last_day_of_month(12 + self.leap_month().is_some() as u8) - } -} - -#[cfg(test)] -mod test { - use super::*; - use crate::options::{DateFromFieldsOptions, Overflow}; - use crate::types::DateFields; - use calendrical_calculations::{gregorian::fixed_from_gregorian, rata_die::RataDie}; - use std::collections::BTreeMap; - - #[test] - fn test_chinese_from_rd() { - #[derive(Debug)] - struct TestCase { - rd: i64, - expected_year: i32, - expected_month: u8, - expected_day: u8, - } - - let cases = [ - TestCase { - rd: -964192, - expected_year: -2639, - expected_month: 1, - expected_day: 1, - }, - TestCase { - rd: -963838, - expected_year: -2638, - expected_month: 1, - expected_day: 1, - }, - TestCase { - rd: -963129, - expected_year: -2637, - expected_month: 13, - expected_day: 1, - }, - TestCase { - rd: -963100, - expected_year: -2637, - expected_month: 13, - expected_day: 30, - }, - TestCase { - rd: -963099, - expected_year: -2636, - expected_month: 1, - expected_day: 1, - }, - TestCase { - rd: 738700, - expected_year: 2023, - expected_month: 6, - expected_day: 12, - }, - TestCase { - rd: fixed_from_gregorian(2319, 2, 20).to_i64_date(), - expected_year: 2318, - expected_month: 13, - expected_day: 30, - }, - TestCase { - rd: fixed_from_gregorian(2319, 2, 21).to_i64_date(), - expected_year: 2319, - expected_month: 1, - expected_day: 1, - }, - TestCase { - rd: 738718, - expected_year: 2023, - expected_month: 6, - expected_day: 30, - }, - TestCase { - rd: 738747, - expected_year: 2023, - expected_month: 7, - expected_day: 29, - }, - TestCase { - rd: 738748, - expected_year: 2023, - expected_month: 8, - expected_day: 1, - }, - TestCase { - rd: 738865, - expected_year: 2023, - expected_month: 11, - expected_day: 29, - }, - TestCase { - rd: 738895, - expected_year: 2023, - expected_month: 12, - expected_day: 29, - }, - TestCase { - rd: 738925, - expected_year: 2023, - expected_month: 13, - expected_day: 30, - }, - TestCase { - rd: 0, - expected_year: 0, - expected_month: 11, - expected_day: 19, - }, - TestCase { - rd: -1, - expected_year: 0, - expected_month: 11, - expected_day: 18, - }, - TestCase { - rd: -365, - expected_year: -1, - expected_month: 12, - expected_day: 9, - }, - TestCase { - rd: 100, - expected_year: 1, - expected_month: 3, - expected_day: 1, - }, - ]; - - for case in cases { - let rata_die = RataDie::new(case.rd); - - let chinese = Date::from_rata_die(rata_die, ChineseTraditional::new()); - assert_eq!( - case.expected_year, - chinese.extended_year(), - "Chinese from RD failed, case: {case:?}" - ); - assert_eq!( - case.expected_month, - chinese.month().ordinal, - "Chinese from RD failed, case: {case:?}" - ); - assert_eq!( - case.expected_day, - chinese.day_of_month().0, - "Chinese from RD failed, case: {case:?}" - ); - } - } - - #[test] - fn test_rd_from_chinese() { - #[derive(Debug)] - struct TestCase { - year: i32, - ordinal_month: u8, - month_code: types::MonthCode, - day: u8, - expected: i64, - } - - let cases = [ - TestCase { - year: 2023, - ordinal_month: 6, - month_code: types::MonthCode::new_normal(5).unwrap(), - day: 6, - // June 23 2023 - expected: 738694, - }, - TestCase { - year: -2636, - ordinal_month: 1, - month_code: types::MonthCode::new_normal(1).unwrap(), - day: 1, - expected: -963099, - }, - ]; - - for case in cases { - let date = Date::try_new_from_codes( - None, - case.year, - case.month_code, - case.day, - ChineseTraditional::new(), - ) - .unwrap(); - #[allow(deprecated)] // should still test - { - assert_eq!( - Date::try_new_chinese_with_calendar( - case.year, - case.ordinal_month, - case.day, - ChineseTraditional::new() - ), - Ok(date) - ); - } - let rd = date.to_rata_die().to_i64_date(); - let expected = case.expected; - assert_eq!(rd, expected, "RD from Chinese failed, with expected: {expected} and calculated: {rd}, for test case: {case:?}"); - } - } - - #[test] - fn test_rd_chinese_roundtrip() { - let mut rd = -1963020; - let max_rd = 1963020; - let mut iters = 0; - let max_iters = 560; - while rd < max_rd && iters < max_iters { - let rata_die = RataDie::new(rd); - - let chinese = Date::from_rata_die(rata_die, ChineseTraditional::new()); - let result = chinese.to_rata_die(); - assert_eq!(result, rata_die, "Failed roundtrip RD -> Chinese -> RD for RD: {rata_die:?}, with calculated: {result:?} from Chinese date:\n{chinese:?}"); - - rd += 7043; - iters += 1; - } - } - - #[test] - fn test_chinese_epoch() { - let iso = Date::try_new_iso(-2636, 2, 15).unwrap(); - - let chinese = iso.to_calendar(ChineseTraditional::new()); - - assert_eq!(chinese.cyclic_year().related_iso, -2636); - assert_eq!(chinese.month().ordinal, 1); - assert_eq!(chinese.month().standard_code.0, "M01"); - assert_eq!(chinese.day_of_month().0, 1); - assert_eq!(chinese.cyclic_year().year, 1); - assert_eq!(chinese.cyclic_year().related_iso, -2636); - } - - #[test] - fn test_iso_to_chinese_negative_years() { - #[derive(Debug)] - struct TestCase { - iso_year: i32, - iso_month: u8, - iso_day: u8, - expected_year: i32, - expected_month: u8, - expected_day: u8, - } - - let cases = [ - TestCase { - iso_year: -2636, - iso_month: 2, - iso_day: 14, - expected_year: -2637, - expected_month: 13, - expected_day: 30, - }, - TestCase { - iso_year: -2636, - iso_month: 1, - iso_day: 15, - expected_year: -2637, - expected_month: 12, - expected_day: 29, - }, - ]; - - for case in cases { - let iso = Date::try_new_iso(case.iso_year, case.iso_month, case.iso_day).unwrap(); - - let chinese = iso.to_calendar(ChineseTraditional::new()); - assert_eq!( - case.expected_year, - chinese.cyclic_year().related_iso, - "ISO to Chinese failed for case: {case:?}" - ); - assert_eq!( - case.expected_month, - chinese.month().ordinal, - "ISO to Chinese failed for case: {case:?}" - ); - assert_eq!( - case.expected_day, - chinese.day_of_month().0, - "ISO to Chinese failed for case: {case:?}" - ); - } - } - - #[test] - fn test_chinese_leap_months() { - let expected = [ - (1933, 6), - (1938, 8), - (1984, 11), - (2009, 6), - (2017, 7), - (2028, 6), - ]; - - for case in expected { - let year = case.0; - let expected_month = case.1; - let iso = Date::try_new_iso(year, 6, 1).unwrap(); - - let chinese_date = iso.to_calendar(ChineseTraditional::new()); - assert!( - chinese_date.is_in_leap_year(), - "{year} should be a leap year" - ); - let new_year = chinese_date.inner.0.year.new_year(); - assert_eq!( - expected_month, - chinese_based::get_leap_month_from_new_year::(new_year), - "{year} have leap month {expected_month}" - ); - } - } - - #[test] - fn test_month_days() { - let year = ChineseTraditional::new().0.year_data(2023); - let cases = [ - (1, 29), - (2, 30), - (3, 29), - (4, 29), - (5, 30), - (6, 30), - (7, 29), - (8, 30), - (9, 30), - (10, 29), - (11, 30), - (12, 29), - (13, 30), - ]; - for case in cases { - let days_in_month = EastAsianTraditional::::days_in_provided_month(year, case.0); - assert_eq!( - case.1, days_in_month, - "month_days test failed for case: {case:?}" - ); - } - } - - #[test] - fn test_ordinal_to_month_code() { - #[derive(Debug)] - struct TestCase { - year: i32, - month: u8, - day: u8, - expected_code: &'static str, - } - - let cases = [ - TestCase { - year: 2023, - month: 1, - day: 9, - expected_code: "M12", - }, - TestCase { - year: 2023, - month: 2, - day: 9, - expected_code: "M01", - }, - TestCase { - year: 2023, - month: 3, - day: 9, - expected_code: "M02", - }, - TestCase { - year: 2023, - month: 4, - day: 9, - expected_code: "M02L", - }, - TestCase { - year: 2023, - month: 5, - day: 9, - expected_code: "M03", - }, - TestCase { - year: 2023, - month: 6, - day: 9, - expected_code: "M04", - }, - TestCase { - year: 2023, - month: 7, - day: 9, - expected_code: "M05", - }, - TestCase { - year: 2023, - month: 8, - day: 9, - expected_code: "M06", - }, - TestCase { - year: 2023, - month: 9, - day: 9, - expected_code: "M07", - }, - TestCase { - year: 2023, - month: 10, - day: 9, - expected_code: "M08", - }, - TestCase { - year: 2023, - month: 11, - day: 9, - expected_code: "M09", - }, - TestCase { - year: 2023, - month: 12, - day: 9, - expected_code: "M10", - }, - TestCase { - year: 2024, - month: 1, - day: 9, - expected_code: "M11", - }, - TestCase { - year: 2024, - month: 2, - day: 9, - expected_code: "M12", - }, - TestCase { - year: 2024, - month: 2, - day: 10, - expected_code: "M01", - }, - ]; - - for case in cases { - let iso = Date::try_new_iso(case.year, case.month, case.day).unwrap(); - let chinese = iso.to_calendar(ChineseTraditional::new()); - let result_code = chinese.month().standard_code.0; - let expected_code = case.expected_code.to_string(); - assert_eq!( - expected_code, result_code, - "Month codes did not match for test case: {case:?}" - ); - } - } - - #[test] - fn test_month_code_to_ordinal() { - let cal = ChineseTraditional::new(); - let reject = DateFromFieldsOptions { - overflow: Some(Overflow::Reject), - ..Default::default() - }; - let year = cal.year_info_from_extended(2023); - let leap_month = year.packed.leap_month().unwrap(); - for ordinal in 1..=13 { - let code = ValidMonthCode::new_unchecked( - ordinal - (ordinal >= leap_month) as u8, - ordinal == leap_month, - ); - assert_eq!( - cal.ordinal_month_from_code(&year, code, reject), - Ok(ordinal), - "Code to ordinal failed for year: {}, code: {ordinal}", - year.related_iso - ); - } - } - - #[test] - fn check_invalid_month_code_to_ordinal() { - let cal = ChineseTraditional::new(); - let reject = DateFromFieldsOptions { - overflow: Some(Overflow::Reject), - ..Default::default() - }; - for year in [4659, 4660] { - let year = cal.year_info_from_extended(year); - for (code, error) in [ - ( - ValidMonthCode::new_unchecked(4, true), - MonthCodeError::NotInYear, - ), - ( - ValidMonthCode::new_unchecked(13, false), - MonthCodeError::NotInCalendar, - ), - ] { - assert_eq!( - cal.ordinal_month_from_code(&year, code, reject), - Err(error), - "Invalid month code failed for year: {}, code: {code:?}", - year.related_iso, - ); - } - } - } - - #[test] - fn test_iso_chinese_roundtrip() { - for i in -1000..=1000 { - let year = i; - let month = i as u8 % 12 + 1; - let day = i as u8 % 28 + 1; - let iso = Date::try_new_iso(year, month, day).unwrap(); - let chinese = iso.to_calendar(ChineseTraditional::new()); - let result = chinese.to_calendar(Iso); - assert_eq!(iso, result, "ISO to Chinese roundtrip failed!\nIso: {iso:?}\nChinese: {chinese:?}\nResult: {result:?}"); - } - } - - fn check_cyclic_and_rel_iso(year: i32) { - let iso = Date::try_new_iso(year, 6, 6).unwrap(); - let chinese = iso.to_calendar(ChineseTraditional::new()); - let korean = iso.to_calendar(KoreanTraditional::new()); - let chinese_year = chinese.cyclic_year(); - let korean_year = korean.cyclic_year(); - assert_eq!( - chinese_year, korean_year, - "Cyclic year failed for year: {year}" - ); - let chinese_rel_iso = chinese_year.related_iso; - let korean_rel_iso = korean_year.related_iso; - assert_eq!( - chinese_rel_iso, korean_rel_iso, - "Rel. ISO year equality failed for year: {year}" - ); - assert_eq!(korean_rel_iso, year, "Korean Rel. ISO failed!"); - } - - #[test] - fn test_cyclic_same_as_chinese_near_present_day() { - for year in 1923..=2123 { - check_cyclic_and_rel_iso(year); - } - } - - #[test] - fn test_cyclic_same_as_chinese_near_rd_zero() { - for year in -100..=100 { - check_cyclic_and_rel_iso(year); - } - } - - #[test] - fn test_iso_to_korean_roundtrip() { - let mut rd = -1963020; - let max_rd = 1963020; - let mut iters = 0; - let max_iters = 560; - while rd < max_rd && iters < max_iters { - let rata_die = RataDie::new(rd); - let iso = Date::from_rata_die(rata_die, Iso); - let korean = iso.to_calendar(KoreanTraditional::new()); - let result = korean.to_calendar(Iso); - assert_eq!( - iso, result, - "Failed roundtrip ISO -> Korean -> ISO for RD: {rd}" - ); - - rd += 7043; - iters += 1; - } - } - - #[test] - fn test_from_fields_constrain() { - let fields = DateFields { - day: Some(31), - month_code: Some(b"M01"), - extended_year: Some(1972), - ..Default::default() - }; - let options = DateFromFieldsOptions { - overflow: Some(Overflow::Constrain), - ..Default::default() - }; - - let cal = ChineseTraditional::new(); - let date = Date::try_from_fields(fields, options, cal).unwrap(); - assert_eq!( - date.day_of_month().0, - 29, - "Day was successfully constrained" - ); - - // 2022 did not have M01L, the month should be constrained back down - let fields = DateFields { - day: Some(1), - month_code: Some(b"M01L"), - extended_year: Some(2022), - ..Default::default() - }; - let date = Date::try_from_fields(fields, options, cal).unwrap(); - assert_eq!( - date.month().standard_code.0, - "M01", - "Month was successfully constrained" - ); - } - - #[test] - fn test_from_fields_regress_7049() { - // We want to make sure that overly large years do not panic - // (we just reject them in Date::try_from_fields) - let fields = DateFields { - extended_year: Some(889192448), - ordinal_month: Some(1), - day: Some(1), - ..Default::default() - }; - let options = DateFromFieldsOptions { - overflow: Some(Overflow::Reject), - ..Default::default() - }; - - let cal = ChineseTraditional::new(); - assert!(matches!( - Date::try_from_fields(fields, options, cal).unwrap_err(), - DateFromFieldsError::Range { .. } - )); - } - - #[test] - #[ignore] // slow, network - fn test_against_hong_kong_observatory_data() { - use crate::{cal::Gregorian, Date}; - - let mut related_iso = 1900; - let mut lunar_month = ValidMonthCode::new_unchecked(11, false); - - for year in 1901..=2100 { - println!("Validating year {year}..."); - - for line in ureq::get(&format!( - "https://www.hko.gov.hk/en/gts/time/calendar/text/files/T{year}e.txt" - )) - .call() - .unwrap() - .body_mut() - .read_to_string() - .unwrap() - .split('\n') - { - if !line.starts_with(['1', '2']) { - // comments or blank lines - continue; - } - - let mut fields = line.split_ascii_whitespace(); - - let mut gregorian = fields.next().unwrap().split('/'); - let gregorian = Date::try_new_gregorian( - gregorian.next().unwrap().parse().unwrap(), - gregorian.next().unwrap().parse().unwrap(), - gregorian.next().unwrap().parse().unwrap(), - ) - .unwrap(); - - let day_or_lunar_month = fields.next().unwrap(); - - let lunar_day = if fields.next().is_some_and(|s| s.contains("Lunar")) { - let new_lunar_month = day_or_lunar_month - // 1st, 2nd, 3rd, nth - .split_once(['s', 'n', 'r', 't']) - .unwrap() - .0 - .parse() - .unwrap(); - lunar_month = ValidMonthCode::new_unchecked( - new_lunar_month, - new_lunar_month == lunar_month.number(), - ); - if new_lunar_month == 1 { - related_iso += 1; - } - 1 - } else { - day_or_lunar_month.parse().unwrap() - }; - - let chinese = Date::try_new_from_codes( - None, - related_iso, - lunar_month.to_month_code(), - lunar_day, - ChineseTraditional::new(), - ) - .unwrap(); - - assert_eq!( - gregorian, - chinese.to_calendar(Gregorian), - "{line}, {chinese:?}" - ); - } - } - } - - #[test] - #[ignore] // network - fn test_against_kasi_data() { - use crate::{cal::Gregorian, types::MonthCode, Date}; - - // TODO: query KASI directly - let uri = "https://gist.githubusercontent.com/Manishearth/d8c94a7df22a9eacefc4472a5805322e/raw/e1ea3b0aa52428686bb3a9cd0f262878515e16c1/resolved.json"; - - #[derive(serde::Deserialize)] - struct Golden(BTreeMap>); - - #[derive(serde::Deserialize)] - struct MonthData { - start_date: String, - } - - let json = ureq::get(uri) - .call() - .unwrap() - .body_mut() - .read_to_string() - .unwrap(); - - let golden = serde_json::from_str::(&json).unwrap(); - - for (&year, months) in &golden.0 { - if year == 1899 || year == 2050 { - continue; - } - for (&month, month_data) in months { - let mut gregorian = month_data.start_date.split('-'); - let gregorian = Date::try_new_gregorian( - gregorian.next().unwrap().parse().unwrap(), - gregorian.next().unwrap().parse().unwrap(), - gregorian.next().unwrap().parse().unwrap(), - ) - .unwrap(); - - assert_eq!( - Date::try_new_from_codes(None, year, month, 1, KoreanTraditional::new()) - .unwrap() - .to_calendar(Gregorian), - gregorian - ); - } - } - } - - #[test] - #[ignore] - fn generate_reference_years() { - generate_reference_years_for(ChineseTraditional::new()); - generate_reference_years_for(KoreanTraditional::new()); - fn generate_reference_years_for(calendar: EastAsianTraditional) { - use crate::Date; - - println!("Reference years for {calendar:?}:"); - let reference_year_end = Date::from_rata_die( - crate::cal::abstract_gregorian::LAST_DAY_OF_REFERENCE_YEAR, - calendar, - ); - let year_1900_start = Date::try_new_gregorian(1900, 1, 1) - .unwrap() - .to_calendar(calendar); - let year_2035_end = Date::try_new_gregorian(2035, 12, 31) - .unwrap() - .to_calendar(calendar); - for month in 1..=12 { - for leap in [false, true] { - 'outer: for long in [false, true] { - for (start_year, start_month, end_year, end_month, by) in [ - ( - reference_year_end.extended_year(), - reference_year_end.month().month_number(), - year_1900_start.extended_year(), - year_1900_start.month().month_number(), - -1, - ), - ( - reference_year_end.extended_year(), - reference_year_end.month().month_number(), - year_2035_end.extended_year(), - year_2035_end.month().month_number(), - 1, - ), - ( - year_1900_start.extended_year(), - year_1900_start.month().month_number(), - -10000, - 1, - -1, - ), - ] { - let mut year = start_year; - while year * by < end_year * by { - if year == start_year - && month as i32 * by <= start_month as i32 * by - || year == end_year - && month as i32 * by >= end_month as i32 * by - { - year += by; - continue; - } - let data = calendar.0.year_data(year); - let leap_month = data.packed.leap_month().unwrap_or(15); - let ordinal_month = if leap && month + 1 == leap_month { - month + 1 - } else { - month + (month + 1 > leap_month) as u8 - }; - if (!long || data.packed.month_has_30_days(ordinal_month)) - && (!leap || month + 1 == leap_month) - { - println!("({month}, {leap:?}, {long:?}) => {year},"); - continue 'outer; - } - year += by; - } - } - println!("({month}, {leap:?}, {long:?}) => todo!(),") - } - } - } - } - } - - #[test] - fn test_roundtrip_packed() { - fn packed_roundtrip_single( - month_lengths: [bool; 13], - leap_month_idx: Option, - ny_offset: i64, - ) { - let ny = - calendrical_calculations::gregorian::fixed_from_gregorian(1000, 1, 1) + ny_offset; - let packed = - PackedEastAsianTraditionalYearData::new(1000, month_lengths, leap_month_idx, ny); - - assert_eq!( - ny, - packed.new_year(1000), - "Roundtrip with {month_lengths:?}, {leap_month_idx:?}, {ny_offset}" - ); - assert_eq!( - leap_month_idx, - packed.leap_month(), - "Roundtrip with {month_lengths:?}, {leap_month_idx:?}, {ny_offset}" - ); - assert_eq!( - month_lengths, - core::array::from_fn(|i| packed.month_has_30_days(i as u8 + 1)), - "Roundtrip with {month_lengths:?}, {leap_month_idx:?}, {ny_offset}" - ); - } - - const SHORT: [bool; 13] = [false; 13]; - const LONG: [bool; 13] = [true; 13]; - const ALTERNATING1: [bool; 13] = [ - false, true, false, true, false, true, false, true, false, true, false, true, false, - ]; - const ALTERNATING2: [bool; 13] = [ - true, false, true, false, true, false, true, false, true, false, true, false, false, - ]; - const RANDOM1: [bool; 13] = [ - true, true, false, false, true, true, false, true, true, true, true, false, false, - ]; - const RANDOM2: [bool; 13] = [ - false, true, true, true, true, false, true, true, true, false, false, true, false, - ]; - packed_roundtrip_single(SHORT, None, 18 + 5); - packed_roundtrip_single(SHORT, None, 18 + 10); - packed_roundtrip_single(SHORT, Some(11), 18 + 15); - packed_roundtrip_single(LONG, Some(12), 18 + 15); - packed_roundtrip_single(ALTERNATING1, None, 18 + 2); - packed_roundtrip_single(ALTERNATING1, Some(3), 18 + 5); - packed_roundtrip_single(ALTERNATING2, None, 18 + 9); - packed_roundtrip_single(ALTERNATING2, Some(7), 18 + 26); - packed_roundtrip_single(RANDOM1, None, 18 + 29); - packed_roundtrip_single(RANDOM1, Some(12), 18 + 29); - packed_roundtrip_single(RANDOM1, Some(2), 18 + 21); - packed_roundtrip_single(RANDOM2, None, 18 + 25); - packed_roundtrip_single(RANDOM2, Some(2), 18 + 19); - packed_roundtrip_single(RANDOM2, Some(5), 18 + 2); - packed_roundtrip_single(RANDOM2, Some(12), 18 + 5); - } -} diff --git a/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/china_data.rs b/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/china_data.rs deleted file mode 100644 index 034ca1cedeb535..00000000000000 --- a/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/china_data.rs +++ /dev/null @@ -1,225 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -//! Data obtained from [`calendrical_calculations`]. - -use super::PackedEastAsianTraditionalYearData; - -pub const STARTING_YEAR: i32 = 1912; - -#[rustfmt::skip] -#[allow(clippy::unwrap_used)] // const -pub const DATA: &[PackedEastAsianTraditionalYearData] = { - use calendrical_calculations::gregorian::fixed_from_gregorian as gregorian; - let l = true; // long - let s = false; // short - &[ - PackedEastAsianTraditionalYearData::new(1912, [l, s, l, s, s, l, s, s, l, l, s, l, s], None, gregorian(1912, 2, 18)), - PackedEastAsianTraditionalYearData::new(1913, [l, l, s, l, s, s, l, s, s, l, s, l, s], None, gregorian(1913, 2, 6)), - PackedEastAsianTraditionalYearData::new(1914, [l, l, s, l, s, l, s, l, s, s, l, s, l], Some(6), gregorian(1914, 1, 26)), - PackedEastAsianTraditionalYearData::new(1915, [l, s, l, l, s, l, s, l, s, l, s, s, s], None, gregorian(1915, 2, 14)), - PackedEastAsianTraditionalYearData::new(1916, [l, l, s, l, s, l, l, s, l, s, l, s, s], None, gregorian(1916, 2, 3)), - PackedEastAsianTraditionalYearData::new(1917, [l, s, s, l, s, l, l, s, l, l, s, l, s], Some(3), gregorian(1917, 1, 23)), - PackedEastAsianTraditionalYearData::new(1918, [l, s, s, l, s, l, s, l, l, s, l, l, s], None, gregorian(1918, 2, 11)), - PackedEastAsianTraditionalYearData::new(1919, [s, l, s, s, l, s, s, l, l, s, l, l, l], Some(8), gregorian(1919, 2, 1)), - PackedEastAsianTraditionalYearData::new(1920, [s, l, s, s, l, s, s, l, s, l, l, l, s], None, gregorian(1920, 2, 20)), - PackedEastAsianTraditionalYearData::new(1921, [l, s, l, s, s, l, s, s, l, s, l, l, s], None, gregorian(1921, 2, 8)), - PackedEastAsianTraditionalYearData::new(1922, [l, s, l, l, s, s, l, s, s, l, s, l, l], Some(6), gregorian(1922, 1, 28)), - PackedEastAsianTraditionalYearData::new(1923, [s, l, l, s, l, s, l, s, s, l, s, l, s], None, gregorian(1923, 2, 16)), - PackedEastAsianTraditionalYearData::new(1924, [s, l, l, s, l, l, s, l, s, l, s, s, s], None, gregorian(1924, 2, 5)), - PackedEastAsianTraditionalYearData::new(1925, [l, s, l, s, l, l, s, l, l, s, l, s, l], Some(5), gregorian(1925, 1, 24)), - PackedEastAsianTraditionalYearData::new(1926, [s, s, l, s, l, s, l, l, s, l, l, s, s], None, gregorian(1926, 2, 13)), - PackedEastAsianTraditionalYearData::new(1927, [l, s, s, l, s, l, s, l, s, l, l, l, s], None, gregorian(1927, 2, 2)), - PackedEastAsianTraditionalYearData::new(1928, [s, l, s, s, l, s, s, l, s, l, l, l, l], Some(3), gregorian(1928, 1, 23)), - PackedEastAsianTraditionalYearData::new(1929, [s, l, s, s, l, s, s, l, s, l, l, l, s], None, gregorian(1929, 2, 10)), - PackedEastAsianTraditionalYearData::new(1930, [s, l, l, s, s, l, s, s, l, s, l, l, s], Some(7), gregorian(1930, 1, 30)), - PackedEastAsianTraditionalYearData::new(1931, [l, l, s, l, s, l, s, s, l, s, l, s, s], None, gregorian(1931, 2, 17)), - PackedEastAsianTraditionalYearData::new(1932, [l, l, l, s, l, s, l, s, s, l, s, l, s], None, gregorian(1932, 2, 6)), - PackedEastAsianTraditionalYearData::new(1933, [s, l, l, s, l, l, s, l, s, l, s, s, l], Some(6), gregorian(1933, 1, 26)), - PackedEastAsianTraditionalYearData::new(1934, [s, l, s, l, l, s, l, s, l, l, s, l, s], None, gregorian(1934, 2, 14)), - PackedEastAsianTraditionalYearData::new(1935, [s, s, l, s, l, s, l, l, s, l, l, s, s], None, gregorian(1935, 2, 4)), - PackedEastAsianTraditionalYearData::new(1936, [l, s, s, l, s, s, l, l, s, l, l, l, s], Some(4), gregorian(1936, 1, 24)), - PackedEastAsianTraditionalYearData::new(1937, [l, s, s, l, s, s, l, s, l, l, l, s, s], None, gregorian(1937, 2, 11)), - PackedEastAsianTraditionalYearData::new(1938, [l, l, s, s, l, s, s, l, s, l, l, s, l], Some(8), gregorian(1938, 1, 31)), - PackedEastAsianTraditionalYearData::new(1939, [l, l, s, s, l, s, s, l, s, l, s, l, s], None, gregorian(1939, 2, 19)), - PackedEastAsianTraditionalYearData::new(1940, [l, l, s, l, s, l, s, s, l, s, l, s, s], None, gregorian(1940, 2, 8)), - PackedEastAsianTraditionalYearData::new(1941, [l, l, s, l, l, s, l, s, s, l, s, l, s], Some(7), gregorian(1941, 1, 27)), - PackedEastAsianTraditionalYearData::new(1942, [l, s, l, l, s, l, s, l, s, l, s, l, s], None, gregorian(1942, 2, 15)), - PackedEastAsianTraditionalYearData::new(1943, [s, l, s, l, s, l, l, s, l, s, l, s, s], None, gregorian(1943, 2, 5)), - PackedEastAsianTraditionalYearData::new(1944, [l, s, l, s, l, s, l, s, l, l, s, l, l], Some(5), gregorian(1944, 1, 25)), - PackedEastAsianTraditionalYearData::new(1945, [s, s, l, s, s, l, s, l, l, l, s, l, s], None, gregorian(1945, 2, 13)), - PackedEastAsianTraditionalYearData::new(1946, [l, s, s, l, s, s, l, s, l, l, s, l, s], None, gregorian(1946, 2, 2)), - PackedEastAsianTraditionalYearData::new(1947, [l, l, s, s, l, s, s, l, s, l, s, l, l], Some(3), gregorian(1947, 1, 22)), - PackedEastAsianTraditionalYearData::new(1948, [l, s, l, s, l, s, s, l, s, l, s, l, s], None, gregorian(1948, 2, 10)), - PackedEastAsianTraditionalYearData::new(1949, [l, s, l, l, s, l, s, s, l, s, l, s, l], Some(8), gregorian(1949, 1, 29)), - PackedEastAsianTraditionalYearData::new(1950, [s, l, l, s, l, l, s, s, l, s, l, s, s], None, gregorian(1950, 2, 17)), - PackedEastAsianTraditionalYearData::new(1951, [l, s, l, l, s, l, s, l, s, l, s, l, s], None, gregorian(1951, 2, 6)), - PackedEastAsianTraditionalYearData::new(1952, [s, l, s, l, s, l, s, l, l, s, l, s, l], Some(6), gregorian(1952, 1, 27)), - PackedEastAsianTraditionalYearData::new(1953, [s, l, s, s, l, l, s, l, l, s, l, s, s], None, gregorian(1953, 2, 14)), - PackedEastAsianTraditionalYearData::new(1954, [l, s, l, s, s, l, s, l, l, s, l, l, s], None, gregorian(1954, 2, 3)), - PackedEastAsianTraditionalYearData::new(1955, [s, l, s, l, s, s, l, s, l, s, l, l, l], Some(4), gregorian(1955, 1, 24)), - PackedEastAsianTraditionalYearData::new(1956, [s, l, s, l, s, s, l, s, l, s, l, l, s], None, gregorian(1956, 2, 12)), - PackedEastAsianTraditionalYearData::new(1957, [l, s, l, s, l, s, s, l, s, l, s, l, s], Some(9), gregorian(1957, 1, 31)), - PackedEastAsianTraditionalYearData::new(1958, [l, l, l, s, l, s, s, l, s, l, s, l, s], None, gregorian(1958, 2, 18)), - PackedEastAsianTraditionalYearData::new(1959, [s, l, l, s, l, s, l, s, l, s, l, s, s], None, gregorian(1959, 2, 8)), - PackedEastAsianTraditionalYearData::new(1960, [l, s, l, s, l, l, s, l, s, l, s, l, s], Some(7), gregorian(1960, 1, 28)), - PackedEastAsianTraditionalYearData::new(1961, [l, s, l, s, l, s, l, l, s, l, s, l, s], None, gregorian(1961, 2, 15)), - PackedEastAsianTraditionalYearData::new(1962, [s, l, s, s, l, s, l, l, s, l, l, s, s], None, gregorian(1962, 2, 5)), - PackedEastAsianTraditionalYearData::new(1963, [l, s, l, s, s, l, s, l, s, l, l, l, s], Some(5), gregorian(1963, 1, 25)), - PackedEastAsianTraditionalYearData::new(1964, [l, s, l, s, s, l, s, l, s, l, l, l, s], None, gregorian(1964, 2, 13)), - PackedEastAsianTraditionalYearData::new(1965, [s, l, s, l, s, s, l, s, s, l, l, s, s], None, gregorian(1965, 2, 2)), - PackedEastAsianTraditionalYearData::new(1966, [l, l, l, s, l, s, s, l, s, s, l, l, s], Some(4), gregorian(1966, 1, 21)), - PackedEastAsianTraditionalYearData::new(1967, [l, l, s, l, l, s, s, l, s, l, s, l, s], None, gregorian(1967, 2, 9)), - PackedEastAsianTraditionalYearData::new(1968, [s, l, s, l, l, s, l, s, l, s, l, s, l], Some(8), gregorian(1968, 1, 30)), - PackedEastAsianTraditionalYearData::new(1969, [s, l, s, l, s, l, l, s, l, s, l, s, s], None, gregorian(1969, 2, 17)), - PackedEastAsianTraditionalYearData::new(1970, [l, s, s, l, s, l, l, s, l, l, s, l, s], None, gregorian(1970, 2, 6)), - PackedEastAsianTraditionalYearData::new(1971, [s, l, s, s, l, s, l, s, l, l, l, s, l], Some(6), gregorian(1971, 1, 27)), - PackedEastAsianTraditionalYearData::new(1972, [s, l, s, s, l, s, l, s, l, l, s, l, s], None, gregorian(1972, 2, 15)), - PackedEastAsianTraditionalYearData::new(1973, [l, s, l, s, s, l, s, s, l, l, s, l, s], None, gregorian(1973, 2, 3)), - PackedEastAsianTraditionalYearData::new(1974, [l, l, s, l, s, s, l, s, s, l, l, s, l], Some(5), gregorian(1974, 1, 23)), - PackedEastAsianTraditionalYearData::new(1975, [l, l, s, l, s, s, l, s, s, l, s, l, s], None, gregorian(1975, 2, 11)), - PackedEastAsianTraditionalYearData::new(1976, [l, l, s, l, s, l, s, l, s, s, l, s, l], Some(9), gregorian(1976, 1, 31)), - PackedEastAsianTraditionalYearData::new(1977, [l, s, l, l, s, l, s, l, s, l, s, s, s], None, gregorian(1977, 2, 18)), - PackedEastAsianTraditionalYearData::new(1978, [l, s, l, l, s, l, l, s, l, s, l, s, s], None, gregorian(1978, 2, 7)), - PackedEastAsianTraditionalYearData::new(1979, [l, s, s, l, s, l, l, s, l, l, s, l, s], Some(7), gregorian(1979, 1, 28)), - PackedEastAsianTraditionalYearData::new(1980, [l, s, s, l, s, l, s, l, l, s, l, l, s], None, gregorian(1980, 2, 16)), - PackedEastAsianTraditionalYearData::new(1981, [s, l, s, s, l, s, s, l, l, s, l, l, s], None, gregorian(1981, 2, 5)), - PackedEastAsianTraditionalYearData::new(1982, [l, s, l, s, s, l, s, s, l, s, l, l, l], Some(5), gregorian(1982, 1, 25)), - PackedEastAsianTraditionalYearData::new(1983, [l, s, l, s, s, l, s, s, l, s, l, l, s], None, gregorian(1983, 2, 13)), - PackedEastAsianTraditionalYearData::new(1984, [l, s, l, l, s, s, l, s, s, l, s, l, l], Some(11), gregorian(1984, 2, 2)), - PackedEastAsianTraditionalYearData::new(1985, [s, l, l, s, l, s, l, s, s, l, s, l, s], None, gregorian(1985, 2, 20)), - PackedEastAsianTraditionalYearData::new(1986, [s, l, l, s, l, l, s, l, s, l, s, s, s], None, gregorian(1986, 2, 9)), - PackedEastAsianTraditionalYearData::new(1987, [l, s, l, s, l, l, s, l, l, s, l, s, s], Some(7), gregorian(1987, 1, 29)), - PackedEastAsianTraditionalYearData::new(1988, [l, s, l, s, l, s, l, l, s, l, l, s, s], None, gregorian(1988, 2, 17)), - PackedEastAsianTraditionalYearData::new(1989, [l, s, s, l, s, l, s, l, s, l, l, l, s], None, gregorian(1989, 2, 6)), - PackedEastAsianTraditionalYearData::new(1990, [s, l, s, s, l, s, s, l, s, l, l, l, l], Some(6), gregorian(1990, 1, 27)), - PackedEastAsianTraditionalYearData::new(1991, [s, l, s, s, l, s, s, l, s, l, l, l, s], None, gregorian(1991, 2, 15)), - PackedEastAsianTraditionalYearData::new(1992, [s, l, l, s, s, l, s, s, l, s, l, l, s], None, gregorian(1992, 2, 4)), - PackedEastAsianTraditionalYearData::new(1993, [s, l, l, s, l, s, l, s, s, l, s, l, s], Some(4), gregorian(1993, 1, 23)), - PackedEastAsianTraditionalYearData::new(1994, [l, l, l, s, l, s, l, s, s, l, s, l, s], None, gregorian(1994, 2, 10)), - PackedEastAsianTraditionalYearData::new(1995, [s, l, l, s, l, s, l, l, s, s, l, s, l], Some(9), gregorian(1995, 1, 31)), - PackedEastAsianTraditionalYearData::new(1996, [s, l, s, l, l, s, l, s, l, l, s, s, s], None, gregorian(1996, 2, 19)), - PackedEastAsianTraditionalYearData::new(1997, [l, s, l, s, l, s, l, l, s, l, l, s, s], None, gregorian(1997, 2, 7)), - PackedEastAsianTraditionalYearData::new(1998, [l, s, s, l, s, s, l, l, s, l, l, s, l], Some(6), gregorian(1998, 1, 28)), - PackedEastAsianTraditionalYearData::new(1999, [l, s, s, l, s, s, l, s, l, l, l, s, s], None, gregorian(1999, 2, 16)), - PackedEastAsianTraditionalYearData::new(2000, [l, l, s, s, l, s, s, l, s, l, l, s, s], None, gregorian(2000, 2, 5)), - PackedEastAsianTraditionalYearData::new(2001, [l, l, s, l, s, l, s, s, l, s, l, s, l], Some(5), gregorian(2001, 1, 24)), - PackedEastAsianTraditionalYearData::new(2002, [l, l, s, l, s, l, s, s, l, s, l, s, s], None, gregorian(2002, 2, 12)), - PackedEastAsianTraditionalYearData::new(2003, [l, l, s, l, l, s, l, s, s, l, s, l, s], None, gregorian(2003, 2, 1)), - PackedEastAsianTraditionalYearData::new(2004, [s, l, s, l, l, s, l, s, l, s, l, s, l], Some(3), gregorian(2004, 1, 22)), - PackedEastAsianTraditionalYearData::new(2005, [s, l, s, l, s, l, l, s, l, s, l, s, s], None, gregorian(2005, 2, 9)), - PackedEastAsianTraditionalYearData::new(2006, [l, s, l, s, l, s, l, s, l, l, s, l, l], Some(8), gregorian(2006, 1, 29)), - PackedEastAsianTraditionalYearData::new(2007, [s, s, l, s, s, l, s, l, l, l, s, l, s], None, gregorian(2007, 2, 18)), - PackedEastAsianTraditionalYearData::new(2008, [l, s, s, l, s, s, l, s, l, l, s, l, s], None, gregorian(2008, 2, 7)), - PackedEastAsianTraditionalYearData::new(2009, [l, l, s, s, l, s, s, l, s, l, s, l, l], Some(6), gregorian(2009, 1, 26)), - PackedEastAsianTraditionalYearData::new(2010, [l, s, l, s, l, s, s, l, s, l, s, l, s], None, gregorian(2010, 2, 14)), - PackedEastAsianTraditionalYearData::new(2011, [l, s, l, l, s, l, s, s, l, s, l, s, s], None, gregorian(2011, 2, 3)), - PackedEastAsianTraditionalYearData::new(2012, [l, s, l, l, s, l, s, l, s, l, s, l, s], Some(5), gregorian(2012, 1, 23)), - PackedEastAsianTraditionalYearData::new(2013, [l, s, l, s, l, l, s, l, s, l, s, l, s], None, gregorian(2013, 2, 10)), - PackedEastAsianTraditionalYearData::new(2014, [s, l, s, l, s, l, s, l, l, s, l, s, l], Some(10), gregorian(2014, 1, 31)), - PackedEastAsianTraditionalYearData::new(2015, [s, l, s, s, l, s, l, l, l, s, l, s, s], None, gregorian(2015, 2, 19)), - PackedEastAsianTraditionalYearData::new(2016, [l, s, l, s, s, l, s, l, l, s, l, l, s], None, gregorian(2016, 2, 8)), - PackedEastAsianTraditionalYearData::new(2017, [s, l, s, l, s, s, l, s, l, s, l, l, l], Some(7), gregorian(2017, 1, 28)), - PackedEastAsianTraditionalYearData::new(2018, [s, l, s, l, s, s, l, s, l, s, l, l, s], None, gregorian(2018, 2, 16)), - PackedEastAsianTraditionalYearData::new(2019, [l, s, l, s, l, s, s, l, s, s, l, l, s], None, gregorian(2019, 2, 5)), - PackedEastAsianTraditionalYearData::new(2020, [s, l, l, l, s, l, s, s, l, s, l, s, l], Some(5), gregorian(2020, 1, 25)), - PackedEastAsianTraditionalYearData::new(2021, [s, l, l, s, l, s, l, s, l, s, l, s, s], None, gregorian(2021, 2, 12)), - PackedEastAsianTraditionalYearData::new(2022, [l, s, l, s, l, l, s, l, s, l, s, l, s], None, gregorian(2022, 2, 1)), - PackedEastAsianTraditionalYearData::new(2023, [s, l, s, s, l, l, s, l, l, s, l, s, l], Some(3), gregorian(2023, 1, 22)), - PackedEastAsianTraditionalYearData::new(2024, [s, l, s, s, l, s, l, l, s, l, l, s, s], None, gregorian(2024, 2, 10)), - PackedEastAsianTraditionalYearData::new(2025, [l, s, l, s, s, l, s, l, s, l, l, l, s], Some(7), gregorian(2025, 1, 29)), - PackedEastAsianTraditionalYearData::new(2026, [l, s, l, s, s, l, s, s, l, l, l, s, s], None, gregorian(2026, 2, 17)), - PackedEastAsianTraditionalYearData::new(2027, [l, l, s, l, s, s, l, s, s, l, l, s, s], None, gregorian(2027, 2, 6)), - PackedEastAsianTraditionalYearData::new(2028, [l, l, l, s, l, s, s, l, s, s, l, l, s], Some(6), gregorian(2028, 1, 26)), - PackedEastAsianTraditionalYearData::new(2029, [l, l, s, l, s, l, s, l, s, s, l, l, s], None, gregorian(2029, 2, 13)), - PackedEastAsianTraditionalYearData::new(2030, [s, l, s, l, l, s, l, s, l, s, l, s, s], None, gregorian(2030, 2, 3)), - PackedEastAsianTraditionalYearData::new(2031, [s, l, l, s, l, s, l, l, s, l, s, l, s], Some(4), gregorian(2031, 1, 23)), - PackedEastAsianTraditionalYearData::new(2032, [l, s, s, l, s, l, l, s, l, l, s, l, s], None, gregorian(2032, 2, 11)), - PackedEastAsianTraditionalYearData::new(2033, [s, l, s, s, l, s, l, s, l, l, l, s, l], Some(12), gregorian(2033, 1, 31)), - PackedEastAsianTraditionalYearData::new(2034, [s, l, s, s, l, s, l, s, l, l, s, l, s], None, gregorian(2034, 2, 19)), - PackedEastAsianTraditionalYearData::new(2035, [l, s, l, s, s, l, s, s, l, l, s, l, s], None, gregorian(2035, 2, 8)), - PackedEastAsianTraditionalYearData::new(2036, [l, l, s, l, s, s, l, s, s, l, s, l, l], Some(7), gregorian(2036, 1, 28)), - PackedEastAsianTraditionalYearData::new(2037, [l, l, s, l, s, s, l, s, s, l, s, l, s], None, gregorian(2037, 2, 15)), - PackedEastAsianTraditionalYearData::new(2038, [l, l, s, l, s, l, s, l, s, s, l, s, s], None, gregorian(2038, 2, 4)), - PackedEastAsianTraditionalYearData::new(2039, [l, l, s, l, l, s, l, s, l, s, l, s, s], Some(6), gregorian(2039, 1, 24)), - PackedEastAsianTraditionalYearData::new(2040, [l, s, l, l, s, l, s, l, l, s, l, s, s], None, gregorian(2040, 2, 12)), - PackedEastAsianTraditionalYearData::new(2041, [s, l, s, l, s, l, l, s, l, l, s, l, s], None, gregorian(2041, 2, 1)), - PackedEastAsianTraditionalYearData::new(2042, [s, l, s, s, l, s, l, s, l, l, s, l, l], Some(3), gregorian(2042, 1, 22)), - PackedEastAsianTraditionalYearData::new(2043, [s, l, s, s, l, s, s, l, l, s, l, l, s], None, gregorian(2043, 2, 10)), - PackedEastAsianTraditionalYearData::new(2044, [l, s, l, s, s, l, s, s, l, s, l, l, l], Some(8), gregorian(2044, 1, 30)), - PackedEastAsianTraditionalYearData::new(2045, [l, s, l, s, s, l, s, s, l, s, l, l, s], None, gregorian(2045, 2, 17)), - PackedEastAsianTraditionalYearData::new(2046, [l, s, l, s, l, s, l, s, s, l, s, l, s], None, gregorian(2046, 2, 6)), - PackedEastAsianTraditionalYearData::new(2047, [l, s, l, l, s, l, s, l, s, s, l, s, l], Some(6), gregorian(2047, 1, 26)), - PackedEastAsianTraditionalYearData::new(2048, [s, l, l, s, l, l, s, l, s, s, l, s, s], None, gregorian(2048, 2, 14)), - PackedEastAsianTraditionalYearData::new(2049, [l, s, l, s, l, l, s, l, l, s, l, s, s], None, gregorian(2049, 2, 2)), - PackedEastAsianTraditionalYearData::new(2050, [s, l, s, l, s, l, s, l, l, s, l, l, s], Some(4), gregorian(2050, 1, 23)), - PackedEastAsianTraditionalYearData::new(2051, [l, s, s, l, s, s, l, l, s, l, l, l, s], None, gregorian(2051, 2, 11)), - PackedEastAsianTraditionalYearData::new(2052, [s, l, s, s, l, s, s, l, s, l, l, l, l], Some(9), gregorian(2052, 2, 1)), - PackedEastAsianTraditionalYearData::new(2053, [s, l, s, s, l, s, s, l, s, l, l, l, s], None, gregorian(2053, 2, 19)), - PackedEastAsianTraditionalYearData::new(2054, [s, l, l, s, s, l, s, s, l, s, l, l, s], None, gregorian(2054, 2, 8)), - PackedEastAsianTraditionalYearData::new(2055, [s, l, l, s, l, s, l, s, s, l, s, l, s], Some(7), gregorian(2055, 1, 28)), - PackedEastAsianTraditionalYearData::new(2056, [l, l, l, s, l, s, l, s, s, l, s, l, s], None, gregorian(2056, 2, 15)), - PackedEastAsianTraditionalYearData::new(2057, [s, l, l, s, l, s, l, s, l, s, l, s, s], None, gregorian(2057, 2, 4)), - PackedEastAsianTraditionalYearData::new(2058, [l, s, l, s, l, s, l, l, s, l, l, s, s], Some(5), gregorian(2058, 1, 24)), - PackedEastAsianTraditionalYearData::new(2059, [l, s, l, s, l, s, l, s, l, l, l, s, s], None, gregorian(2059, 2, 12)), - PackedEastAsianTraditionalYearData::new(2060, [l, s, s, l, s, s, l, s, l, l, l, s, s], None, gregorian(2060, 2, 2)), - PackedEastAsianTraditionalYearData::new(2061, [l, l, s, s, l, s, s, l, s, l, l, l, s], Some(4), gregorian(2061, 1, 21)), - PackedEastAsianTraditionalYearData::new(2062, [l, l, s, s, l, s, s, l, s, l, l, s, s], None, gregorian(2062, 2, 9)), - PackedEastAsianTraditionalYearData::new(2063, [l, l, s, l, s, l, s, s, l, s, l, s, l], Some(8), gregorian(2063, 1, 29)), - PackedEastAsianTraditionalYearData::new(2064, [l, l, s, l, s, l, s, s, l, s, l, s, s], None, gregorian(2064, 2, 17)), - PackedEastAsianTraditionalYearData::new(2065, [l, l, s, l, l, s, l, s, s, l, s, l, s], None, gregorian(2065, 2, 5)), - PackedEastAsianTraditionalYearData::new(2066, [s, l, s, l, l, s, l, s, l, s, l, s, l], Some(6), gregorian(2066, 1, 26)), - PackedEastAsianTraditionalYearData::new(2067, [s, l, s, l, s, l, l, s, l, s, l, s, s], None, gregorian(2067, 2, 14)), - PackedEastAsianTraditionalYearData::new(2068, [l, s, l, s, s, l, l, s, l, l, s, l, s], None, gregorian(2068, 2, 3)), - PackedEastAsianTraditionalYearData::new(2069, [s, l, s, l, s, s, l, s, l, l, l, s, l], Some(5), gregorian(2069, 1, 23)), - PackedEastAsianTraditionalYearData::new(2070, [s, l, s, l, s, s, l, s, l, l, s, l, s], None, gregorian(2070, 2, 11)), - PackedEastAsianTraditionalYearData::new(2071, [l, s, l, s, l, s, s, l, s, l, s, l, l], Some(9), gregorian(2071, 1, 31)), - PackedEastAsianTraditionalYearData::new(2072, [l, s, l, s, l, s, s, l, s, l, s, l, s], None, gregorian(2072, 2, 19)), - PackedEastAsianTraditionalYearData::new(2073, [l, s, l, l, s, l, s, s, l, s, l, s, s], None, gregorian(2073, 2, 7)), - PackedEastAsianTraditionalYearData::new(2074, [l, s, l, l, s, l, s, l, s, l, s, l, s], Some(7), gregorian(2074, 1, 27)), - PackedEastAsianTraditionalYearData::new(2075, [l, s, l, s, l, l, s, l, s, l, s, l, s], None, gregorian(2075, 2, 15)), - PackedEastAsianTraditionalYearData::new(2076, [s, l, s, l, s, l, s, l, l, s, l, s, s], None, gregorian(2076, 2, 5)), - PackedEastAsianTraditionalYearData::new(2077, [l, s, l, s, s, l, s, l, l, l, s, l, s], Some(5), gregorian(2077, 1, 24)), - PackedEastAsianTraditionalYearData::new(2078, [l, s, l, s, s, l, s, l, l, s, l, l, s], None, gregorian(2078, 2, 12)), - PackedEastAsianTraditionalYearData::new(2079, [s, l, s, l, s, s, l, s, l, s, l, l, s], None, gregorian(2079, 2, 2)), - PackedEastAsianTraditionalYearData::new(2080, [l, s, l, s, l, s, s, l, s, s, l, l, l], Some(4), gregorian(2080, 1, 22)), - PackedEastAsianTraditionalYearData::new(2081, [s, l, l, s, l, s, s, l, s, s, l, l, s], None, gregorian(2081, 2, 9)), - PackedEastAsianTraditionalYearData::new(2082, [s, l, l, l, s, s, l, s, l, s, s, l, l], Some(8), gregorian(2082, 1, 29)), - PackedEastAsianTraditionalYearData::new(2083, [s, l, l, s, l, s, l, s, l, s, l, s, s], None, gregorian(2083, 2, 17)), - PackedEastAsianTraditionalYearData::new(2084, [l, s, l, s, l, l, s, l, s, l, s, l, s], None, gregorian(2084, 2, 6)), - PackedEastAsianTraditionalYearData::new(2085, [s, l, s, s, l, l, s, l, l, s, l, s, l], Some(6), gregorian(2085, 1, 26)), - PackedEastAsianTraditionalYearData::new(2086, [s, l, s, s, l, s, l, l, s, l, l, s, s], None, gregorian(2086, 2, 14)), - PackedEastAsianTraditionalYearData::new(2087, [l, s, l, s, s, l, s, l, s, l, l, l, s], None, gregorian(2087, 2, 3)), - PackedEastAsianTraditionalYearData::new(2088, [s, l, s, l, s, s, l, s, s, l, l, l, s], Some(5), gregorian(2088, 1, 24)), - PackedEastAsianTraditionalYearData::new(2089, [l, l, s, l, s, s, s, l, s, l, l, s, s], None, gregorian(2089, 2, 10)), - PackedEastAsianTraditionalYearData::new(2090, [l, l, l, s, l, s, s, l, s, s, l, l, s], Some(9), gregorian(2090, 1, 30)), - PackedEastAsianTraditionalYearData::new(2091, [l, l, s, l, s, l, s, l, s, s, l, s, s], None, gregorian(2091, 2, 18)), - PackedEastAsianTraditionalYearData::new(2092, [l, l, s, l, l, s, l, s, l, s, l, s, s], None, gregorian(2092, 2, 7)), - PackedEastAsianTraditionalYearData::new(2093, [s, l, l, s, l, s, l, l, s, l, s, l, s], Some(7), gregorian(2093, 1, 27)), - PackedEastAsianTraditionalYearData::new(2094, [s, l, s, l, s, l, l, s, l, l, s, l, s], None, gregorian(2094, 2, 15)), - PackedEastAsianTraditionalYearData::new(2095, [s, l, s, s, l, s, l, s, l, l, l, s, s], None, gregorian(2095, 2, 5)), - PackedEastAsianTraditionalYearData::new(2096, [l, s, l, s, s, l, s, s, l, l, l, s, l], Some(5), gregorian(2096, 1, 25)), - PackedEastAsianTraditionalYearData::new(2097, [l, s, l, s, s, s, l, s, l, l, s, l, s], None, gregorian(2097, 2, 12)), - PackedEastAsianTraditionalYearData::new(2098, [l, l, s, l, s, s, s, l, s, l, s, l, s], None, gregorian(2098, 2, 1)), - PackedEastAsianTraditionalYearData::new(2099, [l, l, s, l, l, s, s, l, s, s, l, s, l], Some(3), gregorian(2099, 1, 21)), - PackedEastAsianTraditionalYearData::new(2100, [l, l, s, l, s, l, s, l, s, s, l, s, s], None, gregorian(2100, 2, 9)), - // Extra two years of correct data because the simple calculation lines up at the beginning of 2103 - PackedEastAsianTraditionalYearData::new(2101, [l, l, s, l, l, s, l, s, l, s, s, l, s], Some(8), gregorian(2101, 1, 29)), - PackedEastAsianTraditionalYearData::new(2102, [l, s, l, l, s, l, s, l, l, s, l, s, s], None, gregorian(2102, 2, 17)), - ] -}; - -#[test] -fn test_against_calendrical_calculations() { - use calendrical_calculations::chinese_based::Chinese; - for (i, &data) in DATA.iter().enumerate() { - assert_eq!( - data, - super::EastAsianTraditionalYearData::calendrical_calculations::( - STARTING_YEAR + i as i32 - ) - .packed - ); - } -} diff --git a/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/korea_data.rs b/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/korea_data.rs deleted file mode 100644 index bf4cffc45cb724..00000000000000 --- a/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/korea_data.rs +++ /dev/null @@ -1,225 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -//! Data obtained from [`calendrical_calculations`]. - -use super::PackedEastAsianTraditionalYearData; - -pub const STARTING_YEAR: i32 = 1912; - -#[rustfmt::skip] -#[allow(clippy::unwrap_used)] // const -pub const DATA: &[PackedEastAsianTraditionalYearData] = { - use calendrical_calculations::gregorian::fixed_from_gregorian as gregorian; - let l = true; // long - let s = false; // short - &[ - PackedEastAsianTraditionalYearData::new(1912, [l, s, l, s, s, l, s, s, l, l, s, l, s], None, gregorian(1912, 2, 18)), - PackedEastAsianTraditionalYearData::new(1913, [l, l, s, l, s, s, l, s, s, l, s, l, s], None, gregorian(1913, 2, 6)), - PackedEastAsianTraditionalYearData::new(1914, [l, l, s, l, l, s, s, l, s, l, s, s, l], Some(6), gregorian(1914, 1, 26)), - PackedEastAsianTraditionalYearData::new(1915, [l, s, l, l, s, l, s, l, s, l, s, l, s], None, gregorian(1915, 2, 14)), - PackedEastAsianTraditionalYearData::new(1916, [s, l, s, l, s, l, l, s, l, s, l, s, s], None, gregorian(1916, 2, 4)), - PackedEastAsianTraditionalYearData::new(1917, [l, s, s, l, s, l, l, s, l, l, s, l, s], Some(3), gregorian(1917, 1, 23)), - PackedEastAsianTraditionalYearData::new(1918, [l, s, s, l, s, l, s, l, l, l, s, l, s], None, gregorian(1918, 2, 11)), - PackedEastAsianTraditionalYearData::new(1919, [s, l, s, s, l, s, l, s, l, l, s, l, l], Some(8), gregorian(1919, 2, 1)), - PackedEastAsianTraditionalYearData::new(1920, [s, l, s, s, l, s, s, l, l, s, l, l, s], None, gregorian(1920, 2, 20)), - PackedEastAsianTraditionalYearData::new(1921, [l, s, l, s, s, l, s, s, l, s, l, l, s], None, gregorian(1921, 2, 8)), - PackedEastAsianTraditionalYearData::new(1922, [l, s, l, l, s, s, l, s, s, l, s, l, l], Some(6), gregorian(1922, 1, 28)), - PackedEastAsianTraditionalYearData::new(1923, [s, l, l, s, l, s, l, s, l, s, s, l, s], None, gregorian(1923, 2, 16)), - PackedEastAsianTraditionalYearData::new(1924, [l, s, l, s, l, l, s, l, s, l, s, s, s], None, gregorian(1924, 2, 5)), - PackedEastAsianTraditionalYearData::new(1925, [l, s, l, l, s, l, s, l, l, s, l, s, l], Some(5), gregorian(1925, 1, 24)), - PackedEastAsianTraditionalYearData::new(1926, [s, s, l, s, l, s, l, l, s, l, l, s, s], None, gregorian(1926, 2, 13)), - PackedEastAsianTraditionalYearData::new(1927, [l, s, s, l, s, l, s, l, l, s, l, l, s], None, gregorian(1927, 2, 2)), - PackedEastAsianTraditionalYearData::new(1928, [s, l, s, s, l, s, s, l, l, s, l, l, l], Some(3), gregorian(1928, 1, 23)), - PackedEastAsianTraditionalYearData::new(1929, [s, l, s, s, l, s, s, l, s, l, l, l, s], None, gregorian(1929, 2, 10)), - PackedEastAsianTraditionalYearData::new(1930, [s, l, l, s, s, l, s, s, l, s, l, l, s], Some(7), gregorian(1930, 1, 30)), - PackedEastAsianTraditionalYearData::new(1931, [l, l, l, s, s, l, s, s, l, s, l, s, s], None, gregorian(1931, 2, 17)), - PackedEastAsianTraditionalYearData::new(1932, [l, l, l, s, l, s, l, s, s, l, s, l, s], None, gregorian(1932, 2, 6)), - PackedEastAsianTraditionalYearData::new(1933, [s, l, l, s, l, l, s, l, s, l, s, s, l], Some(6), gregorian(1933, 1, 26)), - PackedEastAsianTraditionalYearData::new(1934, [s, l, s, l, l, s, l, l, s, l, s, l, s], None, gregorian(1934, 2, 14)), - PackedEastAsianTraditionalYearData::new(1935, [s, s, l, s, l, s, l, l, s, l, l, s, s], None, gregorian(1935, 2, 4)), - PackedEastAsianTraditionalYearData::new(1936, [l, s, s, l, s, l, s, l, s, l, l, l, s], Some(4), gregorian(1936, 1, 24)), - PackedEastAsianTraditionalYearData::new(1937, [l, s, s, l, s, s, l, s, l, l, l, s, s], None, gregorian(1937, 2, 11)), - PackedEastAsianTraditionalYearData::new(1938, [l, l, s, s, l, s, s, l, s, l, l, s, l], Some(8), gregorian(1938, 1, 31)), - PackedEastAsianTraditionalYearData::new(1939, [l, l, s, s, l, s, s, l, s, l, s, l, s], None, gregorian(1939, 2, 19)), - PackedEastAsianTraditionalYearData::new(1940, [l, l, s, l, s, l, s, s, l, s, l, s, s], None, gregorian(1940, 2, 8)), - PackedEastAsianTraditionalYearData::new(1941, [l, l, s, l, l, s, l, s, s, l, s, l, s], Some(7), gregorian(1941, 1, 27)), - PackedEastAsianTraditionalYearData::new(1942, [l, s, l, l, s, l, l, s, l, s, s, l, s], None, gregorian(1942, 2, 15)), - PackedEastAsianTraditionalYearData::new(1943, [s, l, s, l, s, l, l, s, l, l, s, l, s], None, gregorian(1943, 2, 5)), - PackedEastAsianTraditionalYearData::new(1944, [s, s, l, s, l, s, l, s, l, l, s, l, l], Some(5), gregorian(1944, 1, 26)), - PackedEastAsianTraditionalYearData::new(1945, [s, s, l, s, s, l, s, l, l, l, s, l, s], None, gregorian(1945, 2, 13)), - PackedEastAsianTraditionalYearData::new(1946, [l, s, s, l, s, s, l, s, l, l, s, l, s], None, gregorian(1946, 2, 2)), - PackedEastAsianTraditionalYearData::new(1947, [l, l, s, s, l, s, s, l, s, l, s, l, l], Some(3), gregorian(1947, 1, 22)), - PackedEastAsianTraditionalYearData::new(1948, [l, s, l, s, l, s, s, l, s, l, s, l, s], None, gregorian(1948, 2, 10)), - PackedEastAsianTraditionalYearData::new(1949, [l, l, s, l, s, l, s, s, l, s, l, s, l], Some(8), gregorian(1949, 1, 29)), - PackedEastAsianTraditionalYearData::new(1950, [l, s, l, l, s, l, s, s, l, s, l, s, s], None, gregorian(1950, 2, 17)), - PackedEastAsianTraditionalYearData::new(1951, [l, s, l, l, s, l, s, l, s, l, s, l, s], None, gregorian(1951, 2, 6)), - PackedEastAsianTraditionalYearData::new(1952, [s, l, s, l, s, l, l, s, l, s, l, s, l], Some(6), gregorian(1952, 1, 27)), - PackedEastAsianTraditionalYearData::new(1953, [s, l, s, s, l, l, s, l, l, s, l, l, s], None, gregorian(1953, 2, 14)), - PackedEastAsianTraditionalYearData::new(1954, [s, s, l, s, s, l, s, l, l, s, l, l, s], None, gregorian(1954, 2, 4)), - PackedEastAsianTraditionalYearData::new(1955, [l, s, s, l, s, s, l, s, l, s, l, l, l], Some(4), gregorian(1955, 1, 24)), - PackedEastAsianTraditionalYearData::new(1956, [s, l, s, l, s, s, l, s, l, s, l, l, s], None, gregorian(1956, 2, 12)), - PackedEastAsianTraditionalYearData::new(1957, [l, s, l, s, l, s, s, l, s, l, s, l, l], Some(9), gregorian(1957, 1, 31)), - PackedEastAsianTraditionalYearData::new(1958, [s, l, l, s, l, s, s, l, s, l, s, l, s], None, gregorian(1958, 2, 19)), - PackedEastAsianTraditionalYearData::new(1959, [s, l, l, s, l, s, l, s, l, s, l, s, s], None, gregorian(1959, 2, 8)), - PackedEastAsianTraditionalYearData::new(1960, [l, s, l, s, l, l, s, l, s, l, s, l, s], Some(7), gregorian(1960, 1, 28)), - PackedEastAsianTraditionalYearData::new(1961, [l, s, l, s, l, s, l, l, s, l, s, l, s], None, gregorian(1961, 2, 15)), - PackedEastAsianTraditionalYearData::new(1962, [s, l, s, s, l, s, l, l, s, l, l, s, s], None, gregorian(1962, 2, 5)), - PackedEastAsianTraditionalYearData::new(1963, [l, s, l, s, s, l, s, l, s, l, l, l, s], Some(5), gregorian(1963, 1, 25)), - PackedEastAsianTraditionalYearData::new(1964, [l, s, l, s, s, l, s, l, s, l, l, l, s], None, gregorian(1964, 2, 13)), - PackedEastAsianTraditionalYearData::new(1965, [s, l, s, l, s, s, l, s, s, l, l, l, s], None, gregorian(1965, 2, 2)), - PackedEastAsianTraditionalYearData::new(1966, [s, l, l, s, l, s, s, l, s, s, l, l, s], Some(4), gregorian(1966, 1, 22)), - PackedEastAsianTraditionalYearData::new(1967, [l, l, s, l, l, s, s, l, s, l, s, l, s], None, gregorian(1967, 2, 9)), - PackedEastAsianTraditionalYearData::new(1968, [s, l, l, s, l, s, l, s, l, s, l, s, l], Some(8), gregorian(1968, 1, 30)), - PackedEastAsianTraditionalYearData::new(1969, [s, l, s, l, s, l, l, s, l, s, l, s, s], None, gregorian(1969, 2, 17)), - PackedEastAsianTraditionalYearData::new(1970, [l, s, s, l, l, s, l, s, l, l, s, l, s], None, gregorian(1970, 2, 6)), - PackedEastAsianTraditionalYearData::new(1971, [s, l, s, s, l, s, l, s, l, l, l, s, l], Some(6), gregorian(1971, 1, 27)), - PackedEastAsianTraditionalYearData::new(1972, [s, l, s, s, l, s, l, s, l, l, l, s, s], None, gregorian(1972, 2, 15)), - PackedEastAsianTraditionalYearData::new(1973, [l, s, l, s, s, l, s, s, l, l, l, s, s], None, gregorian(1973, 2, 3)), - PackedEastAsianTraditionalYearData::new(1974, [l, l, s, l, s, s, l, s, s, l, l, s, l], Some(5), gregorian(1974, 1, 23)), - PackedEastAsianTraditionalYearData::new(1975, [l, l, s, l, s, s, l, s, s, l, s, l, s], None, gregorian(1975, 2, 11)), - PackedEastAsianTraditionalYearData::new(1976, [l, l, s, l, s, l, s, l, s, l, s, s, l], Some(9), gregorian(1976, 1, 31)), - PackedEastAsianTraditionalYearData::new(1977, [l, s, l, l, s, l, s, l, s, l, s, s, s], None, gregorian(1977, 2, 18)), - PackedEastAsianTraditionalYearData::new(1978, [l, l, s, l, s, l, l, s, l, s, l, s, s], None, gregorian(1978, 2, 7)), - PackedEastAsianTraditionalYearData::new(1979, [l, s, s, l, s, l, l, s, l, l, s, l, s], Some(7), gregorian(1979, 1, 28)), - PackedEastAsianTraditionalYearData::new(1980, [l, s, s, l, s, l, s, l, l, s, l, l, s], None, gregorian(1980, 2, 16)), - PackedEastAsianTraditionalYearData::new(1981, [s, l, s, s, l, s, s, l, l, s, l, l, s], None, gregorian(1981, 2, 5)), - PackedEastAsianTraditionalYearData::new(1982, [l, s, l, s, s, l, s, s, l, l, s, l, l], Some(5), gregorian(1982, 1, 25)), - PackedEastAsianTraditionalYearData::new(1983, [l, s, l, s, s, l, s, s, l, s, l, l, s], None, gregorian(1983, 2, 13)), - PackedEastAsianTraditionalYearData::new(1984, [l, s, l, l, s, s, l, s, s, l, s, l, l], Some(11), gregorian(1984, 2, 2)), - PackedEastAsianTraditionalYearData::new(1985, [s, l, l, s, l, s, l, s, s, l, s, l, s], None, gregorian(1985, 2, 20)), - PackedEastAsianTraditionalYearData::new(1986, [s, l, l, s, l, l, s, l, s, l, s, s, s], None, gregorian(1986, 2, 9)), - PackedEastAsianTraditionalYearData::new(1987, [l, s, l, l, s, l, s, l, l, s, l, s, l], Some(7), gregorian(1987, 1, 29)), - PackedEastAsianTraditionalYearData::new(1988, [s, s, l, s, l, s, l, l, s, l, l, s, s], None, gregorian(1988, 2, 18)), - PackedEastAsianTraditionalYearData::new(1989, [l, s, s, l, s, l, s, l, l, s, l, l, s], None, gregorian(1989, 2, 6)), - PackedEastAsianTraditionalYearData::new(1990, [s, l, s, s, l, s, s, l, l, s, l, l, l], Some(6), gregorian(1990, 1, 27)), - PackedEastAsianTraditionalYearData::new(1991, [s, l, s, s, l, s, s, l, s, l, l, l, s], None, gregorian(1991, 2, 15)), - PackedEastAsianTraditionalYearData::new(1992, [s, l, l, s, s, l, s, s, l, s, l, l, s], None, gregorian(1992, 2, 4)), - PackedEastAsianTraditionalYearData::new(1993, [s, l, l, s, l, s, l, s, s, l, s, l, s], Some(4), gregorian(1993, 1, 23)), - PackedEastAsianTraditionalYearData::new(1994, [l, l, l, s, l, s, l, s, s, l, s, l, s], None, gregorian(1994, 2, 10)), - PackedEastAsianTraditionalYearData::new(1995, [s, l, l, s, l, l, s, l, s, l, s, s, l], Some(9), gregorian(1995, 1, 31)), - PackedEastAsianTraditionalYearData::new(1996, [s, l, s, l, l, s, l, s, l, l, s, l, s], None, gregorian(1996, 2, 19)), - PackedEastAsianTraditionalYearData::new(1997, [s, s, l, s, l, s, l, l, s, l, l, s, s], None, gregorian(1997, 2, 8)), - PackedEastAsianTraditionalYearData::new(1998, [l, s, s, l, s, s, l, l, s, l, l, l, s], Some(6), gregorian(1998, 1, 28)), - PackedEastAsianTraditionalYearData::new(1999, [l, s, s, l, s, s, l, s, l, l, l, s, s], None, gregorian(1999, 2, 16)), - PackedEastAsianTraditionalYearData::new(2000, [l, l, s, s, l, s, s, l, s, l, l, s, s], None, gregorian(2000, 2, 5)), - PackedEastAsianTraditionalYearData::new(2001, [l, l, l, s, s, l, s, s, l, s, l, s, l], Some(5), gregorian(2001, 1, 24)), - PackedEastAsianTraditionalYearData::new(2002, [l, l, s, l, s, l, s, s, l, s, l, s, s], None, gregorian(2002, 2, 12)), - PackedEastAsianTraditionalYearData::new(2003, [l, l, s, l, l, s, l, s, s, l, s, l, s], None, gregorian(2003, 2, 1)), - PackedEastAsianTraditionalYearData::new(2004, [s, l, s, l, l, s, l, s, l, s, l, s, l], Some(3), gregorian(2004, 1, 22)), - PackedEastAsianTraditionalYearData::new(2005, [s, l, s, l, s, l, l, s, l, l, s, s, s], None, gregorian(2005, 2, 9)), - PackedEastAsianTraditionalYearData::new(2006, [l, s, l, s, l, s, l, s, l, l, s, l, l], Some(8), gregorian(2006, 1, 29)), - PackedEastAsianTraditionalYearData::new(2007, [s, s, l, s, s, l, s, l, l, l, s, l, s], None, gregorian(2007, 2, 18)), - PackedEastAsianTraditionalYearData::new(2008, [l, s, s, l, s, s, l, s, l, l, s, l, s], None, gregorian(2008, 2, 7)), - PackedEastAsianTraditionalYearData::new(2009, [l, l, s, s, l, s, s, l, s, l, s, l, l], Some(6), gregorian(2009, 1, 26)), - PackedEastAsianTraditionalYearData::new(2010, [l, s, l, s, l, s, s, l, s, l, s, l, s], None, gregorian(2010, 2, 14)), - PackedEastAsianTraditionalYearData::new(2011, [l, s, l, l, s, l, s, s, l, s, l, s, s], None, gregorian(2011, 2, 3)), - PackedEastAsianTraditionalYearData::new(2012, [l, s, l, l, l, s, l, s, s, l, s, l, s], Some(4), gregorian(2012, 1, 23)), - PackedEastAsianTraditionalYearData::new(2013, [l, s, l, l, s, l, s, l, s, l, s, l, s], None, gregorian(2013, 2, 10)), - PackedEastAsianTraditionalYearData::new(2014, [s, l, s, l, s, l, s, l, l, s, l, s, l], Some(10), gregorian(2014, 1, 31)), - PackedEastAsianTraditionalYearData::new(2015, [s, l, s, s, l, s, l, l, l, s, l, s, s], None, gregorian(2015, 2, 19)), - PackedEastAsianTraditionalYearData::new(2016, [l, s, l, s, s, l, s, l, l, s, l, l, s], None, gregorian(2016, 2, 8)), - PackedEastAsianTraditionalYearData::new(2017, [s, l, s, l, s, s, l, s, l, s, l, l, l], Some(6), gregorian(2017, 1, 28)), - PackedEastAsianTraditionalYearData::new(2018, [s, l, s, l, s, s, l, s, l, s, l, l, s], None, gregorian(2018, 2, 16)), - PackedEastAsianTraditionalYearData::new(2019, [l, s, l, s, l, s, s, l, s, l, s, l, s], None, gregorian(2019, 2, 5)), - PackedEastAsianTraditionalYearData::new(2020, [l, s, l, l, s, l, s, s, l, s, l, s, l], Some(5), gregorian(2020, 1, 25)), - PackedEastAsianTraditionalYearData::new(2021, [s, l, l, s, l, s, l, s, l, s, l, s, s], None, gregorian(2021, 2, 12)), - PackedEastAsianTraditionalYearData::new(2022, [l, s, l, s, l, l, s, l, s, l, s, l, s], None, gregorian(2022, 2, 1)), - PackedEastAsianTraditionalYearData::new(2023, [s, l, s, l, s, l, s, l, l, s, l, s, l], Some(3), gregorian(2023, 1, 22)), - PackedEastAsianTraditionalYearData::new(2024, [s, l, s, s, l, s, l, l, s, l, l, s, s], None, gregorian(2024, 2, 10)), - PackedEastAsianTraditionalYearData::new(2025, [l, s, l, s, s, l, s, l, s, l, l, l, s], Some(7), gregorian(2025, 1, 29)), - PackedEastAsianTraditionalYearData::new(2026, [l, s, l, s, s, l, s, l, s, l, l, l, s], None, gregorian(2026, 2, 17)), - PackedEastAsianTraditionalYearData::new(2027, [s, l, s, l, s, s, l, s, s, l, l, l, s], None, gregorian(2027, 2, 7)), - PackedEastAsianTraditionalYearData::new(2028, [s, l, l, s, l, s, s, l, s, s, l, l, s], Some(6), gregorian(2028, 1, 27)), - PackedEastAsianTraditionalYearData::new(2029, [l, l, s, l, l, s, s, l, s, s, l, l, s], None, gregorian(2029, 2, 13)), - PackedEastAsianTraditionalYearData::new(2030, [s, l, s, l, l, s, l, s, l, s, l, s, s], None, gregorian(2030, 2, 3)), - PackedEastAsianTraditionalYearData::new(2031, [l, s, l, s, l, s, l, l, s, l, s, l, s], Some(4), gregorian(2031, 1, 23)), - PackedEastAsianTraditionalYearData::new(2032, [l, s, s, l, s, l, l, s, l, l, s, l, s], None, gregorian(2032, 2, 11)), - PackedEastAsianTraditionalYearData::new(2033, [s, l, s, s, l, s, l, s, l, l, l, s, l], Some(12), gregorian(2033, 1, 31)), - PackedEastAsianTraditionalYearData::new(2034, [s, l, s, s, l, s, l, s, l, l, l, s, s], None, gregorian(2034, 2, 19)), - PackedEastAsianTraditionalYearData::new(2035, [l, s, l, s, s, l, s, s, l, l, s, l, s], None, gregorian(2035, 2, 8)), - PackedEastAsianTraditionalYearData::new(2036, [l, l, s, l, s, s, l, s, s, l, l, s, l], Some(7), gregorian(2036, 1, 28)), - PackedEastAsianTraditionalYearData::new(2037, [l, l, s, l, s, s, l, s, s, l, s, l, s], None, gregorian(2037, 2, 15)), - PackedEastAsianTraditionalYearData::new(2038, [l, l, s, l, s, l, s, l, s, s, l, s, s], None, gregorian(2038, 2, 4)), - PackedEastAsianTraditionalYearData::new(2039, [l, l, s, l, l, s, l, s, l, s, l, s, s], Some(6), gregorian(2039, 1, 24)), - PackedEastAsianTraditionalYearData::new(2040, [l, s, l, l, s, l, l, s, l, s, l, s, s], None, gregorian(2040, 2, 12)), - PackedEastAsianTraditionalYearData::new(2041, [l, s, s, l, s, l, l, s, l, l, s, l, s], None, gregorian(2041, 2, 1)), - PackedEastAsianTraditionalYearData::new(2042, [s, l, s, s, l, s, l, s, l, l, s, l, l], Some(3), gregorian(2042, 1, 22)), - PackedEastAsianTraditionalYearData::new(2043, [s, l, s, s, l, s, s, l, l, s, l, l, s], None, gregorian(2043, 2, 10)), - PackedEastAsianTraditionalYearData::new(2044, [l, s, l, s, s, l, s, s, l, s, l, l, l], Some(8), gregorian(2044, 1, 30)), - PackedEastAsianTraditionalYearData::new(2045, [l, s, l, s, s, l, s, s, l, s, l, l, s], None, gregorian(2045, 2, 17)), - PackedEastAsianTraditionalYearData::new(2046, [l, s, l, l, s, s, l, s, s, l, s, l, s], None, gregorian(2046, 2, 6)), - PackedEastAsianTraditionalYearData::new(2047, [l, s, l, l, s, l, s, l, s, s, l, s, l], Some(6), gregorian(2047, 1, 26)), - PackedEastAsianTraditionalYearData::new(2048, [s, l, l, s, l, l, s, l, s, l, s, s, s], None, gregorian(2048, 2, 14)), - PackedEastAsianTraditionalYearData::new(2049, [l, s, l, s, l, l, s, l, l, s, l, s, s], None, gregorian(2049, 2, 2)), - PackedEastAsianTraditionalYearData::new(2050, [l, s, s, l, s, l, s, l, l, s, l, l, s], Some(4), gregorian(2050, 1, 23)), - PackedEastAsianTraditionalYearData::new(2051, [l, s, s, l, s, l, s, l, s, l, l, l, s], None, gregorian(2051, 2, 11)), - PackedEastAsianTraditionalYearData::new(2052, [s, l, s, s, l, s, s, l, l, s, l, l, l], Some(9), gregorian(2052, 2, 1)), - PackedEastAsianTraditionalYearData::new(2053, [s, l, s, s, l, s, s, l, s, l, l, l, s], None, gregorian(2053, 2, 19)), - PackedEastAsianTraditionalYearData::new(2054, [s, l, l, s, s, l, s, s, l, s, l, l, s], None, gregorian(2054, 2, 8)), - PackedEastAsianTraditionalYearData::new(2055, [s, l, l, s, l, s, l, s, s, l, s, l, s], Some(7), gregorian(2055, 1, 28)), - PackedEastAsianTraditionalYearData::new(2056, [l, l, l, s, l, s, l, s, s, l, s, l, s], None, gregorian(2056, 2, 15)), - PackedEastAsianTraditionalYearData::new(2057, [s, l, l, s, l, s, l, l, s, s, l, s, s], None, gregorian(2057, 2, 4)), - PackedEastAsianTraditionalYearData::new(2058, [l, s, l, s, l, l, s, l, s, l, l, s, s], Some(5), gregorian(2058, 1, 24)), - PackedEastAsianTraditionalYearData::new(2059, [l, s, l, s, l, s, l, l, s, l, l, s, s], None, gregorian(2059, 2, 12)), - PackedEastAsianTraditionalYearData::new(2060, [l, s, s, l, s, s, l, l, s, l, l, l, s], None, gregorian(2060, 2, 2)), - PackedEastAsianTraditionalYearData::new(2061, [s, l, s, s, l, s, s, l, s, l, l, l, s], Some(4), gregorian(2061, 1, 22)), - PackedEastAsianTraditionalYearData::new(2062, [l, l, s, s, l, s, s, l, s, l, l, s, s], None, gregorian(2062, 2, 9)), - PackedEastAsianTraditionalYearData::new(2063, [l, l, s, l, s, l, s, s, l, s, l, s, l], Some(8), gregorian(2063, 1, 29)), - PackedEastAsianTraditionalYearData::new(2064, [l, l, s, l, s, l, s, s, l, s, l, s, s], None, gregorian(2064, 2, 17)), - PackedEastAsianTraditionalYearData::new(2065, [l, l, s, l, l, s, l, s, s, l, s, l, s], None, gregorian(2065, 2, 5)), - PackedEastAsianTraditionalYearData::new(2066, [s, l, s, l, l, s, l, s, l, s, l, s, l], Some(6), gregorian(2066, 1, 26)), - PackedEastAsianTraditionalYearData::new(2067, [s, l, s, l, s, l, l, s, l, s, l, s, s], None, gregorian(2067, 2, 14)), - PackedEastAsianTraditionalYearData::new(2068, [l, s, l, s, l, s, l, s, l, l, s, l, s], None, gregorian(2068, 2, 3)), - PackedEastAsianTraditionalYearData::new(2069, [l, s, s, l, s, s, l, s, l, l, l, s, l], Some(5), gregorian(2069, 1, 23)), - PackedEastAsianTraditionalYearData::new(2070, [l, s, s, l, s, s, l, s, l, l, s, l, s], None, gregorian(2070, 2, 11)), - PackedEastAsianTraditionalYearData::new(2071, [l, l, s, s, l, s, s, l, s, l, s, l, l], Some(9), gregorian(2071, 1, 31)), - PackedEastAsianTraditionalYearData::new(2072, [l, s, l, s, l, s, s, l, s, l, s, l, s], None, gregorian(2072, 2, 19)), - PackedEastAsianTraditionalYearData::new(2073, [l, s, l, l, s, l, s, s, l, s, l, s, s], None, gregorian(2073, 2, 7)), - PackedEastAsianTraditionalYearData::new(2074, [l, s, l, l, s, l, s, l, s, l, s, l, s], Some(7), gregorian(2074, 1, 27)), - PackedEastAsianTraditionalYearData::new(2075, [l, s, l, s, l, l, s, l, s, l, s, l, s], None, gregorian(2075, 2, 15)), - PackedEastAsianTraditionalYearData::new(2076, [s, l, s, l, s, l, s, l, l, s, l, s, s], None, gregorian(2076, 2, 5)), - PackedEastAsianTraditionalYearData::new(2077, [l, s, l, s, s, l, s, l, l, l, s, l, s], Some(5), gregorian(2077, 1, 24)), - PackedEastAsianTraditionalYearData::new(2078, [l, s, l, s, s, l, s, l, l, s, l, l, s], None, gregorian(2078, 2, 12)), - PackedEastAsianTraditionalYearData::new(2079, [s, l, s, l, s, s, l, s, l, s, l, l, s], None, gregorian(2079, 2, 2)), - PackedEastAsianTraditionalYearData::new(2080, [l, s, l, s, l, s, s, l, s, l, s, l, l], Some(4), gregorian(2080, 1, 22)), - PackedEastAsianTraditionalYearData::new(2081, [l, s, l, s, l, s, s, l, s, s, l, l, s], None, gregorian(2081, 2, 9)), - PackedEastAsianTraditionalYearData::new(2082, [s, l, l, l, s, l, s, s, l, s, l, s, l], Some(8), gregorian(2082, 1, 29)), - PackedEastAsianTraditionalYearData::new(2083, [s, l, l, s, l, s, l, s, l, s, l, s, s], None, gregorian(2083, 2, 17)), - PackedEastAsianTraditionalYearData::new(2084, [l, s, l, s, l, l, s, l, s, l, s, l, s], None, gregorian(2084, 2, 6)), - PackedEastAsianTraditionalYearData::new(2085, [s, l, s, s, l, l, s, l, l, s, l, s, l], Some(6), gregorian(2085, 1, 26)), - PackedEastAsianTraditionalYearData::new(2086, [s, l, s, s, l, s, l, l, s, l, l, s, s], None, gregorian(2086, 2, 14)), - PackedEastAsianTraditionalYearData::new(2087, [l, s, l, s, s, l, s, l, s, l, l, l, s], None, gregorian(2087, 2, 3)), - PackedEastAsianTraditionalYearData::new(2088, [s, l, s, l, s, s, l, s, s, l, l, l, l], Some(5), gregorian(2088, 1, 24)), - PackedEastAsianTraditionalYearData::new(2089, [s, l, s, l, s, s, l, s, s, l, l, s, s], None, gregorian(2089, 2, 11)), - PackedEastAsianTraditionalYearData::new(2090, [l, l, l, s, l, s, s, l, s, s, l, l, s], Some(9), gregorian(2090, 1, 30)), - PackedEastAsianTraditionalYearData::new(2091, [l, l, s, l, s, l, s, l, s, s, l, l, s], None, gregorian(2091, 2, 18)), - PackedEastAsianTraditionalYearData::new(2092, [s, l, s, l, l, s, l, s, l, s, l, s, s], None, gregorian(2092, 2, 8)), - PackedEastAsianTraditionalYearData::new(2093, [l, s, l, s, l, s, l, l, s, l, s, l, s], Some(7), gregorian(2093, 1, 27)), - PackedEastAsianTraditionalYearData::new(2094, [l, s, s, l, s, l, l, s, l, l, s, l, s], None, gregorian(2094, 2, 15)), - PackedEastAsianTraditionalYearData::new(2095, [s, l, s, s, l, s, l, s, l, l, l, s, s], None, gregorian(2095, 2, 5)), - PackedEastAsianTraditionalYearData::new(2096, [l, s, l, s, s, l, s, l, s, l, l, s, l], Some(5), gregorian(2096, 1, 25)), - PackedEastAsianTraditionalYearData::new(2097, [l, s, l, s, s, l, s, s, l, l, s, l, s], None, gregorian(2097, 2, 12)), - PackedEastAsianTraditionalYearData::new(2098, [l, l, s, l, s, s, l, s, s, l, l, s, s], None, gregorian(2098, 2, 1)), - PackedEastAsianTraditionalYearData::new(2099, [l, l, l, s, l, s, s, l, s, s, l, s, l], Some(4), gregorian(2099, 1, 21)), - PackedEastAsianTraditionalYearData::new(2100, [l, l, s, l, s, l, s, l, s, s, l, s, s], None, gregorian(2100, 2, 9)), - // Extra two years of correct data because the simple calculation lines up at the beginning of 2103 - PackedEastAsianTraditionalYearData::new(2101, [l, l, s, l, l, s, l, s, l, s, l, s, s], Some(8), gregorian(2101, 1, 29)), - PackedEastAsianTraditionalYearData::new(2102, [l, s, l, l, s, l, s, l, l, s, l, s, s], None, gregorian(2102, 2, 17)), - ] -}; - -#[test] -fn test_against_calendrical_calculations() { - use calendrical_calculations::chinese_based::Dangi; - for (i, &data) in DATA.iter().enumerate() { - assert_eq!( - data, - super::EastAsianTraditionalYearData::calendrical_calculations::( - STARTING_YEAR + i as i32 - ) - .packed - ); - } -} diff --git a/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/qing_data.rs b/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/qing_data.rs deleted file mode 100644 index c107d7f82118ef..00000000000000 --- a/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/qing_data.rs +++ /dev/null @@ -1,32 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -//! This data is confirmed by both the [Korea Astronomy and Space Science Institute](https://astro.kasi.re.kr/life/pageView/5), -//! as well as the [Hong Kong Observatory](https://www.hko.gov.hk/en/gts/time/conversion.htm). - -use super::PackedEastAsianTraditionalYearData; - -pub const STARTING_YEAR: i32 = 1900; - -#[rustfmt::skip] -#[allow(clippy::unwrap_used)] // const -pub const DATA: &[PackedEastAsianTraditionalYearData] = { - use calendrical_calculations::gregorian::fixed_from_gregorian as gregorian; - let l = true; // long - let s = false; // short - &[ - PackedEastAsianTraditionalYearData::new(1900, [s, l, s, s, l, s, l, l, s, l, l, s, l], Some(9), gregorian(1900, 1, 31)), - PackedEastAsianTraditionalYearData::new(1901, [s, l, s, s, l, s, l, s, l, l, l, s, s], None, gregorian(1901, 2, 19)), - PackedEastAsianTraditionalYearData::new(1902, [l, s, l, s, s, l, s, l, s, l, l, l, s], None, gregorian(1902, 2, 8)), - PackedEastAsianTraditionalYearData::new(1903, [s, l, s, l, s, s, l, s, s, l, l, s, l], Some(6), gregorian(1903, 1, 29)), - PackedEastAsianTraditionalYearData::new(1904, [l, l, s, l, s, s, l, s, s, l, l, s, s], None, gregorian(1904, 2, 16)), - PackedEastAsianTraditionalYearData::new(1905, [l, l, s, l, l, s, s, l, s, l, s, l, s], None, gregorian(1905, 2, 4)), - PackedEastAsianTraditionalYearData::new(1906, [s, l, l, s, l, s, l, s, l, s, l, s, l], Some(5), gregorian(1906, 1, 25)), - PackedEastAsianTraditionalYearData::new(1907, [s, l, s, l, s, l, l, s, l, s, l, s, s], None, gregorian(1907, 2, 13)), - PackedEastAsianTraditionalYearData::new(1908, [l, s, s, l, l, s, l, s, l, l, s, l, s], None, gregorian(1908, 2, 2)), - PackedEastAsianTraditionalYearData::new(1909, [s, l, s, s, l, s, l, s, l, l, l, s, l], Some(3), gregorian(1909, 1, 22)), - PackedEastAsianTraditionalYearData::new(1910, [s, l, s, s, l, s, l, s, l, l, l, s, s], None, gregorian(1910, 2, 10)), - PackedEastAsianTraditionalYearData::new(1911, [l, s, l, s, s, l, s, s, l, l, s, l, l], Some(7), gregorian(1911, 1, 30)), - ] -}; diff --git a/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/simple.rs b/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/simple.rs deleted file mode 100644 index 851e7371349a7b..00000000000000 --- a/deps/crates/vendor/icu_calendar/src/cal/east_asian_traditional/simple.rs +++ /dev/null @@ -1,190 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -use super::EastAsianTraditionalYearData; -use calendrical_calculations::{gregorian::DAYS_IN_400_YEAR_CYCLE, rata_die::RataDie}; - -macro_rules! day_fraction_to_ms { - ($n:tt $(/ $d:tt)+) => {{ - Milliseconds((MILLISECONDS_IN_EPHEMERIS_DAY as i128 * $n as i128 $( / $d as i128)+) as i64) - }}; - ($n:tt $(/ $d:tt)+, exact) => {{ - let d = day_fraction_to_ms!($n $(/ $d)+); - assert!((d.0 as i128 $(* $d as i128)+) % MILLISECONDS_IN_EPHEMERIS_DAY as i128 == 0, "inexact"); - d - }}; -} - -pub(super) const UTC_PLUS_8: Milliseconds = day_fraction_to_ms!(8 / 24); -pub(super) const UTC_PLUS_9: Milliseconds = day_fraction_to_ms!(9 / 24); -// Reference time was UTC+(1397/180) -pub(super) const BEIJING_UTC_OFFSET: Milliseconds = day_fraction_to_ms!(1397 / 180 / 24); - -/// The mean year length according to the Gregorian solar cycle. -const MEAN_GREGORIAN_YEAR_LENGTH: Milliseconds = - day_fraction_to_ms!(DAYS_IN_400_YEAR_CYCLE / 400, exact); - -/// The mean solar term length according to the Gregorian solar cycle -const MEAN_GREGORIAN_SOLAR_TERM_LENGTH: Milliseconds = - day_fraction_to_ms!(DAYS_IN_400_YEAR_CYCLE / 400 / 12, exact); - -/// The mean synodic length on Jan 1 2000 according to the [Astronomical Almanac (1992)]. -/// -/// [Astronomical Almanac (1992)]: https://archive.org/details/131123ExplanatorySupplementAstronomicalAlmanac/page/n302/mode/1up -const MEAN_SYNODIC_MONTH_LENGTH: Milliseconds = day_fraction_to_ms!(295305888531 / 10000000000i64); - -/// Number of milliseconds in a day. -const MILLISECONDS_IN_EPHEMERIS_DAY: i64 = 24 * 60 * 60 * 1000; - -// 1999-12-22T07:44, https://aa.usno.navy.mil/calculated/seasons?year=2024&tz=0.00&tz_sign=-1&tz_label=false&dst=false -const UTC_SOLSTICE: LocalMoment = LocalMoment { - rata_die: calendrical_calculations::gregorian::fixed_from_gregorian(1999, 12, 22), - local_milliseconds: ((7 * 60) + 44) * 60 * 1000, -}; - -// 2000-01-06T18:14 https://aa.usno.navy.mil/calculated/moon/phases?date=2000-01-01&nump=1&format=t -const UTC_NEW_MOON: LocalMoment = LocalMoment { - rata_die: calendrical_calculations::gregorian::fixed_from_gregorian(2000, 1, 6), - local_milliseconds: ((18 * 60) + 14) * 60 * 1000, -}; - -#[derive(Debug, Copy, Clone, Default)] -pub(super) struct Milliseconds(i64); - -#[derive(Debug, Copy, Clone)] -struct LocalMoment { - rata_die: RataDie, - local_milliseconds: u32, -} - -impl core::ops::Add for LocalMoment { - type Output = Self; - - fn add(self, Milliseconds(duration): Milliseconds) -> Self::Output { - let temp = self.local_milliseconds as i64 + duration; - Self { - rata_die: self.rata_die + temp.div_euclid(MILLISECONDS_IN_EPHEMERIS_DAY), - local_milliseconds: temp.rem_euclid(MILLISECONDS_IN_EPHEMERIS_DAY) as u32, - } - } -} - -impl super::EastAsianTraditionalYearData { - /// A fast approximation for the Chinese calendar, inspired by the _píngqì_ (平氣) rule - /// used in the Ming dynasty. - /// - /// Stays anchored in the Gregorian calendar, even as the Gregorian calendar drifts - /// from the seasons in the distant future and distant past. - pub(super) fn simple( - utc_offset: Milliseconds, - related_iso: i32, - ) -> EastAsianTraditionalYearData { - /// calculates the largest moment such that moment = base_moment + n * duration lands on rata_die (< rata_die + 1) - fn periodic_duration_on_or_before( - rata_die: RataDie, - base_moment: LocalMoment, - duration: Milliseconds, - ) -> LocalMoment { - let diff_millis = (rata_die - base_moment.rata_die) * MILLISECONDS_IN_EPHEMERIS_DAY - - base_moment.local_milliseconds as i64; - - let num_periods = - (diff_millis + MILLISECONDS_IN_EPHEMERIS_DAY - 1).div_euclid(duration.0); - - let millis = base_moment.rata_die.to_i64_date() * MILLISECONDS_IN_EPHEMERIS_DAY - + base_moment.local_milliseconds as i64 - + num_periods * duration.0; - - // Note: this is Euclidean div/rem, but this more optimized, because - // we know that our divisor is positive - let rata_die = millis / MILLISECONDS_IN_EPHEMERIS_DAY - (millis < 0) as i64; - let local_milliseconds = millis % MILLISECONDS_IN_EPHEMERIS_DAY - + (millis < 0) as i64 * MILLISECONDS_IN_EPHEMERIS_DAY; - - LocalMoment { - rata_die: RataDie::new(rata_die), - local_milliseconds: local_milliseconds as u32, - } - } - - let mut major_solar_term = periodic_duration_on_or_before( - calendrical_calculations::iso::day_before_year(related_iso), - UTC_SOLSTICE + utc_offset, - MEAN_GREGORIAN_YEAR_LENGTH, - ); - - let mut new_moon = periodic_duration_on_or_before( - major_solar_term.rata_die, - UTC_NEW_MOON + utc_offset, - MEAN_SYNODIC_MONTH_LENGTH, - ); - - let mut next_new_moon = new_moon + MEAN_SYNODIC_MONTH_LENGTH; - - // The solstice is in the month of the 11th solar term of the previous year - let mut solar_term = -2; - let mut had_leap_in_sui = false; - - // Skip the months before the year (M11, maybe M11L, M12, maybe M12L) - while solar_term < 0 - || (next_new_moon.rata_die <= major_solar_term.rata_die && !had_leap_in_sui) - { - if next_new_moon.rata_die <= major_solar_term.rata_die && !had_leap_in_sui { - had_leap_in_sui = true; - } else { - solar_term += 1; - major_solar_term = major_solar_term + MEAN_GREGORIAN_SOLAR_TERM_LENGTH; - } - - (new_moon, next_new_moon) = (next_new_moon, next_new_moon + MEAN_SYNODIC_MONTH_LENGTH); - } - - debug_assert_eq!(solar_term, 0); - - let start_day = new_moon.rata_die; - let mut month_lengths = [false; 13]; - let mut leap_month = None; - - // Iterate over the 12 solar terms, producing potentially 13 months - while solar_term < 12 - || (next_new_moon.rata_die <= major_solar_term.rata_die && !had_leap_in_sui) - { - *month_lengths - .get_mut(solar_term as usize + leap_month.is_some() as usize) - .unwrap_or(&mut false) = next_new_moon.rata_die - new_moon.rata_die == 30; - - if next_new_moon.rata_die <= major_solar_term.rata_die && !had_leap_in_sui { - had_leap_in_sui = true; - leap_month = Some(solar_term as u8 + 1); - } else { - solar_term += 1; - major_solar_term = major_solar_term + MEAN_GREGORIAN_SOLAR_TERM_LENGTH; - } - - (new_moon, next_new_moon) = (next_new_moon, next_new_moon + MEAN_SYNODIC_MONTH_LENGTH); - } - - debug_assert_eq!(solar_term, 12); - - EastAsianTraditionalYearData::new(related_iso, start_day, month_lengths, leap_month) - } -} - -#[test] -fn bounds() { - EastAsianTraditionalYearData::simple(UTC_PLUS_9, 292_277_025); - assert!( - std::panic::catch_unwind(|| EastAsianTraditionalYearData::simple(UTC_PLUS_9, 292_277_026)) - .is_err() - ); - - EastAsianTraditionalYearData::simple(BEIJING_UTC_OFFSET, -292_275_024); - assert!( - std::panic::catch_unwind(|| EastAsianTraditionalYearData::simple( - BEIJING_UTC_OFFSET, - -292_275_025 - )) - .is_err() - ); -} diff --git a/deps/crates/vendor/icu_calendar/src/cal/ethiopian.rs b/deps/crates/vendor/icu_calendar/src/cal/ethiopian.rs index 559864e2f765c5..3fd0cb96a07b58 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/ethiopian.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/ethiopian.rs @@ -2,27 +2,33 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::cal::coptic::CopticDateInner; -use crate::cal::Coptic; -use crate::calendar_arithmetic::{ArithmeticDate, DateFieldsResolver}; -use crate::error::{ - DateError, DateFromFieldsError, EcmaReferenceYearError, MonthCodeError, UnknownEraError, -}; -use crate::options::DateFromFieldsOptions; -use crate::options::{DateAddOptions, DateDifferenceOptions}; -use crate::types::DateFields; -use crate::{types, Calendar, Date, RangeError}; +//! This module contains types and implementations for the Ethiopian calendar. +//! +//! ```rust +//! use icu::calendar::{cal::Ethiopian, Date}; +//! +//! let date_iso = Date::try_new_iso(1970, 1, 2) +//! .expect("Failed to initialize ISO Date instance."); +//! let date_ethiopian = Date::new_from_iso(date_iso, Ethiopian::new()); +//! +//! assert_eq!(date_ethiopian.era_year().year, 1962); +//! assert_eq!(date_ethiopian.month().ordinal, 4); +//! assert_eq!(date_ethiopian.day_of_month().0, 24); +//! ``` + +use crate::cal::iso::{Iso, IsoDateInner}; +use crate::calendar_arithmetic::{ArithmeticDate, CalendarArithmetic}; +use crate::error::{year_check, DateError}; +use crate::{types, Calendar, Date, DateDuration, DateDurationUnit, RangeError}; +use calendrical_calculations::helpers::I32CastError; use calendrical_calculations::rata_die::RataDie; use tinystr::tinystr; -/// The Coptic year of the Amete Mihret epoch -const AMETE_MIHRET_OFFSET: i32 = -276; - -/// The Coptic year of the Amete Alem epoch -const AMETE_ALEM_OFFSET: i32 = -5776; +/// The number of years the Amete Alem epoch precedes the Amete Mihret epoch +const INCARNATION_OFFSET: i32 = 5500; /// Which era style the ethiopian calendar uses -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] #[non_exhaustive] pub enum EthiopianEraStyle { /// Use the Anno Mundi era, anchored at the date of Creation, followed by the @@ -32,110 +38,74 @@ pub enum EthiopianEraStyle { AmeteAlem, } -/// The [Ethiopian Calendar](https://en.wikipedia.org/wiki/Ethiopian_calendar) +/// The [Ethiopian Calendar] /// -/// The Ethiopian calendar is a variant of the [`Coptic`] calendar. It differs -/// from the Coptic calendar by the names of the months as well as the era. +/// The [Ethiopian calendar] is a solar calendar used by the Coptic Orthodox Church, with twelve normal months +/// and a thirteenth small epagomenal month. /// -/// This implementation can be constructed in two modes: using the Amete Alem era -/// scheme, or the Amete Mihret era scheme (the default), see [`EthiopianEraStyle`] -/// for more info. +/// This type can be used with [`Date`] to represent dates in this calendar. /// -/// This implementation extends proleptically for dates before the calendar's creation. +/// It can be constructed in two modes: using the Amete Alem era scheme, or the Amete Mihret era scheme (the default), +/// see [`EthiopianEraStyle`] for more info. /// -/// This corresponds to the `"ethiopic"` and `"ethioaa"` [CLDR calendars](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier), -/// with `"ethiopic"` being for [`EthiopianEraStyle::AmeteMihret`] +/// [Ethiopian calendar]: https://en.wikipedia.org/wiki/Ethiopian_calendar /// /// # Era codes /// /// This calendar always uses the `aa` era, where 1 Amete Alem is 5493 BCE. Dates before this era use negative years. /// Dates before that use negative year numbers. -/// /// In the Amete Mihret scheme it uses the additional `am` era, 1 Amete Mihret is 9 CE. /// -/// # Months and days -/// -/// The 13 months are called Mäskäräm (`M01`, 30 days), Ṭəqəmt (`M02`, 30 days), -/// Ḫədar (`M03`, 30 days), Taḫśaś (`M04`, 30 days), Ṭərr (`M05`, 30 days), Yäkatit (`M06`, 30 days), -/// Mägabit (`M07`, 30 days), Miyazya (`M08`, 30 days), Gənbo (`M09`, 30 days), -/// Säne (`M10`, 30 days), Ḥamle (`M11`, 30 days), Nähase (`M12`, 30 days), Ṗagʷəmen (`M13`, 5 days). -/// -/// In leap years (years divisible by 4), Ṗagʷəmen gains a 6th day. +/// # Month codes /// -/// Standard years thus have 365 days, and leap years 366. -/// -/// # Calendar drift -/// -/// The Ethiopian calendar has the same year lengths and leap year rules as the [`Coptic`] and -/// [`Julian`](crate::cal::Julian) calendars, so it experiences the same drift of 1 day in ~128 -/// years with respect to the seasons. -#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] -pub struct Ethiopian(EthiopianEraStyle); +/// This calendar supports 13 solar month codes (`"M01" - "M13"`), with `"M13"` being used for the short epagomenal month +/// at the end of the year. +// The bool specifies whether dates should be in the Amete Alem era scheme +#[derive(Copy, Clone, Debug, Hash, Default, Eq, PartialEq, PartialOrd, Ord)] +pub struct Ethiopian(pub(crate) bool); -impl Default for Ethiopian { - fn default() -> Self { - Self(EthiopianEraStyle::AmeteMihret) - } -} - -#[allow(missing_docs)] // not actually public +/// The inner date type used for representing [`Date`]s of [`Ethiopian`]. See [`Date`] and [`Ethiopian`] for more details. #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] -pub struct EthiopianDateInner(CopticDateInner); +pub struct EthiopianDateInner(ArithmeticDate); -impl DateFieldsResolver for Ethiopian { - // Coptic year +impl CalendarArithmetic for Ethiopian { type YearInfo = i32; - fn days_in_provided_month(year: Self::YearInfo, month: u8) -> u8 { - Coptic::days_in_provided_month(year, month) - } - - fn months_in_provided_year(year: Self::YearInfo) -> u8 { - Coptic::months_in_provided_year(year) + fn days_in_provided_month(year: i32, month: u8) -> u8 { + if (1..=12).contains(&month) { + 30 + } else if month == 13 { + if Self::provided_year_is_leap(year) { + 6 + } else { + 5 + } + } else { + 0 + } } - #[inline] - fn year_info_from_era( - &self, - era: &[u8], - era_year: i32, - ) -> Result { - match (self.era_style(), era) { - (EthiopianEraStyle::AmeteMihret, b"am") => Ok(era_year + AMETE_MIHRET_OFFSET), - (_, b"aa") => Ok(era_year + AMETE_ALEM_OFFSET), - (_, _) => Err(UnknownEraError), - } + fn months_in_provided_year(_: i32) -> u8 { + 13 } - #[inline] - fn year_info_from_extended(&self, extended_year: i32) -> Self::YearInfo { - extended_year - + if self.0 == EthiopianEraStyle::AmeteMihret { - AMETE_MIHRET_OFFSET - } else { - AMETE_ALEM_OFFSET - } + fn provided_year_is_leap(year: i32) -> bool { + year.rem_euclid(4) == 3 } - #[inline] - fn reference_year_from_month_day( - &self, - month_code: types::ValidMonthCode, - day: u8, - ) -> Result { - crate::cal::Coptic::reference_year_from_month_day(month_code, day) + fn last_month_day_in_provided_year(year: i32) -> (u8, u8) { + if Self::provided_year_is_leap(year) { + (13, 6) + } else { + (13, 5) + } } - #[inline] - fn ordinal_month_from_code( - &self, - _year: &Self::YearInfo, - month_code: types::ValidMonthCode, - _options: DateFromFieldsOptions, - ) -> Result { - match month_code.to_tuple() { - (month_number @ 1..=13, false) => Ok(month_number), - _ => Err(MonthCodeError::NotInCalendar), + fn days_in_provided_year(year: i32) -> u16 { + if Self::provided_year_is_leap(year) { + 366 + } else { + 365 } } } @@ -143,9 +113,7 @@ impl DateFieldsResolver for Ethiopian { impl crate::cal::scaffold::UnstableSealed for Ethiopian {} impl Calendar for Ethiopian { type DateInner = EthiopianDateInner; - type Year = ::Year; - type DifferenceError = ::DifferenceError; - + type Year = types::EraYear; fn from_codes( &self, era: Option<&str>, @@ -153,111 +121,123 @@ impl Calendar for Ethiopian { month_code: types::MonthCode, day: u8, ) -> Result { - ArithmeticDate::from_codes(era, year, month_code, day, self) - .map(ArithmeticDate::cast) - .map(CopticDateInner) - .map(EthiopianDateInner) - } - - #[cfg(feature = "unstable")] - fn from_fields( - &self, - fields: DateFields, - options: DateFromFieldsOptions, - ) -> Result { - ArithmeticDate::from_fields(fields, options, self) - .map(ArithmeticDate::cast) - .map(CopticDateInner) - .map(EthiopianDateInner) + let year = match (self.era_style(), era) { + (EthiopianEraStyle::AmeteMihret, Some("am") | None) => { + year_check(year, 1..)? + INCARNATION_OFFSET + } + (EthiopianEraStyle::AmeteMihret, Some("aa")) => { + year_check(year, ..=INCARNATION_OFFSET)? + } + (EthiopianEraStyle::AmeteAlem, Some("aa") | None) => year, + (_, Some(_)) => { + return Err(DateError::UnknownEra); + } + }; + ArithmeticDate::new_from_codes(self, year, month_code, day).map(EthiopianDateInner) } fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { - EthiopianDateInner(Coptic.from_rata_die(rd)) + EthiopianDateInner( + match calendrical_calculations::ethiopian::ethiopian_from_fixed(rd) { + Err(I32CastError::BelowMin) => ArithmeticDate::min_date(), + Err(I32CastError::AboveMax) => ArithmeticDate::max_date(), + Ok((year, month, day)) => ArithmeticDate::new_unchecked( + // calendrical calculations returns years in the Incarnation era + year + INCARNATION_OFFSET, + month, + day, + ), + }, + ) } fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { - Coptic.to_rata_die(&date.0) + // calendrical calculations expects years in the Incarnation era + calendrical_calculations::ethiopian::fixed_from_ethiopian( + date.0.year - INCARNATION_OFFSET, + date.0.month, + date.0.day, + ) + } + + fn from_iso(&self, iso: IsoDateInner) -> EthiopianDateInner { + self.from_rata_die(Iso.to_rata_die(&iso)) } - fn has_cheap_iso_conversion(&self) -> bool { - false + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + Iso.from_rata_die(self.to_rata_die(date)) } fn months_in_year(&self, date: &Self::DateInner) -> u8 { - Coptic.months_in_year(&date.0) + date.0.months_in_year() } fn days_in_year(&self, date: &Self::DateInner) -> u16 { - Coptic.days_in_year(&date.0) + date.0.days_in_year() } fn days_in_month(&self, date: &Self::DateInner) -> u8 { - Coptic.days_in_month(&date.0) + date.0.days_in_month() } - #[cfg(feature = "unstable")] - fn add( - &self, - date: &Self::DateInner, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result { - Coptic - .add(&date.0, duration, options) - .map(EthiopianDateInner) + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + date.0.offset_date(offset, &()); } - #[cfg(feature = "unstable")] + #[allow(clippy::field_reassign_with_default)] fn until( &self, date1: &Self::DateInner, date2: &Self::DateInner, - options: DateDifferenceOptions, - ) -> Result { - Coptic.until(&date1.0, &date2.0, options) + _calendar2: &Self, + _largest_unit: DateDurationUnit, + _smallest_unit: DateDurationUnit, + ) -> DateDuration { + date1.0.until(date2.0, _largest_unit, _smallest_unit) } fn year_info(&self, date: &Self::DateInner) -> Self::Year { - let coptic_year = date.0 .0.year; - let extended_year = if self.0 == EthiopianEraStyle::AmeteAlem { - coptic_year - AMETE_ALEM_OFFSET - } else { - coptic_year - AMETE_MIHRET_OFFSET - }; - - if self.0 == EthiopianEraStyle::AmeteAlem || extended_year <= 0 { + let year = date.0.year; + if self.0 || year <= INCARNATION_OFFSET { types::EraYear { era: tinystr!(16, "aa"), era_index: Some(0), - year: coptic_year - AMETE_ALEM_OFFSET, - extended_year, + year, ambiguity: types::YearAmbiguity::CenturyRequired, } } else { types::EraYear { era: tinystr!(16, "am"), era_index: Some(1), - year: coptic_year - AMETE_MIHRET_OFFSET, - extended_year, + year: year - INCARNATION_OFFSET, ambiguity: types::YearAmbiguity::CenturyRequired, } } } + fn extended_year(&self, date: &Self::DateInner) -> i32 { + let year = date.0.extended_year(); + if self.0 { + year + } else { + year - INCARNATION_OFFSET + } + } + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { - Coptic.is_in_leap_year(&date.0) + Self::provided_year_is_leap(date.0.year) } fn month(&self, date: &Self::DateInner) -> types::MonthInfo { - Coptic.month(&date.0) + date.0.month() } fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { - Coptic.day_of_month(&date.0) + date.0.day_of_month() } fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { - Coptic.day_of_year(&date.0) + date.0.day_of_year() } fn debug_name(&self) -> &'static str { @@ -272,17 +252,20 @@ impl Calendar for Ethiopian { impl Ethiopian { /// Construct a new Ethiopian Calendar for the Amete Mihret era naming scheme pub const fn new() -> Self { - Self(EthiopianEraStyle::AmeteMihret) + Self(false) } - - /// Construct a new Ethiopian Calendar with an explicit [`EthiopianEraStyle`]. + /// Construct a new Ethiopian Calendar with a value specifying whether or not it is Amete Alem pub const fn new_with_era_style(era_style: EthiopianEraStyle) -> Self { - Self(era_style) + Self(matches!(era_style, EthiopianEraStyle::AmeteAlem)) } - /// Returns the [`EthiopianEraStyle`] used by this calendar. + /// Returns whether this has the Amete Alem era pub fn era_style(&self) -> EthiopianEraStyle { - self.0 + if self.0 { + EthiopianEraStyle::AmeteAlem + } else { + EthiopianEraStyle::AmeteMihret + } } } @@ -303,15 +286,16 @@ impl Date { /// ``` pub fn try_new_ethiopian( era_style: EthiopianEraStyle, - year: i32, + mut year: i32, month: u8, day: u8, ) -> Result, RangeError> { - let year = Ethiopian(era_style).year_info_from_extended(year); - ArithmeticDate::try_from_ymd(year, month, day) - .map(CopticDateInner) + if era_style == EthiopianEraStyle::AmeteAlem { + year -= INCARNATION_OFFSET; + } + ArithmeticDate::new_from_ordinals(year, month, day) .map(EthiopianDateInner) - .map(|inner| Date::from_raw(inner, Ethiopian(era_style))) + .map(|inner| Date::from_raw(inner, Ethiopian::new_with_era_style(era_style))) } } @@ -347,7 +331,10 @@ mod test { #[test] fn test_iso_to_ethiopian_aa_conversion_and_back() { let iso_date = Date::try_new_iso(1970, 1, 2).unwrap(); - let date_ethiopian = Date::new_from_iso(iso_date, Ethiopian(EthiopianEraStyle::AmeteAlem)); + let date_ethiopian = Date::new_from_iso( + iso_date, + Ethiopian::new_with_era_style(EthiopianEraStyle::AmeteAlem), + ); assert_eq!(date_ethiopian.extended_year(), 7462); assert_eq!(date_ethiopian.month().ordinal, 4); @@ -373,7 +360,7 @@ mod test { assert_eq!( Date::new_from_iso( Date::try_new_iso(-5500 + 9, 1, 1).unwrap(), - Ethiopian(EthiopianEraStyle::AmeteAlem) + Ethiopian::new_with_era_style(EthiopianEraStyle::AmeteAlem) ) .extended_year(), 1 @@ -381,7 +368,7 @@ mod test { assert_eq!( Date::new_from_iso( Date::try_new_iso(9, 1, 1).unwrap(), - Ethiopian(EthiopianEraStyle::AmeteAlem) + Ethiopian::new_with_era_style(EthiopianEraStyle::AmeteAlem) ) .extended_year(), 5501 @@ -390,7 +377,7 @@ mod test { assert_eq!( Date::new_from_iso( Date::try_new_iso(-5500 + 9, 1, 1).unwrap(), - Ethiopian(EthiopianEraStyle::AmeteMihret) + Ethiopian::new_with_era_style(EthiopianEraStyle::AmeteMihret) ) .extended_year(), -5499 @@ -398,7 +385,7 @@ mod test { assert_eq!( Date::new_from_iso( Date::try_new_iso(9, 1, 1).unwrap(), - Ethiopian(EthiopianEraStyle::AmeteMihret) + Ethiopian::new_with_era_style(EthiopianEraStyle::AmeteMihret) ) .extended_year(), 1 diff --git a/deps/crates/vendor/icu_calendar/src/cal/gregorian.rs b/deps/crates/vendor/icu_calendar/src/cal/gregorian.rs index 2475fd562a5c27..0466be71743ba5 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/gregorian.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/gregorian.rs @@ -2,39 +2,122 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::cal::abstract_gregorian::{impl_with_abstract_gregorian, GregorianYears}; +//! This module contains types and implementations for the Gregorian calendar. +//! +//! ```rust +//! use icu::calendar::{cal::Gregorian, Date}; +//! +//! let date_iso = Date::try_new_iso(1970, 1, 2) +//! .expect("Failed to initialize ISO Date instance."); +//! let date_gregorian = Date::new_from_iso(date_iso, Gregorian); +//! +//! assert_eq!(date_gregorian.era_year().year, 1970); +//! assert_eq!(date_gregorian.month().ordinal, 1); +//! assert_eq!(date_gregorian.day_of_month().0, 2); +//! ``` + +use crate::cal::iso::{Iso, IsoDateInner}; use crate::calendar_arithmetic::ArithmeticDate; -use crate::error::UnknownEraError; -use crate::preferences::CalendarAlgorithm; -use crate::{types, Date, DateError, RangeError}; +use crate::error::{year_check, DateError}; +use crate::{types, Calendar, Date, DateDuration, DateDurationUnit, RangeError}; +use calendrical_calculations::rata_die::RataDie; use tinystr::tinystr; -impl_with_abstract_gregorian!(crate::cal::Gregorian, GregorianDateInner, CeBce, _x, CeBce); +/// The [(proleptic) Gregorian Calendar](https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar) +/// +/// The Gregorian calendar is a solar calendar used by most of the world, with twelve months. +/// +/// This type can be used with [`Date`] to represent dates in this calendar. +/// +/// # Era codes +/// +/// This calendar uses two era codes: `bce` (alias `bc`), and `ce` (alias `ad`), corresponding to the BCE and CE eras. +/// +/// # Month codes +/// +/// This calendar supports 12 solar month codes (`"M01" - "M12"`) +#[derive(Copy, Clone, Debug, Default)] +#[allow(clippy::exhaustive_structs)] // this type is stable +pub struct Gregorian; -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub(crate) struct CeBce; +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +/// The inner date type used for representing [`Date`]s of [`Gregorian`]. See [`Date`] and [`Gregorian`] for more details. +pub struct GregorianDateInner(pub(crate) IsoDateInner); -impl GregorianYears for CeBce { - fn extended_from_era_year( +impl crate::cal::scaffold::UnstableSealed for Gregorian {} +impl Calendar for Gregorian { + type DateInner = GregorianDateInner; + type Year = types::EraYear; + fn from_codes( &self, - era: Option<&[u8]>, + era: Option<&str>, year: i32, - ) -> Result { - match era { - None => Ok(year), - Some(b"ad" | b"ce") => Ok(year), - Some(b"bce" | b"bc") => Ok(1 - year), - Some(_) => Err(UnknownEraError), - } + month_code: types::MonthCode, + day: u8, + ) -> Result { + let year = match era { + Some("bce" | "bc") => 1 - year_check(year, 1..)?, + Some("ad" | "ce") | None => year_check(year, 1..)?, + Some(_) => return Err(DateError::UnknownEra), + }; + + ArithmeticDate::new_from_codes(self, year, month_code, day) + .map(IsoDateInner) + .map(GregorianDateInner) + } + + fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { + GregorianDateInner(Iso.from_rata_die(rd)) } - fn era_year_from_extended(&self, extended_year: i32, _month: u8, _day: u8) -> types::EraYear { + fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { + Iso.to_rata_die(&date.0) + } + + fn from_iso(&self, iso: IsoDateInner) -> GregorianDateInner { + GregorianDateInner(iso) + } + + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + date.0 + } + + fn months_in_year(&self, date: &Self::DateInner) -> u8 { + Iso.months_in_year(&date.0) + } + + fn days_in_year(&self, date: &Self::DateInner) -> u16 { + Iso.days_in_year(&date.0) + } + + fn days_in_month(&self, date: &Self::DateInner) -> u8 { + Iso.days_in_month(&date.0) + } + + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + Iso.offset_date(&mut date.0, offset.cast_unit()) + } + + #[allow(clippy::field_reassign_with_default)] // it's more clear this way + fn until( + &self, + date1: &Self::DateInner, + date2: &Self::DateInner, + _calendar2: &Self, + largest_unit: DateDurationUnit, + smallest_unit: DateDurationUnit, + ) -> DateDuration { + Iso.until(&date1.0, &date2.0, &Iso, largest_unit, smallest_unit) + .cast_unit() + } + /// The calendar-specific year represented by `date` + fn year_info(&self, date: &Self::DateInner) -> Self::Year { + let extended_year = self.extended_year(date); if extended_year > 0 { types::EraYear { era: tinystr!(16, "ce"), era_index: Some(1), year: extended_year, - extended_year, ambiguity: match extended_year { ..=999 => types::YearAmbiguity::EraAndCenturyRequired, 1000..=1949 => types::YearAmbiguity::CenturyRequired, @@ -46,77 +129,44 @@ impl GregorianYears for CeBce { types::EraYear { era: tinystr!(16, "bce"), era_index: Some(0), - year: 1 - extended_year, - extended_year, + year: 1_i32.saturating_sub(extended_year), ambiguity: types::YearAmbiguity::EraAndCenturyRequired, } } } + fn extended_year(&self, date: &Self::DateInner) -> i32 { + Iso.extended_year(&date.0) + } + + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { + Iso.is_in_leap_year(&date.0) + } + + /// The calendar-specific month represented by `date` + fn month(&self, date: &Self::DateInner) -> types::MonthInfo { + Iso.month(&date.0) + } + + /// The calendar-specific day-of-month represented by `date` + fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { + Iso.day_of_month(&date.0) + } + + /// Information of the day of the year + fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { + date.0 .0.day_of_year() + } + fn debug_name(&self) -> &'static str { "Gregorian" } - fn calendar_algorithm(&self) -> Option { - Some(CalendarAlgorithm::Gregory) + fn calendar_algorithm(&self) -> Option { + Some(crate::preferences::CalendarAlgorithm::Gregory) } } -/// The [Gregorian Calendar](https://en.wikipedia.org/wiki/Gregorian_calendar) -/// -/// The Gregorian calendar is an improvement over the [`Julian`](super::Julian) calendar. -/// It was adopted under Pope Gregory XIII in 1582 CE by much of Roman Catholic Europe, -/// and over the following centuries by all other countries that had been using -/// the Julian calendar. Eventually even countries that had been using other calendars -/// adopted this calendar, and today it is used as the international civil calendar. -/// -/// This implementation extends proleptically for dates before the calendar's creation. -/// -/// This corresponds to the `"gregory"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). -/// -/// # Era codes -/// -/// This calendar uses two era codes: `bce` (alias `bc`), and `ce` (alias `ad`), corresponding to the BCE and CE eras. -/// -/// # Months and days -/// -/// The 12 months are called January (`M01`, 31 days), February (`M02`, 28 days), -/// March (`M03`, 31 days), April (`M04`, 30 days), May (`M05`, 31 days), June (`M06`, 30 days), -/// July (`M07`, 31 days), August (`M08`, 31 days), September (`M09`, 30 days), -/// October (`M10`, 31 days), November (`M11`, 30 days), December (`M12`, 31 days). -/// -/// In leap years (years divisible by 4 but not 100 except when divisble by 400), February gains a 29th day. -/// -/// Standard years thus have 365 days, and leap years 366. -/// -/// # Calendar drift -/// -/// The Gregorian calendar has an average year length of 365.2425, slightly longer than -/// the mean solar year, so this calendar drifts 1 day in ~7700 years with respect -/// to the seasons. -/// -/// # Historical accuracy -/// -/// This type implements the [*proleptic* Gregorian calendar]( -/// https://en.wikipedia.org/wiki/Gregorian_calendar#Proleptic_Gregorian_calendar), -/// with dates before 1582 CE using the rules projected backwards. Care needs to be taken -/// when intepreting historical dates before or during the transition from the Julian to -/// the Gregorian calendar. [Some regions](https://en.wikipedia.org/wiki/Adoption_of_the_Gregorian_calendar) -/// continued using the Julian calendar as late as the 20th century. Sources often -/// mark dates as "New Style" (Gregorian) or "Old Style" (Julian) if there is ambiguity. -/// -/// Historically, the Julian/Gregorian calendars were used with a variety of year reckoning -/// schemes (see [`Julian`](super::Julian) for more detail). The Gregorian calendar has generally -/// been used with the [Anno Domini](https://en.wikipedia.org/wiki/Anno_Domini)/[Common era]( -/// https://en.wikipedia.org/wiki/Common_Era) since its inception. However, some countries -/// that have adopted the Gregorian calendar more recently are still using their traditional -/// year-reckoning schemes. This crate implements some of these as different types, i.e the Thai -/// [`Buddhist`](super::Buddhist) calendar, the [`Japanese`](super::Japanese) calendar, and the -/// Chinese Republican Calendar ([`Roc`](super::Roc)). -#[derive(Copy, Clone, Debug, Default)] -#[allow(clippy::exhaustive_structs)] // this type is stable -pub struct Gregorian; - impl Date { /// Construct a new Gregorian Date. /// @@ -134,22 +184,12 @@ impl Date { /// assert_eq!(date_gregorian.day_of_month().0, 2); /// ``` pub fn try_new_gregorian(year: i32, month: u8, day: u8) -> Result, RangeError> { - ArithmeticDate::new_gregorian::(year, month, day) - .map(GregorianDateInner) - .map(|i| Date::from_raw(i, Gregorian)) - } -} - -impl Gregorian { - /// Returns the date of Easter in the given year. - pub fn easter(year: i32) -> Date { - Date::from_rata_die(calendrical_calculations::gregorian::easter(year), Self) + Date::try_new_iso(year, month, day).map(|d| Date::new_from_iso(d, Gregorian)) } } #[cfg(test)] mod test { - use crate::cal::Iso; use calendrical_calculations::rata_die::RataDie; use super::*; diff --git a/deps/crates/vendor/icu_calendar/src/cal/hebrew.rs b/deps/crates/vendor/icu_calendar/src/cal/hebrew.rs index e1e43953ca8866..e0464a2c1af691 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/hebrew.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/hebrew.rs @@ -2,15 +2,26 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::calendar_arithmetic::{ArithmeticDate, DateFieldsResolver, ToExtendedYear}; -use crate::error::{ - DateError, DateFromFieldsError, EcmaReferenceYearError, MonthCodeError, UnknownEraError, -}; -use crate::options::{DateAddOptions, DateDifferenceOptions}; -use crate::options::{DateFromFieldsOptions, Overflow}; -use crate::types::{DateFields, MonthInfo, ValidMonthCode}; +//! This module contains types and implementations for the Hebrew calendar. +//! +//! ```rust +//! use icu::calendar::Date; +//! +//! let hebrew_date = Date::try_new_hebrew(3425, 10, 11) +//! .expect("Failed to initialize hebrew Date instance."); +//! +//! assert_eq!(hebrew_date.era_year().year, 3425); +//! assert_eq!(hebrew_date.month().ordinal, 10); +//! assert_eq!(hebrew_date.day_of_month().0, 11); +//! ``` + +use crate::cal::iso::{Iso, IsoDateInner}; +use crate::calendar_arithmetic::PrecomputedDataSource; +use crate::calendar_arithmetic::{ArithmeticDate, CalendarArithmetic}; +use crate::error::DateError; +use crate::types::MonthInfo; use crate::RangeError; -use crate::{types, Calendar, Date}; +use crate::{types, Calendar, Date, DateDuration, DateDurationUnit}; use ::tinystr::tinystr; use calendrical_calculations::hebrew_keviyah::{Keviyah, YearInfo}; use calendrical_calculations::rata_die::RataDie; @@ -20,35 +31,21 @@ use calendrical_calculations::rata_die::RataDie; /// The Hebrew calendar is a lunisolar calendar used as the Jewish liturgical calendar /// as well as an official calendar in Israel. /// -/// This implementation uses civil month numbering, where Tishrei is the first month of the year. -/// -/// The precise algorithm used to calculate the Hebrew Calendar has [changed over time], with -/// the modern one being in place since about 4536 AM (776 CE). This implementation extends -/// proleptically for dates before that. -/// -/// [changed over time]: https://hakirah.org/vol20AjdlerAppendices.pdf -/// -/// This corresponds to the `"hebrew"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). +/// This calendar is the _civil_ Hebrew calendar, with the year starting at in the month of Tishrei. /// /// # Era codes /// /// This calendar uses a single era code `am`, Anno Mundi. Dates before this era use negative years. /// -/// # Months and days +/// # Month codes /// -/// The 12 months are called Tishrei (`M01`, 30 days), Ḥešvan (`M02`, 29/30 days), -/// Kīslev (`M03`, 30/29 days), Ṭevet (`M04`, 29 days), Šəvaṭ (`M05`, 30 days), ʾĂdār (`M06`, 29 days), -/// Nīsān (`M07`, 30 days), ʾĪyyar (`M08`, 29 days), Sivan (`M09`, 30 days), Tammūz (`M10`, 29 days), -/// ʾAv (`M11`, 30 days), ʾElūl (`M12`, 29 days). +/// This calendar is a lunisolar calendar and thus has a leap month. It supports codes `"M01"-"M12"` +/// for regular months, and the leap month Adar I being coded as `"M05L"`. /// -/// Due to Rosh Hashanah postponement rules, Ḥešvan and Kislev vary in length. -/// -/// In leap years (years 3, 6, 8, 11, 17, 19 in a 19-year cycle), the leap month Adar I (`M05L`, 30 days) -/// is inserted before Adar, and Adar is called Adar II (the `formatting_code` returned by [`MonthInfo`] -/// will be `M06L` to mark this, while the `standard_code` remains `M06`). -/// -/// Standard years thus have 353-355 days, and leap years 383-385. -#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord, Default)] +/// [`MonthInfo`] has slightly divergent behavior: because the regular month Adar is formatted +/// as "Adar II" in a leap year, this calendar will produce the special code `"M06L"` in any [`MonthInfo`] +/// objects it creates. +#[derive(Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord, Default)] #[allow(clippy::exhaustive_structs)] // unit struct pub struct Hebrew; @@ -66,29 +63,42 @@ impl Hebrew { #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] pub(crate) struct HebrewYearInfo { keviyah: Keviyah, + prev_keviyah: Keviyah, value: i32, } -impl ToExtendedYear for HebrewYearInfo { - fn to_extended_year(&self) -> i32 { - self.value +impl From for i32 { + fn from(value: HebrewYearInfo) -> Self { + value.value } } impl HebrewYearInfo { /// Convenience method to compute for a given year. Don't use this if you actually need /// a YearInfo that you want to call .new_year() on. + /// + /// This can potentially be optimized with adjacent-year knowledge, but it's complex #[inline] - fn compute(value: i32) -> Self { + fn compute(h_year: i32) -> Self { + let keviyah = YearInfo::compute_for(h_year).keviyah; + Self::compute_with_keviyah(keviyah, h_year) + } + /// Compute for a given year when the keviyah is already known + #[inline] + fn compute_with_keviyah(keviyah: Keviyah, h_year: i32) -> Self { + let prev_keviyah = YearInfo::compute_for(h_year - 1).keviyah; Self { - keviyah: YearInfo::compute_for(value).keviyah, - value, + keviyah, + prev_keviyah, + value: h_year, } } } +// HEBREW CALENDAR -impl DateFieldsResolver for Hebrew { +impl CalendarArithmetic for Hebrew { type YearInfo = HebrewYearInfo; + fn days_in_provided_month(info: HebrewYearInfo, ordinal_month: u8) -> u8 { info.keviyah.month_len(ordinal_month) } @@ -101,91 +111,22 @@ impl DateFieldsResolver for Hebrew { } } - #[inline] - fn year_info_from_era( - &self, - era: &[u8], - era_year: i32, - ) -> Result { - match era { - b"am" => Ok(HebrewYearInfo::compute(era_year)), - _ => Err(UnknownEraError), - } - } - - #[inline] - fn year_info_from_extended(&self, extended_year: i32) -> Self::YearInfo { - HebrewYearInfo::compute(extended_year) + fn days_in_provided_year(info: HebrewYearInfo) -> u16 { + info.keviyah.year_length() } - fn reference_year_from_month_day( - &self, - month_code: types::ValidMonthCode, - day: u8, - ) -> Result { - // December 31, 1972 occurs on 4th month, 26th day, 5733 AM - let hebrew_year = match month_code.to_tuple() { - (1, false) => 5733, - (2, false) => match day { - // There is no day 30 in 5733 (there is in 5732) - ..=29 => 5733, - // Note (here and below): this must be > 29, not just == 30, - // since we have not yet applied a potential Overflow::Constrain. - _ => 5732, - }, - (3, false) => match day { - // There is no day 30 in 5733 (there is in 5732) - ..=29 => 5733, - _ => 5732, - }, - (4, false) => match day { - ..=26 => 5733, - _ => 5732, - }, - (5..=12, false) => 5732, - // Neither 5731 nor 5732 is a leap year - (5, true) => 5730, - _ => { - return Err(EcmaReferenceYearError::MonthCodeNotInCalendar); - } - }; - Ok(HebrewYearInfo::compute(hebrew_year)) + fn provided_year_is_leap(info: HebrewYearInfo) -> bool { + info.keviyah.is_leap() } - fn ordinal_month_from_code( - &self, - year: &Self::YearInfo, - month_code: types::ValidMonthCode, - options: DateFromFieldsOptions, - ) -> Result { - let is_leap_year = year.keviyah.is_leap(); - let ordinal_month = match month_code.to_tuple() { - (n @ 1..=12, false) => n + (n >= 6 && is_leap_year) as u8, - (5, true) => { - if is_leap_year { - 6 - } else if matches!(options.overflow, Some(Overflow::Constrain)) { - // M05L maps to M06 in a common year - 6 - } else { - return Err(MonthCodeError::NotInYear); - } - } - _ => return Err(MonthCodeError::NotInCalendar), - }; - Ok(ordinal_month) + fn last_month_day_in_provided_year(info: HebrewYearInfo) -> (u8, u8) { + info.keviyah.last_month_day_in_year() } +} - fn month_code_from_ordinal( - &self, - year: &Self::YearInfo, - ordinal_month: u8, - ) -> types::ValidMonthCode { - let is_leap = year.keviyah.is_leap(); - ValidMonthCode::new_unchecked( - ordinal_month - (is_leap && ordinal_month >= 6) as u8, - ordinal_month == 6 && is_leap, - ) +impl PrecomputedDataSource for () { + fn load_or_compute_info(&self, h_year: i32) -> HebrewYearInfo { + HebrewYearInfo::compute(h_year) } } @@ -193,7 +134,6 @@ impl crate::cal::scaffold::UnstableSealed for Hebrew {} impl Calendar for Hebrew { type DateInner = HebrewDateInner; type Year = types::EraYear; - type DifferenceError = core::convert::Infallible; fn from_codes( &self, @@ -202,78 +142,118 @@ impl Calendar for Hebrew { month_code: types::MonthCode, day: u8, ) -> Result { - ArithmeticDate::from_codes(era, year, month_code, day, self).map(HebrewDateInner) - } + match era { + Some("am") | None => {} + _ => return Err(DateError::UnknownEra), + } - #[cfg(feature = "unstable")] - fn from_fields( - &self, - fields: DateFields, - options: DateFromFieldsOptions, - ) -> Result { - ArithmeticDate::from_fields(fields, options, self).map(HebrewDateInner) + let year = HebrewYearInfo::compute(year); + + let is_leap_year = year.keviyah.is_leap(); + + let month_code_str = month_code.0.as_str(); + + let month_ordinal = if is_leap_year { + match month_code_str { + "M01" => 1, + "M02" => 2, + "M03" => 3, + "M04" => 4, + "M05" => 5, + "M05L" => 6, + // M06L is the formatting era code used for Adar II + "M06" | "M06L" => 7, + "M07" => 8, + "M08" => 9, + "M09" => 10, + "M10" => 11, + "M11" => 12, + "M12" => 13, + _ => { + return Err(DateError::UnknownMonthCode(month_code)); + } + } + } else { + match month_code_str { + "M01" => 1, + "M02" => 2, + "M03" => 3, + "M04" => 4, + "M05" => 5, + "M06" => 6, + "M07" => 7, + "M08" => 8, + "M09" => 9, + "M10" => 10, + "M11" => 11, + "M12" => 12, + _ => { + return Err(DateError::UnknownMonthCode(month_code)); + } + } + }; + + Ok(HebrewDateInner(ArithmeticDate::new_from_ordinals( + year, + month_ordinal, + day, + )?)) } fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { - let (year_info, year) = YearInfo::year_containing_rd(rd); - let keviyah = year_info.keviyah; - + let (year, h_year) = YearInfo::year_containing_rd(rd); // Obtaining a 1-indexed day-in-year value - let day_in_year = u16::try_from(rd - year_info.new_year() + 1).unwrap_or(u16::MAX); - let (month, day) = keviyah.month_day_for(day_in_year); - - HebrewDateInner(ArithmeticDate::new_unchecked( - HebrewYearInfo { - keviyah, - value: year, - }, - month, - day, - )) + let day = rd - year.new_year() + 1; + let day = u16::try_from(day).unwrap_or(u16::MAX); + + let year = HebrewYearInfo::compute_with_keviyah(year.keviyah, h_year); + let (month, day) = year.keviyah.month_day_for(day); + HebrewDateInner(ArithmeticDate::new_unchecked(year, month, day)) } fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { - let ny = date.0.year.keviyah.year_info(date.0.year.value).new_year(); - let days_preceding = date.0.year.keviyah.days_preceding(date.0.month); + let year = date.0.year.keviyah.year_info(date.0.year.value); + + let ny = year.new_year(); + let days_preceding = year.keviyah.days_preceding(date.0.month); // Need to subtract 1 since the new year is itself in this year ny + i64::from(days_preceding) + i64::from(date.0.day) - 1 } - fn has_cheap_iso_conversion(&self) -> bool { - false + fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner { + self.from_rata_die(Iso.to_rata_die(&iso)) + } + + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + Iso.from_rata_die(self.to_rata_die(date)) } fn months_in_year(&self, date: &Self::DateInner) -> u8 { - Self::months_in_provided_year(date.0.year) + date.0.months_in_year() } fn days_in_year(&self, date: &Self::DateInner) -> u16 { - date.0.year.keviyah.year_length() + date.0.days_in_year() } fn days_in_month(&self, date: &Self::DateInner) -> u8 { - Self::days_in_provided_month(date.0.year, date.0.month) + date.0.days_in_month() } - #[cfg(feature = "unstable")] - fn add( - &self, - date: &Self::DateInner, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result { - date.0.added(duration, self, options).map(HebrewDateInner) + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + date.0.offset_date(offset, &()) } - #[cfg(feature = "unstable")] fn until( &self, date1: &Self::DateInner, date2: &Self::DateInner, - options: DateDifferenceOptions, - ) -> Result { - Ok(date1.0.until(&date2.0, self, options)) + _calendar2: &Self, + _largest_unit: DateDurationUnit, + _smallest_unit: DateDurationUnit, + ) -> DateDuration { + date1.0.until(date2.0, _largest_unit, _smallest_unit) } fn debug_name(&self) -> &'static str { @@ -281,44 +261,76 @@ impl Calendar for Hebrew { } fn year_info(&self, date: &Self::DateInner) -> Self::Year { - let extended_year = date.0.year.value; types::EraYear { era_index: Some(0), era: tinystr!(16, "am"), - year: extended_year, - extended_year, + year: self.extended_year(date), ambiguity: types::YearAmbiguity::CenturyRequired, } } + fn extended_year(&self, date: &Self::DateInner) -> i32 { + date.0.extended_year() + } + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { - date.0.year.keviyah.is_leap() + Self::provided_year_is_leap(date.0.year) } fn month(&self, date: &Self::DateInner) -> MonthInfo { - let valid_standard_code = self.month_code_from_ordinal(&date.0.year, date.0.month); + let mut ordinal = date.0.month; + let is_leap_year = Self::provided_year_is_leap(date.0.year); + + if is_leap_year { + if ordinal == 6 { + return types::MonthInfo { + ordinal, + standard_code: types::MonthCode(tinystr!(4, "M05L")), + formatting_code: types::MonthCode(tinystr!(4, "M05L")), + }; + } else if ordinal == 7 { + return types::MonthInfo { + ordinal, + // Adar II is the same as Adar and has the same code + standard_code: types::MonthCode(tinystr!(4, "M06")), + formatting_code: types::MonthCode(tinystr!(4, "M06L")), + }; + } + } - let valid_formatting_code = if valid_standard_code.number() == 6 && date.0.month == 7 { - ValidMonthCode::new_unchecked(6, true) // M06L - } else { - valid_standard_code + if is_leap_year && ordinal > 6 { + ordinal -= 1; + } + + let code = match ordinal { + 1 => tinystr!(4, "M01"), + 2 => tinystr!(4, "M02"), + 3 => tinystr!(4, "M03"), + 4 => tinystr!(4, "M04"), + 5 => tinystr!(4, "M05"), + 6 => tinystr!(4, "M06"), + 7 => tinystr!(4, "M07"), + 8 => tinystr!(4, "M08"), + 9 => tinystr!(4, "M09"), + 10 => tinystr!(4, "M10"), + 11 => tinystr!(4, "M11"), + 12 => tinystr!(4, "M12"), + _ => tinystr!(4, "und"), }; types::MonthInfo { ordinal: date.0.month, - standard_code: valid_standard_code.to_month_code(), - valid_standard_code, - formatting_code: valid_formatting_code.to_month_code(), - valid_formatting_code, + standard_code: types::MonthCode(code), + formatting_code: types::MonthCode(code), } } fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { - types::DayOfMonth(date.0.day) + date.0.day_of_month() } fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { - types::DayOfYear(date.0.year.keviyah.days_preceding(date.0.month) + date.0.day as u16) + date.0.day_of_year() } fn calendar_algorithm(&self) -> Option { @@ -327,18 +339,26 @@ impl Calendar for Hebrew { } impl Date { - /// This method uses an ordinal month, which is probably not what you want. + /// Construct new Hebrew Date. /// - /// Use [`Date::try_new_from_codes`] - #[deprecated(since = "2.1.0", note = "use `Date::try_new_from_codes`")] - pub fn try_new_hebrew( - year: i32, - ordinal_month: u8, - day: u8, - ) -> Result, RangeError> { + /// This date will not use any precomputed calendrical calculations, + /// one that loads such data from a provider will be added in the future (#3933) + /// + /// + /// ```rust + /// use icu::calendar::Date; + /// + /// let date_hebrew = Date::try_new_hebrew(3425, 4, 25) + /// .expect("Failed to initialize Hebrew Date instance."); + /// + /// assert_eq!(date_hebrew.era_year().year, 3425); + /// assert_eq!(date_hebrew.month().ordinal, 4); + /// assert_eq!(date_hebrew.day_of_month().0, 25); + /// ``` + pub fn try_new_hebrew(year: i32, month: u8, day: u8) -> Result, RangeError> { let year = HebrewYearInfo::compute(year); - ArithmeticDate::try_from_ymd(year, ordinal_month, day) + ArithmeticDate::new_from_ordinals(year, month, day) .map(HebrewDateInner) .map(|inner| Date::from_raw(inner, Hebrew)) } @@ -349,28 +369,21 @@ mod tests { use super::*; use crate::types::MonthCode; + use calendrical_calculations::hebrew_keviyah::*; - pub const TISHREI: ValidMonthCode = ValidMonthCode::new_unchecked(1, false); - pub const ḤESHVAN: ValidMonthCode = ValidMonthCode::new_unchecked(2, false); - pub const KISLEV: ValidMonthCode = ValidMonthCode::new_unchecked(3, false); - pub const TEVET: ValidMonthCode = ValidMonthCode::new_unchecked(4, false); - pub const SHEVAT: ValidMonthCode = ValidMonthCode::new_unchecked(5, false); - pub const ADARI: ValidMonthCode = ValidMonthCode::new_unchecked(5, true); - pub const ADAR: ValidMonthCode = ValidMonthCode::new_unchecked(6, false); - pub const NISAN: ValidMonthCode = ValidMonthCode::new_unchecked(7, false); - pub const IYYAR: ValidMonthCode = ValidMonthCode::new_unchecked(8, false); - pub const SIVAN: ValidMonthCode = ValidMonthCode::new_unchecked(9, false); - pub const TAMMUZ: ValidMonthCode = ValidMonthCode::new_unchecked(10, false); - pub const AV: ValidMonthCode = ValidMonthCode::new_unchecked(11, false); - pub const ELUL: ValidMonthCode = ValidMonthCode::new_unchecked(12, false); + // Sentinel value for Adar I + // We're using normalized month values here so that we can use constants. These do not + // distinguish between the different Adars. We add an out-of-range sentinel value of 13 to + // specifically talk about Adar I in a leap year + const ADARI: u8 = 13; /// The leap years used in the tests below const LEAP_YEARS_IN_TESTS: [i32; 1] = [5782]; /// (iso, hebrew) pairs of testcases. If any of the years here /// are leap years please add them to LEAP_YEARS_IN_TESTS (we have this manually /// so we don't end up exercising potentially buggy codepaths to test this) - #[expect(clippy::type_complexity)] - const ISO_HEBREW_DATE_PAIRS: [((i32, u8, u8), (i32, ValidMonthCode, u8)); 48] = [ + #[allow(clippy::type_complexity)] + const ISO_HEBREW_DATE_PAIRS: [((i32, u8, u8), (i32, u8, u8)); 48] = [ ((2021, 1, 10), (5781, TEVET, 26)), ((2021, 1, 25), (5781, SHEVAT, 12)), ((2021, 2, 10), (5781, SHEVAT, 28)), @@ -425,12 +438,17 @@ mod tests { fn test_conversions() { for ((iso_y, iso_m, iso_d), (y, m, d)) in ISO_HEBREW_DATE_PAIRS.into_iter() { let iso_date = Date::try_new_iso(iso_y, iso_m, iso_d).unwrap(); - let hebrew_date = Date::try_new_from_codes(Some("am"), y, m.to_month_code(), d, Hebrew) + let month_code = if m == ADARI { + MonthCode(tinystr!(4, "M05L")) + } else { + MonthCode::new_normal(m).unwrap() + }; + let hebrew_date = Date::try_new_from_codes(Some("am"), y, month_code, d, Hebrew) .expect("Date should parse"); let iso_to_hebrew = iso_date.to_calendar(Hebrew); - let hebrew_to_iso = hebrew_date.to_iso(); + let hebrew_to_iso = hebrew_date.to_calendar(Iso); assert_eq!( hebrew_to_iso, iso_date, @@ -441,16 +459,19 @@ mod tests { "Failed comparing to-hebrew value for {iso_date:?} => {hebrew_date:?}" ); - let ordinal_month = if (m == ADARI || m.number() >= ADAR.number()) - && LEAP_YEARS_IN_TESTS.contains(&y) - { - m.number() + 1 + let ordinal_month = if LEAP_YEARS_IN_TESTS.contains(&y) { + if m == ADARI { + ADAR + } else if m >= ADAR { + m + 1 + } else { + m + } } else { assert!(m != ADARI); - m.number() + m }; - #[allow(deprecated)] // should still test let ordinal_hebrew_date = Date::try_new_hebrew(y, ordinal_month, d) .expect("Construction of date must succeed"); @@ -468,7 +489,7 @@ mod tests { fn test_negative_era_years() { let greg_date = Date::try_new_gregorian(-5000, 1, 1).unwrap(); let greg_year = greg_date.era_year(); - assert_eq!(greg_date.inner.0.year, -5000); + assert_eq!(greg_date.inner.0 .0.year, -5000); assert_eq!(greg_year.era, "bce"); // In Gregorian, era year is 1 - extended year assert_eq!(greg_year.year, 5001); @@ -485,7 +506,7 @@ mod tests { // https://github.com/unicode-org/icu4x/issues/4893 let cal = Hebrew::new(); let era = "am"; - let month_code = MonthCode::new_normal(1).unwrap(); + let month_code = MonthCode(tinystr!(4, "M01")); let dt = Date::try_new_from_codes(Some(era), 3760, month_code, 1, cal).unwrap(); // Should be Saturday per: diff --git a/deps/crates/vendor/icu_calendar/src/cal/hijri.rs b/deps/crates/vendor/icu_calendar/src/cal/hijri.rs index cd445acd34067a..02a5d920269fa7 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/hijri.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/hijri.rs @@ -2,191 +2,533 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::calendar_arithmetic::ArithmeticDate; -use crate::calendar_arithmetic::DateFieldsResolver; -use crate::calendar_arithmetic::ToExtendedYear; -use crate::error::{DateError, DateFromFieldsError, EcmaReferenceYearError, UnknownEraError}; -use crate::options::DateFromFieldsOptions; -use crate::options::{DateAddOptions, DateDifferenceOptions}; -use crate::types::DateFields; -use crate::{types, Calendar, Date}; +//! This module contains types and implementations for the Hijri calendars. +//! +//! ```rust +//! use icu::calendar::cal::HijriSimulated; +//! use icu::calendar::Date; +//! +//! let hijri = HijriSimulated::new_mecca_always_calculating(); +//! let hijri_date = +//! Date::try_new_simulated_hijri_with_calendar(1348, 10, 11, hijri) +//! .expect("Failed to initialize Hijri Date instance."); +//! +//! assert_eq!(hijri_date.era_year().year, 1348); +//! assert_eq!(hijri_date.month().ordinal, 10); +//! assert_eq!(hijri_date.day_of_month().0, 11); +//! ``` + +use crate::cal::iso::{Iso, IsoDateInner}; +use crate::calendar_arithmetic::PrecomputedDataSource; +use crate::calendar_arithmetic::{ArithmeticDate, CalendarArithmetic}; +use crate::error::{year_check, DateError}; +use crate::provider::hijri::PackedHijriYearInfo; +use crate::provider::hijri::{CalendarHijriSimulatedMeccaV1, HijriData}; +use crate::types::EraYear; +use crate::{types, Calendar, Date, DateDuration, DateDurationUnit}; use crate::{AsCalendar, RangeError}; -use calendrical_calculations::islamic::{ - ISLAMIC_EPOCH_FRIDAY, ISLAMIC_EPOCH_THURSDAY, WELL_BEHAVED_ASTRONOMICAL_RANGE, -}; +use calendrical_calculations::islamic::{ISLAMIC_EPOCH_FRIDAY, ISLAMIC_EPOCH_THURSDAY}; use calendrical_calculations::rata_die::RataDie; -use core::fmt::Debug; -use icu_locale_core::preferences::extensions::unicode::keywords::{ - CalendarAlgorithm, HijriCalendarAlgorithm, -}; +use icu_provider::marker::ErasedMarker; use icu_provider::prelude::*; use tinystr::tinystr; +use ummalqura_data::{UMMALQURA_DATA, UMMALQURA_DATA_STARTING_YEAR}; -#[path = "hijri/simulated_mecca_data.rs"] -mod simulated_mecca_data; -#[path = "hijri/ummalqura_data.rs"] mod ummalqura_data; -/// The [Hijri Calendar](https://en.wikipedia.org/wiki/Islamic_calendar) -/// -/// There are many variants of this calendar, using different lunar observations or calculations -/// (see [`Rules`]). Currently, [`Rules`] is an unstable trait, but some of its implementors -/// are stable, and can be constructed via the various `Hijri::new_*` constructors. Please comment -/// on [this issue](https://github.com/unicode-org/icu4x/issues/6962) -/// if you would like to see this the ability to implement custom [`Rules`] stabilized. -/// -/// This implementation supports only variants where months are either 29 or 30 days. -/// -/// This corresponds to various `"islamic-*"` [CLDR calendars](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier), -/// see the individual implementors of [`Rules`] ([`TabularAlgorithm`], [`UmmAlQura`], [`AstronomicalSimulation`]) for more information. +fn era_year(year: i32) -> EraYear { + if year > 0 { + types::EraYear { + era: tinystr!(16, "ah"), + era_index: Some(0), + year, + ambiguity: types::YearAmbiguity::CenturyRequired, + } + } else { + types::EraYear { + era: tinystr!(16, "bh"), + era_index: Some(1), + year: 1 - year, + ambiguity: types::YearAmbiguity::CenturyRequired, + } + } +} + +/// The [simulated Hijri Calendar](https://en.wikipedia.org/wiki/Islamic_calendar) /// /// # Era codes /// /// This calendar uses two era codes: `ah`, and `bh`, corresponding to the Anno Hegirae and Before Hijrah eras /// -/// # Months and days +/// # Month codes /// -/// The 12 months are called al-Muḥarram (`M01`), Ṣafar (`M02`), Rabīʿ al-ʾAwwal (`M03`), -/// Rabīʿ ath-Thānī or Rabīʿ al-ʾĀkhir (`M04`), Jumādā al-ʾŪlā (`M05`), Jumādā ath-Thāniyah -/// or Jumādā al-ʾĀkhirah (`M06`), Rajab (`M07`), Shaʿbān (`M08`), Ramaḍān (`M09`), Shawwāl (`M10`), -/// Ḏū al-Qaʿdah (`M11`), Ḏū al-Ḥijjah (`M12`). +/// This calendar is a pure lunar calendar with no leap months. It uses month codes +/// `"M01" - "M12"`. +#[derive(Clone, Debug)] +pub struct HijriSimulated { + pub(crate) location: HijriSimulatedLocation, + data: Option>>>, +} + +#[derive(Clone, Debug, Copy, PartialEq)] +pub(crate) enum HijriSimulatedLocation { + Mecca, +} + +impl HijriSimulatedLocation { + fn location(self) -> calendrical_calculations::islamic::Location { + match self { + Self::Mecca => calendrical_calculations::islamic::MECCA, + } + } +} + +/// The [Umm al-Qura Hijri Calendar](https://en.wikipedia.org/wiki/Islamic_calendar#Saudi_Arabia's_Umm_al-Qura_calendar) /// -/// As a true lunar calendar, the lengths of the months depend on the lunar cycle (a month starts on the day -/// where the waxing crescent is first observed), and will be either 29 or 30 days. +/// This calendar is the official calendar in Saudi Arabia. /// -/// The lengths of the months are determined by the concrete [`Rules`] implementation. +/// # Era codes /// -/// There are either 6 or 7 30-day months, so the length of the year is 354 or 355 days. +/// This calendar uses two era codes: `ah`, and `bh`, corresponding to the Anno Hegirae and Before Hijrah eras /// -/// # Calendar drift +/// # Month codes /// -/// As a lunar calendar, this calendar does not intend to follow the solar year, and drifts more -/// than 10 days per year with respect to the seasons. -#[derive(Clone, Debug, Default, Copy)] -#[allow(clippy::exhaustive_structs)] // newtype -pub struct Hijri(pub S); +/// This calendar is a pure lunar calendar with no leap months. It uses month codes +/// `"M01" - "M12"`. +#[derive(Clone, Debug, Default)] +#[non_exhaustive] +pub struct HijriUmmAlQura; -/// Defines a variant of the [`Hijri`] calendar. +/// The [tabular Hijri Calendar](https://en.wikipedia.org/wiki/Tabular_Islamic_calendar). /// -/// This crate includes the [`UmmAlQura`], [`AstronomicalSimulation`], and [`TabularAlgorithm`] -/// rules, other rules can be implemented by users. +/// See [`HijriTabularEpoch`] and [`HijriTabularLeapYears`] for customization. /// -///
-/// 🚫 This trait is sealed; it should not be implemented by user code. If an API requests an item that implements this -/// trait, please consider using a type from the implementors listed below. +/// The most common version of this calendar uses [`HijriTabularEpoch::Friday`] and [`HijriTabularLeapYears::TypeII`]. /// -/// It is still possible to implement this trait in userland (since `UnstableSealed` is public), -/// do not do so unless you are prepared for things to occasionally break. -///
-pub trait Rules: Clone + Debug + crate::cal::scaffold::UnstableSealed { - /// Returns data about the given year. - fn year_data(&self, extended_year: i32) -> HijriYearData; - - /// Returns an ECMA reference year that contains the given month-day combination. - /// - /// If the day is out of range, it will return a year that contains the given month - /// and the maximum day possible for that month. See [the spec][spec] for the - /// precise algorithm used. +/// # Era codes +/// +/// This calendar uses two era codes: `ah`, and `bh`, corresponding to the Anno Hegirae and Before Hijrah eras +/// +/// # Month codes +/// +/// This calendar is a pure lunar calendar with no leap months. It uses month codes +/// `"M01" - "M12"`. +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +pub struct HijriTabular { + pub(crate) leap_years: HijriTabularLeapYears, + pub(crate) epoch: HijriTabularEpoch, +} + +impl HijriSimulated { + /// Creates a new [`HijriSimulated`] for reference location Mecca, with some compiled data containing precomputed calendrical calculations. /// - /// This API only matters when using [`MissingFieldsStrategy::Ecma`] to compute - /// a date without providing a year in [`Date::try_from_fields()`]. The default impl - /// will just error, and custom calendars who do not care about ECMA/Temporal - /// reference years do not need to override this. + /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// - /// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-nonisomonthdaytoisoreferencedate - /// [`MissingFieldsStrategy::Ecma`]: crate::options::MissingFieldsStrategy::Ecma - fn ecma_reference_year( - &self, - // TODO: Consider accepting ValidMonthCode - _month_code: (u8, bool), - _day: u8, - ) -> Result { - Err(EcmaReferenceYearError::Unimplemented) + /// [📚 Help choosing a constructor](icu_provider::constructors) + #[cfg(feature = "compiled_data")] + pub const fn new_mecca() -> Self { + Self { + location: HijriSimulatedLocation::Mecca, + data: Some(DataPayload::from_static_ref( + crate::provider::Baked::SINGLETON_CALENDAR_HIJRI_SIMULATED_MECCA_V1, + )), + } } - /// The BCP-47 [`CalendarAlgorithm`] for the Hijri calendar using these rules, if defined. - fn calendar_algorithm(&self) -> Option { - None + icu_provider::gen_buffer_data_constructors!(() -> error: DataError, + functions: [ + new: skip, + try_new_mecca_with_buffer_provider, + try_new_mecca_unstable, + Self, + ]); + + #[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new_mecca)] + pub fn try_new_mecca_unstable + ?Sized>( + provider: &D, + ) -> Result { + Ok(Self { + location: HijriSimulatedLocation::Mecca, + data: Some(provider.load(Default::default())?.payload.cast()), + }) } - /// The debug name for these rules. - fn debug_name(&self) -> &'static str { - "Hijri (custom rules)" + /// Construct a new [`HijriSimulated`] for reference location Mecca, without any precomputed calendrical calculations. + pub const fn new_mecca_always_calculating() -> Self { + Self { + location: HijriSimulatedLocation::Mecca, + data: None, + } + } + + /// Compute a cache for this calendar + #[cfg(feature = "datagen")] + pub fn build_cache(&self, extended_years: core::ops::Range) -> HijriData<'static> { + let data = extended_years + .clone() + .map(|year| self.location.compute_year_info(year).pack()) + .collect(); + HijriData { + first_extended_year: extended_years.start, + data, + } } } -/// [`Hijri`] [`Rules`] based on an astronomical simulation for a particular location. -/// -/// These simulations are unofficial and are known to not necessarily match sightings -/// on the ground. Unless you know otherwise for sure, instead of this variant, use -/// [`UmmAlQura`], which uses the results of KACST's Mecca-based calculations. -/// -/// As floating point arithmetic degenerates for far-away dates, this falls back to -/// the tabular calendar at some point. -/// -/// The precise behavior of this calendar may change in the future if: -/// - We decide to tweak the precise astronomical simulation used -/// - We decide to expand or reduce the range where we are using the astronomical simulation. -/// -/// This corresponds to the `"islamic-rgsa"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier) -/// if constructed with [`Hijri::new_simulated_mecca()`]. -#[derive(Copy, Clone, Debug)] -pub struct AstronomicalSimulation { - pub(crate) location: SimulatedLocation, +impl HijriUmmAlQura { + /// Creates a new [`HijriUmmAlQura`]. + pub const fn new() -> Self { + Self + } } -#[derive(Clone, Debug, Copy, PartialEq)] -pub(crate) enum SimulatedLocation { - Mecca, +/// The epoch for the [`HijriTabular`] calendar. +#[non_exhaustive] +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +pub enum HijriTabularEpoch { + /// Thusday July 15, 622 AD (0622-07-18 ISO) + Thursday, + /// Friday July 16, 622 AD (0622-07-19 ISO) + Friday, } -impl crate::cal::scaffold::UnstableSealed for AstronomicalSimulation {} -impl Rules for AstronomicalSimulation { - fn debug_name(&self) -> &'static str { - match self.location { - SimulatedLocation::Mecca => "Hijri (simulated, Mecca)", +impl HijriTabularEpoch { + fn rata_die(self) -> RataDie { + match self { + Self::Thursday => ISLAMIC_EPOCH_THURSDAY, + Self::Friday => ISLAMIC_EPOCH_FRIDAY, } } +} + +/// The leap year rule for the [`HijriTabular`] calendar. +/// +/// This specifies which years of a 30-year cycle have an additional day at +/// the end of the year. +#[non_exhaustive] +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +pub enum HijriTabularLeapYears { + /// Leap years 2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29 + TypeII, +} + +impl HijriTabular { + /// Construct a new [`HijriTabular`] with the given leap year rule and epoch. + pub const fn new(leap_years: HijriTabularLeapYears, epoch: HijriTabularEpoch) -> Self { + Self { epoch, leap_years } + } +} + +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +pub(crate) struct HijriYearInfo { + month_lengths: [bool; 12], + start_day: RataDie, + value: i32, +} + +impl From for i32 { + fn from(value: HijriYearInfo) -> Self { + value.value + } +} - fn year_data(&self, extended_year: i32) -> HijriYearData { - if let Some(data) = HijriYearData::lookup( +impl HijriData<'_> { + /// Get the cached data for a given extended year + fn get(&self, extended_year: i32) -> Option { + Some(HijriYearInfo::unpack( extended_year, - simulated_mecca_data::STARTING_YEAR, - simulated_mecca_data::DATA, - ) { - return data; + self.data + .get(usize::try_from(extended_year - self.first_extended_year).ok()?)?, + )) + } +} + +const LONG_YEAR_LEN: u16 = 355; +const SHORT_YEAR_LEN: u16 = 354; + +impl HijriYearInfo { + #[cfg(feature = "datagen")] + fn pack(&self) -> PackedHijriYearInfo { + PackedHijriYearInfo::new(self.value, self.month_lengths, self.start_day) + } + + fn unpack(extended_year: i32, packed: PackedHijriYearInfo) -> Self { + let (month_lengths, start_day) = packed.unpack(extended_year); + + HijriYearInfo { + month_lengths, + start_day, + value: extended_year, + } + } + + /// The number of days in a given 1-indexed month + fn days_in_month(self, month: u8) -> u8 { + let Some(zero_month) = month.checked_sub(1) else { + return 29; + }; + + if self.month_lengths.get(zero_month as usize) == Some(&true) { + 30 + } else { + 29 + } + } + + fn days_in_year(self) -> u16 { + self.last_day_of_month(12) + } + + /// Get the date's R.D. given (m, d) in this info's year + fn md_to_rd(self, month: u8, day: u8) -> RataDie { + let month_offset = if month == 1 { + 0 + } else { + self.last_day_of_month(month - 1) + }; + self.start_day + month_offset as i64 + (day - 1) as i64 + } + + fn md_from_rd(self, rd: RataDie) -> (u8, u8) { + let day_of_year = (rd - self.start_day) as u16; + debug_assert!(day_of_year < 360); + // We divide by 30, not 29, to account for the case where all months before this + // were length 30 (possible near the beginning of the year) + let mut month = (day_of_year / 30) as u8 + 1; + + let day_of_year = day_of_year + 1; + let mut last_day_of_month = self.last_day_of_month(month); + let mut last_day_of_prev_month = if month == 1 { + 0 + } else { + self.last_day_of_month(month - 1) + }; + + while day_of_year > last_day_of_month && month <= 12 { + month += 1; + last_day_of_prev_month = last_day_of_month; + last_day_of_month = self.last_day_of_month(month); } + debug_assert!( + day_of_year - last_day_of_prev_month <= 30, + "Found day {} that doesn't fit in month!", + day_of_year - last_day_of_prev_month + ); + let day = (day_of_year - last_day_of_prev_month) as u8; + (month, day) + } + + // Which day of year is the last day of a month (month is 1-indexed) + fn last_day_of_month(self, month: u8) -> u16 { + 29 * month as u16 + + self + .month_lengths + .get(..month as usize) + .unwrap_or_default() + .iter() + .filter(|&&x| x) + .count() as u16 + } +} + +impl PrecomputedDataSource for HijriSimulated { + fn load_or_compute_info(&self, extended_year: i32) -> HijriYearInfo { + self.data + .as_ref() + .and_then(|d| d.get().get(extended_year)) + .unwrap_or_else(|| self.location.compute_year_info(extended_year)) + } +} + +/// The inner date type used for representing [`Date`]s of [`HijriSimulated`]. See [`Date`] and [`HijriSimulated`] for more details. + +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +pub struct HijriSimulatedDateInner(ArithmeticDate); + +impl CalendarArithmetic for HijriSimulated { + type YearInfo = HijriYearInfo; + + fn days_in_provided_month(year: Self::YearInfo, month: u8) -> u8 { + year.days_in_month(month) + } + + fn months_in_provided_year(_year: Self::YearInfo) -> u8 { + 12 + } + + fn days_in_provided_year(year: Self::YearInfo) -> u16 { + year.days_in_year() + } + + // As an true lunar calendar, it does not have leap years. + fn provided_year_is_leap(year: Self::YearInfo) -> bool { + year.days_in_year() != SHORT_YEAR_LEN + } - let location = match self.location { - SimulatedLocation::Mecca => calendrical_calculations::islamic::MECCA, + fn last_month_day_in_provided_year(year: Self::YearInfo) -> (u8, u8) { + let days = Self::days_in_provided_month(year, 12); + + (12, days) + } +} + +impl crate::cal::scaffold::UnstableSealed for HijriSimulated {} +impl Calendar for HijriSimulated { + type DateInner = HijriSimulatedDateInner; + type Year = types::EraYear; + fn from_codes( + &self, + era: Option<&str>, + year: i32, + month_code: types::MonthCode, + day: u8, + ) -> Result { + let year = match era { + Some("ah") | None => year_check(year, 1..)?, + Some("bh") => 1 - year_check(year, 1..)?, + Some(_) => return Err(DateError::UnknownEra), }; + let Some((month, false)) = month_code.parsed() else { + return Err(DateError::UnknownMonthCode(month_code)); + }; + Ok(HijriSimulatedDateInner(ArithmeticDate::new_from_ordinals( + self.load_or_compute_info(year), + month, + day, + )?)) + } + + fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { + // +1 because the epoch is new year of year 1 + // truncating instead of flooring does not matter, as this is well-defined for + // positive years only + let extended_year = ((rd - calendrical_calculations::islamic::ISLAMIC_EPOCH_FRIDAY) as f64 + / calendrical_calculations::islamic::MEAN_YEAR_LENGTH) + as i32 + + 1; + + let year = self.load_or_compute_info(extended_year); + + let y = if rd < year.start_day { + self.load_or_compute_info(extended_year - 1) + } else { + let next_year = self.load_or_compute_info(extended_year + 1); + if rd < next_year.start_day { + year + } else { + next_year + } + }; + let (m, d) = y.md_from_rd(rd); + HijriSimulatedDateInner(ArithmeticDate::new_unchecked(y, m, d)) + } + + fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { + date.0.year.md_to_rd(date.0.month, date.0.day) + } + + fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner { + self.from_rata_die(Iso.to_rata_die(&iso)) + } + + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + Iso.from_rata_die(self.to_rata_die(date)) + } + + fn months_in_year(&self, date: &Self::DateInner) -> u8 { + date.0.months_in_year() + } + + fn days_in_year(&self, date: &Self::DateInner) -> u16 { + date.0.days_in_year() + } + + fn days_in_month(&self, date: &Self::DateInner) -> u8 { + date.0.days_in_month() + } + + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + date.0.offset_date(offset, self) + } + + fn until( + &self, + date1: &Self::DateInner, + date2: &Self::DateInner, + _calendar2: &Self, + _largest_unit: DateDurationUnit, + _smallest_unit: DateDurationUnit, + ) -> DateDuration { + date1.0.until(date2.0, _largest_unit, _smallest_unit) + } + + fn debug_name(&self) -> &'static str { + Self::DEBUG_NAME + } + + fn year_info(&self, date: &Self::DateInner) -> Self::Year { + era_year(self.extended_year(date)) + } + + fn extended_year(&self, date: &Self::DateInner) -> i32 { + date.0.extended_year() + } + + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { + Self::provided_year_is_leap(date.0.year) + } + + fn month(&self, date: &Self::DateInner) -> types::MonthInfo { + date.0.month() + } + + fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { + date.0.day_of_month() + } + + fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { + date.0.day_of_year() + } + + fn calendar_algorithm(&self) -> Option { + Some(match self.location { + crate::cal::hijri::HijriSimulatedLocation::Mecca => { + crate::preferences::CalendarAlgorithm::Hijri(Some( + crate::preferences::HijriCalendarAlgorithm::Rgsa, + )) + } + }) + } +} +impl HijriSimulatedLocation { + fn compute_year_info(self, extended_year: i32) -> HijriYearInfo { let start_day = calendrical_calculations::islamic::fixed_from_observational_islamic( extended_year, 1, 1, - location, + self.location(), ); let next_start_day = calendrical_calculations::islamic::fixed_from_observational_islamic( extended_year + 1, 1, 1, - location, + self.location(), ); match (next_start_day - start_day) as u16 { - 355 | 354 => (), + LONG_YEAR_LEN | SHORT_YEAR_LEN => (), 353 => { icu_provider::log::trace!( "({}) Found year {extended_year} AH with length {}. See ", - self.debug_name(), + HijriSimulated::DEBUG_NAME, next_start_day - start_day ); } other => { debug_assert!( - !WELL_BEHAVED_ASTRONOMICAL_RANGE.contains(&start_day), + false, "({}) Found year {extended_year} AH with length {}!", - self.debug_name(), + HijriSimulated::DEBUG_NAME, other ) } @@ -199,7 +541,7 @@ impl Rules for AstronomicalSimulation { calendrical_calculations::islamic::observational_islamic_month_days( extended_year, month_idx as u8 + 1, - location, + self.location(), ); match days_in_month { 29 => false, @@ -207,7 +549,7 @@ impl Rules for AstronomicalSimulation { 31 => { icu_provider::log::trace!( "({}) Found year {extended_year} AH with month length {days_in_month} for month {}.", - self.debug_name(), + HijriSimulated::DEBUG_NAME, month_idx + 1 ); excess_days += 1; @@ -215,9 +557,9 @@ impl Rules for AstronomicalSimulation { } _ => { debug_assert!( - !WELL_BEHAVED_ASTRONOMICAL_RANGE.contains(&start_day), + false, "({}) Found year {extended_year} AH with month length {days_in_month} for month {}!", - self.debug_name(), + HijriSimulated::DEBUG_NAME, month_idx + 1 ); false @@ -228,638 +570,319 @@ impl Rules for AstronomicalSimulation { // a 31-day month, "move" the day to the first 29-day month in the // same year to maintain all months at 29 or 30 days. if excess_days != 0 { - debug_assert!( - excess_days == 1 || !WELL_BEHAVED_ASTRONOMICAL_RANGE.contains(&start_day), + debug_assert_eq!( + excess_days, + 1, "({}) Found year {extended_year} AH with more than one excess day!", - self.debug_name() + HijriSimulated::DEBUG_NAME ); if let Some(l) = month_lengths.iter_mut().find(|l| !(**l)) { - *l = true; - } - } - month_lengths - }; - HijriYearData::try_new(extended_year, start_day, month_lengths) - .unwrap_or_else(|| UmmAlQura.year_data(extended_year)) - } -} - -/// [`Hijri`] [`Rules`] for the [Umm al-Qura](https://en.wikipedia.org/wiki/Islamic_calendar#Saudi_Arabia's_Umm_al-Qura_calendar) calendar. -/// -/// From the start of 1300 AH (1882-11-12 ISO) to the end of 1600 AH (2174-11-25 ISO), this -/// `Rules` implementation uses Umm al-Qura month lengths obtained from -/// [KACST](https://kacst.gov.sa/). Outside this range, this implementation falls back to -/// [`TabularAlgorithm`] with [`TabularAlgorithmLeapYears::TypeII`] and [`TabularAlgorithmEpoch::Friday`]. -/// -/// The precise behavior of this calendar may change in the future if: -/// - New ground truth is established by published government sources -/// - We decide to use a different algorithm outside the KACST range -/// - We decide to expand or reduce the range where we are correctly handling past dates. -/// -/// This corresponds to the `"islamic-umalqura"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). -#[derive(Copy, Clone, Debug, Default)] -#[non_exhaustive] -pub struct UmmAlQura; - -impl crate::cal::scaffold::UnstableSealed for UmmAlQura {} -impl Rules for UmmAlQura { - fn calendar_algorithm(&self) -> Option { - Some(CalendarAlgorithm::Hijri(Some( - HijriCalendarAlgorithm::Umalqura, - ))) - } - - fn ecma_reference_year( - &self, - month_code: (u8, bool), - day: u8, - ) -> Result { - let (ordinal_month, false) = month_code else { - return Err(EcmaReferenceYearError::MonthCodeNotInCalendar); - }; - - let extended_year = match (ordinal_month, day) { - (1, _) => 1392, - (2, 30..) => 1390, - (2, _) => 1392, - (3, 30..) => 1391, - (3, _) => 1392, - (4, _) => 1392, - (5, 30..) => 1391, - (5, _) => 1392, - (6, _) => 1392, - (7, 30..) => 1389, - (7, _) => 1392, - (8, _) => 1392, - (9, _) => 1392, - (10, 30..) => 1390, - (10, _) => 1392, - (11, ..=25) => 1392, - (11, _) => 1391, - (12, 30..) => 1390, - (12, _) => 1391, - _ => return Err(EcmaReferenceYearError::MonthCodeNotInCalendar), - }; - Ok(extended_year) - } - - fn debug_name(&self) -> &'static str { - "Hijri (Umm al-Qura)" - } - - fn year_data(&self, extended_year: i32) -> HijriYearData { - if let Some(data) = HijriYearData::lookup( - extended_year, - ummalqura_data::STARTING_YEAR, - ummalqura_data::DATA, - ) { - data - } else { - TabularAlgorithm { - leap_years: TabularAlgorithmLeapYears::TypeII, - epoch: TabularAlgorithmEpoch::Friday, - } - .year_data(extended_year) - } - } -} - -/// [`Hijri`] [`Rules`] for the [Tabular Hijri Algorithm](https://en.wikipedia.org/wiki/Tabular_Islamic_calendar). -/// -/// See [`TabularAlgorithmEpoch`] and [`TabularAlgorithmLeapYears`] for customization. -/// -/// The most common version of these rules uses [`TabularAlgorithmEpoch::Friday`] and [`TabularAlgorithmLeapYears::TypeII`]. -/// -/// When constructed with [`TabularAlgorithmLeapYears::TypeII`], and either [`TabularAlgorithmEpoch::Friday`] or [`TabularAlgorithmEpoch::Thursday`], -/// this corresponds to the `"islamic-civil"` and `"islamic-tbla"` [CLDR calendars](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier) respectively. -#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] -pub struct TabularAlgorithm { - pub(crate) leap_years: TabularAlgorithmLeapYears, - pub(crate) epoch: TabularAlgorithmEpoch, -} - -impl TabularAlgorithm { - /// Construct a new [`TabularAlgorithm`] with the given leap year rule and epoch. - pub const fn new(leap_years: TabularAlgorithmLeapYears, epoch: TabularAlgorithmEpoch) -> Self { - Self { epoch, leap_years } - } -} - -impl crate::cal::scaffold::UnstableSealed for TabularAlgorithm {} -impl Rules for TabularAlgorithm { - fn calendar_algorithm(&self) -> Option { - Some(match (self.epoch, self.leap_years) { - (TabularAlgorithmEpoch::Friday, TabularAlgorithmLeapYears::TypeII) => { - CalendarAlgorithm::Hijri(Some(HijriCalendarAlgorithm::Civil)) - } - (TabularAlgorithmEpoch::Thursday, TabularAlgorithmLeapYears::TypeII) => { - CalendarAlgorithm::Hijri(Some(HijriCalendarAlgorithm::Tbla)) - } - }) - } - - fn ecma_reference_year( - &self, - month_code: (u8, bool), - day: u8, - ) -> Result { - let (ordinal_month, false) = month_code else { - return Err(EcmaReferenceYearError::MonthCodeNotInCalendar); - }; - - Ok(match (ordinal_month, day) { - (1, _) => 1392, - (2, 30..) => 1389, - (2, _) => 1392, - (3, _) => 1392, - (4, 30..) => 1389, - (4, _) => 1392, - (5, _) => 1392, - (6, 30..) => 1389, - (6, _) => 1392, - (7, _) => 1392, - (8, 30..) => 1389, - (8, _) => 1392, - (9, _) => 1392, - (10, 30..) => 1389, - (10, _) => 1392, - (11, ..=26) if self.epoch == TabularAlgorithmEpoch::Thursday => 1392, - (11, ..=25) if self.epoch == TabularAlgorithmEpoch::Friday => 1392, - (11, _) => 1391, - (12, 30..) => 1390, - (12, _) => 1391, - _ => return Err(EcmaReferenceYearError::MonthCodeNotInCalendar), - }) - } - - fn debug_name(&self) -> &'static str { - match self.epoch { - TabularAlgorithmEpoch::Friday => "Hijri (civil)", - TabularAlgorithmEpoch::Thursday => "Hijri (astronomical)", - } - } - - fn year_data(&self, extended_year: i32) -> HijriYearData { - let start_day = calendrical_calculations::islamic::fixed_from_tabular_islamic( - extended_year, - 1, - 1, - self.epoch.rata_die(), - ); - let month_lengths = core::array::from_fn(|m| { - m % 2 == 0 - || m == 11 - && match self.leap_years { - TabularAlgorithmLeapYears::TypeII => { - (14 + 11 * extended_year as i64).rem_euclid(30) < 11 - } - } - }); - HijriYearData { - // start_day is within 5 days of the tabular start day (trivial), and month lengths - // has either 6 or 7 long months. - packed: PackedHijriYearData::new_unchecked(extended_year, month_lengths, start_day), - extended_year, + *l = true; + } + } + month_lengths + }; + HijriYearInfo { + month_lengths, + start_day, + value: extended_year, } } } -impl Hijri { - /// Use [`Self::new_simulated_mecca`]. - #[cfg(feature = "compiled_data")] - #[deprecated(since = "2.1.0", note = "use `Hijri::new_simulated_mecca`")] - pub const fn new_mecca() -> Self { - Self::new_simulated_mecca() - } +impl HijriSimulated { + pub(crate) const DEBUG_NAME: &'static str = "Hijri (simulated)"; +} - /// Creates a [`Hijri`] calendar using simulated sightings at Mecca. +impl> Date
{ + /// Construct new simulated Hijri Date. /// - /// These simulations are unofficial and are known to not necessarily match sightings - /// on the ground. Unless you know otherwise for sure, instead of this variant, use - /// [`Hijri::new_umm_al_qura`], which uses the results of KACST's Mecca-based calculations. - pub const fn new_simulated_mecca() -> Self { - Self(AstronomicalSimulation { - location: SimulatedLocation::Mecca, - }) + /// ```rust + /// use icu::calendar::cal::HijriSimulated; + /// use icu::calendar::Date; + /// + /// let hijri = HijriSimulated::new_mecca_always_calculating(); + /// + /// let date_hijri = + /// Date::try_new_simulated_hijri_with_calendar(1392, 4, 25, hijri) + /// .expect("Failed to initialize Hijri Date instance."); + /// + /// assert_eq!(date_hijri.era_year().year, 1392); + /// assert_eq!(date_hijri.month().ordinal, 4); + /// assert_eq!(date_hijri.day_of_month().0, 25); + /// ``` + pub fn try_new_simulated_hijri_with_calendar( + year: i32, + month: u8, + day: u8, + calendar: A, + ) -> Result, RangeError> { + let y = calendar.as_calendar().load_or_compute_info(year); + ArithmeticDate::new_from_ordinals(y, month, day) + .map(HijriSimulatedDateInner) + .map(|inner| Date::from_raw(inner, calendar)) } +} - #[cfg(feature = "serde")] - #[doc = icu_provider::gen_buffer_unstable_docs!(BUFFER,Self::new)] - #[deprecated(since = "2.1.0", note = "use `Hijri::new_simulated_mecca`")] - pub fn try_new_mecca_with_buffer_provider( - _provider: &(impl icu_provider::buf::BufferProvider + ?Sized), - ) -> Result { - Ok(Self::new_simulated_mecca()) - } +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +/// The inner date type used for representing [`Date`]s of [`HijriUmmAlQura`]. See [`Date`] and [`HijriUmmAlQura`] for more details. +pub struct HijriUmmAlQuraDateInner(ArithmeticDate); - #[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new_mecca)] - #[deprecated(since = "2.1.0", note = "use `Hijri::new_simulated_mecca`")] - pub fn try_new_mecca_unstable(_provider: &D) -> Result { - Ok(Self::new_simulated_mecca()) +impl CalendarArithmetic for HijriUmmAlQura { + type YearInfo = HijriYearInfo; + + fn days_in_provided_month(year: Self::YearInfo, month: u8) -> u8 { + year.days_in_month(month) } - /// Use [`Self::new_simulated_mecca`]. - #[deprecated(since = "2.1.0", note = "use `Hijri::new_simulated_mecca`")] - pub const fn new_mecca_always_calculating() -> Self { - Self::new_simulated_mecca() + fn months_in_provided_year(_year: HijriYearInfo) -> u8 { + 12 } -} -impl Hijri { - /// Use [`Self::new_umm_al_qura`] - #[deprecated(since = "2.1.0", note = "use `Self::new_umm_al_qura`")] - pub const fn new() -> Self { - Self(UmmAlQura) + fn days_in_provided_year(year: Self::YearInfo) -> u16 { + year.days_in_year() } - /// Creates a [`Hijri`] calendar using [`UmmAlQura`] rules. - pub const fn new_umm_al_qura() -> Self { - Self(UmmAlQura) + // As an true lunar calendar, it does not have leap years. + fn provided_year_is_leap(year: Self::YearInfo) -> bool { + year.days_in_year() != SHORT_YEAR_LEN } -} -/// The epoch for the [`TabularAlgorithm`] rules. -#[non_exhaustive] -#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] -pub enum TabularAlgorithmEpoch { - /// Thusday July 15, 622 AD Julian (0622-07-18 ISO) - Thursday, - /// Friday July 16, 622 AD Julian (0622-07-19 ISO) - Friday, -} + fn last_month_day_in_provided_year(year: HijriYearInfo) -> (u8, u8) { + let days = Self::days_in_provided_month(year, 12); -impl TabularAlgorithmEpoch { - fn rata_die(self) -> RataDie { - match self { - Self::Thursday => ISLAMIC_EPOCH_THURSDAY, - Self::Friday => ISLAMIC_EPOCH_FRIDAY, - } + (12, days) } } -/// The leap year rule for the [`TabularAlgorithm`] rules. -/// -/// This specifies which years of a 30-year cycle have an additional day at -/// the end of the year. -#[non_exhaustive] -#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] -pub enum TabularAlgorithmLeapYears { - /// Leap years 2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29 - TypeII, -} - -impl Hijri { - /// Use [`Self::new_tabular`] - #[deprecated(since = "2.1.0", note = "use `Hijri::new_tabular`")] - pub const fn new(leap_years: TabularAlgorithmLeapYears, epoch: TabularAlgorithmEpoch) -> Self { - Hijri::new_tabular(leap_years, epoch) +impl crate::cal::scaffold::UnstableSealed for HijriUmmAlQura {} +impl Calendar for HijriUmmAlQura { + type DateInner = HijriUmmAlQuraDateInner; + type Year = types::EraYear; + fn from_codes( + &self, + era: Option<&str>, + year: i32, + month_code: types::MonthCode, + day: u8, + ) -> Result { + let year = match era { + Some("ah") | None => year_check(year, 1..)?, + Some("bh") => 1 - year_check(year, 1..)?, + Some(_) => return Err(DateError::UnknownEra), + }; + let Some((month, false)) = month_code.parsed() else { + return Err(DateError::UnknownMonthCode(month_code)); + }; + Ok(HijriUmmAlQuraDateInner(ArithmeticDate::new_from_ordinals( + self.load_or_compute_info(year), + month, + day, + )?)) } - /// Creates a [`Hijri`] calendar with tabular rules and the given leap year rule and epoch. - pub const fn new_tabular( - leap_years: TabularAlgorithmLeapYears, - epoch: TabularAlgorithmEpoch, - ) -> Self { - Self(TabularAlgorithm::new(leap_years, epoch)) - } -} + fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { + // +1 because the epoch is new year of year 1 + // truncating instead of flooring does not matter, as this is well-defined for + // positive years only + let extended_year = ((rd - calendrical_calculations::islamic::ISLAMIC_EPOCH_FRIDAY) as f64 + / calendrical_calculations::islamic::MEAN_YEAR_LENGTH) + as i32 + + 1; -/// Information about a Hijri year. -#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] -pub struct HijriYearData { - packed: PackedHijriYearData, - extended_year: i32, -} + let year = self.load_or_compute_info(extended_year); -impl ToExtendedYear for HijriYearData { - fn to_extended_year(&self) -> i32 { - self.extended_year + let y = if rd < year.start_day { + self.load_or_compute_info(extended_year - 1) + } else { + let next_year = self.load_or_compute_info(extended_year + 1); + if rd < next_year.start_day { + year + } else { + next_year + } + }; + let (m, d) = y.md_from_rd(rd); + HijriUmmAlQuraDateInner(ArithmeticDate::new_unchecked(y, m, d)) } -} -impl HijriYearData { - /// Creates [`HijriYearData`] from the given parts. - /// - /// `start_day` is the date for the first day of the year, see [`Date::to_rata_die`] - /// to obtain a [`RataDie`] from a [`Date`] in an arbitrary calendar. `start_day` has - /// to be within 5 days of the start of the year of the [`TabularAlgorithm`]. - /// - /// `month_lengths[n - 1]` is true if the nth month has 30 days, and false otherwise. - /// Either 6 or 7 months need to have 30 days. - pub fn try_new( - extended_year: i32, - start_day: RataDie, - month_lengths: [bool; 12], - ) -> Option { - Some(Self { - packed: PackedHijriYearData::try_new(extended_year, month_lengths, start_day)?, - extended_year, - }) + fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { + date.0.year.md_to_rd(date.0.month, date.0.day) } - fn lookup( - extended_year: i32, - starting_year: i32, - data: &[PackedHijriYearData], - ) -> Option { - Some(extended_year) - .and_then(|e| usize::try_from(e.checked_sub(starting_year)?).ok()) - .and_then(|i| data.get(i)) - .map(|&packed| Self { - extended_year, - packed, - }) + fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner { + self.from_rata_die(Iso.to_rata_die(&iso)) } - fn new_year(self) -> RataDie { - self.packed.new_year(self.extended_year) + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + Iso.from_rata_die(self.to_rata_die(date)) } -} - -/// The struct containing compiled Hijri YearInfo -/// -/// * `start_day` has to be within 5 days of the start of the year of the [`TabularAlgorithm`]. -/// * `month_lengths[n - 1]` has either 6 or 7 long months. -/// -/// Bit structure -/// -/// ```text -/// Bit: F.........C B.............0 -/// Value: [ start day ][ month lengths ] -/// ``` -/// -/// The start day is encoded as a signed offset from `Self::mean_tabular_start_day`. This number does not -/// appear to be less than 2, however we use all remaining bits for it in case of drift in the math. -/// The month lengths are stored as 1 = 30, 0 = 29 for each month including the leap month. -/// -///
-/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, -/// including in SemVer minor releases. While the serde representation of data structs is guaranteed -/// to be stable, their Rust representation might not be. Use with caution. -///
-#[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Debug)] -struct PackedHijriYearData(u16); - -impl PackedHijriYearData { - const fn try_new( - extended_year: i32, - month_lengths: [bool; 12], - start_day: RataDie, - ) -> Option { - let start_offset = start_day.since(Self::mean_tabular_start_day(extended_year)); - - if !(-8 < start_offset && start_offset < 8 - || calendrical_calculations::islamic::WELL_BEHAVED_ASTRONOMICAL_RANGE - .start - .to_i64_date() - > start_day.to_i64_date() - || calendrical_calculations::islamic::WELL_BEHAVED_ASTRONOMICAL_RANGE - .end - .to_i64_date() - < start_day.to_i64_date()) - { - return None; - } - let start_offset = start_offset as i8 & 0b1000_0111u8 as i8; - - let mut all = 0u16; - - let mut num_days = 29 * 12; - - let mut i = 0; - while i < 12 { - #[expect(clippy::indexing_slicing)] - if month_lengths[i] { - all |= 1 << i; - num_days += 1; - } - i += 1; - } - - if !matches!(num_days, 354 | 355) { - return None; - } - if start_offset < 0 { - all |= 1 << 12; - } - all |= (start_offset.unsigned_abs() as u16) << 13; - Some(Self(all)) + fn months_in_year(&self, date: &Self::DateInner) -> u8 { + date.0.months_in_year() } - const fn new_unchecked( - extended_year: i32, - month_lengths: [bool; 12], - start_day: RataDie, - ) -> Self { - let start_offset = start_day.since(Self::mean_tabular_start_day(extended_year)); - - let start_offset = start_offset as i8 & 0b1000_0111u8 as i8; - - let mut all = 0u16; + fn days_in_year(&self, date: &Self::DateInner) -> u16 { + date.0.days_in_year() + } - let mut i = 0; - while i < 12 { - #[expect(clippy::indexing_slicing)] - if month_lengths[i] { - all |= 1 << i; - } - i += 1; - } + fn days_in_month(&self, date: &Self::DateInner) -> u8 { + date.0.days_in_month() + } - if start_offset < 0 { - all |= 1 << 12; - } - all |= (start_offset.unsigned_abs() as u16) << 13; - Self(all) + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + date.0.offset_date(offset, &HijriUmmAlQura) } - fn new_year(self, extended_year: i32) -> RataDie { - let start_offset = if (self.0 & 0b1_0000_0000_0000) != 0 { - -((self.0 >> 13) as i64) - } else { - (self.0 >> 13) as i64 - }; - Self::mean_tabular_start_day(extended_year) + start_offset + fn until( + &self, + date1: &Self::DateInner, + date2: &Self::DateInner, + _calendar2: &Self, + _largest_unit: DateDurationUnit, + _smallest_unit: DateDurationUnit, + ) -> DateDuration { + date1.0.until(date2.0, _largest_unit, _smallest_unit) } - fn month_has_30_days(self, month: u8) -> bool { - self.0 & (1 << (month - 1) as u16) != 0 + fn debug_name(&self) -> &'static str { + Self::DEBUG_NAME } - fn is_leap(self) -> bool { - (self.0 & ((1 << 12) - 1)).count_ones() == 7 + fn year_info(&self, date: &Self::DateInner) -> Self::Year { + era_year(self.extended_year(date)) } - // month is 1-indexed, but 0 is a valid input, producing 0 - fn last_day_of_month(self, month: u8) -> u16 { - // month is 1-indexed, so `29 * month` includes the current month - let mut prev_month_lengths = 29 * month as u16; - // month is 1-indexed, so `1 << month` is a mask with all zeroes except - // for a 1 at the bit index at the next month. Subtracting 1 from it gets us - // a bitmask for all months up to now - let long_month_bits = self.0 & ((1 << month as u16) - 1); - prev_month_lengths += long_month_bits.count_ones().try_into().unwrap_or(0); - prev_month_lengths + fn extended_year(&self, date: &Self::DateInner) -> i32 { + date.0.extended_year() } - fn days_in_year(self) -> u16 { - self.last_day_of_month(12) + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { + Self::provided_year_is_leap(date.0.year) } - const fn mean_tabular_start_day(extended_year: i32) -> RataDie { - // -1 because the epoch is new year of year 1 - calendrical_calculations::islamic::ISLAMIC_EPOCH_FRIDAY - .add((extended_year as i64 - 1) * (354 * 30 + 11) / 30) + fn month(&self, date: &Self::DateInner) -> types::MonthInfo { + date.0.month() } -} -impl>> Date
{ - /// Deprecated - #[deprecated(since = "2.1.0", note = "use `Date::try_new_hijri_with_calendar`")] - pub fn try_new_simulated_hijri_with_calendar( - year: i32, - month: u8, - day: u8, - calendar: A, - ) -> Result, RangeError> { - Date::try_new_hijri_with_calendar(year, month, day, calendar) + fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { + date.0.day_of_month() } -} -#[test] -fn computer_reference_years() { - let rules = UmmAlQura; + fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { + date.0.day_of_year() + } - fn compute_hijri_reference_year( - ordinal_month: u8, - day: u8, - cal: &C, - year_info_from_extended: impl Fn(i32) -> C::YearInfo, - ) -> Result - where - C: DateFieldsResolver, - { - let dec_31 = Date::from_rata_die( - crate::cal::abstract_gregorian::LAST_DAY_OF_REFERENCE_YEAR, - crate::Ref(cal), - ); - // December 31, 1972 occurs in the 11th month, 1392 AH, but the day could vary - debug_assert_eq!(dec_31.month().ordinal, 11); - let (y0, y1, y2, y3) = - if ordinal_month < 11 || (ordinal_month == 11 && day <= dec_31.day_of_month().0) { - (1389, 1390, 1391, 1392) - } else { - (1388, 1389, 1390, 1391) - }; - let year_info = year_info_from_extended(y3); - if day <= C::days_in_provided_month(year_info, ordinal_month) { - return Ok(year_info); - } - let year_info = year_info_from_extended(y2); - if day <= C::days_in_provided_month(year_info, ordinal_month) { - return Ok(year_info); - } - let year_info = year_info_from_extended(y1); - if day <= C::days_in_provided_month(year_info, ordinal_month) { - return Ok(year_info); - } - let year_info = year_info_from_extended(y0); - // This function might be called with out-of-range days that are handled later. - // Some calendars don't have day 30s in every month so we don't check those. - if day <= 29 { - debug_assert!( - day <= C::days_in_provided_month(year_info, ordinal_month), - "{ordinal_month}/{day}" - ); - } - Ok(year_info) + fn calendar_algorithm(&self) -> Option { + let expected_calendar = crate::preferences::CalendarAlgorithm::Hijri(Some( + crate::preferences::HijriCalendarAlgorithm::Umalqura, + )); + Some(expected_calendar) } - for month in 1..=12 { - for day in [30, 29] { - let y = compute_hijri_reference_year(month, day, &Hijri(rules), |e| rules.year_data(e)) - .unwrap() - .extended_year; +} - if day == 30 { - println!("({month}, {day}) => {y},") - } else { - println!("({month}, _) => {y},") +impl PrecomputedDataSource for HijriUmmAlQura { + fn load_or_compute_info(&self, year: i32) -> HijriYearInfo { + if let Some(&packed) = usize::try_from(year - UMMALQURA_DATA_STARTING_YEAR) + .ok() + .and_then(|i| UMMALQURA_DATA.get(i)) + { + HijriYearInfo::unpack(year, packed) + } else { + HijriYearInfo { + value: year, + month_lengths: core::array::from_fn(|i| { + HijriTabular::days_in_provided_month(year, i as u8 + 1) == 30 + }), + start_day: calendrical_calculations::islamic::fixed_from_tabular_islamic( + year, + 1, + 1, + ISLAMIC_EPOCH_FRIDAY, + ), } } } } -#[allow(clippy::derived_hash_with_manual_eq)] // bounds -#[derive(Clone, Debug, Hash)] -/// The inner date type used for representing [`Date`]s of [`Hijri`]. See [`Date`] and [`Hijri`] for more details. -pub struct HijriDateInner(ArithmeticDate>); - -impl Copy for HijriDateInner {} -impl PartialEq for HijriDateInner { - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } -} -impl Eq for HijriDateInner {} -impl PartialOrd for HijriDateInner { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } +impl HijriUmmAlQura { + pub(crate) const DEBUG_NAME: &'static str = "Hijri (Umm al-Qura)"; } -impl Ord for HijriDateInner { - fn cmp(&self, other: &Self) -> core::cmp::Ordering { - self.0.cmp(&other.0) + +impl Date { + /// Construct new Hijri Umm al-Qura Date. + /// + /// ```rust + /// use icu::calendar::cal::HijriUmmAlQura; + /// use icu::calendar::Date; + /// + /// let date_hijri = Date::try_new_ummalqura(1392, 4, 25) + /// .expect("Failed to initialize Hijri Date instance."); + /// + /// assert_eq!(date_hijri.era_year().year, 1392); + /// assert_eq!(date_hijri.month().ordinal, 4); + /// assert_eq!(date_hijri.day_of_month().0, 25); + /// ``` + pub fn try_new_ummalqura( + year: i32, + month: u8, + day: u8, + ) -> Result, RangeError> { + let y = HijriUmmAlQura.load_or_compute_info(year); + Ok(Date::from_raw( + HijriUmmAlQuraDateInner(ArithmeticDate::new_from_ordinals(y, month, day)?), + HijriUmmAlQura, + )) } } -impl DateFieldsResolver for Hijri { - type YearInfo = HijriYearData; +/// The inner date type used for representing [`Date`]s of [`HijriTabular`]. See [`Date`] and [`HijriTabular`] for more details. - fn days_in_provided_month(year: Self::YearInfo, month: u8) -> u8 { - 29 + year.packed.month_has_30_days(month) as u8 +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +pub struct HijriTabularDateInner(ArithmeticDate); + +impl CalendarArithmetic for HijriTabular { + type YearInfo = i32; + + fn days_in_provided_month(year: i32, month: u8) -> u8 { + match month { + 1 | 3 | 5 | 7 | 9 | 11 => 30, + 2 | 4 | 6 | 8 | 10 => 29, + 12 if Self::provided_year_is_leap(year) => 30, + 12 => 29, + _ => 0, + } } fn months_in_provided_year(_year: Self::YearInfo) -> u8 { 12 } - #[inline] - fn year_info_from_era( - &self, - era: &[u8], - era_year: i32, - ) -> Result { - let extended_year = match era { - b"ah" => era_year, - b"bh" => 1 - era_year, - _ => return Err(UnknownEraError), - }; - Ok(self.year_info_from_extended(extended_year)) + fn days_in_provided_year(year: i32) -> u16 { + if Self::provided_year_is_leap(year) { + LONG_YEAR_LEN + } else { + SHORT_YEAR_LEN + } } - #[inline] - fn year_info_from_extended(&self, extended_year: i32) -> Self::YearInfo { - self.0.year_data(extended_year) + fn provided_year_is_leap(year: i32) -> bool { + (14 + 11 * year).rem_euclid(30) < 11 } - #[inline] - fn reference_year_from_month_day( - &self, - month_code: types::ValidMonthCode, - day: u8, - ) -> Result { - self.0 - .ecma_reference_year(month_code.to_tuple(), day) - .map(|y| self.0.year_data(y)) + fn last_month_day_in_provided_year(year: i32) -> (u8, u8) { + if Self::provided_year_is_leap(year) { + (12, 30) + } else { + (12, 29) + } } } -impl crate::cal::scaffold::UnstableSealed for Hijri {} -impl Calendar for Hijri { - type DateInner = HijriDateInner; +impl crate::cal::scaffold::UnstableSealed for HijriTabular {} +impl Calendar for HijriTabular { + type DateInner = HijriTabularDateInner; type Year = types::EraYear; - type DifferenceError = core::convert::Infallible; fn from_codes( &self, @@ -868,200 +891,157 @@ impl Calendar for Hijri { month_code: types::MonthCode, day: u8, ) -> Result { - ArithmeticDate::from_codes(era, year, month_code, day, self).map(HijriDateInner) - } + let year = match era { + Some("ah") | None => year_check(year, 1..)?, + Some("bh") => 1 - year_check(year, 1..)?, + Some(_) => return Err(DateError::UnknownEra), + }; - #[cfg(feature = "unstable")] - fn from_fields( - &self, - fields: DateFields, - options: DateFromFieldsOptions, - ) -> Result { - ArithmeticDate::from_fields(fields, options, self).map(HijriDateInner) + ArithmeticDate::new_from_codes(self, year, month_code, day).map(HijriTabularDateInner) } fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { - // (354 * 30 + 11) / 30 is the mean year length for a tabular year - // This is slightly different from the `calendrical_calculations::islamic::MEAN_YEAR_LENGTH`, which is based on - // the (current) synodic month length. - // - // +1 because the epoch is new year of year 1 - // Before the epoch the division will round up (towards 0), so we need to - // subtract 1, which is the same as not adding the 1. - let extended_year = (rd - calendrical_calculations::islamic::ISLAMIC_EPOCH_FRIDAY) * 30 - / (354 * 30 + 11) - + (rd >= calendrical_calculations::islamic::ISLAMIC_EPOCH_FRIDAY) as i64; - - let extended_year = extended_year.clamp(i32::MIN as i64, i32::MAX as i64) as i32; - - let mut year = self.0.year_data(extended_year); - - // We rounded the extended year down, so we might need to use the next year - if rd >= year.new_year() + year.packed.days_in_year() as i64 && extended_year < i32::MAX { - year = self.0.year_data(year.extended_year + 1) - } - - // Clamp the RD to our year - let rd = rd.clamp( - year.new_year(), - year.new_year() + year.packed.days_in_year() as i64, - ); - - let day_of_year = (rd - year.new_year()) as u16; + let (y, m, d) = match self.leap_years { + HijriTabularLeapYears::TypeII => { + calendrical_calculations::islamic::tabular_islamic_from_fixed( + rd, + self.epoch.rata_die(), + ) + } + }; - // We divide by 30, not 29, to account for the case where all months before this - // were length 30 (possible near the beginning of the year) - let mut month = (day_of_year / 30) as u8 + 1; - let mut last_day_of_month = year.packed.last_day_of_month(month); - let mut last_day_of_prev_month = year.packed.last_day_of_month(month - 1); + debug_assert!(Date::try_new_hijri_tabular_with_calendar(y, m, d, crate::Ref(self)).is_ok()); + HijriTabularDateInner(ArithmeticDate::new_unchecked(y, m, d)) + } - while day_of_year >= last_day_of_month { - month += 1; - last_day_of_prev_month = last_day_of_month; - last_day_of_month = year.packed.last_day_of_month(month); + fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { + match self.leap_years { + HijriTabularLeapYears::TypeII => { + calendrical_calculations::islamic::fixed_from_tabular_islamic( + date.0.year, + date.0.month, + date.0.day, + self.epoch.rata_die(), + ) + } } - - let day = (day_of_year + 1 - last_day_of_prev_month) as u8; - - HijriDateInner(ArithmeticDate::new_unchecked(year, month, day)) } - fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { - date.0.year.new_year() - + date.0.year.packed.last_day_of_month(date.0.month - 1) as i64 - + (date.0.day - 1) as i64 + fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner { + self.from_rata_die(Iso.to_rata_die(&iso)) } - fn has_cheap_iso_conversion(&self) -> bool { - false + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + Iso.from_rata_die(self.to_rata_die(date)) } fn months_in_year(&self, date: &Self::DateInner) -> u8 { - Self::months_in_provided_year(date.0.year) + date.0.months_in_year() } fn days_in_year(&self, date: &Self::DateInner) -> u16 { - date.0.year.packed.days_in_year() + date.0.days_in_year() } fn days_in_month(&self, date: &Self::DateInner) -> u8 { - Self::days_in_provided_month(date.0.year, date.0.month) + date.0.days_in_month() } - #[cfg(feature = "unstable")] - fn add( - &self, - date: &Self::DateInner, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result { - date.0.added(duration, self, options).map(HijriDateInner) + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + date.0.offset_date(offset, &()) } - #[cfg(feature = "unstable")] fn until( &self, date1: &Self::DateInner, date2: &Self::DateInner, - options: DateDifferenceOptions, - ) -> Result { - Ok(date1.0.until(&date2.0, self, options)) + _calendar2: &Self, + _largest_unit: DateDurationUnit, + _smallest_unit: DateDurationUnit, + ) -> DateDuration { + date1.0.until(date2.0, _largest_unit, _smallest_unit) } fn debug_name(&self) -> &'static str { - self.0.debug_name() + match self.epoch { + HijriTabularEpoch::Friday => "Hijri (civil)", + HijriTabularEpoch::Thursday => "Hijri (astronomical)", + } } fn year_info(&self, date: &Self::DateInner) -> Self::Year { - let extended_year = date.0.year.extended_year; - if extended_year > 0 { - types::EraYear { - era: tinystr!(16, "ah"), - era_index: Some(0), - year: extended_year, - extended_year, - ambiguity: types::YearAmbiguity::CenturyRequired, - } - } else { - types::EraYear { - era: tinystr!(16, "bh"), - era_index: Some(1), - year: 1 - extended_year, - extended_year, - ambiguity: types::YearAmbiguity::CenturyRequired, - } - } + era_year(self.extended_year(date)) + } + + fn extended_year(&self, date: &Self::DateInner) -> i32 { + date.0.extended_year() } fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { - date.0.year.packed.is_leap() + Self::provided_year_is_leap(date.0.year) } fn month(&self, date: &Self::DateInner) -> types::MonthInfo { - types::MonthInfo::non_lunisolar(date.0.month) + date.0.month() } fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { - types::DayOfMonth(date.0.day) + date.0.day_of_month() } fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { - types::DayOfYear(date.0.year.packed.last_day_of_month(date.0.month - 1) + date.0.day as u16) + date.0.day_of_year() } fn calendar_algorithm(&self) -> Option { - self.0.calendar_algorithm() + let expected_calendar = match (self.epoch, self.leap_years) { + (crate::cal::HijriTabularEpoch::Friday, crate::cal::HijriTabularLeapYears::TypeII) => { + crate::preferences::CalendarAlgorithm::Hijri(Some( + crate::preferences::HijriCalendarAlgorithm::Civil, + )) + } + ( + crate::cal::HijriTabularEpoch::Thursday, + crate::cal::HijriTabularLeapYears::TypeII, + ) => crate::preferences::CalendarAlgorithm::Hijri(Some( + crate::preferences::HijriCalendarAlgorithm::Tbla, + )), + }; + Some(expected_calendar) } } -impl>, R: Rules> Date { - /// Construct new Hijri Date. +impl> Date { + /// Construct new Tabular Hijri Date. /// /// ```rust - /// use icu::calendar::cal::Hijri; + /// use icu::calendar::cal::{ + /// HijriTabular, HijriTabularEpoch, HijriTabularLeapYears, + /// }; /// use icu::calendar::Date; /// - /// let hijri = Hijri::new_simulated_mecca(); + /// let hijri = HijriTabular::new( + /// HijriTabularLeapYears::TypeII, + /// HijriTabularEpoch::Thursday, + /// ); /// - /// let date_hijri = Date::try_new_hijri_with_calendar(1392, 4, 25, hijri) - /// .expect("Failed to initialize Hijri Date instance."); + /// let date_hijri = + /// Date::try_new_hijri_tabular_with_calendar(1392, 4, 25, hijri) + /// .expect("Failed to initialize Hijri Date instance."); /// /// assert_eq!(date_hijri.era_year().year, 1392); /// assert_eq!(date_hijri.month().ordinal, 4); /// assert_eq!(date_hijri.day_of_month().0, 25); /// ``` - pub fn try_new_hijri_with_calendar( - year: i32, - month: u8, - day: u8, - calendar: A, - ) -> Result { - let y = calendar.as_calendar().0.year_data(year); - Ok(Date::from_raw( - HijriDateInner(ArithmeticDate::try_from_ymd(y, month, day)?), - calendar, - )) - } -} - -impl Date> { - /// Deprecated - #[deprecated(since = "2.1.0", note = "use `Date::try_new_hijri_with_calendar")] - pub fn try_new_ummalqura(year: i32, month: u8, day: u8) -> Result { - Date::try_new_hijri_with_calendar(year, month, day, Hijri::new_umm_al_qura()) - } -} - -impl>> Date { - /// Deprecated - #[deprecated(since = "2.1.0", note = "use `Date::try_new_hijri_with_calendar")] pub fn try_new_hijri_tabular_with_calendar( year: i32, month: u8, day: u8, calendar: A, ) -> Result, RangeError> { - Date::try_new_hijri_with_calendar(year, month, day, calendar) + ArithmeticDate::new_from_ordinals(year, month, day) + .map(HijriTabularDateInner) + .map(|inner| Date::from_raw(inner, calendar)) } } @@ -1070,6 +1050,7 @@ mod test { use types::MonthCode; use super::*; + use crate::Ref; const START_YEAR: i32 = -1245; const END_YEAR: i32 = 1518; @@ -1761,11 +1742,14 @@ mod test { #[test] fn test_simulated_hijri_from_rd() { - let calendar = Hijri::new_simulated_mecca(); + let calendar = HijriSimulated::new_mecca(); + let calendar = Ref(&calendar); for (case, f_date) in SIMULATED_CASES.iter().zip(TEST_RD.iter()) { - let date = Date::try_new_hijri_with_calendar(case.year, case.month, case.day, calendar) - .unwrap(); - let iso = Date::from_rata_die(RataDie::new(*f_date), crate::Iso); + let date = Date::try_new_simulated_hijri_with_calendar( + case.year, case.month, case.day, calendar, + ) + .unwrap(); + let iso = Date::from_rata_die(RataDie::new(*f_date), Iso); assert_eq!(iso.to_calendar(calendar).inner, date.inner, "{case:?}"); } @@ -1773,36 +1757,39 @@ mod test { #[test] fn test_rd_from_simulated_hijri() { - let calendar = Hijri::new_simulated_mecca(); + let calendar = HijriSimulated::new_mecca(); + let calendar = Ref(&calendar); for (case, f_date) in SIMULATED_CASES.iter().zip(TEST_RD.iter()) { - let date = Date::try_new_hijri_with_calendar(case.year, case.month, case.day, calendar) - .unwrap(); + let date = Date::try_new_simulated_hijri_with_calendar( + case.year, case.month, case.day, calendar, + ) + .unwrap(); assert_eq!(date.to_rata_die(), RataDie::new(*f_date), "{case:?}"); } } #[test] fn test_rd_from_hijri() { - let calendar = Hijri::new_tabular( - TabularAlgorithmLeapYears::TypeII, - TabularAlgorithmEpoch::Friday, - ); + let calendar = HijriTabular::new(HijriTabularLeapYears::TypeII, HijriTabularEpoch::Friday); + let calendar = Ref(&calendar); for (case, f_date) in ARITHMETIC_CASES.iter().zip(TEST_RD.iter()) { - let date = Date::try_new_hijri_with_calendar(case.year, case.month, case.day, calendar) - .unwrap(); + let date = Date::try_new_hijri_tabular_with_calendar( + case.year, case.month, case.day, calendar, + ) + .unwrap(); assert_eq!(date.to_rata_die(), RataDie::new(*f_date), "{case:?}"); } } #[test] fn test_hijri_from_rd() { - let calendar = Hijri::new_tabular( - TabularAlgorithmLeapYears::TypeII, - TabularAlgorithmEpoch::Friday, - ); + let calendar = HijriTabular::new(HijriTabularLeapYears::TypeII, HijriTabularEpoch::Friday); + let calendar = Ref(&calendar); for (case, f_date) in ARITHMETIC_CASES.iter().zip(TEST_RD.iter()) { - let date = Date::try_new_hijri_with_calendar(case.year, case.month, case.day, calendar) - .unwrap(); + let date = Date::try_new_hijri_tabular_with_calendar( + case.year, case.month, case.day, calendar, + ) + .unwrap(); let date_rd = Date::from_rata_die(RataDie::new(*f_date), calendar); assert_eq!(date, date_rd, "{case:?}"); @@ -1811,26 +1798,28 @@ mod test { #[test] fn test_rd_from_hijri_tbla() { - let calendar = Hijri::new_tabular( - TabularAlgorithmLeapYears::TypeII, - TabularAlgorithmEpoch::Thursday, - ); + let calendar = + HijriTabular::new(HijriTabularLeapYears::TypeII, HijriTabularEpoch::Thursday); + let calendar = Ref(&calendar); for (case, f_date) in ASTRONOMICAL_CASES.iter().zip(TEST_RD.iter()) { - let date = Date::try_new_hijri_with_calendar(case.year, case.month, case.day, calendar) - .unwrap(); + let date = Date::try_new_hijri_tabular_with_calendar( + case.year, case.month, case.day, calendar, + ) + .unwrap(); assert_eq!(date.to_rata_die(), RataDie::new(*f_date), "{case:?}"); } } #[test] fn test_hijri_tbla_from_rd() { - let calendar = Hijri::new_tabular( - TabularAlgorithmLeapYears::TypeII, - TabularAlgorithmEpoch::Thursday, - ); + let calendar = + HijriTabular::new(HijriTabularLeapYears::TypeII, HijriTabularEpoch::Thursday); + let calendar = Ref(&calendar); for (case, f_date) in ASTRONOMICAL_CASES.iter().zip(TEST_RD.iter()) { - let date = Date::try_new_hijri_with_calendar(case.year, case.month, case.day, calendar) - .unwrap(); + let date = Date::try_new_hijri_tabular_with_calendar( + case.year, case.month, case.day, calendar, + ) + .unwrap(); let date_rd = Date::from_rata_die(RataDie::new(*f_date), calendar); assert_eq!(date, date_rd, "{case:?}"); @@ -1839,10 +1828,10 @@ mod test { #[test] fn test_saudi_hijri_from_rd() { - let calendar = Hijri::new_umm_al_qura(); + let calendar = HijriUmmAlQura::new(); + let calendar = Ref(&calendar); for (case, f_date) in UMMALQURA_CASES.iter().zip(TEST_RD.iter()) { - let date = Date::try_new_hijri_with_calendar(case.year, case.month, case.day, calendar) - .unwrap(); + let date = Date::try_new_ummalqura(case.year, case.month, case.day).unwrap(); let date_rd = Date::from_rata_die(RataDie::new(*f_date), calendar); assert_eq!(date, date_rd, "{case:?}"); @@ -1851,10 +1840,8 @@ mod test { #[test] fn test_rd_from_saudi_hijri() { - let calendar = Hijri::new_umm_al_qura(); for (case, f_date) in UMMALQURA_CASES.iter().zip(TEST_RD.iter()) { - let date = Date::try_new_hijri_with_calendar(case.year, case.month, case.day, calendar) - .unwrap(); + let date = Date::try_new_ummalqura(case.year, case.month, case.day).unwrap(); assert_eq!(date.to_rata_die(), RataDie::new(*f_date), "{case:?}"); } } @@ -1862,24 +1849,24 @@ mod test { #[ignore] // slow #[test] fn test_days_in_provided_year_simulated() { - let calendar = Hijri::new_simulated_mecca(); + let calendar = HijriSimulated::new_mecca(); + let calendar = Ref(&calendar); // -1245 1 1 = -214526 (R.D Date) // 1518 1 1 = 764589 (R.D Date) let sum_days_in_year: i64 = (START_YEAR..END_YEAR) .map(|year| { - Hijri::new_simulated_mecca() - .0 - .year_data(year) - .packed - .days_in_year() as i64 + HijriSimulated::days_in_provided_year( + HijriSimulatedLocation::Mecca.compute_year_info(year), + ) as i64 }) .sum(); - let expected_number_of_days = Date::try_new_hijri_with_calendar(END_YEAR, 1, 1, calendar) - .unwrap() - .to_rata_die() - - Date::try_new_hijri_with_calendar(START_YEAR, 1, 1, calendar) + let expected_number_of_days = + Date::try_new_simulated_hijri_with_calendar(END_YEAR, 1, 1, calendar) .unwrap() - .to_rata_die(); // The number of days between Hijri years -1245 and 1518 + .to_rata_die() + - Date::try_new_simulated_hijri_with_calendar(START_YEAR, 1, 1, calendar) + .unwrap() + .to_rata_die(); // The number of days between Hijri years -1245 and 1518 let tolerance = 1; // One day tolerance (See Astronomical::month_length for more context) assert!( @@ -1891,17 +1878,18 @@ mod test { #[ignore] // slow #[test] fn test_days_in_provided_year_ummalqura() { - let calendar = Hijri::new_umm_al_qura(); // -1245 1 1 = -214528 (R.D Date) // 1518 1 1 = 764588 (R.D Date) let sum_days_in_year: i64 = (START_YEAR..END_YEAR) - .map(|year| calendar.0.year_data(year).packed.days_in_year() as i64) + .map(|year| { + HijriUmmAlQura::days_in_provided_year(HijriUmmAlQura.load_or_compute_info(year)) + as i64 + }) .sum(); - let expected_number_of_days = Date::try_new_hijri_with_calendar(END_YEAR, 1, 1, calendar) + let expected_number_of_days = Date::try_new_ummalqura(END_YEAR, 1, 1) .unwrap() .to_rata_die() - - (Date::try_new_hijri_with_calendar(START_YEAR, 1, 1, calendar).unwrap()) - .to_rata_die(); // The number of days between Umm al-Qura Hijri years -1245 and 1518 + - (Date::try_new_ummalqura(START_YEAR, 1, 1).unwrap()).to_rata_die(); // The number of days between Umm al-Qura Hijri years -1245 and 1518 assert_eq!(sum_days_in_year, expected_number_of_days); } @@ -1910,7 +1898,7 @@ mod test { fn test_regression_3868() { // This date used to panic on creation let iso = Date::try_new_iso(2011, 4, 4).unwrap(); - let hijri = iso.to_calendar(Hijri::new_umm_al_qura()); + let hijri = iso.to_calendar(HijriUmmAlQura::new()); // Data from https://www.ummulqura.org.sa/Index.aspx assert_eq!(hijri.day_of_month().0, 30); assert_eq!(hijri.month().ordinal, 4); @@ -1920,96 +1908,143 @@ mod test { #[test] fn test_regression_4914() { // https://github.com/unicode-org/icu4x/issues/4914 - let dt = Hijri::new_umm_al_qura() + let dt = HijriUmmAlQura::new() .from_codes(Some("bh"), 6824, MonthCode::new_normal(1).unwrap(), 1) .unwrap(); assert_eq!(dt.0.day, 1); assert_eq!(dt.0.month, 1); - assert_eq!(dt.0.year.extended_year, -6823); - } - - #[test] - fn test_regression_7056() { - // https://github.com/unicode-org/icu4x/issues/7056 - let calendar = Hijri::new_tabular( - TabularAlgorithmLeapYears::TypeII, - TabularAlgorithmEpoch::Friday, - ); - let iso = Date::try_new_iso(-62971, 3, 19).unwrap(); - let _dt = iso.to_calendar(calendar); - let _dt = iso.to_calendar(Hijri::new_umm_al_qura()); + assert_eq!(dt.0.year.value, -6823); } #[test] fn test_regression_5069_uaq() { - let calendar = Hijri::new_umm_al_qura(); + let cached = HijriUmmAlQura::new(); - let dt = Date::try_new_hijri_with_calendar(1391, 1, 29, calendar).unwrap(); + let cached = crate::Ref(&cached); - assert_eq!(dt.to_iso().to_calendar(calendar), dt); + let dt_cached = Date::try_new_ummalqura(1391, 1, 29).unwrap(); + + assert_eq!(dt_cached.to_iso().to_calendar(cached), dt_cached); } #[test] fn test_regression_5069_obs() { - let cal = Hijri::new_simulated_mecca(); + let cached = HijriSimulated::new_mecca(); + let comp = HijriSimulated::new_mecca_always_calculating(); + + let cached = crate::Ref(&cached); + let comp = crate::Ref(&comp); - let dt = Date::try_new_hijri_with_calendar(1390, 1, 30, cal).unwrap(); + let dt_cached = Date::try_new_simulated_hijri_with_calendar(1390, 1, 30, cached).unwrap(); + let dt_comp = Date::try_new_simulated_hijri_with_calendar(1390, 1, 30, comp).unwrap(); - assert_eq!(dt.to_iso().to_calendar(cal), dt); + assert_eq!(dt_cached.to_iso(), dt_comp.to_iso()); + + assert_eq!(dt_comp.to_iso().to_calendar(comp), dt_comp); + assert_eq!(dt_cached.to_iso().to_calendar(cached), dt_cached); let dt = Date::try_new_iso(2000, 5, 5).unwrap(); - assert!(dt.to_calendar(cal).day_of_month().0 > 0); + assert!(dt.to_calendar(comp).day_of_month().0 > 0); + assert!(dt.to_calendar(cached).day_of_month().0 > 0); } #[test] fn test_regression_6197() { - let calendar = Hijri::new_umm_al_qura(); + let cached = HijriUmmAlQura::new(); + + let cached = crate::Ref(&cached); let iso = Date::try_new_iso(2025, 2, 26).unwrap(); - let date = iso.to_calendar(calendar); + let cached = iso.to_calendar(cached); // Data from https://www.ummulqura.org.sa/ assert_eq!( ( - date.day_of_month().0, - date.month().ordinal, - date.era_year().year + cached.day_of_month().0, + cached.month().ordinal, + cached.era_year().year ), (27, 8, 1446) ); } #[test] - fn test_hijri_packed_roundtrip() { - fn single_roundtrip(month_lengths: [bool; 12], start_day: RataDie) -> Option<()> { - let packed = PackedHijriYearData::try_new(1600, month_lengths, start_day)?; - for i in 0..12 { - assert_eq!(packed.month_has_30_days(i + 1), month_lengths[i as usize]); - } - assert_eq!(packed.new_year(1600), start_day); - Some(()) - } + fn test_uaq_icu4c_agreement() { + // From https://github.com/unicode-org/icu/blob/1bf6bf774dbc8c6c2051963a81100ea1114b497f/icu4c/source/i18n/islamcal.cpp#L87 + const ICU4C_ENCODED_MONTH_LENGTHS: [u16; 1601 - 1300] = [ + 0x0AAA, 0x0D54, 0x0EC9, 0x06D4, 0x06EA, 0x036C, 0x0AAD, 0x0555, 0x06A9, 0x0792, 0x0BA9, + 0x05D4, 0x0ADA, 0x055C, 0x0D2D, 0x0695, 0x074A, 0x0B54, 0x0B6A, 0x05AD, 0x04AE, 0x0A4F, + 0x0517, 0x068B, 0x06A5, 0x0AD5, 0x02D6, 0x095B, 0x049D, 0x0A4D, 0x0D26, 0x0D95, 0x05AC, + 0x09B6, 0x02BA, 0x0A5B, 0x052B, 0x0A95, 0x06CA, 0x0AE9, 0x02F4, 0x0976, 0x02B6, 0x0956, + 0x0ACA, 0x0BA4, 0x0BD2, 0x05D9, 0x02DC, 0x096D, 0x054D, 0x0AA5, 0x0B52, 0x0BA5, 0x05B4, + 0x09B6, 0x0557, 0x0297, 0x054B, 0x06A3, 0x0752, 0x0B65, 0x056A, 0x0AAB, 0x052B, 0x0C95, + 0x0D4A, 0x0DA5, 0x05CA, 0x0AD6, 0x0957, 0x04AB, 0x094B, 0x0AA5, 0x0B52, 0x0B6A, 0x0575, + 0x0276, 0x08B7, 0x045B, 0x0555, 0x05A9, 0x05B4, 0x09DA, 0x04DD, 0x026E, 0x0936, 0x0AAA, + 0x0D54, 0x0DB2, 0x05D5, 0x02DA, 0x095B, 0x04AB, 0x0A55, 0x0B49, 0x0B64, 0x0B71, 0x05B4, + 0x0AB5, 0x0A55, 0x0D25, 0x0E92, 0x0EC9, 0x06D4, 0x0AE9, 0x096B, 0x04AB, 0x0A93, 0x0D49, + 0x0DA4, 0x0DB2, 0x0AB9, 0x04BA, 0x0A5B, 0x052B, 0x0A95, 0x0B2A, 0x0B55, 0x055C, 0x04BD, + 0x023D, 0x091D, 0x0A95, 0x0B4A, 0x0B5A, 0x056D, 0x02B6, 0x093B, 0x049B, 0x0655, 0x06A9, + 0x0754, 0x0B6A, 0x056C, 0x0AAD, 0x0555, 0x0B29, 0x0B92, 0x0BA9, 0x05D4, 0x0ADA, 0x055A, + 0x0AAB, 0x0595, 0x0749, 0x0764, 0x0BAA, 0x05B5, 0x02B6, 0x0A56, 0x0E4D, 0x0B25, 0x0B52, + 0x0B6A, 0x05AD, 0x02AE, 0x092F, 0x0497, 0x064B, 0x06A5, 0x06AC, 0x0AD6, 0x055D, 0x049D, + 0x0A4D, 0x0D16, 0x0D95, 0x05AA, 0x05B5, 0x02DA, 0x095B, 0x04AD, 0x0595, 0x06CA, 0x06E4, + 0x0AEA, 0x04F5, 0x02B6, 0x0956, 0x0AAA, 0x0B54, 0x0BD2, 0x05D9, 0x02EA, 0x096D, 0x04AD, + 0x0A95, 0x0B4A, 0x0BA5, 0x05B2, 0x09B5, 0x04D6, 0x0A97, 0x0547, 0x0693, 0x0749, 0x0B55, + 0x056A, 0x0A6B, 0x052B, 0x0A8B, 0x0D46, 0x0DA3, 0x05CA, 0x0AD6, 0x04DB, 0x026B, 0x094B, + 0x0AA5, 0x0B52, 0x0B69, 0x0575, 0x0176, 0x08B7, 0x025B, 0x052B, 0x0565, 0x05B4, 0x09DA, + 0x04ED, 0x016D, 0x08B6, 0x0AA6, 0x0D52, 0x0DA9, 0x05D4, 0x0ADA, 0x095B, 0x04AB, 0x0653, + 0x0729, 0x0762, 0x0BA9, 0x05B2, 0x0AB5, 0x0555, 0x0B25, 0x0D92, 0x0EC9, 0x06D2, 0x0AE9, + 0x056B, 0x04AB, 0x0A55, 0x0D29, 0x0D54, 0x0DAA, 0x09B5, 0x04BA, 0x0A3B, 0x049B, 0x0A4D, + 0x0AAA, 0x0AD5, 0x02DA, 0x095D, 0x045E, 0x0A2E, 0x0C9A, 0x0D55, 0x06B2, 0x06B9, 0x04BA, + 0x0A5D, 0x052D, 0x0A95, 0x0B52, 0x0BA8, 0x0BB4, 0x05B9, 0x02DA, 0x095A, 0x0B4A, 0x0DA4, + 0x0ED1, 0x06E8, 0x0B6A, 0x056D, 0x0535, 0x0695, 0x0D4A, 0x0DA8, 0x0DD4, 0x06DA, 0x055B, + 0x029D, 0x062B, 0x0B15, 0x0B4A, 0x0B95, 0x05AA, 0x0AAE, 0x092E, 0x0C8F, 0x0527, 0x0695, + 0x06AA, 0x0AD6, 0x055D, 0x029D, + ]; + + // From https://github.com/unicode-org/icu/blob/1bf6bf774dbc8c6c2051963a81100ea1114b497f/icu4c/source/i18n/islamcal.cpp#L264 + const ICU4C_YEAR_START_ESTIMATE_FIX: [i64; 1601 - 1300] = [ + 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, 1, 1, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, + 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 1, 1, 0, 0, -1, 0, 1, 0, 1, 1, 0, 0, -1, + 0, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0, 0, -1, 0, 0, 0, 0, -1, -1, 0, -1, 0, 1, 0, 0, 0, + -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, -1, 0, 0, 0, 1, 0, 0, -1, -1, 0, -1, 0, 0, + -1, -1, 0, -1, 0, -1, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, 1, 1, 0, 0, -1, 0, + 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, -1, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 1, 0, 0, -1, 0, 1, 0, 1, 1, 0, 0, 0, + 0, 1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, -1, 0, 1, 0, 0, 0, + -1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 0, -1, + -1, 0, -1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 1, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, + ]; + + let icu4c = ICU4C_ENCODED_MONTH_LENGTHS + .into_iter() + .zip(ICU4C_YEAR_START_ESTIMATE_FIX) + .enumerate() + .map( + |(years_since_1300, (encoded_months_lengths, year_start_estimate_fix))| { + // https://github.com/unicode-org/icu/blob/1bf6bf774dbc8c6c2051963a81100ea1114b497f/icu4c/source/i18n/islamcal.cpp#L858 + let month_lengths = + core::array::from_fn(|i| (1 << (11 - i)) & encoded_months_lengths != 0); + // From https://github.com/unicode-org/icu/blob/1bf6bf774dbc8c6c2051963a81100ea1114b497f/icu4c/source/i18n/islamcal.cpp#L813 + let year_start = ((354.36720 * years_since_1300 as f64) + 460322.05 + 0.5) + as i64 + + year_start_estimate_fix; + HijriYearInfo { + value: 1300 + years_since_1300 as i32, + month_lengths, + start_day: ISLAMIC_EPOCH_FRIDAY + year_start, + } + }, + ) + .collect::>(); + + let icu4x = (1300..=1600) + .map(|y| HijriUmmAlQura.load_or_compute_info(y)) + .collect::>(); - let l = true; - let s = false; - let all_short = [s; 12]; - let all_long = [l; 12]; - let mixed1 = [l, s, l, s, l, s, l, s, l, s, l, s]; - let mixed2 = [s, s, l, l, l, s, l, s, s, s, l, l]; - - let start_1600 = PackedHijriYearData::mean_tabular_start_day(1600); - assert_eq!(single_roundtrip(all_short, start_1600), None); - assert_eq!(single_roundtrip(all_long, start_1600), None); - single_roundtrip(mixed1, start_1600).unwrap(); - single_roundtrip(mixed2, start_1600).unwrap(); - - single_roundtrip(mixed1, start_1600 - 7).unwrap(); - single_roundtrip(mixed2, start_1600 + 7).unwrap(); - single_roundtrip(mixed2, start_1600 + 4).unwrap(); - single_roundtrip(mixed2, start_1600 + 1).unwrap(); - single_roundtrip(mixed2, start_1600 - 1).unwrap(); - single_roundtrip(mixed2, start_1600 - 4).unwrap(); + assert_eq!(icu4x, icu4c); } } diff --git a/deps/crates/vendor/icu_calendar/src/cal/hijri/simulated_mecca_data.rs b/deps/crates/vendor/icu_calendar/src/cal/hijri/simulated_mecca_data.rs deleted file mode 100644 index 895ffd46eb9c89..00000000000000 --- a/deps/crates/vendor/icu_calendar/src/cal/hijri/simulated_mecca_data.rs +++ /dev/null @@ -1,269 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -//! Data obtained from [`calendrical_calculations`]. - -use super::PackedHijriYearData; - -pub const STARTING_YEAR: i32 = 1317; - -#[rustfmt::skip] -#[allow(clippy::unwrap_used)] // const -pub const DATA: &[PackedHijriYearData] = { - use calendrical_calculations::gregorian::fixed_from_gregorian as gregorian; - let l = true; // long - let s = false; // short - &[ - PackedHijriYearData::try_new(1317, [l, l, l, l, s, s, l, s, l, s, s, l], gregorian(1899, 5, 11)).unwrap(), - PackedHijriYearData::try_new(1318, [s, l, l, l, s, l, s, l, s, l, s, s], gregorian(1900, 5, 1)).unwrap(), - PackedHijriYearData::try_new(1319, [l, s, l, l, s, l, s, l, l, s, l, s], gregorian(1901, 4, 20)).unwrap(), - PackedHijriYearData::try_new(1320, [l, s, s, l, s, l, s, l, l, s, l, l], gregorian(1902, 4, 10)).unwrap(), - PackedHijriYearData::try_new(1321, [s, l, s, s, l, s, s, l, l, s, l, l], gregorian(1903, 3, 31)).unwrap(), - PackedHijriYearData::try_new(1322, [l, s, l, s, s, s, l, s, l, s, l, l], gregorian(1904, 3, 19)).unwrap(), - PackedHijriYearData::try_new(1323, [l, s, l, l, s, s, s, l, s, l, s, l], gregorian(1905, 3, 8)).unwrap(), - PackedHijriYearData::try_new(1324, [l, s, l, l, s, l, s, s, l, s, l, s], gregorian(1906, 2, 25)).unwrap(), - PackedHijriYearData::try_new(1325, [l, s, l, l, s, l, l, s, l, s, l, s], gregorian(1907, 2, 14)).unwrap(), - PackedHijriYearData::try_new(1326, [s, l, s, l, s, l, l, s, l, l, s, l], gregorian(1908, 2, 4)).unwrap(), - PackedHijriYearData::try_new(1327, [s, s, l, s, l, s, l, s, l, l, l, s], gregorian(1909, 1, 24)).unwrap(), - PackedHijriYearData::try_new(1328, [l, s, s, l, s, s, l, s, l, l, l, s], gregorian(1910, 1, 13)).unwrap(), - PackedHijriYearData::try_new(1329, [l, l, s, l, s, s, s, l, s, l, l, l], gregorian(1911, 1, 2)).unwrap(), - PackedHijriYearData::try_new(1330, [s, l, l, s, s, l, s, s, l, s, l, l], gregorian(1911, 12, 23)).unwrap(), - PackedHijriYearData::try_new(1331, [s, l, l, s, l, s, l, s, l, s, l, s], gregorian(1912, 12, 11)).unwrap(), - PackedHijriYearData::try_new(1332, [s, l, l, l, s, l, s, l, s, l, s, l], gregorian(1913, 11, 30)).unwrap(), - PackedHijriYearData::try_new(1333, [s, s, l, l, s, l, l, s, l, l, s, s], gregorian(1914, 11, 20)).unwrap(), - PackedHijriYearData::try_new(1334, [s, l, s, l, s, l, l, s, l, l, l, s], gregorian(1915, 11, 9)).unwrap(), - PackedHijriYearData::try_new(1335, [s, s, l, s, l, s, l, s, l, l, l, s], gregorian(1916, 10, 29)).unwrap(), - PackedHijriYearData::try_new(1336, [l, s, l, s, s, l, s, l, s, l, l, s], gregorian(1917, 10, 18)).unwrap(), - PackedHijriYearData::try_new(1337, [l, s, l, l, s, s, l, s, l, s, l, s], gregorian(1918, 10, 7)).unwrap(), - PackedHijriYearData::try_new(1338, [l, s, l, l, l, s, l, s, s, l, s, l], gregorian(1919, 9, 26)).unwrap(), - PackedHijriYearData::try_new(1339, [s, s, l, l, l, s, l, s, l, s, l, s], gregorian(1920, 9, 15)).unwrap(), - PackedHijriYearData::try_new(1340, [s, l, s, l, l, l, s, l, s, l, s, l], gregorian(1921, 9, 4)).unwrap(), - PackedHijriYearData::try_new(1341, [s, s, l, s, l, l, s, l, l, s, l, s], gregorian(1922, 8, 25)).unwrap(), - PackedHijriYearData::try_new(1342, [s, l, s, l, s, l, s, l, l, s, l, l], gregorian(1923, 8, 14)).unwrap(), - PackedHijriYearData::try_new(1343, [s, s, l, s, l, s, l, s, l, s, l, l], gregorian(1924, 8, 3)).unwrap(), - PackedHijriYearData::try_new(1344, [s, l, s, l, s, l, s, l, s, l, s, l], gregorian(1925, 7, 23)).unwrap(), - PackedHijriYearData::try_new(1345, [s, l, l, s, l, l, s, s, l, s, s, l], gregorian(1926, 7, 12)).unwrap(), - PackedHijriYearData::try_new(1346, [s, l, l, s, l, l, s, l, s, l, s, s], gregorian(1927, 7, 1)).unwrap(), - PackedHijriYearData::try_new(1347, [l, s, l, s, l, l, l, s, l, s, l, s], gregorian(1928, 6, 19)).unwrap(), - PackedHijriYearData::try_new(1348, [s, l, s, l, s, l, l, l, s, l, s, l], gregorian(1929, 6, 9)).unwrap(), - PackedHijriYearData::try_new(1349, [s, s, l, s, l, s, l, s, l, l, l, s], gregorian(1930, 5, 30)).unwrap(), - PackedHijriYearData::try_new(1350, [l, s, s, l, s, l, s, l, s, l, l, s], gregorian(1931, 5, 19)).unwrap(), - PackedHijriYearData::try_new(1351, [l, l, s, l, s, l, s, s, l, s, l, s], gregorian(1932, 5, 7)).unwrap(), - PackedHijriYearData::try_new(1352, [l, l, s, l, l, s, l, s, s, l, s, l], gregorian(1933, 4, 26)).unwrap(), - PackedHijriYearData::try_new(1353, [s, l, l, s, l, l, s, s, l, s, l, s], gregorian(1934, 4, 16)).unwrap(), - PackedHijriYearData::try_new(1354, [s, l, l, s, l, l, l, s, s, l, s, l], gregorian(1935, 4, 5)).unwrap(), - PackedHijriYearData::try_new(1355, [s, s, l, l, s, l, l, s, l, s, l, s], gregorian(1936, 3, 25)).unwrap(), - PackedHijriYearData::try_new(1356, [l, s, s, l, l, s, l, s, l, l, s, l], gregorian(1937, 3, 14)).unwrap(), - PackedHijriYearData::try_new(1357, [s, l, s, l, s, s, l, s, l, l, s, l], gregorian(1938, 3, 4)).unwrap(), - PackedHijriYearData::try_new(1358, [l, s, l, s, l, s, s, l, s, l, s, l], gregorian(1939, 2, 21)).unwrap(), - PackedHijriYearData::try_new(1359, [l, l, s, l, s, l, s, s, l, s, s, l], gregorian(1940, 2, 10)).unwrap(), - PackedHijriYearData::try_new(1360, [l, l, s, l, l, s, l, s, s, l, s, l], gregorian(1941, 1, 29)).unwrap(), - PackedHijriYearData::try_new(1361, [s, l, s, l, l, s, l, s, l, s, l, s], gregorian(1942, 1, 19)).unwrap(), - PackedHijriYearData::try_new(1362, [l, s, l, s, l, s, l, l, s, l, s, l], gregorian(1943, 1, 8)).unwrap(), - PackedHijriYearData::try_new(1363, [s, l, s, s, l, s, l, l, s, l, l, s], gregorian(1943, 12, 29)).unwrap(), - PackedHijriYearData::try_new(1364, [l, s, l, s, s, l, s, l, s, l, l, l], gregorian(1944, 12, 17)).unwrap(), - PackedHijriYearData::try_new(1365, [s, l, s, l, s, s, l, s, s, l, l, l], gregorian(1945, 12, 7)).unwrap(), - PackedHijriYearData::try_new(1366, [s, l, l, s, l, s, s, l, s, s, l, l], gregorian(1946, 11, 26)).unwrap(), - PackedHijriYearData::try_new(1367, [s, l, l, l, s, l, s, s, l, s, s, l], gregorian(1947, 11, 15)).unwrap(), - PackedHijriYearData::try_new(1368, [l, s, l, l, s, l, l, s, s, l, s, l], gregorian(1948, 11, 3)).unwrap(), - PackedHijriYearData::try_new(1369, [s, l, s, l, s, l, l, s, l, s, l, s], gregorian(1949, 10, 24)).unwrap(), - PackedHijriYearData::try_new(1370, [l, s, s, l, l, s, l, s, l, l, s, l], gregorian(1950, 10, 13)).unwrap(), - PackedHijriYearData::try_new(1371, [l, s, s, l, s, s, l, s, l, l, l, l], gregorian(1951, 10, 3)).unwrap(), - PackedHijriYearData::try_new(1372, [s, s, l, s, l, s, s, l, s, l, l, l], gregorian(1952, 9, 22)).unwrap(), - PackedHijriYearData::try_new(1373, [s, l, s, l, s, l, s, s, l, s, l, l], gregorian(1953, 9, 11)).unwrap(), - PackedHijriYearData::try_new(1374, [s, l, s, l, l, s, l, s, s, l, s, l], gregorian(1954, 8, 31)).unwrap(), - PackedHijriYearData::try_new(1375, [s, l, s, l, l, l, s, l, s, s, l, s], gregorian(1955, 8, 20)).unwrap(), - PackedHijriYearData::try_new(1376, [l, s, l, s, l, l, s, l, l, s, l, s], gregorian(1956, 8, 8)).unwrap(), - PackedHijriYearData::try_new(1377, [s, l, s, s, l, l, s, l, l, l, s, l], gregorian(1957, 7, 29)).unwrap(), - PackedHijriYearData::try_new(1378, [s, s, l, s, s, l, s, l, l, l, s, l], gregorian(1958, 7, 19)).unwrap(), - PackedHijriYearData::try_new(1379, [l, s, s, l, s, s, l, s, l, l, s, l], gregorian(1959, 7, 8)).unwrap(), - PackedHijriYearData::try_new(1380, [l, s, l, s, l, s, s, l, s, l, s, l], gregorian(1960, 6, 26)).unwrap(), - PackedHijriYearData::try_new(1381, [l, s, l, s, l, l, s, l, s, s, l, s], gregorian(1961, 6, 15)).unwrap(), - PackedHijriYearData::try_new(1382, [l, s, l, l, s, l, l, s, l, s, s, l], gregorian(1962, 6, 4)).unwrap(), - PackedHijriYearData::try_new(1383, [s, l, s, l, s, l, l, l, s, l, s, s], gregorian(1963, 5, 25)).unwrap(), - PackedHijriYearData::try_new(1384, [l, s, s, l, s, l, l, l, s, l, l, s], gregorian(1964, 5, 13)).unwrap(), - PackedHijriYearData::try_new(1385, [s, l, s, s, l, s, l, l, s, l, l, l], gregorian(1965, 5, 3)).unwrap(), - PackedHijriYearData::try_new(1386, [s, s, l, s, s, l, s, l, s, l, l, l], gregorian(1966, 4, 23)).unwrap(), - PackedHijriYearData::try_new(1387, [s, l, s, l, s, l, s, s, l, s, l, l], gregorian(1967, 4, 12)).unwrap(), - PackedHijriYearData::try_new(1388, [s, l, l, s, l, s, l, s, s, l, s, l], gregorian(1968, 3, 31)).unwrap(), - PackedHijriYearData::try_new(1389, [s, l, l, s, l, l, s, l, s, s, l, s], gregorian(1969, 3, 20)).unwrap(), - PackedHijriYearData::try_new(1390, [l, s, l, s, l, l, l, s, l, s, l, s], gregorian(1970, 3, 9)).unwrap(), - PackedHijriYearData::try_new(1391, [s, l, s, l, s, l, l, l, s, l, s, l], gregorian(1971, 2, 27)).unwrap(), - PackedHijriYearData::try_new(1392, [s, s, l, s, s, l, l, l, s, l, s, l], gregorian(1972, 2, 17)).unwrap(), - PackedHijriYearData::try_new(1393, [l, s, s, l, s, l, s, l, s, l, s, l], gregorian(1973, 2, 5)).unwrap(), - PackedHijriYearData::try_new(1394, [l, l, s, s, l, s, l, s, s, l, s, l], gregorian(1974, 1, 25)).unwrap(), - PackedHijriYearData::try_new(1395, [l, l, s, l, s, l, s, l, s, s, l, s], gregorian(1975, 1, 14)).unwrap(), - PackedHijriYearData::try_new(1396, [l, l, l, s, l, s, l, s, l, s, s, l], gregorian(1976, 1, 3)).unwrap(), - PackedHijriYearData::try_new(1397, [s, l, l, s, l, l, s, l, s, l, s, s], gregorian(1976, 12, 23)).unwrap(), - PackedHijriYearData::try_new(1398, [l, s, l, s, l, l, s, l, l, s, s, l], gregorian(1977, 12, 12)).unwrap(), - PackedHijriYearData::try_new(1399, [s, l, s, l, s, l, s, l, l, s, l, s], gregorian(1978, 12, 2)).unwrap(), - PackedHijriYearData::try_new(1400, [l, l, s, s, l, s, l, s, l, s, l, l], gregorian(1979, 11, 21)).unwrap(), - PackedHijriYearData::try_new(1401, [s, l, l, s, s, l, s, s, l, s, l, l], gregorian(1980, 11, 10)).unwrap(), - PackedHijriYearData::try_new(1402, [s, l, l, l, s, s, l, s, s, l, s, l], gregorian(1981, 10, 30)).unwrap(), - PackedHijriYearData::try_new(1403, [s, l, l, l, s, l, s, l, s, s, l, s], gregorian(1982, 10, 19)).unwrap(), - PackedHijriYearData::try_new(1404, [l, s, l, l, s, l, l, s, l, s, s, l], gregorian(1983, 10, 8)).unwrap(), - PackedHijriYearData::try_new(1405, [s, l, s, l, s, l, l, l, s, l, s, s], gregorian(1984, 9, 27)).unwrap(), - PackedHijriYearData::try_new(1406, [l, s, l, s, l, s, l, l, s, l, s, l], gregorian(1985, 9, 16)).unwrap(), - PackedHijriYearData::try_new(1407, [l, s, s, l, s, l, s, l, s, l, l, s], gregorian(1986, 9, 6)).unwrap(), - PackedHijriYearData::try_new(1408, [l, l, s, s, l, s, l, s, l, s, l, s], gregorian(1987, 8, 26)).unwrap(), - PackedHijriYearData::try_new(1409, [l, l, l, s, s, l, s, l, s, s, l, s], gregorian(1988, 8, 14)).unwrap(), - PackedHijriYearData::try_new(1410, [l, l, l, s, l, l, s, s, l, s, s, l], gregorian(1989, 8, 3)).unwrap(), - PackedHijriYearData::try_new(1411, [l, s, l, s, l, l, s, l, s, l, s, s], gregorian(1990, 7, 24)).unwrap(), - PackedHijriYearData::try_new(1412, [l, l, s, l, s, l, l, s, l, s, l, s], gregorian(1991, 7, 13)).unwrap(), - PackedHijriYearData::try_new(1413, [l, s, s, l, s, l, l, s, l, l, s, l], gregorian(1992, 7, 2)).unwrap(), - PackedHijriYearData::try_new(1414, [s, l, s, s, l, s, l, s, l, l, l, s], gregorian(1993, 6, 22)).unwrap(), - PackedHijriYearData::try_new(1415, [l, s, l, s, s, l, s, l, s, l, l, s], gregorian(1994, 6, 11)).unwrap(), - PackedHijriYearData::try_new(1416, [l, l, s, l, s, s, l, s, l, s, l, s], gregorian(1995, 5, 31)).unwrap(), - PackedHijriYearData::try_new(1417, [l, l, s, l, s, l, s, l, s, l, s, s], gregorian(1996, 5, 19)).unwrap(), - PackedHijriYearData::try_new(1418, [l, l, s, l, l, s, l, s, l, s, l, s], gregorian(1997, 5, 8)).unwrap(), - PackedHijriYearData::try_new(1419, [s, l, s, l, s, l, l, l, s, l, s, l], gregorian(1998, 4, 28)).unwrap(), - PackedHijriYearData::try_new(1420, [s, s, l, s, l, s, l, l, l, s, l, s], gregorian(1999, 4, 18)).unwrap(), - PackedHijriYearData::try_new(1421, [l, s, s, l, s, s, l, l, l, s, l, l], gregorian(2000, 4, 6)).unwrap(), - PackedHijriYearData::try_new(1422, [s, l, s, s, l, s, s, l, l, s, l, l], gregorian(2001, 3, 27)).unwrap(), - PackedHijriYearData::try_new(1423, [l, s, l, s, s, l, s, s, l, l, s, l], gregorian(2002, 3, 16)).unwrap(), - PackedHijriYearData::try_new(1424, [l, s, l, s, l, s, l, s, l, s, s, l], gregorian(2003, 3, 5)).unwrap(), - PackedHijriYearData::try_new(1425, [l, s, l, l, s, l, s, l, s, l, s, s], gregorian(2004, 2, 22)).unwrap(), - PackedHijriYearData::try_new(1426, [l, l, s, l, s, l, l, s, l, s, l, s], gregorian(2005, 2, 10)).unwrap(), - PackedHijriYearData::try_new(1427, [l, s, s, l, s, l, l, l, s, l, s, l], gregorian(2006, 1, 31)).unwrap(), - PackedHijriYearData::try_new(1428, [s, l, s, s, l, s, l, l, l, s, l, s], gregorian(2007, 1, 21)).unwrap(), - PackedHijriYearData::try_new(1429, [l, s, l, s, s, l, s, l, l, s, l, s], gregorian(2008, 1, 10)).unwrap(), - PackedHijriYearData::try_new(1430, [l, l, s, l, s, s, l, s, l, s, l, s], gregorian(2008, 12, 29)).unwrap(), - PackedHijriYearData::try_new(1431, [l, l, l, s, l, s, s, l, s, l, s, s], gregorian(2009, 12, 18)).unwrap(), - PackedHijriYearData::try_new(1432, [l, l, l, s, l, l, s, l, s, s, l, s], gregorian(2010, 12, 7)).unwrap(), - PackedHijriYearData::try_new(1433, [s, l, l, s, l, l, s, l, l, s, s, l], gregorian(2011, 11, 27)).unwrap(), - PackedHijriYearData::try_new(1434, [s, s, l, s, l, l, s, l, l, l, s, s], gregorian(2012, 11, 16)).unwrap(), - PackedHijriYearData::try_new(1435, [l, s, s, l, s, l, s, l, l, l, s, l], gregorian(2013, 11, 5)).unwrap(), - PackedHijriYearData::try_new(1436, [s, l, s, l, s, s, l, s, l, l, s, l], gregorian(2014, 10, 26)).unwrap(), - PackedHijriYearData::try_new(1437, [s, l, l, s, l, s, s, l, s, l, s, l], gregorian(2015, 10, 15)).unwrap(), - PackedHijriYearData::try_new(1438, [s, l, l, l, s, l, s, s, l, s, s, l], gregorian(2016, 10, 3)).unwrap(), - PackedHijriYearData::try_new(1439, [s, l, l, l, l, s, l, s, s, l, s, s], gregorian(2017, 9, 22)).unwrap(), - PackedHijriYearData::try_new(1440, [l, s, l, l, l, s, l, l, s, s, l, s], gregorian(2018, 9, 11)).unwrap(), - PackedHijriYearData::try_new(1441, [s, l, s, l, l, s, l, l, s, l, s, l], gregorian(2019, 9, 1)).unwrap(), - PackedHijriYearData::try_new(1442, [s, s, l, s, l, s, l, l, l, s, l, s], gregorian(2020, 8, 21)).unwrap(), - PackedHijriYearData::try_new(1443, [l, s, l, s, s, l, s, l, l, s, l, s], gregorian(2021, 8, 10)).unwrap(), - PackedHijriYearData::try_new(1444, [l, l, s, l, s, s, l, s, l, s, l, s], gregorian(2022, 7, 30)).unwrap(), - PackedHijriYearData::try_new(1445, [l, l, l, s, l, s, l, s, s, l, s, l], gregorian(2023, 7, 19)).unwrap(), - PackedHijriYearData::try_new(1446, [s, l, l, l, s, l, s, l, s, s, l, s], gregorian(2024, 7, 8)).unwrap(), - PackedHijriYearData::try_new(1447, [s, l, l, l, s, l, l, s, l, s, s, l], gregorian(2025, 6, 27)).unwrap(), - PackedHijriYearData::try_new(1448, [s, s, l, l, s, l, l, s, l, l, s, s], gregorian(2026, 6, 17)).unwrap(), - PackedHijriYearData::try_new(1449, [l, s, l, s, l, s, l, s, l, l, s, l], gregorian(2027, 6, 6)).unwrap(), - PackedHijriYearData::try_new(1450, [s, l, s, l, s, s, l, s, l, l, l, s], gregorian(2028, 5, 26)).unwrap(), - PackedHijriYearData::try_new(1451, [l, s, l, l, s, s, s, l, s, l, l, s], gregorian(2029, 5, 15)).unwrap(), - PackedHijriYearData::try_new(1452, [l, l, l, s, s, l, s, s, l, s, l, s], gregorian(2030, 5, 4)).unwrap(), - PackedHijriYearData::try_new(1453, [l, l, l, s, l, s, l, s, s, l, s, l], gregorian(2031, 4, 23)).unwrap(), - PackedHijriYearData::try_new(1454, [s, l, l, s, l, l, s, l, s, s, l, s], gregorian(2032, 4, 12)).unwrap(), - PackedHijriYearData::try_new(1455, [l, s, l, s, l, l, s, l, s, l, l, s], gregorian(2033, 4, 1)).unwrap(), - PackedHijriYearData::try_new(1456, [s, l, s, l, s, l, s, l, l, s, l, l], gregorian(2034, 3, 22)).unwrap(), - PackedHijriYearData::try_new(1457, [s, s, l, s, s, l, s, l, l, s, l, l], gregorian(2035, 3, 12)).unwrap(), - PackedHijriYearData::try_new(1458, [l, s, s, l, s, s, l, s, l, s, l, l], gregorian(2036, 2, 29)).unwrap(), - PackedHijriYearData::try_new(1459, [l, s, l, s, l, s, s, l, s, l, s, l], gregorian(2037, 2, 17)).unwrap(), - PackedHijriYearData::try_new(1460, [l, s, l, l, s, l, s, s, l, s, l, s], gregorian(2038, 2, 6)).unwrap(), - PackedHijriYearData::try_new(1461, [l, s, l, l, s, l, s, l, s, l, s, l], gregorian(2039, 1, 26)).unwrap(), - PackedHijriYearData::try_new(1462, [s, l, s, l, l, s, l, s, l, l, s, s], gregorian(2040, 1, 16)).unwrap(), - PackedHijriYearData::try_new(1463, [l, s, l, s, l, s, l, s, l, l, l, s], gregorian(2041, 1, 4)).unwrap(), - PackedHijriYearData::try_new(1464, [s, l, s, l, s, s, l, s, l, l, l, l], gregorian(2041, 12, 25)).unwrap(), - PackedHijriYearData::try_new(1465, [s, l, s, s, l, s, s, l, s, l, l, l], gregorian(2042, 12, 15)).unwrap(), - PackedHijriYearData::try_new(1466, [s, l, l, s, s, l, s, s, l, l, s, l], gregorian(2043, 12, 4)).unwrap(), - PackedHijriYearData::try_new(1467, [s, l, l, s, l, s, l, s, s, l, l, s], gregorian(2044, 11, 22)).unwrap(), - PackedHijriYearData::try_new(1468, [s, l, l, l, s, l, s, l, s, l, s, s], gregorian(2045, 11, 11)).unwrap(), - PackedHijriYearData::try_new(1469, [l, s, l, s, l, l, l, s, l, s, l, s], gregorian(2046, 10, 31)).unwrap(), - PackedHijriYearData::try_new(1470, [s, l, s, l, s, l, l, s, l, l, s, l], gregorian(2047, 10, 21)).unwrap(), - PackedHijriYearData::try_new(1471, [s, s, l, s, l, s, l, s, l, l, l, s], gregorian(2048, 10, 10)).unwrap(), - PackedHijriYearData::try_new(1472, [l, s, s, l, s, l, s, l, s, l, l, s], gregorian(2049, 9, 29)).unwrap(), - PackedHijriYearData::try_new(1473, [l, s, l, s, l, s, l, s, s, l, l, s], gregorian(2050, 9, 18)).unwrap(), - PackedHijriYearData::try_new(1474, [l, s, l, l, s, l, s, l, s, s, l, s], gregorian(2051, 9, 7)).unwrap(), - PackedHijriYearData::try_new(1475, [l, s, l, l, l, s, l, s, l, s, s, l], gregorian(2052, 8, 26)).unwrap(), - PackedHijriYearData::try_new(1476, [s, l, s, l, l, l, s, l, s, l, s, s], gregorian(2053, 8, 16)).unwrap(), - PackedHijriYearData::try_new(1477, [l, s, s, l, l, l, s, l, l, s, l, s], gregorian(2054, 8, 5)).unwrap(), - PackedHijriYearData::try_new(1478, [s, l, s, s, l, l, s, l, l, s, l, l], gregorian(2055, 7, 26)).unwrap(), - PackedHijriYearData::try_new(1479, [s, s, l, s, l, s, l, s, l, s, l, l], gregorian(2056, 7, 15)).unwrap(), - PackedHijriYearData::try_new(1480, [s, l, s, l, s, l, s, s, l, l, s, l], gregorian(2057, 7, 4)).unwrap(), - PackedHijriYearData::try_new(1481, [s, l, l, s, l, s, l, s, l, s, s, l], gregorian(2058, 6, 23)).unwrap(), - PackedHijriYearData::try_new(1482, [s, l, l, s, l, l, s, l, s, l, s, s], gregorian(2059, 6, 12)).unwrap(), - PackedHijriYearData::try_new(1483, [l, s, l, s, l, l, l, s, l, s, l, s], gregorian(2060, 5, 31)).unwrap(), - PackedHijriYearData::try_new(1484, [s, l, s, l, l, s, l, s, l, l, s, l], gregorian(2061, 5, 21)).unwrap(), - PackedHijriYearData::try_new(1485, [s, s, l, s, l, s, l, l, s, l, l, s], gregorian(2062, 5, 11)).unwrap(), - PackedHijriYearData::try_new(1486, [l, s, s, l, s, l, s, l, s, l, l, s], gregorian(2063, 4, 30)).unwrap(), - PackedHijriYearData::try_new(1487, [l, l, s, l, s, s, l, s, l, s, l, s], gregorian(2064, 4, 18)).unwrap(), - PackedHijriYearData::try_new(1488, [l, l, s, l, l, s, s, l, s, s, l, l], gregorian(2065, 4, 7)).unwrap(), - PackedHijriYearData::try_new(1489, [s, l, l, s, l, l, s, s, l, s, s, l], gregorian(2066, 3, 28)).unwrap(), - PackedHijriYearData::try_new(1490, [s, l, l, s, l, l, l, s, s, l, s, s], gregorian(2067, 3, 17)).unwrap(), - PackedHijriYearData::try_new(1491, [l, s, l, s, l, l, l, s, l, s, l, s], gregorian(2068, 3, 5)).unwrap(), - PackedHijriYearData::try_new(1492, [l, s, s, l, s, l, l, s, l, s, l, l], gregorian(2069, 2, 23)).unwrap(), - PackedHijriYearData::try_new(1493, [s, l, s, s, l, s, l, s, l, s, l, l], gregorian(2070, 2, 13)).unwrap(), - PackedHijriYearData::try_new(1494, [l, s, l, s, s, l, s, s, l, s, l, l], gregorian(2071, 2, 2)).unwrap(), - PackedHijriYearData::try_new(1495, [l, l, s, l, s, s, l, s, s, l, s, l], gregorian(2072, 1, 22)).unwrap(), - PackedHijriYearData::try_new(1496, [l, l, s, l, l, s, s, l, s, s, l, s], gregorian(2073, 1, 10)).unwrap(), - PackedHijriYearData::try_new(1497, [l, l, s, l, l, s, l, s, l, s, s, l], gregorian(2073, 12, 30)).unwrap(), - PackedHijriYearData::try_new(1498, [s, l, s, l, l, s, l, l, s, l, s, l], gregorian(2074, 12, 20)).unwrap(), - PackedHijriYearData::try_new(1499, [s, s, l, s, l, s, l, l, s, l, l, s], gregorian(2075, 12, 10)).unwrap(), - PackedHijriYearData::try_new(1500, [l, s, s, l, s, l, s, l, s, l, l, l], gregorian(2076, 11, 28)).unwrap(), - PackedHijriYearData::try_new(1501, [s, l, s, l, s, s, l, s, s, l, l, l], gregorian(2077, 11, 18)).unwrap(), - PackedHijriYearData::try_new(1502, [s, l, l, s, l, s, s, l, s, s, l, l], gregorian(2078, 11, 7)).unwrap(), - PackedHijriYearData::try_new(1503, [l, s, l, l, s, l, s, s, l, s, s, l], gregorian(2079, 10, 27)).unwrap(), - PackedHijriYearData::try_new(1504, [l, s, l, l, s, l, l, s, s, l, s, l], gregorian(2080, 10, 15)).unwrap(), - PackedHijriYearData::try_new(1505, [s, s, l, l, s, l, l, s, l, s, l, s], gregorian(2081, 10, 5)).unwrap(), - PackedHijriYearData::try_new(1506, [l, s, s, l, s, l, l, s, l, l, s, l], gregorian(2082, 9, 24)).unwrap(), - PackedHijriYearData::try_new(1507, [l, s, s, s, l, s, l, s, l, l, l, l], gregorian(2083, 9, 14)).unwrap(), - PackedHijriYearData::try_new(1508, [s, s, l, s, s, l, s, l, s, l, l, l], gregorian(2084, 9, 3)).unwrap(), - PackedHijriYearData::try_new(1509, [s, l, s, l, s, s, l, s, l, s, l, l], gregorian(2085, 8, 23)).unwrap(), - PackedHijriYearData::try_new(1510, [s, l, s, l, l, s, l, s, s, l, s, l], gregorian(2086, 8, 12)).unwrap(), - PackedHijriYearData::try_new(1511, [s, l, s, l, l, s, l, l, s, s, l, s], gregorian(2087, 8, 1)).unwrap(), - PackedHijriYearData::try_new(1512, [l, s, s, l, l, l, s, l, l, s, s, l], gregorian(2088, 7, 20)).unwrap(), - PackedHijriYearData::try_new(1513, [s, s, l, s, l, l, s, l, l, s, l, s], gregorian(2089, 7, 10)).unwrap(), - PackedHijriYearData::try_new(1514, [l, s, s, l, s, l, s, l, l, l, s, l], gregorian(2090, 6, 29)).unwrap(), - PackedHijriYearData::try_new(1515, [s, l, s, s, l, s, l, s, l, l, s, l], gregorian(2091, 6, 19)).unwrap(), - PackedHijriYearData::try_new(1516, [l, s, l, s, s, l, s, l, s, l, s, l], gregorian(2092, 6, 7)).unwrap(), - PackedHijriYearData::try_new(1517, [l, s, l, s, l, s, l, s, l, s, l, s], gregorian(2093, 5, 27)).unwrap(), - PackedHijriYearData::try_new(1518, [l, s, l, l, s, l, l, s, s, l, s, l], gregorian(2094, 5, 16)).unwrap(), - PackedHijriYearData::try_new(1519, [s, s, l, l, s, l, l, s, l, s, l, s], gregorian(2095, 5, 6)).unwrap(), - PackedHijriYearData::try_new(1520, [l, s, s, l, s, l, l, l, s, l, l, s], gregorian(2096, 4, 24)).unwrap(), - PackedHijriYearData::try_new(1521, [s, l, s, s, l, s, l, l, s, l, l, l], gregorian(2097, 4, 14)).unwrap(), - PackedHijriYearData::try_new(1522, [s, s, l, s, s, l, s, l, s, l, l, l], gregorian(2098, 4, 4)).unwrap(), - PackedHijriYearData::try_new(1523, [s, l, s, l, s, s, l, s, l, s, l, l], gregorian(2099, 3, 24)).unwrap(), - PackedHijriYearData::try_new(1524, [s, l, l, s, l, s, l, s, s, l, s, l], gregorian(2100, 3, 13)).unwrap(), - PackedHijriYearData::try_new(1525, [s, l, l, s, l, l, s, l, s, s, l, s], gregorian(2101, 3, 2)).unwrap(), - PackedHijriYearData::try_new(1526, [l, s, l, s, l, l, l, s, l, s, s, l], gregorian(2102, 2, 19)).unwrap(), - PackedHijriYearData::try_new(1527, [s, l, s, l, s, l, l, l, s, s, l, s], gregorian(2103, 2, 9)).unwrap(), - PackedHijriYearData::try_new(1528, [l, s, l, s, s, l, l, l, s, l, s, l], gregorian(2104, 1, 29)).unwrap(), - PackedHijriYearData::try_new(1529, [s, l, s, l, s, l, s, l, s, l, s, l], gregorian(2105, 1, 18)).unwrap(), - PackedHijriYearData::try_new(1530, [l, s, l, s, l, s, l, s, s, l, s, l], gregorian(2106, 1, 7)).unwrap(), - PackedHijriYearData::try_new(1531, [l, l, s, l, s, l, s, l, s, s, l, s], gregorian(2106, 12, 27)).unwrap(), - PackedHijriYearData::try_new(1532, [l, l, l, s, l, s, l, s, s, l, s, s], gregorian(2107, 12, 16)).unwrap(), - PackedHijriYearData::try_new(1533, [l, l, l, s, l, l, s, l, s, s, l, s], gregorian(2108, 12, 4)).unwrap(), - PackedHijriYearData::try_new(1534, [l, s, l, s, l, l, s, l, s, l, s, l], gregorian(2109, 11, 24)).unwrap(), - PackedHijriYearData::try_new(1535, [s, l, s, l, s, l, s, l, l, s, l, s], gregorian(2110, 11, 14)).unwrap(), - PackedHijriYearData::try_new(1536, [l, s, l, s, l, s, s, l, l, s, l, l], gregorian(2111, 11, 3)).unwrap(), - PackedHijriYearData::try_new(1537, [s, l, s, l, s, l, s, s, l, s, l, l], gregorian(2112, 10, 23)).unwrap(), - PackedHijriYearData::try_new(1538, [s, l, l, s, l, s, l, s, s, l, s, l], gregorian(2113, 10, 12)).unwrap(), - PackedHijriYearData::try_new(1539, [s, l, l, l, s, l, s, l, s, s, s, l], gregorian(2114, 10, 1)).unwrap(), - PackedHijriYearData::try_new(1540, [l, s, l, l, s, l, l, s, l, s, s, l], gregorian(2115, 9, 20)).unwrap(), - PackedHijriYearData::try_new(1541, [s, l, s, l, s, l, l, l, s, l, s, s], gregorian(2116, 9, 9)).unwrap(), - PackedHijriYearData::try_new(1542, [l, s, l, s, l, s, l, l, s, l, s, l], gregorian(2117, 8, 29)).unwrap(), - PackedHijriYearData::try_new(1543, [l, s, s, l, s, l, s, l, s, l, l, s], gregorian(2118, 8, 19)).unwrap(), - PackedHijriYearData::try_new(1544, [l, l, s, s, l, s, l, s, s, l, l, s], gregorian(2119, 8, 8)).unwrap(), - PackedHijriYearData::try_new(1545, [l, l, l, s, s, l, s, s, l, s, l, s], gregorian(2120, 7, 27)).unwrap(), - PackedHijriYearData::try_new(1546, [l, l, l, s, l, s, l, s, l, s, s, l], gregorian(2121, 7, 16)).unwrap(), - PackedHijriYearData::try_new(1547, [l, s, l, s, l, l, s, l, s, l, s, s], gregorian(2122, 7, 6)).unwrap(), - PackedHijriYearData::try_new(1548, [l, s, l, s, l, l, s, l, l, s, l, s], gregorian(2123, 6, 25)).unwrap(), - PackedHijriYearData::try_new(1549, [s, l, s, l, s, l, s, l, l, l, s, l], gregorian(2124, 6, 14)).unwrap(), - PackedHijriYearData::try_new(1550, [s, l, s, s, s, l, s, l, l, l, l, s], gregorian(2125, 6, 4)).unwrap(), - PackedHijriYearData::try_new(1551, [l, s, l, s, s, s, l, s, l, l, l, s], gregorian(2126, 5, 24)).unwrap(), - PackedHijriYearData::try_new(1552, [l, l, s, s, l, s, s, l, s, l, l, s], gregorian(2127, 5, 13)).unwrap(), - PackedHijriYearData::try_new(1553, [l, l, s, l, s, l, s, l, s, s, l, s], gregorian(2128, 5, 1)).unwrap(), - PackedHijriYearData::try_new(1554, [l, l, s, l, s, l, l, s, l, s, s, l], gregorian(2129, 4, 20)).unwrap(), - PackedHijriYearData::try_new(1555, [s, l, s, l, s, l, l, l, s, l, s, l], gregorian(2130, 4, 10)).unwrap(), - PackedHijriYearData::try_new(1556, [s, s, l, s, l, s, l, l, l, s, l, s], gregorian(2131, 3, 31)).unwrap(), - PackedHijriYearData::try_new(1557, [l, s, s, l, s, s, l, l, l, s, l, l], gregorian(2132, 3, 19)).unwrap(), - PackedHijriYearData::try_new(1558, [s, l, s, s, s, l, s, l, l, s, l, l], gregorian(2133, 3, 9)).unwrap(), - PackedHijriYearData::try_new(1559, [l, s, l, s, s, l, s, s, l, s, l, l], gregorian(2134, 2, 26)).unwrap(), - PackedHijriYearData::try_new(1560, [l, s, l, s, l, s, l, s, l, s, s, l], gregorian(2135, 2, 15)).unwrap(), - PackedHijriYearData::try_new(1561, [l, s, l, l, s, l, s, l, s, l, s, s], gregorian(2136, 2, 4)).unwrap(), - PackedHijriYearData::try_new(1562, [l, s, l, l, s, l, l, s, l, s, l, s], gregorian(2137, 1, 23)).unwrap(), - PackedHijriYearData::try_new(1563, [s, l, s, l, s, l, l, l, l, s, s, l], gregorian(2138, 1, 13)).unwrap(), - PackedHijriYearData::try_new(1564, [s, s, l, s, l, s, l, l, l, s, l, s], gregorian(2139, 1, 3)).unwrap(), - PackedHijriYearData::try_new(1565, [l, s, l, s, s, l, s, l, l, s, l, s], gregorian(2139, 12, 23)).unwrap(), - PackedHijriYearData::try_new(1566, [l, l, s, l, s, s, l, s, l, s, l, s], gregorian(2140, 12, 11)).unwrap(), - ] -}; diff --git a/deps/crates/vendor/icu_calendar/src/cal/hijri/ummalqura_data.rs b/deps/crates/vendor/icu_calendar/src/cal/hijri/ummalqura_data.rs index 884d851795d8da..718286a8c1f830 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/hijri/ummalqura_data.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/hijri/ummalqura_data.rs @@ -2,401 +2,316 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -//! Data obtained from ICU4C: -//! +use crate::provider::hijri::PackedHijriYearInfo; -use super::PackedHijriYearData; - -pub const STARTING_YEAR: i32 = 1300; +pub const UMMALQURA_DATA_STARTING_YEAR: i32 = 1300; #[rustfmt::skip] -#[allow(clippy::unwrap_used)] // const -pub const DATA: &[PackedHijriYearData] = { - use calendrical_calculations::gregorian::fixed_from_gregorian as gregorian; +pub const UMMALQURA_DATA: [PackedHijriYearInfo; 1601 - UMMALQURA_DATA_STARTING_YEAR as usize] = { + use calendrical_calculations::iso::const_fixed_from_iso as iso; let l = true; // long let s = false; // short - &[ - PackedHijriYearData::try_new(1300, [l, s, l, s, l, s, l, s, l, s, l, s], gregorian(1882, 11, 12)).unwrap(), - PackedHijriYearData::try_new(1301, [l, l, s, l, s, l, s, l, s, l, s, s], gregorian(1883, 11, 1)).unwrap(), - PackedHijriYearData::try_new(1302, [l, l, l, s, l, l, s, s, l, s, s, l], gregorian(1884, 10, 20)).unwrap(), - PackedHijriYearData::try_new(1303, [s, l, l, s, l, l, s, l, s, l, s, s], gregorian(1885, 10, 10)).unwrap(), - PackedHijriYearData::try_new(1304, [s, l, l, s, l, l, l, s, l, s, l, s], gregorian(1886, 9, 29)).unwrap(), - PackedHijriYearData::try_new(1305, [s, s, l, l, s, l, l, s, l, l, s, s], gregorian(1887, 9, 19)).unwrap(), - PackedHijriYearData::try_new(1306, [l, s, l, s, l, s, l, s, l, l, s, l], gregorian(1888, 9, 7)).unwrap(), - PackedHijriYearData::try_new(1307, [s, l, s, l, s, l, s, l, s, l, s, l], gregorian(1889, 8, 28)).unwrap(), - PackedHijriYearData::try_new(1308, [s, l, l, s, l, s, l, s, l, s, s, l], gregorian(1890, 8, 17)).unwrap(), - PackedHijriYearData::try_new(1309, [s, l, l, l, l, s, s, l, s, s, l, s], gregorian(1891, 8, 6)).unwrap(), - PackedHijriYearData::try_new(1310, [l, s, l, l, l, s, l, s, l, s, s, l], gregorian(1892, 7, 25)).unwrap(), - PackedHijriYearData::try_new(1311, [s, l, s, l, l, l, s, l, s, l, s, s], gregorian(1893, 7, 15)).unwrap(), - PackedHijriYearData::try_new(1312, [l, s, l, s, l, l, s, l, l, s, l, s], gregorian(1894, 7, 4)).unwrap(), - PackedHijriYearData::try_new(1313, [s, l, s, l, s, l, s, l, l, l, s, s], gregorian(1895, 6, 24)).unwrap(), - PackedHijriYearData::try_new(1314, [l, l, s, l, s, s, l, s, l, l, s, l], gregorian(1896, 6, 12)).unwrap(), - PackedHijriYearData::try_new(1315, [s, l, l, s, l, s, s, l, s, l, s, l], gregorian(1897, 6, 2)).unwrap(), - PackedHijriYearData::try_new(1316, [s, l, l, l, s, l, s, s, l, s, l, s], gregorian(1898, 5, 22)).unwrap(), - PackedHijriYearData::try_new(1317, [l, s, l, l, s, l, s, l, s, l, s, s], gregorian(1899, 5, 11)).unwrap(), - PackedHijriYearData::try_new(1318, [l, s, l, l, s, l, l, s, l, s, l, s], gregorian(1900, 4, 30)).unwrap(), - PackedHijriYearData::try_new(1319, [s, l, s, l, l, s, l, s, l, l, s, l], gregorian(1901, 4, 20)).unwrap(), - PackedHijriYearData::try_new(1320, [s, l, s, s, l, s, l, s, l, l, l, s], gregorian(1902, 4, 10)).unwrap(), - PackedHijriYearData::try_new(1321, [l, s, l, s, s, l, s, s, l, l, l, l], gregorian(1903, 3, 30)).unwrap(), - PackedHijriYearData::try_new(1322, [s, l, s, l, s, s, s, l, s, l, l, l], gregorian(1904, 3, 19)).unwrap(), - PackedHijriYearData::try_new(1323, [s, l, l, s, l, s, s, s, l, s, l, l], gregorian(1905, 3, 8)).unwrap(), - PackedHijriYearData::try_new(1324, [s, l, l, s, l, s, l, s, s, l, s, l], gregorian(1906, 2, 25)).unwrap(), - PackedHijriYearData::try_new(1325, [l, s, l, s, l, l, s, l, s, l, s, l], gregorian(1907, 2, 14)).unwrap(), - PackedHijriYearData::try_new(1326, [s, s, l, s, l, l, s, l, s, l, l, s], gregorian(1908, 2, 4)).unwrap(), - PackedHijriYearData::try_new(1327, [l, s, s, l, s, l, s, l, l, s, l, l], gregorian(1909, 1, 23)).unwrap(), - PackedHijriYearData::try_new(1328, [s, l, s, s, l, s, s, l, l, l, s, l], gregorian(1910, 1, 13)).unwrap(), - PackedHijriYearData::try_new(1329, [l, s, l, s, s, l, s, s, l, l, s, l], gregorian(1911, 1, 2)).unwrap(), - PackedHijriYearData::try_new(1330, [l, l, s, l, s, s, l, s, s, l, l, s], gregorian(1911, 12, 22)).unwrap(), - PackedHijriYearData::try_new(1331, [l, l, s, l, l, s, s, l, s, l, s, l], gregorian(1912, 12, 10)).unwrap(), - PackedHijriYearData::try_new(1332, [s, l, s, l, l, s, l, s, l, l, s, s], gregorian(1913, 11, 30)).unwrap(), - PackedHijriYearData::try_new(1333, [l, s, s, l, l, s, l, l, s, l, l, s], gregorian(1914, 11, 19)).unwrap(), - PackedHijriYearData::try_new(1334, [s, s, l, s, l, s, l, l, l, s, l, s], gregorian(1915, 11, 9)).unwrap(), - PackedHijriYearData::try_new(1335, [l, s, l, s, s, l, s, l, l, s, l, l], gregorian(1916, 10, 28)).unwrap(), - PackedHijriYearData::try_new(1336, [s, l, s, l, s, s, l, s, l, s, l, l], gregorian(1917, 10, 18)).unwrap(), - PackedHijriYearData::try_new(1337, [l, s, l, s, l, s, s, l, s, l, s, l], gregorian(1918, 10, 7)).unwrap(), - PackedHijriYearData::try_new(1338, [s, l, l, s, l, l, s, s, l, s, l, s], gregorian(1919, 9, 26)).unwrap(), - PackedHijriYearData::try_new(1339, [l, s, l, s, l, l, l, s, l, s, s, l], gregorian(1920, 9, 14)).unwrap(), - PackedHijriYearData::try_new(1340, [s, s, l, s, l, l, l, l, s, l, s, s], gregorian(1921, 9, 4)).unwrap(), - PackedHijriYearData::try_new(1341, [l, s, s, l, s, l, l, l, s, l, l, s], gregorian(1922, 8, 24)).unwrap(), - PackedHijriYearData::try_new(1342, [s, s, l, s, l, s, l, l, s, l, l, s], gregorian(1923, 8, 14)).unwrap(), - PackedHijriYearData::try_new(1343, [l, s, s, l, s, l, s, l, s, l, l, s], gregorian(1924, 8, 2)).unwrap(), - PackedHijriYearData::try_new(1344, [l, s, l, s, l, l, s, s, l, s, l, s], gregorian(1925, 7, 22)).unwrap(), - PackedHijriYearData::try_new(1345, [l, s, l, l, l, s, l, s, s, l, s, s], gregorian(1926, 7, 11)).unwrap(), - PackedHijriYearData::try_new(1346, [l, s, l, l, l, l, s, l, s, s, l, s], gregorian(1927, 6, 30)).unwrap(), - PackedHijriYearData::try_new(1347, [s, l, s, l, l, l, s, l, l, s, s, l], gregorian(1928, 6, 19)).unwrap(), - PackedHijriYearData::try_new(1348, [s, s, l, s, l, l, s, l, l, l, s, s], gregorian(1929, 6, 9)).unwrap(), - PackedHijriYearData::try_new(1349, [l, s, s, l, s, l, l, s, l, l, s, l], gregorian(1930, 5, 29)).unwrap(), - PackedHijriYearData::try_new(1350, [s, l, s, l, s, l, s, s, l, l, s, l], gregorian(1931, 5, 19)).unwrap(), - PackedHijriYearData::try_new(1351, [l, s, l, s, l, s, l, s, s, l, s, l], gregorian(1932, 5, 7)).unwrap(), - PackedHijriYearData::try_new(1352, [l, s, l, l, s, l, s, l, s, s, l, s], gregorian(1933, 4, 26)).unwrap(), - PackedHijriYearData::try_new(1353, [l, s, l, l, l, s, l, s, s, l, s, l], gregorian(1934, 4, 15)).unwrap(), - PackedHijriYearData::try_new(1354, [s, l, s, l, l, s, l, l, s, l, s, s], gregorian(1935, 4, 5)).unwrap(), - PackedHijriYearData::try_new(1355, [l, s, s, l, l, s, l, l, s, l, l, s], gregorian(1936, 3, 24)).unwrap(), - PackedHijriYearData::try_new(1356, [s, l, s, l, s, l, s, l, s, l, l, l], gregorian(1937, 3, 14)).unwrap(), - PackedHijriYearData::try_new(1357, [s, s, l, s, l, s, s, l, s, l, l, l], gregorian(1938, 3, 4)).unwrap(), - PackedHijriYearData::try_new(1358, [s, l, s, l, s, l, s, s, l, s, l, l], gregorian(1939, 2, 21)).unwrap(), - PackedHijriYearData::try_new(1359, [s, l, l, s, l, s, l, s, s, s, l, l], gregorian(1940, 2, 10)).unwrap(), - PackedHijriYearData::try_new(1360, [s, l, l, l, s, l, s, l, s, s, l, s], gregorian(1941, 1, 29)).unwrap(), - PackedHijriYearData::try_new(1361, [l, s, l, l, s, l, l, s, s, l, s, l], gregorian(1942, 1, 18)).unwrap(), - PackedHijriYearData::try_new(1362, [s, l, s, l, s, l, l, s, l, s, l, s], gregorian(1943, 1, 8)).unwrap(), - PackedHijriYearData::try_new(1363, [l, s, l, s, l, s, l, s, l, s, l, l], gregorian(1943, 12, 28)).unwrap(), - PackedHijriYearData::try_new(1364, [s, l, s, l, s, s, l, s, l, s, l, l], gregorian(1944, 12, 17)).unwrap(), - PackedHijriYearData::try_new(1365, [l, l, s, s, l, s, s, l, s, l, s, l], gregorian(1945, 12, 6)).unwrap(), - PackedHijriYearData::try_new(1366, [l, l, s, l, s, l, s, s, l, s, l, s], gregorian(1946, 11, 25)).unwrap(), - PackedHijriYearData::try_new(1367, [l, l, s, l, l, s, l, s, s, l, s, l], gregorian(1947, 11, 14)).unwrap(), - PackedHijriYearData::try_new(1368, [s, l, s, l, l, l, s, s, l, s, l, s], gregorian(1948, 11, 3)).unwrap(), - PackedHijriYearData::try_new(1369, [l, s, l, s, l, l, s, l, s, l, l, s], gregorian(1949, 10, 23)).unwrap(), - PackedHijriYearData::try_new(1370, [l, s, s, l, s, l, s, l, s, l, l, l], gregorian(1950, 10, 13)).unwrap(), - PackedHijriYearData::try_new(1371, [s, l, s, s, l, s, l, s, l, s, l, l], gregorian(1951, 10, 3)).unwrap(), - PackedHijriYearData::try_new(1372, [l, s, s, l, s, l, s, s, l, s, l, l], gregorian(1952, 9, 21)).unwrap(), - PackedHijriYearData::try_new(1373, [l, s, l, s, l, s, l, s, s, l, s, l], gregorian(1953, 9, 10)).unwrap(), - PackedHijriYearData::try_new(1374, [l, s, l, l, s, l, s, l, s, s, l, s], gregorian(1954, 8, 30)).unwrap(), - PackedHijriYearData::try_new(1375, [l, s, l, l, s, l, l, s, l, s, l, s], gregorian(1955, 8, 19)).unwrap(), - PackedHijriYearData::try_new(1376, [s, l, s, l, s, l, l, l, s, l, s, l], gregorian(1956, 8, 8)).unwrap(), - PackedHijriYearData::try_new(1377, [s, s, l, s, s, l, l, l, s, l, l, s], gregorian(1957, 7, 29)).unwrap(), - PackedHijriYearData::try_new(1378, [l, s, s, s, l, s, l, l, s, l, l, l], gregorian(1958, 7, 18)).unwrap(), - PackedHijriYearData::try_new(1379, [s, l, s, s, s, l, s, l, l, s, l, l], gregorian(1959, 7, 8)).unwrap(), - PackedHijriYearData::try_new(1380, [s, l, s, l, s, l, s, l, s, l, s, l], gregorian(1960, 6, 26)).unwrap(), - PackedHijriYearData::try_new(1381, [s, l, s, l, l, s, l, s, l, s, s, l], gregorian(1961, 6, 15)).unwrap(), - PackedHijriYearData::try_new(1382, [s, l, s, l, l, s, l, l, s, l, s, s], gregorian(1962, 6, 4)).unwrap(), - PackedHijriYearData::try_new(1383, [l, s, s, l, l, l, s, l, l, s, l, s], gregorian(1963, 5, 24)).unwrap(), - PackedHijriYearData::try_new(1384, [s, l, s, s, l, l, s, l, l, l, s, l], gregorian(1964, 5, 13)).unwrap(), - PackedHijriYearData::try_new(1385, [s, s, l, s, s, l, l, s, l, l, l, s], gregorian(1965, 5, 3)).unwrap(), - PackedHijriYearData::try_new(1386, [l, s, s, l, s, s, l, l, s, l, l, s], gregorian(1966, 4, 22)).unwrap(), - PackedHijriYearData::try_new(1387, [l, s, l, s, l, s, l, s, l, s, l, s], gregorian(1967, 4, 11)).unwrap(), - PackedHijriYearData::try_new(1388, [l, l, s, l, s, l, s, l, s, l, s, s], gregorian(1968, 3, 30)).unwrap(), - PackedHijriYearData::try_new(1389, [l, l, s, l, l, s, l, l, s, s, l, s], gregorian(1969, 3, 19)).unwrap(), - PackedHijriYearData::try_new(1390, [s, l, s, l, l, l, s, l, s, l, s, l], gregorian(1970, 3, 9)).unwrap(), - PackedHijriYearData::try_new(1391, [s, s, l, s, l, l, s, l, l, s, l, s], gregorian(1971, 2, 27)).unwrap(), - PackedHijriYearData::try_new(1392, [l, s, s, l, s, l, s, l, l, s, l, l], gregorian(1972, 2, 16)).unwrap(), - PackedHijriYearData::try_new(1393, [s, l, s, s, l, s, l, s, l, s, l, l], gregorian(1973, 2, 5)).unwrap(), - PackedHijriYearData::try_new(1394, [l, s, l, s, s, l, s, l, s, l, s, l], gregorian(1974, 1, 25)).unwrap(), - PackedHijriYearData::try_new(1395, [l, s, l, l, s, l, s, s, l, s, s, l], gregorian(1975, 1, 14)).unwrap(), - PackedHijriYearData::try_new(1396, [l, s, l, l, s, l, l, s, s, l, s, s], gregorian(1976, 1, 3)).unwrap(), - PackedHijriYearData::try_new(1397, [l, s, l, l, s, l, l, l, s, s, s, l], gregorian(1976, 12, 22)).unwrap(), - PackedHijriYearData::try_new(1398, [s, l, s, l, l, s, l, l, s, l, s, s], gregorian(1977, 12, 12)).unwrap(), - PackedHijriYearData::try_new(1399, [l, s, l, s, l, s, l, l, s, l, s, l], gregorian(1978, 12, 1)).unwrap(), - PackedHijriYearData::try_new(1400, [l, s, l, s, s, l, s, l, s, l, s, l], gregorian(1979, 11, 21)).unwrap(), - PackedHijriYearData::try_new(1401, [l, l, s, l, s, s, l, s, s, l, s, l], gregorian(1980, 11, 9)).unwrap(), - PackedHijriYearData::try_new(1402, [l, l, l, s, l, s, s, l, s, s, l, s], gregorian(1981, 10, 29)).unwrap(), - PackedHijriYearData::try_new(1403, [l, l, l, s, l, l, s, s, l, s, s, l], gregorian(1982, 10, 18)).unwrap(), - PackedHijriYearData::try_new(1404, [s, l, l, s, l, l, s, l, s, l, s, s], gregorian(1983, 10, 8)).unwrap(), - PackedHijriYearData::try_new(1405, [l, s, l, s, l, l, l, s, l, s, s, l], gregorian(1984, 9, 26)).unwrap(), - PackedHijriYearData::try_new(1406, [l, s, s, l, s, l, l, s, l, s, l, l], gregorian(1985, 9, 16)).unwrap(), - PackedHijriYearData::try_new(1407, [s, l, s, s, l, s, l, s, l, s, l, l], gregorian(1986, 9, 6)).unwrap(), - PackedHijriYearData::try_new(1408, [l, s, l, s, l, s, s, l, s, s, l, l], gregorian(1987, 8, 26)).unwrap(), - PackedHijriYearData::try_new(1409, [l, l, s, l, s, l, s, s, l, s, s, l], gregorian(1988, 8, 14)).unwrap(), - PackedHijriYearData::try_new(1410, [l, l, s, l, l, s, l, s, s, l, s, s], gregorian(1989, 8, 3)).unwrap(), - PackedHijriYearData::try_new(1411, [l, l, s, l, l, s, l, l, s, s, l, s], gregorian(1990, 7, 23)).unwrap(), - PackedHijriYearData::try_new(1412, [l, s, l, s, l, s, l, l, l, s, s, l], gregorian(1991, 7, 13)).unwrap(), - PackedHijriYearData::try_new(1413, [s, l, s, s, l, s, l, l, l, s, l, s], gregorian(1992, 7, 2)).unwrap(), - PackedHijriYearData::try_new(1414, [l, s, l, s, s, l, s, l, l, s, l, l], gregorian(1993, 6, 21)).unwrap(), - PackedHijriYearData::try_new(1415, [s, l, s, l, s, s, l, s, l, s, l, l], gregorian(1994, 6, 11)).unwrap(), - PackedHijriYearData::try_new(1416, [l, s, l, s, l, s, s, l, s, l, s, l], gregorian(1995, 5, 31)).unwrap(), - PackedHijriYearData::try_new(1417, [l, s, l, l, s, s, l, s, l, s, l, s], gregorian(1996, 5, 19)).unwrap(), - PackedHijriYearData::try_new(1418, [l, s, l, l, s, l, s, l, s, l, s, l], gregorian(1997, 5, 8)).unwrap(), - PackedHijriYearData::try_new(1419, [s, l, s, l, s, l, s, l, l, l, s, s], gregorian(1998, 4, 28)).unwrap(), - PackedHijriYearData::try_new(1420, [s, l, s, s, l, s, l, l, l, l, s, l], gregorian(1999, 4, 17)).unwrap(), - PackedHijriYearData::try_new(1421, [s, s, l, s, s, s, l, l, l, l, s, l], gregorian(2000, 4, 6)).unwrap(), - PackedHijriYearData::try_new(1422, [l, s, s, l, s, s, s, l, l, l, s, l], gregorian(2001, 3, 26)).unwrap(), - PackedHijriYearData::try_new(1423, [l, s, l, s, l, s, s, l, s, l, s, l], gregorian(2002, 3, 15)).unwrap(), - PackedHijriYearData::try_new(1424, [l, s, l, l, s, l, s, s, l, s, l, s], gregorian(2003, 3, 4)).unwrap(), - PackedHijriYearData::try_new(1425, [l, s, l, l, s, l, s, l, l, s, l, s], gregorian(2004, 2, 21)).unwrap(), - PackedHijriYearData::try_new(1426, [s, l, s, l, s, l, l, s, l, l, s, l], gregorian(2005, 2, 10)).unwrap(), - PackedHijriYearData::try_new(1427, [s, s, l, s, l, s, l, l, s, l, l, s], gregorian(2006, 1, 31)).unwrap(), - PackedHijriYearData::try_new(1428, [l, s, s, l, s, s, l, l, l, s, l, l], gregorian(2007, 1, 20)).unwrap(), - PackedHijriYearData::try_new(1429, [s, l, s, s, l, s, s, l, l, s, l, l], gregorian(2008, 1, 10)).unwrap(), - PackedHijriYearData::try_new(1430, [s, l, l, s, s, l, s, l, s, l, s, l], gregorian(2008, 12, 29)).unwrap(), - PackedHijriYearData::try_new(1431, [s, l, l, s, l, s, l, s, l, s, s, l], gregorian(2009, 12, 18)).unwrap(), - PackedHijriYearData::try_new(1432, [s, l, l, l, s, l, s, l, s, l, s, s], gregorian(2010, 12, 7)).unwrap(), - PackedHijriYearData::try_new(1433, [l, s, l, l, s, l, l, s, l, s, l, s], gregorian(2011, 11, 26)).unwrap(), - PackedHijriYearData::try_new(1434, [s, l, s, l, s, l, l, s, l, l, s, s], gregorian(2012, 11, 15)).unwrap(), - PackedHijriYearData::try_new(1435, [l, s, l, s, l, s, l, s, l, l, s, l], gregorian(2013, 11, 4)).unwrap(), - PackedHijriYearData::try_new(1436, [s, l, s, l, s, l, s, l, s, l, s, l], gregorian(2014, 10, 25)).unwrap(), - PackedHijriYearData::try_new(1437, [l, s, l, l, s, s, l, s, l, s, s, l], gregorian(2015, 10, 14)).unwrap(), - PackedHijriYearData::try_new(1438, [l, s, l, l, l, s, s, l, s, s, l, s], gregorian(2016, 10, 2)).unwrap(), - PackedHijriYearData::try_new(1439, [l, s, l, l, l, s, l, s, l, s, s, l], gregorian(2017, 9, 21)).unwrap(), - PackedHijriYearData::try_new(1440, [s, l, s, l, l, l, s, l, s, l, s, s], gregorian(2018, 9, 11)).unwrap(), - PackedHijriYearData::try_new(1441, [l, s, l, s, l, l, s, l, l, s, l, s], gregorian(2019, 8, 31)).unwrap(), - PackedHijriYearData::try_new(1442, [s, l, s, l, s, l, s, l, l, s, l, s], gregorian(2020, 8, 20)).unwrap(), - PackedHijriYearData::try_new(1443, [l, s, l, s, l, s, l, s, l, s, l, l], gregorian(2021, 8, 9)).unwrap(), - PackedHijriYearData::try_new(1444, [s, l, s, l, l, s, s, l, s, l, s, l], gregorian(2022, 7, 30)).unwrap(), - PackedHijriYearData::try_new(1445, [s, l, l, l, s, l, s, s, l, s, s, l], gregorian(2023, 7, 19)).unwrap(), - PackedHijriYearData::try_new(1446, [s, l, l, l, s, l, l, s, s, l, s, s], gregorian(2024, 7, 7)).unwrap(), - PackedHijriYearData::try_new(1447, [l, s, l, l, l, s, l, s, l, s, l, s], gregorian(2025, 6, 26)).unwrap(), - PackedHijriYearData::try_new(1448, [s, l, s, l, l, s, l, l, s, l, s, l], gregorian(2026, 6, 16)).unwrap(), - PackedHijriYearData::try_new(1449, [s, s, l, s, l, s, l, l, s, l, l, s], gregorian(2027, 6, 6)).unwrap(), - PackedHijriYearData::try_new(1450, [l, s, l, s, s, l, s, l, s, l, l, s], gregorian(2028, 5, 25)).unwrap(), - PackedHijriYearData::try_new(1451, [l, l, l, s, s, l, s, s, l, l, s, l], gregorian(2029, 5, 14)).unwrap(), - PackedHijriYearData::try_new(1452, [l, s, l, l, s, s, l, s, s, l, s, l], gregorian(2030, 5, 4)).unwrap(), - PackedHijriYearData::try_new(1453, [l, s, l, l, s, l, s, l, s, s, l, s], gregorian(2031, 4, 23)).unwrap(), - PackedHijriYearData::try_new(1454, [l, s, l, l, s, l, l, s, l, s, l, s], gregorian(2032, 4, 11)).unwrap(), - PackedHijriYearData::try_new(1455, [s, l, s, l, l, s, l, s, l, l, s, l], gregorian(2033, 4, 1)).unwrap(), - PackedHijriYearData::try_new(1456, [s, s, l, s, l, s, l, s, l, l, l, s], gregorian(2034, 3, 22)).unwrap(), - PackedHijriYearData::try_new(1457, [l, s, s, l, s, s, l, s, l, l, l, l], gregorian(2035, 3, 11)).unwrap(), - PackedHijriYearData::try_new(1458, [s, l, s, s, l, s, s, l, s, l, l, l], gregorian(2036, 2, 29)).unwrap(), - PackedHijriYearData::try_new(1459, [s, l, l, s, s, l, s, s, l, s, l, l], gregorian(2037, 2, 17)).unwrap(), - PackedHijriYearData::try_new(1460, [s, l, l, s, l, s, l, s, s, l, s, l], gregorian(2038, 2, 6)).unwrap(), - PackedHijriYearData::try_new(1461, [s, l, l, s, l, s, l, s, l, l, s, s], gregorian(2039, 1, 26)).unwrap(), - PackedHijriYearData::try_new(1462, [l, s, l, s, l, l, s, l, s, l, l, s], gregorian(2040, 1, 15)).unwrap(), - PackedHijriYearData::try_new(1463, [s, l, s, l, s, l, s, l, l, l, s, l], gregorian(2041, 1, 4)).unwrap(), - PackedHijriYearData::try_new(1464, [s, l, s, s, l, s, s, l, l, l, s, l], gregorian(2041, 12, 25)).unwrap(), - PackedHijriYearData::try_new(1465, [l, s, l, s, s, l, s, s, l, l, s, l], gregorian(2042, 12, 14)).unwrap(), - PackedHijriYearData::try_new(1466, [l, l, s, l, s, s, s, l, s, l, l, s], gregorian(2043, 12, 3)).unwrap(), - PackedHijriYearData::try_new(1467, [l, l, s, l, l, s, s, l, s, l, s, l], gregorian(2044, 11, 21)).unwrap(), - PackedHijriYearData::try_new(1468, [s, l, s, l, l, s, l, s, l, s, l, s], gregorian(2045, 11, 11)).unwrap(), - PackedHijriYearData::try_new(1469, [s, l, s, l, l, s, l, l, s, l, s, l], gregorian(2046, 10, 31)).unwrap(), - PackedHijriYearData::try_new(1470, [s, s, l, s, l, l, s, l, l, s, l, s], gregorian(2047, 10, 21)).unwrap(), - PackedHijriYearData::try_new(1471, [l, s, s, l, s, l, s, l, l, s, l, l], gregorian(2048, 10, 9)).unwrap(), - PackedHijriYearData::try_new(1472, [s, l, s, s, l, s, l, s, l, l, s, l], gregorian(2049, 9, 29)).unwrap(), - PackedHijriYearData::try_new(1473, [s, l, s, l, l, s, s, l, s, l, s, l], gregorian(2050, 9, 18)).unwrap(), - PackedHijriYearData::try_new(1474, [s, l, l, s, l, l, s, s, l, s, l, s], gregorian(2051, 9, 7)).unwrap(), - PackedHijriYearData::try_new(1475, [s, l, l, s, l, l, l, s, s, l, s, s], gregorian(2052, 8, 26)).unwrap(), - PackedHijriYearData::try_new(1476, [l, s, l, s, l, l, l, s, l, s, l, s], gregorian(2053, 8, 15)).unwrap(), - PackedHijriYearData::try_new(1477, [s, l, s, s, l, l, l, l, s, l, s, l], gregorian(2054, 8, 5)).unwrap(), - PackedHijriYearData::try_new(1478, [s, s, l, s, l, s, l, l, s, l, l, s], gregorian(2055, 7, 26)).unwrap(), - PackedHijriYearData::try_new(1479, [l, s, s, l, s, l, s, l, s, l, l, s], gregorian(2056, 7, 14)).unwrap(), - PackedHijriYearData::try_new(1480, [l, s, l, s, l, s, l, s, l, s, l, s], gregorian(2057, 7, 3)).unwrap(), - PackedHijriYearData::try_new(1481, [l, s, l, l, s, l, s, l, s, l, s, s], gregorian(2058, 6, 22)).unwrap(), - PackedHijriYearData::try_new(1482, [l, s, l, l, l, l, s, l, s, s, l, s], gregorian(2059, 6, 11)).unwrap(), - PackedHijriYearData::try_new(1483, [s, l, s, l, l, l, s, l, l, s, s, l], gregorian(2060, 5, 31)).unwrap(), - PackedHijriYearData::try_new(1484, [s, s, l, s, l, l, l, s, l, s, l, s], gregorian(2061, 5, 21)).unwrap(), - PackedHijriYearData::try_new(1485, [l, s, s, l, s, l, l, s, l, l, s, l], gregorian(2062, 5, 10)).unwrap(), - PackedHijriYearData::try_new(1486, [s, l, s, s, l, s, l, s, l, l, s, l], gregorian(2063, 4, 30)).unwrap(), - PackedHijriYearData::try_new(1487, [l, s, l, s, l, s, s, l, s, l, s, l], gregorian(2064, 4, 18)).unwrap(), - PackedHijriYearData::try_new(1488, [l, s, l, l, s, l, s, s, l, s, l, s], gregorian(2065, 4, 7)).unwrap(), - PackedHijriYearData::try_new(1489, [l, s, l, l, l, s, l, s, s, l, s, l], gregorian(2066, 3, 27)).unwrap(), - PackedHijriYearData::try_new(1490, [s, l, s, l, l, s, l, l, s, s, l, s], gregorian(2067, 3, 17)).unwrap(), - PackedHijriYearData::try_new(1491, [l, s, s, l, l, s, l, l, s, l, s, l], gregorian(2068, 3, 5)).unwrap(), - PackedHijriYearData::try_new(1492, [s, l, s, s, l, l, s, l, s, l, l, s], gregorian(2069, 2, 23)).unwrap(), - PackedHijriYearData::try_new(1493, [l, s, l, s, l, s, s, l, s, l, l, l], gregorian(2070, 2, 12)).unwrap(), - PackedHijriYearData::try_new(1494, [s, l, s, l, s, l, s, s, s, l, l, l], gregorian(2071, 2, 2)).unwrap(), - PackedHijriYearData::try_new(1495, [s, l, l, s, l, s, s, l, s, s, l, l], gregorian(2072, 1, 22)).unwrap(), - PackedHijriYearData::try_new(1496, [s, l, l, l, s, l, s, s, l, s, s, l], gregorian(2073, 1, 10)).unwrap(), - PackedHijriYearData::try_new(1497, [l, s, l, l, s, l, s, l, s, l, s, l], gregorian(2073, 12, 30)).unwrap(), - PackedHijriYearData::try_new(1498, [s, l, s, l, s, l, l, s, l, s, l, s], gregorian(2074, 12, 20)).unwrap(), - PackedHijriYearData::try_new(1499, [l, s, l, s, s, l, l, s, l, s, l, l], gregorian(2075, 12, 9)).unwrap(), - PackedHijriYearData::try_new(1500, [s, l, s, l, s, s, l, s, l, s, l, l], gregorian(2076, 11, 28)).unwrap(), - PackedHijriYearData::try_new(1501, [l, s, l, s, l, s, s, s, l, s, l, l], gregorian(2077, 11, 17)).unwrap(), - PackedHijriYearData::try_new(1502, [l, l, s, l, s, l, s, s, s, l, l, s], gregorian(2078, 11, 6)).unwrap(), - PackedHijriYearData::try_new(1503, [l, l, s, l, l, s, l, s, s, s, l, l], gregorian(2079, 10, 26)).unwrap(), - PackedHijriYearData::try_new(1504, [s, l, s, l, l, l, s, s, l, s, l, s], gregorian(2080, 10, 15)).unwrap(), - PackedHijriYearData::try_new(1505, [l, s, l, s, l, l, s, l, s, l, l, s], gregorian(2081, 10, 4)).unwrap(), - PackedHijriYearData::try_new(1506, [s, l, s, s, l, l, s, l, l, s, l, l], gregorian(2082, 9, 24)).unwrap(), - PackedHijriYearData::try_new(1507, [s, s, l, s, s, l, l, s, l, s, l, l], gregorian(2083, 9, 14)).unwrap(), - PackedHijriYearData::try_new(1508, [l, s, s, l, s, l, s, s, l, s, l, l], gregorian(2084, 9, 2)).unwrap(), - PackedHijriYearData::try_new(1509, [l, s, l, s, l, s, l, s, s, l, s, l], gregorian(2085, 8, 22)).unwrap(), - PackedHijriYearData::try_new(1510, [l, s, l, l, s, l, s, l, s, s, l, s], gregorian(2086, 8, 11)).unwrap(), - PackedHijriYearData::try_new(1511, [l, s, l, l, s, l, l, s, l, s, s, l], gregorian(2087, 7, 31)).unwrap(), - PackedHijriYearData::try_new(1512, [s, l, s, l, s, l, l, l, s, l, s, l], gregorian(2088, 7, 20)).unwrap(), - PackedHijriYearData::try_new(1513, [s, s, s, l, s, l, l, l, s, l, l, s], gregorian(2089, 7, 10)).unwrap(), - PackedHijriYearData::try_new(1514, [l, s, s, s, l, s, l, l, s, l, l, l], gregorian(2090, 6, 29)).unwrap(), - PackedHijriYearData::try_new(1515, [s, s, l, s, s, l, s, l, l, s, l, l], gregorian(2091, 6, 19)).unwrap(), - PackedHijriYearData::try_new(1516, [s, l, s, l, s, s, l, s, l, s, l, l], gregorian(2092, 6, 7)).unwrap(), - PackedHijriYearData::try_new(1517, [s, l, s, l, s, l, l, s, s, l, s, l], gregorian(2093, 5, 27)).unwrap(), - PackedHijriYearData::try_new(1518, [s, l, s, l, l, s, l, l, s, l, s, s], gregorian(2094, 5, 16)).unwrap(), - PackedHijriYearData::try_new(1519, [l, s, s, l, l, l, s, l, l, s, l, s], gregorian(2095, 5, 5)).unwrap(), - PackedHijriYearData::try_new(1520, [s, l, s, s, l, l, l, s, l, l, s, l], gregorian(2096, 4, 24)).unwrap(), - PackedHijriYearData::try_new(1521, [s, s, s, l, s, l, l, s, l, l, s, l], gregorian(2097, 4, 14)).unwrap(), - PackedHijriYearData::try_new(1522, [l, s, s, s, l, s, l, l, s, l, l, s], gregorian(2098, 4, 3)).unwrap(), - PackedHijriYearData::try_new(1523, [l, s, l, s, l, s, l, s, s, l, l, s], gregorian(2099, 3, 23)).unwrap(), - PackedHijriYearData::try_new(1524, [l, l, s, l, s, l, s, l, s, s, l, s], gregorian(2100, 3, 12)).unwrap(), - PackedHijriYearData::try_new(1525, [l, l, s, l, l, s, l, s, l, s, s, l], gregorian(2101, 3, 1)).unwrap(), - PackedHijriYearData::try_new(1526, [s, l, s, l, l, l, s, l, s, l, s, s], gregorian(2102, 2, 19)).unwrap(), - PackedHijriYearData::try_new(1527, [l, s, l, s, l, l, s, l, l, s, l, s], gregorian(2103, 2, 8)).unwrap(), - PackedHijriYearData::try_new(1528, [l, s, s, l, s, l, s, l, l, s, l, l], gregorian(2104, 1, 29)).unwrap(), - PackedHijriYearData::try_new(1529, [s, l, s, s, l, s, l, s, l, s, l, l], gregorian(2105, 1, 18)).unwrap(), - PackedHijriYearData::try_new(1530, [s, l, l, s, s, l, s, l, s, s, l, l], gregorian(2106, 1, 7)).unwrap(), - PackedHijriYearData::try_new(1531, [s, l, l, l, s, s, l, s, l, s, s, l], gregorian(2106, 12, 27)).unwrap(), - PackedHijriYearData::try_new(1532, [s, l, l, l, s, l, l, s, s, s, l, s], gregorian(2107, 12, 16)).unwrap(), - PackedHijriYearData::try_new(1533, [l, s, l, l, l, s, l, s, l, s, s, l], gregorian(2108, 12, 4)).unwrap(), - PackedHijriYearData::try_new(1534, [s, l, s, l, l, s, l, l, s, s, l, s], gregorian(2109, 11, 24)).unwrap(), - PackedHijriYearData::try_new(1535, [l, s, l, s, l, s, l, l, s, l, s, l], gregorian(2110, 11, 13)).unwrap(), - PackedHijriYearData::try_new(1536, [s, l, s, l, s, l, s, l, s, l, s, l], gregorian(2111, 11, 3)).unwrap(), - PackedHijriYearData::try_new(1537, [l, s, l, l, s, s, l, s, s, l, s, l], gregorian(2112, 10, 22)).unwrap(), - PackedHijriYearData::try_new(1538, [l, l, s, l, l, s, s, l, s, s, l, s], gregorian(2113, 10, 11)).unwrap(), - PackedHijriYearData::try_new(1539, [l, l, l, s, l, l, s, s, l, s, s, l], gregorian(2114, 9, 30)).unwrap(), - PackedHijriYearData::try_new(1540, [s, l, l, s, l, l, s, l, s, s, l, s], gregorian(2115, 9, 20)).unwrap(), - PackedHijriYearData::try_new(1541, [l, s, l, s, l, l, l, s, l, s, s, l], gregorian(2116, 9, 8)).unwrap(), - PackedHijriYearData::try_new(1542, [s, l, s, l, s, l, l, s, l, s, l, l], gregorian(2117, 8, 29)).unwrap(), - PackedHijriYearData::try_new(1543, [s, l, s, s, l, s, l, s, l, s, l, l], gregorian(2118, 8, 19)).unwrap(), - PackedHijriYearData::try_new(1544, [l, s, l, s, s, l, s, l, s, l, s, l], gregorian(2119, 8, 8)).unwrap(), - PackedHijriYearData::try_new(1545, [l, l, s, l, s, s, l, s, l, s, s, l], gregorian(2120, 7, 27)).unwrap(), - PackedHijriYearData::try_new(1546, [l, l, s, l, s, l, s, l, s, l, s, s], gregorian(2121, 7, 16)).unwrap(), - PackedHijriYearData::try_new(1547, [l, l, s, l, l, s, l, s, l, s, l, s], gregorian(2122, 7, 5)).unwrap(), - PackedHijriYearData::try_new(1548, [l, s, s, l, l, s, l, l, s, l, s, l], gregorian(2123, 6, 25)).unwrap(), - PackedHijriYearData::try_new(1549, [s, l, s, s, l, s, l, l, l, s, l, s], gregorian(2124, 6, 14)).unwrap(), - PackedHijriYearData::try_new(1550, [l, s, l, s, s, s, l, l, l, s, l, l], gregorian(2125, 6, 3)).unwrap(), - PackedHijriYearData::try_new(1551, [s, l, s, s, l, s, s, l, l, s, l, l], gregorian(2126, 5, 24)).unwrap(), - PackedHijriYearData::try_new(1552, [l, s, l, s, s, l, s, s, l, l, s, l], gregorian(2127, 5, 13)).unwrap(), - PackedHijriYearData::try_new(1553, [l, s, l, s, l, s, l, s, l, s, l, s], gregorian(2128, 5, 1)).unwrap(), - PackedHijriYearData::try_new(1554, [l, s, l, s, l, l, s, l, s, l, s, l], gregorian(2129, 4, 20)).unwrap(), - PackedHijriYearData::try_new(1555, [s, s, l, s, l, l, s, l, l, s, l, s], gregorian(2130, 4, 10)).unwrap(), - PackedHijriYearData::try_new(1556, [l, s, s, l, s, l, s, l, l, l, s, l], gregorian(2131, 3, 30)).unwrap(), - PackedHijriYearData::try_new(1557, [s, l, s, s, s, l, s, l, l, l, l, s], gregorian(2132, 3, 19)).unwrap(), - PackedHijriYearData::try_new(1558, [l, s, l, s, s, s, l, s, l, l, l, s], gregorian(2133, 3, 8)).unwrap(), - PackedHijriYearData::try_new(1559, [l, l, s, s, l, s, s, l, l, s, l, s], gregorian(2134, 2, 25)).unwrap(), - PackedHijriYearData::try_new(1560, [l, l, s, l, s, l, s, l, s, l, s, l], gregorian(2135, 2, 14)).unwrap(), - PackedHijriYearData::try_new(1561, [s, l, l, s, l, s, l, l, s, s, l, s], gregorian(2136, 2, 4)).unwrap(), - PackedHijriYearData::try_new(1562, [s, l, l, s, l, s, l, l, l, s, s, l], gregorian(2137, 1, 23)).unwrap(), - PackedHijriYearData::try_new(1563, [s, l, s, s, l, s, l, l, l, s, l, s], gregorian(2138, 1, 13)).unwrap(), - PackedHijriYearData::try_new(1564, [l, s, l, s, s, l, s, l, l, l, s, l], gregorian(2139, 1, 2)).unwrap(), - PackedHijriYearData::try_new(1565, [s, l, s, l, s, s, l, s, l, l, s, l], gregorian(2139, 12, 23)).unwrap(), - PackedHijriYearData::try_new(1566, [l, s, l, s, l, s, s, l, s, l, s, l], gregorian(2140, 12, 11)).unwrap(), - PackedHijriYearData::try_new(1567, [l, s, l, l, s, l, s, l, s, s, l, s], gregorian(2141, 11, 30)).unwrap(), - PackedHijriYearData::try_new(1568, [l, s, l, l, l, s, l, s, l, s, s, s], gregorian(2142, 11, 19)).unwrap(), - PackedHijriYearData::try_new(1569, [l, s, l, l, l, s, l, l, s, l, s, s], gregorian(2143, 11, 8)).unwrap(), - PackedHijriYearData::try_new(1570, [s, l, s, l, l, s, l, l, l, s, s, l], gregorian(2144, 10, 28)).unwrap(), - PackedHijriYearData::try_new(1571, [s, s, l, s, l, l, s, l, l, s, l, s], gregorian(2145, 10, 18)).unwrap(), - PackedHijriYearData::try_new(1572, [l, s, s, l, s, l, s, l, l, s, l, s], gregorian(2146, 10, 7)).unwrap(), - PackedHijriYearData::try_new(1573, [l, s, l, l, s, l, s, s, l, s, l, s], gregorian(2147, 9, 26)).unwrap(), - PackedHijriYearData::try_new(1574, [l, l, s, l, l, s, l, s, s, l, s, s], gregorian(2148, 9, 14)).unwrap(), - PackedHijriYearData::try_new(1575, [l, l, l, s, l, l, s, l, s, s, s, l], gregorian(2149, 9, 3)).unwrap(), - PackedHijriYearData::try_new(1576, [s, l, l, s, l, l, l, s, l, s, s, s], gregorian(2150, 8, 24)).unwrap(), - PackedHijriYearData::try_new(1577, [l, s, l, l, s, l, l, s, l, s, l, s], gregorian(2151, 8, 13)).unwrap(), - PackedHijriYearData::try_new(1578, [s, l, s, l, s, l, l, s, l, l, s, l], gregorian(2152, 8, 2)).unwrap(), - PackedHijriYearData::try_new(1579, [s, l, s, l, s, s, l, l, s, l, s, l], gregorian(2153, 7, 23)).unwrap(), - PackedHijriYearData::try_new(1580, [s, l, l, s, l, s, s, l, s, l, s, l], gregorian(2154, 7, 12)).unwrap(), - PackedHijriYearData::try_new(1581, [l, l, s, l, s, l, s, s, l, s, l, s], gregorian(2155, 7, 1)).unwrap(), - PackedHijriYearData::try_new(1582, [l, l, s, l, l, s, l, s, l, s, s, s], gregorian(2156, 6, 19)).unwrap(), - PackedHijriYearData::try_new(1583, [l, l, s, l, l, l, s, l, s, l, s, s], gregorian(2157, 6, 8)).unwrap(), - PackedHijriYearData::try_new(1584, [s, l, l, s, l, l, s, l, l, s, l, s], gregorian(2158, 5, 29)).unwrap(), - PackedHijriYearData::try_new(1585, [s, l, s, l, s, l, s, l, l, s, l, l], gregorian(2159, 5, 19)).unwrap(), - PackedHijriYearData::try_new(1586, [s, s, l, s, l, s, s, l, l, l, s, l], gregorian(2160, 5, 8)).unwrap(), - PackedHijriYearData::try_new(1587, [s, l, l, s, s, s, l, s, l, s, l, l], gregorian(2161, 4, 27)).unwrap(), - PackedHijriYearData::try_new(1588, [l, s, l, l, s, s, s, l, s, l, s, l], gregorian(2162, 4, 16)).unwrap(), - PackedHijriYearData::try_new(1589, [l, s, l, l, s, l, s, s, l, s, l, s], gregorian(2163, 4, 5)).unwrap(), - PackedHijriYearData::try_new(1590, [l, s, l, l, l, s, s, l, s, l, s, l], gregorian(2164, 3, 24)).unwrap(), - PackedHijriYearData::try_new(1591, [s, l, s, l, l, s, l, s, l, s, l, s], gregorian(2165, 3, 14)).unwrap(), - PackedHijriYearData::try_new(1592, [l, s, l, s, l, s, l, s, l, l, l, s], gregorian(2166, 3, 3)).unwrap(), - PackedHijriYearData::try_new(1593, [l, s, s, l, s, s, l, s, l, l, l, s], gregorian(2167, 2, 21)).unwrap(), - PackedHijriYearData::try_new(1594, [l, l, s, s, l, s, s, s, l, l, l, l], gregorian(2168, 2, 10)).unwrap(), - PackedHijriYearData::try_new(1595, [s, l, s, l, s, s, l, s, s, l, l, l], gregorian(2169, 1, 30)).unwrap(), - PackedHijriYearData::try_new(1596, [s, l, l, s, l, s, s, l, s, l, s, l], gregorian(2170, 1, 19)).unwrap(), - PackedHijriYearData::try_new(1597, [s, l, l, s, l, s, l, s, l, s, l, s], gregorian(2171, 1, 8)).unwrap(), - PackedHijriYearData::try_new(1598, [l, s, l, s, l, l, s, l, s, l, l, s], gregorian(2171, 12, 28)).unwrap(), - PackedHijriYearData::try_new(1599, [s, l, s, l, s, l, s, l, l, l, s, l], gregorian(2172, 12, 17)).unwrap(), - PackedHijriYearData::try_new(1600, [s, s, l, s, l, s, s, l, l, l, s, l], gregorian(2173, 12, 7)).unwrap(), + [ + PackedHijriYearInfo::new(UMMALQURA_DATA_STARTING_YEAR, [l, s, l, s, l, s, l, s, l, s, l, s], iso(1882, 11, 12)), + PackedHijriYearInfo::new(1301, [l, l, s, l, s, l, s, l, s, l, s, s], iso(1883, 11, 1)), + PackedHijriYearInfo::new(1302, [l, l, l, s, l, l, s, s, l, s, s, l], iso(1884, 10, 20)), + PackedHijriYearInfo::new(1303, [s, l, l, s, l, l, s, l, s, l, s, s], iso(1885, 10, 10)), + PackedHijriYearInfo::new(1304, [s, l, l, s, l, l, l, s, l, s, l, s], iso(1886, 9, 29)), + PackedHijriYearInfo::new(1305, [s, s, l, l, s, l, l, s, l, l, s, s], iso(1887, 9, 19)), + PackedHijriYearInfo::new(1306, [l, s, l, s, l, s, l, s, l, l, s, l], iso(1888, 9, 7)), + PackedHijriYearInfo::new(1307, [s, l, s, l, s, l, s, l, s, l, s, l], iso(1889, 8, 28)), + PackedHijriYearInfo::new(1308, [s, l, l, s, l, s, l, s, l, s, s, l], iso(1890, 8, 17)), + PackedHijriYearInfo::new(1309, [s, l, l, l, l, s, s, l, s, s, l, s], iso(1891, 8, 6)), + PackedHijriYearInfo::new(1310, [l, s, l, l, l, s, l, s, l, s, s, l], iso(1892, 7, 25)), + PackedHijriYearInfo::new(1311, [s, l, s, l, l, l, s, l, s, l, s, s], iso(1893, 7, 15)), + PackedHijriYearInfo::new(1312, [l, s, l, s, l, l, s, l, l, s, l, s], iso(1894, 7, 4)), + PackedHijriYearInfo::new(1313, [s, l, s, l, s, l, s, l, l, l, s, s], iso(1895, 6, 24)), + PackedHijriYearInfo::new(1314, [l, l, s, l, s, s, l, s, l, l, s, l], iso(1896, 6, 12)), + PackedHijriYearInfo::new(1315, [s, l, l, s, l, s, s, l, s, l, s, l], iso(1897, 6, 2)), + PackedHijriYearInfo::new(1316, [s, l, l, l, s, l, s, s, l, s, l, s], iso(1898, 5, 22)), + PackedHijriYearInfo::new(1317, [l, s, l, l, s, l, s, l, s, l, s, s], iso(1899, 5, 11)), + PackedHijriYearInfo::new(1318, [l, s, l, l, s, l, l, s, l, s, l, s], iso(1900, 4, 30)), + PackedHijriYearInfo::new(1319, [s, l, s, l, l, s, l, s, l, l, s, l], iso(1901, 4, 20)), + PackedHijriYearInfo::new(1320, [s, l, s, s, l, s, l, s, l, l, l, s], iso(1902, 4, 10)), + PackedHijriYearInfo::new(1321, [l, s, l, s, s, l, s, s, l, l, l, l], iso(1903, 3, 30)), + PackedHijriYearInfo::new(1322, [s, l, s, l, s, s, s, l, s, l, l, l], iso(1904, 3, 19)), + PackedHijriYearInfo::new(1323, [s, l, l, s, l, s, s, s, l, s, l, l], iso(1905, 3, 8)), + PackedHijriYearInfo::new(1324, [s, l, l, s, l, s, l, s, s, l, s, l], iso(1906, 2, 25)), + PackedHijriYearInfo::new(1325, [l, s, l, s, l, l, s, l, s, l, s, l], iso(1907, 2, 14)), + PackedHijriYearInfo::new(1326, [s, s, l, s, l, l, s, l, s, l, l, s], iso(1908, 2, 4)), + PackedHijriYearInfo::new(1327, [l, s, s, l, s, l, s, l, l, s, l, l], iso(1909, 1, 23)), + PackedHijriYearInfo::new(1328, [s, l, s, s, l, s, s, l, l, l, s, l], iso(1910, 1, 13)), + PackedHijriYearInfo::new(1329, [l, s, l, s, s, l, s, s, l, l, s, l], iso(1911, 1, 2)), + PackedHijriYearInfo::new(1330, [l, l, s, l, s, s, l, s, s, l, l, s], iso(1911, 12, 22)), + PackedHijriYearInfo::new(1331, [l, l, s, l, l, s, s, l, s, l, s, l], iso(1912, 12, 10)), + PackedHijriYearInfo::new(1332, [s, l, s, l, l, s, l, s, l, l, s, s], iso(1913, 11, 30)), + PackedHijriYearInfo::new(1333, [l, s, s, l, l, s, l, l, s, l, l, s], iso(1914, 11, 19)), + PackedHijriYearInfo::new(1334, [s, s, l, s, l, s, l, l, l, s, l, s], iso(1915, 11, 9)), + PackedHijriYearInfo::new(1335, [l, s, l, s, s, l, s, l, l, s, l, l], iso(1916, 10, 28)), + PackedHijriYearInfo::new(1336, [s, l, s, l, s, s, l, s, l, s, l, l], iso(1917, 10, 18)), + PackedHijriYearInfo::new(1337, [l, s, l, s, l, s, s, l, s, l, s, l], iso(1918, 10, 7)), + PackedHijriYearInfo::new(1338, [s, l, l, s, l, l, s, s, l, s, l, s], iso(1919, 9, 26)), + PackedHijriYearInfo::new(1339, [l, s, l, s, l, l, l, s, l, s, s, l], iso(1920, 9, 14)), + PackedHijriYearInfo::new(1340, [s, s, l, s, l, l, l, l, s, l, s, s], iso(1921, 9, 4)), + PackedHijriYearInfo::new(1341, [l, s, s, l, s, l, l, l, s, l, l, s], iso(1922, 8, 24)), + PackedHijriYearInfo::new(1342, [s, s, l, s, l, s, l, l, s, l, l, s], iso(1923, 8, 14)), + PackedHijriYearInfo::new(1343, [l, s, s, l, s, l, s, l, s, l, l, s], iso(1924, 8, 2)), + PackedHijriYearInfo::new(1344, [l, s, l, s, l, l, s, s, l, s, l, s], iso(1925, 7, 22)), + PackedHijriYearInfo::new(1345, [l, s, l, l, l, s, l, s, s, l, s, s], iso(1926, 7, 11)), + PackedHijriYearInfo::new(1346, [l, s, l, l, l, l, s, l, s, s, l, s], iso(1927, 6, 30)), + PackedHijriYearInfo::new(1347, [s, l, s, l, l, l, s, l, l, s, s, l], iso(1928, 6, 19)), + PackedHijriYearInfo::new(1348, [s, s, l, s, l, l, s, l, l, l, s, s], iso(1929, 6, 9)), + PackedHijriYearInfo::new(1349, [l, s, s, l, s, l, l, s, l, l, s, l], iso(1930, 5, 29)), + PackedHijriYearInfo::new(1350, [s, l, s, l, s, l, s, s, l, l, s, l], iso(1931, 5, 19)), + PackedHijriYearInfo::new(1351, [l, s, l, s, l, s, l, s, s, l, s, l], iso(1932, 5, 7)), + PackedHijriYearInfo::new(1352, [l, s, l, l, s, l, s, l, s, s, l, s], iso(1933, 4, 26)), + PackedHijriYearInfo::new(1353, [l, s, l, l, l, s, l, s, s, l, s, l], iso(1934, 4, 15)), + PackedHijriYearInfo::new(1354, [s, l, s, l, l, s, l, l, s, l, s, s], iso(1935, 4, 5)), + PackedHijriYearInfo::new(1355, [l, s, s, l, l, s, l, l, s, l, l, s], iso(1936, 3, 24)), + PackedHijriYearInfo::new(1356, [s, l, s, l, s, l, s, l, s, l, l, l], iso(1937, 3, 14)), + PackedHijriYearInfo::new(1357, [s, s, l, s, l, s, s, l, s, l, l, l], iso(1938, 3, 4)), + PackedHijriYearInfo::new(1358, [s, l, s, l, s, l, s, s, l, s, l, l], iso(1939, 2, 21)), + PackedHijriYearInfo::new(1359, [s, l, l, s, l, s, l, s, s, s, l, l], iso(1940, 2, 10)), + PackedHijriYearInfo::new(1360, [s, l, l, l, s, l, s, l, s, s, l, s], iso(1941, 1, 29)), + PackedHijriYearInfo::new(1361, [l, s, l, l, s, l, l, s, s, l, s, l], iso(1942, 1, 18)), + PackedHijriYearInfo::new(1362, [s, l, s, l, s, l, l, s, l, s, l, s], iso(1943, 1, 8)), + PackedHijriYearInfo::new(1363, [l, s, l, s, l, s, l, s, l, s, l, l], iso(1943, 12, 28)), + PackedHijriYearInfo::new(1364, [s, l, s, l, s, s, l, s, l, s, l, l], iso(1944, 12, 17)), + PackedHijriYearInfo::new(1365, [l, l, s, s, l, s, s, l, s, l, s, l], iso(1945, 12, 6)), + PackedHijriYearInfo::new(1366, [l, l, s, l, s, l, s, s, l, s, l, s], iso(1946, 11, 25)), + PackedHijriYearInfo::new(1367, [l, l, s, l, l, s, l, s, s, l, s, l], iso(1947, 11, 14)), + PackedHijriYearInfo::new(1368, [s, l, s, l, l, l, s, s, l, s, l, s], iso(1948, 11, 3)), + PackedHijriYearInfo::new(1369, [l, s, l, s, l, l, s, l, s, l, l, s], iso(1949, 10, 23)), + PackedHijriYearInfo::new(1370, [l, s, s, l, s, l, s, l, s, l, l, l], iso(1950, 10, 13)), + PackedHijriYearInfo::new(1371, [s, l, s, s, l, s, l, s, l, s, l, l], iso(1951, 10, 3)), + PackedHijriYearInfo::new(1372, [l, s, s, l, s, l, s, s, l, s, l, l], iso(1952, 9, 21)), + PackedHijriYearInfo::new(1373, [l, s, l, s, l, s, l, s, s, l, s, l], iso(1953, 9, 10)), + PackedHijriYearInfo::new(1374, [l, s, l, l, s, l, s, l, s, s, l, s], iso(1954, 8, 30)), + PackedHijriYearInfo::new(1375, [l, s, l, l, s, l, l, s, l, s, l, s], iso(1955, 8, 19)), + PackedHijriYearInfo::new(1376, [s, l, s, l, s, l, l, l, s, l, s, l], iso(1956, 8, 8)), + PackedHijriYearInfo::new(1377, [s, s, l, s, s, l, l, l, s, l, l, s], iso(1957, 7, 29)), + PackedHijriYearInfo::new(1378, [l, s, s, s, l, s, l, l, s, l, l, l], iso(1958, 7, 18)), + PackedHijriYearInfo::new(1379, [s, l, s, s, s, l, s, l, l, s, l, l], iso(1959, 7, 8)), + PackedHijriYearInfo::new(1380, [s, l, s, l, s, l, s, l, s, l, s, l], iso(1960, 6, 26)), + PackedHijriYearInfo::new(1381, [s, l, s, l, l, s, l, s, l, s, s, l], iso(1961, 6, 15)), + PackedHijriYearInfo::new(1382, [s, l, s, l, l, s, l, l, s, l, s, s], iso(1962, 6, 4)), + PackedHijriYearInfo::new(1383, [l, s, s, l, l, l, s, l, l, s, l, s], iso(1963, 5, 24)), + PackedHijriYearInfo::new(1384, [s, l, s, s, l, l, s, l, l, l, s, l], iso(1964, 5, 13)), + PackedHijriYearInfo::new(1385, [s, s, l, s, s, l, l, s, l, l, l, s], iso(1965, 5, 3)), + PackedHijriYearInfo::new(1386, [l, s, s, l, s, s, l, l, s, l, l, s], iso(1966, 4, 22)), + PackedHijriYearInfo::new(1387, [l, s, l, s, l, s, l, s, l, s, l, s], iso(1967, 4, 11)), + PackedHijriYearInfo::new(1388, [l, l, s, l, s, l, s, l, s, l, s, s], iso(1968, 3, 30)), + PackedHijriYearInfo::new(1389, [l, l, s, l, l, s, l, l, s, s, l, s], iso(1969, 3, 19)), + PackedHijriYearInfo::new(1390, [s, l, s, l, l, l, s, l, s, l, s, l], iso(1970, 3, 9)), + PackedHijriYearInfo::new(1391, [s, s, l, s, l, l, s, l, l, s, l, s], iso(1971, 2, 27)), + PackedHijriYearInfo::new(1392, [l, s, s, l, s, l, s, l, l, s, l, l], iso(1972, 2, 16)), + PackedHijriYearInfo::new(1393, [s, l, s, s, l, s, l, s, l, s, l, l], iso(1973, 2, 5)), + PackedHijriYearInfo::new(1394, [l, s, l, s, s, l, s, l, s, l, s, l], iso(1974, 1, 25)), + PackedHijriYearInfo::new(1395, [l, s, l, l, s, l, s, s, l, s, s, l], iso(1975, 1, 14)), + PackedHijriYearInfo::new(1396, [l, s, l, l, s, l, l, s, s, l, s, s], iso(1976, 1, 3)), + PackedHijriYearInfo::new(1397, [l, s, l, l, s, l, l, l, s, s, s, l], iso(1976, 12, 22)), + PackedHijriYearInfo::new(1398, [s, l, s, l, l, s, l, l, s, l, s, s], iso(1977, 12, 12)), + PackedHijriYearInfo::new(1399, [l, s, l, s, l, s, l, l, s, l, s, l], iso(1978, 12, 1)), + PackedHijriYearInfo::new(1400, [l, s, l, s, s, l, s, l, s, l, s, l], iso(1979, 11, 21)), + PackedHijriYearInfo::new(1401, [l, l, s, l, s, s, l, s, s, l, s, l], iso(1980, 11, 9)), + PackedHijriYearInfo::new(1402, [l, l, l, s, l, s, s, l, s, s, l, s], iso(1981, 10, 29)), + PackedHijriYearInfo::new(1403, [l, l, l, s, l, l, s, s, l, s, s, l], iso(1982, 10, 18)), + PackedHijriYearInfo::new(1404, [s, l, l, s, l, l, s, l, s, l, s, s], iso(1983, 10, 8)), + PackedHijriYearInfo::new(1405, [l, s, l, s, l, l, l, s, l, s, s, l], iso(1984, 9, 26)), + PackedHijriYearInfo::new(1406, [l, s, s, l, s, l, l, s, l, s, l, l], iso(1985, 9, 16)), + PackedHijriYearInfo::new(1407, [s, l, s, s, l, s, l, s, l, s, l, l], iso(1986, 9, 6)), + PackedHijriYearInfo::new(1408, [l, s, l, s, l, s, s, l, s, s, l, l], iso(1987, 8, 26)), + PackedHijriYearInfo::new(1409, [l, l, s, l, s, l, s, s, l, s, s, l], iso(1988, 8, 14)), + PackedHijriYearInfo::new(1410, [l, l, s, l, l, s, l, s, s, l, s, s], iso(1989, 8, 3)), + PackedHijriYearInfo::new(1411, [l, l, s, l, l, s, l, l, s, s, l, s], iso(1990, 7, 23)), + PackedHijriYearInfo::new(1412, [l, s, l, s, l, s, l, l, l, s, s, l], iso(1991, 7, 13)), + PackedHijriYearInfo::new(1413, [s, l, s, s, l, s, l, l, l, s, l, s], iso(1992, 7, 2)), + PackedHijriYearInfo::new(1414, [l, s, l, s, s, l, s, l, l, s, l, l], iso(1993, 6, 21)), + PackedHijriYearInfo::new(1415, [s, l, s, l, s, s, l, s, l, s, l, l], iso(1994, 6, 11)), + PackedHijriYearInfo::new(1416, [l, s, l, s, l, s, s, l, s, l, s, l], iso(1995, 5, 31)), + PackedHijriYearInfo::new(1417, [l, s, l, l, s, s, l, s, l, s, l, s], iso(1996, 5, 19)), + PackedHijriYearInfo::new(1418, [l, s, l, l, s, l, s, l, s, l, s, l], iso(1997, 5, 8)), + PackedHijriYearInfo::new(1419, [s, l, s, l, s, l, s, l, l, l, s, s], iso(1998, 4, 28)), + PackedHijriYearInfo::new(1420, [s, l, s, s, l, s, l, l, l, l, s, l], iso(1999, 4, 17)), + PackedHijriYearInfo::new(1421, [s, s, l, s, s, s, l, l, l, l, s, l], iso(2000, 4, 6)), + PackedHijriYearInfo::new(1422, [l, s, s, l, s, s, s, l, l, l, s, l], iso(2001, 3, 26)), + PackedHijriYearInfo::new(1423, [l, s, l, s, l, s, s, l, s, l, s, l], iso(2002, 3, 15)), + PackedHijriYearInfo::new(1424, [l, s, l, l, s, l, s, s, l, s, l, s], iso(2003, 3, 4)), + PackedHijriYearInfo::new(1425, [l, s, l, l, s, l, s, l, l, s, l, s], iso(2004, 2, 21)), + PackedHijriYearInfo::new(1426, [s, l, s, l, s, l, l, s, l, l, s, l], iso(2005, 2, 10)), + PackedHijriYearInfo::new(1427, [s, s, l, s, l, s, l, l, s, l, l, s], iso(2006, 1, 31)), + PackedHijriYearInfo::new(1428, [l, s, s, l, s, s, l, l, l, s, l, l], iso(2007, 1, 20)), + PackedHijriYearInfo::new(1429, [s, l, s, s, l, s, s, l, l, s, l, l], iso(2008, 1, 10)), + PackedHijriYearInfo::new(1430, [s, l, l, s, s, l, s, l, s, l, s, l], iso(2008, 12, 29)), + PackedHijriYearInfo::new(1431, [s, l, l, s, l, s, l, s, l, s, s, l], iso(2009, 12, 18)), + PackedHijriYearInfo::new(1432, [s, l, l, l, s, l, s, l, s, l, s, s], iso(2010, 12, 7)), + PackedHijriYearInfo::new(1433, [l, s, l, l, s, l, l, s, l, s, l, s], iso(2011, 11, 26)), + PackedHijriYearInfo::new(1434, [s, l, s, l, s, l, l, s, l, l, s, s], iso(2012, 11, 15)), + PackedHijriYearInfo::new(1435, [l, s, l, s, l, s, l, s, l, l, s, l], iso(2013, 11, 4)), + PackedHijriYearInfo::new(1436, [s, l, s, l, s, l, s, l, s, l, s, l], iso(2014, 10, 25)), + PackedHijriYearInfo::new(1437, [l, s, l, l, s, s, l, s, l, s, s, l], iso(2015, 10, 14)), + PackedHijriYearInfo::new(1438, [l, s, l, l, l, s, s, l, s, s, l, s], iso(2016, 10, 2)), + PackedHijriYearInfo::new(1439, [l, s, l, l, l, s, l, s, l, s, s, l], iso(2017, 9, 21)), + PackedHijriYearInfo::new(1440, [s, l, s, l, l, l, s, l, s, l, s, s], iso(2018, 9, 11)), + PackedHijriYearInfo::new(1441, [l, s, l, s, l, l, s, l, l, s, l, s], iso(2019, 8, 31)), + PackedHijriYearInfo::new(1442, [s, l, s, l, s, l, s, l, l, s, l, s], iso(2020, 8, 20)), + PackedHijriYearInfo::new(1443, [l, s, l, s, l, s, l, s, l, s, l, l], iso(2021, 8, 9)), + PackedHijriYearInfo::new(1444, [s, l, s, l, l, s, s, l, s, l, s, l], iso(2022, 7, 30)), + PackedHijriYearInfo::new(1445, [s, l, l, l, s, l, s, s, l, s, s, l], iso(2023, 7, 19)), + PackedHijriYearInfo::new(1446, [s, l, l, l, s, l, l, s, s, l, s, s], iso(2024, 7, 7)), + PackedHijriYearInfo::new(1447, [l, s, l, l, l, s, l, s, l, s, l, s], iso(2025, 6, 26)), + PackedHijriYearInfo::new(1448, [s, l, s, l, l, s, l, l, s, l, s, l], iso(2026, 6, 16)), + PackedHijriYearInfo::new(1449, [s, s, l, s, l, s, l, l, s, l, l, s], iso(2027, 6, 6)), + PackedHijriYearInfo::new(1450, [l, s, l, s, s, l, s, l, s, l, l, s], iso(2028, 5, 25)), + PackedHijriYearInfo::new(1451, [l, l, l, s, s, l, s, s, l, l, s, l], iso(2029, 5, 14)), + PackedHijriYearInfo::new(1452, [l, s, l, l, s, s, l, s, s, l, s, l], iso(2030, 5, 4)), + PackedHijriYearInfo::new(1453, [l, s, l, l, s, l, s, l, s, s, l, s], iso(2031, 4, 23)), + PackedHijriYearInfo::new(1454, [l, s, l, l, s, l, l, s, l, s, l, s], iso(2032, 4, 11)), + PackedHijriYearInfo::new(1455, [s, l, s, l, l, s, l, s, l, l, s, l], iso(2033, 4, 1)), + PackedHijriYearInfo::new(1456, [s, s, l, s, l, s, l, s, l, l, l, s], iso(2034, 3, 22)), + PackedHijriYearInfo::new(1457, [l, s, s, l, s, s, l, s, l, l, l, l], iso(2035, 3, 11)), + PackedHijriYearInfo::new(1458, [s, l, s, s, l, s, s, l, s, l, l, l], iso(2036, 2, 29)), + PackedHijriYearInfo::new(1459, [s, l, l, s, s, l, s, s, l, s, l, l], iso(2037, 2, 17)), + PackedHijriYearInfo::new(1460, [s, l, l, s, l, s, l, s, s, l, s, l], iso(2038, 2, 6)), + PackedHijriYearInfo::new(1461, [s, l, l, s, l, s, l, s, l, l, s, s], iso(2039, 1, 26)), + PackedHijriYearInfo::new(1462, [l, s, l, s, l, l, s, l, s, l, l, s], iso(2040, 1, 15)), + PackedHijriYearInfo::new(1463, [s, l, s, l, s, l, s, l, l, l, s, l], iso(2041, 1, 4)), + PackedHijriYearInfo::new(1464, [s, l, s, s, l, s, s, l, l, l, s, l], iso(2041, 12, 25)), + PackedHijriYearInfo::new(1465, [l, s, l, s, s, l, s, s, l, l, s, l], iso(2042, 12, 14)), + PackedHijriYearInfo::new(1466, [l, l, s, l, s, s, s, l, s, l, l, s], iso(2043, 12, 3)), + PackedHijriYearInfo::new(1467, [l, l, s, l, l, s, s, l, s, l, s, l], iso(2044, 11, 21)), + PackedHijriYearInfo::new(1468, [s, l, s, l, l, s, l, s, l, s, l, s], iso(2045, 11, 11)), + PackedHijriYearInfo::new(1469, [s, l, s, l, l, s, l, l, s, l, s, l], iso(2046, 10, 31)), + PackedHijriYearInfo::new(1470, [s, s, l, s, l, l, s, l, l, s, l, s], iso(2047, 10, 21)), + PackedHijriYearInfo::new(1471, [l, s, s, l, s, l, s, l, l, s, l, l], iso(2048, 10, 9)), + PackedHijriYearInfo::new(1472, [s, l, s, s, l, s, l, s, l, l, s, l], iso(2049, 9, 29)), + PackedHijriYearInfo::new(1473, [s, l, s, l, l, s, s, l, s, l, s, l], iso(2050, 9, 18)), + PackedHijriYearInfo::new(1474, [s, l, l, s, l, l, s, s, l, s, l, s], iso(2051, 9, 7)), + PackedHijriYearInfo::new(1475, [s, l, l, s, l, l, l, s, s, l, s, s], iso(2052, 8, 26)), + PackedHijriYearInfo::new(1476, [l, s, l, s, l, l, l, s, l, s, l, s], iso(2053, 8, 15)), + PackedHijriYearInfo::new(1477, [s, l, s, s, l, l, l, l, s, l, s, l], iso(2054, 8, 5)), + PackedHijriYearInfo::new(1478, [s, s, l, s, l, s, l, l, s, l, l, s], iso(2055, 7, 26)), + PackedHijriYearInfo::new(1479, [l, s, s, l, s, l, s, l, s, l, l, s], iso(2056, 7, 14)), + PackedHijriYearInfo::new(1480, [l, s, l, s, l, s, l, s, l, s, l, s], iso(2057, 7, 3)), + PackedHijriYearInfo::new(1481, [l, s, l, l, s, l, s, l, s, l, s, s], iso(2058, 6, 22)), + PackedHijriYearInfo::new(1482, [l, s, l, l, l, l, s, l, s, s, l, s], iso(2059, 6, 11)), + PackedHijriYearInfo::new(1483, [s, l, s, l, l, l, s, l, l, s, s, l], iso(2060, 5, 31)), + PackedHijriYearInfo::new(1484, [s, s, l, s, l, l, l, s, l, s, l, s], iso(2061, 5, 21)), + PackedHijriYearInfo::new(1485, [l, s, s, l, s, l, l, s, l, l, s, l], iso(2062, 5, 10)), + PackedHijriYearInfo::new(1486, [s, l, s, s, l, s, l, s, l, l, s, l], iso(2063, 4, 30)), + PackedHijriYearInfo::new(1487, [l, s, l, s, l, s, s, l, s, l, s, l], iso(2064, 4, 18)), + PackedHijriYearInfo::new(1488, [l, s, l, l, s, l, s, s, l, s, l, s], iso(2065, 4, 7)), + PackedHijriYearInfo::new(1489, [l, s, l, l, l, s, l, s, s, l, s, l], iso(2066, 3, 27)), + PackedHijriYearInfo::new(1490, [s, l, s, l, l, s, l, l, s, s, l, s], iso(2067, 3, 17)), + PackedHijriYearInfo::new(1491, [l, s, s, l, l, s, l, l, s, l, s, l], iso(2068, 3, 5)), + PackedHijriYearInfo::new(1492, [s, l, s, s, l, l, s, l, s, l, l, s], iso(2069, 2, 23)), + PackedHijriYearInfo::new(1493, [l, s, l, s, l, s, s, l, s, l, l, l], iso(2070, 2, 12)), + PackedHijriYearInfo::new(1494, [s, l, s, l, s, l, s, s, s, l, l, l], iso(2071, 2, 2)), + PackedHijriYearInfo::new(1495, [s, l, l, s, l, s, s, l, s, s, l, l], iso(2072, 1, 22)), + PackedHijriYearInfo::new(1496, [s, l, l, l, s, l, s, s, l, s, s, l], iso(2073, 1, 10)), + PackedHijriYearInfo::new(1497, [l, s, l, l, s, l, s, l, s, l, s, l], iso(2073, 12, 30)), + PackedHijriYearInfo::new(1498, [s, l, s, l, s, l, l, s, l, s, l, s], iso(2074, 12, 20)), + PackedHijriYearInfo::new(1499, [l, s, l, s, s, l, l, s, l, s, l, l], iso(2075, 12, 9)), + PackedHijriYearInfo::new(1500, [s, l, s, l, s, s, l, s, l, s, l, l], iso(2076, 11, 28)), + PackedHijriYearInfo::new(1501, [l, s, l, s, l, s, s, s, l, s, l, l], iso(2077, 11, 17)), + PackedHijriYearInfo::new(1502, [l, l, s, l, s, l, s, s, s, l, l, s], iso(2078, 11, 6)), + PackedHijriYearInfo::new(1503, [l, l, s, l, l, s, l, s, s, s, l, l], iso(2079, 10, 26)), + PackedHijriYearInfo::new(1504, [s, l, s, l, l, l, s, s, l, s, l, s], iso(2080, 10, 15)), + PackedHijriYearInfo::new(1505, [l, s, l, s, l, l, s, l, s, l, l, s], iso(2081, 10, 4)), + PackedHijriYearInfo::new(1506, [s, l, s, s, l, l, s, l, l, s, l, l], iso(2082, 9, 24)), + PackedHijriYearInfo::new(1507, [s, s, l, s, s, l, l, s, l, s, l, l], iso(2083, 9, 14)), + PackedHijriYearInfo::new(1508, [l, s, s, l, s, l, s, s, l, s, l, l], iso(2084, 9, 2)), + PackedHijriYearInfo::new(1509, [l, s, l, s, l, s, l, s, s, l, s, l], iso(2085, 8, 22)), + PackedHijriYearInfo::new(1510, [l, s, l, l, s, l, s, l, s, s, l, s], iso(2086, 8, 11)), + PackedHijriYearInfo::new(1511, [l, s, l, l, s, l, l, s, l, s, s, l], iso(2087, 7, 31)), + PackedHijriYearInfo::new(1512, [s, l, s, l, s, l, l, l, s, l, s, l], iso(2088, 7, 20)), + PackedHijriYearInfo::new(1513, [s, s, s, l, s, l, l, l, s, l, l, s], iso(2089, 7, 10)), + PackedHijriYearInfo::new(1514, [l, s, s, s, l, s, l, l, s, l, l, l], iso(2090, 6, 29)), + PackedHijriYearInfo::new(1515, [s, s, l, s, s, l, s, l, l, s, l, l], iso(2091, 6, 19)), + PackedHijriYearInfo::new(1516, [s, l, s, l, s, s, l, s, l, s, l, l], iso(2092, 6, 7)), + PackedHijriYearInfo::new(1517, [s, l, s, l, s, l, l, s, s, l, s, l], iso(2093, 5, 27)), + PackedHijriYearInfo::new(1518, [s, l, s, l, l, s, l, l, s, l, s, s], iso(2094, 5, 16)), + PackedHijriYearInfo::new(1519, [l, s, s, l, l, l, s, l, l, s, l, s], iso(2095, 5, 5)), + PackedHijriYearInfo::new(1520, [s, l, s, s, l, l, l, s, l, l, s, l], iso(2096, 4, 24)), + PackedHijriYearInfo::new(1521, [s, s, s, l, s, l, l, s, l, l, s, l], iso(2097, 4, 14)), + PackedHijriYearInfo::new(1522, [l, s, s, s, l, s, l, l, s, l, l, s], iso(2098, 4, 3)), + PackedHijriYearInfo::new(1523, [l, s, l, s, l, s, l, s, s, l, l, s], iso(2099, 3, 23)), + PackedHijriYearInfo::new(1524, [l, l, s, l, s, l, s, l, s, s, l, s], iso(2100, 3, 12)), + PackedHijriYearInfo::new(1525, [l, l, s, l, l, s, l, s, l, s, s, l], iso(2101, 3, 1)), + PackedHijriYearInfo::new(1526, [s, l, s, l, l, l, s, l, s, l, s, s], iso(2102, 2, 19)), + PackedHijriYearInfo::new(1527, [l, s, l, s, l, l, s, l, l, s, l, s], iso(2103, 2, 8)), + PackedHijriYearInfo::new(1528, [l, s, s, l, s, l, s, l, l, s, l, l], iso(2104, 1, 29)), + PackedHijriYearInfo::new(1529, [s, l, s, s, l, s, l, s, l, s, l, l], iso(2105, 1, 18)), + PackedHijriYearInfo::new(1530, [s, l, l, s, s, l, s, l, s, s, l, l], iso(2106, 1, 7)), + PackedHijriYearInfo::new(1531, [s, l, l, l, s, s, l, s, l, s, s, l], iso(2106, 12, 27)), + PackedHijriYearInfo::new(1532, [s, l, l, l, s, l, l, s, s, s, l, s], iso(2107, 12, 16)), + PackedHijriYearInfo::new(1533, [l, s, l, l, l, s, l, s, l, s, s, l], iso(2108, 12, 4)), + PackedHijriYearInfo::new(1534, [s, l, s, l, l, s, l, l, s, s, l, s], iso(2109, 11, 24)), + PackedHijriYearInfo::new(1535, [l, s, l, s, l, s, l, l, s, l, s, l], iso(2110, 11, 13)), + PackedHijriYearInfo::new(1536, [s, l, s, l, s, l, s, l, s, l, s, l], iso(2111, 11, 3)), + PackedHijriYearInfo::new(1537, [l, s, l, l, s, s, l, s, s, l, s, l], iso(2112, 10, 22)), + PackedHijriYearInfo::new(1538, [l, l, s, l, l, s, s, l, s, s, l, s], iso(2113, 10, 11)), + PackedHijriYearInfo::new(1539, [l, l, l, s, l, l, s, s, l, s, s, l], iso(2114, 9, 30)), + PackedHijriYearInfo::new(1540, [s, l, l, s, l, l, s, l, s, s, l, s], iso(2115, 9, 20)), + PackedHijriYearInfo::new(1541, [l, s, l, s, l, l, l, s, l, s, s, l], iso(2116, 9, 8)), + PackedHijriYearInfo::new(1542, [s, l, s, l, s, l, l, s, l, s, l, l], iso(2117, 8, 29)), + PackedHijriYearInfo::new(1543, [s, l, s, s, l, s, l, s, l, s, l, l], iso(2118, 8, 19)), + PackedHijriYearInfo::new(1544, [l, s, l, s, s, l, s, l, s, l, s, l], iso(2119, 8, 8)), + PackedHijriYearInfo::new(1545, [l, l, s, l, s, s, l, s, l, s, s, l], iso(2120, 7, 27)), + PackedHijriYearInfo::new(1546, [l, l, s, l, s, l, s, l, s, l, s, s], iso(2121, 7, 16)), + PackedHijriYearInfo::new(1547, [l, l, s, l, l, s, l, s, l, s, l, s], iso(2122, 7, 5)), + PackedHijriYearInfo::new(1548, [l, s, s, l, l, s, l, l, s, l, s, l], iso(2123, 6, 25)), + PackedHijriYearInfo::new(1549, [s, l, s, s, l, s, l, l, l, s, l, s], iso(2124, 6, 14)), + PackedHijriYearInfo::new(1550, [l, s, l, s, s, s, l, l, l, s, l, l], iso(2125, 6, 3)), + PackedHijriYearInfo::new(1551, [s, l, s, s, l, s, s, l, l, s, l, l], iso(2126, 5, 24)), + PackedHijriYearInfo::new(1552, [l, s, l, s, s, l, s, s, l, l, s, l], iso(2127, 5, 13)), + PackedHijriYearInfo::new(1553, [l, s, l, s, l, s, l, s, l, s, l, s], iso(2128, 5, 1)), + PackedHijriYearInfo::new(1554, [l, s, l, s, l, l, s, l, s, l, s, l], iso(2129, 4, 20)), + PackedHijriYearInfo::new(1555, [s, s, l, s, l, l, s, l, l, s, l, s], iso(2130, 4, 10)), + PackedHijriYearInfo::new(1556, [l, s, s, l, s, l, s, l, l, l, s, l], iso(2131, 3, 30)), + PackedHijriYearInfo::new(1557, [s, l, s, s, s, l, s, l, l, l, l, s], iso(2132, 3, 19)), + PackedHijriYearInfo::new(1558, [l, s, l, s, s, s, l, s, l, l, l, s], iso(2133, 3, 8)), + PackedHijriYearInfo::new(1559, [l, l, s, s, l, s, s, l, l, s, l, s], iso(2134, 2, 25)), + PackedHijriYearInfo::new(1560, [l, l, s, l, s, l, s, l, s, l, s, l], iso(2135, 2, 14)), + PackedHijriYearInfo::new(1561, [s, l, l, s, l, s, l, l, s, s, l, s], iso(2136, 2, 4)), + PackedHijriYearInfo::new(1562, [s, l, l, s, l, s, l, l, l, s, s, l], iso(2137, 1, 23)), + PackedHijriYearInfo::new(1563, [s, l, s, s, l, s, l, l, l, s, l, s], iso(2138, 1, 13)), + PackedHijriYearInfo::new(1564, [l, s, l, s, s, l, s, l, l, l, s, l], iso(2139, 1, 2)), + PackedHijriYearInfo::new(1565, [s, l, s, l, s, s, l, s, l, l, s, l], iso(2139, 12, 23)), + PackedHijriYearInfo::new(1566, [l, s, l, s, l, s, s, l, s, l, s, l], iso(2140, 12, 11)), + PackedHijriYearInfo::new(1567, [l, s, l, l, s, l, s, l, s, s, l, s], iso(2141, 11, 30)), + PackedHijriYearInfo::new(1568, [l, s, l, l, l, s, l, s, l, s, s, s], iso(2142, 11, 19)), + PackedHijriYearInfo::new(1569, [l, s, l, l, l, s, l, l, s, l, s, s], iso(2143, 11, 8)), + PackedHijriYearInfo::new(1570, [s, l, s, l, l, s, l, l, l, s, s, l], iso(2144, 10, 28)), + PackedHijriYearInfo::new(1571, [s, s, l, s, l, l, s, l, l, s, l, s], iso(2145, 10, 18)), + PackedHijriYearInfo::new(1572, [l, s, s, l, s, l, s, l, l, s, l, s], iso(2146, 10, 7)), + PackedHijriYearInfo::new(1573, [l, s, l, l, s, l, s, s, l, s, l, s], iso(2147, 9, 26)), + PackedHijriYearInfo::new(1574, [l, l, s, l, l, s, l, s, s, l, s, s], iso(2148, 9, 14)), + PackedHijriYearInfo::new(1575, [l, l, l, s, l, l, s, l, s, s, s, l], iso(2149, 9, 3)), + PackedHijriYearInfo::new(1576, [s, l, l, s, l, l, l, s, l, s, s, s], iso(2150, 8, 24)), + PackedHijriYearInfo::new(1577, [l, s, l, l, s, l, l, s, l, s, l, s], iso(2151, 8, 13)), + PackedHijriYearInfo::new(1578, [s, l, s, l, s, l, l, s, l, l, s, l], iso(2152, 8, 2)), + PackedHijriYearInfo::new(1579, [s, l, s, l, s, s, l, l, s, l, s, l], iso(2153, 7, 23)), + PackedHijriYearInfo::new(1580, [s, l, l, s, l, s, s, l, s, l, s, l], iso(2154, 7, 12)), + PackedHijriYearInfo::new(1581, [l, l, s, l, s, l, s, s, l, s, l, s], iso(2155, 7, 1)), + PackedHijriYearInfo::new(1582, [l, l, s, l, l, s, l, s, l, s, s, s], iso(2156, 6, 19)), + PackedHijriYearInfo::new(1583, [l, l, s, l, l, l, s, l, s, l, s, s], iso(2157, 6, 8)), + PackedHijriYearInfo::new(1584, [s, l, l, s, l, l, s, l, l, s, l, s], iso(2158, 5, 29)), + PackedHijriYearInfo::new(1585, [s, l, s, l, s, l, s, l, l, s, l, l], iso(2159, 5, 19)), + PackedHijriYearInfo::new(1586, [s, s, l, s, l, s, s, l, l, l, s, l], iso(2160, 5, 8)), + PackedHijriYearInfo::new(1587, [s, l, l, s, s, s, l, s, l, s, l, l], iso(2161, 4, 27)), + PackedHijriYearInfo::new(1588, [l, s, l, l, s, s, s, l, s, l, s, l], iso(2162, 4, 16)), + PackedHijriYearInfo::new(1589, [l, s, l, l, s, l, s, s, l, s, l, s], iso(2163, 4, 5)), + PackedHijriYearInfo::new(1590, [l, s, l, l, l, s, s, l, s, l, s, l], iso(2164, 3, 24)), + PackedHijriYearInfo::new(1591, [s, l, s, l, l, s, l, s, l, s, l, s], iso(2165, 3, 14)), + PackedHijriYearInfo::new(1592, [l, s, l, s, l, s, l, s, l, l, l, s], iso(2166, 3, 3)), + PackedHijriYearInfo::new(1593, [l, s, s, l, s, s, l, s, l, l, l, s], iso(2167, 2, 21)), + PackedHijriYearInfo::new(1594, [l, l, s, s, l, s, s, s, l, l, l, l], iso(2168, 2, 10)), + PackedHijriYearInfo::new(1595, [s, l, s, l, s, s, l, s, s, l, l, l], iso(2169, 1, 30)), + PackedHijriYearInfo::new(1596, [s, l, l, s, l, s, s, l, s, l, s, l], iso(2170, 1, 19)), + PackedHijriYearInfo::new(1597, [s, l, l, s, l, s, l, s, l, s, l, s], iso(2171, 1, 8)), + PackedHijriYearInfo::new(1598, [l, s, l, s, l, l, s, l, s, l, l, s], iso(2171, 12, 28)), + PackedHijriYearInfo::new(1599, [s, l, s, l, s, l, s, l, l, l, s, l], iso(2172, 12, 17)), + PackedHijriYearInfo::new(1600, [s, s, l, s, l, s, s, l, l, l, s, l], iso(2173, 12, 7)), ] }; - -#[test] -fn test_icu4c_agreement() { - use calendrical_calculations::islamic::ISLAMIC_EPOCH_FRIDAY; - - // From https://github.com/unicode-org/icu/blob/1bf6bf774dbc8c6c2051963a81100ea1114b497f/icu4c/source/i18n/islamcal.cpp#L87 - const ICU4C_ENCODED_MONTH_LENGTHS: [u16; 1601 - 1300] = [ - 0x0AAA, 0x0D54, 0x0EC9, 0x06D4, 0x06EA, 0x036C, 0x0AAD, 0x0555, 0x06A9, 0x0792, 0x0BA9, - 0x05D4, 0x0ADA, 0x055C, 0x0D2D, 0x0695, 0x074A, 0x0B54, 0x0B6A, 0x05AD, 0x04AE, 0x0A4F, - 0x0517, 0x068B, 0x06A5, 0x0AD5, 0x02D6, 0x095B, 0x049D, 0x0A4D, 0x0D26, 0x0D95, 0x05AC, - 0x09B6, 0x02BA, 0x0A5B, 0x052B, 0x0A95, 0x06CA, 0x0AE9, 0x02F4, 0x0976, 0x02B6, 0x0956, - 0x0ACA, 0x0BA4, 0x0BD2, 0x05D9, 0x02DC, 0x096D, 0x054D, 0x0AA5, 0x0B52, 0x0BA5, 0x05B4, - 0x09B6, 0x0557, 0x0297, 0x054B, 0x06A3, 0x0752, 0x0B65, 0x056A, 0x0AAB, 0x052B, 0x0C95, - 0x0D4A, 0x0DA5, 0x05CA, 0x0AD6, 0x0957, 0x04AB, 0x094B, 0x0AA5, 0x0B52, 0x0B6A, 0x0575, - 0x0276, 0x08B7, 0x045B, 0x0555, 0x05A9, 0x05B4, 0x09DA, 0x04DD, 0x026E, 0x0936, 0x0AAA, - 0x0D54, 0x0DB2, 0x05D5, 0x02DA, 0x095B, 0x04AB, 0x0A55, 0x0B49, 0x0B64, 0x0B71, 0x05B4, - 0x0AB5, 0x0A55, 0x0D25, 0x0E92, 0x0EC9, 0x06D4, 0x0AE9, 0x096B, 0x04AB, 0x0A93, 0x0D49, - 0x0DA4, 0x0DB2, 0x0AB9, 0x04BA, 0x0A5B, 0x052B, 0x0A95, 0x0B2A, 0x0B55, 0x055C, 0x04BD, - 0x023D, 0x091D, 0x0A95, 0x0B4A, 0x0B5A, 0x056D, 0x02B6, 0x093B, 0x049B, 0x0655, 0x06A9, - 0x0754, 0x0B6A, 0x056C, 0x0AAD, 0x0555, 0x0B29, 0x0B92, 0x0BA9, 0x05D4, 0x0ADA, 0x055A, - 0x0AAB, 0x0595, 0x0749, 0x0764, 0x0BAA, 0x05B5, 0x02B6, 0x0A56, 0x0E4D, 0x0B25, 0x0B52, - 0x0B6A, 0x05AD, 0x02AE, 0x092F, 0x0497, 0x064B, 0x06A5, 0x06AC, 0x0AD6, 0x055D, 0x049D, - 0x0A4D, 0x0D16, 0x0D95, 0x05AA, 0x05B5, 0x02DA, 0x095B, 0x04AD, 0x0595, 0x06CA, 0x06E4, - 0x0AEA, 0x04F5, 0x02B6, 0x0956, 0x0AAA, 0x0B54, 0x0BD2, 0x05D9, 0x02EA, 0x096D, 0x04AD, - 0x0A95, 0x0B4A, 0x0BA5, 0x05B2, 0x09B5, 0x04D6, 0x0A97, 0x0547, 0x0693, 0x0749, 0x0B55, - 0x056A, 0x0A6B, 0x052B, 0x0A8B, 0x0D46, 0x0DA3, 0x05CA, 0x0AD6, 0x04DB, 0x026B, 0x094B, - 0x0AA5, 0x0B52, 0x0B69, 0x0575, 0x0176, 0x08B7, 0x025B, 0x052B, 0x0565, 0x05B4, 0x09DA, - 0x04ED, 0x016D, 0x08B6, 0x0AA6, 0x0D52, 0x0DA9, 0x05D4, 0x0ADA, 0x095B, 0x04AB, 0x0653, - 0x0729, 0x0762, 0x0BA9, 0x05B2, 0x0AB5, 0x0555, 0x0B25, 0x0D92, 0x0EC9, 0x06D2, 0x0AE9, - 0x056B, 0x04AB, 0x0A55, 0x0D29, 0x0D54, 0x0DAA, 0x09B5, 0x04BA, 0x0A3B, 0x049B, 0x0A4D, - 0x0AAA, 0x0AD5, 0x02DA, 0x095D, 0x045E, 0x0A2E, 0x0C9A, 0x0D55, 0x06B2, 0x06B9, 0x04BA, - 0x0A5D, 0x052D, 0x0A95, 0x0B52, 0x0BA8, 0x0BB4, 0x05B9, 0x02DA, 0x095A, 0x0B4A, 0x0DA4, - 0x0ED1, 0x06E8, 0x0B6A, 0x056D, 0x0535, 0x0695, 0x0D4A, 0x0DA8, 0x0DD4, 0x06DA, 0x055B, - 0x029D, 0x062B, 0x0B15, 0x0B4A, 0x0B95, 0x05AA, 0x0AAE, 0x092E, 0x0C8F, 0x0527, 0x0695, - 0x06AA, 0x0AD6, 0x055D, 0x029D, - ]; - - // From https://github.com/unicode-org/icu/blob/1bf6bf774dbc8c6c2051963a81100ea1114b497f/icu4c/source/i18n/islamcal.cpp#L264 - const ICU4C_YEAR_START_ESTIMATE_FIX: [i64; 1601 - 1300] = [ - 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 1, 1, 0, 0, -1, 0, 1, 0, 1, 1, 0, 0, -1, 0, 1, 0, - 0, 0, -1, 0, 1, 0, 1, 0, 0, 0, -1, 0, 0, 0, 0, -1, -1, 0, -1, 0, 1, 0, 0, 0, -1, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, -1, 0, 0, 0, 1, 0, 0, -1, -1, 0, -1, 0, 0, -1, -1, 0, -1, 0, - -1, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, 1, 1, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, 1, 0, - 1, 0, 0, 0, -1, 0, 1, 0, 0, -1, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, -1, 0, 0, 0, 1, 1, 0, 0, -1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 1, - 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, -1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, - 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 0, -1, -1, 0, -1, 0, 1, 0, 0, -1, -1, 0, 0, 1, - 1, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, - ]; - - let icu4c = ICU4C_ENCODED_MONTH_LENGTHS - .into_iter() - .zip(ICU4C_YEAR_START_ESTIMATE_FIX) - .enumerate() - .map( - |(years_since_1300, (encoded_months_lengths, year_start_estimate_fix))| { - // https://github.com/unicode-org/icu/blob/1bf6bf774dbc8c6c2051963a81100ea1114b497f/icu4c/source/i18n/islamcal.cpp#L858 - let month_lengths = - core::array::from_fn(|i| (1 << (11 - i)) & encoded_months_lengths != 0); - // From https://github.com/unicode-org/icu/blob/1bf6bf774dbc8c6c2051963a81100ea1114b497f/icu4c/source/i18n/islamcal.cpp#L813 - let year_start = ((354.36720 * years_since_1300 as f64) + 460322.05 + 0.5) as i64 - + year_start_estimate_fix; - ( - 1300 + years_since_1300 as i32, - PackedHijriYearData::try_new( - 1300 + years_since_1300 as i32, - month_lengths, - ISLAMIC_EPOCH_FRIDAY + year_start, - ) - .unwrap(), - ) - }, - ) - .collect::>(); - - let icu4x = (1300..=1600).zip(DATA.iter().copied()).collect::>(); - - assert_eq!(icu4x, icu4c); -} diff --git a/deps/crates/vendor/icu_calendar/src/cal/indian.rs b/deps/crates/vendor/icu_calendar/src/cal/indian.rs index 0b021d41970d93..608e85e2ead8c2 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/indian.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/indian.rs @@ -2,46 +2,40 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::calendar_arithmetic::ArithmeticDate; -use crate::calendar_arithmetic::DateFieldsResolver; -use crate::error::{DateError, DateFromFieldsError, EcmaReferenceYearError, UnknownEraError}; -use crate::options::DateFromFieldsOptions; -use crate::options::{DateAddOptions, DateDifferenceOptions}; -use crate::types::DateFields; -use crate::{types, Calendar, Date, RangeError}; +//! This module contains types and implementations for the Indian national calendar. +//! +//! ```rust +//! use icu::calendar::{cal::Indian, Date}; +//! +//! let date_iso = Date::try_new_iso(1970, 1, 2) +//! .expect("Failed to initialize ISO Date instance."); +//! let date_indian = Date::new_from_iso(date_iso, Indian); +//! +//! assert_eq!(date_indian.era_year().year, 1891); +//! assert_eq!(date_indian.month().ordinal, 10); +//! assert_eq!(date_indian.day_of_month().0, 12); +//! ``` + +use crate::cal::iso::{Iso, IsoDateInner}; +use crate::calendar_arithmetic::{ArithmeticDate, CalendarArithmetic}; +use crate::error::DateError; +use crate::{types, Calendar, Date, DateDuration, DateDurationUnit, RangeError}; use calendrical_calculations::rata_die::RataDie; use tinystr::tinystr; /// The [Indian National (Śaka) Calendar](https://en.wikipedia.org/wiki/Indian_national_calendar) /// -/// The Indian National calendar is a solar calendar created by the Indian government. +/// The Indian National calendar is a solar calendar used by the Indian government, with twelve months. /// -/// This implementation extends proleptically for dates before the calendar's creation -/// in 1879 Śaka (1957 CE). -/// -/// This corresponds to the `"indian"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). +/// This type can be used with [`Date`] to represent dates in this calendar. /// /// # Era codes /// /// This calendar uses a single era code: `shaka`, with Śaka 0 being 78 CE. Dates before this era use negative years. /// -/// # Months and days -/// -/// The 12 months are called Chaitra (`M01`, 30 days), Vaisakha (`M02`, 31 days), -/// Jyaishtha (`M03`, 31 days), Ashadha (`M04`, 31 days), Sravana (`M05`, 31 days), -/// Bhadra (`M06`, 31 days), Asvina (`M07`, 30 days), Kartika (`M08`, 30 days), -/// Agrahayana or Margasirsha (`M09`, 30 days), Pausha (`M10`, 30 days), Magha (`M11`, 30 days), -/// Phalguna (`M12`, 30 days). -/// -/// In leap years (years where the concurrent [`Gregorian`](crate::cal::Gregorian) year (`year + 78`) is leap), -/// Chaitra gains a 31st day. -/// -/// Standard years thus have 365 days, and leap years 366. +/// # Month codes /// -/// # Calendar drift -/// -/// The Indian calendar has the same year lengths and leap year rules as the Gregorian calendar, -/// so it experiences the same drift of 1 day in ~7700 years with respect to the seasons. +/// This calendar supports 12 solar month codes (`"M01" - "M12"`) #[derive(Copy, Clone, Debug, Hash, Default, Eq, PartialEq, PartialOrd, Ord)] #[allow(clippy::exhaustive_structs)] // this type is stable pub struct Indian; @@ -50,18 +44,16 @@ pub struct Indian; #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] pub struct IndianDateInner(ArithmeticDate); -/// The Śaka era starts on the 81st day of the Gregorian year (March 22 or 21) -/// which is an 80 day offset. This number should be subtracted from Gregorian dates -const DAY_OFFSET: u16 = 80; -/// The Śaka era is 78 years behind Gregorian. This number should be added to Gregorian dates -const YEAR_OFFSET: i32 = 78; - -impl DateFieldsResolver for Indian { +impl CalendarArithmetic for Indian { type YearInfo = i32; fn days_in_provided_month(year: i32, month: u8) -> u8 { if month == 1 { - 30 + calendrical_calculations::gregorian::is_leap_year(year + YEAR_OFFSET) as u8 + if Self::provided_year_is_leap(year) { + 31 + } else { + 30 + } } else if (2..=6).contains(&month) { 31 } else if (7..=12).contains(&month) { @@ -75,49 +67,33 @@ impl DateFieldsResolver for Indian { 12 } - #[inline] - fn year_info_from_era( - &self, - era: &[u8], - era_year: i32, - ) -> Result { - match era { - b"shaka" => Ok(era_year), - _ => Err(UnknownEraError), - } + fn provided_year_is_leap(year: i32) -> bool { + Iso::provided_year_is_leap(year + 78) } - #[inline] - fn year_info_from_extended(&self, extended_year: i32) -> Self::YearInfo { - extended_year + fn last_month_day_in_provided_year(_year: i32) -> (u8, u8) { + (12, 30) } - #[inline] - fn reference_year_from_month_day( - &self, - month_code: types::ValidMonthCode, - day: u8, - ) -> Result { - let (ordinal_month, false) = month_code.to_tuple() else { - return Err(EcmaReferenceYearError::MonthCodeNotInCalendar); - }; - // December 31, 1972 occurs on 10th month, 10th day, 1894 Shaka - // Note: 1894 Shaka is also a leap year - let shaka_year = if ordinal_month < 10 || (ordinal_month == 10 && day <= 10) { - 1894 + fn days_in_provided_year(year: i32) -> u16 { + if Self::provided_year_is_leap(year) { + 366 } else { - 1893 - }; - Ok(shaka_year) + 365 + } } } +/// The Śaka era starts on the 81st day of the Gregorian year (March 22 or 21) +/// which is an 80 day offset. This number should be subtracted from Gregorian dates +const DAY_OFFSET: u16 = 80; +/// The Śaka era is 78 years behind Gregorian. This number should be added to Gregorian dates +const YEAR_OFFSET: i32 = 78; + impl crate::cal::scaffold::UnstableSealed for Indian {} impl Calendar for Indian { type DateInner = IndianDateInner; type Year = types::EraYear; - type DifferenceError = core::convert::Infallible; - fn from_codes( &self, era: Option<&str>, @@ -125,147 +101,115 @@ impl Calendar for Indian { month_code: types::MonthCode, day: u8, ) -> Result { - ArithmeticDate::from_codes(era, year, month_code, day, self).map(IndianDateInner) + let year = match era { + Some("shaka") | None => year, + Some(_) => return Err(DateError::UnknownEra), + }; + ArithmeticDate::new_from_codes(self, year, month_code, day).map(IndianDateInner) } - #[cfg(feature = "unstable")] - fn from_fields( - &self, - fields: DateFields, - options: DateFromFieldsOptions, - ) -> Result { - ArithmeticDate::from_fields(fields, options, self).map(IndianDateInner) + fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { + self.from_iso(Iso.from_rata_die(rd)) + } + + fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { + Iso.to_rata_die(&self.to_iso(date)) } // Algorithms directly implemented in icu_calendar since they're not from the book - fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { - let iso_year = calendrical_calculations::gregorian::year_from_fixed(rd) - .unwrap_or_else(|e| e.saturate()); + fn from_iso(&self, iso: IsoDateInner) -> IndianDateInner { // Get day number in year (1 indexed) - let day_of_year_iso = - (rd - calendrical_calculations::gregorian::day_before_year(iso_year)) as u16; + let day_of_year_iso = Iso::day_of_year(iso); // Convert to Śaka year - let mut year = iso_year - YEAR_OFFSET; + let mut year = iso.0.year - YEAR_OFFSET; // This is in the previous Indian year let day_of_year_indian = if day_of_year_iso <= DAY_OFFSET { year -= 1; - let n_days = if calendrical_calculations::gregorian::is_leap_year(year + YEAR_OFFSET) { - 366 - } else { - 365 - }; + let n_days = Self::days_in_provided_year(year); // calculate day of year in previous year n_days + day_of_year_iso - DAY_OFFSET } else { day_of_year_iso - DAY_OFFSET }; - let mut month = 1; - let mut day = day_of_year_indian as i32; - while month <= 12 { - let month_days = Self::days_in_provided_month(year, month) as i32; - if day <= month_days { - break; - } else { - day -= month_days; - month += 1; - } - } - - debug_assert!(day <= Self::days_in_provided_month(year, month) as i32); - let day = day.try_into().unwrap_or(1); - - IndianDateInner(ArithmeticDate::new_unchecked(year, month, day)) + IndianDateInner(ArithmeticDate::date_from_year_day( + year, + day_of_year_indian as u32, + )) } // Algorithms directly implemented in icu_calendar since they're not from the book - fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { - let day_of_year_indian = self.day_of_year(date).0; // 1-indexed - let days_in_year = self.days_in_year(date); + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + let day_of_year_indian = date.0.day_of_year().0; // 1-indexed + let days_in_year = date.0.days_in_year(); - let mut year_iso = date.0.year + YEAR_OFFSET; + let mut year = date.0.year + YEAR_OFFSET; // days_in_year is a valid day of the year, so we check > not >= let day_of_year_iso = if day_of_year_indian + DAY_OFFSET > days_in_year { - year_iso += 1; + year += 1; // calculate day of year in next year day_of_year_indian + DAY_OFFSET - days_in_year } else { day_of_year_indian + DAY_OFFSET }; - - calendrical_calculations::gregorian::day_before_year(year_iso) + day_of_year_iso as i64 - } - - fn has_cheap_iso_conversion(&self) -> bool { - false + Iso::iso_from_year_day(year, day_of_year_iso) } fn months_in_year(&self, date: &Self::DateInner) -> u8 { - Self::months_in_provided_year(date.0.year) + date.0.months_in_year() } fn days_in_year(&self, date: &Self::DateInner) -> u16 { - if self.is_in_leap_year(date) { - 366 - } else { - 365 - } + date.0.days_in_year() } fn days_in_month(&self, date: &Self::DateInner) -> u8 { - Self::days_in_provided_month(date.0.year, date.0.month) + date.0.days_in_month() } - #[cfg(feature = "unstable")] - fn add( - &self, - date: &Self::DateInner, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result { - date.0.added(duration, self, options).map(IndianDateInner) + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + date.0.offset_date(offset, &()); } - #[cfg(feature = "unstable")] + #[allow(clippy::field_reassign_with_default)] fn until( &self, date1: &Self::DateInner, date2: &Self::DateInner, - options: DateDifferenceOptions, - ) -> Result { - Ok(date1.0.until(&date2.0, self, options)) + _calendar2: &Self, + _largest_unit: DateDurationUnit, + _smallest_unit: DateDurationUnit, + ) -> DateDuration { + date1.0.until(date2.0, _largest_unit, _smallest_unit) } fn year_info(&self, date: &Self::DateInner) -> Self::Year { - let extended_year = date.0.year; types::EraYear { era_index: Some(0), era: tinystr!(16, "shaka"), - year: extended_year, - extended_year, + year: self.extended_year(date), ambiguity: types::YearAmbiguity::CenturyRequired, } } + fn extended_year(&self, date: &Self::DateInner) -> i32 { + date.0.extended_year() + } + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { - calendrical_calculations::gregorian::is_leap_year(date.0.year + YEAR_OFFSET) + Self::provided_year_is_leap(date.0.year) } fn month(&self, date: &Self::DateInner) -> types::MonthInfo { - types::MonthInfo::non_lunisolar(date.0.month) + date.0.month() } fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { - types::DayOfMonth(date.0.day) + date.0.day_of_month() } fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { - types::DayOfYear( - (1..date.0.month) - .map(|m| Self::days_in_provided_month(date.0.year, m) as u16) - .sum::() - + date.0.day as u16, - ) + date.0.day_of_year() } fn debug_name(&self) -> &'static str { @@ -298,7 +242,7 @@ impl Date { /// assert_eq!(date_indian.day_of_month().0, 12); /// ``` pub fn try_new_indian(year: i32, month: u8, day: u8) -> Result, RangeError> { - ArithmeticDate::try_from_ymd(year, month, day) + ArithmeticDate::new_from_ordinals(year, month, day) .map(IndianDateInner) .map(|inner| Date::from_raw(inner, Indian)) } @@ -506,7 +450,10 @@ mod tests { fn test_roundtrip_near_rd_zero() { for i in -1000..=1000 { let initial = RataDie::new(i); - let result = Date::from_rata_die(initial, Indian).to_rata_die(); + let result = Date::from_rata_die(initial, Iso) + .to_calendar(Indian) + .to_iso() + .to_rata_die(); assert_eq!( initial, result, "Roundtrip failed for initial: {initial:?}, result: {result:?}" @@ -519,7 +466,10 @@ mod tests { // Epoch start: RD 28570 for i in 27570..=29570 { let initial = RataDie::new(i); - let result = Date::from_rata_die(initial, Indian).to_rata_die(); + let result = Date::from_rata_die(initial, Iso) + .to_calendar(Indian) + .to_iso() + .to_rata_die(); assert_eq!( initial, result, "Roundtrip failed for initial: {initial:?}, result: {result:?}" diff --git a/deps/crates/vendor/icu_calendar/src/cal/iso.rs b/deps/crates/vendor/icu_calendar/src/cal/iso.rs index ebb361817d70a6..989485dc7a1733 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/iso.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/iso.rs @@ -2,56 +2,186 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::cal::abstract_gregorian::{impl_with_abstract_gregorian, GregorianYears}; -use crate::calendar_arithmetic::ArithmeticDate; -use crate::error::UnknownEraError; -use crate::{types, Date, DateError, RangeError}; +//! This module contains types and implementations for the ISO calendar. +//! +//! ```rust +//! use icu::calendar::Date; +//! +//! let date_iso = Date::try_new_iso(1970, 1, 2) +//! .expect("Failed to initialize ISO Date instance."); +//! +//! assert_eq!(date_iso.era_year().year, 1970); +//! assert_eq!(date_iso.month().ordinal, 1); +//! assert_eq!(date_iso.day_of_month().0, 2); +//! ``` + +use crate::calendar_arithmetic::{ArithmeticDate, CalendarArithmetic}; +use crate::error::DateError; +use crate::{types, Calendar, Date, DateDuration, DateDurationUnit, RangeError}; +use calendrical_calculations::helpers::I32CastError; +use calendrical_calculations::rata_die::RataDie; use tinystr::tinystr; /// The [ISO-8601 Calendar](https://en.wikipedia.org/wiki/ISO_8601#Dates) /// -/// This calendar is identical to the [`Gregorian`](super::Gregorian) calendar, -/// except that it uses a single `default` era instead of `bce` and `ce`. +/// The ISO-8601 Calendar is a standardized solar calendar with twelve months. +/// It is identical to the [`Gregorian`](super::Gregorian) calendar, except it uses +/// negative years for years before 1 CE, and may have differing formatting data for a given locale. /// -/// This corresponds to the `"iso8601"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). +/// This type can be used with [`Date`] to represent dates in this calendar. /// /// # Era codes /// /// This calendar uses a single era: `default` + #[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] #[allow(clippy::exhaustive_structs)] // this type is stable pub struct Iso; -impl_with_abstract_gregorian!(crate::cal::Iso, IsoDateInner, IsoEra, _x, IsoEra); +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +/// The inner date type used for representing [`Date`]s of [`Iso`]. See [`Date`] and [`Iso`] for more details. +pub struct IsoDateInner(pub(crate) ArithmeticDate); -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub(crate) struct IsoEra; +impl CalendarArithmetic for Iso { + type YearInfo = i32; + + fn days_in_provided_month(year: i32, month: u8) -> u8 { + match month { + 4 | 6 | 9 | 11 => 30, + 2 if Self::provided_year_is_leap(year) => 29, + 2 => 28, + 1 | 3 | 5 | 7 | 8 | 10 | 12 => 31, + _ => 0, + } + } + + fn months_in_provided_year(_: i32) -> u8 { + 12 + } + + fn provided_year_is_leap(year: i32) -> bool { + calendrical_calculations::iso::is_leap_year(year) + } + + fn last_month_day_in_provided_year(_year: i32) -> (u8, u8) { + (12, 31) + } + + fn days_in_provided_year(year: i32) -> u16 { + if Self::provided_year_is_leap(year) { + 366 + } else { + 365 + } + } +} -impl GregorianYears for IsoEra { - fn extended_from_era_year( +impl crate::cal::scaffold::UnstableSealed for Iso {} +impl Calendar for Iso { + type DateInner = IsoDateInner; + type Year = types::EraYear; + /// Construct a date from era/month codes and fields + fn from_codes( &self, - era: Option<&[u8]>, + era: Option<&str>, year: i32, - ) -> Result { - match era { - Some(b"default") | None => Ok(year), - Some(_) => Err(UnknownEraError), - } + month_code: types::MonthCode, + day: u8, + ) -> Result { + let year = match era { + Some("default") | None => year, + Some(_) => return Err(DateError::UnknownEra), + }; + + ArithmeticDate::new_from_codes(self, year, month_code, day).map(IsoDateInner) + } + + fn from_rata_die(&self, date: RataDie) -> IsoDateInner { + IsoDateInner(match calendrical_calculations::iso::iso_from_fixed(date) { + Err(I32CastError::BelowMin) => ArithmeticDate::min_date(), + Err(I32CastError::AboveMax) => ArithmeticDate::max_date(), + Ok((year, month, day)) => ArithmeticDate::new_unchecked(year, month, day), + }) + } + + fn to_rata_die(&self, date: &IsoDateInner) -> RataDie { + calendrical_calculations::iso::fixed_from_iso(date.0.year, date.0.month, date.0.day) + } + + fn from_iso(&self, iso: IsoDateInner) -> IsoDateInner { + iso + } + + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + *date + } + + fn months_in_year(&self, date: &Self::DateInner) -> u8 { + date.0.months_in_year() + } + + fn days_in_year(&self, date: &Self::DateInner) -> u16 { + date.0.days_in_year() + } + + fn days_in_month(&self, date: &Self::DateInner) -> u8 { + date.0.days_in_month() } - fn era_year_from_extended(&self, extended_year: i32, _month: u8, _day: u8) -> types::EraYear { + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + date.0.offset_date(offset, &()); + } + + #[allow(clippy::field_reassign_with_default)] + fn until( + &self, + date1: &Self::DateInner, + date2: &Self::DateInner, + _calendar2: &Self, + _largest_unit: DateDurationUnit, + _smallest_unit: DateDurationUnit, + ) -> DateDuration { + date1.0.until(date2.0, _largest_unit, _smallest_unit) + } + + fn year_info(&self, date: &Self::DateInner) -> Self::Year { types::EraYear { era_index: Some(0), era: tinystr!(16, "default"), - year: extended_year, - extended_year, + year: self.extended_year(date), ambiguity: types::YearAmbiguity::Unambiguous, } } + fn extended_year(&self, date: &Self::DateInner) -> i32 { + date.0.extended_year() + } + + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { + Self::provided_year_is_leap(date.0.year) + } + + /// The calendar-specific month represented by `date` + fn month(&self, date: &Self::DateInner) -> types::MonthInfo { + date.0.month() + } + + /// The calendar-specific day-of-month represented by `date` + fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { + date.0.day_of_month() + } + + fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { + date.0.day_of_year() + } + fn debug_name(&self) -> &'static str { "ISO" } + + fn calendar_algorithm(&self) -> Option { + None + } } impl Date { @@ -68,9 +198,9 @@ impl Date { /// assert_eq!(date_iso.day_of_month().0, 2); /// ``` pub fn try_new_iso(year: i32, month: u8, day: u8) -> Result, RangeError> { - ArithmeticDate::new_gregorian::(year, month, day) + ArithmeticDate::new_from_ordinals(year, month, day) .map(IsoDateInner) - .map(|i| Date::from_raw(i, Iso)) + .map(|inner| Date::from_raw(inner, Iso)) } } @@ -79,13 +209,46 @@ impl Iso { pub fn new() -> Self { Self } + + pub(crate) fn iso_from_year_day(year: i32, year_day: u16) -> IsoDateInner { + let mut month = 1; + let mut day = year_day as i32; + while month <= 12 { + let month_days = Self::days_in_provided_month(year, month) as i32; + if day <= month_days { + break; + } else { + debug_assert!(month < 12); // don't try going to month 13 + day -= month_days; + month += 1; + } + } + let day = day as u8; // day <= month_days < u8::MAX + + // month in 1..=12, day <= month_days + IsoDateInner(ArithmeticDate::new_unchecked(year, month, day)) + } + + pub(crate) fn day_of_year(date: IsoDateInner) -> u16 { + // Cumulatively how much are dates in each month + // offset from "30 days in each month" (in non leap years) + let month_offset = [0, 1, -1, 0, 0, 1, 1, 2, 3, 3, 4, 4]; + #[allow(clippy::indexing_slicing)] // date.0.month in 1..=12 + let mut offset = month_offset[date.0.month as usize - 1]; + if Self::provided_year_is_leap(date.0.year) && date.0.month > 2 { + // Months after February in a leap year are offset by one less + offset += 1; + } + let prev_month_days = (30 * (date.0.month as i32 - 1) + offset) as u16; + + prev_month_days + date.0.day as u16 + } } #[cfg(test)] mod test { use super::*; - use crate::types::{DateDuration, RataDie, Weekday}; - use crate::Calendar; + use crate::types::Weekday; #[test] fn iso_overflow() { @@ -272,20 +435,31 @@ mod test { assert_eq!(Date::try_new_iso(1983, 2, 2).unwrap().day_of_year().0, 33,); } + fn simple_subtract(a: &Date, b: &Date) -> DateDuration { + let a = a.inner(); + let b = b.inner(); + DateDuration::new( + a.0.year - b.0.year, + a.0.month as i32 - b.0.month as i32, + 0, + a.0.day as i32 - b.0.day as i32, + ) + } + #[test] fn test_offset() { let today = Date::try_new_iso(2021, 6, 23).unwrap(); let today_plus_5000 = Date::try_new_iso(2035, 3, 2).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_days(5000), Default::default()) - .unwrap(); + let offset = today.added(DateDuration::new(0, 0, 0, 5000)); + assert_eq!(offset, today_plus_5000); + let offset = today.added(simple_subtract(&today_plus_5000, &today)); assert_eq!(offset, today_plus_5000); let today = Date::try_new_iso(2021, 6, 23).unwrap(); let today_minus_5000 = Date::try_new_iso(2007, 10, 15).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_days(-5000), Default::default()) - .unwrap(); + let offset = today.added(DateDuration::new(0, 0, 0, -5000)); + assert_eq!(offset, today_minus_5000); + let offset = today.added(simple_subtract(&today_minus_5000, &today)); assert_eq!(offset, today_minus_5000); } @@ -293,44 +467,32 @@ mod test { fn test_offset_at_month_boundary() { let today = Date::try_new_iso(2020, 2, 28).unwrap(); let today_plus_2 = Date::try_new_iso(2020, 3, 1).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_days(2), Default::default()) - .unwrap(); + let offset = today.added(DateDuration::new(0, 0, 0, 2)); assert_eq!(offset, today_plus_2); let today = Date::try_new_iso(2020, 2, 28).unwrap(); let today_plus_3 = Date::try_new_iso(2020, 3, 2).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_days(3), Default::default()) - .unwrap(); + let offset = today.added(DateDuration::new(0, 0, 0, 3)); assert_eq!(offset, today_plus_3); let today = Date::try_new_iso(2020, 2, 28).unwrap(); let today_plus_1 = Date::try_new_iso(2020, 2, 29).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_days(1), Default::default()) - .unwrap(); + let offset = today.added(DateDuration::new(0, 0, 0, 1)); assert_eq!(offset, today_plus_1); let today = Date::try_new_iso(2019, 2, 28).unwrap(); let today_plus_2 = Date::try_new_iso(2019, 3, 2).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_days(2), Default::default()) - .unwrap(); + let offset = today.added(DateDuration::new(0, 0, 0, 2)); assert_eq!(offset, today_plus_2); let today = Date::try_new_iso(2019, 2, 28).unwrap(); let today_plus_1 = Date::try_new_iso(2019, 3, 1).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_days(1), Default::default()) - .unwrap(); + let offset = today.added(DateDuration::new(0, 0, 0, 1)); assert_eq!(offset, today_plus_1); let today = Date::try_new_iso(2020, 3, 1).unwrap(); let today_minus_1 = Date::try_new_iso(2020, 2, 29).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_days(-1), Default::default()) - .unwrap(); + let offset = today.added(DateDuration::new(0, 0, 0, -1)); assert_eq!(offset, today_minus_1); } @@ -338,57 +500,37 @@ mod test { fn test_offset_handles_negative_month_offset() { let today = Date::try_new_iso(2020, 3, 1).unwrap(); let today_minus_2_months = Date::try_new_iso(2020, 1, 1).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_months(-2), Default::default()) - .unwrap(); + let offset = today.added(DateDuration::new(0, -2, 0, 0)); assert_eq!(offset, today_minus_2_months); let today = Date::try_new_iso(2020, 3, 1).unwrap(); let today_minus_4_months = Date::try_new_iso(2019, 11, 1).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_months(-4), Default::default()) - .unwrap(); + let offset = today.added(DateDuration::new(0, -4, 0, 0)); assert_eq!(offset, today_minus_4_months); let today = Date::try_new_iso(2020, 3, 1).unwrap(); let today_minus_24_months = Date::try_new_iso(2018, 3, 1).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_months(-24), Default::default()) - .unwrap(); + let offset = today.added(DateDuration::new(0, -24, 0, 0)); assert_eq!(offset, today_minus_24_months); let today = Date::try_new_iso(2020, 3, 1).unwrap(); let today_minus_27_months = Date::try_new_iso(2017, 12, 1).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_months(-27), Default::default()) - .unwrap(); + let offset = today.added(DateDuration::new(0, -27, 0, 0)); assert_eq!(offset, today_minus_27_months); } #[test] fn test_offset_handles_out_of_bound_month_offset() { let today = Date::try_new_iso(2021, 1, 31).unwrap(); - // since 2021/02/31 isn't a valid date, `offset_date` auto-adjusts by constraining to the last day in February - let today_plus_1_month = Date::try_new_iso(2021, 2, 28).unwrap(); - let offset = today - .try_added_with_options(DateDuration::for_months(1), Default::default()) - .unwrap(); + // since 2021/02/31 isn't a valid date, `offset_date` auto-adjusts by adding 3 days to 2021/02/28 + let today_plus_1_month = Date::try_new_iso(2021, 3, 3).unwrap(); + let offset = today.added(DateDuration::new(0, 1, 0, 0)); assert_eq!(offset, today_plus_1_month); let today = Date::try_new_iso(2021, 1, 31).unwrap(); - // since 2021/02/31 isn't a valid date, `offset_date` auto-adjusts by constraining to the last day in February - // and then adding the days - let today_plus_1_month_1_day = Date::try_new_iso(2021, 3, 1).unwrap(); - let offset = today - .try_added_with_options( - DateDuration { - months: 1, - days: 1, - ..Default::default() - }, - Default::default(), - ) - .unwrap(); + // since 2021/02/31 isn't a valid date, `offset_date` auto-adjusts by adding 3 days to 2021/02/28 + let today_plus_1_month_1_day = Date::try_new_iso(2021, 3, 4).unwrap(); + let offset = today.added(DateDuration::new(0, 1, 0, 1)); assert_eq!(offset, today_plus_1_month_1_day); } diff --git a/deps/crates/vendor/icu_calendar/src/cal/japanese.rs b/deps/crates/vendor/icu_calendar/src/cal/japanese.rs index 37ad427b9dd334..d52874b265413d 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/japanese.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/japanese.rs @@ -2,41 +2,59 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::cal::abstract_gregorian::{impl_with_abstract_gregorian, GregorianYears}; -use crate::cal::gregorian::CeBce; -use crate::calendar_arithmetic::ArithmeticDate; -use crate::error::{DateError, UnknownEraError}; +//! This module contains types and implementations for the Japanese calendar. +//! +//! ```rust +//! use icu::calendar::cal::Japanese; +//! use icu::calendar::Date; +//! use tinystr::tinystr; +//! +//! let japanese_calendar = Japanese::new(); +//! +//! let date_iso = Date::try_new_iso(1970, 1, 2) +//! .expect("Failed to initialize ISO Date instance."); +//! let date_japanese = Date::new_from_iso(date_iso, japanese_calendar); +//! +//! assert_eq!(date_japanese.era_year().year, 45); +//! assert_eq!(date_japanese.month().ordinal, 1); +//! assert_eq!(date_japanese.day_of_month().0, 2); +//! assert_eq!(date_japanese.era_year().era, "showa"); +//! ``` + +use crate::cal::iso::{Iso, IsoDateInner}; +use crate::error::{year_check, DateError}; use crate::provider::{CalendarJapaneseExtendedV1, CalendarJapaneseModernV1, EraStartDate}; -use crate::{types, AsCalendar, Date}; +use crate::{types, AsCalendar, Calendar, Date, DateDuration, DateDurationUnit, Ref}; +use calendrical_calculations::rata_die::RataDie; use icu_provider::prelude::*; -use tinystr::tinystr; +use tinystr::{tinystr, TinyStr16}; /// The [Japanese Calendar] (with modern eras only) /// -/// The [Japanese Calendar] is a variant of the [`Gregorian`](crate::cal::Gregorian) calendar -/// created by the Japanese government. It is identical to the Gregorian calendar except that -/// is uses Japanese eras instead of the Common Era. +/// The [Japanese calendar] is a solar calendar used in Japan, with twelve months. +/// The months and days are identical to that of the Gregorian calendar, however the years are counted +/// differently using the Japanese era system. /// -/// This implementation extends proleptically for dates before the calendar's creation -/// in 6 Meiji (1873 CE). -/// The Meiji era is used proleptically back to and including 1868-10-23, Gregorian eras are used before that. +/// This calendar only contains eras after Meiji, for all historical eras, check out [`JapaneseExtended`]. /// -/// For a variant that uses approximations of historical Japanese eras proleptically, check out [`JapaneseExtended`]. -/// -/// This corresponds to the `"japanese"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). +/// This type can be used with [`Date`] to represent dates in this calendar. /// /// [Japanese calendar]: https://en.wikipedia.org/wiki/Japanese_calendar /// /// # Era codes /// -/// This calendar currently supports seven era codes. It supports the five eras since its -/// introduction (`meiji`, `taisho`, `showa`, `heisei`, `reiwa`), as well as the Gregorian -/// `bce` (alias `bc`), and `ce` (alias `ad`) for earlier dates. +/// This calendar currently supports seven era codes. It supports the five post-Meiji eras +/// (`meiji`, `taisho`, `showa`, `heisei`, `reiwa`), as well as using the Gregorian +/// `bce` (alias `bc`), and `ce` (alias `ad`) for dates before the Meiji era. /// /// Future eras will also be added to this type when they are decided. /// /// These eras are loaded from data, requiring a data provider capable of providing [`CalendarJapaneseModernV1`] /// data. +/// +/// # Month codes +/// +/// This calendar supports 12 solar month codes (`M01` - `M12`) #[derive(Clone, Debug, Default)] pub struct Japanese { eras: DataPayload, @@ -44,35 +62,40 @@ pub struct Japanese { /// The [Japanese Calendar] (with historical eras) /// -/// The [Japanese Calendar] is a variant of the [`Gregorian`](crate::cal::Gregorian) calendar -/// created by the Japanese government. It is identical to the Gregorian calendar except that -/// is uses Japanese eras instead of the Common Era. -/// -/// This implementation extends proleptically for dates before the calendar's creation -/// in 6 Meiji (1873 CE). -/// This implementation uses approximations of earlier Japanese eras proleptically and uses the Gregorian eras for -/// even earlier dates that don't have an approximate Japanese era. -/// -/// For a variant whose Japanese eras start with Meiji, check out [`Japanese`]. +/// The [Japanese calendar] is a solar calendar used in Japan, with twelve months. +/// The months and days are identical to that of the Gregorian calendar, however the years are counted +/// differently using the Japanese era system. /// -/// This corresponds to the `"japanext"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). +/// This type can be used with [`Date`] to represent dates in this calendar. /// /// [Japanese calendar]: https://en.wikipedia.org/wiki/Japanese_calendar /// /// # Era codes /// -/// This calendar supports a large number of era codes. It supports the five eras since its introduction -/// (`meiji`, `taisho`, `showa`, `heisei`, `reiwa`). Proleptic eras are represented -/// with their names converted to lowercase ASCII and followed by their start year. E.g. the *Ten'ō* +/// This calendar supports a large number of era codes. It supports the five post-Meiji eras +/// (`meiji`, `taisho`, `showa`, `heisei`, `reiwa`). Pre-Meiji eras are represented +/// with their names converted to lowercase ascii and followed by their start year. E.g. the *Ten'ō* /// era (781 - 782 CE) has the code `teno-781`. The Gregorian `bce` (alias `bc`), and `ce` (alias `ad`) /// are used for dates before the first known era era. /// /// /// These eras are loaded from data, requiring a data provider capable of providing [`CalendarJapaneseExtendedV1`] /// data. +/// +/// # Month codes +/// +/// This calendar supports 12 solar month codes (`M01` - `M12`) #[derive(Clone, Debug, Default)] pub struct JapaneseExtended(Japanese); +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +/// The inner date type used for representing [`Date`]s of [`Japanese`]. See [`Date`] and [`Japanese`] for more details. +pub struct JapaneseDateInner { + inner: IsoDateInner, + adjusted_year: i32, + era: TinyStr16, +} + impl Japanese { /// Creates a new [`Japanese`] using only modern eras (post-meiji) from compiled data. /// @@ -104,6 +127,8 @@ impl Japanese { eras: provider.load(Default::default())?.payload, }) } + + pub(crate) const DEBUG_NAME: &'static str = "Japanese"; } impl JapaneseExtended { @@ -137,165 +162,232 @@ impl JapaneseExtended { eras: provider.load(Default::default())?.payload.cast(), })) } + + pub(crate) const DEBUG_NAME: &'static str = "Japanese (historical era data)"; } -const MEIJI_START: EraStartDate = EraStartDate { - year: 1868, - month: 10, - day: 23, -}; -const TAISHO_START: EraStartDate = EraStartDate { - year: 1912, - month: 7, - day: 30, -}; -const SHOWA_START: EraStartDate = EraStartDate { - year: 1926, - month: 12, - day: 25, -}; -const HEISEI_START: EraStartDate = EraStartDate { - year: 1989, - month: 1, - day: 8, -}; -const REIWA_START: EraStartDate = EraStartDate { - year: 2019, - month: 5, - day: 1, -}; +impl crate::cal::scaffold::UnstableSealed for Japanese {} +impl Calendar for Japanese { + type DateInner = JapaneseDateInner; + type Year = types::EraYear; -impl GregorianYears for &'_ Japanese { - fn extended_from_era_year( + fn from_codes( &self, - era: Option<&[u8]>, + era: Option<&str>, year: i32, - ) -> Result { - if let Ok(g) = CeBce.extended_from_era_year(era, year) { - return Ok(g); - } - let Some(era) = era else { - // unreachable, handled by CeBce - return Err(UnknownEraError); + month_code: types::MonthCode, + day: u8, + ) -> Result { + let Some((month, false)) = month_code.parsed() else { + return Err(DateError::UnknownMonthCode(month_code)); }; - // Avoid linear search by trying well known eras - if era == b"reiwa" { - return Ok(year - 1 + REIWA_START.year); - } else if era == b"heisei" { - return Ok(year - 1 + HEISEI_START.year); - } else if era == b"showa" { - return Ok(year - 1 + SHOWA_START.year); - } else if era == b"taisho" { - return Ok(year - 1 + TAISHO_START.year); - } else if era == b"meiji" { - return Ok(year - 1 + MEIJI_START.year); + if month > 12 { + return Err(DateError::UnknownMonthCode(month_code)); } - let data = &self.eras.get().dates_to_eras; + self.new_japanese_date_inner(era.unwrap_or("ce"), year, month, day) + } - // Try to avoid linear search by binary searching for the year suffix - if let Some(start_year) = era - .split(|x| *x == b'-') - .nth(1) - .and_then(|y| core::str::from_utf8(y).ok()?.parse::().ok()) - { - if let Ok(index) = data.binary_search_by(|(d, _)| d.year.cmp(&start_year)) { - // There is a slight chance we hit the case where there are two eras in the same year - // There are a couple of rare cases of this, but it's not worth writing a range-based binary search - // to catch them since this is an optimization - #[expect(clippy::unwrap_used)] // binary search - if data.get(index).unwrap().1.as_bytes() == era { - return Ok(start_year + year - 1); - } - } + fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { + self.from_iso(Iso.from_rata_die(rd)) + } + + fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { + Iso.to_rata_die(&self.to_iso(date)) + } + + fn from_iso(&self, iso: IsoDateInner) -> JapaneseDateInner { + let (adjusted_year, era) = self.adjusted_year_for(iso); + JapaneseDateInner { + inner: iso, + adjusted_year, + era, } + } - // Avoidance didn't work. Let's find the era manually, searching back from the present - let era_start = data - .iter() - .rev() - .find_map(|(s, e)| (e.as_bytes() == era).then_some(s)) - .ok_or(UnknownEraError)?; - Ok(era_start.year + year - 1) - } - - fn era_year_from_extended(&self, year: i32, month: u8, day: u8) -> types::EraYear { - let date: EraStartDate = EraStartDate { year, month, day }; - - let (start, era) = if date >= MEIJI_START - && self - .eras - .get() - .dates_to_eras - .last() - .is_some_and(|(_, e)| e == tinystr!(16, "reiwa")) - { - // We optimize for the five "modern" post-Meiji eras, which are stored in a smaller - // array and also hardcoded. The hardcoded version is not used if data indicates the - // presence of newer eras. - if date >= REIWA_START { - (REIWA_START, tinystr!(16, "reiwa")) - } else if date >= HEISEI_START { - (HEISEI_START, tinystr!(16, "heisei")) - } else if date >= SHOWA_START { - (SHOWA_START, tinystr!(16, "showa")) - } else if date >= TAISHO_START { - (TAISHO_START, tinystr!(16, "taisho")) - } else { - (MEIJI_START, tinystr!(16, "meiji")) - } - } else { - let data = &self.eras.get().dates_to_eras; - #[allow(clippy::unwrap_used)] // binary search - match data.binary_search_by(|(d, _)| d.cmp(&date)) { - Err(0) => { - return types::EraYear { - // TODO: return era indices? - era_index: None, - ..CeBce.era_year_from_extended(year, month, day) - }; - } - Ok(index) => data.get(index).unwrap(), - Err(index) => data.get(index - 1).unwrap(), - } - }; + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + date.inner + } + + fn months_in_year(&self, date: &Self::DateInner) -> u8 { + Iso.months_in_year(&date.inner) + } + + fn days_in_year(&self, date: &Self::DateInner) -> u16 { + Iso.days_in_year(&date.inner) + } + fn days_in_month(&self, date: &Self::DateInner) -> u8 { + Iso.days_in_month(&date.inner) + } + + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + Iso.offset_date(&mut date.inner, offset.cast_unit()); + let (adjusted_year, era) = self.adjusted_year_for(date.inner); + date.adjusted_year = adjusted_year; + date.era = era + } + + fn until( + &self, + date1: &Self::DateInner, + date2: &Self::DateInner, + _calendar2: &Self, + largest_unit: DateDurationUnit, + smallest_unit: DateDurationUnit, + ) -> DateDuration { + Iso.until( + &date1.inner, + &date2.inner, + &Iso, + largest_unit, + smallest_unit, + ) + .cast_unit() + } + + fn year_info(&self, date: &Self::DateInner) -> Self::Year { types::EraYear { - era, + era: date.era, era_index: None, - year: year - start.year + 1, - extended_year: year, + year: date.adjusted_year, ambiguity: types::YearAmbiguity::CenturyRequired, } } + fn extended_year(&self, date: &Self::DateInner) -> i32 { + Iso.extended_year(&date.inner) + } + + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { + Iso.is_in_leap_year(&date.inner) + } + + /// The calendar-specific month represented by `date` + fn month(&self, date: &Self::DateInner) -> types::MonthInfo { + Iso.month(&date.inner) + } + + /// The calendar-specific day-of-month represented by `date` + fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { + Iso.day_of_month(&date.inner) + } + + fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { + Iso.day_of_year(&date.inner) + } + fn debug_name(&self) -> &'static str { - if self.eras.get().dates_to_eras.len() > 10 { - "Japanese (historical era data)" - } else { - "Japanese" - } + Self::DEBUG_NAME } fn calendar_algorithm(&self) -> Option { - if self.eras.get().dates_to_eras.len() > 10 { - None - } else { - Some(crate::preferences::CalendarAlgorithm::Japanese) - } + Some(crate::preferences::CalendarAlgorithm::Japanese) } } -impl_with_abstract_gregorian!(Japanese, JapaneseDateInner, Japanese, this, this); +impl crate::cal::scaffold::UnstableSealed for JapaneseExtended {} +impl Calendar for JapaneseExtended { + type DateInner = JapaneseDateInner; + type Year = types::EraYear; + + fn from_codes( + &self, + era: Option<&str>, + year: i32, + month_code: types::MonthCode, + day: u8, + ) -> Result { + self.0.from_codes(era, year, month_code, day) + } + + fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { + Japanese::from_rata_die(&self.0, rd) + } -impl_with_abstract_gregorian!( - JapaneseExtended, - JapaneseExtendedDateInner, - Japanese, - this, - &this.0 -); + fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { + Japanese::to_rata_die(&self.0, date) + } + + fn from_iso(&self, iso: IsoDateInner) -> JapaneseDateInner { + Japanese::from_iso(&self.0, iso) + } + + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + Japanese::to_iso(&self.0, date) + } + + fn months_in_year(&self, date: &Self::DateInner) -> u8 { + Japanese::months_in_year(&self.0, date) + } + + fn days_in_year(&self, date: &Self::DateInner) -> u16 { + Japanese::days_in_year(&self.0, date) + } + + fn days_in_month(&self, date: &Self::DateInner) -> u8 { + Japanese::days_in_month(&self.0, date) + } + + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + Japanese::offset_date(&self.0, date, offset.cast_unit()) + } + + fn until( + &self, + date1: &Self::DateInner, + date2: &Self::DateInner, + calendar2: &Self, + largest_unit: DateDurationUnit, + smallest_unit: DateDurationUnit, + ) -> DateDuration { + Japanese::until( + &self.0, + date1, + date2, + &calendar2.0, + largest_unit, + smallest_unit, + ) + .cast_unit() + } + + fn year_info(&self, date: &Self::DateInner) -> Self::Year { + Japanese::year_info(&self.0, date) + } + + fn extended_year(&self, date: &Self::DateInner) -> i32 { + Japanese::extended_year(&self.0, date) + } + + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { + Japanese::is_in_leap_year(&self.0, date) + } + + /// The calendar-specific month represented by `date` + fn month(&self, date: &Self::DateInner) -> types::MonthInfo { + Japanese::month(&self.0, date) + } + + /// The calendar-specific day-of-month represented by `date` + fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { + Japanese::day_of_month(&self.0, date) + } + + /// Information of the day of the year + fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { + Japanese::day_of_year(&self.0, date) + } + + fn debug_name(&self) -> &'static str { + Self::DEBUG_NAME + } + + fn calendar_algorithm(&self) -> Option { + Some(crate::preferences::CalendarAlgorithm::Japanese) + } +} impl Date { /// Construct a new Japanese Date. @@ -326,7 +418,13 @@ impl Date { /// assert_eq!(date.month().ordinal, 1); /// assert_eq!(date.day_of_month().0, 2); /// - /// // This function will error for unknown eras + /// // This function will error for eras that are out of bounds: + /// // (Heisei was 32 years long, Heisei 33 is in Reiwa) + /// let oob_date = + /// Date::try_new_japanese_with_calendar(era, 33, 1, 2, japanese_calendar); + /// assert!(oob_date.is_err()); + /// + /// // and for unknown eras /// let fake_era = "neko"; // 🐱 /// let fake_date = Date::try_new_japanese_with_calendar( /// fake_era, @@ -344,15 +442,10 @@ impl Date { day: u8, japanese_calendar: A, ) -> Result, DateError> { - let extended = japanese_calendar + let inner = japanese_calendar .as_calendar() - .extended_from_era_year(Some(era.as_bytes()), year)?; - Ok(Date::from_raw( - JapaneseDateInner(ArithmeticDate::new_gregorian::<&Japanese>( - extended, month, day, - )?), - japanese_calendar, - )) + .new_japanese_date_inner(era, year, month, day)?; + Ok(Date::from_raw(inner, japanese_calendar)) } } @@ -397,14 +490,248 @@ impl Date { day: u8, japanext_calendar: A, ) -> Result, DateError> { - let extended = (&japanext_calendar.as_calendar().0) - .extended_from_era_year(Some(era.as_bytes()), year)?; - Ok(Date::from_raw( - JapaneseExtendedDateInner(ArithmeticDate::new_gregorian::<&Japanese>( - extended, month, day, - )?), - japanext_calendar, - )) + let inner = japanext_calendar + .as_calendar() + .0 + .new_japanese_date_inner(era, year, month, day)?; + Ok(Date::from_raw(inner, japanext_calendar)) + } +} + +const MEIJI_START: EraStartDate = EraStartDate { + year: 1868, + month: 10, + day: 23, +}; +const TAISHO_START: EraStartDate = EraStartDate { + year: 1912, + month: 7, + day: 30, +}; +const SHOWA_START: EraStartDate = EraStartDate { + year: 1926, + month: 12, + day: 25, +}; +const HEISEI_START: EraStartDate = EraStartDate { + year: 1989, + month: 1, + day: 8, +}; +const REIWA_START: EraStartDate = EraStartDate { + year: 2019, + month: 5, + day: 1, +}; + +impl Japanese { + /// Given an ISO date, give year and era for that date in the Japanese calendar + /// + /// This will also use Gregorian eras for eras that are before the earliest era + fn adjusted_year_for(&self, date: IsoDateInner) -> (i32, TinyStr16) { + let date: EraStartDate = EraStartDate { + year: date.0.year, + month: date.0.month, + day: date.0.day, + }; + let (start, era) = self.japanese_era_for(date); + // The year in which an era starts is Year 1, and it may be short + // The only time this function will experience dates that are *before* + // the era start date are for the first era (Currently, taika-645 + // for japanext, meiji for japanese), + // In such a case, we instead fall back to Gregorian era codes + if date < start { + if date.year <= 0 { + (1 - date.year, tinystr!(16, "bce")) + } else { + (date.year, tinystr!(16, "ce")) + } + } else { + (date.year - start.year + 1, era) + } + } + + /// Given an date, obtain the era data (not counting spliced gregorian eras) + fn japanese_era_for(&self, date: EraStartDate) -> (EraStartDate, TinyStr16) { + let era_data = self.eras.get(); + // We optimize for the five "modern" post-Meiji eras, which are stored in a smaller + // array and also hardcoded. The hardcoded version is not used if data indicates the + // presence of newer eras. + if date >= MEIJI_START + && era_data.dates_to_eras.last().map(|x| x.1) == Some(tinystr!(16, "reiwa")) + { + // Fast path in case eras have not changed since this code was written + return if date >= REIWA_START { + (REIWA_START, tinystr!(16, "reiwa")) + } else if date >= HEISEI_START { + (HEISEI_START, tinystr!(16, "heisei")) + } else if date >= SHOWA_START { + (SHOWA_START, tinystr!(16, "showa")) + } else if date >= TAISHO_START { + (TAISHO_START, tinystr!(16, "taisho")) + } else { + (MEIJI_START, tinystr!(16, "meiji")) + }; + } + let data = &era_data.dates_to_eras; + match data.binary_search_by(|(d, _)| d.cmp(&date)) { + Ok(index) => data.get(index), + Err(index) if index == 0 => data.get(index), + Err(index) => data.get(index - 1).or_else(|| data.iter().next_back()), + } + .unwrap_or((REIWA_START, tinystr!(16, "reiwa"))) + } + + /// Returns the range of dates for a given Japanese era code, + /// not handling "bce" or "ce" + /// + /// Returns (era_start, era_end) + fn japanese_era_range_for( + &self, + era: TinyStr16, + ) -> Result<(EraStartDate, Option), DateError> { + // Avoid linear search by trying well known eras + if era == tinystr!(16, "reiwa") { + // Check if we're the last + if let Some(last) = self.eras.get().dates_to_eras.last() { + if last.1 == era { + return Ok((REIWA_START, None)); + } + } + } else if era == tinystr!(16, "heisei") { + return Ok((HEISEI_START, Some(REIWA_START))); + } else if era == tinystr!(16, "showa") { + return Ok((SHOWA_START, Some(HEISEI_START))); + } else if era == tinystr!(16, "taisho") { + return Ok((TAISHO_START, Some(SHOWA_START))); + } else if era == tinystr!(16, "meiji") { + return Ok((MEIJI_START, Some(TAISHO_START))); + } + + let era_data = self.eras.get(); + let data = &era_data.dates_to_eras; + // Try to avoid linear search by binary searching for the year suffix + if let Some(year) = era.split('-').nth(1) { + if let Ok(ref int) = year.parse::() { + if let Ok(index) = data.binary_search_by(|(d, _)| d.year.cmp(int)) { + #[allow(clippy::expect_used)] // see expect message + let (era_start, code) = data + .get(index) + .expect("Indexing from successful binary search must succeed"); + // There is a slight chance we hit the case where there are two eras in the same year + // There are a couple of rare cases of this, but it's not worth writing a range-based binary search + // to catch them since this is an optimization + if code == era { + return Ok((era_start, data.get(index + 1).map(|e| e.0))); + } + } + } + } + + // Avoidance didn't work. Let's find the era manually, searching back from the present + if let Some((index, (start, _))) = data.iter().enumerate().rev().find(|d| d.1 .1 == era) { + return Ok((start, data.get(index + 1).map(|e| e.0))); + } + + Err(DateError::UnknownEra) + } + + fn new_japanese_date_inner( + &self, + era: &str, + year: i32, + month: u8, + day: u8, + ) -> Result { + let cal = Ref(self); + let era = match era { + "ce" | "ad" => { + return Ok(Date::try_new_gregorian(year_check(year, 1..)?, month, day)? + .to_calendar(cal) + .inner); + } + "bce" | "bc" => { + return Ok( + Date::try_new_gregorian(1 - year_check(year, 1..)?, month, day)? + .to_calendar(cal) + .inner, + ); + } + e => e.parse().map_err(|_| DateError::UnknownEra)?, + }; + + let (era_start, next_era_start) = self.japanese_era_range_for(era)?; + + let next_era_start = next_era_start.unwrap_or(EraStartDate { + year: i32::MAX, + month: 12, + day: 31, + }); + + let date_in_iso = EraStartDate { + year: era_start.year + year - 1, + month, + day, + }; + + if date_in_iso < era_start { + return Err(if date_in_iso.year < era_start.year { + DateError::Range { + field: "year", + value: year, + min: 1, + max: 1 + next_era_start.year - era_start.year, + } + } else if date_in_iso.month < era_start.month { + DateError::Range { + field: "month", + value: month as i32, + min: era_start.month as i32, + max: 12, + } + } else + /* if date_in_iso.day < era_start.day */ + { + DateError::Range { + field: "day", + value: day as i32, + min: era_start.day as i32, + max: 31, + } + }); + } else if date_in_iso >= next_era_start { + return Err(if date_in_iso.year > era_start.year { + DateError::Range { + field: "year", + value: year, + min: 1, + max: 1 + next_era_start.year - era_start.year, + } + } else if date_in_iso.month > era_start.month { + DateError::Range { + field: "month", + value: month as i32, + min: 1, + max: next_era_start.month as i32 - 1, + } + } else + /* if date_in_iso.day >= era_start.day */ + { + DateError::Range { + field: "day", + value: day as i32, + min: 1, + max: next_era_start.day as i32 - 1, + } + }); + } + + let iso = Date::try_new_iso(date_in_iso.year, date_in_iso.month, date_in_iso.day)?; + Ok(JapaneseDateInner { + inner: iso.inner, + adjusted_year: year, + era, + }) } } @@ -449,9 +776,9 @@ mod tests { ) } - // test that out-of-range era values roundtrip to other eras - fn single_test_era_range_roundtrip( - calendar: Ref, + // test that the Gregorian eras roundtrip to Japanese ones + fn single_test_gregorian_roundtrip_ext( + calendar: Ref, era: &str, year: i32, month: u8, @@ -459,14 +786,14 @@ mod tests { era2: &str, year2: i32, ) { - let expected = Date::try_new_japanese_with_calendar(era2, year2, month, day, calendar) + let expected = Date::try_new_japanese_extended_with_calendar(era2, year2, month, day, calendar) .unwrap_or_else(|e| { panic!( "Failed to construct expectation date with {era2:?}, {year2}, {month}, {day}: {e:?}" ) }); - let date = Date::try_new_japanese_with_calendar(era, year, month, day, calendar) + let date = Date::try_new_japanese_extended_with_calendar(era, year, month, day, calendar) .unwrap_or_else(|e| { panic!("Failed to construct date with {era:?}, {year}, {month}, {day}: {e:?}") }); @@ -477,43 +804,32 @@ mod tests { "Failed to roundtrip with {era:?}, {year}, {month}, {day} == {era2:?}, {year}" ) } - fn single_test_era_range_roundtrip_ext( - calendar: Ref, + + fn single_test_error( + calendar: Ref, era: &str, year: i32, month: u8, day: u8, - era2: &str, - year2: i32, + error: DateError, ) { - let expected = Date::try_new_japanese_extended_with_calendar(era2, year2, month, day, calendar) - .unwrap_or_else(|e| { - panic!( - "Failed to construct expectation date with {era2:?}, {year2}, {month}, {day}: {e:?}" - ) - }); - - let date = Date::try_new_japanese_extended_with_calendar(era, year, month, day, calendar) - .unwrap_or_else(|e| { - panic!("Failed to construct date with {era:?}, {year}, {month}, {day}: {e:?}") - }); - let iso = date.to_iso(); - let reconstructed = Date::new_from_iso(iso, calendar); + let date = Date::try_new_japanese_with_calendar(era, year, month, day, calendar); assert_eq!( - expected, reconstructed, - "Failed to roundtrip with {era:?}, {year}, {month}, {day} == {era2:?}, {year}" + date, + Err(error), + "Construction with {era:?}, {year}, {month}, {day} did not return {error:?}" ) } - fn single_test_error( - calendar: Ref, + fn single_test_error_ext( + calendar: Ref, era: &str, year: i32, month: u8, day: u8, error: DateError, ) { - let date = Date::try_new_japanese_with_calendar(era, year, month, day, calendar); + let date = Date::try_new_japanese_extended_with_calendar(era, year, month, day, calendar); assert_eq!( date, Err(error), @@ -531,11 +847,35 @@ mod tests { single_test_roundtrip(calendar, "heisei", 12, 3, 1); single_test_roundtrip(calendar, "taisho", 3, 3, 1); // Heisei did not start until later in the year - single_test_era_range_roundtrip(calendar, "heisei", 1, 1, 1, "showa", 64); + single_test_error( + calendar, + "heisei", + 1, + 1, + 1, + DateError::Range { + field: "day", + value: 1, + min: 8, + max: 31, + }, + ); single_test_roundtrip_ext(calendar_ext, "heisei", 12, 3, 1); single_test_roundtrip_ext(calendar_ext, "taisho", 3, 3, 1); - single_test_era_range_roundtrip_ext(calendar_ext, "heisei", 1, 1, 1, "showa", 64); + single_test_error_ext( + calendar_ext, + "heisei", + 1, + 1, + 1, + DateError::Range { + field: "day", + value: 1, + min: 8, + max: 31, + }, + ); single_test_roundtrip_ext(calendar_ext, "hakuho-672", 4, 3, 1); single_test_error(calendar, "hakuho-672", 4, 3, 1, DateError::UnknownEra); @@ -547,38 +887,69 @@ mod tests { single_test_roundtrip(calendar, "ce", 100, 3, 1); single_test_roundtrip_ext(calendar_ext, "ce", 100, 3, 1); single_test_roundtrip(calendar, "ce", 1000, 3, 1); - single_test_era_range_roundtrip(calendar, "ce", 0, 3, 1, "bce", 1); - single_test_era_range_roundtrip(calendar, "bce", -1, 3, 1, "ce", 2); + single_test_error( + calendar, + "ce", + 0, + 3, + 1, + DateError::Range { + field: "year", + value: 0, + min: 1, + max: i32::MAX, + }, + ); + single_test_error( + calendar, + "bce", + -1, + 3, + 1, + DateError::Range { + field: "year", + value: -1, + min: 1, + max: i32::MAX, + }, + ); // handle the cases where bce/ce get adjusted to different eras // single_test_gregorian_roundtrip(calendar, "ce", 2021, 3, 1, "reiwa", 3); - single_test_era_range_roundtrip_ext(calendar_ext, "ce", 1000, 3, 1, "choho-999", 2); - single_test_era_range_roundtrip_ext(calendar_ext, "ce", 749, 5, 10, "tenpyokampo-749", 1); - single_test_era_range_roundtrip_ext(calendar_ext, "bce", 10, 3, 1, "bce", 10); - single_test_era_range_roundtrip_ext(calendar_ext, "ce", -1, 3, 1, "bce", 2); + single_test_gregorian_roundtrip_ext(calendar_ext, "ce", 1000, 3, 1, "choho-999", 2); + single_test_gregorian_roundtrip_ext(calendar_ext, "ce", 749, 5, 10, "tenpyokampo-749", 1); + single_test_gregorian_roundtrip_ext(calendar_ext, "bce", 10, 3, 1, "bce", 10); // There were multiple eras in this year // This one is from Apr 14 to July 2 single_test_roundtrip_ext(calendar_ext, "tenpyokampo-749", 1, 4, 20); single_test_roundtrip_ext(calendar_ext, "tenpyokampo-749", 1, 4, 14); single_test_roundtrip_ext(calendar_ext, "tenpyokampo-749", 1, 7, 1); - single_test_era_range_roundtrip_ext( + single_test_error_ext( calendar_ext, "tenpyokampo-749", 1, 7, 5, - "tenpyoshoho-749", - 1, + DateError::Range { + field: "month", + value: 7, + min: 1, + max: 6, + }, ); - single_test_era_range_roundtrip_ext( + single_test_error_ext( calendar_ext, "tenpyokampo-749", 1, 4, 13, - "tenpyoshoho-749", - 1, + DateError::Range { + field: "day", + value: 13, + min: 14, + max: 31, + }, ); } } diff --git a/deps/crates/vendor/icu_calendar/src/cal/julian.rs b/deps/crates/vendor/icu_calendar/src/cal/julian.rs index f0a48379d6fe22..92379e0bde1f22 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/julian.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/julian.rs @@ -2,90 +2,59 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::calendar_arithmetic::ArithmeticDate; -use crate::calendar_arithmetic::DateFieldsResolver; -use crate::error::{DateError, DateFromFieldsError, EcmaReferenceYearError, UnknownEraError}; -use crate::options::DateFromFieldsOptions; -use crate::options::{DateAddOptions, DateDifferenceOptions}; -use crate::types::DateFields; -use crate::{types, Calendar, Date, RangeError}; +//! This module contains types and implementations for the Julian calendar. +//! +//! ```rust +//! use icu::calendar::{cal::Julian, Date}; +//! +//! let date_iso = Date::try_new_iso(1970, 1, 2) +//! .expect("Failed to initialize ISO Date instance."); +//! let date_julian = Date::new_from_iso(date_iso, Julian); +//! +//! assert_eq!(date_julian.era_year().year, 1969); +//! assert_eq!(date_julian.month().ordinal, 12); +//! assert_eq!(date_julian.day_of_month().0, 20); +//! ``` + +use crate::cal::iso::{Iso, IsoDateInner}; +use crate::calendar_arithmetic::{ArithmeticDate, CalendarArithmetic}; +use crate::error::{year_check, DateError}; +use crate::{types, Calendar, Date, DateDuration, DateDurationUnit, RangeError}; use calendrical_calculations::helpers::I32CastError; use calendrical_calculations::rata_die::RataDie; use tinystr::tinystr; -/// The [Julian Calendar](https://en.wikipedia.org/wiki/Julian_calendar). +/// The [Julian Calendar] /// -/// The Julian calendar is a solar calendar that was introduced in the Roman Republic under -/// Julius Caesar in 45 BCE, and used in Europe and much of the western world until it was -/// eventually replaced by the more accurate [`Gregorian`](super::Gregorian) calendar. +/// The [Julian calendar] is a solar calendar that was used commonly historically, with twelve months. /// -/// This implementation extends proleptically for dates before the calendar's creation. +/// This type can be used with [`Date`] to represent dates in this calendar. /// -/// While no country uses the Julian calendar as its civil calendar today, it is still -/// used by eastern Christian churches to determine lithurgical dates like Christmas and -/// Easter. +/// [Julian calendar]: https://en.wikipedia.org/wiki/Julian_calendar /// /// # Era codes /// /// This calendar uses two era codes: `bce` (alias `bc`), and `ce` (alias `ad`), corresponding to the BCE and CE eras. /// -/// # Months and days +/// # Month codes /// -/// The 12 months are called January (`M01`, 31 days), February (`M02`, 28 days), -/// March (`M03`, 31 days), April (`M04`, 30 days), May (`M05`, 31 days), June (`M06`, 30 days), -/// July (`M07`, 31 days), August (`M08`, 31 days), September (`M09`, 30 days), -/// October (`M10`, 31 days), November (`M11`, 30 days), December (`M12`, 31 days). -/// -/// In leap years (years divisible by 4), February gains a 29th day. -/// -/// Standard years thus have 365 days, and leap years 366. -/// -/// # Calendar drift -/// -/// The Julian calendar has an average year length of 365.25, slightly longer than -/// the mean solar year, so this calendar drifts 1 day in ~128 years with -/// respect to the seasons. This significant drift was the reason for its replacement -/// by the Gregorian calendar. The Julian calendar is currently 14 days ahead of the -/// Gregorian calendar and the solar year. -/// -/// # Historical accuracy -/// -/// Historically, a variety of year reckoning schemes have been used with the Julian -/// calendar, such as Roman consular years, regnal years, [indictions]( -/// https://en.wikipedia.org/wiki/Indiction), [Anno Mundi]( -/// https://en.wikipedia.org/wiki/Anno_Mundi#Byzantine_era), the [Diocletian era]( -/// https://en.wikipedia.org/wiki/Era_of_the_Martyrs), [Anno Domini]( -/// https://en.wikipedia.org/wiki/Anno_Domini), and the (equivalent) [Common era]( -/// https://en.wikipedia.org/wiki/Common_Era). -/// The latter, which is used today and by this implementation, has been used by -/// western European authorities since the early middle ages, however some eastern -/// European countries/churches have not adopted it until fairly recently, or, in -/// some cases, are still using a different year reckoning scheme. -/// -/// Also during the middle ages, [some countries](https://en.wikipedia.org/wiki/New_Year#Historical_European_new_year_dates) -/// used different dates for the first day of the year, ranging from late December to -/// late March. Care has to be taken when interpreting year numbers with dates in this -/// range. -/// -/// The calendar was used [incorrectly](https://en.wikipedia.org/wiki/Julian_calendar#Leap_year_error) -/// for a while after adoption, so the first year where the months align with this proleptic -/// implementation is probably 4 CE. +/// This calendar supports 12 solar month codes (`"M01" - "M12"`) #[derive(Copy, Clone, Debug, Hash, Default, Eq, PartialEq, PartialOrd, Ord)] #[allow(clippy::exhaustive_structs)] // this type is stable pub struct Julian; /// The inner date type used for representing [`Date`]s of [`Julian`]. See [`Date`] and [`Julian`] for more details. -#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] // The inner date type used for representing Date pub struct JulianDateInner(pub(crate) ArithmeticDate); -impl DateFieldsResolver for Julian { +impl CalendarArithmetic for Julian { type YearInfo = i32; fn days_in_provided_month(year: i32, month: u8) -> u8 { match month { 4 | 6 | 9 | 11 => 30, - 2 if calendrical_calculations::julian::is_leap_year(year) => 29, + 2 if Self::provided_year_is_leap(year) => 29, 2 => 28, 1 | 3 | 5 | 7 | 8 | 10 | 12 => 31, _ => 0, @@ -96,41 +65,20 @@ impl DateFieldsResolver for Julian { 12 } - #[inline] - fn year_info_from_era( - &self, - era: &[u8], - era_year: i32, - ) -> Result { - match era { - b"ad" | b"ce" => Ok(era_year), - b"bc" | b"bce" => Ok(1 - era_year), - _ => Err(UnknownEraError), - } + fn provided_year_is_leap(year: i32) -> bool { + calendrical_calculations::julian::is_leap_year(year) } - #[inline] - fn year_info_from_extended(&self, extended_year: i32) -> Self::YearInfo { - extended_year + fn last_month_day_in_provided_year(_year: i32) -> (u8, u8) { + (12, 31) } - #[inline] - fn reference_year_from_month_day( - &self, - month_code: types::ValidMonthCode, - day: u8, - ) -> Result { - let (ordinal_month, false) = month_code.to_tuple() else { - return Err(EcmaReferenceYearError::MonthCodeNotInCalendar); - }; - // December 31, 1972 occurs on 12th month, 18th day, 1972 Old Style - // Note: 1972 is a leap year - let julian_year = if ordinal_month < 12 || (ordinal_month == 12 && day <= 18) { - 1972 + fn days_in_provided_year(year: i32) -> u16 { + if Self::provided_year_is_leap(year) { + 366 } else { - 1971 - }; - Ok(julian_year) + 365 + } } } @@ -138,7 +86,6 @@ impl crate::cal::scaffold::UnstableSealed for Julian {} impl Calendar for Julian { type DateInner = JulianDateInner; type Year = types::EraYear; - type DifferenceError = core::convert::Infallible; fn from_codes( &self, @@ -147,23 +94,20 @@ impl Calendar for Julian { month_code: types::MonthCode, day: u8, ) -> Result { - ArithmeticDate::from_codes(era, year, month_code, day, self).map(JulianDateInner) - } + let year = match era { + Some("ce" | "ad") | None => year_check(year, 1..)?, + Some("bce" | "bc") => 1 - year_check(year, 1..)?, + Some(_) => return Err(DateError::UnknownEra), + }; - #[cfg(feature = "unstable")] - fn from_fields( - &self, - fields: DateFields, - options: DateFromFieldsOptions, - ) -> Result { - ArithmeticDate::from_fields(fields, options, self).map(JulianDateInner) + ArithmeticDate::new_from_codes(self, year, month_code, day).map(JulianDateInner) } fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { JulianDateInner( match calendrical_calculations::julian::julian_from_fixed(rd) { - Err(I32CastError::BelowMin) => ArithmeticDate::new_unchecked(i32::MIN, 1, 1), - Err(I32CastError::AboveMax) => ArithmeticDate::new_unchecked(i32::MAX, 12, 31), + Err(I32CastError::BelowMin) => ArithmeticDate::min_date(), + Err(I32CastError::AboveMax) => ArithmeticDate::max_date(), Ok((year, month, day)) => ArithmeticDate::new_unchecked(year, month, day), }, ) @@ -173,90 +117,83 @@ impl Calendar for Julian { calendrical_calculations::julian::fixed_from_julian(date.0.year, date.0.month, date.0.day) } - fn has_cheap_iso_conversion(&self) -> bool { - false + fn from_iso(&self, iso: IsoDateInner) -> JulianDateInner { + self.from_rata_die(Iso.to_rata_die(&iso)) + } + + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + Iso.from_rata_die(self.to_rata_die(date)) } fn months_in_year(&self, date: &Self::DateInner) -> u8 { - Self::months_in_provided_year(date.0.year) + date.0.months_in_year() } fn days_in_year(&self, date: &Self::DateInner) -> u16 { - if self.is_in_leap_year(date) { - 366 - } else { - 365 - } + date.0.days_in_year() } fn days_in_month(&self, date: &Self::DateInner) -> u8 { - Self::days_in_provided_month(date.0.year, date.0.month) + date.0.days_in_month() } - #[cfg(feature = "unstable")] - fn add( - &self, - date: &Self::DateInner, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result { - date.0.added(duration, self, options).map(JulianDateInner) + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + date.0.offset_date(offset, &()); } - #[cfg(feature = "unstable")] + #[allow(clippy::field_reassign_with_default)] fn until( &self, date1: &Self::DateInner, date2: &Self::DateInner, - options: DateDifferenceOptions, - ) -> Result { - Ok(date1.0.until(&date2.0, self, options)) + _calendar2: &Self, + _largest_unit: DateDurationUnit, + _smallest_unit: DateDurationUnit, + ) -> DateDuration { + date1.0.until(date2.0, _largest_unit, _smallest_unit) } /// The calendar-specific year represented by `date` /// Julian has the same era scheme as Gregorian fn year_info(&self, date: &Self::DateInner) -> Self::Year { - let extended_year = date.0.year; + let extended_year = self.extended_year(date); if extended_year > 0 { types::EraYear { era: tinystr!(16, "ce"), era_index: Some(1), year: extended_year, - extended_year, ambiguity: types::YearAmbiguity::CenturyRequired, } } else { types::EraYear { era: tinystr!(16, "bce"), era_index: Some(0), - year: 1 - extended_year, - extended_year, + year: 1_i32.saturating_sub(extended_year), ambiguity: types::YearAmbiguity::EraAndCenturyRequired, } } } + fn extended_year(&self, date: &Self::DateInner) -> i32 { + date.0.extended_year() + } + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { - calendrical_calculations::julian::is_leap_year(date.0.year) + Self::provided_year_is_leap(date.0.year) } /// The calendar-specific month represented by `date` fn month(&self, date: &Self::DateInner) -> types::MonthInfo { - types::MonthInfo::non_lunisolar(date.0.month) + date.0.month() } /// The calendar-specific day-of-month represented by `date` fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { - types::DayOfMonth(date.0.day) + date.0.day_of_month() } fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { - types::DayOfYear( - (1..date.0.month) - .map(|m| Self::days_in_provided_month(date.0.year, m) as u16) - .sum::() - + date.0.day as u16, - ) + date.0.day_of_year() } fn debug_name(&self) -> &'static str { @@ -273,11 +210,6 @@ impl Julian { pub fn new() -> Self { Self } - - /// Returns the date of (Orthodox) Easter in the given year. - pub fn easter(year: i32) -> Date { - Date::from_rata_die(calendrical_calculations::julian::easter(year), Self) - } } impl Date { @@ -296,7 +228,7 @@ impl Date { /// assert_eq!(date_julian.day_of_month().0, 20); /// ``` pub fn try_new_julian(year: i32, month: u8, day: u8) -> Result, RangeError> { - ArithmeticDate::try_from_ymd(year, month, day) + ArithmeticDate::new_from_ordinals(year, month, day) .map(JulianDateInner) .map(|inner| Date::from_raw(inner, Julian)) } @@ -542,11 +474,20 @@ mod test { } } + #[test] + fn test_hebrew_epoch() { + assert_eq!( + calendrical_calculations::julian::fixed_from_julian_book_version(-3761, 10, 7), + RataDie::new(-1373427) + ); + } + #[test] fn test_julian_leap_years() { - Date::try_new_julian(4, 2, 29).unwrap(); - Date::try_new_julian(0, 2, 29).unwrap(); - Date::try_new_julian(-4, 2, 29).unwrap(); + assert!(Julian::provided_year_is_leap(4)); + assert!(Julian::provided_year_is_leap(0)); + assert!(Julian::provided_year_is_leap(-4)); + Date::try_new_julian(2020, 2, 29).unwrap(); } } diff --git a/deps/crates/vendor/icu_calendar/src/cal/mod.rs b/deps/crates/vendor/icu_calendar/src/cal/mod.rs index cd442f6f979116..0014aac559b5e3 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/mod.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/mod.rs @@ -4,14 +4,14 @@ //! Types for individual calendars pub(crate) mod buddhist; +pub(crate) mod chinese; +pub(crate) mod chinese_based; pub(crate) mod coptic; -#[path = "east_asian_traditional.rs"] -pub(crate) mod east_asian_traditional_internal; +pub(crate) mod dangi; pub(crate) mod ethiopian; pub(crate) mod gregorian; pub(crate) mod hebrew; -#[path = "hijri.rs"] -pub(crate) mod hijri_internal; +pub(crate) mod hijri; pub(crate) mod indian; pub(crate) mod iso; pub(crate) mod japanese; @@ -19,42 +19,16 @@ pub(crate) mod julian; pub(crate) mod persian; pub(crate) mod roc; -pub(crate) mod abstract_gregorian; - pub use buddhist::Buddhist; -/// Customizations for the [`EastAsianTraditional`](east_asian_traditional::EastAsianTraditional) calendar. -pub mod east_asian_traditional { - pub use super::east_asian_traditional_internal::{China, EastAsianTraditional, Korea}; - - // TODO(#6962) Stabilize - #[cfg(feature = "unstable")] - pub use super::east_asian_traditional_internal::{EastAsianTraditionalYearData, Rules}; -} +pub use chinese::Chinese; pub use coptic::Coptic; -pub use east_asian_traditional_internal::{ChineseTraditional, KoreanTraditional}; +pub use dangi::Dangi; pub use ethiopian::{Ethiopian, EthiopianEraStyle}; pub use gregorian::Gregorian; pub use hebrew::Hebrew; -pub use hijri_internal::Hijri; -/// Customizations for the [`Hijri`] calendar. -pub mod hijri { - pub use super::hijri_internal::{ - AstronomicalSimulation, TabularAlgorithm, TabularAlgorithmEpoch, TabularAlgorithmLeapYears, - UmmAlQura, - }; - - // TODO(#6962) Stabilize - #[cfg(feature = "unstable")] - pub use super::hijri_internal::{HijriYearData, Rules}; - - #[doc(hidden)] - /// These are unstable traits but we expose them on stable to - /// icu_datetime. - pub mod unstable_internal { - pub use super::super::hijri_internal::Rules; - } -} - +pub use hijri::{ + HijriSimulated, HijriTabular, HijriTabularEpoch, HijriTabularLeapYears, HijriUmmAlQura, +}; pub use indian::Indian; pub use iso::Iso; pub use japanese::{Japanese, JapaneseExtended}; @@ -62,31 +36,9 @@ pub use julian::Julian; pub use persian::Persian; pub use roc::Roc; -/// Deprecated -#[deprecated] -pub use hijri::{ - TabularAlgorithmEpoch as HijriTabularEpoch, TabularAlgorithmLeapYears as HijriTabularLeapYears, -}; -/// Deprecated -#[deprecated] -pub type HijriSimulated = Hijri; -/// Deprecated -#[deprecated] -pub type HijriUmmAlQura = Hijri; -/// Deprecated -#[deprecated] -pub type HijriTabular = Hijri; -/// Use [`KoreanTraditional`] -#[deprecated(since = "2.1.0", note = "use `KoreanTraditional`")] -pub type Dangi = KoreanTraditional; -/// Use [`ChineseTraditional`] -#[deprecated(since = "2.1.0", note = "use `ChineseTraditional`")] -pub type Chinese = ChineseTraditional; - -pub use crate::any_calendar::{AnyCalendar, AnyCalendarDifferenceError, AnyCalendarKind}; +pub use crate::any_calendar::{AnyCalendar, AnyCalendarKind}; /// Internal scaffolding types -#[cfg_attr(not(feature = "unstable"), doc(hidden))] pub mod scaffold { /// Trait marking other traits that are considered unstable and should not generally be /// implemented outside of the calendar crate. diff --git a/deps/crates/vendor/icu_calendar/src/cal/persian.rs b/deps/crates/vendor/icu_calendar/src/cal/persian.rs index 0e1a95b111953f..fc58e879925737 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/persian.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/persian.rs @@ -2,46 +2,41 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::calendar_arithmetic::ArithmeticDate; -use crate::calendar_arithmetic::DateFieldsResolver; -use crate::error::{DateError, DateFromFieldsError, EcmaReferenceYearError, UnknownEraError}; -use crate::options::DateFromFieldsOptions; -use crate::options::{DateAddOptions, DateDifferenceOptions}; -use crate::types::DateFields; -use crate::{types, Calendar, Date, RangeError}; +//! This module contains types and implementations for the Persian calendar. +//! +//! ```rust +//! use icu::calendar::Date; +//! +//! let persian_date = Date::try_new_persian(1348, 10, 11) +//! .expect("Failed to initialize Persian Date instance."); +//! +//! assert_eq!(persian_date.era_year().year, 1348); +//! assert_eq!(persian_date.month().ordinal, 10); +//! assert_eq!(persian_date.day_of_month().0, 11); +//! ``` + +use crate::cal::iso::{Iso, IsoDateInner}; +use crate::calendar_arithmetic::{ArithmeticDate, CalendarArithmetic}; +use crate::error::DateError; +use crate::{types, Calendar, Date, DateDuration, DateDurationUnit, RangeError}; use ::tinystr::tinystr; use calendrical_calculations::helpers::I32CastError; use calendrical_calculations::rata_die::RataDie; /// The [Persian Calendar](https://en.wikipedia.org/wiki/Solar_Hijri_calendar) /// -/// The Persian Calendar is a solar calendar used officially by the countries of Iran and -/// Afghanistan and many Persian-speaking regions. +/// The Persian Calendar is a solar calendar used officially by the countries of Iran and Afghanistan and many Persian-speaking regions. +/// It has 12 months and other similarities to the [`Gregorian`](super::Gregorian) Calendar. /// -/// This implementation extends proleptically for dates before the calendar's creation -/// in 458 AP (1079 CE). -/// -/// This corresponds to the `"persian"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). +/// This type can be used with [`Date`] to represent dates in this calendar. /// /// # Era codes /// -/// This calendar uses a single era code `ap`, with Anno Persico/Anno Persarum starting the year of the Hijra. Dates before this era use negative years. -/// -/// # Months and days -/// -/// The 12 months are called Farvardin (`M01`, 31 days), Ordibehesht (`M02`, 31 days), -/// Khordad (`M03`, 31 days), Tir (`M04`, 31 days), Mordad (`M05`, 31 days), Shahrivar (`M06`, 31 days), -/// Mehr (`M07`, 30 days), Aban (`M08`, 30 days), Azar (`M09`, 30 days), -/// Dey (`M10`, 30 days), Bahman (`M11`, 30 days), Esfand (`M12`, 29 days). -/// -/// In leap years (determined astronomically with respect to the vernal equinox), Esfand gains a 30th day. -/// -/// Standard years thus have 365 days, and leap years 366. +/// This calendar uses a single era code `ap` (aliases `sh`, `hs`), with Anno Persico/Anno Persarum starting the year of the Hijra. Dates before this era use negative years. /// -/// # Calendar drift +/// # Month codes /// -/// As leap years are determined with respect to the solar year, this calendar stays anchored -/// to the seasons. +/// This calendar supports 12 solar month codes (`"M01" - "M12"`) #[derive(Copy, Clone, Debug, Default, Hash, Eq, PartialEq, PartialOrd, Ord)] #[allow(clippy::exhaustive_structs)] pub struct Persian; @@ -51,14 +46,14 @@ pub struct Persian; /// The inner date type used for representing [`Date`]s of [`Persian`]. See [`Date`] and [`Persian`] for more details. pub struct PersianDateInner(ArithmeticDate); -impl DateFieldsResolver for Persian { +impl CalendarArithmetic for Persian { type YearInfo = i32; fn days_in_provided_month(year: i32, month: u8) -> u8 { match month { 1..=6 => 31, 7..=11 => 30, - 12 if calendrical_calculations::persian::is_leap_year(year) => 30, + 12 if Self::provided_year_is_leap(year) => 30, 12 => 29, _ => 0, } @@ -68,40 +63,24 @@ impl DateFieldsResolver for Persian { 12 } - #[inline] - fn year_info_from_era( - &self, - era: &[u8], - era_year: i32, - ) -> Result { - match era { - b"ap" => Ok(era_year), - _ => Err(UnknownEraError), - } + fn provided_year_is_leap(p_year: i32) -> bool { + calendrical_calculations::persian::is_leap_year(p_year) } - #[inline] - fn year_info_from_extended(&self, extended_year: i32) -> Self::YearInfo { - extended_year + fn days_in_provided_year(year: i32) -> u16 { + if Self::provided_year_is_leap(year) { + 366 + } else { + 365 + } } - #[inline] - fn reference_year_from_month_day( - &self, - month_code: types::ValidMonthCode, - day: u8, - ) -> Result { - let (ordinal_month, false) = month_code.to_tuple() else { - return Err(EcmaReferenceYearError::MonthCodeNotInCalendar); - }; - // December 31, 1972 occurs on 10th month, 10th day, 1351 AP - let persian_year = if ordinal_month < 10 || (ordinal_month == 10 && day <= 10) { - 1351 + fn last_month_day_in_provided_year(year: i32) -> (u8, u8) { + if Self::provided_year_is_leap(year) { + (12, 30) } else { - // Note: 1350 is a leap year - 1350 - }; - Ok(persian_year) + (12, 29) + } } } @@ -109,7 +88,6 @@ impl crate::cal::scaffold::UnstableSealed for Persian {} impl Calendar for Persian { type DateInner = PersianDateInner; type Year = types::EraYear; - type DifferenceError = core::convert::Infallible; fn from_codes( &self, @@ -118,23 +96,19 @@ impl Calendar for Persian { month_code: types::MonthCode, day: u8, ) -> Result { - ArithmeticDate::from_codes(era, year, month_code, day, self).map(PersianDateInner) - } + let year = match era { + Some("ap" | "sh" | "hs") | None => year, + Some(_) => return Err(DateError::UnknownEra), + }; - #[cfg(feature = "unstable")] - fn from_fields( - &self, - fields: DateFields, - options: DateFromFieldsOptions, - ) -> Result { - ArithmeticDate::from_fields(fields, options, self).map(PersianDateInner) + ArithmeticDate::new_from_codes(self, year, month_code, day).map(PersianDateInner) } fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { PersianDateInner( match calendrical_calculations::persian::fast_persian_from_fixed(rd) { - Err(I32CastError::BelowMin) => ArithmeticDate::new_unchecked(i32::MIN, 1, 1), - Err(I32CastError::AboveMax) => ArithmeticDate::new_unchecked(i32::MAX, 12, 29), + Err(I32CastError::BelowMin) => ArithmeticDate::min_date(), + Err(I32CastError::AboveMax) => ArithmeticDate::max_date(), Ok((year, month, day)) => ArithmeticDate::new_unchecked(year, month, day), }, ) @@ -148,74 +122,69 @@ impl Calendar for Persian { ) } - fn has_cheap_iso_conversion(&self) -> bool { - false + fn from_iso(&self, iso: IsoDateInner) -> PersianDateInner { + self.from_rata_die(Iso.to_rata_die(&iso)) + } + + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + Iso.from_rata_die(self.to_rata_die(date)) } fn months_in_year(&self, date: &Self::DateInner) -> u8 { - Self::months_in_provided_year(date.0.year) + date.0.months_in_year() } fn days_in_year(&self, date: &Self::DateInner) -> u16 { - if self.is_in_leap_year(date) { - 366 - } else { - 365 - } + date.0.days_in_year() } fn days_in_month(&self, date: &Self::DateInner) -> u8 { - Self::days_in_provided_month(date.0.year, date.0.month) + date.0.days_in_month() } - #[cfg(feature = "unstable")] - fn add( - &self, - date: &Self::DateInner, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result { - date.0.added(duration, self, options).map(PersianDateInner) + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration) { + date.0.offset_date(offset, &()) } - #[cfg(feature = "unstable")] + #[allow(clippy::field_reassign_with_default)] fn until( &self, date1: &Self::DateInner, date2: &Self::DateInner, - options: DateDifferenceOptions, - ) -> Result { - Ok(date1.0.until(&date2.0, self, options)) + _calendar2: &Self, + _largest_unit: DateDurationUnit, + _smallest_unit: DateDurationUnit, + ) -> DateDuration { + date1.0.until(date2.0, _largest_unit, _smallest_unit) } fn year_info(&self, date: &Self::DateInner) -> Self::Year { - let extended_year = date.0.year; types::EraYear { era: tinystr!(16, "ap"), era_index: Some(0), - year: extended_year, - extended_year, + year: self.extended_year(date), ambiguity: types::YearAmbiguity::CenturyRequired, } } + fn extended_year(&self, date: &Self::DateInner) -> i32 { + date.0.extended_year() + } + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { - calendrical_calculations::persian::is_leap_year(date.0.year) + Self::provided_year_is_leap(date.0.year) } fn month(&self, date: &Self::DateInner) -> types::MonthInfo { - types::MonthInfo::non_lunisolar(date.0.month) + date.0.month() } fn day_of_month(&self, date: &Self::DateInner) -> types::DayOfMonth { - types::DayOfMonth(date.0.day) + date.0.day_of_month() } fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { - types::DayOfYear( - (date.0.month as u16 - 1) * 31 - (date.0.month as u16 - 1).saturating_sub(6) - + date.0.day as u16, - ) + date.0.day_of_year() } fn debug_name(&self) -> &'static str { @@ -250,7 +219,7 @@ impl Date { /// assert_eq!(date_persian.day_of_month().0, 25); /// ``` pub fn try_new_persian(year: i32, month: u8, day: u8) -> Result, RangeError> { - ArithmeticDate::try_from_ymd(year, month, day) + ArithmeticDate::new_from_ordinals(year, month, day) .map(PersianDateInner) .map(|inner| Date::from_raw(inner, Persian)) } @@ -389,6 +358,15 @@ mod tests { }, ]; + fn days_in_provided_year_core(year: i32) -> u16 { + let ny = + calendrical_calculations::persian::fixed_from_fast_persian(year, 1, 1).to_i64_date(); + let next_ny = calendrical_calculations::persian::fixed_from_fast_persian(year + 1, 1, 1) + .to_i64_date(); + + (next_ny - ny) as u16 + } + #[test] fn test_persian_leap_year() { let mut leap_years: [i32; 21] = [0; 21]; @@ -401,11 +379,8 @@ mod tests { for (index, case) in CASES.iter().enumerate() { leap_years[index] = case.year; } - for (&year, &is_leap) in leap_years.iter().zip(expected_values.iter()) { - assert_eq!( - Date::try_new_persian(year, 1, 1).unwrap().is_in_leap_year(), - is_leap - ); + for (year, bool) in leap_years.iter().zip(expected_values.iter()) { + assert_eq!(Persian::provided_year_is_leap(*year), *bool); } } @@ -413,12 +388,8 @@ mod tests { fn days_in_provided_year_test() { for case in CASES.iter() { assert_eq!( - Date::try_new_persian(case.year, 1, 1) - .unwrap() - .days_in_year(), - (calendrical_calculations::persian::fixed_from_fast_persian(case.year + 1, 1, 1) - - calendrical_calculations::persian::fixed_from_fast_persian(case.year, 1, 1)) - as u16 + days_in_provided_year_core(case.year), + Persian::days_in_provided_year(case.year) ); } } @@ -743,13 +714,13 @@ mod tests { #[test] fn test_calendar_ut_ac_ir_data() { - for &(p_year, leap, iso_year, iso_month, iso_day) in CALENDAR_UT_AC_IR_TEST_DATA.iter() { - let persian_date = Date::try_new_persian(p_year, 1, 1).unwrap(); - assert_eq!(persian_date.is_in_leap_year(), leap); - let iso_date = persian_date.to_iso(); - assert_eq!(iso_date.era_year().year, iso_year); - assert_eq!(iso_date.month().ordinal, iso_month); - assert_eq!(iso_date.day_of_month().0, iso_day); + for (p_year, leap, iso_year, iso_month, iso_day) in CALENDAR_UT_AC_IR_TEST_DATA.iter() { + assert_eq!(Persian::provided_year_is_leap(*p_year), *leap); + let persian_date = Date::try_new_persian(*p_year, 1, 1).unwrap(); + let iso_date = persian_date.to_calendar(Iso); + assert_eq!(iso_date.era_year().year, *iso_year); + assert_eq!(iso_date.month().ordinal, *iso_month); + assert_eq!(iso_date.day_of_month().0, *iso_day); } } } diff --git a/deps/crates/vendor/icu_calendar/src/cal/roc.rs b/deps/crates/vendor/icu_calendar/src/cal/roc.rs index 1ae6cdbf4e461c..1c81c0a2646620 100644 --- a/deps/crates/vendor/icu_calendar/src/cal/roc.rs +++ b/deps/crates/vendor/icu_calendar/src/cal/roc.rs @@ -2,63 +2,136 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::cal::abstract_gregorian::{impl_with_abstract_gregorian, GregorianYears}; -use crate::calendar_arithmetic::ArithmeticDate; -use crate::error::UnknownEraError; -use crate::preferences::CalendarAlgorithm; -use crate::{types, Date, DateError, RangeError}; +//! This module contains types and implementations for the Republic of China calendar. +//! +//! ```rust +//! use icu::calendar::{cal::Roc, Date}; +//! +//! let date_iso = Date::try_new_iso(1970, 1, 2) +//! .expect("Failed to initialize ISO Date instance."); +//! let date_roc = Date::new_from_iso(date_iso, Roc); +//! +//! assert_eq!(date_roc.era_year().year, 59); +//! assert_eq!(date_roc.month().ordinal, 1); +//! assert_eq!(date_roc.day_of_month().0, 2); +//! ``` + +use crate::error::year_check; +use crate::{ + cal::iso::IsoDateInner, calendar_arithmetic::ArithmeticDate, error::DateError, types, Calendar, + Date, Iso, RangeError, +}; +use calendrical_calculations::rata_die::RataDie; use tinystr::tinystr; +/// Year of the beginning of the Taiwanese (ROC/Minguo) calendar. +/// 1912 ISO = ROC 1 +const ROC_ERA_OFFSET: i32 = 1911; + /// The [Republic of China Calendar](https://en.wikipedia.org/wiki/Republic_of_China_calendar) /// -/// The ROC Calendar is a variant of the [`Gregorian`](crate::cal::Gregorian) calendar -/// created by the government of the Republic of China. It is identical to the Gregorian -/// calendar except that is uses the ROC/Minguo/民国/民國 Era (1912 CE) instead of the Common Era. -/// -/// This implementation extends proleptically for dates before the calendar's creation -/// in 1 Minguo (1912 CE). +/// The ROC calendar is a solar calendar used in Taiwan and Penghu, as well as by overseas diaspora from +/// those locations. Months and days are identical to the [`Gregorian`](super::Gregorian) calendar, while years are counted +/// with 1912, the year of the establishment of the Republic of China, as year 1 of the ROC/Minguo/民国/民國 era. /// -/// The ROC calendar should not be confused with the [`ChineseTraditional`](crate::cal::ChineseTraditional) -/// lunisolar calendar. -/// -/// This corresponds to the `"roc"` [CLDR calendar](https://unicode.org/reports/tr35/#UnicodeCalendarIdentifier). +/// The ROC calendar should not be confused with the Chinese traditional lunar calendar +/// (see [`Chinese`](crate::cal::Chinese)). /// /// # Era codes /// /// This calendar uses two era codes: `roc`, corresponding to years in the 民國 era (CE year 1912 and /// after), and `broc`, corresponding to years before the 民國 era (CE year 1911 and before). +/// +/// +/// # Month codes +/// +/// This calendar supports 12 solar month codes (`"M01" - "M12"`) #[derive(Copy, Clone, Debug, Default)] #[allow(clippy::exhaustive_structs)] // this type is stable pub struct Roc; -impl_with_abstract_gregorian!(crate::cal::Roc, RocDateInner, RocEra, _x, RocEra); - -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub(crate) struct RocEra; +/// The inner date type used for representing [`Date`]s of [`Roc`]. See [`Date`] and [`Roc`] for more info. +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +pub struct RocDateInner(IsoDateInner); -impl GregorianYears for RocEra { - const EXTENDED_YEAR_OFFSET: i32 = 1911; +impl crate::cal::scaffold::UnstableSealed for Roc {} +impl Calendar for Roc { + type DateInner = RocDateInner; + type Year = types::EraYear; - fn extended_from_era_year( + fn from_codes( &self, - era: Option<&[u8]>, + era: Option<&str>, year: i32, - ) -> Result { - match era { - None => Ok(year), - Some(b"roc") => Ok(year), - Some(b"broc") => Ok(1 - year), - Some(_) => Err(UnknownEraError), - } + month_code: crate::types::MonthCode, + day: u8, + ) -> Result { + let year = match era { + Some("roc") | None => ROC_ERA_OFFSET + year_check(year, 1..)?, + Some("broc") => ROC_ERA_OFFSET + 1 - year_check(year, 1..)?, + Some(_) => return Err(DateError::UnknownEra), + }; + + ArithmeticDate::new_from_codes(self, year, month_code, day) + .map(IsoDateInner) + .map(RocDateInner) + } + + fn from_rata_die(&self, rd: RataDie) -> Self::DateInner { + RocDateInner(Iso.from_rata_die(rd)) + } + + fn to_rata_die(&self, date: &Self::DateInner) -> RataDie { + Iso.to_rata_die(&date.0) + } + + fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner { + RocDateInner(iso) + } + + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { + date.0 + } + + fn months_in_year(&self, date: &Self::DateInner) -> u8 { + Iso.months_in_year(&date.0) + } + + fn days_in_year(&self, date: &Self::DateInner) -> u16 { + Iso.days_in_year(&date.0) } - fn era_year_from_extended(&self, extended_year: i32, _month: u8, _day: u8) -> types::EraYear { + fn days_in_month(&self, date: &Self::DateInner) -> u8 { + Iso.days_in_month(&date.0) + } + + fn offset_date(&self, date: &mut Self::DateInner, offset: crate::DateDuration) { + Iso.offset_date(&mut date.0, offset.cast_unit()) + } + + fn until( + &self, + date1: &Self::DateInner, + date2: &Self::DateInner, + _calendar2: &Self, + largest_unit: crate::DateDurationUnit, + smallest_unit: crate::DateDurationUnit, + ) -> crate::DateDuration { + Iso.until(&date1.0, &date2.0, &Iso, largest_unit, smallest_unit) + .cast_unit() + } + + fn debug_name(&self) -> &'static str { + "ROC" + } + + fn year_info(&self, date: &Self::DateInner) -> Self::Year { + let extended_year = self.extended_year(date); if extended_year > 0 { types::EraYear { era: tinystr!(16, "roc"), era_index: Some(1), year: extended_year, - extended_year, ambiguity: types::YearAmbiguity::CenturyRequired, } } else { @@ -66,18 +139,33 @@ impl GregorianYears for RocEra { era: tinystr!(16, "broc"), era_index: Some(0), year: 1 - extended_year, - extended_year, ambiguity: types::YearAmbiguity::EraAndCenturyRequired, } } } - fn debug_name(&self) -> &'static str { - "ROC" + fn extended_year(&self, date: &Self::DateInner) -> i32 { + Iso.extended_year(&date.0) - ROC_ERA_OFFSET + } + + fn is_in_leap_year(&self, date: &Self::DateInner) -> bool { + Iso.is_in_leap_year(&date.0) + } + + fn month(&self, date: &Self::DateInner) -> crate::types::MonthInfo { + Iso.month(&date.0) } - fn calendar_algorithm(&self) -> Option { - Some(CalendarAlgorithm::Roc) + fn day_of_month(&self, date: &Self::DateInner) -> crate::types::DayOfMonth { + Iso.day_of_month(&date.0) + } + + fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear { + Iso.day_of_year(&date.0) + } + + fn calendar_algorithm(&self) -> Option { + Some(crate::preferences::CalendarAlgorithm::Roc) } } @@ -97,7 +185,7 @@ impl Date { /// let date_roc = Date::try_new_roc(1, 2, 3) /// .expect("Failed to initialize ROC Date instance."); /// - /// assert_eq!(date_roc.era_year().era, "roc"); + /// assert_eq!(date_roc.era_year().era, tinystr!(16, "roc")); /// assert_eq!(date_roc.era_year().year, 1, "ROC year check failed!"); /// assert_eq!(date_roc.month().ordinal, 2, "ROC month check failed!"); /// assert_eq!(date_roc.day_of_month().0, 3, "ROC day of month check failed!"); @@ -109,9 +197,8 @@ impl Date { /// assert_eq!(date_gregorian.month().ordinal, 2, "Gregorian from ROC month check failed!"); /// assert_eq!(date_gregorian.day_of_month().0, 3, "Gregorian from ROC day of month check failed!"); pub fn try_new_roc(year: i32, month: u8, day: u8) -> Result, RangeError> { - ArithmeticDate::new_gregorian::(year, month, day) - .map(RocDateInner) - .map(|i| Date::from_raw(i, Roc)) + let iso_year = year.saturating_add(ROC_ERA_OFFSET); + Date::try_new_iso(iso_year, month, day).map(|d| Date::new_from_iso(d, Roc)) } } @@ -119,7 +206,6 @@ impl Date { mod test { use super::*; - use crate::cal::Iso; use calendrical_calculations::rata_die::RataDie; #[derive(Debug)] diff --git a/deps/crates/vendor/icu_calendar/src/calendar.rs b/deps/crates/vendor/icu_calendar/src/calendar.rs index 716121b5fac28c..5b0ea851d1388e 100644 --- a/deps/crates/vendor/icu_calendar/src/calendar.rs +++ b/deps/crates/vendor/icu_calendar/src/calendar.rs @@ -5,10 +5,8 @@ use calendrical_calculations::rata_die::RataDie; use crate::cal::iso::IsoDateInner; -use crate::error::{DateError, DateFromFieldsError}; -use crate::options::DateFromFieldsOptions; -use crate::options::{DateAddOptions, DateDifferenceOptions}; -use crate::{types, Iso}; +use crate::error::DateError; +use crate::{types, DateDuration, DateDurationUnit}; use core::fmt; /// A calendar implementation @@ -28,18 +26,14 @@ use core::fmt; /// pub trait Calendar: crate::cal::scaffold::UnstableSealed { /// The internal type used to represent dates - /// - /// Equality and ordering should observe normal calendar semantics. - type DateInner: Eq + Copy + PartialOrd + fmt::Debug; + type DateInner: Eq + Copy + fmt::Debug; /// The type of YearInfo returned by the date type Year: fmt::Debug + Into; - /// The type of error returned by `until` - type DifferenceError; /// Construct a date from era/month codes and fields /// - /// The year is the [extended year](crate::Date::extended_year) if no era is provided - #[expect(clippy::wrong_self_convention)] + /// The year is extended_year if no era is provided + #[allow(clippy::wrong_self_convention)] fn from_codes( &self, era: Option<&str>, @@ -48,44 +42,14 @@ pub trait Calendar: crate::cal::scaffold::UnstableSealed { day: u8, ) -> Result; - /// Construct a date from a bag of date fields. - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #7161](https://github.com/unicode-org/icu4x/issues/7161). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[expect(clippy::wrong_self_convention)] - #[cfg(feature = "unstable")] - fn from_fields( - &self, - fields: types::DateFields, - options: DateFromFieldsOptions, - ) -> Result; - - /// Whether `from_iso`/`to_iso` is more efficient - /// than `from_rata_die`/`to_rata_die`. - fn has_cheap_iso_conversion(&self) -> bool; - - /// Construct the date from an ISO date. - /// - /// Only called if `HAS_CHEAP_ISO_CONVERSION` is set. - #[expect(clippy::wrong_self_convention)] - fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner { - self.from_rata_die(Iso.to_rata_die(&iso)) - } - /// Obtain an ISO date from this date. - /// - /// Only called if `HAS_CHEAP_ISO_CONVERSION` is set. - fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner { - Iso.from_rata_die(self.to_rata_die(date)) - } + /// Construct the date from an ISO date + #[allow(clippy::wrong_self_convention)] + fn from_iso(&self, iso: IsoDateInner) -> Self::DateInner; + /// Obtain an ISO date from this date + fn to_iso(&self, date: &Self::DateInner) -> IsoDateInner; /// Construct the date from a [`RataDie`] - #[expect(clippy::wrong_self_convention)] + #[allow(clippy::wrong_self_convention)] fn from_rata_die(&self, rd: RataDie) -> Self::DateInner; /// Obtain a [`RataDie`] from this date fn to_rata_die(&self, date: &Self::DateInner) -> RataDie; @@ -104,11 +68,8 @@ pub trait Calendar: crate::cal::scaffold::UnstableSealed { /// Information about the year fn year_info(&self, date: &Self::DateInner) -> Self::Year; - - /// The [extended year](crate::Date::extended_year). - fn extended_year(&self, date: &Self::DateInner) -> i32 { - self.year_info(date).into().extended_year() - } + /// The extended year value + fn extended_year(&self, date: &Self::DateInner) -> i32; /// The calendar-specific month represented by `date` fn month(&self, date: &Self::DateInner) -> types::MonthInfo; /// The calendar-specific day-of-month represented by `date` @@ -116,44 +77,22 @@ pub trait Calendar: crate::cal::scaffold::UnstableSealed { /// Information of the day of the year fn day_of_year(&self, date: &Self::DateInner) -> types::DayOfYear; - /// Add `duration` to `date` - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #3964](https://github.com/unicode-org/icu4x/issues/3964). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[cfg(feature = "unstable")] - fn add( - &self, - date: &Self::DateInner, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result; - + #[doc(hidden)] // unstable + /// Add `offset` to `date` + fn offset_date(&self, date: &mut Self::DateInner, offset: DateDuration); + #[doc(hidden)] // unstable /// Calculate `date2 - date` as a duration /// /// `calendar2` is the calendar object associated with `date2`. In case the specific calendar objects /// differ on data, the data for the first calendar is used, and `date2` may be converted if necessary. - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #3964](https://github.com/unicode-org/icu4x/issues/3964). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[cfg(feature = "unstable")] fn until( &self, date1: &Self::DateInner, date2: &Self::DateInner, - options: DateDifferenceOptions, - ) -> Result; + calendar2: &Self, + largest_unit: DateDurationUnit, + smallest_unit: DateDurationUnit, + ) -> DateDuration; /// Returns the [`CalendarAlgorithm`](crate::preferences::CalendarAlgorithm) that is required to match /// when parsing into this calendar. diff --git a/deps/crates/vendor/icu_calendar/src/calendar_arithmetic.rs b/deps/crates/vendor/icu_calendar/src/calendar_arithmetic.rs index 3e3078d11f663c..fc1da7d8c6823a 100644 --- a/deps/crates/vendor/icu_calendar/src/calendar_arithmetic.rs +++ b/deps/crates/vendor/icu_calendar/src/calendar_arithmetic.rs @@ -2,78 +2,66 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::duration::{DateDuration, DateDurationUnit}; -use crate::error::{ - range_check, range_check_with_overflow, DateFromFieldsError, EcmaReferenceYearError, - MonthCodeError, MonthCodeParseError, UnknownEraError, -}; -use crate::options::{DateAddOptions, DateDifferenceOptions}; -use crate::options::{DateFromFieldsOptions, MissingFieldsStrategy, Overflow}; -use crate::types::{DateFields, ValidMonthCode}; -use crate::{types, Calendar, DateError, RangeError}; +use crate::error::DateError; +use crate::types::DayOfYear; +use crate::{types, Calendar, DateDuration, DateDurationUnit, RangeError}; use core::cmp::Ordering; +use core::convert::TryInto; use core::fmt::Debug; use core::hash::{Hash, Hasher}; -use core::ops::RangeInclusive; - -/// The range ±2²⁷. We use i32::MIN since it is -2³¹ -/// -/// This range is currently global, and applied to both era years and -/// extended years, but may be replaced with a per-calendar check in the future. -/// -/// -const VALID_YEAR_RANGE: RangeInclusive = (i32::MIN / 16)..=-(i32::MIN / 16); +use core::marker::PhantomData; +use tinystr::tinystr; #[derive(Debug)] -pub(crate) struct ArithmeticDate { +#[allow(clippy::exhaustive_structs)] // this type is stable +pub(crate) struct ArithmeticDate { pub year: C::YearInfo, /// 1-based month of year pub month: u8, /// 1-based day of month pub day: u8, + marker: PhantomData, } // Manual impls since the derive will introduce a C: Trait bound // and only the year value should be compared -impl Copy for ArithmeticDate {} -impl Clone for ArithmeticDate { +impl Copy for ArithmeticDate {} +impl Clone for ArithmeticDate { fn clone(&self) -> Self { *self } } -impl PartialEq for ArithmeticDate { +impl PartialEq for ArithmeticDate { fn eq(&self, other: &Self) -> bool { - self.year.to_extended_year() == other.year.to_extended_year() - && self.month == other.month - && self.day == other.day + self.year.into() == other.year.into() && self.month == other.month && self.day == other.day } } -impl Eq for ArithmeticDate {} +impl Eq for ArithmeticDate {} -impl Ord for ArithmeticDate { +impl Ord for ArithmeticDate { fn cmp(&self, other: &Self) -> Ordering { self.year - .to_extended_year() - .cmp(&other.year.to_extended_year()) + .into() + .cmp(&other.year.into()) .then(self.month.cmp(&other.month)) .then(self.day.cmp(&other.day)) } } -impl PartialOrd for ArithmeticDate { +impl PartialOrd for ArithmeticDate { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } -impl Hash for ArithmeticDate { +impl Hash for ArithmeticDate { fn hash(&self, state: &mut H) where H: Hasher, { - self.year.to_extended_year().hash(state); + self.year.into().hash(state); self.month.hash(state); self.day.hash(state); } @@ -83,613 +71,341 @@ impl Hash for ArithmeticDate { #[allow(dead_code)] // TODO: Remove dead code tag after use pub(crate) const MAX_ITERS_FOR_DAYS_OF_MONTH: u8 = 33; -pub(crate) trait ToExtendedYear { - fn to_extended_year(&self) -> i32; -} - -impl ToExtendedYear for i32 { - fn to_extended_year(&self) -> i32 { - *self - } -} - -/// Trait for converting from era codes, month codes, and other fields to year/month/day ordinals. -pub(crate) trait DateFieldsResolver: Calendar { +pub(crate) trait CalendarArithmetic: Calendar { /// This stores the year as either an i32, or a type containing more /// useful computational information. - type YearInfo: Copy + Debug + PartialEq + ToExtendedYear; + type YearInfo: Copy + Debug + Into; + // TODO(#3933): potentially make these methods take &self instead, and absorb certain y/m parameters + // based on usage patterns (e.g month_days is only ever called with self.year) fn days_in_provided_month(year: Self::YearInfo, month: u8) -> u8; - fn months_in_provided_year(year: Self::YearInfo) -> u8; + fn provided_year_is_leap(year: Self::YearInfo) -> bool; + fn last_month_day_in_provided_year(year: Self::YearInfo) -> (u8, u8); - /// Converts the era and era year to a YearInfo. If the calendar does not have eras, - /// this should always return an Err result. - fn year_info_from_era( - &self, - era: &[u8], - era_year: i32, - ) -> Result; - - /// Converts an extended year to a YearInfo. - fn year_info_from_extended(&self, extended_year: i32) -> Self::YearInfo; - - /// Calculates the ECMA reference year for the month code and day, or an error - /// if the month code and day are invalid. - /// - /// Note that this is called before any potential Overflow::Constrain application, - /// so this should accept out-of-range day values as if they are the highest possible - /// day for the given month. - fn reference_year_from_month_day( - &self, - month_code: ValidMonthCode, - day: u8, - ) -> Result; - - /// Calculates the ordinal month for the given year and month code. + /// Calculate the days in a given year + /// Can be overridden with simpler implementations for solar calendars + /// (typically, 366 in leap, 365 otherwise) Leave this as the default + /// for lunar calendars /// - /// The default impl is for non-lunisolar calendars with 12 months! - #[inline] - fn ordinal_month_from_code( - &self, - _year: &Self::YearInfo, - month_code: ValidMonthCode, - _options: DateFromFieldsOptions, - ) -> Result { - match month_code.to_tuple() { - (month_number @ 1..=12, false) => Ok(month_number), - _ => Err(MonthCodeError::NotInCalendar), + /// The name has `provided` in it to avoid clashes with Calendar + fn days_in_provided_year(year: Self::YearInfo) -> u16 { + let months_in_year = Self::months_in_provided_year(year); + let mut days: u16 = 0; + for month in 1..=months_in_year { + days += Self::days_in_provided_month(year, month) as u16; } + days } +} - /// Calculates the month code from the given ordinal month and year. - /// - /// The caller must ensure that the ordinal is in range. +pub(crate) trait PrecomputedDataSource { + /// Given a calendar year, load (or compute) the YearInfo for it /// - /// The default impl is for non-lunisolar calendars! - #[inline] - fn month_code_from_ordinal(&self, _year: &Self::YearInfo, ordinal_month: u8) -> ValidMonthCode { - ValidMonthCode::new_unchecked(ordinal_month, false) + /// In the future we may pass in an optional previous YearInfo alongside the year + /// it matches to allow code to take shortcuts. + fn load_or_compute_info(&self, year: i32) -> YearInfo; +} + +impl PrecomputedDataSource for () { + fn load_or_compute_info(&self, year: i32) -> i32 { + year } } -impl ArithmeticDate { +impl ArithmeticDate { + /// Create a new `ArithmeticDate` without checking that `month` and `day` are in bounds. #[inline] - pub(crate) const fn new_unchecked(year: C::YearInfo, month: u8, day: u8) -> Self { - ArithmeticDate { year, month, day } + pub const fn new_unchecked(year: C::YearInfo, month: u8, day: u8) -> Self { + ArithmeticDate { + year, + month, + day, + marker: PhantomData, + } } - pub(crate) const fn cast>( - self, - ) -> ArithmeticDate { + #[inline] + pub fn min_date() -> Self + where + C: CalendarArithmetic, + { ArithmeticDate { - year: self.year, - month: self.month, - day: self.day, + year: i32::MIN, + month: 1, + day: 1, + marker: PhantomData, } } - pub(crate) fn from_codes( - era: Option<&str>, - year: i32, - month_code: types::MonthCode, - day: u8, - calendar: &C, - ) -> Result { - let year = range_check(year, "year", VALID_YEAR_RANGE)?; - let year = if let Some(era) = era { - calendar.year_info_from_era(era.as_bytes(), year)? - } else { - calendar.year_info_from_extended(year) - }; - let validated = - ValidMonthCode::try_from_utf8(month_code.0.as_bytes()).map_err(|e| match e { - MonthCodeParseError::InvalidSyntax => DateError::UnknownMonthCode(month_code), - })?; - let month = calendar - .ordinal_month_from_code(&year, validated, Default::default()) - .map_err(|e| match e { - MonthCodeError::NotInCalendar | MonthCodeError::NotInYear => { - DateError::UnknownMonthCode(month_code) - } - })?; - - let day = range_check(day, "day", 1..=C::days_in_provided_month(year, month))?; - - Ok(ArithmeticDate::new_unchecked(year, month, day)) + #[inline] + pub fn max_date() -> Self + where + C: CalendarArithmetic, + { + let year = i32::MAX; + let (month, day) = C::last_month_day_in_provided_year(year); + ArithmeticDate { + year: i32::MAX, + month, + day, + marker: PhantomData, + } } - pub(crate) fn from_fields( - fields: DateFields, - options: DateFromFieldsOptions, - calendar: &C, - ) -> Result { - let missing_fields_strategy = options.missing_fields_strategy.unwrap_or_default(); - - let day = match fields.day { - Some(day) => day, - None => match missing_fields_strategy { - MissingFieldsStrategy::Reject => return Err(DateFromFieldsError::NotEnoughFields), - MissingFieldsStrategy::Ecma => { - if fields.extended_year.is_some() || fields.era_year.is_some() { - // The ECMAScript strategy is to pick day 1, always, regardless of whether - // that day exists for the month/year combo - 1 - } else { - return Err(DateFromFieldsError::NotEnoughFields); - } - } - }, - }; - - if fields.month_code.is_none() && fields.ordinal_month.is_none() { - // We're returning this error early so that we return structural type - // errors before range errors, see comment in the year code below. - return Err(DateFromFieldsError::NotEnoughFields); + #[inline] + fn offset_days(&mut self, mut day_offset: i32, data: &impl PrecomputedDataSource) { + while day_offset != 0 { + let month_days = C::days_in_provided_month(self.year, self.month); + if self.day as i32 + day_offset > month_days as i32 { + self.offset_months(1, data); + day_offset -= month_days as i32; + } else if self.day as i32 + day_offset < 1 { + self.offset_months(-1, data); + day_offset += C::days_in_provided_month(self.year, self.month) as i32; + } else { + self.day = (self.day as i32 + day_offset) as u8; + day_offset = 0; + } } + } - let mut valid_month_code = None; - - // NOTE: The year/extendedyear range check is important to avoid arithmetic - // overflow in `year_info_from_era` and `year_info_from_extended`. It - // must happen before they are called. - // - // To better match the Temporal specification's order of operations, we try - // to return structural type errors (`NotEnoughFields`) before checking for range errors. - // This isn't behavior we *must* have, but it is not much additional work to maintain - // so we make an attempt. - let year = match (fields.era, fields.era_year) { - (None, None) => match fields.extended_year { - Some(extended_year) => calendar.year_info_from_extended(range_check( - extended_year, - "year", - VALID_YEAR_RANGE, - )?), - None => match missing_fields_strategy { - MissingFieldsStrategy::Reject => { - return Err(DateFromFieldsError::NotEnoughFields) - } - MissingFieldsStrategy::Ecma => { - match (fields.month_code, fields.ordinal_month) { - (Some(month_code), None) => { - let validated = ValidMonthCode::try_from_utf8(month_code)?; - valid_month_code = Some(validated); - calendar.reference_year_from_month_day(validated, day)? - } - _ => return Err(DateFromFieldsError::NotEnoughFields), - } - } - }, - }, - (Some(era), Some(era_year)) => { - let era_year_as_year_info = calendar - .year_info_from_era(era, range_check(era_year, "year", VALID_YEAR_RANGE)?)?; - if let Some(extended_year) = fields.extended_year { - if era_year_as_year_info - != calendar.year_info_from_extended(range_check( - extended_year, - "year", - VALID_YEAR_RANGE, - )?) - { - return Err(DateFromFieldsError::InconsistentYear); - } - } - era_year_as_year_info + #[inline] + fn offset_months( + &mut self, + mut month_offset: i32, + data: &impl PrecomputedDataSource, + ) { + while month_offset != 0 { + let year_months = C::months_in_provided_year(self.year); + if self.month as i32 + month_offset > year_months as i32 { + self.year = data.load_or_compute_info(self.year.into() + 1); + month_offset -= year_months as i32; + } else if self.month as i32 + month_offset < 1 { + self.year = data.load_or_compute_info(self.year.into() - 1); + month_offset += C::months_in_provided_year(self.year) as i32; + } else { + self.month = (self.month as i32 + month_offset) as u8; + month_offset = 0 } - // Era and Era Year must be both or neither - (Some(_), None) | (None, Some(_)) => return Err(DateFromFieldsError::NotEnoughFields), - }; + } + } - let month = match fields.month_code { - Some(month_code) => { - let validated = match valid_month_code { - Some(validated) => validated, - None => ValidMonthCode::try_from_utf8(month_code)?, - }; - let computed_month = calendar.ordinal_month_from_code(&year, validated, options)?; - if let Some(ordinal_month) = fields.ordinal_month { - if computed_month != ordinal_month { - return Err(DateFromFieldsError::InconsistentMonth); - } - } - computed_month - } - None => match fields.ordinal_month { - Some(month) => month, - None => { - debug_assert!(false, "Already checked above"); - return Err(DateFromFieldsError::NotEnoughFields); - } - }, - }; + #[inline] + pub fn offset_date( + &mut self, + offset: DateDuration, + data: &impl PrecomputedDataSource, + ) { + if offset.years != 0 { + // For offset_date to work with lunar calendars, need to handle an edge case where the original month is not valid in the future year. + self.year = data.load_or_compute_info(self.year.into() + offset.years); + } - let constrained_month = range_check_with_overflow( - month, - "month", - 1..=C::months_in_provided_year(year), - options.overflow.unwrap_or_default(), - )?; - Ok(Self::new_unchecked( - year, - constrained_month, - range_check_with_overflow( - day, - "day", - 1..=C::days_in_provided_month(year, constrained_month), - options.overflow.unwrap_or_default(), - )?, - )) + self.offset_months(offset.months, data); + + let day_offset = offset.days + offset.weeks * 7 + self.day as i32 - 1; + self.day = 1; + self.offset_days(day_offset, data); + } + + #[inline] + pub fn until( + &self, + date2: ArithmeticDate, + _largest_unit: DateDurationUnit, + _smaller_unit: DateDurationUnit, + ) -> DateDuration { + // This simple implementation does not need C::PrecomputedDataSource right now, but it + // likely will once we've written a proper implementation + DateDuration::new( + self.year.into() - date2.year.into(), + self.month as i32 - date2.month as i32, + 0, + self.day as i32 - date2.day as i32, + ) } - pub(crate) fn try_from_ymd(year: C::YearInfo, month: u8, day: u8) -> Result { - range_check(month, "month", 1..=C::months_in_provided_year(year))?; - range_check(day, "day", 1..=C::days_in_provided_month(year, month))?; - Ok(ArithmeticDate::new_unchecked(year, month, day)) + #[inline] + pub fn days_in_year(&self) -> u16 { + C::days_in_provided_year(self.year) } - /// Implements the Temporal abstract operation BalanceNonISODate. - /// - /// This takes a year, month, and day, where the month and day might be out of range, then - /// balances excess months into the year field and excess days into the month field. - pub(crate) fn new_balanced(year: C::YearInfo, ordinal_month: i64, day: i64, cal: &C) -> Self { - // 1. Let _resolvedYear_ be _arithmeticYear_. - // 1. Let _resolvedMonth_ be _ordinalMonth_. - let mut resolved_year = year; - let mut resolved_month = ordinal_month; - // 1. Let _monthsInYear_ be CalendarMonthsInYear(_calendar_, _resolvedYear_). - let mut months_in_year = C::months_in_provided_year(resolved_year); - // 1. Repeat, while _resolvedMonth_ ≤ 0, - // 1. Set _resolvedYear_ to _resolvedYear_ - 1. - // 1. Set _monthsInYear_ to CalendarMonthsInYear(_calendar_, _resolvedYear_). - // 1. Set _resolvedMonth_ to _resolvedMonth_ + _monthsInYear_. - while resolved_month <= 0 { - resolved_year = cal.year_info_from_extended(resolved_year.to_extended_year() - 1); - months_in_year = C::months_in_provided_year(resolved_year); - resolved_month += i64::from(months_in_year); - } - // 1. Repeat, while _resolvedMonth_ > _monthsInYear_, - // 1. Set _resolvedMonth_ to _resolvedMonth_ - _monthsInYear_. - // 1. Set _resolvedYear_ to _resolvedYear_ + 1. - // 1. Set _monthsInYear_ to CalendarMonthsInYear(_calendar_, _resolvedYear_). - while resolved_month > i64::from(months_in_year) { - resolved_month -= i64::from(months_in_year); - resolved_year = cal.year_info_from_extended(resolved_year.to_extended_year() + 1); - months_in_year = C::months_in_provided_year(resolved_year); - } - debug_assert!(u8::try_from(resolved_month).is_ok()); - let mut resolved_month = resolved_month as u8; - // 1. Let _resolvedDay_ be _day_. - let mut resolved_day = day; - // 1. Let _daysInMonth_ be CalendarDaysInMonth(_calendar_, _resolvedYear_, _resolvedMonth_). - let mut days_in_month = C::days_in_provided_month(resolved_year, resolved_month); - // 1. Repeat, while _resolvedDay_ ≤ 0, - while resolved_day <= 0 { - // 1. Set _resolvedMonth_ to _resolvedMonth_ - 1. - // 1. If _resolvedMonth_ is 0, then - resolved_month -= 1; - if resolved_month == 0 { - // 1. Set _resolvedYear_ to _resolvedYear_ - 1. - // 1. Set _monthsInYear_ to CalendarMonthsInYear(_calendar_, _resolvedYear_). - // 1. Set _resolvedMonth_ to _monthsInYear_. - resolved_year = cal.year_info_from_extended(resolved_year.to_extended_year() - 1); - months_in_year = C::months_in_provided_year(resolved_year); - resolved_month = months_in_year; + #[inline] + pub fn months_in_year(&self) -> u8 { + C::months_in_provided_year(self.year) + } + + #[inline] + pub fn days_in_month(&self) -> u8 { + C::days_in_provided_month(self.year, self.month) + } + + #[inline] + pub fn date_from_year_day(year: i32, year_day: u32) -> ArithmeticDate + where + C: CalendarArithmetic, + { + let mut month = 1; + let mut day = year_day as i32; + while month <= C::months_in_provided_year(year) { + let month_days = C::days_in_provided_month(year, month) as i32; + if day <= month_days { + break; + } else { + day -= month_days; + month += 1; } - // 1. Set _daysInMonth_ to CalendarDaysInMonth(_calendar_, _resolvedYear_, _resolvedMonth_). - // 1. Set _resolvedDay_ to _resolvedDay_ + _daysInMonth_. - days_in_month = C::days_in_provided_month(resolved_year, resolved_month); - resolved_day += i64::from(days_in_month); } - // 1. Repeat, while _resolvedDay_ > _daysInMonth_, - while resolved_day > i64::from(days_in_month) { - // 1. Set _resolvedDay_ to _resolvedDay_ - _daysInMonth_. - // 1. Set _resolvedMonth_ to _resolvedMonth_ + 1. - // 1. If _resolvedMonth_ > _monthsInYear_, then - resolved_day -= i64::from(days_in_month); - resolved_month += 1; - if resolved_month > months_in_year { - // 1. Set _resolvedYear_ to _resolvedYear_ + 1. - // 1. Set _monthsInYear_ to CalendarMonthsInYear(_calendar_, _resolvedYear_). - // 1. Set _resolvedMonth_ to 1. - resolved_year = cal.year_info_from_extended(resolved_year.to_extended_year() + 1); - months_in_year = C::months_in_provided_year(resolved_year); - resolved_month = 1; - } - // 1. Set _daysInMonth_ to CalendarDaysInMonth(_calendar_, _resolvedYear_, _resolvedMonth_). - days_in_month = C::days_in_provided_month(resolved_year, resolved_month); + + debug_assert!(day <= C::days_in_provided_month(year, month) as i32); + #[allow(clippy::unwrap_used)] + // The day is expected to be within the range of month_days of C + ArithmeticDate { + year, + month, + day: day.try_into().unwrap_or(1), + marker: PhantomData, } - debug_assert!(u8::try_from(resolved_day).is_ok()); - let resolved_day = resolved_day as u8; - // 1. Return the Record { [[Year]]: _resolvedYear_, [[Month]]: _resolvedMonth_, [[Day]]: _resolvedDay_ }. - Self::new_unchecked(resolved_year, resolved_month, resolved_day) } - /// Implements the Temporal abstract operation NonISODateSurpasses. - /// - /// This takes two dates (`self` and `other`), `duration`, and `sign` (either -1 or 1), then - /// returns whether adding the duration to `self` results in a year/month/day that exceeds - /// `other` in the direction indicated by `sign`, constraining the month but not the day. - pub(crate) fn surpasses( - &self, - other: &Self, - duration: DateDuration, - sign: i64, - cal: &C, - ) -> bool { - // 1. Let _parts_ be CalendarISOToDate(_calendar_, _fromIsoDate_). - // 1. Let _y0_ be _parts_.[[Year]] + _years_. - let y0 = cal.year_info_from_extended(duration.add_years_to(self.year.to_extended_year())); - // 1. Let _m0_ be MonthCodeToOrdinal(_calendar_, _y0_, ! ConstrainMonthCode(_calendar_, _y0_, _parts_.[[MonthCode]], ~constrain~)). - let base_month_code = cal.month_code_from_ordinal(&self.year, self.month); - let constrain = DateFromFieldsOptions { - overflow: Some(Overflow::Constrain), - ..Default::default() - }; - let m0_result = cal.ordinal_month_from_code(&y0, base_month_code, constrain); - let m0 = match m0_result { - Ok(m0) => m0, - Err(_) => { - debug_assert!( - false, - "valid month code for calendar, and constrained to the year" - ); - 1 - } - }; - // 1. Let _endOfMonth_ be BalanceNonISODate(_calendar_, _y0_, _m0_ + _months_ + 1, 0). - let end_of_month = Self::new_balanced(y0, duration.add_months_to(m0) + 1, 0, cal); - // 1. Let _baseDay_ be _parts_.[[Day]]. - let base_day = self.day; - let y1; - let m1; - let d1; - // 1. If _weeks_ is not 0 or _days_ is not 0, then - if duration.weeks != 0 || duration.days != 0 { - // 1. If _baseDay_ < _endOfMonth_.[[Day]], then - // 1. Let _regulatedDay_ be _baseDay_. - // 1. Else, - // 1. Let _regulatedDay_ be _endOfMonth_.[[Day]]. - let regulated_day = if base_day < end_of_month.day { - base_day - } else { - end_of_month.day - }; - // 1. Let _balancedDate_ be BalanceNonISODate(_calendar_, _endOfMonth_.[[Year]], _endOfMonth_.[[Month]], _regulatedDay_ + 7 * _weeks_ + _days_). - // 1. Let _y1_ be _balancedDate_.[[Year]]. - // 1. Let _m1_ be _balancedDate_.[[Month]]. - // 1. Let _d1_ be _balancedDate_.[[Day]]. - let balanced_date = Self::new_balanced( - end_of_month.year, - i64::from(end_of_month.month), - duration.add_weeks_and_days_to(regulated_day), - cal, - ); - y1 = balanced_date.year; - m1 = balanced_date.month; - d1 = balanced_date.day; - } else { - // 1. Else, - // 1. Let _y1_ be _endOfMonth_.[[Year]]. - // 1. Let _m1_ be _endOfMonth_.[[Month]]. - // 1. Let _d1_ be _baseDay_. - y1 = end_of_month.year; - m1 = end_of_month.month; - d1 = base_day; - } - // 1. Let _calDate2_ be CalendarISOToDate(_calendar_, _toIsoDate_). - // 1. If _y1_ ≠ _calDate2_.[[Year]], then - // 1. If _sign_ × (_y1_ - _calDate2_.[[Year]]) > 0, return *true*. - // 1. Else if _m1_ ≠ _calDate2_.[[Month]], then - // 1. If _sign_ × (_m1_ - _calDate2_.[[Month]]) > 0, return *true*. - // 1. Else if _d1_ ≠ _calDate2_.[[Day]], then - // 1. If _sign_ × (_d1_ - _calDate2_.[[Day]]) > 0, return *true*. - #[allow(clippy::collapsible_if)] // to align with the spec - if y1 != other.year { - if sign * (i64::from(y1.to_extended_year()) - i64::from(other.year.to_extended_year())) - > 0 - { - return true; - } - } else if m1 != other.month { - if sign * (i64::from(m1) - i64::from(other.month)) > 0 { - return true; - } - } else if d1 != other.day { - if sign * (i64::from(d1) - i64::from(other.day)) > 0 { - return true; - } + #[inline] + pub fn day_of_month(&self) -> types::DayOfMonth { + types::DayOfMonth(self.day) + } + + #[inline] + pub fn day_of_year(&self) -> DayOfYear { + let mut day_of_year = 0; + for month in 1..self.month { + day_of_year += C::days_in_provided_month(self.year, month) as u16; } - // 1. Return *false*. - false + DayOfYear(day_of_year + (self.day as u16)) + } + + pub fn extended_year(&self) -> i32 { + self.year.into() } - /// Implements the Temporal abstract operation NonISODateAdd. + /// The [`types::MonthInfo`] for the current month (with month code) for a solar calendar + /// Lunar calendars should not use this method and instead manually implement a month code + /// resolver. + /// Originally "solar_month" but renamed because it can be used for some lunar calendars /// - /// This takes a date (`self`) and `duration`, then returns a new date resulting from - /// adding `duration` to `self`, constrained according to `options`. - pub(crate) fn added( - &self, - duration: DateDuration, - cal: &C, - options: DateAddOptions, - ) -> Result { - // 1. Let _parts_ be CalendarISOToDate(_calendar_, _isoDate_). - // 1. Let _y0_ be _parts_.[[Year]] + _duration_.[[Years]]. - let y0 = cal.year_info_from_extended(duration.add_years_to(self.year.to_extended_year())); - // 1. Let _m0_ be MonthCodeToOrdinal(_calendar_, _y0_, ! ConstrainMonthCode(_calendar_, _y0_, _parts_.[[MonthCode]], _overflow_)). - let base_month = cal.month_code_from_ordinal(&self.year, self.month); - let m0 = cal - .ordinal_month_from_code( - &y0, - base_month, - DateFromFieldsOptions::from_add_options(options), - ) - .map_err(|e| { - // TODO: Use a narrower error type here. For now, convert into DateError. - match e { - MonthCodeError::NotInCalendar => { - DateError::UnknownMonthCode(base_month.to_month_code()) - } - MonthCodeError::NotInYear => { - DateError::UnknownMonthCode(base_month.to_month_code()) - } - } - })?; - // 1. Let _endOfMonth_ be BalanceNonISODate(_calendar_, _y0_, _m0_ + _duration_.[[Months]] + 1, 0). - let end_of_month = Self::new_balanced(y0, duration.add_months_to(m0) + 1, 0, cal); - // 1. Let _baseDay_ be _parts_.[[Day]]. - let base_day = self.day; - // 1. If _baseDay_ < _endOfMonth_.[[Day]], then - // 1. Let _regulatedDay_ be _baseDay_. - let regulated_day = if base_day < end_of_month.day { - base_day - } else { - // 1. Else, - // 1. If _overflow_ is ~reject~, throw a *RangeError* exception. - // Note: ICU4X default is constrain here - if matches!(options.overflow, Some(Overflow::Reject)) { - return Err(DateError::Range { - field: "day", - value: i32::from(base_day), - min: 1, - max: i32::from(end_of_month.day), - }); - } - end_of_month.day + /// Returns "und" if run with months that are out of bounds for the current + /// calendar. + #[inline] + pub fn month(&self) -> types::MonthInfo { + let code = match self.month { + a if a > C::months_in_provided_year(self.year) => tinystr!(4, "und"), + 1 => tinystr!(4, "M01"), + 2 => tinystr!(4, "M02"), + 3 => tinystr!(4, "M03"), + 4 => tinystr!(4, "M04"), + 5 => tinystr!(4, "M05"), + 6 => tinystr!(4, "M06"), + 7 => tinystr!(4, "M07"), + 8 => tinystr!(4, "M08"), + 9 => tinystr!(4, "M09"), + 10 => tinystr!(4, "M10"), + 11 => tinystr!(4, "M11"), + 12 => tinystr!(4, "M12"), + 13 => tinystr!(4, "M13"), + _ => tinystr!(4, "und"), }; - // 1. Let _balancedDate_ be BalanceNonISODate(_calendar_, _endOfMonth_.[[Year]], _endOfMonth_.[[Month]], _regulatedDay_ + 7 * _duration_.[[Weeks]] + _duration_.[[Days]]). - // 1. Let _result_ be ? CalendarIntegersToISO(_calendar_, _balancedDate_.[[Year]], _balancedDate_.[[Month]], _balancedDate_.[[Day]]). - // 1. Return _result_. - Ok(Self::new_balanced( - end_of_month.year, - i64::from(end_of_month.month), - duration.add_weeks_and_days_to(regulated_day), - cal, - )) + types::MonthInfo { + ordinal: self.month, + standard_code: types::MonthCode(code), + formatting_code: types::MonthCode(code), + } } - /// Implements the Temporal abstract operation NonISODateUntil. - /// - /// This takes a duration (`self`) and a date (`other`), then returns a duration that, when - /// added to `self`, results in `other`, with largest unit according to `options`. - pub(crate) fn until( - &self, - other: &Self, - cal: &C, - options: DateDifferenceOptions, - ) -> DateDuration { - // 1. Let _sign_ be -1 × CompareISODate(_one_, _two_). - // 1. If _sign_ = 0, return ZeroDateDuration(). - let sign = match other.cmp(self) { - Ordering::Greater => 1i64, - Ordering::Equal => return DateDuration::default(), - Ordering::Less => -1i64, + /// Construct a new arithmetic date from a year, month code, and day, bounds checking + /// the month and day + /// Originally (new_from_solar_codes) but renamed because it works for some lunar calendars + pub fn new_from_codes( + // Separate type since the debug_name() impl may differ when DateInner types + // are nested (e.g. in GregorianDateInner) + _cal: &C2, + year: i32, + month_code: types::MonthCode, + day: u8, + ) -> Result + where + C: CalendarArithmetic, + { + let month = if let Some((ordinal, false)) = month_code.parsed() { + ordinal + } else { + return Err(DateError::UnknownMonthCode(month_code)); }; - // 1. Let _years_ be 0. - // 1. If _largestUnit_ is ~year~, then - // 1. Let _candidateYears_ be _sign_. - // 1. Repeat, while NonISODateSurpasses(_calendar_, _sign_, _one_, _two_, _candidateYears_, 0, 0, 0) is *false*, - // 1. Set _years_ to _candidateYears_. - // 1. Set _candidateYears_ to _candidateYears_ + _sign_. - let mut years = 0; - if matches!(options.largest_unit, Some(DateDurationUnit::Years)) { - let mut candidate_years = sign; - while !self.surpasses( - other, - DateDuration::from_signed_ymwd(candidate_years, 0, 0, 0), - sign, - cal, - ) { - years = candidate_years; - candidate_years += sign; - } + + if month > C::months_in_provided_year(year) { + return Err(DateError::UnknownMonthCode(month_code)); } - // 1. Let _months_ be 0. - // 1. If _largestUnit_ is ~year~ or _largestUnit_ is ~month~, then - // 1. Let _candidateMonths_ be _sign_. - // 1. Repeat, while NonISODateSurpasses(_calendar_, _sign_, _one_, _two_, _years_, _candidateMonths_, 0, 0) is *false*, - // 1. Set _months_ to _candidateMonths_. - // 1. Set _candidateMonths_ to _candidateMonths_ + _sign_. - let mut months = 0; - if matches!( - options.largest_unit, - Some(DateDurationUnit::Years) | Some(DateDurationUnit::Months) - ) { - let mut candidate_months = sign; - while !self.surpasses( - other, - DateDuration::from_signed_ymwd(years, candidate_months, 0, 0), - sign, - cal, - ) { - months = candidate_months; - candidate_months += sign; - } + + let max_day = C::days_in_provided_month(year, month); + if day == 0 || day > max_day { + return Err(DateError::Range { + field: "day", + value: day as i32, + min: 1, + max: max_day as i32, + }); } - // 1. Let _weeks_ be 0. - // 1. If _largestUnit_ is ~week~, then - // 1. Let _candidateWeeks_ be _sign_. - // 1. Repeat, while NonISODateSurpasses(_calendar_, _sign_, _one_, _two_, _years_, _months_, _candidateWeeks_, 0) is *false*, - // 1. Set _weeks_ to _candidateWeeks_. - // 1. Set _candidateWeeks_ to _candidateWeeks_ + sign. - let mut weeks = 0; - if matches!(options.largest_unit, Some(DateDurationUnit::Weeks)) { - let mut candidate_weeks = sign; - while !self.surpasses( - other, - DateDuration::from_signed_ymwd(years, months, candidate_weeks, 0), - sign, - cal, - ) { - weeks = candidate_weeks; - candidate_weeks += sign; - } + + Ok(Self::new_unchecked(year, month, day)) + } + + /// Construct a new arithmetic date from a year, month ordinal, and day, bounds checking + /// the month and day + pub fn new_from_ordinals(year: C::YearInfo, month: u8, day: u8) -> Result { + let max_month = C::months_in_provided_year(year); + if month == 0 || month > max_month { + return Err(RangeError { + field: "month", + value: month as i32, + min: 1, + max: max_month as i32, + }); } - // 1. Let _days_ be 0. - // 1. Let _candidateDays_ be _sign_. - // 1. Repeat, while NonISODateSurpasses(_calendar_, _sign_, _one_, _two_, _years_, _months_, _weeks_, _candidateDays_) is *false*, - // 1. Set _days_ to _candidateDays_. - // 1. Set _candidateDays_ to _candidateDays_ + _sign_. - let mut days = 0; - let mut candidate_days = sign; - while !self.surpasses( - other, - DateDuration::from_signed_ymwd(years, months, weeks, candidate_days), - sign, - cal, - ) { - days = candidate_days; - candidate_days += sign; + let max_day = C::days_in_provided_month(year, month); + if day == 0 || day > max_day { + return Err(RangeError { + field: "day", + value: day as i32, + min: 1, + max: max_day as i32, + }); } - // 1. Return ! CreateDateDurationRecord(_years_, _months_, _weeks_, _days_). - DateDuration::from_signed_ymwd(years, months, weeks, days) + + Ok(Self::new_unchecked(year, month, day)) } } #[cfg(test)] mod tests { use super::*; - use crate::cal::{abstract_gregorian::AbstractGregorian, iso::IsoEra}; + use crate::cal::Iso; #[test] fn test_ord() { let dates_in_order = [ - ArithmeticDate::>::new_unchecked(-10, 1, 1), - ArithmeticDate::>::new_unchecked(-10, 1, 2), - ArithmeticDate::>::new_unchecked(-10, 2, 1), - ArithmeticDate::>::new_unchecked(-1, 1, 1), - ArithmeticDate::>::new_unchecked(-1, 1, 2), - ArithmeticDate::>::new_unchecked(-1, 2, 1), - ArithmeticDate::>::new_unchecked(0, 1, 1), - ArithmeticDate::>::new_unchecked(0, 1, 2), - ArithmeticDate::>::new_unchecked(0, 2, 1), - ArithmeticDate::>::new_unchecked(1, 1, 1), - ArithmeticDate::>::new_unchecked(1, 1, 2), - ArithmeticDate::>::new_unchecked(1, 2, 1), - ArithmeticDate::>::new_unchecked(10, 1, 1), - ArithmeticDate::>::new_unchecked(10, 1, 2), - ArithmeticDate::>::new_unchecked(10, 2, 1), + ArithmeticDate::::new_unchecked(-10, 1, 1), + ArithmeticDate::::new_unchecked(-10, 1, 2), + ArithmeticDate::::new_unchecked(-10, 2, 1), + ArithmeticDate::::new_unchecked(-1, 1, 1), + ArithmeticDate::::new_unchecked(-1, 1, 2), + ArithmeticDate::::new_unchecked(-1, 2, 1), + ArithmeticDate::::new_unchecked(0, 1, 1), + ArithmeticDate::::new_unchecked(0, 1, 2), + ArithmeticDate::::new_unchecked(0, 2, 1), + ArithmeticDate::::new_unchecked(1, 1, 1), + ArithmeticDate::::new_unchecked(1, 1, 2), + ArithmeticDate::::new_unchecked(1, 2, 1), + ArithmeticDate::::new_unchecked(10, 1, 1), + ArithmeticDate::::new_unchecked(10, 1, 2), + ArithmeticDate::::new_unchecked(10, 2, 1), ]; for (i, i_date) in dates_in_order.iter().enumerate() { for (j, j_date) in dates_in_order.iter().enumerate() { diff --git a/deps/crates/vendor/icu_calendar/src/date.rs b/deps/crates/vendor/icu_calendar/src/date.rs index 5b65612c260b75..5c4c0cf5d9fcab 100644 --- a/deps/crates/vendor/icu_calendar/src/date.rs +++ b/deps/crates/vendor/icu_calendar/src/date.rs @@ -3,12 +3,11 @@ // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). use crate::any_calendar::{AnyCalendar, IntoAnyCalendar}; -use crate::error::{DateError, DateFromFieldsError}; -use crate::options::DateFromFieldsOptions; -use crate::options::{DateAddOptions, DateDifferenceOptions}; +use crate::calendar_arithmetic::CalendarArithmetic; +use crate::error::DateError; use crate::types::{CyclicYear, EraYear, IsoWeekOfYear}; use crate::week::{RelativeUnit, WeekCalculator, WeekOf}; -use crate::{types, Calendar, Iso}; +use crate::{types, Calendar, DateDuration, DateDurationUnit, Iso}; #[cfg(feature = "alloc")] use alloc::rc::Rc; #[cfg(feature = "alloc")] @@ -37,7 +36,6 @@ impl AsCalendar for C { } #[cfg(feature = "alloc")] -/// ✨ *Enabled with the `alloc` Cargo feature.* impl AsCalendar for Rc { type Calendar = C::Calendar; #[inline] @@ -47,7 +45,6 @@ impl AsCalendar for Rc { } #[cfg(feature = "alloc")] -/// ✨ *Enabled with the `alloc` Cargo feature.* impl AsCalendar for Arc { type Calendar = C::Calendar; #[inline] @@ -122,11 +119,7 @@ pub struct Date { impl Date
{ /// Construct a date from from era/month codes and fields, and some calendar representation /// - /// The year is `extended_year` if no era is provided. - /// - /// This function will not accept year/extended_year values that are outside of the range `[-2²⁷, 2²⁷]`, - /// regardless of the calendar, instead returning a [`DateError::Range`]. See [`Date::try_from_fields()`] for more - /// information. + /// The year is `extended_year` if no era is provided #[inline] pub fn try_new_from_codes( era: Option<&str>, @@ -141,59 +134,6 @@ impl Date { Ok(Date { inner, calendar }) } - /// Construct a date from from a bag of fields. - /// - /// This function allows specifying the year as either extended year or era + era year, - /// and the month as either ordinal or month code. It can constrain out-of-bounds values - /// and fill in missing fields. See [`DateFromFieldsOptions`] for more information. - /// - /// This function will not accept year/extended_year values that are outside of the range `[-2²⁷, 2²⁷]`, - /// regardless of the calendar, instead returning a [`DateFromFieldsError::Range`]. This allows us to to keep - /// all operations on [`Date`]s infallible by staying clear of integer limits. - /// Currently, calendar-specific `Date::try_new_calendarname()` constructors - /// do not do this, and it is possible to obtain such extreme dates via calendar conversion or arithmetic, - /// though [we may change that behavior in the future](https://github.com/unicode-org/icu4x/issues/7076). - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::cal::Gregorian; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// - /// let mut fields = DateFields::default(); - /// fields.extended_year = Some(2000); - /// fields.ordinal_month = Some(1); - /// fields.day = Some(1); - /// - /// let d1 = Date::try_from_fields(fields, Default::default(), Gregorian) - /// .expect("Jan 1 in year 2000"); - /// - /// let d2 = Date::try_new_gregorian(2000, 1, 1).unwrap(); - /// assert_eq!(d1, d2); - /// ``` - /// - /// See [`DateFromFieldsError`] for examples of error conditions. - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #7161](https://github.com/unicode-org/icu4x/issues/7161). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[cfg(feature = "unstable")] - #[inline] - pub fn try_from_fields( - fields: types::DateFields, - options: DateFromFieldsOptions, - calendar: A, - ) -> Result { - let inner = calendar.as_calendar().from_fields(fields, options)?; - Ok(Date { inner, calendar }) - } - /// Construct a date from a [`RataDie`] and some calendar representation #[inline] pub fn from_rata_die(rd: RataDie, calendar: A) -> Self { @@ -212,26 +152,20 @@ impl Date
{ /// Construct a date from an ISO date and some calendar representation #[inline] pub fn new_from_iso(iso: Date, calendar: A) -> Self { - iso.to_calendar(calendar) + let inner = calendar.as_calendar().from_iso(iso.inner); + Date { inner, calendar } } /// Convert the Date to an ISO Date #[inline] pub fn to_iso(&self) -> Date { - self.to_calendar(Iso) + Date::from_raw(self.calendar.as_calendar().to_iso(self.inner()), Iso) } /// Convert the Date to a date in a different calendar #[inline] pub fn to_calendar(&self, calendar: A2) -> Date { - let c1 = self.calendar.as_calendar(); - let c2 = calendar.as_calendar(); - let inner = if c1.has_cheap_iso_conversion() && c2.has_cheap_iso_conversion() { - c2.from_iso(c1.to_iso(self.inner())) - } else { - c2.from_rata_die(c1.to_rata_die(self.inner())) - }; - Date { inner, calendar } + Date::new_from_iso(self.to_iso(), calendar) } /// The number of months in the year of this date @@ -259,95 +193,38 @@ impl Date { } /// Add a `duration` to this date, mutating it - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #3964](https://github.com/unicode-org/icu4x/issues/3964). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[cfg(feature = "unstable")] + #[doc(hidden)] // unstable #[inline] - pub fn try_add_with_options( - &mut self, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result<(), DateError> { - let inner = self - .calendar + pub fn add(&mut self, duration: DateDuration) { + self.calendar .as_calendar() - .add(&self.inner, duration, options)?; - self.inner = inner; - Ok(()) + .offset_date(&mut self.inner, duration) } /// Add a `duration` to this date, returning the new one - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #3964](https://github.com/unicode-org/icu4x/issues/3964). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[cfg(feature = "unstable")] + #[doc(hidden)] // unstable #[inline] - pub fn try_added_with_options( - mut self, - duration: types::DateDuration, - options: DateAddOptions, - ) -> Result { - self.try_add_with_options(duration, options)?; - Ok(self) + pub fn added(mut self, duration: DateDuration) -> Self { + self.add(duration); + self } /// Calculating the duration between `other - self` - /// - /// Although this returns a [`Result`], with most fixed calendars, this operation can't fail. - /// In such cases, the error type is [`Infallible`], and the inner value can be safely - /// unwrapped using [`Result::into_ok()`], which is available in nightly Rust as of this - /// writing. In stable Rust, the value can be unwrapped using [pattern matching]. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::types::DateDuration; - /// use icu::calendar::Date; - /// - /// let d1 = Date::try_new_iso(2020, 1, 1).unwrap(); - /// let d2 = Date::try_new_iso(2025, 10, 2).unwrap(); - /// let options = Default::default(); - /// - /// // The value can be unwrapped with destructuring syntax: - /// let Ok(duration) = d1.try_until_with_options(&d2, options); - /// - /// assert_eq!(duration, DateDuration::for_days(2101)); - /// ``` - /// - /// [`Infallible`]: core::convert::Infallible - /// [pattern matching]: https://doc.rust-lang.org/book/ch19-03-pattern-syntax.html - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #3964](https://github.com/unicode-org/icu4x/issues/3964). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[cfg(feature = "unstable")] + #[doc(hidden)] // unstable #[inline] - pub fn try_until_with_options>( + pub fn until>( &self, other: &Date, - options: DateDifferenceOptions, - ) -> Result::DifferenceError> { - self.calendar - .as_calendar() - .until(self.inner(), other.inner(), options) + largest_unit: DateDurationUnit, + smallest_unit: DateDurationUnit, + ) -> DateDuration { + self.calendar.as_calendar().until( + self.inner(), + other.inner(), + other.calendar.as_calendar(), + largest_unit, + smallest_unit, + ) } /// The calendar-specific year-info. @@ -359,21 +236,13 @@ impl Date
{ self.calendar.as_calendar().year_info(&self.inner).into() } - /// The "extended year". - /// - /// This year number can be used when you need a simple numeric representation - /// of the year, and can be meaningfully compared with extended years from other - /// eras or used in arithmetic. - /// - /// For calendars defined in Temporal, this will match the "arithmetic year" - /// as defined in . - /// This is typically anchored with year 1 as the year 1 of either the most modern or - /// otherwise some "major" era for the calendar. + /// The "extended year", typically anchored with year 1 as the year 1 of either the most modern or + /// otherwise some "major" era for the calendar /// /// See [`Self::year()`] for more information about the year. #[inline] pub fn extended_year(&self) -> i32 { - self.year().extended_year() + self.calendar.as_calendar().extended_year(&self.inner) } /// Returns whether `self` is in a calendar-specific leap year @@ -470,8 +339,7 @@ impl Date { pub fn week_of_year(&self) -> IsoWeekOfYear { let week_of = WeekCalculator::ISO .week_of( - 365 + calendrical_calculations::gregorian::is_leap_year(self.inner.0.year - 1) - as u16, + Iso::days_in_provided_year(self.inner.0.year.saturating_sub(1)), self.days_in_year(), self.day_of_year().0, self.day_of_week(), @@ -489,8 +357,8 @@ impl Date { week_number: week_of.week, iso_year: match week_of.unit { RelativeUnit::Current => self.inner.0.year, - RelativeUnit::Next => self.inner.0.year + 1, - RelativeUnit::Previous => self.inner.0.year - 1, + RelativeUnit::Next => self.inner.0.year.saturating_add(1), + RelativeUnit::Previous => self.inner.0.year.saturating_sub(1), }, } } @@ -510,8 +378,6 @@ impl Date { /// Wrap the contained calendar type in `Rc`, making it cheaper to clone. /// /// Useful when paired with [`Self::to_any()`] to obtain a `Date>` - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn into_ref_counted(self) -> Date> { Date::from_raw(self.inner, Rc::new(self.calendar)) @@ -520,8 +386,6 @@ impl Date { /// Wrap the contained calendar type in `Arc`, making it cheaper to clone in a thread-safe manner. /// /// Useful when paired with [`Self::to_any()`] to obtain a `Date>` - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn into_atomic_ref_counted(self) -> Date> { Date::from_raw(self.inner, Arc::new(self.calendar)) @@ -531,7 +395,7 @@ impl Date { /// /// Useful for converting a `&Date` into an equivalent `Date` without cloning /// the calendar. - pub fn as_borrowed(&self) -> Date> { + pub fn as_borrowed(&self) -> Date> { Date::from_raw(self.inner, Ref(&self.calendar)) } } @@ -552,6 +416,7 @@ impl Eq for Date {} impl PartialOrd> for Date where C: Calendar, + C::DateInner: PartialOrd, A: AsCalendar, B: AsCalendar, { diff --git a/deps/crates/vendor/icu_calendar/src/duration.rs b/deps/crates/vendor/icu_calendar/src/duration.rs index d089dd0644ac99..b8f21743d1460a 100644 --- a/deps/crates/vendor/icu_calendar/src/duration.rs +++ b/deps/crates/vendor/icu_calendar/src/duration.rs @@ -2,25 +2,18 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -/// A signed length of time in terms of days, weeks, months, and years. -/// -/// This type represents the abstract concept of a date duration. For example, a duration of -/// "1 month" is represented as "1 month" in the data model, without any context of how many -/// days the month might be. -/// -/// Use [`DateDuration`] for calculating the difference between two [`Date`]s and adding -/// date units to a [`Date`]. +use crate::Calendar; +use core::fmt; +use core::marker::PhantomData; + +/// A duration between two dates /// -/// [`Date`]: crate::Date +/// Can be used to perform date arithmetic /// /// # Example /// /// ```rust -/// use icu::calendar::options::DateDifferenceOptions; -/// use icu::calendar::types::DateDuration; -/// use icu::calendar::types::DateDurationUnit; -/// use icu::calendar::types::Weekday; -/// use icu::calendar::Date; +/// use icu::calendar::{types::Weekday, Date, DateDuration, DateDurationUnit}; /// /// // Creating ISO date: 1992-09-02. /// let mut date_iso = Date::try_new_iso(1992, 9, 2) @@ -36,116 +29,70 @@ /// assert_eq!(date_iso.days_in_month(), 30); /// /// // Advancing date in-place by 1 year, 2 months, 3 weeks, 4 days. -/// date_iso -/// .try_add_with_options( -/// DateDuration { -/// is_negative: false, -/// years: 1, -/// months: 2, -/// weeks: 3, -/// days: 4, -/// }, -/// Default::default(), -/// ) -/// .unwrap(); +/// date_iso.add(DateDuration::new(1, 2, 3, 4)); /// assert_eq!(date_iso.era_year().year, 1993); /// assert_eq!(date_iso.month().ordinal, 11); /// assert_eq!(date_iso.day_of_month().0, 27); /// /// // Reverse date advancement. -/// date_iso -/// .try_add_with_options( -/// DateDuration { -/// is_negative: true, -/// years: 1, -/// months: 2, -/// weeks: 3, -/// days: 4, -/// }, -/// Default::default(), -/// ) -/// .unwrap(); +/// date_iso.add(DateDuration::new(-1, -2, -3, -4)); /// assert_eq!(date_iso.era_year().year, 1992); /// assert_eq!(date_iso.month().ordinal, 9); /// assert_eq!(date_iso.day_of_month().0, 2); /// /// // Creating ISO date: 2022-01-30. -/// let newer_date_iso = Date::try_new_iso(2022, 10, 30) +/// let newer_date_iso = Date::try_new_iso(2022, 1, 30) /// .expect("Failed to initialize ISO Date instance."); /// /// // Comparing dates: 2022-01-30 and 1992-09-02. -/// let mut options = DateDifferenceOptions::default(); -/// options.largest_unit = Some(DateDurationUnit::Years); -/// let Ok(duration) = -/// newer_date_iso.try_until_with_options(&date_iso, options); +/// let duration = newer_date_iso.until( +/// &date_iso, +/// DateDurationUnit::Years, +/// DateDurationUnit::Days, +/// ); /// assert_eq!(duration.years, 30); -/// assert_eq!(duration.months, 1); +/// assert_eq!(duration.months, -8); /// assert_eq!(duration.days, 28); /// /// // Create new date with date advancement. Reassign to new variable. -/// let mutated_date_iso = date_iso -/// .try_added_with_options( -/// DateDuration { -/// is_negative: false, -/// years: 1, -/// months: 2, -/// weeks: 3, -/// days: 4, -/// }, -/// Default::default(), -/// ) -/// .unwrap(); +/// let mutated_date_iso = date_iso.added(DateDuration::new(1, 2, 3, 4)); /// assert_eq!(mutated_date_iso.era_year().year, 1993); /// assert_eq!(mutated_date_iso.month().ordinal, 11); /// assert_eq!(mutated_date_iso.day_of_month().0, 27); /// ``` /// /// Currently unstable for ICU4X 1.0 -/// -///
-/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, -/// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. -/// -/// Graduation tracking issue: [issue #3964](https://github.com/unicode-org/icu4x/issues/3964). -///
-/// -/// ✨ *Enabled with the `unstable` Cargo feature.* -#[derive(Debug, Copy, Clone, Eq, PartialEq, Default)] -#[allow(clippy::exhaustive_structs)] // spec-defined in Temporal -pub struct DateDuration { - /// Whether the duration is negative. - /// - /// A negative duration is an abstract concept that could result, for example, from - /// taking the difference between two [`Date`](crate::Date)s. - /// - /// The fields of the duration are either all positive or all negative. Mixed signs - /// are not allowed. - /// - /// By convention, this field should be `false` if the duration is zero. - pub is_negative: bool, +#[derive(Eq, PartialEq)] +#[allow(clippy::exhaustive_structs)] // this type should be stable (and is intended to be constructed manually) +#[doc(hidden)] // unstable +pub struct DateDuration { /// The number of years - pub years: u32, + pub years: i32, /// The number of months - pub months: u32, + pub months: i32, /// The number of weeks - pub weeks: u32, + pub weeks: i32, /// The number of days - pub days: u64, + pub days: i32, + /// A marker for the calendar + pub marker: PhantomData, } +// Custom impl so that C need not be bound on Copy/Clone +impl Clone for DateDuration { + fn clone(&self) -> Self { + *self + } +} + +// Custom impl so that C need not be bound on Copy/Clone +impl Copy for DateDuration {} + /// A "duration unit" used to specify the minimum or maximum duration of time to /// care about -/// -///
-/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, -/// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. -/// -/// Graduation tracking issue: [issue #3964](https://github.com/unicode-org/icu4x/issues/3964). -///
-/// -/// ✨ *Enabled with the `unstable` Cargo feature.* #[derive(Copy, Clone, Eq, PartialEq, Debug)] #[allow(clippy::exhaustive_enums)] // this type should be stable +#[doc(hidden)] // unstable pub enum DateDurationUnit { /// Duration in years Years, @@ -157,134 +104,55 @@ pub enum DateDurationUnit { Days, } -impl DateDuration { - /// Returns a new [`DateDuration`] representing a number of years. - pub fn for_years(years: i32) -> Self { +impl Default for DateDuration { + fn default() -> Self { Self { - is_negative: years.is_negative(), - years: years.unsigned_abs(), - ..Default::default() - } - } - - /// Returns a new [`DateDuration`] representing a number of months. - pub fn for_months(months: i32) -> Self { - Self { - is_negative: months.is_negative(), - months: months.unsigned_abs(), - ..Default::default() - } - } - - /// Returns a new [`DateDuration`] representing a number of weeks. - pub fn for_weeks(weeks: i32) -> Self { - Self { - is_negative: weeks.is_negative(), - weeks: weeks.unsigned_abs(), - ..Default::default() - } - } - - /// Returns a new [`DateDuration`] representing a number of days. - pub fn for_days(days: i64) -> Self { - Self { - is_negative: days.is_negative(), - days: days.unsigned_abs(), - ..Default::default() - } - } - - /// Do NOT pass this function values of mixed signs! - pub(crate) fn from_signed_ymwd(years: i64, months: i64, weeks: i64, days: i64) -> Self { - let is_negative = years.is_negative() - || months.is_negative() - || weeks.is_negative() - || days.is_negative(); - if is_negative - && (years.is_positive() - || months.is_positive() - || weeks.is_positive() - || days.is_positive()) - { - debug_assert!(false, "mixed signs in from_signed_ymd"); - } - Self { - is_negative, - years: match u32::try_from(years.unsigned_abs()) { - Ok(x) => x, - Err(_) => { - debug_assert!(false, "years out of range"); - u32::MAX - } - }, - months: match u32::try_from(months.unsigned_abs()) { - Ok(x) => x, - Err(_) => { - debug_assert!(false, "months out of range"); - u32::MAX - } - }, - weeks: match u32::try_from(weeks.unsigned_abs()) { - Ok(x) => x, - Err(_) => { - debug_assert!(false, "weeks out of range"); - u32::MAX - } - }, - days: days.unsigned_abs(), + years: 0, + months: 0, + weeks: 0, + days: 0, + marker: PhantomData, } } +} - #[inline] - pub(crate) fn add_years_to(&self, year: i32) -> i32 { - if !self.is_negative { - match year.checked_add_unsigned(self.years) { - Some(x) => x, - None => { - debug_assert!(false, "{year} + {self:?} out of year range"); - i32::MAX - } - } - } else { - match year.checked_sub_unsigned(self.years) { - Some(x) => x, - None => { - debug_assert!(false, "{year} - {self:?} out of year range"); - i32::MIN - } - } +impl DateDuration { + /// Construct a DateDuration + /// + /// ```rust + /// # use icu::calendar::*; + /// // two years, three months, and five days + /// let duration: DateDuration = DateDuration::new(2, 3, 0, 5); + /// ``` + pub fn new(years: i32, months: i32, weeks: i32, days: i32) -> Self { + DateDuration { + years, + months, + weeks, + days, + marker: PhantomData, } } - #[inline] - pub(crate) fn add_months_to(&self, month: u8) -> i64 { - if !self.is_negative { - i64::from(month) + i64::from(self.months) - } else { - i64::from(month) - i64::from(self.months) + /// Explicitly cast duration to one for a different calendar + pub fn cast_unit(self) -> DateDuration { + DateDuration { + years: self.years, + months: self.months, + days: self.days, + weeks: self.weeks, + marker: PhantomData, } } +} - #[inline] - pub(crate) fn add_weeks_and_days_to(&self, day: u8) -> i64 { - if !self.is_negative { - let day = i64::from(day) + i64::from(self.weeks) * 7; - match day.checked_add_unsigned(self.days) { - Some(x) => x, - None => { - debug_assert!(false, "{day} + {self:?} out of day range"); - i64::MAX - } - } - } else { - let day = i64::from(day) - i64::from(self.weeks) * 7; - match day.checked_sub_unsigned(self.days) { - Some(x) => x, - None => { - debug_assert!(false, "{day} - {self:?} out of day range"); - i64::MIN - } - } - } +impl fmt::Debug for DateDuration { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { + f.debug_struct("DateDuration") + .field("years", &self.years) + .field("months", &self.months) + .field("weeks", &self.weeks) + .field("days", &self.days) + .finish() } } diff --git a/deps/crates/vendor/icu_calendar/src/error.rs b/deps/crates/vendor/icu_calendar/src/error.rs index 437700befb830f..2e050a93a3f04a 100644 --- a/deps/crates/vendor/icu_calendar/src/error.rs +++ b/deps/crates/vendor/icu_calendar/src/error.rs @@ -2,15 +2,11 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -//! Error types for functions in the calendar crate - -use crate::{options::Overflow, types::MonthCode}; +use crate::types::MonthCode; use displaydoc::Display; #[derive(Debug, Copy, Clone, PartialEq, Display)] -/// Error type for date creation via [`Date::try_new_from_codes`]. -/// -/// [`Date::try_new_from_codes`]: crate::Date::try_new_from_codes +/// Error type for date creation. #[non_exhaustive] pub enum DateError { /// A field is out of range for its domain. @@ -25,351 +21,15 @@ pub enum DateError { /// The maximum value (inclusive). This might not be tight. max: i32, }, - /// The era code is invalid for the calendar. + /// Unknown era #[displaydoc("Unknown era")] UnknownEra, - /// The month code is invalid for the calendar or year. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::cal::Hebrew; - /// use icu::calendar::types::MonthCode; - /// use icu::calendar::Date; - /// use icu::calendar::DateError; - /// use tinystr::tinystr; - /// - /// Date::try_new_from_codes( - /// None, - /// 5784, - /// MonthCode::new_leap(5).unwrap(), - /// 1, - /// Hebrew, - /// ) - /// .expect("5784 is a leap year"); - /// - /// let err = Date::try_new_from_codes( - /// None, - /// 5785, - /// MonthCode::new_leap(5).unwrap(), - /// 1, - /// Hebrew, - /// ) - /// .expect_err("5785 is a common year"); - /// - /// assert!(matches!(err, DateError::UnknownMonthCode(_))); - /// ``` + /// Unknown month code #[displaydoc("Unknown month code {0:?}")] UnknownMonthCode(MonthCode), } impl core::error::Error for DateError {} -#[cfg(feature = "unstable")] -pub use unstable::DateFromFieldsError; -#[cfg(not(feature = "unstable"))] -pub(crate) use unstable::DateFromFieldsError; - -mod unstable { - pub use super::*; - /// Error type for date creation via [`Date::try_from_fields`]. - /// - /// [`Date::try_from_fields`]: crate::Date::try_from_fields - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #7161](https://github.com/unicode-org/icu4x/issues/7161). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[derive(Debug, Copy, Clone, PartialEq, Display)] - #[non_exhaustive] - pub enum DateFromFieldsError { - /// A field is out of range for its domain. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::error::DateFromFieldsError; - /// use icu::calendar::error::RangeError; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// use icu::calendar::Iso; - /// - /// let mut fields = DateFields::default(); - /// fields.extended_year = Some(2000); - /// fields.ordinal_month = Some(13); - /// fields.day = Some(1); - /// - /// let err = Date::try_from_fields(fields, Default::default(), Iso) - /// .expect_err("no month 13 in the ISO calendar"); - /// - /// assert!(matches!( - /// err, - /// DateFromFieldsError::Range(RangeError { field: "month", .. }) - /// )); - /// ``` - #[displaydoc("{0}")] - Range(RangeError), - /// The era code is invalid for the calendar. - #[displaydoc("Unknown era or invalid syntax")] - UnknownEra, - /// The month code syntax is invalid. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::error::DateFromFieldsError; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// use icu::calendar::Iso; - /// - /// let mut fields = DateFields::default(); - /// fields.extended_year = Some(2000); - /// fields.month_code = Some(b"????"); - /// fields.day = Some(1); - /// - /// let err = Date::try_from_fields(fields, Default::default(), Iso) - /// .expect_err("month code is invalid"); - /// - /// assert_eq!(err, DateFromFieldsError::MonthCodeInvalidSyntax); - /// ``` - #[displaydoc("Invalid month code syntax")] - MonthCodeInvalidSyntax, - /// The specified month code does not exist in this calendar. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::cal::Hebrew; - /// use icu::calendar::error::DateFromFieldsError; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// - /// let mut fields = DateFields::default(); - /// fields.extended_year = Some(5783); - /// fields.month_code = Some(b"M13"); - /// fields.day = Some(1); - /// - /// let err = Date::try_from_fields(fields, Default::default(), Hebrew) - /// .expect_err("no month M13 in Hebrew"); - /// assert_eq!(err, DateFromFieldsError::MonthCodeNotInCalendar); - /// ``` - #[displaydoc("The specified month code does not exist in this calendar")] - MonthCodeNotInCalendar, - /// The specified month code exists in this calendar, but not in the specified year. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::cal::Hebrew; - /// use icu::calendar::error::DateFromFieldsError; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// - /// let mut fields = DateFields::default(); - /// fields.extended_year = Some(5783); - /// fields.month_code = Some(b"M05L"); - /// fields.day = Some(1); - /// - /// let err = Date::try_from_fields(fields, Default::default(), Hebrew) - /// .expect_err("no month M05L in Hebrew year 5783"); - /// assert_eq!(err, DateFromFieldsError::MonthCodeNotInYear); - /// ``` - #[displaydoc("The specified month code exists in calendar, but not for this year")] - MonthCodeNotInYear, - /// The year was specified in multiple inconsistent ways. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::cal::Japanese; - /// use icu::calendar::error::DateFromFieldsError; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// - /// let mut fields = DateFields::default(); - /// fields.era = Some(b"reiwa"); - /// fields.era_year = Some(6); - /// fields.ordinal_month = Some(1); - /// fields.day = Some(1); - /// - /// Date::try_from_fields(fields, Default::default(), Japanese::new()) - /// .expect("a well-defined Japanese date"); - /// - /// fields.extended_year = Some(1900); - /// - /// let err = - /// Date::try_from_fields(fields, Default::default(), Japanese::new()) - /// .expect_err("year 1900 is not the same as 6 Reiwa"); - /// - /// assert_eq!(err, DateFromFieldsError::InconsistentYear); - /// ``` - #[displaydoc("Inconsistent year")] - InconsistentYear, - /// The month was specified in multiple inconsistent ways. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::cal::Hebrew; - /// use icu::calendar::error::DateFromFieldsError; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// use tinystr::tinystr; - /// - /// let mut fields = DateFields::default(); - /// fields.extended_year = Some(5783); - /// fields.month_code = Some(b"M06"); - /// fields.ordinal_month = Some(6); - /// fields.day = Some(1); - /// - /// Date::try_from_fields(fields, Default::default(), Hebrew) - /// .expect("a well-defined Hebrew date in a common year"); - /// - /// fields.extended_year = Some(5784); - /// - /// let err = Date::try_from_fields(fields, Default::default(), Hebrew) - /// .expect_err("month M06 is not the 6th month in leap year 5784"); - /// - /// assert_eq!(err, DateFromFieldsError::InconsistentMonth); - /// ``` - #[displaydoc("Inconsistent month")] - InconsistentMonth, - /// Not enough fields were specified to form a well-defined date. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::cal::Hebrew; - /// use icu::calendar::error::DateFromFieldsError; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// use tinystr::tinystr; - /// - /// let mut fields = DateFields::default(); - /// - /// fields.ordinal_month = Some(3); - /// - /// let err = Date::try_from_fields(fields, Default::default(), Hebrew) - /// .expect_err("need more than just an ordinal month"); - /// assert_eq!(err, DateFromFieldsError::NotEnoughFields); - /// - /// fields.era_year = Some(5783); - /// - /// let err = Date::try_from_fields(fields, Default::default(), Hebrew) - /// .expect_err("need more than an ordinal month and an era year"); - /// assert_eq!(err, DateFromFieldsError::NotEnoughFields); - /// - /// fields.extended_year = Some(5783); - /// - /// let err = Date::try_from_fields(fields, Default::default(), Hebrew) - /// .expect_err("era year still needs an era"); - /// assert_eq!(err, DateFromFieldsError::NotEnoughFields); - /// - /// fields.era = Some(b"am"); - /// - /// let date = Date::try_from_fields(fields, Default::default(), Hebrew) - /// .expect_err("still missing the day"); - /// assert_eq!(err, DateFromFieldsError::NotEnoughFields); - /// - /// fields.day = Some(1); - /// let date = Date::try_from_fields(fields, Default::default(), Hebrew) - /// .expect("we have enough fields!"); - /// ``` - #[displaydoc("Not enough fields")] - NotEnoughFields, - } - - impl core::error::Error for DateFromFieldsError {} - - impl From for DateFromFieldsError { - #[inline] - fn from(value: RangeError) -> Self { - DateFromFieldsError::Range(value) - } - } -} - -/// Internal narrow error type for functions that only fail on unknown eras -pub(crate) struct UnknownEraError; - -impl From for DateError { - #[inline] - fn from(_value: UnknownEraError) -> Self { - DateError::UnknownEra - } -} - -impl From for DateFromFieldsError { - #[inline] - fn from(_value: UnknownEraError) -> Self { - DateFromFieldsError::UnknownEra - } -} - -/// Internal narrow error type for functions that only fail on parsing month codes -#[derive(Debug)] -pub(crate) enum MonthCodeParseError { - InvalidSyntax, -} - -impl From for DateFromFieldsError { - #[inline] - fn from(value: MonthCodeParseError) -> Self { - match value { - MonthCodeParseError::InvalidSyntax => DateFromFieldsError::MonthCodeInvalidSyntax, - } - } -} - -/// Internal narrow error type for functions that only fail on month code operations -#[derive(Debug, PartialEq)] -pub(crate) enum MonthCodeError { - NotInCalendar, - NotInYear, -} - -impl From for DateFromFieldsError { - #[inline] - fn from(value: MonthCodeError) -> Self { - match value { - MonthCodeError::NotInCalendar => DateFromFieldsError::MonthCodeNotInCalendar, - MonthCodeError::NotInYear => DateFromFieldsError::MonthCodeNotInYear, - } - } -} - -mod inner { - /// Internal narrow error type for calculating the ECMA reference year - /// - /// Public but unstable because it is used on hijri::Rules - #[derive(Debug, Copy, Clone, PartialEq, Eq)] - #[allow(missing_docs)] // TODO: fix when graduating - #[non_exhaustive] - pub enum EcmaReferenceYearError { - Unimplemented, - MonthCodeNotInCalendar, - } -} - -#[cfg(feature = "unstable")] -pub use inner::EcmaReferenceYearError; -#[cfg(not(feature = "unstable"))] -pub(crate) use inner::EcmaReferenceYearError; - -impl From for DateFromFieldsError { - #[inline] - fn from(value: EcmaReferenceYearError) -> Self { - match value { - EcmaReferenceYearError::Unimplemented => DateFromFieldsError::NotEnoughFields, - EcmaReferenceYearError::MonthCodeNotInCalendar => { - DateFromFieldsError::MonthCodeNotInCalendar - } - } - } -} #[derive(Debug, Copy, Clone, PartialEq, Display)] /// An argument is out of range for its domain. @@ -389,7 +49,6 @@ pub struct RangeError { impl core::error::Error for RangeError {} impl From for DateError { - #[inline] fn from(value: RangeError) -> Self { let RangeError { field, @@ -406,31 +65,28 @@ impl From for DateError { } } -pub(crate) fn range_check_with_overflow + Copy>( - value: T, - field: &'static str, - bounds: core::ops::RangeInclusive, - overflow: Overflow, -) -> Result { - if matches!(overflow, Overflow::Constrain) { - Ok(value.clamp(*bounds.start(), *bounds.end())) - } else { - range_check(value, field, bounds) - } -} +pub(crate) fn year_check( + year: i32, + bounds: impl core::ops::RangeBounds, +) -> Result { + use core::ops::Bound::*; -pub(crate) fn range_check + Copy>( - value: T, - field: &'static str, - bounds: core::ops::RangeInclusive, -) -> Result { - if !bounds.contains(&value) { + if !bounds.contains(&year) { return Err(RangeError { - field, - value: value.into(), - min: (*bounds.start()).into(), - max: (*bounds.end()).into(), + field: "year", + value: year, + min: match bounds.start_bound() { + Included(&m) => m, + Excluded(&m) => m + 1, + Unbounded => i32::MIN, + }, + max: match bounds.end_bound() { + Included(&m) => m, + Excluded(&m) => m - 1, + Unbounded => i32::MAX, + }, }); } - Ok(value) + + Ok(year) } diff --git a/deps/crates/vendor/icu_calendar/src/ixdtf.rs b/deps/crates/vendor/icu_calendar/src/ixdtf.rs index 1fe60d9720b68e..0256dcd6c40eb6 100644 --- a/deps/crates/vendor/icu_calendar/src/ixdtf.rs +++ b/deps/crates/vendor/icu_calendar/src/ixdtf.rs @@ -6,12 +6,11 @@ use core::str::FromStr; use crate::{AsCalendar, Calendar, Date, Iso, RangeError}; use icu_locale_core::preferences::extensions::unicode::keywords::CalendarAlgorithm; -use ixdtf::encoding::Utf8; +use ixdtf::parsers::records::IxdtfParseRecord; use ixdtf::parsers::IxdtfParser; -use ixdtf::records::IxdtfParseRecord; use ixdtf::ParseError as Rfc9557Error; -/// An error returned from parsing an RFC 9557 string to an `icu::calendar` type. +/// An error returned from parsing an RFC 9557 string to an `icu_calendar` type. #[derive(Debug, displaydoc::Display)] #[non_exhaustive] pub enum ParseError { @@ -69,7 +68,10 @@ impl Date
{ /// Date::try_from_str("2024-07-17[u-ca=hebrew]", Gregorian).unwrap_err(); /// /// assert_eq!(date.era_year().year, 2024); - /// assert_eq!(date.month().standard_code.0, "M07"); + /// assert_eq!( + /// date.month().standard_code, + /// icu::calendar::types::MonthCode(tinystr::tinystr!(4, "M07")) + /// ); /// assert_eq!(date.day_of_month().0, 17); /// ``` pub fn try_from_str(rfc_9557_str: &str, calendar: A) -> Result { @@ -91,7 +93,7 @@ impl Date { #[doc(hidden)] pub fn try_from_ixdtf_record( - ixdtf_record: &IxdtfParseRecord<'_, Utf8>, + ixdtf_record: &IxdtfParseRecord, calendar: A, ) -> Result { let date_record = ixdtf_record.date.ok_or(ParseError::MissingFields)?; diff --git a/deps/crates/vendor/icu_calendar/src/lib.rs b/deps/crates/vendor/icu_calendar/src/lib.rs index ca8c9923881996..77d5a4b46aeadf 100644 --- a/deps/crates/vendor/icu_calendar/src/lib.rs +++ b/deps/crates/vendor/icu_calendar/src/lib.rs @@ -88,9 +88,6 @@ ) )] #![warn(missing_docs)] -// It's not worth it to try and maintain clean import lists for both -// stable and unstable mode when the code is so entangled. -#![cfg_attr(not(feature = "unstable"), allow(unused))] #[cfg(feature = "alloc")] extern crate alloc; @@ -101,7 +98,6 @@ mod date; // Public modules mod any_calendar; pub mod cal; -pub mod options; pub mod provider; pub mod types; pub mod week; @@ -109,7 +105,7 @@ pub mod week; mod calendar; mod calendar_arithmetic; mod duration; -pub mod error; +mod error; #[cfg(feature = "ixdtf")] mod ixdtf; @@ -117,6 +113,8 @@ mod ixdtf; pub use any_calendar::IntoAnyCalendar; pub use calendar::Calendar; pub use date::{AsCalendar, Date, Ref}; +#[doc(hidden)] // unstable +pub use duration::{DateDuration, DateDurationUnit}; pub use error::{DateError, RangeError}; #[cfg(feature = "ixdtf")] pub use ixdtf::ParseError; diff --git a/deps/crates/vendor/icu_calendar/src/options.rs b/deps/crates/vendor/icu_calendar/src/options.rs deleted file mode 100644 index 37eba042536a54..00000000000000 --- a/deps/crates/vendor/icu_calendar/src/options.rs +++ /dev/null @@ -1,559 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -//! Options used by types in this crate - -#[cfg(feature = "unstable")] -pub use unstable::{ - DateAddOptions, DateDifferenceOptions, DateFromFieldsOptions, MissingFieldsStrategy, Overflow, -}; -#[cfg(not(feature = "unstable"))] -pub(crate) use unstable::{ - DateAddOptions, DateDifferenceOptions, DateFromFieldsOptions, MissingFieldsStrategy, Overflow, -}; - -mod unstable { - /// Options bag for [`Date::try_from_fields`](crate::Date::try_from_fields). - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #7161](https://github.com/unicode-org/icu4x/issues/7161). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[derive(Copy, Clone, Debug, PartialEq, Default)] - #[non_exhaustive] - pub struct DateFromFieldsOptions { - /// How to behave with out-of-bounds fields. - /// - /// Defaults to [`Overflow::Reject`]. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::options::DateFromFieldsOptions; - /// use icu::calendar::options::Overflow; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// use icu::calendar::Iso; - /// - /// // There is no day 31 in September. - /// let mut fields = DateFields::default(); - /// fields.extended_year = Some(2025); - /// fields.ordinal_month = Some(9); - /// fields.day = Some(31); - /// - /// let options_default = DateFromFieldsOptions::default(); - /// assert!(Date::try_from_fields(fields, options_default, Iso).is_err()); - /// - /// let mut options_reject = options_default; - /// options_reject.overflow = Some(Overflow::Reject); - /// assert!(Date::try_from_fields(fields, options_reject, Iso).is_err()); - /// - /// let mut options_constrain = options_default; - /// options_constrain.overflow = Some(Overflow::Constrain); - /// assert_eq!( - /// Date::try_from_fields(fields, options_constrain, Iso).unwrap(), - /// Date::try_new_iso(2025, 9, 30).unwrap() - /// ); - /// ``` - pub overflow: Option, - /// How to behave when the fields that are present do not fully constitute a Date. - /// - /// This option can be used to fill in a missing year given a month and a day according to - /// the ECMAScript Temporal specification. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::options::DateFromFieldsOptions; - /// use icu::calendar::options::MissingFieldsStrategy; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// use icu::calendar::Iso; - /// - /// // These options are missing a year. - /// let mut fields = DateFields::default(); - /// fields.month_code = Some(b"M02"); - /// fields.day = Some(1); - /// - /// let options_default = DateFromFieldsOptions::default(); - /// assert!(Date::try_from_fields(fields, options_default, Iso).is_err()); - /// - /// let mut options_reject = options_default; - /// options_reject.missing_fields_strategy = - /// Some(MissingFieldsStrategy::Reject); - /// assert!(Date::try_from_fields(fields, options_reject, Iso).is_err()); - /// - /// let mut options_ecma = options_default; - /// options_ecma.missing_fields_strategy = Some(MissingFieldsStrategy::Ecma); - /// assert_eq!( - /// Date::try_from_fields(fields, options_ecma, Iso).unwrap(), - /// Date::try_new_iso(1972, 2, 1).unwrap() - /// ); - /// ``` - pub missing_fields_strategy: Option, - } - - impl DateFromFieldsOptions { - pub(crate) fn from_add_options(options: DateAddOptions) -> Self { - Self { - overflow: options.overflow, - missing_fields_strategy: Default::default(), - } - } - } - - /// Options for adding a duration to a date. - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #3964](https://github.com/unicode-org/icu4x/issues/3964). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[derive(Copy, Clone, PartialEq, Debug, Default)] - #[non_exhaustive] - pub struct DateAddOptions { - /// How to behave with out-of-bounds fields during arithmetic. - /// - /// Defaults to [`Overflow::Constrain`]. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::options::DateAddOptions; - /// use icu::calendar::options::Overflow; - /// use icu::calendar::types::DateDuration; - /// use icu::calendar::Date; - /// - /// // There is a day 31 in October but not in November. - /// let d1 = Date::try_new_iso(2025, 10, 31).unwrap(); - /// let duration = DateDuration::for_months(1); - /// - /// let options_default = DateAddOptions::default(); - /// assert_eq!( - /// d1.try_added_with_options(duration, options_default) - /// .unwrap(), - /// Date::try_new_iso(2025, 11, 30).unwrap() - /// ); - /// - /// let mut options_reject = options_default; - /// options_reject.overflow = Some(Overflow::Reject); - /// assert!(d1.try_added_with_options(duration, options_reject).is_err()); - /// - /// let mut options_constrain = options_default; - /// options_constrain.overflow = Some(Overflow::Constrain); - /// assert_eq!( - /// d1.try_added_with_options(duration, options_constrain) - /// .unwrap(), - /// Date::try_new_iso(2025, 11, 30).unwrap() - /// ); - /// ``` - pub overflow: Option, - } - - /// Options for taking the difference between two dates. - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #3964](https://github.com/unicode-org/icu4x/issues/3964). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[derive(Copy, Clone, PartialEq, Debug, Default)] - #[non_exhaustive] - pub struct DateDifferenceOptions { - /// Which date field to allow as the largest in a duration when taking the difference. - /// - /// When choosing [`Months`] or [`Years`], the resulting [`DateDuration`] might not be - /// associative or commutative in subsequent arithmetic operations, and it might require - /// [`Overflow::Constrain`] in addition. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::options::DateDifferenceOptions; - /// use icu::calendar::types::DateDuration; - /// use icu::calendar::types::DateDurationUnit; - /// use icu::calendar::Date; - /// - /// let d1 = Date::try_new_iso(2025, 3, 31).unwrap(); - /// let d2 = Date::try_new_iso(2026, 5, 15).unwrap(); - /// - /// let options_default = DateDifferenceOptions::default(); - /// assert_eq!( - /// d1.try_until_with_options(&d2, options_default).unwrap(), - /// DateDuration::for_days(410) - /// ); - /// - /// let mut options_days = options_default; - /// options_days.largest_unit = Some(DateDurationUnit::Days); - /// assert_eq!( - /// d1.try_until_with_options(&d2, options_default).unwrap(), - /// DateDuration::for_days(410) - /// ); - /// - /// let mut options_weeks = options_default; - /// options_weeks.largest_unit = Some(DateDurationUnit::Weeks); - /// assert_eq!( - /// d1.try_until_with_options(&d2, options_weeks).unwrap(), - /// DateDuration { - /// weeks: 58, - /// days: 4, - /// ..Default::default() - /// } - /// ); - /// - /// let mut options_months = options_default; - /// options_months.largest_unit = Some(DateDurationUnit::Months); - /// assert_eq!( - /// d1.try_until_with_options(&d2, options_months).unwrap(), - /// DateDuration { - /// months: 13, - /// days: 15, - /// ..Default::default() - /// } - /// ); - /// - /// let mut options_years = options_default; - /// options_years.largest_unit = Some(DateDurationUnit::Years); - /// assert_eq!( - /// d1.try_until_with_options(&d2, options_years).unwrap(), - /// DateDuration { - /// years: 1, - /// months: 1, - /// days: 15, - /// ..Default::default() - /// } - /// ); - /// ``` - /// - /// [`Months`]: crate::types::DateDurationUnit::Months - /// [`Years`]: crate::types::DateDurationUnit::Years - /// [`DateDuration`]: crate::types::DateDuration - pub largest_unit: Option, - } - - /// Whether to constrain or reject out-of-bounds values when constructing a Date. - /// - /// The behavior conforms to the ECMAScript Temporal specification. - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #7161](https://github.com/unicode-org/icu4x/issues/7161). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[derive(Copy, Clone, Debug, PartialEq, Default)] - #[non_exhaustive] - pub enum Overflow { - /// Constrain out-of-bounds fields to the nearest in-bounds value. - /// - /// Only the out-of-bounds field is constrained. If the other fields are not themselves - /// out of bounds, they are not changed. - /// - /// This is the [default option]( - /// https://tc39.es/proposal-temporal/#sec-temporal-gettemporaloverflowoption), - /// following the ECMAScript Temporal specification. See also the [docs on MDN]( - /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate#invalid_date_clamping). - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::cal::Hebrew; - /// use icu::calendar::options::DateFromFieldsOptions; - /// use icu::calendar::options::Overflow; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// use icu::calendar::DateError; - /// - /// let mut options = DateFromFieldsOptions::default(); - /// options.overflow = Some(Overflow::Constrain); - /// - /// // 5784, a leap year, contains M05L, but the day is too big. - /// let mut fields = DateFields::default(); - /// fields.extended_year = Some(5784); - /// fields.month_code = Some(b"M05L"); - /// fields.day = Some(50); - /// - /// let date = Date::try_from_fields(fields, options, Hebrew).unwrap(); - /// - /// // Constrained to the 30th day of M05L of year 5784 - /// assert_eq!(date.year().extended_year(), 5784); - /// assert_eq!(date.month().standard_code.0, "M05L"); - /// assert_eq!(date.day_of_month().0, 30); - /// - /// // 5785, a common year, does not contain M05L. - /// fields.extended_year = Some(5785); - /// - /// let date = Date::try_from_fields(fields, options, Hebrew).unwrap(); - /// - /// // Constrained to the 29th day of M06 of year 5785 - /// assert_eq!(date.year().extended_year(), 5785); - /// assert_eq!(date.month().standard_code.0, "M06"); - /// assert_eq!(date.day_of_month().0, 29); - /// ``` - Constrain, - /// Return an error if any fields are out of bounds. - /// - /// # Examples - /// - /// ``` - /// use icu::calendar::cal::Hebrew; - /// use icu::calendar::error::DateFromFieldsError; - /// use icu::calendar::options::DateFromFieldsOptions; - /// use icu::calendar::options::Overflow; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// use tinystr::tinystr; - /// - /// let mut options = DateFromFieldsOptions::default(); - /// options.overflow = Some(Overflow::Reject); - /// - /// // 5784, a leap year, contains M05L, but the day is too big. - /// let mut fields = DateFields::default(); - /// fields.extended_year = Some(5784); - /// fields.month_code = Some(b"M05L"); - /// fields.day = Some(50); - /// - /// let err = Date::try_from_fields(fields, options, Hebrew) - /// .expect_err("Day is out of bounds"); - /// assert!(matches!(err, DateFromFieldsError::Range { .. })); - /// - /// // Set the day to one that exists - /// fields.day = Some(1); - /// Date::try_from_fields(fields, options, Hebrew) - /// .expect("A valid Hebrew date"); - /// - /// // 5785, a common year, does not contain M05L. - /// fields.extended_year = Some(5785); - /// - /// let err = Date::try_from_fields(fields, options, Hebrew) - /// .expect_err("Month is out of bounds"); - /// assert!(matches!(err, DateFromFieldsError::MonthCodeNotInYear)); - /// ``` - #[default] - Reject, - } - - /// How to infer missing fields when the fields that are present do not fully constitute a Date. - /// - /// In order for the fields to fully constitute a Date, they must identify a year, a month, - /// and a day. The fields `era`, `era_year`, and `extended_year` identify the year: - /// - /// | Era? | Era Year? | Extended Year? | Outcome | - /// |------|-----------|----------------|---------| - /// | - | - | - | Error | - /// | Some | - | - | Error | - /// | - | Some | - | Error | - /// | - | - | Some | OK | - /// | Some | Some | - | OK | - /// | Some | - | Some | Error (era requires era year) | - /// | - | Some | Some | Error (era year requires era) | - /// | Some | Some | Some | OK (but error if inconsistent) | - /// - /// The fields `month_code` and `ordinal_month` identify the month: - /// - /// | Month Code? | Ordinal Month? | Outcome | - /// |-------------|----------------|---------| - /// | - | - | Error | - /// | Some | - | OK | - /// | - | Some | OK | - /// | Some | Some | OK (but error if inconsistent) | - /// - /// The field `day` identifies the day. - /// - /// If the fields identify a year, a month, and a day, then there are no missing fields, so - /// the strategy chosen here has no effect (fields that are out-of-bounds or inconsistent - /// are handled by other errors). - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #7161](https://github.com/unicode-org/icu4x/issues/7161). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[derive(Copy, Clone, Debug, PartialEq, Default)] - #[non_exhaustive] - pub enum MissingFieldsStrategy { - /// If the fields that are present do not fully constitute a Date, - /// return [`DateFromFieldsError::NotEnoughFields`]. - /// - /// [`DateFromFieldsError::NotEnoughFields`]: crate::error::DateFromFieldsError::NotEnoughFields - #[default] - Reject, - /// If the fields that are present do not fully constitute a Date, - /// follow the ECMAScript specification when possible. - /// - /// ⚠️ This option causes a year or day to be implicitly added to the Date! - /// - /// This strategy makes the following changes: - /// - /// 1. If the fields identify a year and a month, but not a day, then set `day` to 1. - /// 2. If `month_code` and `day` are set but nothing else, then set the year to a - /// _reference year_: some year in the calendar that contains the specified month - /// and day, according to the ECMAScript specification. - /// - /// Note that the reference year is _not_ added if an ordinal month is present, since - /// the identity of an ordinal month changes from year to year. - Ecma, - } -} -#[cfg(test)] -mod tests { - use crate::{error::DateFromFieldsError, types::DateFields, Date, Gregorian}; - use itertools::Itertools; - use std::collections::{BTreeMap, BTreeSet}; - - use super::*; - - #[test] - #[allow(clippy::field_reassign_with_default)] // want out-of-crate code style - fn test_missing_fields_strategy() { - // The sets of fields that identify a year, according to the table in the docs - let valid_year_field_sets = [ - &["era", "era_year"][..], - &["extended_year"][..], - &["era", "era_year", "extended_year"][..], - ] - .into_iter() - .map(|field_names| field_names.iter().copied().collect()) - .collect::>>(); - - // The sets of fields that identify a month, according to the table in the docs - let valid_month_field_sets = [ - &["month_code"][..], - &["ordinal_month"][..], - &["month_code", "ordinal_month"][..], - ] - .into_iter() - .map(|field_names| field_names.iter().copied().collect()) - .collect::>>(); - - // The sets of fields that identify a day, according to the table in the docs - let valid_day_field_sets = [&["day"][..]] - .into_iter() - .map(|field_names| field_names.iter().copied().collect()) - .collect::>>(); - - // All possible valid sets of fields - let all_valid_field_sets = valid_year_field_sets - .iter() - .cartesian_product(valid_month_field_sets.iter()) - .cartesian_product(valid_day_field_sets.iter()) - .map(|((year_fields, month_fields), day_fields)| { - year_fields - .iter() - .chain(month_fields.iter()) - .chain(day_fields.iter()) - .copied() - .collect::>() - }) - .collect::>>(); - - // Field sets with year and month but without day that ECMA accepts - let field_sets_without_day = valid_year_field_sets - .iter() - .cartesian_product(valid_month_field_sets.iter()) - .map(|(year_fields, month_fields)| { - year_fields - .iter() - .chain(month_fields.iter()) - .copied() - .collect::>() - }) - .collect::>>(); - - // Field sets with month and day but without year that ECMA accepts - let field_sets_without_year = [&["month_code", "day"][..]] - .into_iter() - .map(|field_names| field_names.iter().copied().collect()) - .collect::>>(); - - // A map from field names to a function that sets that field - let mut field_fns = BTreeMap::<&str, &dyn Fn(&mut DateFields)>::new(); - field_fns.insert("era", &|fields| fields.era = Some(b"ad")); - field_fns.insert("era_year", &|fields| fields.era_year = Some(2000)); - field_fns.insert("extended_year", &|fields| fields.extended_year = Some(2000)); - field_fns.insert("month_code", &|fields| fields.month_code = Some(b"M04")); - field_fns.insert("ordinal_month", &|fields| fields.ordinal_month = Some(4)); - field_fns.insert("day", &|fields| fields.day = Some(20)); - - for field_set in field_fns.keys().copied().powerset() { - let field_set = field_set.into_iter().collect::>(); - - // Check whether this case should succeed: whether it identifies a year, - // a month, and a day. - let should_succeed_rejecting = all_valid_field_sets.contains(&field_set); - - // Check whether it should succeed in ECMA mode. - let should_succeed_ecma = should_succeed_rejecting - || field_sets_without_day.contains(&field_set) - || field_sets_without_year.contains(&field_set); - - // Populate the fields in the field set - let mut fields = Default::default(); - for field_name in field_set { - field_fns.get(field_name).unwrap()(&mut fields); - } - - // Check whether we were able to successfully construct the date - let mut options = DateFromFieldsOptions::default(); - options.missing_fields_strategy = Some(MissingFieldsStrategy::Reject); - match Date::try_from_fields(fields, options, Gregorian) { - Ok(_) => assert!( - should_succeed_rejecting, - "Succeeded, but should have rejected: {fields:?}" - ), - Err(DateFromFieldsError::NotEnoughFields) => assert!( - !should_succeed_rejecting, - "Rejected, but should have succeeded: {fields:?}" - ), - Err(e) => panic!("Unexpected error: {e} for {fields:?}"), - } - - // Check ECMA mode - let mut options = DateFromFieldsOptions::default(); - options.missing_fields_strategy = Some(MissingFieldsStrategy::Ecma); - match Date::try_from_fields(fields, options, Gregorian) { - Ok(_) => assert!( - should_succeed_ecma, - "Succeeded, but should have rejected (ECMA): {fields:?}" - ), - Err(DateFromFieldsError::NotEnoughFields) => assert!( - !should_succeed_ecma, - "Rejected, but should have succeeded (ECMA): {fields:?}" - ), - Err(e) => panic!("Unexpected error: {e} for {fields:?}"), - } - } - } - - #[test] - fn test_constrain_large_months() { - let fields = DateFields { - extended_year: Some(2004), - ordinal_month: Some(15), - day: Some(1), - ..Default::default() - }; - let options = DateFromFieldsOptions { - overflow: Some(Overflow::Constrain), - ..Default::default() - }; - - let _ = Date::try_from_fields(fields, options, crate::cal::Persian).unwrap(); - } -} diff --git a/deps/crates/vendor/icu_calendar/src/provider.rs b/deps/crates/vendor/icu_calendar/src/provider.rs index b8f7feaf9181be..71e7369abfd360 100644 --- a/deps/crates/vendor/icu_calendar/src/provider.rs +++ b/deps/crates/vendor/icu_calendar/src/provider.rs @@ -15,6 +15,11 @@ // Provider structs must be stable #![allow(clippy::exhaustive_structs, clippy::exhaustive_enums)] +pub mod chinese_based; +pub mod hijri; +pub use chinese_based::{CalendarChineseV1, CalendarDangiV1}; +pub use hijri::CalendarHijriSimulatedMeccaV1; + use crate::types::Weekday; use icu_provider::fallback::{LocaleFallbackConfig, LocaleFallbackPriority}; use icu_provider::prelude::*; @@ -41,6 +46,9 @@ const _: () = { pub use icu_locale as locale; } make_provider!(Baked); + impl_calendar_chinese_v1!(Baked); + impl_calendar_dangi_v1!(Baked); + impl_calendar_hijri_simulated_mecca_v1!(Baked); impl_calendar_japanese_modern_v1!(Baked); impl_calendar_japanese_extended_v1!(Baked); impl_calendar_week_v1!(Baked); @@ -75,6 +83,9 @@ icu_provider::data_marker!( #[cfg(feature = "datagen")] /// The latest minimum set of markers required by this component. pub const MARKERS: &[DataMarkerInfo] = &[ + CalendarChineseV1::INFO, + CalendarDangiV1::INFO, + CalendarHijriSimulatedMeccaV1::INFO, CalendarJapaneseModernV1::INFO, CalendarJapaneseExtendedV1::INFO, CalendarWeekV1::INFO, @@ -96,7 +107,6 @@ pub const MARKERS: &[DataMarkerInfo] = &[ #[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))] #[cfg_attr(feature = "datagen", databake(path = icu_calendar::provider))] #[cfg_attr(feature = "serde", derive(serde::Deserialize))] -#[cfg_attr(not(feature = "alloc"), zerovec::skip_derive(ZeroMapKV))] pub struct EraStartDate { /// The year the era started in pub year: i32, @@ -188,7 +198,7 @@ impl WeekdaySet { pub const fn new(days: &[Weekday]) -> Self { let mut i = 0; let mut w = 0; - #[expect(clippy::indexing_slicing)] + #[allow(clippy::indexing_slicing)] while i < days.len() { w |= days[i].bit_value(); i += 1; @@ -285,7 +295,6 @@ impl<'de> serde::Deserialize<'de> for WeekdaySet { } #[test] -#[cfg(feature = "datagen")] fn test_weekdayset_bake() { databake::test_bake!( WeekdaySet, diff --git a/deps/crates/vendor/icu_calendar/src/provider/chinese_based.rs b/deps/crates/vendor/icu_calendar/src/provider/chinese_based.rs new file mode 100644 index 00000000000000..da6fbd372b069e --- /dev/null +++ b/deps/crates/vendor/icu_calendar/src/provider/chinese_based.rs @@ -0,0 +1,298 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +//! 🚧 \[Unstable\] Data provider struct definitions for chinese-based calendars. +//! +//!
+//! 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, +//! including in SemVer minor releases. While the serde representation of data structs is guaranteed +//! to be stable, their Rust representation might not be. Use with caution. +//!
+//! +//! Read more about data providers: [`icu_provider`] + +use icu_provider::prelude::*; +use zerovec::ule::{AsULE, ULE}; +use zerovec::ZeroVec; + +icu_provider::data_marker!( + /// Precomputed data for the Chinese calendar + CalendarChineseV1, + "calendar/chinese/v1", + ChineseBasedCache<'static>, + is_singleton = true +); +icu_provider::data_marker!( + /// Precomputed data for the Dangi calendar + CalendarDangiV1, + "calendar/dangi/v1", + ChineseBasedCache<'static>, + is_singleton = true +); + +/// Cached/precompiled data for a certain range of years for a chinese-based +/// calendar. Avoids the need to perform lunar calendar arithmetic for most calendrical +/// operations. +#[derive(Debug, PartialEq, Clone, Default, yoke::Yokeable, zerofrom::ZeroFrom)] +#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))] +#[cfg_attr(feature = "datagen", databake(path = icu_calendar::provider::chinese_based))] +#[cfg_attr(feature = "serde", derive(serde::Deserialize))] +pub struct ChineseBasedCache<'data> { + /// The ISO year corresponding to the first data entry for this year + pub first_related_iso_year: i32, + /// A list of precomputed data for each year beginning with first_related_iso_year + #[cfg_attr(feature = "serde", serde(borrow))] + pub data: ZeroVec<'data, PackedChineseBasedYearInfo>, +} + +icu_provider::data_struct!( + ChineseBasedCache<'_>, + #[cfg(feature = "datagen")] +); + +/// The struct containing compiled ChineseData +/// +/// Bit structure (little endian: note that shifts go in the opposite direction!) +/// +/// ```text +/// Bit: 0 1 2 3 4 5 6 7 +/// Byte 0: [ month lengths ............. +/// Byte 1: .. month lengths ] | [ leap month index .. +/// Byte 2: ] | [ NY offset ] | unused +/// ``` +/// +/// Where the New Year Offset is the offset from ISO Jan 21 of that year for Chinese New Year, +/// the month lengths are stored as 1 = 30, 0 = 29 for each month including the leap month. +/// The largest possible offset is 33, which requires 6 bits of storage. +/// +///
+/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, +/// including in SemVer minor releases. While the serde representation of data structs is guaranteed +/// to be stable, their Rust representation might not be. Use with caution. +///
+#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ULE)] +#[cfg_attr(feature = "datagen", derive(databake::Bake))] +#[cfg_attr(feature = "datagen", databake(path = icu_calendar::provider))] +#[repr(C, packed)] +pub struct PackedChineseBasedYearInfo(pub u8, pub u8, pub u8); + +impl PackedChineseBasedYearInfo { + /// The first day of the ISO year on which Chinese New Year may occur + /// + /// According to Reingold & Dershowitz, ch 19.6, Chinese New Year occurs on Jan 21 - Feb 21 inclusive. + /// + /// Chinese New Year in the year 30 AD is January 20 (30-01-20). + /// + /// We allow it to occur as early as January 19 which is the earliest the second new moon + /// could occur after the Winter Solstice if the solstice is pinned to December 20. + const FIRST_NY: i64 = 18; + + pub(crate) fn new( + month_lengths: [bool; 13], + leap_month_idx: Option, + ny_offset: i64, + ) -> Self { + debug_assert!( + !month_lengths[12] || leap_month_idx.is_some(), + "Last month length should not be set for non-leap years" + ); + let ny_offset = ny_offset - Self::FIRST_NY; + debug_assert!(ny_offset >= 0, "Year offset too small to store"); + debug_assert!(ny_offset < 34, "Year offset too big to store"); + debug_assert!( + leap_month_idx.map(|l| l <= 13).unwrap_or(true), + "Leap month indices must be 1 <= i <= 13" + ); + let mut all = 0u32; // last byte unused + + for (month, length_30) in month_lengths.iter().enumerate() { + #[allow(clippy::indexing_slicing)] + if *length_30 { + all |= 1 << month as u32; + } + } + let leap_month_idx = leap_month_idx.unwrap_or(0); + all |= (leap_month_idx as u32) << (8 + 5); + all |= (ny_offset as u32) << (16 + 1); + let le = all.to_le_bytes(); + Self(le[0], le[1], le[2]) + } + + // Get the new year difference from the ISO new year + pub(crate) fn ny_offset(self) -> u8 { + Self::FIRST_NY as u8 + (self.2 >> 1) + } + + pub(crate) fn leap_month(self) -> Option { + let bits = (self.1 >> 5) + ((self.2 & 0b1) << 3); + + (bits != 0).then_some(bits) + } + + // Whether a particular month has 30 days (month is 1-indexed) + pub(crate) fn month_has_30_days(self, month: u8) -> bool { + let months = u16::from_le_bytes([self.0, self.1]); + months & (1 << (month - 1) as u16) != 0 + } + + #[cfg(any(test, feature = "datagen"))] + pub(crate) fn month_lengths(self) -> [bool; 13] { + core::array::from_fn(|i| self.month_has_30_days(i as u8 + 1)) + } + + // Which day of year is the last day of a month (month is 1-indexed) + pub(crate) fn last_day_of_month(self, month: u8) -> u16 { + let months = u16::from_le_bytes([self.0, self.1]); + // month is 1-indexed, so `29 * month` includes the current month + let mut prev_month_lengths = 29 * month as u16; + // month is 1-indexed, so `1 << month` is a mask with all zeroes except + // for a 1 at the bit index at the next month. Subtracting 1 from it gets us + // a bitmask for all months up to now + let long_month_bits = months & ((1 << month as u16) - 1); + prev_month_lengths += long_month_bits.count_ones().try_into().unwrap_or(0); + prev_month_lengths + } +} + +impl AsULE for PackedChineseBasedYearInfo { + type ULE = Self; + fn to_unaligned(self) -> Self { + self + } + fn from_unaligned(other: Self) -> Self { + other + } +} + +#[cfg(feature = "serde")] +mod serialization { + use super::*; + + #[cfg(feature = "datagen")] + use serde::{ser, Serialize}; + use serde::{Deserialize, Deserializer}; + + #[derive(Deserialize)] + #[cfg_attr(feature = "datagen", derive(Serialize))] + struct SerdePackedChineseBasedYearInfo { + ny_offset: u8, + month_has_30_days: [bool; 13], + leap_month_idx: Option, + } + + impl<'de> Deserialize<'de> for PackedChineseBasedYearInfo { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + if deserializer.is_human_readable() { + SerdePackedChineseBasedYearInfo::deserialize(deserializer).map(Into::into) + } else { + let data = <(u8, u8, u8)>::deserialize(deserializer)?; + Ok(PackedChineseBasedYearInfo(data.0, data.1, data.2)) + } + } + } + + #[cfg(feature = "datagen")] + impl Serialize for PackedChineseBasedYearInfo { + fn serialize(&self, serializer: S) -> Result + where + S: ser::Serializer, + { + if serializer.is_human_readable() { + SerdePackedChineseBasedYearInfo::from(*self).serialize(serializer) + } else { + (self.0, self.1, self.2).serialize(serializer) + } + } + } + + #[cfg(feature = "datagen")] + impl From for SerdePackedChineseBasedYearInfo { + fn from(other: PackedChineseBasedYearInfo) -> Self { + Self { + ny_offset: other.ny_offset(), + month_has_30_days: other.month_lengths(), + leap_month_idx: other.leap_month(), + } + } + } + + impl From for PackedChineseBasedYearInfo { + fn from(other: SerdePackedChineseBasedYearInfo) -> Self { + Self::new( + other.month_has_30_days, + other.leap_month_idx, + other.ny_offset as i64, + ) + } + } +} + +#[cfg(test)] +mod test { + use super::*; + + fn packed_roundtrip_single( + mut month_lengths: [bool; 13], + leap_month_idx: Option, + ny_offset: i64, + ) { + if leap_month_idx.is_none() { + // Avoid bad invariants + month_lengths[12] = false; + } + let packed = PackedChineseBasedYearInfo::new(month_lengths, leap_month_idx, ny_offset); + + assert_eq!( + ny_offset, + packed.ny_offset() as i64, + "Roundtrip with {month_lengths:?}, {leap_month_idx:?}, {ny_offset}" + ); + assert_eq!( + leap_month_idx, + packed.leap_month(), + "Roundtrip with {month_lengths:?}, {leap_month_idx:?}, {ny_offset}" + ); + let month_lengths_roundtrip = packed.month_lengths(); + assert_eq!( + month_lengths, month_lengths_roundtrip, + "Roundtrip with {month_lengths:?}, {leap_month_idx:?}, {ny_offset}" + ); + } + + #[test] + fn test_roundtrip_packed() { + const SHORT: [bool; 13] = [false; 13]; + const LONG: [bool; 13] = [true; 13]; + const ALTERNATING1: [bool; 13] = [ + false, true, false, true, false, true, false, true, false, true, false, true, false, + ]; + const ALTERNATING2: [bool; 13] = [ + true, false, true, false, true, false, true, false, true, false, true, false, true, + ]; + const RANDOM1: [bool; 13] = [ + true, true, false, false, true, true, false, true, true, true, true, false, true, + ]; + const RANDOM2: [bool; 13] = [ + false, true, true, true, true, false, true, true, true, false, false, true, false, + ]; + packed_roundtrip_single(SHORT, None, 18 + 5); + packed_roundtrip_single(SHORT, None, 18 + 10); + packed_roundtrip_single(SHORT, Some(11), 18 + 15); + packed_roundtrip_single(LONG, Some(12), 18 + 15); + packed_roundtrip_single(ALTERNATING1, None, 18 + 2); + packed_roundtrip_single(ALTERNATING1, Some(3), 18 + 5); + packed_roundtrip_single(ALTERNATING2, None, 18 + 9); + packed_roundtrip_single(ALTERNATING2, Some(7), 18 + 26); + packed_roundtrip_single(RANDOM1, None, 18 + 29); + packed_roundtrip_single(RANDOM1, Some(12), 18 + 29); + packed_roundtrip_single(RANDOM1, Some(2), 18 + 21); + packed_roundtrip_single(RANDOM2, None, 18 + 25); + packed_roundtrip_single(RANDOM2, Some(2), 18 + 19); + packed_roundtrip_single(RANDOM2, Some(5), 18 + 2); + packed_roundtrip_single(RANDOM2, Some(12), 18 + 5); + } +} diff --git a/deps/crates/vendor/icu_calendar/src/provider/hijri.rs b/deps/crates/vendor/icu_calendar/src/provider/hijri.rs new file mode 100644 index 00000000000000..d0ff61f8b13b57 --- /dev/null +++ b/deps/crates/vendor/icu_calendar/src/provider/hijri.rs @@ -0,0 +1,165 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +//! 🚧 \[Unstable\] Data provider struct definitions for chinese-based calendars. +//! +//!
+//! 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, +//! including in SemVer minor releases. While the serde representation of data structs is guaranteed +//! to be stable, their Rust representation might not be. Use with caution. +//!
+//! +//! Read more about data providers: [`icu_provider`] + +use calendrical_calculations::rata_die::RataDie; +use icu_provider::prelude::*; +use zerovec::ule::AsULE; +use zerovec::ZeroVec; + +icu_provider::data_marker!( + /// Precomputed data for the Hijri obsevational calendar + CalendarHijriSimulatedMeccaV1, + "calendar/hijri/simulated/mecca/v1", + HijriData<'static>, + is_singleton = true, +); + +/// Cached/precompiled data for a certain range of years for a chinese-based +/// calendar. Avoids the need to perform lunar calendar arithmetic for most calendrical +/// operations. +#[derive(Debug, PartialEq, Clone, Default, yoke::Yokeable, zerofrom::ZeroFrom)] +#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))] +#[cfg_attr(feature = "datagen", databake(path = icu_calendar::provider::hijri))] +#[cfg_attr(feature = "serde", derive(serde::Deserialize))] +pub struct HijriData<'data> { + /// The extended year corresponding to the first data entry for this year + pub first_extended_year: i32, + /// A list of precomputed data for each year beginning with first_extended_year + #[cfg_attr(feature = "serde", serde(borrow))] + pub data: ZeroVec<'data, PackedHijriYearInfo>, +} + +icu_provider::data_struct!( + HijriData<'_>, + #[cfg(feature = "datagen")] +); + +/// The struct containing compiled Hijri YearInfo +/// +/// Bit structure +/// +/// ```text +/// Bit: F.........C B.............0 +/// Value: [ start day ][ month lengths ] +/// ``` +/// +/// The start day is encoded as a signed offset from `Self::mean_synodic_start_day`. This number does not +/// appear to be less than 2, however we use all remaining bits for it in case of drift in the math. +/// The month lengths are stored as 1 = 30, 0 = 29 for each month including the leap month. +/// +///
+/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, +/// including in SemVer minor releases. While the serde representation of data structs is guaranteed +/// to be stable, their Rust representation might not be. Use with caution. +///
+#[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Debug)] +#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))] +#[cfg_attr(feature = "datagen", databake(path = icu_calendar::provider))] +#[cfg_attr(feature = "serde", derive(serde::Deserialize))] +pub struct PackedHijriYearInfo(pub u16); + +impl PackedHijriYearInfo { + pub(crate) const fn new( + extended_year: i32, + month_lengths: [bool; 12], + start_day: RataDie, + ) -> Self { + let start_offset = start_day.since(Self::mean_synodic_start_day(extended_year)); + + debug_assert!( + -8 < start_offset && start_offset < 8, + "Year offset too big to store" + ); + let start_offset = start_offset as i8; + + let mut all = 0u16; // last byte unused + + let mut i = 0; + while i < 12 { + #[allow(clippy::indexing_slicing)] + if month_lengths[i] { + all |= 1 << i; + } + i += 1; + } + + if start_offset < 0 { + all |= 1 << 12; + } + all |= (start_offset.unsigned_abs() as u16) << 13; + Self(all) + } + + pub(crate) fn unpack(self, extended_year: i32) -> ([bool; 12], RataDie) { + let month_lengths = core::array::from_fn(|i| self.0 & (1 << (i as u8) as u16) != 0); + let start_offset = if (self.0 & 0b1_0000_0000_0000) != 0 { + -((self.0 >> 13) as i64) + } else { + (self.0 >> 13) as i64 + }; + ( + month_lengths, + Self::mean_synodic_start_day(extended_year) + start_offset, + ) + } + + const fn mean_synodic_start_day(extended_year: i32) -> RataDie { + // -1 because the epoch is new year of year 1 + // truncating instead of flooring does not matter, as this is used for positive years only + calendrical_calculations::islamic::ISLAMIC_EPOCH_FRIDAY.add( + ((extended_year - 1) as f64 * calendrical_calculations::islamic::MEAN_YEAR_LENGTH) + as i64, + ) + } +} + +impl AsULE for PackedHijriYearInfo { + type ULE = ::ULE; + fn from_unaligned(unaligned: Self::ULE) -> Self { + Self(::from_unaligned(unaligned)) + } + fn to_unaligned(self) -> Self::ULE { + ::to_unaligned(self.0) + } +} + +#[test] +fn test_hijri_packed_roundtrip() { + fn single_roundtrip(month_lengths: [bool; 12], year_start: RataDie) { + let packed = PackedHijriYearInfo::new(1600, month_lengths, year_start); + let (month_lengths2, year_start2) = packed.unpack(1600); + assert_eq!(month_lengths, month_lengths2, "Month lengths must match for testcase {month_lengths:?} / {year_start:?}, with packed repr: {packed:?}"); + assert_eq!(year_start, year_start2, "Month lengths must match for testcase {month_lengths:?} / {year_start:?}, with packed repr: {packed:?}"); + } + + let l = true; + let s = false; + let all_short = [s; 12]; + let all_long = [l; 12]; + let mixed1 = [l, s, l, s, l, s, l, s, l, s, l, s]; + let mixed2 = [s, s, l, l, l, s, l, s, s, s, l, l]; + + let start_1600 = PackedHijriYearInfo::mean_synodic_start_day(1600); + single_roundtrip(all_short, start_1600); + single_roundtrip(all_long, start_1600); + single_roundtrip(mixed1, start_1600); + single_roundtrip(mixed2, start_1600); + + single_roundtrip(mixed1, start_1600 - 7); + single_roundtrip(mixed2, start_1600 + 7); + single_roundtrip(mixed2, start_1600 + 4); + single_roundtrip(mixed2, start_1600 + 1); + single_roundtrip(mixed2, start_1600 - 1); + single_roundtrip(mixed2, start_1600 - 4); +} diff --git a/deps/crates/vendor/icu_calendar/src/tests/continuity_test.rs b/deps/crates/vendor/icu_calendar/src/tests/continuity_test.rs index ba22c7c1e51de1..f157bdd28826ff 100644 --- a/deps/crates/vendor/icu_calendar/src/tests/continuity_test.rs +++ b/deps/crates/vendor/icu_calendar/src/tests/continuity_test.rs @@ -2,20 +2,25 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::{types::*, *}; - -fn check_continuity(mut date: Date
, years_to_check: usize) { - let duration = DateDuration::for_days(1); +use crate::*; +use core::marker::PhantomData; + +fn check_continuity(mut date: Date) { + let one_day_duration = DateDuration:: { + years: 0, + months: 0, + weeks: 0, + days: 1, + marker: PhantomData, + }; let mut rata_die = date.to_rata_die(); let mut weekday = date.day_of_week(); let mut year = date.year(); let mut is_in_leap_year = date.is_in_leap_year(); - for _ in 0..(366 * years_to_check) { - let next_date = date - .try_added_with_options(duration, Default::default()) - .unwrap(); + for _ in 0..(366 * 20) { + let next_date = date.added(one_day_duration); let next_rata_die = next_date.to_iso().to_rata_die(); assert_eq!(next_rata_die, rata_die + 1, "{next_date:?}"); let next_weekday = next_date.day_of_week(); @@ -37,15 +42,19 @@ fn check_continuity(mut date: Date, years_to_check: usize) { } } -fn check_every_250_days(mut date: Date, iters: usize) { - let duration = DateDuration::for_days(250); +fn check_every_250_days(mut date: Date) { + let one_thousand_days_duration = DateDuration:: { + years: 0, + months: 0, + weeks: 0, + days: 250, + marker: PhantomData, + }; let mut rata_die = date.to_rata_die(); - for _ in 0..iters { - let next_date = date - .try_added_with_options(duration, Default::default()) - .unwrap(); + for _ in 0..2000 { + let next_date = date.added(one_thousand_days_duration); let next_iso = next_date.to_iso(); let next_rata_die = next_iso.to_rata_die(); assert_eq!(next_rata_die, rata_die + 250, "{next_date:?}"); @@ -59,192 +68,175 @@ fn check_every_250_days(mut date: Date, iters: usize) { #[test] fn test_buddhist_continuity() { let date = Date::try_new_buddhist(-10, 1, 1); - check_continuity(date.unwrap(), 20); + check_continuity(date.unwrap()); let date = Date::try_new_buddhist(-300, 1, 1); - check_every_250_days(date.unwrap(), 2000); + check_every_250_days(date.unwrap()); } #[test] fn test_chinese_continuity() { - let cal = crate::cal::ChineseTraditional::new(); - let date = Date::try_new_from_codes(None, -10, MonthCode::new_normal(1).unwrap(), 1, cal); - check_continuity(date.unwrap(), 20); - let date = Date::try_new_from_codes(None, -300, MonthCode::new_normal(1).unwrap(), 1, cal); - check_every_250_days(date.unwrap(), 2000); - let date = Date::try_new_from_codes(None, -10000, MonthCode::new_normal(1).unwrap(), 1, cal); - check_every_250_days(date.unwrap(), 2000); - - let date = Date::try_new_from_codes(None, 1899, MonthCode::new_normal(1).unwrap(), 1, cal); - check_continuity(date.unwrap(), 20); - - let date = Date::try_new_from_codes(None, 2099, MonthCode::new_normal(1).unwrap(), 1, cal); - check_continuity(date.unwrap(), 20); + let cal = crate::cal::Chinese::new(); + let cal = Ref(&cal); + let date = Date::try_new_chinese_with_calendar(-10, 1, 1, cal); + check_continuity(date.unwrap()); + let date = Date::try_new_chinese_with_calendar(-300, 1, 1, cal); + check_every_250_days(date.unwrap()); + let date = Date::try_new_chinese_with_calendar(-10000, 1, 1, cal); + check_every_250_days(date.unwrap()); } #[test] fn test_coptic_continuity() { let date = Date::try_new_coptic(-10, 1, 1); - check_continuity(date.unwrap(), 20); + check_continuity(date.unwrap()); let date = Date::try_new_coptic(-300, 1, 1); - check_every_250_days(date.unwrap(), 2000); + check_every_250_days(date.unwrap()); } #[test] -fn test_korean_continuity() { - let cal = cal::KoreanTraditional::new(); - let date = Date::try_new_from_codes(None, -10, MonthCode::new_normal(1).unwrap(), 1, cal); - check_continuity(date.unwrap(), 20); - let date = Date::try_new_from_codes(None, -300, MonthCode::new_normal(1).unwrap(), 1, cal); - check_every_250_days(date.unwrap(), 2000); - - let date = Date::try_new_from_codes(None, 1900, MonthCode::new_normal(1).unwrap(), 1, cal); - check_continuity(date.unwrap(), 20); - - let date = Date::try_new_from_codes(None, 2100, MonthCode::new_normal(1).unwrap(), 1, cal); - check_continuity(date.unwrap(), 20); +fn test_dangi_continuity() { + let cal = crate::cal::Dangi::new(); + let cal = Ref(&cal); + let date = Date::try_new_dangi_with_calendar(-10, 1, 1, cal); + check_continuity(date.unwrap()); + let date = Date::try_new_dangi_with_calendar(-300, 1, 1, cal); + check_every_250_days(date.unwrap()); } #[test] fn test_ethiopian_continuity() { - use cal::EthiopianEraStyle::*; + use crate::cal::EthiopianEraStyle::*; let date = Date::try_new_ethiopian(AmeteMihret, -10, 1, 1); - check_continuity(date.unwrap(), 20); + check_continuity(date.unwrap()); let date = Date::try_new_ethiopian(AmeteMihret, -300, 1, 1); - check_every_250_days(date.unwrap(), 2000); + check_every_250_days(date.unwrap()); } #[test] fn test_ethiopian_amete_alem_continuity() { - use cal::EthiopianEraStyle::*; + use crate::cal::EthiopianEraStyle::*; let date = Date::try_new_ethiopian(AmeteAlem, -10, 1, 1); - check_continuity(date.unwrap(), 20); + check_continuity(date.unwrap()); let date = Date::try_new_ethiopian(AmeteAlem, -300, 1, 1); - check_every_250_days(date.unwrap(), 2000); + check_every_250_days(date.unwrap()); } #[test] fn test_gregorian_continuity() { let date = Date::try_new_gregorian(-10, 1, 1); - check_continuity(date.unwrap(), 20); + check_continuity(date.unwrap()); let date = Date::try_new_gregorian(-300, 1, 1); - check_every_250_days(date.unwrap(), 2000); + check_every_250_days(date.unwrap()); } #[test] fn test_hebrew_continuity() { - let date = - Date::try_new_from_codes(None, -10, MonthCode::new_normal(1).unwrap(), 1, cal::Hebrew); - check_continuity(date.unwrap(), 20); - let date = Date::try_new_from_codes( - None, - -300, - MonthCode::new_normal(1).unwrap(), - 1, - cal::Hebrew, - ); - check_every_250_days(date.unwrap(), 2000); + let date = Date::try_new_hebrew(-10, 1, 1); + check_continuity(date.unwrap()); + let date = Date::try_new_hebrew(-300, 1, 1); + check_every_250_days(date.unwrap()); } #[test] fn test_indian_continuity() { let date = Date::try_new_indian(-10, 1, 1); - check_continuity(date.unwrap(), 20); + check_continuity(date.unwrap()); let date = Date::try_new_indian(-300, 1, 1); - check_every_250_days(date.unwrap(), 2000); + check_every_250_days(date.unwrap()); } #[test] fn test_hijri_civil_continuity() { - let cal = cal::Hijri::new_tabular( - cal::hijri::TabularAlgorithmLeapYears::TypeII, - cal::hijri::TabularAlgorithmEpoch::Friday, + let cal = crate::cal::HijriTabular::new( + crate::cal::HijriTabularLeapYears::TypeII, + crate::cal::HijriTabularEpoch::Friday, ); - let date = Date::try_new_hijri_with_calendar(-10, 1, 1, cal); - check_continuity(date.unwrap(), 20); - let date = Date::try_new_hijri_with_calendar(-300, 1, 1, cal); - check_every_250_days(date.unwrap(), 2000); + let cal = Ref(&cal); + let date = Date::try_new_hijri_tabular_with_calendar(-10, 1, 1, cal); + check_continuity(date.unwrap()); + let date = Date::try_new_hijri_tabular_with_calendar(-300, 1, 1, cal); + check_every_250_days(date.unwrap()); } #[test] fn test_hijri_simulated_mecca_continuity() { #[cfg(feature = "logging")] let _ = simple_logger::SimpleLogger::new().env().init(); - let cal = cal::Hijri::new_simulated_mecca(); - let date = Date::try_new_hijri_with_calendar(-10, 1, 1, cal); - // This test is slow since it is doing astronomical calculations, so check only 3 years - check_continuity(date.unwrap(), 3); - let date = Date::try_new_hijri_with_calendar(-300, 1, 1, cal); - // This test is slow since it is doing astronomical calculations, so check only 100 dates - check_every_250_days(date.unwrap(), 100); + let cal = crate::cal::HijriSimulated::new_mecca_always_calculating(); + let cal = Ref(&cal); + let date = Date::try_new_simulated_hijri_with_calendar(-10, 1, 1, cal); + check_continuity(date.unwrap()); + let date = Date::try_new_simulated_hijri_with_calendar(-300, 1, 1, cal); + check_every_250_days(date.unwrap()); } #[test] fn test_hijri_tabular_continuity() { - let cal = cal::Hijri::new_tabular( - cal::hijri::TabularAlgorithmLeapYears::TypeII, - cal::hijri::TabularAlgorithmEpoch::Thursday, + let cal = crate::cal::HijriTabular::new( + crate::cal::HijriTabularLeapYears::TypeII, + crate::cal::HijriTabularEpoch::Thursday, ); - let date = Date::try_new_hijri_with_calendar(-10, 1, 1, cal); - check_continuity(date.unwrap(), 20); - let date = Date::try_new_hijri_with_calendar(-300, 1, 1, cal); - check_every_250_days(date.unwrap(), 2000); + let cal = Ref(&cal); + let date = Date::try_new_hijri_tabular_with_calendar(-10, 1, 1, cal); + check_continuity(date.unwrap()); + let date = Date::try_new_hijri_tabular_with_calendar(-300, 1, 1, cal); + check_every_250_days(date.unwrap()); } #[test] fn test_hijri_umm_al_qura_continuity() { #[cfg(feature = "logging")] let _ = simple_logger::SimpleLogger::new().env().init(); - let cal = cal::Hijri::new_umm_al_qura(); - let date = Date::try_new_hijri_with_calendar(-10, 1, 1, cal); - check_continuity(date.unwrap(), 20); - let date = Date::try_new_hijri_with_calendar(1290, 1, 1, cal); - check_continuity(date.unwrap(), 20); - let date = Date::try_new_hijri_with_calendar(1590, 1, 1, cal); - check_continuity(date.unwrap(), 20); - let date = Date::try_new_hijri_with_calendar(-300, 1, 1, cal); - check_every_250_days(date.unwrap(), 2000); + let date = Date::try_new_ummalqura(-10, 1, 1); + check_continuity(date.unwrap()); + let date = Date::try_new_ummalqura(1290, 1, 1); + check_continuity(date.unwrap()); + let date = Date::try_new_ummalqura(1590, 1, 1); + check_continuity(date.unwrap()); + let date = Date::try_new_ummalqura(-300, 1, 1); + check_every_250_days(date.unwrap()); } #[test] fn test_iso_continuity() { let date = Date::try_new_iso(-10, 1, 1); - check_continuity(date.unwrap(), 20); + check_continuity(date.unwrap()); let date = Date::try_new_iso(-300, 1, 1); - check_every_250_days(date.unwrap(), 2000); + check_every_250_days(date.unwrap()); } #[test] fn test_japanese_continuity() { - let cal = cal::Japanese::new(); + let cal = crate::cal::Japanese::new(); let cal = Ref(&cal); let date = Date::try_new_japanese_with_calendar("heisei", 20, 1, 1, cal); - check_continuity(date.unwrap(), 20); + check_continuity(date.unwrap()); let date = Date::try_new_japanese_with_calendar("bce", 500, 1, 1, cal); - check_every_250_days(date.unwrap(), 2000); + check_every_250_days(date.unwrap()); } #[test] fn test_japanese_extended_continuity() { - let cal = cal::JapaneseExtended::new(); + let cal = crate::cal::JapaneseExtended::new(); let cal = Ref(&cal); let date = Date::try_new_japanese_extended_with_calendar("heisei", 20, 1, 1, cal); - check_continuity(date.unwrap(), 20); + check_continuity(date.unwrap()); let date = Date::try_new_japanese_extended_with_calendar("bce", 500, 1, 1, cal); - check_every_250_days(date.unwrap(), 2000); + check_every_250_days(date.unwrap()); } #[test] fn test_persian_continuity() { let date = Date::try_new_persian(-10, 1, 1); - check_continuity(date.unwrap(), 20); + check_continuity(date.unwrap()); let date = Date::try_new_persian(-300, 1, 1); - check_every_250_days(date.unwrap(), 2000); + check_every_250_days(date.unwrap()); } #[test] fn test_roc_continuity() { let date = Date::try_new_roc(-10, 1, 1); - check_continuity(date.unwrap(), 20); + check_continuity(date.unwrap()); let date = Date::try_new_roc(-300, 1, 1); - check_every_250_days(date.unwrap(), 2000); + check_every_250_days(date.unwrap()); } diff --git a/deps/crates/vendor/icu_calendar/src/tests/extrema.rs b/deps/crates/vendor/icu_calendar/src/tests/extrema.rs deleted file mode 100644 index d4bb47d395fc79..00000000000000 --- a/deps/crates/vendor/icu_calendar/src/tests/extrema.rs +++ /dev/null @@ -1,69 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -use crate::cal::*; -use crate::Calendar; -use crate::Date; -use crate::Ref; - -#[track_caller] -fn check_extrema(cal: C) { - // Minimum and maximum dates allowed in ECMA-262 Temporal. - let min_date_iso = Date::try_new_iso(-271821, 4, 19).unwrap(); - let max_date_iso = Date::try_new_iso(275760, 9, 13).unwrap(); - let min_date = min_date_iso.to_calendar(Ref(&cal)); - let max_date = max_date_iso.to_calendar(Ref(&cal)); - - println!( - "min.year = {:?}, max.year = {:?} (cal = {})", - min_date.year(), - max_date.year(), - cal.debug_name() - ); -} - -// Test all calendars that have any amount of tricky mathematics -// to ensure that they do not trigger debug assertions for large dates. - -#[test] -fn check_extrema_chinese() { - check_extrema(ChineseTraditional::new()) -} - -#[test] -fn check_extrema_korean() { - check_extrema(KoreanTraditional::new()) -} - -#[test] -fn check_extrema_hijri_simulated_mecca() { - check_extrema(Hijri::new_simulated_mecca()) -} - -#[test] -fn check_extrema_hijri_uaq() { - check_extrema(Hijri::new_umm_al_qura()) -} - -#[test] -fn check_extrema_hijri_tabular() { - check_extrema(Hijri::new_tabular( - hijri::TabularAlgorithmLeapYears::TypeII, - hijri::TabularAlgorithmEpoch::Thursday, - )); - check_extrema(Hijri::new_tabular( - hijri::TabularAlgorithmLeapYears::TypeII, - hijri::TabularAlgorithmEpoch::Friday, - )); -} - -#[test] -fn check_extrema_hebrew() { - check_extrema(Hebrew::new()) -} - -#[test] -fn check_extrema_persian() { - check_extrema(Persian::new()) -} diff --git a/deps/crates/vendor/icu_calendar/src/tests/mod.rs b/deps/crates/vendor/icu_calendar/src/tests/mod.rs index b753567880b6ea..a4330b4af10b0c 100644 --- a/deps/crates/vendor/icu_calendar/src/tests/mod.rs +++ b/deps/crates/vendor/icu_calendar/src/tests/mod.rs @@ -3,5 +3,3 @@ // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). mod continuity_test; -mod extrema; -mod not_enough_fields; diff --git a/deps/crates/vendor/icu_calendar/src/tests/not_enough_fields.rs b/deps/crates/vendor/icu_calendar/src/tests/not_enough_fields.rs deleted file mode 100644 index 34aebf6f8996cc..00000000000000 --- a/deps/crates/vendor/icu_calendar/src/tests/not_enough_fields.rs +++ /dev/null @@ -1,237 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -use crate::error::DateFromFieldsError; -use crate::options::{DateFromFieldsOptions, MissingFieldsStrategy, Overflow}; -use crate::types::DateFields; -use crate::Date; - -#[test] -fn test_from_fields_not_enough_fields() { - // Pick a sufficiently complex calendar. - let calendar = crate::cal::Hebrew::new(); - - let big_i32 = Some(i32::MAX); - let big_u8 = Some(u8::MAX); - let small_u8 = Some(1); - let small_i32 = Some(5000); - let valid_month_code: Option<&[_]> = Some(b"M01"); - let invalid_month_code: Option<&[_]> = Some(b"M99"); - - // We want to ensure that most NotEnoughFields cases return NotEnoughFields - // even when we're providing out-of-range values, so that - // this produces TypeError in Temporal as opposed to RangeError. - - for overflow in [Overflow::Reject, Overflow::Constrain] { - for missing_fields in [MissingFieldsStrategy::Reject, MissingFieldsStrategy::Ecma] { - let options = DateFromFieldsOptions { - overflow: Some(overflow), - missing_fields_strategy: Some(missing_fields), - }; - - // No month data always errors - assert_eq!( - Date::try_from_fields( - DateFields { - era: Some(b"hebrew"), - era_year: big_i32, - extended_year: None, - ordinal_month: None, - month_code: None, - day: small_u8, - }, - options, - calendar - ), - Err(DateFromFieldsError::NotEnoughFields), - "Test with {options:?}" - ); - assert_eq!( - Date::try_from_fields( - DateFields { - era: Some(b"hebrew"), - era_year: small_i32, - extended_year: None, - ordinal_month: None, - month_code: None, - day: big_u8, - }, - options, - calendar - ), - Err(DateFromFieldsError::NotEnoughFields), - "Test with {options:?}" - ); - assert_eq!( - Date::try_from_fields( - DateFields { - era: None, - era_year: None, - extended_year: big_i32, - ordinal_month: None, - month_code: None, - day: small_u8, - }, - options, - calendar - ), - Err(DateFromFieldsError::NotEnoughFields), - "Test with {options:?}" - ); - - // Insufficient era-year data always errors - assert_eq!( - Date::try_from_fields( - DateFields { - era: Some(b"hebrew"), - era_year: None, - extended_year: None, - ordinal_month: big_u8, - month_code: None, - day: small_u8, - }, - options, - calendar - ), - Err(DateFromFieldsError::NotEnoughFields), - "Test with {options:?}" - ); - assert_eq!( - Date::try_from_fields( - DateFields { - era: Some(b"hebrew"), - era_year: None, - extended_year: None, - ordinal_month: small_u8, - month_code: None, - day: big_u8, - }, - options, - calendar - ), - Err(DateFromFieldsError::NotEnoughFields), - "Test with {options:?}" - ); - - // No year info errors for ordinal months regardless of missing fields strategy - assert_eq!( - Date::try_from_fields( - DateFields { - era: None, - era_year: None, - extended_year: None, - ordinal_month: small_u8, - month_code: None, - day: big_u8, - }, - options, - calendar - ), - Err(DateFromFieldsError::NotEnoughFields), - "Test with {options:?}" - ); - assert_eq!( - Date::try_from_fields( - DateFields { - era: None, - era_year: None, - extended_year: None, - ordinal_month: big_u8, - month_code: None, - day: small_u8, - }, - options, - calendar - ), - Err(DateFromFieldsError::NotEnoughFields), - "Test with {options:?}" - ); - if missing_fields != MissingFieldsStrategy::Ecma { - // No year info errors only when there is no missing fields strategy - assert_eq!( - Date::try_from_fields( - DateFields { - era: None, - era_year: None, - extended_year: None, - ordinal_month: None, - month_code: valid_month_code, - day: big_u8, - }, - options, - calendar - ), - Err(DateFromFieldsError::NotEnoughFields), - "Test with {options:?}" - ); - assert_eq!( - Date::try_from_fields( - DateFields { - era: None, - era_year: None, - extended_year: None, - ordinal_month: None, - month_code: invalid_month_code, - day: small_u8, - }, - options, - calendar - ), - Err(DateFromFieldsError::NotEnoughFields), - "Test with {options:?}" - ); - - // No day info errors only when there is no missing field strategy - assert_eq!( - Date::try_from_fields( - DateFields { - era: None, - era_year: None, - extended_year: big_i32, - ordinal_month: small_u8, - month_code: None, - day: None, - }, - options, - calendar - ), - Err(DateFromFieldsError::NotEnoughFields), - "Test with {options:?}" - ); - assert_eq!( - Date::try_from_fields( - DateFields { - era: Some(b"hebrew"), - era_year: big_i32, - extended_year: None, - ordinal_month: small_u8, - month_code: None, - day: None, - }, - options, - calendar - ), - Err(DateFromFieldsError::NotEnoughFields), - "Test with {options:?}" - ); - assert_eq!( - Date::try_from_fields( - DateFields { - era: Some(b"hebrew"), - era_year: small_i32, - extended_year: None, - ordinal_month: big_u8, - month_code: None, - day: None, - }, - options, - calendar - ), - Err(DateFromFieldsError::NotEnoughFields), - "Test with {options:?}" - ); - } - } - } -} diff --git a/deps/crates/vendor/icu_calendar/src/types.rs b/deps/crates/vendor/icu_calendar/src/types.rs index 82c5164c6e9a0c..c01f363694e57e 100644 --- a/deps/crates/vendor/icu_calendar/src/types.rs +++ b/deps/crates/vendor/icu_calendar/src/types.rs @@ -2,220 +2,16 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -//! This module contains various types used by `icu::calendar` and `icu::datetime` +//! This module contains various types used by `icu_calendar` and `icu::datetime` #[doc(no_inline)] pub use calendrical_calculations::rata_die::RataDie; use core::fmt; use tinystr::TinyAsciiStr; +use tinystr::{TinyStr16, TinyStr4}; +use zerovec::maps::ZeroMapKV; use zerovec::ule::AsULE; -// Export the duration types from here -#[cfg(feature = "unstable")] -pub use crate::duration::{DateDuration, DateDurationUnit}; -use crate::error::MonthCodeParseError; - -#[cfg(feature = "unstable")] -pub use unstable::DateFields; -#[cfg(not(feature = "unstable"))] -pub(crate) use unstable::DateFields; - -mod unstable { - /// A bag of various ways of expressing the year, month, and/or day. - /// - /// Pass this into [`Date::try_from_fields`](crate::Date::try_from_fields). - /// - ///
- /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, - /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break. - /// - /// Graduation tracking issue: [issue #7161](https://github.com/unicode-org/icu4x/issues/7161). - ///
- /// - /// ✨ *Enabled with the `unstable` Cargo feature.* - #[derive(Copy, Clone, PartialEq, Default)] - #[non_exhaustive] - pub struct DateFields<'a> { - /// The era code as a UTF-8 string. - /// - /// The acceptable codes are defined by CLDR and documented on each calendar. - /// - /// If set, [`Self::era_year`] must also be set. - /// - /// # Examples - /// - /// To set the era field, use a byte string: - /// - /// ``` - /// use icu::calendar::types::DateFields; - /// - /// let mut fields = DateFields::default(); - /// - /// // As a byte string literal: - /// fields.era = Some(b"reiwa"); - /// - /// // Using str::as_bytes: - /// fields.era = Some("reiwa".as_bytes()); - /// ``` - /// - /// For a full example, see [`Self::extended_year`]. - pub era: Option<&'a [u8]>, - /// The numeric year in [`Self::era`]. - /// - /// If set, [`Self::era`] must also be set. - /// - /// For an example, see [`Self::extended_year`]. - pub era_year: Option, - /// See [`Date::extended_year()`](crate::Date::extended_year). - /// - /// If both this and [`Self::era`]/[`Self::era_year`] are set, they must - /// refer to the same year. - /// - /// # Examples - /// - /// Either `extended_year` or `era` + `era_year` can be used in DateFields: - /// - /// ``` - /// use icu::calendar::cal::Japanese; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// - /// let mut fields1 = DateFields::default(); - /// fields1.era = Some(b"reiwa"); - /// fields1.era_year = Some(7); - /// fields1.ordinal_month = Some(1); - /// fields1.day = Some(1); - /// - /// let date1 = - /// Date::try_from_fields(fields1, Default::default(), Japanese::new()) - /// .expect("a well-defined Japanese date from era year"); - /// - /// let mut fields2 = DateFields::default(); - /// fields2.extended_year = Some(2025); - /// fields2.ordinal_month = Some(1); - /// fields2.day = Some(1); - /// - /// let date2 = - /// Date::try_from_fields(fields2, Default::default(), Japanese::new()) - /// .expect("a well-defined Japanese date from extended year"); - /// - /// assert_eq!(date1, date2); - /// - /// let year_info = date1.year().era().unwrap(); - /// assert_eq!(year_info.year, 7); - /// assert_eq!(year_info.era.as_str(), "reiwa"); - /// assert_eq!(year_info.extended_year, 2025); - /// ``` - pub extended_year: Option, - /// The month code representing a valid month in this calendar year, - /// as a UTF-8 string. - /// - /// See [`MonthCode`](crate::types::MonthCode) for information on the syntax. - /// - /// # Examples - /// - /// To set the month code field, use a byte string: - /// - /// ``` - /// use icu::calendar::types::DateFields; - /// - /// let mut fields = DateFields::default(); - /// - /// // As a byte string literal: - /// fields.era = Some(b"M02L"); - /// - /// // Using str::as_bytes: - /// fields.era = Some("M02L".as_bytes()); - /// ``` - /// - /// For a full example, see [`Self::ordinal_month`]. - pub month_code: Option<&'a [u8]>, - /// See [`MonthInfo::ordinal`](crate::types::MonthInfo::ordinal). - /// - /// If both this and [`Self::month_code`] are set, they must refer to - /// the same month. - /// - /// Note: using [`Self::month_code`] is recommended, because the ordinal month numbers - /// can vary from year to year, as illustrated in the following example. - /// - /// # Examples - /// - /// Either `month_code` or `ordinal_month` can be used in DateFields, but they - /// might not resolve to the same month number: - /// - /// ``` - /// use icu::calendar::cal::ChineseTraditional; - /// use icu::calendar::types::DateFields; - /// use icu::calendar::Date; - /// - /// // The 2023 Year of the Rabbit had a leap month after the 2nd month. - /// let mut fields1 = DateFields::default(); - /// fields1.extended_year = Some(2023); - /// fields1.month_code = Some(b"M02L"); - /// fields1.day = Some(1); - /// - /// let date1 = Date::try_from_fields( - /// fields1, - /// Default::default(), - /// ChineseTraditional::new(), - /// ) - /// .expect("a well-defined Chinese date from month code"); - /// - /// let mut fields2 = DateFields::default(); - /// fields2.extended_year = Some(2023); - /// fields2.ordinal_month = Some(3); - /// fields2.day = Some(1); - /// - /// let date2 = Date::try_from_fields( - /// fields2, - /// Default::default(), - /// ChineseTraditional::new(), - /// ) - /// .expect("a well-defined Chinese date from ordinal month"); - /// - /// assert_eq!(date1, date2); - /// - /// let month_info = date1.month(); - /// assert_eq!(month_info.ordinal, 3); - /// assert_eq!(month_info.standard_code.0, "M02L"); - /// ``` - pub ordinal_month: Option, - /// See [`DayOfMonth`](crate::types::DayOfMonth). - pub day: Option, - } -} - -// Custom impl to stringify era and month_code where possible. -impl fmt::Debug for DateFields<'_> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - // Ensures we catch future fields - let Self { - era, - era_year, - extended_year, - month_code, - ordinal_month, - day, - } = *self; - let mut builder = f.debug_struct("DateFields"); - if let Some(s) = era.and_then(|s| core::str::from_utf8(s).ok()) { - builder.field("era", &Some(s)); - } else { - builder.field("era", &era); - } - builder.field("era_year", &era_year); - builder.field("extended_year", &extended_year); - if let Some(s) = month_code.and_then(|s| core::str::from_utf8(s).ok()) { - builder.field("month_code", &Some(s)); - } else { - builder.field("month_code", &month_code); - } - builder.field("ordinal_month", &ordinal_month); - builder.field("day", &day); - builder.finish() - } -} - /// The type of year: Calendars like Chinese don't have an era and instead format with cyclic years. #[derive(Copy, Clone, Debug, PartialEq)] #[non_exhaustive] @@ -252,15 +48,6 @@ impl YearInfo { } } - /// Get the extended year (See [`Date::extended_year`](crate::Date::extended_year)) - /// for more information - pub fn extended_year(self) -> i32 { - match self { - YearInfo::Era(e) => e.extended_year, - YearInfo::Cyclic(c) => c.related_iso, - } - } - /// Get the era year information, if available pub fn era(self) -> Option { match self { @@ -301,10 +88,8 @@ pub enum YearAmbiguity { pub struct EraYear { /// The numeric year in that era pub year: i32, - /// See [`YearInfo::extended_year()`] - pub extended_year: i32, /// The era code as defined by CLDR, expect for cases where CLDR does not define a code. - pub era: TinyAsciiStr<16>, + pub era: TinyStr16, /// An era index, for calendars with a small set of eras. /// /// The only guarantee we make is that these values are stable. These do *not* @@ -341,13 +126,12 @@ pub struct CyclicYear { #[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))] #[cfg_attr(feature = "datagen", databake(path = icu_calendar::types))] #[cfg_attr(feature = "serde", derive(serde::Deserialize))] -pub struct MonthCode(pub TinyAsciiStr<4>); +pub struct MonthCode(pub TinyStr4); impl MonthCode { /// Returns an option which is `Some` containing the non-month version of a leap month /// if the [`MonthCode`] this method is called upon is a leap month, and `None` otherwise. /// This method assumes the [`MonthCode`] is valid. - #[deprecated(since = "2.1.0")] pub fn get_normal_if_leap(self) -> Option { let bytes = self.0.all_bytes(); if bytes[3] == b'L' { @@ -356,65 +140,67 @@ impl MonthCode { None } } - - #[deprecated(since = "2.1.0")] /// Get the month number and whether or not it is leap from the month code pub fn parsed(self) -> Option<(u8, bool)> { - ValidMonthCode::try_from_utf8(self.0.as_bytes()) - .ok() - .map(ValidMonthCode::to_tuple) + // Match statements on tinystrs are annoying so instead + // we calculate it from the bytes directly + + let bytes = self.0.all_bytes(); + let is_leap = bytes[3] == b'L'; + if bytes[0] != b'M' { + return None; + } + if bytes[1] == b'0' { + if bytes[2] >= b'1' && bytes[2] <= b'9' { + return Some((bytes[2] - b'0', is_leap)); + } + } else if bytes[1] == b'1' && bytes[2] >= b'0' && bytes[2] <= b'3' { + return Some((10 + bytes[2] - b'0', is_leap)); + } + None } /// Construct a "normal" month code given a number ("Mxx"). /// /// Returns an error for months greater than 99 pub fn new_normal(number: u8) -> Option { - (1..=99) - .contains(&number) - .then(|| ValidMonthCode::new_unchecked(number, false).to_month_code()) - } + let tens = number / 10; + let ones = number % 10; + if tens > 9 { + return None; + } - /// Construct a "leap" month code given a number ("MxxL"). - /// - /// Returns an error for months greater than 99 - pub fn new_leap(number: u8) -> Option { - (1..=99) - .contains(&number) - .then(|| ValidMonthCode::new_unchecked(number, true).to_month_code()) + let bytes = [b'M', b'0' + tens, b'0' + ones, 0]; + Some(MonthCode(TinyAsciiStr::try_from_raw(bytes).ok()?)) } } #[test] fn test_get_normal_month_code_if_leap() { - #![allow(deprecated)] - assert_eq!( - MonthCode::new_leap(1).unwrap().get_normal_if_leap(), - MonthCode::new_normal(1) - ); - - assert_eq!( - MonthCode::new_leap(11).unwrap().get_normal_if_leap(), - MonthCode::new_normal(11) - ); - - assert_eq!( - MonthCode::new_normal(10).unwrap().get_normal_if_leap(), - None - ); + let mc1 = MonthCode(tinystr::tinystr!(4, "M01L")); + let result1 = mc1.get_normal_if_leap(); + assert_eq!(result1, Some(MonthCode(tinystr::tinystr!(4, "M01")))); + + let mc2 = MonthCode(tinystr::tinystr!(4, "M11L")); + let result2 = mc2.get_normal_if_leap(); + assert_eq!(result2, Some(MonthCode(tinystr::tinystr!(4, "M11")))); + + let mc_invalid = MonthCode(tinystr::tinystr!(4, "M10")); + let result_invalid = mc_invalid.get_normal_if_leap(); + assert_eq!(result_invalid, None); } impl AsULE for MonthCode { - type ULE = TinyAsciiStr<4>; - fn to_unaligned(self) -> TinyAsciiStr<4> { + type ULE = TinyStr4; + fn to_unaligned(self) -> TinyStr4 { self.0 } - fn from_unaligned(u: TinyAsciiStr<4>) -> Self { + fn from_unaligned(u: TinyStr4) -> Self { Self(u) } } -#[cfg(feature = "alloc")] -impl<'a> zerovec::maps::ZeroMapKV<'a> for MonthCode { +impl<'a> ZeroMapKV<'a> for MonthCode { type Container = zerovec::ZeroVec<'a, MonthCode>; type Slice = zerovec::ZeroSlice; type GetType = ::ULE; @@ -427,89 +213,6 @@ impl fmt::Display for MonthCode { } } -/// A [`MonthCode`] that has been parsed into its internal representation. -#[derive(Copy, Clone, Debug, PartialEq)] -pub(crate) struct ValidMonthCode { - /// Month number between 0 and 99 - number: u8, - is_leap: bool, -} - -impl ValidMonthCode { - #[inline] - pub(crate) fn try_from_utf8(bytes: &[u8]) -> Result { - match *bytes { - [b'M', tens, ones] => Ok(Self { - number: (tens - b'0') * 10 + ones - b'0', - is_leap: false, - }), - [b'M', tens, ones, b'L'] => Ok(Self { - number: (tens - b'0') * 10 + ones - b'0', - is_leap: true, - }), - _ => Err(MonthCodeParseError::InvalidSyntax), - } - } - - /// Create a new ValidMonthCode without checking that the number is between 1 and 99 - #[inline] - pub(crate) const fn new_unchecked(number: u8, is_leap: bool) -> Self { - debug_assert!(1 <= number && number <= 99); - Self { number, is_leap } - } - - /// Returns the month number according to the month code. - /// - /// This is NOT the same as the ordinal month! - /// - /// # Examples - /// - /// ```ignore - /// use icu::calendar::Date; - /// use icu::calendar::cal::Hebrew; - /// - /// let hebrew_date = Date::try_new_iso(2024, 7, 1).unwrap().to_calendar(Hebrew); - /// let month_info = hebrew_date.month(); - /// - /// // Hebrew year 5784 was a leap year, so the ordinal month and month number diverge. - /// assert_eq!(month_info.ordinal, 10); - /// assert_eq!(month_info.valid_month_code.number(), 9); - /// ``` - #[inline] - pub fn number(self) -> u8 { - self.number - } - - /// Returns whether the month is a leap month. - /// - /// This is true for intercalary months in [`Hebrew`] and [`LunarChinese`]. - /// - /// [`Hebrew`]: crate::cal::Hebrew - /// [`LunarChinese`]: crate::cal::LunarChinese - #[inline] - pub fn is_leap(self) -> bool { - self.is_leap - } - - #[inline] - pub(crate) fn to_tuple(self) -> (u8, bool) { - (self.number, self.is_leap) - } - - pub(crate) fn to_month_code(self) -> MonthCode { - #[allow(clippy::unwrap_used)] // by construction - MonthCode( - TinyAsciiStr::try_from_raw([ - b'M', - b'0' + self.number / 10, - b'0' + self.number % 10, - if self.is_leap { b'L' } else { 0 }, - ]) - .unwrap(), - ) - } -} - /// Representation of a formattable month. #[derive(Copy, Clone, Debug, PartialEq)] #[non_exhaustive] @@ -522,71 +225,33 @@ pub struct MonthInfo { /// The month code, used to distinguish months during leap years. /// - /// Round-trips through `Date` constructors like [`Date::try_new_from_codes`] and [`Date::try_from_fields`]. - /// /// This follows [Temporal's specification](https://tc39.es/proposal-intl-era-monthcode/#table-additional-month-codes). /// Months considered the "same" have the same code: This means that the Hebrew months "Adar" and "Adar II" ("Adar, but during a leap year") - /// are considered the same month and have the code M05. - /// - /// [`Date::try_new_from_codes`]: crate::Date::try_new_from_codes - /// [`Date::try_from_fields`]: crate::Date::try_from_fields + /// are considered the same month and have the code M05 pub standard_code: MonthCode, - - /// Same as [`Self::standard_code`] but with invariants validated. - pub(crate) valid_standard_code: ValidMonthCode, - - /// A month code, useable for formatting. - /// - /// Does NOT necessarily round-trip through `Date` constructors like [`Date::try_new_from_codes`] and [`Date::try_from_fields`]. + /// A month code, useable for formatting /// /// This may not necessarily be the canonical month code for a month in cases where a month has different /// formatting in a leap year, for example Adar/Adar II in the Hebrew calendar in a leap year has /// the standard code M06, but for formatting specifically the Hebrew calendar will return M06L since it is formatted /// differently. - /// - /// [`Date::try_new_from_codes`]: crate::Date::try_new_from_codes - /// [`Date::try_from_fields`]: crate::Date::try_from_fields pub formatting_code: MonthCode, - - /// Same as [`Self::formatting_code`] but with invariants validated. - pub(crate) valid_formatting_code: ValidMonthCode, } impl MonthInfo { - pub(crate) fn non_lunisolar(number: u8) -> Self { - Self::for_code_and_ordinal(ValidMonthCode::new_unchecked(number, false), number) - } - - pub(crate) fn for_code_and_ordinal(code: ValidMonthCode, ordinal: u8) -> Self { - Self { - ordinal, - standard_code: code.to_month_code(), - valid_standard_code: code, - formatting_code: code.to_month_code(), - valid_formatting_code: code, - } - } - /// Gets the month number. A month number N is not necessarily the Nth month in the year /// if there are leap months in the year, rather it is associated with the Nth month of a "regular" /// year. There may be multiple month Ns in a year pub fn month_number(self) -> u8 { - self.valid_standard_code.number() + self.standard_code + .parsed() + .map(|(i, _)| i) + .unwrap_or(self.ordinal) } /// Get whether the month is a leap month pub fn is_leap(self) -> bool { - self.valid_standard_code.is_leap() - } - - #[doc(hidden)] - pub fn formatting_month_number(self) -> u8 { - self.valid_formatting_code.number() - } - - #[doc(hidden)] - pub fn formatting_is_leap(self) -> bool { - self.valid_formatting_code.is_leap() + self.standard_code.parsed().map(|(_, l)| l).unwrap_or(false) } } diff --git a/deps/crates/vendor/icu_calendar/src/week.rs b/deps/crates/vendor/icu_calendar/src/week.rs index e835fa1c811362..384b4f55d99290 100644 --- a/deps/crates/vendor/icu_calendar/src/week.rs +++ b/deps/crates/vendor/icu_calendar/src/week.rs @@ -144,7 +144,7 @@ fn add_to_weekday(weekday: Weekday, num_days: i32) -> Weekday { /// Which year or month that a calendar assigns a week to relative to the year/month /// the week is in. #[derive(Clone, Copy, Debug, PartialEq)] -#[expect(clippy::enum_variant_names)] +#[allow(clippy::enum_variant_names)] enum RelativeWeek { /// A week that is assigned to the last week of the previous year/month. e.g. 2021-01-01 is week 54 of 2020 per the ISO calendar. LastWeekOfPreviousUnit, @@ -294,7 +294,7 @@ impl Iterator for WeekdaySetIterator { #[cfg(test)] mod tests { use super::*; - use crate::{types::DateDuration, types::Weekday, Date, RangeError}; + use crate::{types::Weekday, Date, DateDuration, RangeError}; static ISO_CALENDAR: WeekCalculator = WeekCalculator { first_weekday: Weekday::Monday, @@ -457,9 +457,7 @@ mod tests { let day = (yyyymmdd % 100) as u8; let date = Date::try_new_iso(year, month, day)?; - let previous_month = date - .try_added_with_options(DateDuration::for_months(-1), Default::default()) - .unwrap(); + let previous_month = date.added(DateDuration::new(0, -1, 0, 0)); calendar.week_of( u16::from(previous_month.days_in_month()), @@ -648,7 +646,7 @@ fn test_iso_weeks() { use crate::types::IsoWeekOfYear; use crate::Date; - #[expect(clippy::zero_prefixed_literal)] + #[allow(clippy::zero_prefixed_literal)] for ((y, m, d), (iso_year, week_number)) in [ // 2010 starts on a Thursday, so 2009 has 53 ISO weeks ((2009, 12, 30), (2009, 53)), diff --git a/deps/crates/vendor/icu_calendar/tests/arithmetic.rs b/deps/crates/vendor/icu_calendar/tests/arithmetic.rs deleted file mode 100644 index 37c4b97ffb7926..00000000000000 --- a/deps/crates/vendor/icu_calendar/tests/arithmetic.rs +++ /dev/null @@ -1,251 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -use std::convert::Infallible; - -use icu_calendar::{ - cal::Hebrew, - options::{DateAddOptions, DateDifferenceOptions, Overflow}, - types::{DateDuration, DateDurationUnit, MonthCode}, - AsCalendar, Calendar, Date, Iso, -}; - -#[rustfmt::skip] -#[allow(clippy::type_complexity)] -const ISO_DATE_PAIRS: &[(&str, &str, u64, (u32, u64), (u32, u64), (u32, u32, u64))] = &[ - // d0, d1, D, (W, D), (M, D), (Y, M, D) - ("2020-01-03", "2020-02-15", 43, (6, 1), (1, 12), (0, 1, 12)), - ("2020-01-31", "2020-06-30", 151, (21, 4), (4, 30), (0, 4, 30)), - ("2020-03-31", "2020-07-30", 121, (17, 2), (3, 30), (0, 3, 30)), - ("2020-03-31", "2020-07-31", 122, (17, 3), (4, 0), (0, 4, 0)), - ("2016-03-20", "2020-03-05", 1446, (206, 4), (47, 14), (3, 11, 14)), - ("2020-02-29", "2022-03-01", 731, (104, 3), (24, 1), (2, 0, 1)), - - // Negative direction: - ("2020-02-15", "2020-01-03", 43, (6, 1), (1, 12), (0, 1, 12)), - ("2020-06-30", "2020-01-31", 151, (21, 4), (4, 29), (0, 4, 29)), // DIFF +/- - ("2020-07-30", "2020-03-31", 121, (17, 2), (3, 30), (0, 3, 30)), - ("2020-07-31", "2020-03-31", 122, (17, 3), (4, 0), (0, 4, 0)), - ("2020-03-05", "2016-03-20", 1446, (206, 4), (47, 16), (3, 11, 16)), // DIFF +/- - ("2022-03-01", "2020-02-29", 731, (104, 3), (24, 1), (2, 0, 1)), -]; - -fn check
( - d0: &Date, - d1: &Date, - exp0: &u64, - exp1: &(u32, u64), - exp2: &(u32, u64), - exp3: &(u32, u32, u64), -) where - A: AsCalendar + Copy, - ::Calendar: Calendar, - <::Calendar as Calendar>::DateInner: PartialOrd, -{ - let is_negative = d0 > d1; - let mut add_options = DateAddOptions::default(); - add_options.overflow = Some(Overflow::Constrain); - let mut until_options0 = DateDifferenceOptions::default(); - until_options0.largest_unit = Some(DateDurationUnit::Days); - let mut until_options1 = DateDifferenceOptions::default(); - until_options1.largest_unit = Some(DateDurationUnit::Weeks); - let mut until_options2 = DateDifferenceOptions::default(); - until_options2.largest_unit = Some(DateDurationUnit::Months); - let mut until_options3 = DateDifferenceOptions::default(); - until_options3.largest_unit = Some(DateDurationUnit::Years); - - let Ok(p0) = d0.try_until_with_options(d1, until_options0); - assert_eq!( - p0, - DateDuration { - is_negative, - days: *exp0, - ..Default::default() - }, - "{d0:?}/{d1:?}" - ); - assert_eq!( - d0.try_added_with_options(p0, add_options).unwrap(), - *d1, - "{d0:?}/{d1:?}" - ); - - let Ok(p1) = d0.try_until_with_options(d1, until_options1); - assert_eq!( - p1, - DateDuration { - is_negative, - weeks: exp1.0, - days: exp1.1, - ..Default::default() - }, - "{d0:?}/{d1:?}" - ); - assert_eq!( - d0.try_added_with_options(p1, add_options).unwrap(), - *d1, - "{d0:?}/{d1:?}" - ); - - let Ok(p2) = d0.try_until_with_options(d1, until_options2); - assert_eq!( - p2, - DateDuration { - is_negative, - months: exp2.0, - days: exp2.1, - ..Default::default() - }, - "{d0:?}/{d1:?}" - ); - assert_eq!( - d0.try_added_with_options(p2, add_options).unwrap(), - *d1, - "{d0:?}/{d1:?}" - ); - - let Ok(p3) = d0.try_until_with_options(d1, until_options3); - assert_eq!( - p3, - DateDuration { - is_negative, - years: exp3.0, - months: exp3.1, - days: exp3.2, - ..Default::default() - }, - "{d0:?}/{d1:?}" - ); - assert_eq!( - d0.try_added_with_options(p3, add_options).unwrap(), - *d1, - "{d0:?}/{d1:?}" - ); - - // RataDie addition should be equivalent for largest unit Days and Weeks - let rd_diff = d1.to_rata_die() - d0.to_rata_die(); - if is_negative { - assert!(rd_diff.is_negative()); - } - assert_eq!(p0.days, rd_diff.unsigned_abs()); - assert_eq!(p1.days + u64::from(p1.weeks) * 7, rd_diff.unsigned_abs()); -} - -#[test] -fn test_arithmetic_cases() { - for (d0, d1, exp0, exp1, exp2, exp3) in ISO_DATE_PAIRS { - let d0 = Date::try_from_str(d0, Iso).unwrap(); - let d1 = Date::try_from_str(d1, Iso).unwrap(); - check(&d0, &d1, exp0, exp1, exp2, exp3); - } -} - -#[test] -fn test_hebrew() { - let m06z_20 = - Date::try_new_from_codes(None, 5783, MonthCode::new_normal(6).unwrap(), 20, Hebrew) - .unwrap(); - let m05l_15 = - Date::try_new_from_codes(None, 5784, MonthCode::new_leap(5).unwrap(), 15, Hebrew).unwrap(); - let m05l_30 = - Date::try_new_from_codes(None, 5784, MonthCode::new_leap(5).unwrap(), 30, Hebrew).unwrap(); - let m06a_29 = - Date::try_new_from_codes(None, 5784, MonthCode::new_normal(6).unwrap(), 29, Hebrew) - .unwrap(); - let m07a_10 = - Date::try_new_from_codes(None, 5784, MonthCode::new_normal(7).unwrap(), 10, Hebrew) - .unwrap(); - let m06b_15 = - Date::try_new_from_codes(None, 5785, MonthCode::new_normal(6).unwrap(), 15, Hebrew) - .unwrap(); - let m07b_20 = - Date::try_new_from_codes(None, 5785, MonthCode::new_normal(7).unwrap(), 20, Hebrew) - .unwrap(); - - #[rustfmt::skip] - #[allow(clippy::type_complexity)] - let cases: &[(&Date, &Date, u64, (u32, u64), (u32, u64), (u32, u32, u64))] = &[ - (&m06z_20, &m05l_15, 348, (49, 5), (11, 25), (0, 11, 25)), - (&m06z_20, &m05l_30, 363, (51, 6), (12, 10), (0, 12, 10)), - (&m06z_20, &m06a_29, 392, (56, 0), (13, 9), (1, 0, 9)), - (&m06z_20, &m07a_10, 402, (57, 3), (13, 19), (1, 0, 19)), - (&m06z_20, &m06b_15, 733, (104,5), (24, 25), (1, 11, 25)), - (&m06z_20, &m07b_20, 767, (109,4), (26, 0), (2, 1, 0)), - - (&m05l_15, &m05l_30, 15, (2, 1), (0, 15), (0, 0, 15)), - (&m05l_15, &m06a_29, 44, (6, 2), (1, 14), (0, 1, 14)), - (&m05l_15, &m07a_10, 54, (7, 5), (1, 24), (0, 1, 24)), - (&m05l_15, &m06b_15, 385, (55, 0), (13, 0), (1, 0, 0)), // M05L to M06 common year - (&m05l_15, &m07b_20, 419, (59, 6), (14, 5), (1, 1, 5)), // M05L to M07 common year - - (&m05l_30, &m06a_29, 29, (4, 1), (0, 29), (0, 0, 29)), - (&m05l_30, &m07a_10, 39, (5, 4), (1, 10), (0, 1, 10)), - (&m05l_30, &m06b_15, 370, (52, 6), (12, 15), (0, 12, 15)), // M05L to M06 common year - (&m05l_30, &m07b_20, 404, (57, 5), (13, 20), (1, 0, 20)), // M05L to M07 common year - - (&m06a_29, &m07a_10, 10, (1, 3), (0, 10), (0, 0, 10)), - (&m06a_29, &m06b_15, 341, (48, 5), (11, 16), (0, 11, 16)), // M06 leap year to M06 common year - (&m06a_29, &m07b_20, 375, (53, 4), (12, 20), (1, 0, 20)), // M06 leap year to M07 common year - (&m07a_10, &m06b_15, 331, (47, 2), (11, 5), (0, 11, 5)), // M07 leap year to M06 common year - (&m07a_10, &m07b_20, 365, (52, 1), (12, 10), (1, 0, 10)), // M07 leap year to M06 common year - (&m06b_15, &m07b_20, 34, (4, 6), (1, 5), (0, 1, 5)), - ]; - - for (d0, d1, exp0, exp1, exp2, exp3) in cases { - check(d0, d1, exp0, exp1, exp2, exp3); - } -} - -#[test] -fn test_tricky_leap_months() { - let mut add_options = DateAddOptions::default(); - add_options.overflow = Some(Overflow::Constrain); - let mut until_options = DateDifferenceOptions::default(); - until_options.largest_unit = Some(DateDurationUnit::Years); - - fn hebrew_date(year: i32, month: &str, day: u8) -> Date { - Date::try_new_from_codes(None, year, MonthCode(month.parse().unwrap()), day, Hebrew) - .unwrap() - } - - // M06 + 1yr = M06 (common to leap) - let date0 = hebrew_date(5783, "M06", 20); - let duration0 = DateDuration::for_years(1); - let date1 = date0 - .try_added_with_options(duration0, add_options) - .unwrap(); - assert_eq!(date1, hebrew_date(5784, "M06", 20)); - let duration0_actual = date0.try_until_with_options(&date1, until_options).unwrap(); - assert_eq!(duration0_actual, duration0); - - // M06 - 1mo = M05L (leap to leap) - let duration1 = DateDuration::for_months(-1); - let date2 = date1 - .try_added_with_options(duration1, add_options) - .unwrap(); - assert_eq!(date2, hebrew_date(5784, "M05L", 20)); - let duration1_actual = date1.try_until_with_options(&date2, until_options).unwrap(); - assert_eq!(duration1_actual, duration1); - - // M05L + 1yr1mo = M07 (leap to common) - let duration2 = DateDuration { - years: 1, - months: 1, - ..Default::default() - }; - let date3 = date2 - .try_added_with_options(duration2, add_options) - .unwrap(); - assert_eq!(date3, hebrew_date(5785, "M07", 20)); - let duration2_actual = date2.try_until_with_options(&date3, until_options).unwrap(); - assert_eq!(duration2_actual, duration2); - - // M06 + 1yr1mo = M07 (leap to common) - let date4 = date1 - .try_added_with_options(duration2, add_options) - .unwrap(); - assert_eq!(date4, hebrew_date(5785, "M07", 20)); - let duration2_actual = date1.try_until_with_options(&date4, until_options).unwrap(); - assert_eq!(duration2_actual, duration2); -} diff --git a/deps/crates/vendor/icu_calendar/tests/exhaustive.rs b/deps/crates/vendor/icu_calendar/tests/exhaustive.rs deleted file mode 100644 index 7552900a92fb2b..00000000000000 --- a/deps/crates/vendor/icu_calendar/tests/exhaustive.rs +++ /dev/null @@ -1,201 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -use icu_calendar::*; - -const MAGNITUDE: i32 = 1_000_000; - -// Check rd -> date -> iso -> date -> rd for whole range -#[test] -#[ignore] // takes about 200 seconds in release-with-assertions -fn check_round_trip() { - fn test(cal: C) { - let cal = Ref(&cal); - let low = Date::try_new_iso(-MAGNITUDE, 1, 1).unwrap().to_rata_die(); - let high = Date::try_new_iso(MAGNITUDE, 12, 31).unwrap().to_rata_die(); - let mut prev = Date::from_rata_die(low, cal); - let mut curr = low + 1; - while curr <= high { - let date = Date::from_rata_die(curr, cal); - assert!(prev < date); - - let rd = date.to_rata_die(); - assert_eq!(rd, curr, "{}", cal.as_calendar().debug_name()); - - let date2 = Date::new_from_iso(date.to_iso(), cal); - assert_eq!(date, date2, "{:?}", cal.as_calendar().debug_name()); - - prev = date; - curr += 1; - } - } - - for_each_calendar!(test); -} - -#[test] -#[ignore] // takes about 90 seconds in release-with-assertions -fn check_from_fields() { - fn test(cal: C) { - let cal = Ref(&cal); - - let codes = (1..19) - .flat_map(|i| { - [ - types::MonthCode::new_normal(i).unwrap(), - types::MonthCode::new_leap(i).unwrap(), - ] - .into_iter() - }) - .collect::>(); - for year in -MAGNITUDE..=MAGNITUDE { - if year % 50000 == 0 { - println!("{} {year:?}", cal.as_calendar().debug_name()); - } - for overflow in [options::Overflow::Constrain, options::Overflow::Reject] { - let mut options = options::DateFromFieldsOptions::default(); - options.overflow = Some(overflow); - for mut fields in codes - .iter() - .map(|m| { - let mut fields = types::DateFields::default(); - fields.month_code = Some(m.0.as_bytes()); - fields - }) - .chain((1..20).map(|m| { - let mut fields = types::DateFields::default(); - fields.ordinal_month = Some(m); - fields - })) - { - for day in 1..50 { - fields.extended_year = Some(year); - fields.day = Some(day); - let _ = Date::try_from_fields(fields, options, Ref(&cal)); - } - } - } - } - } - for_each_calendar!(test); -} - -macro_rules! for_each_calendar { - ($f:ident) => { - [ - || { - $f(cal::Buddhist); - println!("Buddhist done"); - }, - || { - $f(cal::east_asian_traditional::EastAsianTraditional( - EastAsianTraditionalYears::new(cal::east_asian_traditional::China::default()), - )); - println!("Chinese done"); - }, - || { - $f(cal::Coptic); - println!("Coptic done"); - }, - || { - $f(cal::east_asian_traditional::EastAsianTraditional( - EastAsianTraditionalYears::new(cal::east_asian_traditional::Korea::default()), - )); - println!("Korean done"); - }, - || { - $f(cal::Ethiopian::new()); - println!("Ethiopian done"); - }, - || { - $f(cal::Ethiopian::new_with_era_style( - cal::EthiopianEraStyle::AmeteAlem, - )); - println!("Ethiopian (Amete Alem) done"); - }, - || { - $f(cal::Gregorian); - println!("Gregorian done"); - }, - || { - $f(cal::Hebrew::new()); - println!("Hebrew done"); - }, - || { - $f(cal::Hijri::new_tabular( - cal::hijri::TabularAlgorithmLeapYears::TypeII, - cal::hijri::TabularAlgorithmEpoch::Friday, - )); - println!("Hijri (tabular) done"); - }, - || { - $f(cal::Hijri::new_tabular( - cal::hijri::TabularAlgorithmLeapYears::TypeII, - cal::hijri::TabularAlgorithmEpoch::Thursday, - )); - println!("Hijri (astronomical) done"); - }, - || { - $f(cal::Hijri::new_umm_al_qura()); - println!("Hijri (UAQ) done"); - }, - || { - $f(cal::Indian::new()); - println!("Indian done"); - }, - || { - $f(cal::Iso::new()); - println!("Iso done"); - }, - || { - $f(cal::Julian::new()); - println!("Julian done"); - }, - || { - $f(cal::Japanese::new()); - println!("Japanese done"); - }, - || { - $f(cal::JapaneseExtended::new()); - println!("JapaneseExtended done"); - }, - || { - $f(cal::Persian::new()); - println!("Persian done"); - }, - || { - $f(cal::Roc); - println!("Roc done"); - }, - ] - .map(std::thread::spawn) - .into_iter() - .for_each(|h| h.join().unwrap()); - }; -} -use for_each_calendar; - -// Precalculates Chinese years, significant performance improvement -#[derive(Debug, Clone)] -struct EastAsianTraditionalYears(Vec); - -impl EastAsianTraditionalYears { - fn new(r: R) -> Self { - Self( - ((-MAGNITUDE - 1)..=MAGNITUDE) - .map(|i| r.year_data(i)) - .collect(), - ) - } -} - -impl cal::scaffold::UnstableSealed for EastAsianTraditionalYears {} -impl cal::east_asian_traditional::Rules for EastAsianTraditionalYears { - fn year_data( - &self, - related_iso: i32, - ) -> cal::east_asian_traditional::EastAsianTraditionalYearData { - self.0[(related_iso + MAGNITUDE + 1) as usize] - } -} diff --git a/deps/crates/vendor/icu_calendar/tests/extended_year.rs b/deps/crates/vendor/icu_calendar/tests/extended_year.rs deleted file mode 100644 index 262dec5c24c913..00000000000000 --- a/deps/crates/vendor/icu_calendar/tests/extended_year.rs +++ /dev/null @@ -1,85 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -use icu_calendar::types::MonthCode; -use icu_calendar::AnyCalendar; -use icu_calendar::AnyCalendarKind; -use icu_calendar::Date; - -#[cfg(test)] -use std::rc::Rc; - -/// Reference: -static EXTENDED_EPOCHS: &[(AnyCalendarKind, i32)] = &[ - (AnyCalendarKind::Buddhist, -543), - (AnyCalendarKind::Chinese, 0), - (AnyCalendarKind::Coptic, 283), - (AnyCalendarKind::Dangi, 0), - (AnyCalendarKind::Ethiopian, 7), - (AnyCalendarKind::EthiopianAmeteAlem, -5493), - (AnyCalendarKind::Gregorian, 0), - (AnyCalendarKind::Hebrew, -3761), - (AnyCalendarKind::Indian, 78), - (AnyCalendarKind::HijriTabularTypeIIFriday, 621), - (AnyCalendarKind::HijriSimulatedMecca, 621), - (AnyCalendarKind::HijriTabularTypeIIThursday, 621), - (AnyCalendarKind::HijriUmmAlQura, 621), - (AnyCalendarKind::Iso, 0), - (AnyCalendarKind::Japanese, 0), - (AnyCalendarKind::JapaneseExtended, 0), - (AnyCalendarKind::Persian, 621), - (AnyCalendarKind::Roc, 1911), -]; - -#[test] -fn test_extended_year() { - let iso = icu_calendar::cal::Iso; - let m_01 = MonthCode::new_normal(1).unwrap(); - for (kind, extended_epoch) in EXTENDED_EPOCHS.iter() { - let calendar = Rc::new(AnyCalendar::new(*kind)); - - // Create the first date in the epoch year (extended_year = 0) - let date_in_epoch_year = - Date::try_new_from_codes(None, 0, m_01, 1, calendar.clone()).unwrap(); - let iso_date_in_epoch_year = date_in_epoch_year.to_calendar(iso); - assert_eq!( - iso_date_in_epoch_year.extended_year(), - *extended_epoch, - "Extended year for {date_in_epoch_year:?} should be {extended_epoch}" - ); - - // Test that for all calendars except Japanese, the *current* era is - // the same as that used for the extended year - // This date can be anything as long as it is vaguely modern. - // - // Note that this property is not *required* by the specification, new - // calendars may have epochs that do not follow this property. This - // property is strongly suggested by the specification as a rule of thumb - // to follow where possible. - let iso_date_in_2025 = Date::try_new_iso(2025, 1, 1).unwrap(); - let date_in_2025 = iso_date_in_2025.to_calendar(calendar.clone()); - - // The extended year should align with the year in the modern era or related ISO. - // There is a special case for Japanese since it has a modern era but uses ISO for the extended year. - if matches!( - kind, - AnyCalendarKind::Japanese | AnyCalendarKind::JapaneseExtended - ) { - assert_eq!( - date_in_2025.extended_year(), - 2025, - "Extended year for {date_in_2025:?} should be 2025" - ); - } else { - // Note: This code only works because 2025 is in the modern era for all calendars. - // These two function calls are not equivalent in general. - let expected = date_in_2025.year().era_year_or_related_iso(); - assert_eq!( - date_in_2025.extended_year(), - expected, - "Extended year for {date_in_2025:?} should be {expected}" - ); - } - } -} diff --git a/deps/crates/vendor/icu_calendar/tests/reference_year.rs b/deps/crates/vendor/icu_calendar/tests/reference_year.rs deleted file mode 100644 index 35293569a68a9c..00000000000000 --- a/deps/crates/vendor/icu_calendar/tests/reference_year.rs +++ /dev/null @@ -1,323 +0,0 @@ -// This file is part of ICU4X. For terms of use, please see the file -// called LICENSE at the top level of the ICU4X source tree -// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -use std::{collections::HashSet, fmt::Debug}; - -use icu_calendar::{ - cal::*, - error::DateFromFieldsError, - options::{DateFromFieldsOptions, MissingFieldsStrategy, Overflow}, - types::{DateFields, MonthCode}, - Calendar, Date, Ref, -}; - -/// Test that a given calendar produces valid monthdays -/// -/// `valid_md_condition`, given (month_number, is_leap, day_number), should return whether or not -/// that combination is ever possible in that calendar -fn test_reference_year_impl(cal: C, valid_md_condition: impl Fn(u8, bool, u8) -> bool) -where - C: Calendar + Debug, -{ - // Test that all dates in a certain range behave according to Temporal - let mut month_days_seen = HashSet::new(); - let mut rd = Date::try_new_iso(1972, 12, 31).unwrap().to_rata_die(); - for _ in 1..2000 { - let date = Date::from_rata_die(rd, Ref(&cal)); - let month_day = (date.month().standard_code, date.day_of_month().0); - let mut fields = DateFields::default(); - fields.month_code = Some(month_day.0 .0.as_bytes()); - fields.day = Some(month_day.1); - let mut options = DateFromFieldsOptions::default(); - options.missing_fields_strategy = Some(MissingFieldsStrategy::Ecma); - let reference_date = Date::try_from_fields(fields, options, Ref(&cal)).unwrap(); - if month_days_seen.contains(&month_day) { - assert_ne!(date, reference_date, "{cal:?}"); - } else { - assert_eq!(date, reference_date, "{cal:?}"); - month_days_seen.insert(month_day); - } - rd -= 1; - } - // Test that all MonthDay values round-trip - for month_number in 1..=14 { - for is_leap in [false, true] { - let mut valid_day_number = 1; - let is_valid_month = valid_md_condition(month_number, is_leap, valid_day_number); - for day_number in 1..=32 { - if valid_md_condition(month_number, is_leap, day_number) { - valid_day_number = day_number; - } - let mut fields = DateFields::default(); - let mc = match is_leap { - false => MonthCode::new_normal(month_number), - true => MonthCode::new_leap(month_number), - }; - fields.month_code = mc.as_ref().map(|m| m.0.as_bytes()); - fields.day = Some(day_number); - let mut options = DateFromFieldsOptions::default(); - options.overflow = Some(Overflow::Constrain); - options.missing_fields_strategy = Some(MissingFieldsStrategy::Ecma); - let reference_date = match Date::try_from_fields(fields, options, Ref(&cal)) { - Ok(d) => { - assert!( - is_valid_month, - "try_from_fields passed but should have failed: {fields:?} => {d:?}" - ); - d - } - Err(DateFromFieldsError::MonthCodeNotInCalendar) => { - assert!( - !is_valid_month, - "try_from_fields failed but should have passed: {fields:?}" - ); - continue; - } - Err(e) => { - panic!("Unexpected error in month day from fields: {e}"); - } - }; - - // Test round-trip (to valid day number) - assert_eq!( - fields.month_code.unwrap(), - reference_date.month().standard_code.0.as_bytes(), - "{fields:?} {cal:?}" - ); - assert_eq!( - valid_day_number, - reference_date.day_of_month().0, - "{fields:?} {cal:?}" - ); - - // Test Overflow::Reject - options.overflow = Some(Overflow::Reject); - let reject_result = Date::try_from_fields(fields, options, Ref(&cal)); - if valid_day_number == day_number { - assert_eq!(reject_result, Ok(reference_date)); - } else { - assert!(matches!( - reject_result, - Err(DateFromFieldsError::Range { .. }) - )) - } - - // Test that ordinal months cause it to fail (even if the month code is still set) - fields.ordinal_month = Some(month_number); - let ordinal_result = Date::try_from_fields(fields, options, Ref(&cal)); - assert!(matches!( - ordinal_result, - Err(DateFromFieldsError::NotEnoughFields) - )); - } - } - } -} - -fn gregorian_md_condition(month_number: u8, is_leap: bool, day_number: u8) -> bool { - // No leap months - if is_leap { - return false; - } - - match month_number { - 1 | 3 | 5 | 7 | 8 | 10 | 12 => day_number <= 31, - 2 => day_number <= 29, - 4 | 6 | 9 | 11 => day_number <= 30, - _ => { - assert!(month_number > 12); - // No other months - false - } - } -} - -fn chinese_md_condition(month_number: u8, _is_leap: bool, day_number: u8) -> bool { - month_number <= 12 && day_number <= 30 -} - -fn coptic_md_condition(month_number: u8, is_leap: bool, day_number: u8) -> bool { - // No leap months - if is_leap { - return false; - } - match month_number { - 1..=12 => day_number <= 30, - 13 => day_number <= 6, - _ => false, - } -} - -fn hijri_md_condition(month_number: u8, is_leap: bool, day_number: u8) -> bool { - // No leap months - if is_leap { - return false; - } - month_number <= 12 && day_number <= 30 -} - -fn hijri_tabular_md_condition(month_number: u8, is_leap: bool, day_number: u8) -> bool { - // No leap months - if is_leap { - return false; - } - - if month_number > 12 { - return false; - } - - // Odd months have 30 days, even months have 29, except for M12 in a leap year - if month_number % 2 == 0 { - if month_number == 12 { - day_number <= 30 - } else { - day_number <= 29 - } - } else { - day_number <= 30 - } -} - -fn hebrew_md_condition(month_number: u8, is_leap: bool, day_number: u8) -> bool { - if is_leap { - return month_number == 5 && day_number <= 30; - } - match month_number { - 1 | 2 | 3 | 5 | 7 | 9 | 11 => day_number <= 30, - // Tevet, Adar, Iyar, Tammuz, Elul - 4 | 6 | 8 | 10 | 12 => day_number <= 29, - _ => { - assert!(month_number > 12); - // No other months - false - } - } -} - -#[test] -fn test_reference_year_buddhist() { - test_reference_year_impl(Buddhist, gregorian_md_condition) -} - -#[test] -fn test_reference_year_chinese() { - test_reference_year_impl(ChineseTraditional::new(), chinese_md_condition) -} - -#[test] -fn test_reference_year_coptic() { - test_reference_year_impl(Coptic, coptic_md_condition) -} - -#[test] -fn test_reference_year_korean() { - test_reference_year_impl(KoreanTraditional::new(), chinese_md_condition) -} - -#[test] -fn test_reference_year_ethiopian() { - test_reference_year_impl(Ethiopian::new(), coptic_md_condition) -} - -#[test] -fn test_reference_year_ethiopian_amete_alem() { - test_reference_year_impl( - Ethiopian::new_with_era_style(EthiopianEraStyle::AmeteAlem), - coptic_md_condition, - ) -} - -#[test] -fn test_reference_year_gregorian() { - test_reference_year_impl(Gregorian, gregorian_md_condition) -} - -#[test] -fn test_reference_year_julian() { - test_reference_year_impl(Julian, gregorian_md_condition) -} - -#[test] -fn test_reference_year_hebrew() { - test_reference_year_impl(Hebrew, hebrew_md_condition) -} - -#[test] -fn test_reference_year_indian() { - test_reference_year_impl(Indian, |month_number, is_leap, day_number| { - if is_leap { - // No leap months - return false; - } - // First half of the year has long months, second half short - if month_number <= 6 { - day_number <= 31 - } else if month_number <= 12 { - day_number <= 30 - } else { - // No larger months - false - } - }) -} - -#[test] -fn test_reference_year_hijri_tabular_type_ii_friday() { - test_reference_year_impl( - Hijri::new_tabular(HijriTabularLeapYears::TypeII, HijriTabularEpoch::Friday), - hijri_tabular_md_condition, - ) -} - -#[test] -fn test_reference_year_hijri_tabular_type_ii_thursday() { - test_reference_year_impl( - Hijri::new_tabular(HijriTabularLeapYears::TypeII, HijriTabularEpoch::Thursday), - hijri_tabular_md_condition, - ) -} - -#[test] -fn test_reference_year_hijri_umm_al_qura() { - test_reference_year_impl(Hijri::new_umm_al_qura(), hijri_md_condition) -} - -#[test] -fn test_reference_year_iso() { - test_reference_year_impl(Iso, gregorian_md_condition) -} - -#[test] -fn test_reference_year_japanese() { - test_reference_year_impl(Japanese::new(), gregorian_md_condition) -} - -#[test] -fn test_reference_year_japanese_extended() { - test_reference_year_impl(JapaneseExtended::new(), gregorian_md_condition) -} - -#[test] -fn test_reference_year_persian() { - test_reference_year_impl(Persian, |month_number, is_leap, day_number| { - if is_leap { - // No leap months - return false; - } - // First half of the year has long months, second half short - if month_number <= 6 { - day_number <= 31 - } else if month_number <= 12 { - day_number <= 30 - } else { - // No larger months - false - } - }) -} - -#[test] -fn test_reference_year_roc() { - test_reference_year_impl(Roc, gregorian_md_condition) -} diff --git a/deps/crates/vendor/icu_calendar_data/.cargo-checksum.json b/deps/crates/vendor/icu_calendar_data/.cargo-checksum.json index 5581eabccf52bd..1f89ad9e1d30ab 100644 --- a/deps/crates/vendor/icu_calendar_data/.cargo-checksum.json +++ b/deps/crates/vendor/icu_calendar_data/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo_vcs_info.json":"5ddfa3bbe4563249b2050508901cbefb05bd351ea39f5f4add8bc520346ce932","Cargo.lock":"af8b0f1887466167d9776494d3fd9cd8d63b742147ef69538987e7ec190da413","Cargo.toml":"ecdae7056aa05f5e981175be5c1ba744f819438cef7db31d3f9873fbbfe22575","Cargo.toml.orig":"31d1f8d246401f127cd0738522290375cd6124a8ef9232a650aded78f8071ded","LICENSE":"f367c1b8e1aa262435251e442901da4607b4650e0e63a026f5044473ecfb90f2","README.md":"089095cfdb8ce866d7ca71b51433144fb4878dc4ca9b5590b2327b11fdb64b1b","build.rs":"c2d446772e3d766a804963dbf36e51729f910920f91f4b68c0c199fe6ca0853e","data/calendar_japanese_extended_v1.rs.data":"079e4f46ffd69977a95364c12df5455342cd8dc03593b44d2fb73fe06c7145ef","data/calendar_japanese_modern_v1.rs.data":"3b836a21d5e537e06e3b767d44aee023222113415bcc3dbf87248fa89de70928","data/calendar_week_v1.rs.data":"c59edb26ec8b391b52ffa6ad9088d8a51b8353cffc04268701a824e0e9b76c21","data/mod.rs":"ad146e2fac0e7858fea7a10082a8bd63ae0a014b6ff885b041c66c7cc2579bbd","src/lib.rs":"bfc8989a13fe15781d30b59aa152d1806d99a77dbf326d118c5e196a534ccef0"},"package":"527f04223b17edfe0bd43baf14a0cb1b017830db65f3950dc00224860a9a446d"} \ No newline at end of file +{"files":{"Cargo.toml":"53ee9b1dd6ad1a0b1dcb72e7c08db14631db21ecbf7f9f1ed3b10f29b6a8899a","LICENSE":"f367c1b8e1aa262435251e442901da4607b4650e0e63a026f5044473ecfb90f2","README.md":"c34a8f4d0526ef4b3acc8383a1ab33422dc040dd3b9cf5bf0684125beb8fdd71","build.rs":"c2d446772e3d766a804963dbf36e51729f910920f91f4b68c0c199fe6ca0853e","data/calendar_chinese_v1.rs.data":"245c945efcd1ab04d9aad235617d9580bac52061403d371c47d23cce14eaab65","data/calendar_dangi_v1.rs.data":"916f004b0aba23972d96faffb83a06459034a8603037c35ea0e5d4e084bfbd2a","data/calendar_hijri_simulated_mecca_v1.rs.data":"111da8179793ee6d03091a525419e3d34dc6018474189e2f246f0775f3324814","data/calendar_japanese_extended_v1.rs.data":"24c71e99ec40cfecdcd10e2e006b8b708498f2427b7fdf7f63ae2ecbdb7e8b61","data/calendar_japanese_modern_v1.rs.data":"f34dd70c859071b74235200d3389a22c8fb08a895fb326e11fbc1be16c92e686","data/calendar_week_v1.rs.data":"908fba042125ff2c1ff911619ef5926423dd0e2d15f8c70ea9838e3a357002ec","data/mod.rs":"9a9f9b8da50eba75f93763b90bf068cf9de34795a9baca05146912dab9fc1bc8","src/lib.rs":"62940139b0cb9cbe9629ab45e716b095403f13042b08c378f17de8357ccab253"},"package":"7219c8639ab936713a87b571eed2bc2615aa9137e8af6eb221446ee5644acc18"} \ No newline at end of file diff --git a/deps/crates/vendor/icu_calendar_data/.cargo_vcs_info.json b/deps/crates/vendor/icu_calendar_data/.cargo_vcs_info.json deleted file mode 100644 index 266c749a288779..00000000000000 --- a/deps/crates/vendor/icu_calendar_data/.cargo_vcs_info.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "git": { - "sha1": "38a49da495248dd1ded84cf306e4ca42e64d5bb3" - }, - "path_in_vcs": "provider/data/calendar" -} \ No newline at end of file diff --git a/deps/crates/vendor/icu_calendar_data/Cargo.lock b/deps/crates/vendor/icu_calendar_data/Cargo.lock deleted file mode 100644 index 5b794b991b85ba..00000000000000 --- a/deps/crates/vendor/icu_calendar_data/Cargo.lock +++ /dev/null @@ -1,7 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "icu_calendar_data" -version = "2.1.1" diff --git a/deps/crates/vendor/icu_calendar_data/Cargo.toml b/deps/crates/vendor/icu_calendar_data/Cargo.toml index 0f20ba005c23ec..48da7be47196bc 100644 --- a/deps/crates/vendor/icu_calendar_data/Cargo.toml +++ b/deps/crates/vendor/icu_calendar_data/Cargo.toml @@ -11,9 +11,9 @@ [package] edition = "2021" -rust-version = "1.83" +rust-version = "1.82" name = "icu_calendar_data" -version = "2.1.1" +version = "2.0.0" authors = ["The ICU4X Project Developers"] build = "build.rs" include = [ @@ -40,10 +40,10 @@ license = "Unicode-3.0" repository = "https://github.com/unicode-org/icu4x" [package.metadata.sources.cldr] -tagged = "48.0.0" +tagged = "47.0.0" [package.metadata.sources.icuexport] -tagged = "release-78.1rc" +tagged = "icu4x/2025-05-01/77.x" [package.metadata.sources.segmenter_lstm] tagged = "v0.1.0" diff --git a/deps/crates/vendor/icu_calendar_data/Cargo.toml.orig b/deps/crates/vendor/icu_calendar_data/Cargo.toml.orig deleted file mode 100644 index 238a48230dabce..00000000000000 --- a/deps/crates/vendor/icu_calendar_data/Cargo.toml.orig +++ /dev/null @@ -1,27 +0,0 @@ -# This file is part of ICU4X. For terms of use, please see the file -# called LICENSE at the top level of the ICU4X source tree -# (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -[package] -name = "icu_calendar_data" -description = "Data for the icu_calendar crate" -license = "Unicode-3.0" -version.workspace = true - -authors.workspace = true -categories.workspace = true -edition.workspace = true -homepage.workspace = true -include.workspace = true -repository.workspace = true -rust-version.workspace = true - -[package.metadata.sources] -cldr = { tagged = "48.0.0" } -icuexport = { tagged = "release-78.1rc" } -segmenter_lstm = { tagged = "v0.1.0" } - -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(icu4x_custom_data)'] } - -[dependencies] diff --git a/deps/crates/vendor/icu_calendar_data/README.md b/deps/crates/vendor/icu_calendar_data/README.md index b90473a6571cc5..19c1f48292c481 100644 --- a/deps/crates/vendor/icu_calendar_data/README.md +++ b/deps/crates/vendor/icu_calendar_data/README.md @@ -4,7 +4,7 @@ Data for the `icu_calendar` crate -This data was generated with CLDR version 48.0.0, ICU version release-78.1rc, and +This data was generated with CLDR version 47.0.0, ICU version icu4x/2025-05-01/77.x, and LSTM segmenter version v0.1.0. diff --git a/deps/crates/vendor/icu_calendar_data/data/calendar_chinese_v1.rs.data b/deps/crates/vendor/icu_calendar_data/data/calendar_chinese_v1.rs.data new file mode 100644 index 00000000000000..944a49c45490c8 --- /dev/null +++ b/deps/crates/vendor/icu_calendar_data/data/calendar_chinese_v1.rs.data @@ -0,0 +1,75 @@ +// @generated +/// Implement `DataProvider` on the given struct using the data +/// hardcoded in this file. This allows the struct to be used with +/// `icu`'s `_unstable` constructors. +/// +/// Using this implementation will embed the following data in the binary's data segment: +/// * 782B[^1] for the singleton data struct +/// +/// [^1]: these numbers can be smaller in practice due to linker deduplication +#[doc(hidden)] +#[macro_export] +macro_rules! __impl_calendar_chinese_v1 { + ($ provider : ty) => { + #[clippy::msrv = "1.82"] + const _: () = <$provider>::MUST_USE_MAKE_PROVIDER_MACRO; + #[clippy::msrv = "1.82"] + impl $provider { + #[doc(hidden)] + pub const SINGLETON_CALENDAR_CHINESE_V1: &'static ::DataStruct = &icu::calendar::provider::chinese_based::ChineseBasedCache { first_related_iso_year: 1900i32, data: unsafe { zerovec::ZeroVec::from_bytes_unchecked(b"\xD26\x19R\x07>\xA5\x0E(J\xD6\x14K\x068\x9B\n Z\xB5\x0Cj\x052Y\x0B\x1CRw\x06R\x07,%\xFB\x16%\x0B+\x05([\xEA\x10\xAD\n6j\x05\"U\xBB\x0C\xA4\x0B2I\x0B\x1C\x93z\x06\x95\n,-\x15\x156\x05:\xAD\n$\xAA\xD5\x10\xB2\x054\xA5\r\x1EJ\x9D\nJ\r0\x95*\x19\x97\n\xD5\x06&\xC9\xD6\x12I\x078\x93\x06\"+\xB5\n+\x050[\n\x1AZu\x06j\x05*U\x1B\x15\xA4\x0B\xA5\r(J\xFD\x12J\r8\x95\x0C\".\xB5\x0CV\x050\xB5\n\x1A\xB2u\x06\xD2\x06,\xA5\xEE\x14%\x07:K\x06$\x97\xCC\x0E\xAB\x0C2Z\x05\x1E\xD6\x8A\x08i\x0B.R\x97\x19R\x0B>%\x0B(K\xFA\x12K\n6\xAB\x04 [\xC5\n\xAD\x050j\x0B\x1AR{\x06\x92\r,%\x1D\x17%\r:U\n$\xAD\xD4\x0E\xB6\x044\xB5\x05\x1C\xAA\x8D\x08\xC9\x0E.\x92>\x1B\x92\x0E>&\r(V\xEA\x12W\n6V\x05 \xD5\xA6\nU\x070I\x07\x1C\x93\x8E\x04\x93\x06*+\x15\x15+\x05:[\n\"Z\xD5\x0Ej\x054e\x0B\x1EJ\xB7\x08J\x0B.\x95:\x19\x95\n>-\x05&\xAD\xEA\x10\xB5\n6\xAA\x05\"\xA5\xAB\n\xA5\r0J\r\x1C\x95\x9C\x06\x96\x0C*N\x19\x15V\x05:\xB5\n$\xB2\xD5\x0E\xD2\x064\xA5\x0E\x1EJ\xAE\n\x8B\x06,\x97,\x17\xAB\x04<[\x05&\xD6\xEA\x10j\x0B6R\x07\"%\xB7\x0CE\x0B0\x8B\n\x1A\x9Bt\x04\xAB\x04*[\t\x15\xAD\x05:\xAA\x0B&R\xDB\x12\x92\r6%\r K\xBA\nU\n0\xADT\x19\xB6\x04>\xB5\x06(\xAA\xED\x14\xC9\x0E8\x92\x0E$&\xBD\x0E*\r4V\n\x1C\xB6\x94\x06V\x05,\xD5\n\x17U\x0B:J\x07&\x93\xCE\x10\x95\x066+\x05\x1EW\xAA\x08\x9B\n.Z\x95\x1Bj\x05>e\x0B(J\xF7\x14J\x0B:\x15\x0B\"+\xD5\x0CM\x052\xAD\n\x1Cju\x06\xAA\x05,\xA5\x0B\x17\xA5\r for $provider { + fn load(&self, req: icu_provider::DataRequest) -> Result, icu_provider::DataError> { + if req.id.locale.is_unknown() { + Ok(icu_provider::DataResponse { payload: icu_provider::DataPayload::from_static_ref(Self::SINGLETON_CALENDAR_CHINESE_V1), metadata: icu_provider::DataResponseMetadata::default() }) + } else { + Err(icu_provider::DataErrorKind::InvalidRequest.with_req(::INFO, req)) + } + } + } + }; + ($ provider : ty , ITER) => { + __impl_calendar_chinese_v1!($provider); + #[clippy::msrv = "1.82"] + impl icu_provider::IterableDataProvider for $provider { + fn iter_ids(&self) -> Result>, icu_provider::DataError> { + Ok([Default::default()].into_iter().collect()) + } + } + }; + ($ provider : ty , DRY) => { + __impl_calendar_chinese_v1!($provider); + #[clippy::msrv = "1.82"] + impl icu_provider::DryDataProvider for $provider { + fn dry_load(&self, req: icu_provider::DataRequest) -> Result { + if req.id.locale.is_unknown() { + Ok(icu_provider::DataResponseMetadata::default()) + } else { + Err(icu_provider::DataErrorKind::InvalidRequest.with_req(::INFO, req)) + } + } + } + }; + ($ provider : ty , DRY , ITER) => { + __impl_calendar_chinese_v1!($provider); + #[clippy::msrv = "1.82"] + impl icu_provider::DryDataProvider for $provider { + fn dry_load(&self, req: icu_provider::DataRequest) -> Result { + if req.id.locale.is_unknown() { + Ok(icu_provider::DataResponseMetadata::default()) + } else { + Err(icu_provider::DataErrorKind::InvalidRequest.with_req(::INFO, req)) + } + } + } + #[clippy::msrv = "1.82"] + impl icu_provider::IterableDataProvider for $provider { + fn iter_ids(&self) -> Result>, icu_provider::DataError> { + Ok([Default::default()].into_iter().collect()) + } + } + }; +} +#[doc(inline)] +pub use __impl_calendar_chinese_v1 as impl_calendar_chinese_v1; diff --git a/deps/crates/vendor/icu_calendar_data/data/calendar_dangi_v1.rs.data b/deps/crates/vendor/icu_calendar_data/data/calendar_dangi_v1.rs.data new file mode 100644 index 00000000000000..30045896317596 --- /dev/null +++ b/deps/crates/vendor/icu_calendar_data/data/calendar_dangi_v1.rs.data @@ -0,0 +1,75 @@ +// @generated +/// Implement `DataProvider` on the given struct using the data +/// hardcoded in this file. This allows the struct to be used with +/// `icu`'s `_unstable` constructors. +/// +/// Using this implementation will embed the following data in the binary's data segment: +/// * 782B[^1] for the singleton data struct +/// +/// [^1]: these numbers can be smaller in practice due to linker deduplication +#[doc(hidden)] +#[macro_export] +macro_rules! __impl_calendar_dangi_v1 { + ($ provider : ty) => { + #[clippy::msrv = "1.82"] + const _: () = <$provider>::MUST_USE_MAKE_PROVIDER_MACRO; + #[clippy::msrv = "1.82"] + impl $provider { + #[doc(hidden)] + pub const SINGLETON_CALENDAR_DANGI_V1: &'static ::DataStruct = &icu::calendar::provider::chinese_based::ChineseBasedCache { first_related_iso_year: 1900i32, data: unsafe { zerovec::ZeroVec::from_bytes_unchecked(b"\xD26\x19R\x07>\xA5\x0E(J\xCE\x14K\x058\x97\n V\xB5\x0Cj\x052U\x0B\x1CRw\x06R\x07,%\xF7\x16%\x0B+\x05([\xEA\x10m\t6j\x0B\"T\xBB\x0E\xA4\x0B2I\x0B\x1C\x93z\x06\x95\n,+\x15\x15-\x05:\xAD\n$j\xD5\x10\xB2\r4\xA4\r I\x9D\nJ\r0\x95:\x19\x96\n>V\x05(\xB5\xEA\x12\xD5\n6\xD2\x06\"\xA5\xAE\x0C\xA5\x0E2J\x0E\x1C\x96\x8C\x06\x9B\n*V\x15\x17j\x05:Y\x0B$R\xD7\x10R\x076%\x07\x1EK\xB6\x08K\n.\xAB2\x19\xAD\x02\xD4\x06(\xC9\xCE\x12I\x078\x93\x06\"'\xB5\n+\x050[\n\x1AZu\x06j\x03*U\x1B\x15\xA4\x0B\xA5\r(J\xDD\x12J\r8\x95\n\"-\xB5\x0CV\x050\xB5\n\x1A\xAAu\x06\xD2\x06,\xA5\xEE\x14\xA5\x0E:J\x0E&\x96\xCC\x10\x9B\x0C2Z\x05\x1E\xD5\x8A\x08i\x0B.R\x97\x19R\x07>%\x0B(K\xF6\x12K\n6\xAB\x04 [\xC5\nm\x050i\x0B\x1AR{\x06\x92\r,%\x1D\x17%\r:M\n$\xAD\xD4\x0E\xB6\x024\xB5\x05\x1C\xA9\x8D\x08\xA9\x0E.\x92=\x1B\x92\x0E>&\r(V\xEA\x12W\n6\xD6\x04 \xB5\xA6\n\xD5\x060\xC9\x0E\x1C\x92\x8E\x06\x93\x06*+\x15\x15+\x05:[\n\"Z\xD5\x0Ej\x054U\x0B\x1EI\xB7\x08I\x0B.\x93:\x19\x95\n>-\x05&\xAD\xEA\x10\xB5\n6\xAA\x05\"\xA5\xAB\n\xA5\r0J\r\x1C\x95\x9A\x06\x95\x0C*.\x15\x15V\x05:\xB5\n$\xB2\xD5\x0E\xD2\x064\xA5\x0E\x1EJ\xBE\nJ\x06.\x97,\x17\xAB\x0C\xB5\x05(\xAA\xED\x14\xC9\x0E8\x92\x0E$%\xBD\x0E&\r4V\n\x1C\xAE\x94\x06\xD6\x04,\xD5\n\x17\xD5\x06:\xC9\x06&\x93\xCE\x10\x93\x066+\x05\x1EW\xAA\x08[\n.ZU\x1Bj\x05>e\x0B(J\xF7\x14I\x0B:\x95\n\"+\xD5\x0C-\x052\xAD\n\x1Cju\x06\xAA\x05,\xA5\x0B\x17\xA5\r for $provider { + fn load(&self, req: icu_provider::DataRequest) -> Result, icu_provider::DataError> { + if req.id.locale.is_unknown() { + Ok(icu_provider::DataResponse { payload: icu_provider::DataPayload::from_static_ref(Self::SINGLETON_CALENDAR_DANGI_V1), metadata: icu_provider::DataResponseMetadata::default() }) + } else { + Err(icu_provider::DataErrorKind::InvalidRequest.with_req(::INFO, req)) + } + } + } + }; + ($ provider : ty , ITER) => { + __impl_calendar_dangi_v1!($provider); + #[clippy::msrv = "1.82"] + impl icu_provider::IterableDataProvider for $provider { + fn iter_ids(&self) -> Result>, icu_provider::DataError> { + Ok([Default::default()].into_iter().collect()) + } + } + }; + ($ provider : ty , DRY) => { + __impl_calendar_dangi_v1!($provider); + #[clippy::msrv = "1.82"] + impl icu_provider::DryDataProvider for $provider { + fn dry_load(&self, req: icu_provider::DataRequest) -> Result { + if req.id.locale.is_unknown() { + Ok(icu_provider::DataResponseMetadata::default()) + } else { + Err(icu_provider::DataErrorKind::InvalidRequest.with_req(::INFO, req)) + } + } + } + }; + ($ provider : ty , DRY , ITER) => { + __impl_calendar_dangi_v1!($provider); + #[clippy::msrv = "1.82"] + impl icu_provider::DryDataProvider for $provider { + fn dry_load(&self, req: icu_provider::DataRequest) -> Result { + if req.id.locale.is_unknown() { + Ok(icu_provider::DataResponseMetadata::default()) + } else { + Err(icu_provider::DataErrorKind::InvalidRequest.with_req(::INFO, req)) + } + } + } + #[clippy::msrv = "1.82"] + impl icu_provider::IterableDataProvider for $provider { + fn iter_ids(&self) -> Result>, icu_provider::DataError> { + Ok([Default::default()].into_iter().collect()) + } + } + }; +} +#[doc(inline)] +pub use __impl_calendar_dangi_v1 as impl_calendar_dangi_v1; diff --git a/deps/crates/vendor/icu_calendar_data/data/calendar_hijri_simulated_mecca_v1.rs.data b/deps/crates/vendor/icu_calendar_data/data/calendar_hijri_simulated_mecca_v1.rs.data new file mode 100644 index 00000000000000..4803503a2a71f8 --- /dev/null +++ b/deps/crates/vendor/icu_calendar_data/data/calendar_hijri_simulated_mecca_v1.rs.data @@ -0,0 +1,75 @@ +// @generated +/// Implement `DataProvider` on the given struct using the data +/// hardcoded in this file. This allows the struct to be used with +/// `icu`'s `_unstable` constructors. +/// +/// Using this implementation will embed the following data in the binary's data segment: +/// * 532B[^1] for the singleton data struct +/// +/// [^1]: these numbers can be smaller in practice due to linker deduplication +#[doc(hidden)] +#[macro_export] +macro_rules! __impl_calendar_hijri_simulated_mecca_v1 { + ($ provider : ty) => { + #[clippy::msrv = "1.82"] + const _: () = <$provider>::MUST_USE_MAKE_PROVIDER_MACRO; + #[clippy::msrv = "1.82"] + impl $provider { + #[doc(hidden)] + pub const SINGLETON_CALENDAR_HIJRI_SIMULATED_MECCA_V1: &'static ::DataStruct = &icu::calendar::provider::hijri::HijriData { first_extended_year: 1317i32, data: unsafe { zerovec::ZeroVec::from_bytes_unchecked(b"O9\xAE\x02\xAD\x05\xA9\r\x92-E-\x8D\n-\x05m\x05j\x0BT'I\x07\x8B\x0E&-V\x05\xAE\nl#j\x07T'\xA5\x06M\x05]\n\\\x05\xBA\n\xB4%\xAA\rT-\xAA*6\t\xB6\x02u5\xEA\nT'\xA9\x06+\x05[\n6\x05v\nl\x05Y\x0BJ+\x95\n+\t[\nZ\x05\xD5\n\xD2&\xA5\x0EJ.\x96\x0C.\tm\nj\x05Y\x0BI/\x94.*-Z*\xBA\x04\xB5\x05\xB2\x0B\xA4+I+\x95\n\xB5\x04m\t\xEA\x02\xE9\x06\xD2\x0E\xA4.*-V\n\xB6\x04u\x05\xEA\n\xE4*\xA9*S\n\xAB\x04W9\xB6\x02\xB5\t\xAA\x05S\r&-N\n\xAE\x04m\t\xEA\x02\xD5\n\xA9\x06S\x05\xA7\x0479\xB5\x02k\x05i\x0BR'\xA5\x06K\x05\xAB\x02[5\xEA\n\xD4%\xC9\r\x92-%+U\t\xAD\x02k5\xE9\n\xD2%\xA5\x05K\x05\x97\x02\xB74\xB6\t\xB4\x03\xA9\x0BJ+\x96\n.\t^\x02\xDD4\xDA\n\xD4%\xA5\x05K\x05W:\xAE\x04n\tl\x03U\x0BJ'\x8D\x06'\x05W\n\xB6\x04\xB5\x06\xAA\r\xA4-I-\x95\n-\x05\xAD\nZ\x03U\x07J\x0F\x92.&+V\x06\xAE\x02u\x05j\x0BT'\xA9&U\x06\xAD\x04]9\xBA\x02\xB9\x05\xB2\rT-*+V\t\xB6\x02u\x05Z\x0B\xD4&\xA9\x06K\x05\x9B\x0C6\tv\x02u\x05i\rR-%\rK\n\x9B\x04[9\xDA\n\xD4&\xA9\x0EJ.\x96,-\tm\nl\x05i\x0BQ/\xA4.J-Z*\xDA\x04\xB9\t\xB4\x05\xA9\x0BR+\xA5\nU\x05m\nl\x05\xE9\x06\xD2.\xA4.J-V\n\xB6\x04u\t\xEA\x04\xE5\n\xAA*U\n\xAB\x04W\x02\xB74\xB5\n\xAA\x05\x95\r*-V\n\xAE\x08m\t\xEA\x02\xD5\n\xA9\x06S\x06'\x05W9\xB5\x02\xB5\x05\xAA\x0B\xA2'E'\x93\x06\xAB\x04k9\xEA\n\xD4%\xC9\r\xA2-%-U\t\xAD\x02m\x05\xEA\t\xD4%\xA5\x05K\x05") } }; + } + #[clippy::msrv = "1.82"] + impl icu_provider::DataProvider for $provider { + fn load(&self, req: icu_provider::DataRequest) -> Result, icu_provider::DataError> { + if req.id.locale.is_unknown() { + Ok(icu_provider::DataResponse { payload: icu_provider::DataPayload::from_static_ref(Self::SINGLETON_CALENDAR_HIJRI_SIMULATED_MECCA_V1), metadata: icu_provider::DataResponseMetadata::default() }) + } else { + Err(icu_provider::DataErrorKind::InvalidRequest.with_req(::INFO, req)) + } + } + } + }; + ($ provider : ty , ITER) => { + __impl_calendar_hijri_simulated_mecca_v1!($provider); + #[clippy::msrv = "1.82"] + impl icu_provider::IterableDataProvider for $provider { + fn iter_ids(&self) -> Result>, icu_provider::DataError> { + Ok([Default::default()].into_iter().collect()) + } + } + }; + ($ provider : ty , DRY) => { + __impl_calendar_hijri_simulated_mecca_v1!($provider); + #[clippy::msrv = "1.82"] + impl icu_provider::DryDataProvider for $provider { + fn dry_load(&self, req: icu_provider::DataRequest) -> Result { + if req.id.locale.is_unknown() { + Ok(icu_provider::DataResponseMetadata::default()) + } else { + Err(icu_provider::DataErrorKind::InvalidRequest.with_req(::INFO, req)) + } + } + } + }; + ($ provider : ty , DRY , ITER) => { + __impl_calendar_hijri_simulated_mecca_v1!($provider); + #[clippy::msrv = "1.82"] + impl icu_provider::DryDataProvider for $provider { + fn dry_load(&self, req: icu_provider::DataRequest) -> Result { + if req.id.locale.is_unknown() { + Ok(icu_provider::DataResponseMetadata::default()) + } else { + Err(icu_provider::DataErrorKind::InvalidRequest.with_req(::INFO, req)) + } + } + } + #[clippy::msrv = "1.82"] + impl icu_provider::IterableDataProvider for $provider { + fn iter_ids(&self) -> Result>, icu_provider::DataError> { + Ok([Default::default()].into_iter().collect()) + } + } + }; +} +#[doc(inline)] +pub use __impl_calendar_hijri_simulated_mecca_v1 as impl_calendar_hijri_simulated_mecca_v1; diff --git a/deps/crates/vendor/icu_calendar_data/data/calendar_japanese_extended_v1.rs.data b/deps/crates/vendor/icu_calendar_data/data/calendar_japanese_extended_v1.rs.data index 96a1dd8fd31809..338b69e5c61508 100644 --- a/deps/crates/vendor/icu_calendar_data/data/calendar_japanese_extended_v1.rs.data +++ b/deps/crates/vendor/icu_calendar_data/data/calendar_japanese_extended_v1.rs.data @@ -7,23 +7,18 @@ /// * 5238B[^1] for the singleton data struct /// /// [^1]: these numbers can be smaller in practice due to linker deduplication -/// -/// This macro requires the following crates: -/// * `icu` -/// * `icu_provider` -/// * `zerovec` #[doc(hidden)] #[macro_export] macro_rules! __impl_calendar_japanese_extended_v1 { ($ provider : ty) => { - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] const _: () = <$provider>::MUST_USE_MAKE_PROVIDER_MACRO; - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl $provider { #[doc(hidden)] pub const SINGLETON_CALENDAR_JAPANESE_EXTENDED_V1: &'static ::DataStruct = &icu::calendar::provider::JapaneseEras { dates_to_eras: unsafe { zerovec::ZeroVec::from_bytes_unchecked(b"\x85\x02\0\0\x06\x13taika-645\0\0\0\0\0\0\0\x8A\x02\0\0\x02\x0Fhakuchi-650\0\0\0\0\0\xA0\x02\0\0\x01\x01hakuho-672\0\0\0\0\0\0\xAE\x02\0\0\x07\x14shucho-686\0\0\0\0\0\0\xBD\x02\0\0\x03\x15taiho-701\0\0\0\0\0\0\0\xC0\x02\0\0\x05\nkeiun-704\0\0\0\0\0\0\0\xC4\x02\0\0\x01\x0Bwado-708\0\0\0\0\0\0\0\0\xCB\x02\0\0\t\x02reiki-715\0\0\0\0\0\0\0\xCD\x02\0\0\x0B\x11yoro-717\0\0\0\0\0\0\0\0\xD4\x02\0\0\x02\x04jinki-724\0\0\0\0\0\0\0\xD9\x02\0\0\x08\x05tenpyo-729\0\0\0\0\0\0\xED\x02\0\0\x04\x0Etenpyokampo-749\0\xED\x02\0\0\x07\x02tenpyoshoho-749\0\xF5\x02\0\0\x08\x12tenpyohoji-757\0\0\xFD\x02\0\0\x01\x07tenpyojingo-765\0\xFF\x02\0\0\x08\x10jingokeiun-767\0\0\x02\x03\0\0\n\x01hoki-770\0\0\0\0\0\0\0\0\r\x03\0\0\x01\x01teno-781\0\0\0\0\0\0\0\0\x0E\x03\0\0\x08\x13enryaku-782\0\0\0\0\0&\x03\0\0\x05\x12daido-806\0\0\0\0\0\0\0*\x03\0\0\t\x13konin-810\0\0\0\0\0\0\08\x03\0\0\x01\x05tencho-824\0\0\0\0\0\0B\x03\0\0\x01\x03jowa-834\0\0\0\0\0\0\0\0P\x03\0\0\x06\rkajo-848\0\0\0\0\0\0\0\0S\x03\0\0\x04\x1Cninju-851\0\0\0\0\0\0\0V\x03\0\0\x0B\x1Esaiko-854\0\0\0\0\0\0\0Y\x03\0\0\x02\x15tenan-857\0\0\0\0\0\0\0[\x03\0\0\x04\x0Fjogan-859\0\0\0\0\0\0\0m\x03\0\0\x04\x10gangyo-877\0\0\0\0\0\0u\x03\0\0\x02\x15ninna-885\0\0\0\0\0\0\0y\x03\0\0\x04\x1Bkanpyo-889\0\0\0\0\0\0\x82\x03\0\0\x04\x1Ashotai-898\0\0\0\0\0\0\x85\x03\0\0\x07\x0Fengi-901\0\0\0\0\0\0\0\0\x9B\x03\0\0\x04\x0Bencho-923\0\0\0\0\0\0\0\xA3\x03\0\0\x04\x1Ajohei-931\0\0\0\0\0\0\0\xAA\x03\0\0\x05\x16tengyo-938\0\0\0\0\0\0\xB3\x03\0\0\x04\x16tenryaku-947\0\0\0\0\xBD\x03\0\0\n\x1Btentoku-957\0\0\0\0\0\xC1\x03\0\0\x02\x10owa-961\0\0\0\0\0\0\0\0\0\xC4\x03\0\0\x07\nkoho-964\0\0\0\0\0\0\0\0\xC8\x03\0\0\x08\ranna-968\0\0\0\0\0\0\0\0\xCA\x03\0\0\x03\x19tenroku-970\0\0\0\0\0\xCD\x03\0\0\x0C\x14tenen-973\0\0\0\0\0\0\0\xD0\x03\0\0\x07\rjogen-976\0\0\0\0\0\0\0\xD2\x03\0\0\x0B\x1Dtengen-978\0\0\0\0\0\0\xD7\x03\0\0\x04\x0Feikan-983\0\0\0\0\0\0\0\xD9\x03\0\0\x04\x1Bkanna-985\0\0\0\0\0\0\0\xDB\x03\0\0\x04\x05eien-987\0\0\0\0\0\0\0\0\xDD\x03\0\0\x08\x08eiso-989\0\0\0\0\0\0\0\0\xDE\x03\0\0\x0B\x07shoryaku-990\0\0\0\0\xE3\x03\0\0\x02\x16chotoku-995\0\0\0\0\0\xE7\x03\0\0\x01\rchoho-999\0\0\0\0\0\0\0\xEC\x03\0\0\x07\x14kanko-1004\0\0\0\0\0\0\xF4\x03\0\0\x0C\x19chowa-1012\0\0\0\0\0\0\xF9\x03\0\0\x04\x17kannin-1017\0\0\0\0\0\xFD\x03\0\0\x02\x02jian-1021\0\0\0\0\0\0\0\0\x04\0\0\x07\rmanju-1024\0\0\0\0\0\0\x04\x04\0\0\x07\x19chogen-1028\0\0\0\0\0\r\x04\0\0\x04\x15choryaku-1037\0\0\0\x10\x04\0\0\x0B\nchokyu-1040\0\0\0\0\0\x14\x04\0\0\x0B\x18kantoku-1044\0\0\0\0\x16\x04\0\0\x04\x0Eeisho-1046\0\0\0\0\0\0\x1D\x04\0\0\x01\x0Btengi-1053\0\0\0\0\0\0\"\x04\0\0\x08\x1Dkohei-1058\0\0\0\0\0\0)\x04\0\0\x08\x02jiryaku-1065\0\0\0\0-\x04\0\0\x04\renkyu-1069\0\0\0\0\0\x002\x04\0\0\x08\x17shoho-1074\0\0\0\0\0\x005\x04\0\0\x0B\x11shoryaku-1077\0\0\09\x04\0\0\x02\neiho-1081\0\0\0\0\0\0\0<\x04\0\0\x02\x07otoku-1084\0\0\0\0\0\0?\x04\0\0\x04\x07kanji-1087\0\0\0\0\0\0F\x04\0\0\x0C\x0Fkaho-1094\0\0\0\0\0\0\0H\x04\0\0\x0C\x11eicho-1096\0\0\0\0\0\0I\x04\0\0\x0B\x15jotoku-1097\0\0\0\0\0K\x04\0\0\x08\x1Ckowa-1099\0\0\0\0\0\0\0P\x04\0\0\x02\nchoji-1104\0\0\0\0\0\0R\x04\0\0\x04\tkasho-1106\0\0\0\0\0\0T\x04\0\0\x08\x03tennin-1108\0\0\0\0\0V\x04\0\0\x07\rtenei-1110\0\0\0\0\0\0Y\x04\0\0\x07\reikyu-1113\0\0\0\0\0\0^\x04\0\0\x04\x03genei-1118\0\0\0\0\0\0`\x04\0\0\x04\nhoan-1120\0\0\0\0\0\0\0d\x04\0\0\x04\x03tenji-1124\0\0\0\0\0\0f\x04\0\0\x01\x16daiji-1126\0\0\0\0\0\0k\x04\0\0\x01\x1Dtensho-1131\0\0\0\0\0l\x04\0\0\x08\x0Bchosho-1132\0\0\0\0\0o\x04\0\0\x04\x1Bhoen-1135\0\0\0\0\0\0\0u\x04\0\0\x07\neiji-1141\0\0\0\0\0\0\0v\x04\0\0\x04\x1Ckoji-1142\0\0\0\0\0\0\0x\x04\0\0\x02\x17tenyo-1144\0\0\0\0\0\0y\x04\0\0\x07\x16kyuan-1145\0\0\0\0\0\0\x7F\x04\0\0\x01\x1Aninpei-1151\0\0\0\0\0\x82\x04\0\0\n\x1Ckyuju-1154\0\0\0\0\0\0\x84\x04\0\0\x04\x1Bhogen-1156\0\0\0\0\0\0\x87\x04\0\0\x04\x14heiji-1159\0\0\0\0\0\0\x88\x04\0\0\x01\neiryaku-1160\0\0\0\0\x89\x04\0\0\t\x04oho-1161\0\0\0\0\0\0\0\0\x8B\x04\0\0\x03\x1Dchokan-1163\0\0\0\0\0\x8D\x04\0\0\x06\x05eiman-1165\0\0\0\0\0\0\x8E\x04\0\0\x08\x1Bninan-1166\0\0\0\0\0\0\x91\x04\0\0\x04\x08kao-1169\0\0\0\0\0\0\0\0\x93\x04\0\0\x04\x15shoan-1171\0\0\0\0\0\0\x97\x04\0\0\x07\x1Cangen-1175\0\0\0\0\0\0\x99\x04\0\0\x08\x04jisho-1177\0\0\0\0\0\0\x9D\x04\0\0\x07\x0Eyowa-1181\0\0\0\0\0\0\0\x9E\x04\0\0\x05\x1Bjuei-1182\0\0\0\0\0\0\0\xA0\x04\0\0\x04\x10genryaku-1184\0\0\0\xA1\x04\0\0\x08\x0Ebunji-1185\0\0\0\0\0\0\xA6\x04\0\0\x04\x0Bkenkyu-1190\0\0\0\0\0\xAF\x04\0\0\x04\x1Bshoji-1199\0\0\0\0\0\0\xB1\x04\0\0\x02\rkennin-1201\0\0\0\0\0\xB4\x04\0\0\x02\x14genkyu-1204\0\0\0\0\0\xB6\x04\0\0\x04\x1Bkenei-1206\0\0\0\0\0\0\xB7\x04\0\0\n\x19jogen-1207\0\0\0\0\0\0\xBB\x04\0\0\x03\tkenryaku-1211\0\0\0\xBD\x04\0\0\x0C\x06kenpo-1213\0\0\0\0\0\0\xC3\x04\0\0\x04\x0Cjokyu-1219\0\0\0\0\0\0\xC6\x04\0\0\x04\rjoo-1222\0\0\0\0\0\0\0\0\xC8\x04\0\0\x0B\x14gennin-1224\0\0\0\0\0\xC9\x04\0\0\x04\x14karoku-1225\0\0\0\0\0\xCB\x04\0\0\x0C\nantei-1227\0\0\0\0\0\0\xCD\x04\0\0\x03\x05kanki-1229\0\0\0\0\0\0\xD0\x04\0\0\x04\x02joei-1232\0\0\0\0\0\0\0\xD1\x04\0\0\x04\x0Ftenpuku-1233\0\0\0\0\xD2\x04\0\0\x0B\x05bunryaku-1234\0\0\0\xD3\x04\0\0\t\x13katei-1235\0\0\0\0\0\0\xD6\x04\0\0\x0B\x17ryakunin-1238\0\0\0\xD7\x04\0\0\x02\x07eno-1239\0\0\0\0\0\0\0\0\xD8\x04\0\0\x07\x10ninji-1240\0\0\0\0\0\0\xDB\x04\0\0\x02\x1Akangen-1243\0\0\0\0\0\xDF\x04\0\0\x02\x1Choji-1247\0\0\0\0\0\0\0\xE1\x04\0\0\x03\x12kencho-1249\0\0\0\0\0\xE8\x04\0\0\n\x05kogen-1256\0\0\0\0\0\0\xE9\x04\0\0\x03\x0Eshoka-1257\0\0\0\0\0\0\xEB\x04\0\0\x03\x1Ashogen-1259\0\0\0\0\0\xEC\x04\0\0\x04\rbuno-1260\0\0\0\0\0\0\0\xED\x04\0\0\x02\x14kocho-1261\0\0\0\0\0\0\xF0\x04\0\0\x02\x1Cbunei-1264\0\0\0\0\0\0\xFB\x04\0\0\x04\x19kenji-1275\0\0\0\0\0\0\xFE\x04\0\0\x02\x1Ckoan-1278\0\0\0\0\0\0\0\x08\x05\0\0\x04\x1Cshoo-1288\0\0\0\0\0\0\0\r\x05\0\0\x08\x05einin-1293\0\0\0\0\0\0\x13\x05\0\0\x04\x19shoan-1299\0\0\0\0\0\0\x16\x05\0\0\x0B\x15kengen-1302\0\0\0\0\0\x17\x05\0\0\x08\x05kagen-1303\0\0\0\0\0\0\x1A\x05\0\0\x0C\x0Etokuji-1306\0\0\0\0\0\x1C\x05\0\0\n\tenkyo-1308\0\0\0\0\0\0\x1F\x05\0\0\x04\x1Cocho-1311\0\0\0\0\0\0\0 \x05\0\0\x03\x14showa-1312\0\0\0\0\0\0%\x05\0\0\x02\x03bunpo-1317\0\0\0\0\0\0'\x05\0\0\x04\x1Cgeno-1319\0\0\0\0\0\0\0)\x05\0\0\x02\x17genko-1321\0\0\0\0\0\0,\x05\0\0\x0C\tshochu-1324\0\0\0\0\0.\x05\0\0\x04\x1Akaryaku-1326\0\0\0\x001\x05\0\0\x08\x1Dgentoku-1329\0\0\0\x003\x05\0\0\x08\tgenko-1331\0\0\0\0\0\x006\x05\0\0\x01\x1Dkenmu-1334\0\0\0\0\0\08\x05\0\0\x02\x1Dengen-1336\0\0\0\0\0\0<\x05\0\0\x04\x1Ckokoku-1340\0\0\0\0\0B\x05\0\0\x0C\x08shohei-1346\0\0\0\0\0Z\x05\0\0\x07\x18kentoku-1370\0\0\0\0\\\x05\0\0\x04\x01bunchu-1372\0\0\0\0\0_\x05\0\0\x05\x1Btenju-1375\0\0\0\0\0\0c\x05\0\0\x03\x16koryaku-1379\0\0\0\0e\x05\0\0\x02\nkowa-1381\0\0\0\0\0\0\0h\x05\0\0\x04\x1Cgenchu-1384\0\0\0\0\0k\x05\0\0\x08\x16meitoku-1387\0\0\0\0k\x05\0\0\x08\x17kakei-1387\0\0\0\0\0\0m\x05\0\0\x02\tkoo-1389\0\0\0\0\0\0\0\0n\x05\0\0\x03\x1Ameitoku-1390\0\0\0\0r\x05\0\0\x07\x05oei-1394\0\0\0\0\0\0\0\0\x94\x05\0\0\x04\x1Bshocho-1428\0\0\0\0\0\x95\x05\0\0\t\x05eikyo-1429\0\0\0\0\0\0\xA1\x05\0\0\x02\x11kakitsu-1441\0\0\0\0\xA4\x05\0\0\x02\x05bunan-1444\0\0\0\0\0\0\xA9\x05\0\0\x07\x1Chotoku-1449\0\0\0\0\0\xAC\x05\0\0\x07\x19kyotoku-1452\0\0\0\0\xAF\x05\0\0\x07\x19kosho-1455\0\0\0\0\0\0\xB1\x05\0\0\t\x1Cchoroku-1457\0\0\0\0\xB4\x05\0\0\x0C\x15kansho-1460\0\0\0\0\0\xBA\x05\0\0\x02\x1Cbunsho-1466\0\0\0\0\0\xBB\x05\0\0\x03\x03onin-1467\0\0\0\0\0\0\0\xBD\x05\0\0\x04\x1Cbunmei-1469\0\0\0\0\0\xCF\x05\0\0\x07\x1Dchokyo-1487\0\0\0\0\0\xD1\x05\0\0\x08\x15entoku-1489\0\0\0\0\0\xD4\x05\0\0\x07\x13meio-1492\0\0\0\0\0\0\0\xDD\x05\0\0\x02\x1Cbunki-1501\0\0\0\0\0\0\xE0\x05\0\0\x02\x1Deisho-1504\0\0\0\0\0\0\xF1\x05\0\0\x08\x17taiei-1521\0\0\0\0\0\0\xF8\x05\0\0\x08\x14kyoroku-1528\0\0\0\0\xFC\x05\0\0\x07\x1Dtenbun-1532\0\0\0\0\0\x13\x06\0\0\n\x17koji-1555\0\0\0\0\0\0\0\x16\x06\0\0\x02\x1Ceiroku-1558\0\0\0\0\0\"\x06\0\0\x04\x17genki-1570\0\0\0\0\0\0%\x06\0\0\x07\x1Ctensho-1573\0\0\0\0\08\x06\0\0\x0C\x08bunroku-1592\0\0\0\0<\x06\0\0\n\x1Bkeicho-1596\0\0\0\0\0O\x06\0\0\x07\rgenna-1615\0\0\0\0\0\0X\x06\0\0\x02\x1Dkanei-1624\0\0\0\0\0\0l\x06\0\0\x0C\x10shoho-1644\0\0\0\0\0\0p\x06\0\0\x02\x0Fkeian-1648\0\0\0\0\0\0t\x06\0\0\t\x12joo-1652\0\0\0\0\0\0\0\0w\x06\0\0\x04\rmeireki-1655\0\0\0\0z\x06\0\0\x07\x17manji-1658\0\0\0\0\0\0}\x06\0\0\x04\x19kanbun-1661\0\0\0\0\0\x89\x06\0\0\t\x15enpo-1673\0\0\0\0\0\0\0\x91\x06\0\0\t\x1Dtenna-1681\0\0\0\0\0\0\x94\x06\0\0\x02\x15jokyo-1684\0\0\0\0\0\0\x98\x06\0\0\t\x1Egenroku-1688\0\0\0\0\xA8\x06\0\0\x03\rhoei-1704\0\0\0\0\0\0\0\xAF\x06\0\0\x04\x19shotoku-1711\0\0\0\0\xB4\x06\0\0\x06\x16kyoho-1716\0\0\0\0\0\0\xC8\x06\0\0\x04\x1Cgenbun-1736\0\0\0\0\0\xCD\x06\0\0\x02\x1Bkanpo-1741\0\0\0\0\0\0\xD0\x06\0\0\x02\x15enkyo-1744\0\0\0\0\0\0\xD4\x06\0\0\x07\x0Ckanen-1748\0\0\0\0\0\0\xD7\x06\0\0\n\x1Bhoreki-1751\0\0\0\0\0\xE4\x06\0\0\x06\x02meiwa-1764\0\0\0\0\0\0\xEC\x06\0\0\x0B\x10anei-1772\0\0\0\0\0\0\0\xF5\x06\0\0\x04\x02tenmei-1781\0\0\0\0\0\xFD\x06\0\0\x01\x19kansei-1789\0\0\0\0\0\t\x07\0\0\x02\x05kyowa-1801\0\0\0\0\0\0\x0C\x07\0\0\x02\x0Bbunka-1804\0\0\0\0\0\0\x1A\x07\0\0\x04\x16bunsei-1818\0\0\0\0\0&\x07\0\0\x0C\ntenpo-1830\0\0\0\0\0\x004\x07\0\0\x0C\x02koka-1844\0\0\0\0\0\0\08\x07\0\0\x02\x1Ckaei-1848\0\0\0\0\0\0\0>\x07\0\0\x0B\x1Bansei-1854\0\0\0\0\0\0D\x07\0\0\x03\x12manen-1860\0\0\0\0\0\0E\x07\0\0\x02\x13bunkyu-1861\0\0\0\0\0H\x07\0\0\x02\x14genji-1864\0\0\0\0\0\0I\x07\0\0\x04\x07keio-1865\0\0\0\0\0\0\0L\x07\0\0\n\x17meiji\0\0\0\0\0\0\0\0\0\0\0x\x07\0\0\x07\x1Etaisho\0\0\0\0\0\0\0\0\0\0\x86\x07\0\0\x0C\x19showa\0\0\0\0\0\0\0\0\0\0\0\xC5\x07\0\0\x01\x08heisei\0\0\0\0\0\0\0\0\0\0\xE3\x07\0\0\x05\x01reiwa\0\0\0\0\0\0\0\0\0\0\0") } }; } - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl icu_provider::DataProvider for $provider { fn load(&self, req: icu_provider::DataRequest) -> Result, icu_provider::DataError> { if req.id.locale.is_unknown() { @@ -36,7 +31,7 @@ macro_rules! __impl_calendar_japanese_extended_v1 { }; ($ provider : ty , ITER) => { __impl_calendar_japanese_extended_v1!($provider); - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl icu_provider::IterableDataProvider for $provider { fn iter_ids(&self) -> Result>, icu_provider::DataError> { Ok([Default::default()].into_iter().collect()) @@ -45,7 +40,7 @@ macro_rules! __impl_calendar_japanese_extended_v1 { }; ($ provider : ty , DRY) => { __impl_calendar_japanese_extended_v1!($provider); - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl icu_provider::DryDataProvider for $provider { fn dry_load(&self, req: icu_provider::DataRequest) -> Result { if req.id.locale.is_unknown() { @@ -58,7 +53,7 @@ macro_rules! __impl_calendar_japanese_extended_v1 { }; ($ provider : ty , DRY , ITER) => { __impl_calendar_japanese_extended_v1!($provider); - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl icu_provider::DryDataProvider for $provider { fn dry_load(&self, req: icu_provider::DataRequest) -> Result { if req.id.locale.is_unknown() { @@ -68,7 +63,7 @@ macro_rules! __impl_calendar_japanese_extended_v1 { } } } - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl icu_provider::IterableDataProvider for $provider { fn iter_ids(&self) -> Result>, icu_provider::DataError> { Ok([Default::default()].into_iter().collect()) diff --git a/deps/crates/vendor/icu_calendar_data/data/calendar_japanese_modern_v1.rs.data b/deps/crates/vendor/icu_calendar_data/data/calendar_japanese_modern_v1.rs.data index 31c7a3de95d2b8..b86298cbcec181 100644 --- a/deps/crates/vendor/icu_calendar_data/data/calendar_japanese_modern_v1.rs.data +++ b/deps/crates/vendor/icu_calendar_data/data/calendar_japanese_modern_v1.rs.data @@ -7,23 +7,18 @@ /// * 134B[^1] for the singleton data struct /// /// [^1]: these numbers can be smaller in practice due to linker deduplication -/// -/// This macro requires the following crates: -/// * `icu` -/// * `icu_provider` -/// * `zerovec` #[doc(hidden)] #[macro_export] macro_rules! __impl_calendar_japanese_modern_v1 { ($ provider : ty) => { - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] const _: () = <$provider>::MUST_USE_MAKE_PROVIDER_MACRO; - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl $provider { #[doc(hidden)] pub const SINGLETON_CALENDAR_JAPANESE_MODERN_V1: &'static ::DataStruct = &icu::calendar::provider::JapaneseEras { dates_to_eras: unsafe { zerovec::ZeroVec::from_bytes_unchecked(b"L\x07\0\0\n\x17meiji\0\0\0\0\0\0\0\0\0\0\0x\x07\0\0\x07\x1Etaisho\0\0\0\0\0\0\0\0\0\0\x86\x07\0\0\x0C\x19showa\0\0\0\0\0\0\0\0\0\0\0\xC5\x07\0\0\x01\x08heisei\0\0\0\0\0\0\0\0\0\0\xE3\x07\0\0\x05\x01reiwa\0\0\0\0\0\0\0\0\0\0\0") } }; } - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl icu_provider::DataProvider for $provider { fn load(&self, req: icu_provider::DataRequest) -> Result, icu_provider::DataError> { if req.id.locale.is_unknown() { @@ -36,7 +31,7 @@ macro_rules! __impl_calendar_japanese_modern_v1 { }; ($ provider : ty , ITER) => { __impl_calendar_japanese_modern_v1!($provider); - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl icu_provider::IterableDataProvider for $provider { fn iter_ids(&self) -> Result>, icu_provider::DataError> { Ok([Default::default()].into_iter().collect()) @@ -45,7 +40,7 @@ macro_rules! __impl_calendar_japanese_modern_v1 { }; ($ provider : ty , DRY) => { __impl_calendar_japanese_modern_v1!($provider); - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl icu_provider::DryDataProvider for $provider { fn dry_load(&self, req: icu_provider::DataRequest) -> Result { if req.id.locale.is_unknown() { @@ -58,7 +53,7 @@ macro_rules! __impl_calendar_japanese_modern_v1 { }; ($ provider : ty , DRY , ITER) => { __impl_calendar_japanese_modern_v1!($provider); - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl icu_provider::DryDataProvider for $provider { fn dry_load(&self, req: icu_provider::DataRequest) -> Result { if req.id.locale.is_unknown() { @@ -68,7 +63,7 @@ macro_rules! __impl_calendar_japanese_modern_v1 { } } } - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl icu_provider::IterableDataProvider for $provider { fn iter_ids(&self) -> Result>, icu_provider::DataError> { Ok([Default::default()].into_iter().collect()) diff --git a/deps/crates/vendor/icu_calendar_data/data/calendar_week_v1.rs.data b/deps/crates/vendor/icu_calendar_data/data/calendar_week_v1.rs.data index d28cb3677c509d..6a1c737066c3f0 100644 --- a/deps/crates/vendor/icu_calendar_data/data/calendar_week_v1.rs.data +++ b/deps/crates/vendor/icu_calendar_data/data/calendar_week_v1.rs.data @@ -4,30 +4,25 @@ /// `icu`'s `_unstable` constructors. /// /// Using this implementation will embed the following data in the binary's data segment: -/// * 295B for the lookup data structure (73 data identifiers) +/// * 292B for the lookup data structure (72 data identifiers) /// * 20B[^1] for the actual data (10 unique structs) /// /// [^1]: these numbers can be smaller in practice due to linker deduplication -/// -/// This macro requires the following crates: -/// * `icu` -/// * `icu_provider` -/// * `icu_provider/baked` #[doc(hidden)] #[macro_export] macro_rules! __impl_calendar_week_v1 { ($ provider : ty) => { - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] const _: () = <$provider>::MUST_USE_MAKE_PROVIDER_MACRO; - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl $provider { const DATA_CALENDAR_WEEK_V1: icu_provider::baked::zerotrie::Data = { - const TRIE: icu_provider::baked::zerotrie::ZeroTrieSimpleAscii<&'static [u8]> = icu_provider::baked::zerotrie::ZeroTrieSimpleAscii { store: b"und\x80-\xD7ABCDEGHIJKLMNOPQSTUVWYZ\t\x1E$06 = icu_provider::baked::zerotrie::ZeroTrieSimpleAscii { store: b"und\x80-\xD7ABCDEGHIJKLMNOPQSTUVWYZ\t\x1E$06::DataStruct] = &[icu::calendar::provider::WeekData { first_weekday: icu::calendar::types::Weekday::Monday, weekend: icu::calendar::provider::WeekdaySet::new(&[icu::calendar::types::Weekday::Saturday, icu::calendar::types::Weekday::Sunday]) }, icu::calendar::provider::WeekData { first_weekday: icu::calendar::types::Weekday::Saturday, weekend: icu::calendar::provider::WeekdaySet::new(&[icu::calendar::types::Weekday::Thursday, icu::calendar::types::Weekday::Friday]) }, icu::calendar::provider::WeekData { first_weekday: icu::calendar::types::Weekday::Sunday, weekend: icu::calendar::provider::WeekdaySet::new(&[icu::calendar::types::Weekday::Saturday, icu::calendar::types::Weekday::Sunday]) }, icu::calendar::provider::WeekData { first_weekday: icu::calendar::types::Weekday::Saturday, weekend: icu::calendar::provider::WeekdaySet::new(&[icu::calendar::types::Weekday::Friday, icu::calendar::types::Weekday::Saturday]) }, icu::calendar::provider::WeekData { first_weekday: icu::calendar::types::Weekday::Saturday, weekend: icu::calendar::provider::WeekdaySet::new(&[icu::calendar::types::Weekday::Saturday, icu::calendar::types::Weekday::Sunday]) }, icu::calendar::provider::WeekData { first_weekday: icu::calendar::types::Weekday::Sunday, weekend: icu::calendar::provider::WeekdaySet::new(&[icu::calendar::types::Weekday::Friday, icu::calendar::types::Weekday::Saturday]) }, icu::calendar::provider::WeekData { first_weekday: icu::calendar::types::Weekday::Sunday, weekend: icu::calendar::provider::WeekdaySet::new(&[icu::calendar::types::Weekday::Sunday]) }, icu::calendar::provider::WeekData { first_weekday: icu::calendar::types::Weekday::Saturday, weekend: icu::calendar::provider::WeekdaySet::new(&[icu::calendar::types::Weekday::Friday]) }, icu::calendar::provider::WeekData { first_weekday: icu::calendar::types::Weekday::Friday, weekend: icu::calendar::provider::WeekdaySet::new(&[icu::calendar::types::Weekday::Saturday, icu::calendar::types::Weekday::Sunday]) }, icu::calendar::provider::WeekData { first_weekday: icu::calendar::types::Weekday::Monday, weekend: icu::calendar::provider::WeekdaySet::new(&[icu::calendar::types::Weekday::Sunday]) }]; unsafe { icu_provider::baked::zerotrie::Data::from_trie_and_values_unchecked(TRIE, VALUES) } }; } - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl icu_provider::DataProvider for $provider { fn load(&self, req: icu_provider::DataRequest) -> Result, icu_provider::DataError> { let mut metadata = icu_provider::DataResponseMetadata::default(); @@ -53,7 +48,7 @@ macro_rules! __impl_calendar_week_v1 { }; ($ provider : ty , ITER) => { __impl_calendar_week_v1!($provider); - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl icu_provider::IterableDataProvider for $provider { fn iter_ids(&self) -> Result>, icu_provider::DataError> { Ok(icu_provider::baked::DataStore::iter(&Self::DATA_CALENDAR_WEEK_V1).collect()) diff --git a/deps/crates/vendor/icu_calendar_data/data/mod.rs b/deps/crates/vendor/icu_calendar_data/data/mod.rs index 1ad69179b4969a..84e6f6c55ee844 100644 --- a/deps/crates/vendor/icu_calendar_data/data/mod.rs +++ b/deps/crates/vendor/icu_calendar_data/data/mod.rs @@ -2,6 +2,9 @@ include!("calendar_japanese_extended_v1.rs.data"); include!("calendar_japanese_modern_v1.rs.data"); include!("calendar_week_v1.rs.data"); +include!("calendar_dangi_v1.rs.data"); +include!("calendar_hijri_simulated_mecca_v1.rs.data"); +include!("calendar_chinese_v1.rs.data"); /// Marks a type as a data provider. You can then use macros like /// `impl_core_helloworld_v1` to add implementations. /// @@ -17,7 +20,7 @@ include!("calendar_week_v1.rs.data"); #[macro_export] macro_rules! __make_provider { ($ name : ty) => { - #[clippy::msrv = "1.83"] + #[clippy::msrv = "1.82"] impl $name { #[allow(dead_code)] pub(crate) const MUST_USE_MAKE_PROVIDER_MACRO: () = (); @@ -27,11 +30,6 @@ macro_rules! __make_provider { } #[doc(inline)] pub use __make_provider as make_provider; -/// This macro requires the following crates: -/// * `icu` -/// * `icu_provider` -/// * `icu_provider/baked` -/// * `zerovec` #[allow(unused_macros)] macro_rules! impl_data_provider { ($ provider : ty) => { @@ -39,5 +37,8 @@ macro_rules! impl_data_provider { impl_calendar_japanese_extended_v1!($provider); impl_calendar_japanese_modern_v1!($provider); impl_calendar_week_v1!($provider); + impl_calendar_dangi_v1!($provider); + impl_calendar_hijri_simulated_mecca_v1!($provider); + impl_calendar_chinese_v1!($provider); }; } diff --git a/deps/crates/vendor/icu_calendar_data/src/lib.rs b/deps/crates/vendor/icu_calendar_data/src/lib.rs index 02ec18a35cc963..2a3674bc16bb94 100644 --- a/deps/crates/vendor/icu_calendar_data/src/lib.rs +++ b/deps/crates/vendor/icu_calendar_data/src/lib.rs @@ -4,7 +4,7 @@ //! Data for the `icu_calendar` crate //! -//! This data was generated with CLDR version 48.0.0, ICU version release-78.1rc, and +//! This data was generated with CLDR version 47.0.0, ICU version icu4x/2025-05-01/77.x, and //! LSTM segmenter version v0.1.0. #![no_std] diff --git a/deps/crates/vendor/icu_collections/.cargo-checksum.json b/deps/crates/vendor/icu_collections/.cargo-checksum.json index c83ec60da50d71..87873bb53d1812 100644 --- a/deps/crates/vendor/icu_collections/.cargo-checksum.json +++ b/deps/crates/vendor/icu_collections/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo_vcs_info.json":"f5ad06d6d816d1d211ec86d639b4fd2b6551db6e9bdcd37c3c7ccc47f1873618","Cargo.lock":"281b1642001f508afaf929a328b2d2801baa78b91f7e98e9aee6f39f7bd467a9","Cargo.toml":"8f7a2c13e5f27b3edcadac862f50ff5fd16689ec83bcca9a5a6bb0670918263d","Cargo.toml.orig":"963d26428f923ead6ef52219b65549eabcba96bef3e3dcb67279e6fa9c4cef3d","LICENSE":"f367c1b8e1aa262435251e442901da4607b4650e0e63a026f5044473ecfb90f2","README.md":"b1a0b37b61d42026996dda3b7d524d42888181f3e7eaf940c9b2e5f561c449e3","benches/codepointtrie.rs":"4052e9e3a3a744955a5ab3f7089cafaf2920ad5c7566fc8b3b77ee1d39376c20","benches/iai_cpt.rs":"a8ed4e67866d415e6ed0c8c95a9b1887b4198ea409d4cd9efafb50b8c13b3ecc","benches/inv_list.rs":"39e0386fd0e908d6e18b16e021345ba8c88fa70e06e26a29913dfa218a68b03d","benches/tries/gc_fast.rs":"4761a339f9b266813f4fa7ffa229b3464ced2ed106ce712ae6a96c0e49e5224e","benches/tries/gc_small.rs":"a1a75d2325dbce031e0127de8d84e900ca7c73ec81da1679965ab0127a99c205","benches/tries/mod.rs":"82cfdd1c5870d343613098fdff5a7961cfe5645a33480c6a252efae9a074e022","src/char16trie/mod.rs":"5950a1b427743e956b459956cadd72ff7531fe46bfb871d8e3a848b1e4ab0657","src/char16trie/trie.rs":"20ac75a0e2f3bcb74c619e98f44b3cc1f41bea2787ceef186d54cf997a1d9264","src/codepointinvlist/builder.rs":"bb0796333ca76d7714ee8425201a5957ab6b26b55dc049c34b3fb1839afc1581","src/codepointinvlist/conversions.rs":"8ac096ae63fa508ee2d7b2805aca864971110accaa358c178855540074e2ad21","src/codepointinvlist/cpinvlist.rs":"f9b47dd0432379637e194c2adf5acfcb91372a7f896cfab378928ffe65969532","src/codepointinvlist/mod.rs":"d48bc8ff1d103c4e37c4729181bc90b5e5e0db7701a49bd53c4d8c67e9089eb0","src/codepointinvlist/utils.rs":"6d6b4f5884beb830c16b6e5df07688f8cd70e2293a96d03037be690896d514e1","src/codepointinvliststringlist/mod.rs":"1fdb0b404f0b9a44218157ae1b58712d3ff7fe5b1d23521514a5eb36587d68df","src/codepointtrie/cptrie.rs":"dc7133751f32c74f3a87b1eb60e705aa0766a622ce48845aaa466f055267f6f2","src/codepointtrie/error.rs":"028dd55421b0bebf1634ad99752dbe349b40ab10ca565aa6bb134c5885ffd87b","src/codepointtrie/impl_const.rs":"ff25fa0d54e174c289b25a6060f50e03c8aa41bad922c9386de3148f8ad95109","src/codepointtrie/mod.rs":"d77de5edc258bbe79e0b6a37fedd315478fea6f9fd46c6923c564d045ac053d6","src/codepointtrie/planes.rs":"8a063b1efce889e46e69c7000ce48eeb420bb861f4ceafa839faaa944715c7bb","src/codepointtrie/serde.rs":"103bf57194a4d2111ed064d9bf2796b4ff7b5c2b1a1222a7378bad8143aa453f","src/codepointtrie/toml.rs":"6185421c1384e6a9a69b57153e1dcd793665ceb385dff2b61a2c1b0508609ec3","src/iterator_utils.rs":"2a5dfab19a752ae495617d68c07d11d1c0fbded233221dc43e9dd8f959001cd9","src/lib.rs":"a15ba283ccb32fc9a1cbe67166fa8eac5cd9225e4de022d09b057be4ff8eb688","tests/char16trie.rs":"f8018b90187f3b99a6a835c1c41bced18d98a28c41822abf3536cd1f0f08c44f","tests/cpt.rs":"3a151ba56273a29777f0a7656e533f4a603281569dd5349e15f837d2b9ec65e8","tests/data/char16trie/empty.toml":"b900365b9c786f1b185307f5d8835a901d4860b9b097bce13aa0e592fcb384c4","tests/data/char16trie/months.toml":"439245fc4385fe693f283b7bc179bf5558dd8039a89987314dfc8c4a9e0092b2","tests/data/char16trie/test_a.toml":"34b179dd4e7eef73ce373b74e426ecfa05fb7aa2b0fc15e437bfcf3ea4242a9f","tests/data/char16trie/test_a_ab.toml":"b84452cb9c310203599d3cb8279a3f000c39ff8026728573152026f0d5e2c798","tests/data/char16trie/test_branches.toml":"d787ffc89c62a564b487f3c8fb94588258be0d891044e5b3a79c2ab876cd3e57","tests/data/char16trie/test_compact.toml":"30cb3e794d0989e3e087c12de3db077449d82ce6af57666290166d43bdcd27d3","tests/data/char16trie/test_long_branch.toml":"877d408f7d58063723befd01af6e3b0f01060a9ca1c5611ee1ea88d73383fa5a","tests/data/char16trie/test_long_sequence.toml":"f58645b3f14e47850e2a03733f7e47b69b193067f4cccf96124846b1ad49d970","tests/data/char16trie/test_shortest_branch.toml":"af356553506dbc28a2413b9f0ca1489050cd11a72e90ba4b5020bcb596862e64","tests/data/cpt/free-blocks.16.toml":"e0a66e777c13c0885b6a0f6839cdc9bbbddded2f5fbef4710f8e69a0808791d9","tests/data/cpt/free-blocks.32.toml":"b0bb6068a84d08d3fbcbd54dce7a59385a42b2dcdf0a6fe9d4160754a80a5f9e","tests/data/cpt/free-blocks.8.toml":"2de9950cd4475c3cb9cca9c30cb6793b90f3881ea2dd1353bea0701110c76953","tests/data/cpt/free-blocks.small16.toml":"17cbdef8edec19e8d85802eda775b1095ae2d423a589a4b56064b3b13604af36","tests/data/cpt/grow-data.16.toml":"802c7c61c2bb70dd7c96ce4633584a2ac4d2e6a61ecfb6f5d19c3c419b76f97c","tests/data/cpt/grow-data.32.toml":"3cbf6ad1276eda17f18cbeba4db671340ebec0fe6c0b631ea1f52dab63669881","tests/data/cpt/grow-data.8.toml":"e2d0b066e8a0f0bbf21cffa72393e0fd8c9a7534887886438211600bf7717129","tests/data/cpt/grow-data.small16.toml":"1d4c5d4b47a3da6b392729be3aa7cfa2cfb58d9ae37565cf10dbc10f0b48beca","tests/data/cpt/planes.toml":"a2577942758490bd53f4022b30731cff947fae22f4cbbb03b5ae72c65357aa12","tests/data/cpt/set-empty.16.toml":"6a01c051c5dbbe816097da806b943ca1856312059b0842a1238fe75ad5df220b","tests/data/cpt/set-empty.32.toml":"ec9dec0296b150ccabde07c255e2971ba407f647824a7c37af0272fa2ba89e2d","tests/data/cpt/set-empty.8.toml":"478dd49db8670f447f5aae78bcd3cdbeb6f91f7861dec256d480623b5d00941b","tests/data/cpt/set-empty.small16.toml":"5ff232c9b020bdaaaf762f7c0afe48ccb6f94b40dce08c1ba7dcb66c46ad2423","tests/data/cpt/set-single-value.16.toml":"6720f4a4d8c113ab7085e6308792ea0005cc8fe3c5d8acacb2cf43e74b12f4b3","tests/data/cpt/set-single-value.32.toml":"cb93935dc9ce5ed3cbe0f0acb50b49308b232e2d3fc8e39b08d1c33127c9911d","tests/data/cpt/set-single-value.8.toml":"e5cb6b02341bb8992ec93e49a7b2b059af1fd046ede3021dc207f1833c6a3c95","tests/data/cpt/set-single-value.small16.toml":"3aef34147b20a5c2c2c6e20f6024d38f7c0518313371b05d3cb83ae78a9ef0db","tests/data/cpt/set1.16.toml":"01cc1078f281102bd0c9e854a373b7241f2295bb19caa9488caad1b5350d0beb","tests/data/cpt/set1.32.toml":"cd264d011692df42e9007df87c6500bdde4e098a3a85a89a185f7deeff025a3b","tests/data/cpt/set1.8.toml":"039aa2fca8f140f5a060bcf01a1da3d45618242dfb0a3c437d4263d5166398a3","tests/data/cpt/set1.small16.toml":"b8bf6e216201e0a0c61c4b2456eccd1c3b4f38647d67ba251cd7b08f340df0dc","tests/data/cpt/set2-overlap.16.toml":"49f1d7212cb3f7b10f4a0dbab267b64aeb59380cc28d86c67fd640737da5af0a","tests/data/cpt/set2-overlap.32.toml":"406104b0532ae249c603c03729f4596ab24460ccbb3a244e04fa2b8401795ef0","tests/data/cpt/set2-overlap.small16.toml":"4e8d9c5b25cda2fd80fa72e7e9863e6858548608d3fe2a2d774026eda95c959f","tests/data/cpt/set3-initial-9.16.toml":"f5fdc3d7c6d6813cc527ddffecf35db2d144e2706be0541277bbe4672ea29851","tests/data/cpt/set3-initial-9.32.toml":"da2887d40005fc071eee1bf4e828f40410266c44585deda208e78d369b5ca9a9","tests/data/cpt/set3-initial-9.8.toml":"5974d1961bd8334e6fb1be7431f794dfc87d0fecdee4b832ad1c82e2302a6617","tests/data/cpt/set3-initial-9.small16.toml":"f62d46d2b6492c02944d089885b2ce6b975468e6bceabf986b495ab42a06d595","tests/data/cpt/short-all-same.16.toml":"5c0252591699a35398f75b3bec977d6ed44cfffbf335a87ed7c3cff86ff74391","tests/data/cpt/short-all-same.8.toml":"23f7aa3a8e6c3cc75669b8df55827b03c6791aac1ec9f7c8d7f0bbbdd54f23a9","tests/data/cpt/short-all-same.small16.toml":"5c0252591699a35398f75b3bec977d6ed44cfffbf335a87ed7c3cff86ff74391","tests/data/cpt/small0-in-fast.16.toml":"8d00f5657ee11c3b00c7a3c1e6333632b37dba0762cd4868b2f8ef90c03aab6c","tests/data/cpt/small0-in-fast.32.toml":"4736b4ae18cb0e77adc523382ec44bc517a01e17abdb91522b8859d77fbdc7c6","tests/data/cpt/small0-in-fast.8.toml":"e9214d75c421989eb79b7060817f51fa1d648d55b854fad651ff729962bc49e4","tests/data/cpt/small0-in-fast.small16.toml":"20eb07e89364a1fd6ddf26f3bc302e92c1aaa724be792d9bf8656e4e5a7a6379"},"package":"4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43"} \ No newline at end of file +{"files":{"Cargo.lock":"5c3e432c15fb18f16c8343adcedc9c1d0f7dc58bc9b3e09438a06c6215545a26","Cargo.toml":"a1bcce20ab29725ab0d9a44d2b09eda57368c56b2b9d12b73b2958f7d7df4d83","LICENSE":"f367c1b8e1aa262435251e442901da4607b4650e0e63a026f5044473ecfb90f2","README.md":"b1a0b37b61d42026996dda3b7d524d42888181f3e7eaf940c9b2e5f561c449e3","benches/codepointtrie.rs":"4052e9e3a3a744955a5ab3f7089cafaf2920ad5c7566fc8b3b77ee1d39376c20","benches/iai_cpt.rs":"a8ed4e67866d415e6ed0c8c95a9b1887b4198ea409d4cd9efafb50b8c13b3ecc","benches/inv_list.rs":"93a540e1dc30d0d356eef56f044a64b87949d777fa21f35042d53ba1bbcf1fb5","benches/tries/gc_fast.rs":"4761a339f9b266813f4fa7ffa229b3464ced2ed106ce712ae6a96c0e49e5224e","benches/tries/gc_small.rs":"a1a75d2325dbce031e0127de8d84e900ca7c73ec81da1679965ab0127a99c205","benches/tries/mod.rs":"82cfdd1c5870d343613098fdff5a7961cfe5645a33480c6a252efae9a074e022","examples/unicode_bmp_blocks_selector.rs":"a75bc5327fa9df8ab0332dcdf10f72a968924a0698bdba4eb79312a8624cbd44","src/char16trie/mod.rs":"5950a1b427743e956b459956cadd72ff7531fe46bfb871d8e3a848b1e4ab0657","src/char16trie/trie.rs":"18ccf56efa1a2b2af6034b8a7a05310a4078127f496a957ca26ee1e1ae4d1aea","src/codepointinvlist/builder.rs":"dae06a19e6a4275006afcf313d492eabbc74bececa99198de88d29c8facf6415","src/codepointinvlist/conversions.rs":"9d4617631328f5ad668eb5ea6fb100f9881dbebf6f46235ae5a445be2dbb8664","src/codepointinvlist/cpinvlist.rs":"025cd179418d5be9ddf41e97e2ebaa4f9943527fc521a4bb11b93dc02893c33c","src/codepointinvlist/mod.rs":"39f18e0be77508696b80d456f861a1264b902e90298c71a54e00a4585069108f","src/codepointinvlist/utils.rs":"2fcb38b4ce33947e831449ca63e0872b1d90830521144e1089f26842f1b746c8","src/codepointinvliststringlist/mod.rs":"4f0f2ae1ecd9068a0100a48308e08405afcee182eb5c5743990f739d4d7fdc42","src/codepointtrie/cptrie.rs":"dfaaa7271eed2e486bc43f3a36e71579bec19b854f491f6375b97113691c41f6","src/codepointtrie/error.rs":"43d758777ef7ce3f87efe4c8c7fb8fbe7d184b2d40f3f5fb737bce69da5d75a7","src/codepointtrie/impl_const.rs":"ff25fa0d54e174c289b25a6060f50e03c8aa41bad922c9386de3148f8ad95109","src/codepointtrie/mod.rs":"934246b867396119195cce3b4243f1951b76f503f6f455fa73cc6cd66ff792db","src/codepointtrie/planes.rs":"637c63a165397831c8ce8d4c28eff11179467a7d7a6382960acd699d8a087f26","src/codepointtrie/serde.rs":"ada65ec125890ccf86d141a128a1f79dcda5f3a2269605da7a2fa145d3cbd07c","src/codepointtrie/toml.rs":"00d10cb710f69f84dd0fde871c4bd61e8cabe319362a11fc74a0af1f0fda2363","src/iterator_utils.rs":"a6401aa583a2d8a6476f632b24983e91aa000c9dfd075bcddbd8de512b5a06ae","src/lib.rs":"a15ba283ccb32fc9a1cbe67166fa8eac5cd9225e4de022d09b057be4ff8eb688","tests/char16trie.rs":"f8018b90187f3b99a6a835c1c41bced18d98a28c41822abf3536cd1f0f08c44f","tests/cpt.rs":"126c6c671a6aa525dd6fabaf57387c828bae0041b04dffcd7b3a22c674e1dd41","tests/data/char16trie/empty.toml":"b900365b9c786f1b185307f5d8835a901d4860b9b097bce13aa0e592fcb384c4","tests/data/char16trie/months.toml":"439245fc4385fe693f283b7bc179bf5558dd8039a89987314dfc8c4a9e0092b2","tests/data/char16trie/test_a.toml":"34b179dd4e7eef73ce373b74e426ecfa05fb7aa2b0fc15e437bfcf3ea4242a9f","tests/data/char16trie/test_a_ab.toml":"b84452cb9c310203599d3cb8279a3f000c39ff8026728573152026f0d5e2c798","tests/data/char16trie/test_branches.toml":"d787ffc89c62a564b487f3c8fb94588258be0d891044e5b3a79c2ab876cd3e57","tests/data/char16trie/test_compact.toml":"30cb3e794d0989e3e087c12de3db077449d82ce6af57666290166d43bdcd27d3","tests/data/char16trie/test_long_branch.toml":"877d408f7d58063723befd01af6e3b0f01060a9ca1c5611ee1ea88d73383fa5a","tests/data/char16trie/test_long_sequence.toml":"f58645b3f14e47850e2a03733f7e47b69b193067f4cccf96124846b1ad49d970","tests/data/char16trie/test_shortest_branch.toml":"af356553506dbc28a2413b9f0ca1489050cd11a72e90ba4b5020bcb596862e64","tests/data/cpt/free-blocks.16.toml":"e0a66e777c13c0885b6a0f6839cdc9bbbddded2f5fbef4710f8e69a0808791d9","tests/data/cpt/free-blocks.32.toml":"b0bb6068a84d08d3fbcbd54dce7a59385a42b2dcdf0a6fe9d4160754a80a5f9e","tests/data/cpt/free-blocks.8.toml":"2de9950cd4475c3cb9cca9c30cb6793b90f3881ea2dd1353bea0701110c76953","tests/data/cpt/free-blocks.small16.toml":"17cbdef8edec19e8d85802eda775b1095ae2d423a589a4b56064b3b13604af36","tests/data/cpt/grow-data.16.toml":"802c7c61c2bb70dd7c96ce4633584a2ac4d2e6a61ecfb6f5d19c3c419b76f97c","tests/data/cpt/grow-data.32.toml":"3cbf6ad1276eda17f18cbeba4db671340ebec0fe6c0b631ea1f52dab63669881","tests/data/cpt/grow-data.8.toml":"e2d0b066e8a0f0bbf21cffa72393e0fd8c9a7534887886438211600bf7717129","tests/data/cpt/grow-data.small16.toml":"1d4c5d4b47a3da6b392729be3aa7cfa2cfb58d9ae37565cf10dbc10f0b48beca","tests/data/cpt/planes.toml":"a2577942758490bd53f4022b30731cff947fae22f4cbbb03b5ae72c65357aa12","tests/data/cpt/set-empty.16.toml":"6a01c051c5dbbe816097da806b943ca1856312059b0842a1238fe75ad5df220b","tests/data/cpt/set-empty.32.toml":"ec9dec0296b150ccabde07c255e2971ba407f647824a7c37af0272fa2ba89e2d","tests/data/cpt/set-empty.8.toml":"478dd49db8670f447f5aae78bcd3cdbeb6f91f7861dec256d480623b5d00941b","tests/data/cpt/set-empty.small16.toml":"5ff232c9b020bdaaaf762f7c0afe48ccb6f94b40dce08c1ba7dcb66c46ad2423","tests/data/cpt/set-single-value.16.toml":"6720f4a4d8c113ab7085e6308792ea0005cc8fe3c5d8acacb2cf43e74b12f4b3","tests/data/cpt/set-single-value.32.toml":"cb93935dc9ce5ed3cbe0f0acb50b49308b232e2d3fc8e39b08d1c33127c9911d","tests/data/cpt/set-single-value.8.toml":"e5cb6b02341bb8992ec93e49a7b2b059af1fd046ede3021dc207f1833c6a3c95","tests/data/cpt/set-single-value.small16.toml":"3aef34147b20a5c2c2c6e20f6024d38f7c0518313371b05d3cb83ae78a9ef0db","tests/data/cpt/set1.16.toml":"01cc1078f281102bd0c9e854a373b7241f2295bb19caa9488caad1b5350d0beb","tests/data/cpt/set1.32.toml":"cd264d011692df42e9007df87c6500bdde4e098a3a85a89a185f7deeff025a3b","tests/data/cpt/set1.8.toml":"039aa2fca8f140f5a060bcf01a1da3d45618242dfb0a3c437d4263d5166398a3","tests/data/cpt/set1.small16.toml":"b8bf6e216201e0a0c61c4b2456eccd1c3b4f38647d67ba251cd7b08f340df0dc","tests/data/cpt/set2-overlap.16.toml":"49f1d7212cb3f7b10f4a0dbab267b64aeb59380cc28d86c67fd640737da5af0a","tests/data/cpt/set2-overlap.32.toml":"406104b0532ae249c603c03729f4596ab24460ccbb3a244e04fa2b8401795ef0","tests/data/cpt/set2-overlap.small16.toml":"4e8d9c5b25cda2fd80fa72e7e9863e6858548608d3fe2a2d774026eda95c959f","tests/data/cpt/set3-initial-9.16.toml":"f5fdc3d7c6d6813cc527ddffecf35db2d144e2706be0541277bbe4672ea29851","tests/data/cpt/set3-initial-9.32.toml":"da2887d40005fc071eee1bf4e828f40410266c44585deda208e78d369b5ca9a9","tests/data/cpt/set3-initial-9.8.toml":"5974d1961bd8334e6fb1be7431f794dfc87d0fecdee4b832ad1c82e2302a6617","tests/data/cpt/set3-initial-9.small16.toml":"f62d46d2b6492c02944d089885b2ce6b975468e6bceabf986b495ab42a06d595","tests/data/cpt/short-all-same.16.toml":"5c0252591699a35398f75b3bec977d6ed44cfffbf335a87ed7c3cff86ff74391","tests/data/cpt/short-all-same.8.toml":"23f7aa3a8e6c3cc75669b8df55827b03c6791aac1ec9f7c8d7f0bbbdd54f23a9","tests/data/cpt/short-all-same.small16.toml":"5c0252591699a35398f75b3bec977d6ed44cfffbf335a87ed7c3cff86ff74391","tests/data/cpt/small0-in-fast.16.toml":"8d00f5657ee11c3b00c7a3c1e6333632b37dba0762cd4868b2f8ef90c03aab6c","tests/data/cpt/small0-in-fast.32.toml":"4736b4ae18cb0e77adc523382ec44bc517a01e17abdb91522b8859d77fbdc7c6","tests/data/cpt/small0-in-fast.8.toml":"e9214d75c421989eb79b7060817f51fa1d648d55b854fad651ff729962bc49e4","tests/data/cpt/small0-in-fast.small16.toml":"20eb07e89364a1fd6ddf26f3bc302e92c1aaa724be792d9bf8656e4e5a7a6379"},"package":"200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47"} \ No newline at end of file diff --git a/deps/crates/vendor/icu_collections/.cargo_vcs_info.json b/deps/crates/vendor/icu_collections/.cargo_vcs_info.json deleted file mode 100644 index 4364a1d8632a00..00000000000000 --- a/deps/crates/vendor/icu_collections/.cargo_vcs_info.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "git": { - "sha1": "38a49da495248dd1ded84cf306e4ca42e64d5bb3" - }, - "path_in_vcs": "components/collections" -} \ No newline at end of file diff --git a/deps/crates/vendor/icu_collections/Cargo.lock b/deps/crates/vendor/icu_collections/Cargo.lock index ae29068d4b0956..2cf19f6502f5e8 100644 --- a/deps/crates/vendor/icu_collections/Cargo.lock +++ b/deps/crates/vendor/icu_collections/Cargo.lock @@ -19,21 +19,21 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstyle" -version = "1.0.13" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "autocfg" -version = "1.5.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "cast" @@ -43,9 +43,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cfg-if" -version = "1.0.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "ciborium" @@ -101,12 +101,9 @@ checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "cobs" -version = "0.3.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" -dependencies = [ - "thiserror", -] +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "criterion" @@ -171,9 +168,9 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" -version = "0.2.4" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] name = "databake" @@ -245,15 +242,15 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.16.0" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" [[package]] name = "hermit-abi" -version = "0.5.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" +checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08" [[package]] name = "iai" @@ -263,7 +260,7 @@ checksum = "71a816c97c42258aa5834d07590b718b4c9a598944cd39a52dc25b351185d678" [[package]] name = "icu_collections" -version = "2.1.1" +version = "2.0.0" dependencies = [ "criterion", "databake", @@ -281,9 +278,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.11.4" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", "hashbrown", @@ -291,9 +288,9 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.17" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" +checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" dependencies = [ "hermit-abi", "libc", @@ -317,9 +314,9 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.81" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -327,21 +324,21 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.177" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "log" -version = "0.4.28" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "memchr" -version = "2.7.6" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "num-traits" @@ -394,9 +391,9 @@ dependencies = [ [[package]] name = "postcard" -version = "1.1.3" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" +checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" dependencies = [ "cobs", "embedded-io 0.4.0", @@ -406,28 +403,28 @@ dependencies = [ [[package]] name = "potential_utf" -version = "0.1.4" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" dependencies = [ - "serde_core", + "serde", "zerovec", ] [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.41" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -454,9 +451,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.2" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -466,9 +463,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.13" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -477,15 +474,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.8" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustversion" -version = "1.0.22" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "ryu" @@ -504,28 +501,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_core" -version = "1.0.228" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.228" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", @@ -534,37 +521,36 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", "ryu", "serde", - "serde_core", ] [[package]] name = "serde_spanned" -version = "0.6.9" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] [[package]] name = "stable_deref_trait" -version = "1.2.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "syn" -version = "2.0.108" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -582,26 +568,6 @@ dependencies = [ "syn", ] -[[package]] -name = "thiserror" -version = "2.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tinytemplate" version = "1.2.1" @@ -614,9 +580,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.23" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" dependencies = [ "serde", "serde_spanned", @@ -626,18 +592,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.11" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.27" +version = "0.22.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" dependencies = [ "indexmap", "serde", @@ -648,9 +614,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.20" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "walkdir" @@ -664,22 +630,21 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.104" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", - "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.104" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", @@ -691,9 +656,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.104" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -701,9 +666,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.104" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", @@ -714,18 +679,18 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.104" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" dependencies = [ "unicode-ident", ] [[package]] name = "web-sys" -version = "0.3.81" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", @@ -733,42 +698,100 @@ dependencies = [ [[package]] name = "winapi-util" -version = "0.1.11" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ "windows-sys", ] [[package]] -name = "windows-link" -version = "0.2.1" +name = "windows-sys" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] [[package]] -name = "windows-sys" -version = "0.61.2" +name = "windows-targets" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows-link", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "winnow" -version = "0.7.13" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" dependencies = [ "memchr", ] [[package]] name = "yoke" -version = "0.8.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" dependencies = [ "stable_deref_trait", "yoke-derive", @@ -777,9 +800,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", @@ -810,9 +833,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.5" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" dependencies = [ "databake", "serde", @@ -823,9 +846,9 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.2" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", diff --git a/deps/crates/vendor/icu_collections/Cargo.toml b/deps/crates/vendor/icu_collections/Cargo.toml index abb0a93530006f..5fd8b60b4ee492 100644 --- a/deps/crates/vendor/icu_collections/Cargo.toml +++ b/deps/crates/vendor/icu_collections/Cargo.toml @@ -11,9 +11,9 @@ [package] edition = "2021" -rust-version = "1.83" +rust-version = "1.82" name = "icu_collections" -version = "2.1.1" +version = "2.0.0" authors = ["The ICU4X Project Developers"] build = false include = [ @@ -43,10 +43,7 @@ repository = "https://github.com/unicode-org/icu4x" all-features = true [features] -alloc = [ - "serde?/alloc", - "zerovec/alloc", -] +alloc = ["zerovec/alloc"] databake = [ "dep:databake", "zerovec/databake", @@ -63,6 +60,10 @@ name = "icu_collections" path = "src/lib.rs" bench = false +[[example]] +name = "unicode_bmp_blocks_selector" +path = "examples/unicode_bmp_blocks_selector.rs" + [[test]] name = "char16trie" path = "tests/char16trie.rs" @@ -97,13 +98,16 @@ version = "0.2.3" default-features = false [dependencies.potential_utf] -version = "0.1.3" +version = "0.1.1" features = ["zerovec"] default-features = false [dependencies.serde] -version = "1.0.220" -features = ["derive"] +version = "1.0.110" +features = [ + "derive", + "alloc", +] optional = true default-features = false @@ -118,7 +122,7 @@ features = ["derive"] default-features = false [dependencies.zerovec] -version = "0.11.3" +version = "0.11.1" features = [ "derive", "yoke", @@ -134,7 +138,7 @@ features = ["alloc"] default-features = false [dev-dependencies.serde] -version = "1.0.220" +version = "1.0.110" features = ["derive"] default-features = false diff --git a/deps/crates/vendor/icu_collections/Cargo.toml.orig b/deps/crates/vendor/icu_collections/Cargo.toml.orig deleted file mode 100644 index 5e93a0cd333c53..00000000000000 --- a/deps/crates/vendor/icu_collections/Cargo.toml.orig +++ /dev/null @@ -1,66 +0,0 @@ -# This file is part of ICU4X. For terms of use, please see the file -# called LICENSE at the top level of the ICU4X source tree -# (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -[package] -name = "icu_collections" -description = "Collection of API for use in ICU libraries." - -authors.workspace = true -categories.workspace = true -edition.workspace = true -homepage.workspace = true -include.workspace = true -license.workspace = true -repository.workspace = true -rust-version.workspace = true -version.workspace = true - -[package.metadata.docs.rs] -all-features = true - -[dependencies] -displaydoc = { workspace = true } -yoke = { workspace = true, features = ["derive"] } -zerofrom = { workspace = true, features = ["derive"] } -zerovec = { workspace = true, features = ["derive", "yoke"] } -potential_utf = { workspace = true, features = ["zerovec"] } - -serde = { workspace = true, features = ["derive"], optional = true } -databake = { workspace = true, features = ["derive"], optional = true } - -[dev-dependencies] -iai = { workspace = true } -icu = { path = "../../components/icu", default-features = false } -icu_properties = { path = "../../components/properties" } -postcard = { workspace = true, features = ["alloc"] } -serde = { workspace = true, features = ["derive"] } -serde_json = { workspace = true } - -toml = { workspace = true } - -[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] -criterion = { workspace = true } - -[features] -serde = ["dep:serde", "zerovec/serde", "potential_utf/serde", "alloc"] -databake = ["dep:databake", "zerovec/databake"] -alloc = ["serde?/alloc", "zerovec/alloc"] - -[lib] -bench = false # This option is required for Benchmark CI - -[[bench]] -name = "codepointtrie" -harness = false -path = "benches/codepointtrie.rs" - -[[bench]] -name = "iai_cpt" -harness = false -path = "benches/iai_cpt.rs" - -[[bench]] -name = "inv_list" -harness = false -path = "benches/inv_list.rs" diff --git a/deps/crates/vendor/icu_collections/benches/inv_list.rs b/deps/crates/vendor/icu_collections/benches/inv_list.rs index 743c855af8c745..41a23568046090 100644 --- a/deps/crates/vendor/icu_collections/benches/inv_list.rs +++ b/deps/crates/vendor/icu_collections/benches/inv_list.rs @@ -14,7 +14,7 @@ fn uniset_bench(c: &mut Criterion) { CodePointInversionList::try_from_u32_inversion_list_slice(&worst_ex).unwrap(); c.bench_function("uniset/overview", |b| { - #[expect(clippy::suspicious_map)] + #[allow(clippy::suspicious_map)] b.iter(|| { best_sample .iter_chars() diff --git a/deps/crates/vendor/icu_collections/examples/unicode_bmp_blocks_selector.rs b/deps/crates/vendor/icu_collections/examples/unicode_bmp_blocks_selector.rs new file mode 100644 index 00000000000000..c29f1d25000564 --- /dev/null +++ b/deps/crates/vendor/icu_collections/examples/unicode_bmp_blocks_selector.rs @@ -0,0 +1,71 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +// An example application which uses icu_uniset to test what blocks of +// Basic Multilingual Plane a character belongs to. +// +// In this example we use `CodePointInversionListBuilder` to construct just the first +// two blocks of the first plane, and use an instance of a `BMPBlockSelector` +// to retrieve which of those blocks each character of a string belongs to. +// +// This is a simple example of the API use and is severely oversimplified +// compared to real Unicode block selection. + +#![no_main] // https://github.com/unicode-org/icu4x/issues/395 +icu_benchmark_macros::instrument!(); +use icu_benchmark_macros::println; + +use icu_collections::codepointinvlist::{CodePointInversionList, CodePointInversionListBuilder}; +use std::ops::RangeInclusive; + +#[derive(Copy, Clone, Debug)] +enum BmpBlock { + Basic, + Latin1Supplement, + Unknown, +} + +const BLOCKS: [(BmpBlock, RangeInclusive); 2] = [ + (BmpBlock::Basic, '\u{0000}'..='\u{007F}'), + (BmpBlock::Latin1Supplement, '\u{0080}'..='\u{00FF}'), +]; + +struct BmpBlockSelector { + blocks: [(BmpBlock, CodePointInversionList<'static>); 2], +} + +impl BmpBlockSelector { + pub fn new() -> BmpBlockSelector { + BmpBlockSelector { + blocks: BLOCKS.map(|(ch, range)| { + (ch, { + let mut builder = CodePointInversionListBuilder::new(); + builder.add_range(range); + builder.build() + }) + }), + } + } + + pub fn select(&self, input: char) -> BmpBlock { + for (block, set) in &self.blocks { + if set.contains(input) { + return *block; + } + } + BmpBlock::Unknown + } +} + +fn main() { + let selector = BmpBlockSelector::new(); + + let sample = "Welcome to MyName©®, Алексей!"; + + println!("\n====== Unicode BMP Block Selector example ============"); + for ch in sample.chars() { + let block = selector.select(ch); + println!("{ch}: {block:#?}"); + } +} diff --git a/deps/crates/vendor/icu_collections/src/char16trie/trie.rs b/deps/crates/vendor/icu_collections/src/char16trie/trie.rs index 5aedccabe5e1c4..1d48307957c3ce 100644 --- a/deps/crates/vendor/icu_collections/src/char16trie/trie.rs +++ b/deps/crates/vendor/icu_collections/src/char16trie/trie.rs @@ -88,14 +88,12 @@ pub struct Char16Trie<'data> { impl<'data> Char16Trie<'data> { /// Returns a new [`Char16Trie`] with ownership of the provided data. - #[inline] pub fn new(data: ZeroVec<'data, u16>) -> Self { Self { data } } /// Returns a new [`Char16TrieIterator`] backed by borrowed data from the `trie` data - #[inline] - pub fn iter(&self) -> Char16TrieIterator<'_> { + pub fn iter(&self) -> Char16TrieIterator { Char16TrieIterator::new(&self.data) } } @@ -166,7 +164,6 @@ macro_rules! trie_unwrap { impl<'a> Char16TrieIterator<'a> { /// Returns a new [`Char16TrieIterator`] backed by borrowed data for the `trie` array - #[inline] pub fn new(trie: &'a ZeroSlice) -> Self { Self { trie, diff --git a/deps/crates/vendor/icu_collections/src/codepointinvlist/builder.rs b/deps/crates/vendor/icu_collections/src/codepointinvlist/builder.rs index d12cba38626269..f5b019dd58ff08 100644 --- a/deps/crates/vendor/icu_collections/src/codepointinvlist/builder.rs +++ b/deps/crates/vendor/icu_collections/src/codepointinvlist/builder.rs @@ -32,7 +32,7 @@ impl CodePointInversionListBuilder { .into_iter() .map(PotentialCodePoint::from_u24) .collect(); - #[expect(clippy::unwrap_used)] // by invariant + #[allow(clippy::unwrap_used)] // by invariant CodePointInversionList::try_from_inversion_list(inv_list).unwrap() } @@ -51,7 +51,7 @@ impl CodePointInversionListBuilder { let end_pos_check = (end_ind % 2 == 0) == add; let start_eq_end = start_ind == end_ind; - #[expect(clippy::indexing_slicing)] // all indices are binary search results + #[allow(clippy::indexing_slicing)] // all indices are binary search results if start_eq_end && start_pos_check && end_res.is_err() { self.intervals.splice(start_ind..end_ind, [start, end]); } else { @@ -182,7 +182,7 @@ impl CodePointInversionListBuilder { /// ``` #[allow(unused_assignments)] pub fn add_set(&mut self, set: &CodePointInversionList) { - #[expect(clippy::indexing_slicing)] // chunks + #[allow(clippy::indexing_slicing)] // chunks set.as_inversion_list() .as_ule_slice() .chunks(2) @@ -203,7 +203,7 @@ impl CodePointInversionListBuilder { return; } if let Some(&last) = self.intervals.last() { - #[expect(clippy::indexing_slicing)] + #[allow(clippy::indexing_slicing)] // by invariant, if we have a last we have a (different) first if start <= self.intervals[0] && end >= last { self.intervals.clear(); @@ -267,7 +267,7 @@ impl CodePointInversionListBuilder { /// builder.remove_set(&set); // removes 'A'..='E' /// let check = builder.build(); /// assert_eq!(check.iter_chars().next(), Some('F')); - #[expect(clippy::indexing_slicing)] // chunks + #[allow(clippy::indexing_slicing)] // chunks pub fn remove_set(&mut self, set: &CodePointInversionList) { set.as_inversion_list() .as_ule_slice() @@ -350,7 +350,7 @@ impl CodePointInversionListBuilder { /// assert!(check.contains('A')); /// assert!(!check.contains('G')); /// ``` - #[expect(clippy::indexing_slicing)] // chunks + #[allow(clippy::indexing_slicing)] // chunks pub fn retain_set(&mut self, set: &CodePointInversionList) { let mut prev = 0; for pair in set.as_inversion_list().as_ule_slice().chunks(2) { @@ -424,7 +424,7 @@ impl CodePointInversionListBuilder { /// ``` pub fn complement(&mut self) { if !self.intervals.is_empty() { - #[expect(clippy::indexing_slicing)] // by invariant + #[allow(clippy::indexing_slicing)] // by invariant if self.intervals[0] == 0 { self.intervals.drain(0..1); } else { diff --git a/deps/crates/vendor/icu_collections/src/codepointinvlist/conversions.rs b/deps/crates/vendor/icu_collections/src/codepointinvlist/conversions.rs index 7488654a8f32b2..9e4cb380c7b41f 100644 --- a/deps/crates/vendor/icu_collections/src/codepointinvlist/conversions.rs +++ b/deps/crates/vendor/icu_collections/src/codepointinvlist/conversions.rs @@ -25,7 +25,7 @@ fn try_from_range<'data>( PotentialCodePoint::from_u24(till), ]; let inv_list: ZeroVec = ZeroVec::alloc_from_slice(&set); - #[expect(clippy::unwrap_used)] // valid + #[allow(clippy::unwrap_used)] // valid Ok(CodePointInversionList::try_from_inversion_list(inv_list).unwrap()) } else { Err(RangeError(from, till)) diff --git a/deps/crates/vendor/icu_collections/src/codepointinvlist/cpinvlist.rs b/deps/crates/vendor/icu_collections/src/codepointinvlist/cpinvlist.rs index 02f624cdd16a73..3b63ff365d3a79 100644 --- a/deps/crates/vendor/icu_collections/src/codepointinvlist/cpinvlist.rs +++ b/deps/crates/vendor/icu_collections/src/codepointinvlist/cpinvlist.rs @@ -120,7 +120,7 @@ impl UnicodeCodePoint { if cp <= char::MAX as u32 { Ok(Self(cp)) } else { - Err(format!("Not a Unicode code point {cp}")) + Err(format!("Not a Unicode code point {}", cp)) } } @@ -221,7 +221,7 @@ impl<'data> CodePointInversionList<'data> { pub fn try_from_inversion_list( inv_list: ZeroVec<'data, PotentialCodePoint>, ) -> Result { - #[expect(clippy::indexing_slicing)] // chunks + #[allow(clippy::indexing_slicing)] // chunks if is_valid_zv(&inv_list) { let size = inv_list .as_ule_slice() @@ -255,8 +255,6 @@ impl<'data> CodePointInversionList<'data> { /// The inversion list must be of even length, sorted ascending non-overlapping, /// and within the bounds of `0x0 -> 0x10FFFF` inclusive, and end points being exclusive. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -292,8 +290,6 @@ impl<'data> CodePointInversionList<'data> { } /// Attempts to convert this list into a fully-owned one. No-op if already fully owned - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn into_owned(self) -> CodePointInversionList<'static> { CodePointInversionList { @@ -303,8 +299,6 @@ impl<'data> CodePointInversionList<'data> { } /// Returns an owned inversion list representing the current [`CodePointInversionList`] - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn get_inversion_list_vec(&self) -> Vec { self.as_inversion_list().iter().map(u32::from).collect() @@ -368,7 +362,7 @@ impl<'data> CodePointInversionList<'data> { /// /// Public only to the crate, not exposed to public #[cfg(feature = "alloc")] - pub(crate) fn as_inversion_list(&self) -> &ZeroVec<'_, PotentialCodePoint> { + pub(crate) fn as_inversion_list(&self) -> &ZeroVec { &self.inv_list } @@ -391,7 +385,7 @@ impl<'data> CodePointInversionList<'data> { /// assert_eq!(None, ex_iter_chars.next()); /// ``` pub fn iter_chars(&self) -> impl Iterator + '_ { - #[expect(clippy::indexing_slicing)] // chunks + #[allow(clippy::indexing_slicing)] // chunks self.inv_list .as_ule_slice() .chunks(2) @@ -424,7 +418,7 @@ impl<'data> CodePointInversionList<'data> { /// assert_eq!(None, example_iter_ranges.next()); /// ``` pub fn iter_ranges(&self) -> impl ExactSizeIterator> + '_ { - #[expect(clippy::indexing_slicing)] // chunks + #[allow(clippy::indexing_slicing)] // chunks self.inv_list.as_ule_slice().chunks(2).map(|pair| { let range_start = u32::from(PotentialCodePoint::from_unaligned(pair[0])); let range_limit = u32::from(PotentialCodePoint::from_unaligned(pair[1])); @@ -477,7 +471,7 @@ impl<'data> CodePointInversionList<'data> { } else { None }; - #[expect(clippy::indexing_slicing)] // chunks + #[allow(clippy::indexing_slicing)] // chunks let chunks = middle.chunks(2).map(|pair| { let range_start = u32::from(PotentialCodePoint::from_unaligned(pair[0])); let range_limit = u32::from(PotentialCodePoint::from_unaligned(pair[1])); diff --git a/deps/crates/vendor/icu_collections/src/codepointinvlist/mod.rs b/deps/crates/vendor/icu_collections/src/codepointinvlist/mod.rs index 34b99b3b8cfd5c..be4986a301d3c2 100644 --- a/deps/crates/vendor/icu_collections/src/codepointinvlist/mod.rs +++ b/deps/crates/vendor/icu_collections/src/codepointinvlist/mod.rs @@ -53,6 +53,8 @@ #![warn(missing_docs)] +extern crate alloc; + #[cfg(feature = "alloc")] #[macro_use] mod builder; diff --git a/deps/crates/vendor/icu_collections/src/codepointinvlist/utils.rs b/deps/crates/vendor/icu_collections/src/codepointinvlist/utils.rs index ef04d3b18b9a27..525b02ffd116f1 100644 --- a/deps/crates/vendor/icu_collections/src/codepointinvlist/utils.rs +++ b/deps/crates/vendor/icu_collections/src/codepointinvlist/utils.rs @@ -12,8 +12,8 @@ use zerovec::ZeroVec; /// Returns whether the vector is sorted ascending non inclusive, of even length, /// and within the bounds of `0x0 -> 0x10FFFF + 1` inclusive. -#[expect(clippy::indexing_slicing)] // windows -#[expect(clippy::unwrap_used)] // by is_empty check +#[allow(clippy::indexing_slicing)] // windows +#[allow(clippy::unwrap_used)] // by is_empty check pub fn is_valid_zv(inv_list_zv: &ZeroVec<'_, PotentialCodePoint>) -> bool { inv_list_zv.is_empty() || (inv_list_zv.len() % 2 == 0 @@ -48,7 +48,7 @@ mod tests { use core::char; use zerovec::ZeroVec; - fn make_zv(slice: &[u32]) -> ZeroVec<'_, PotentialCodePoint> { + fn make_zv(slice: &[u32]) -> ZeroVec { slice .iter() .copied() diff --git a/deps/crates/vendor/icu_collections/src/codepointinvliststringlist/mod.rs b/deps/crates/vendor/icu_collections/src/codepointinvliststringlist/mod.rs index 136f5ef2c21984..2562cc5bc69512 100644 --- a/deps/crates/vendor/icu_collections/src/codepointinvliststringlist/mod.rs +++ b/deps/crates/vendor/icu_collections/src/codepointinvliststringlist/mod.rs @@ -231,7 +231,6 @@ impl<'data> CodePointInversionListAndStringList<'data> { } #[cfg(feature = "alloc")] -/// ✨ *Enabled with the `alloc` Cargo feature.* impl<'a> FromIterator<&'a str> for CodePointInversionListAndStringList<'_> { fn from_iter(it: I) -> Self where diff --git a/deps/crates/vendor/icu_collections/src/codepointtrie/cptrie.rs b/deps/crates/vendor/icu_collections/src/codepointtrie/cptrie.rs index 5b184a46f894f5..8a79032afbecfd 100644 --- a/deps/crates/vendor/icu_collections/src/codepointtrie/cptrie.rs +++ b/deps/crates/vendor/icu_collections/src/codepointtrie/cptrie.rs @@ -17,10 +17,8 @@ use core::num::TryFromIntError; use core::ops::RangeInclusive; use yoke::Yokeable; use zerofrom::ZeroFrom; -use zerovec::ule::AsULE; #[cfg(feature = "alloc")] use zerovec::ule::UleError; -use zerovec::ZeroSlice; use zerovec::ZeroVec; /// The type of trie represents whether the trie has an optimization that @@ -131,28 +129,8 @@ fn maybe_filter_value(value: T, trie_null_value: T, null_value: T) // serde impls in crate::serde #[derive(Debug, Eq, PartialEq, Yokeable, ZeroFrom)] pub struct CodePointTrie<'trie, T: TrieValue> { - /// # Safety Invariant - /// - /// The value of `header.trie_type` must not change after construction. pub(crate) header: CodePointTrieHeader, - /// # Safety Invariant - /// - /// If `header.trie_type == TrieType::Fast`, `index.len()` must be greater - /// than `FAST_TYPE_FAST_INDEXING_MAX`. Otherwise, `index.len()` - /// must be greater than `SMALL_TYPE_FAST_INDEXING_MAX`. Furthermore, - /// this field must not change after construction. (Strictly: It must - /// not become shorter than the length requirement stated above and the - /// values within the prefix up to the length requirement must not change.) pub(crate) index: ZeroVec<'trie, u16>, - /// # Safety Invariant - /// - /// If `header.trie_type == TrieType::Fast`, `data.len()` must be greater - /// than `FAST_TYPE_DATA_MASK` plus the largest value in - /// `index[0..FAST_TYPE_FAST_INDEXING_MAX + 1]`. Otherwise, `data.len()` - /// must be greater than `FAST_TYPE_DATA_MASK` plus the largest value in - /// `index[0..SMALL_TYPE_FAST_INDEXING_MAX + 1]`. Furthermore, this field - /// must not change after construction. (Strictly: The stated length - /// requirement must continue to hold.) pub(crate) data: ZeroVec<'trie, T>, // serde impl skips this field #[zerofrom(clone)] // TrieValue is Copy, this allows us to avoid @@ -161,13 +139,6 @@ pub struct CodePointTrie<'trie, T: TrieValue> { } /// This struct contains the fixed-length header fields of a [`CodePointTrie`]. -/// -/// # Safety Invariant -/// -/// The `trie_type` field must not change after construction. -/// -/// (In practice, all the fields here remain unchanged during the lifetime -/// of the trie.) #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "databake", derive(databake::Bake))] #[cfg_attr(feature = "databake", databake(path = icu_collections::codepointtrie))] @@ -202,10 +173,6 @@ pub struct CodePointTrieHeader { pub null_value: u32, /// The enum value representing the type of trie, where trie type is as it /// is defined in ICU (ex: Fast, Small). - /// - /// # Safety Invariant - /// - /// Must not change after construction. pub trie_type: TrieType, } @@ -265,21 +232,12 @@ macro_rules! w( impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { #[doc(hidden)] // databake internal - /// # Safety - /// - /// `header.trie_type`, `index`, and `data` must - /// satisfy the invariants for the fields of the - /// same names on `CodePointTrie`. - pub const unsafe fn from_parts_unstable_unchecked_v1( + pub const fn from_parts( header: CodePointTrieHeader, index: ZeroVec<'trie, u16>, data: ZeroVec<'trie, T>, error_value: T, ) -> Self { - // Field invariants upheld: The caller is responsible. - // In practice, this means that datagen in the databake - // mode upholds these invariants when constructing the - // `CodePointTrie` that is then baked. Self { header, index, @@ -295,8 +253,19 @@ impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { index: ZeroVec<'trie, u16>, data: ZeroVec<'trie, T>, ) -> Result, Error> { - let error_value = Self::validate_fields(&header, &index, &data)?; - // Field invariants upheld: Checked by `validate_fields` above. + // Validation invariants are not needed here when constructing a new + // `CodePointTrie` because: + // + // - Rust includes the size of a slice (or Vec or similar), which allows it + // to prevent lookups at out-of-bounds indices, whereas in C++, it is the + // programmer's responsibility to keep track of length info. + // - For lookups into collections, Rust guarantees that a fallback value will + // be returned in the case of `.get()` encountering a lookup error, via + // the `Option` type. + // - The `ZeroVec` serializer stores the length of the array along with the + // ZeroVec data, meaning that a deserializer would also see that length info. + + let error_value = data.last().ok_or(Error::EmptyDataVector)?; let trie: CodePointTrie<'trie, T> = CodePointTrie { header, index, @@ -306,122 +275,9 @@ impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { Ok(trie) } - /// Checks the invariant on the fields that fast-path access relies on for - /// safety in order to omit slice bound checks and upon success returns the - /// `error_value` for the trie. - /// - /// # Safety Usable Invariant - /// - /// Iff this function returns `Ok(T)`, the arguments satisfy the invariants - /// for corresponding fields of `CodePointTrie`. (Other than proving that - /// nothing else changes the fields subsequently.) - pub(crate) fn validate_fields( - header: &CodePointTrieHeader, - index: &ZeroSlice, - data: &ZeroSlice, - ) -> Result { - let error_value = data.last().ok_or(Error::EmptyDataVector)?; - - // `CodePointTrie` lookup has two stages: fast and small (the trie types - // are also fast and small; they affect where the boundary between fast - // and small lookups is). - // - // The length requirements for `index` and `data` are checked here only - // for the fast lookup case so that the fast lookup can omit bound checks - // at the time of access. In the small lookup case, bounds are checked at - // the time of access. - // - // The fast lookup happens on the prefixes of `index` and `data` with - // more items for the small lookup case afterwards. The check here - // only looks at the prefixes relevant to the fast case. - // - // In the fast lookup case, the bits of the of the code point are - // partitioned into a bit prefix and a bit suffix. First, a value - // is read from `index` by indexing into it using the bit prefix. - // Then `data` is accessed by the value just read from `index` plus - // the bit suffix. - // - // Therefore, the length of `index` needs to accommodate access - // by the maximum possible bit prefix, and the length of `data` - // needs to accommodate access by the largest value stored in the part - // of `data` reachable by the bit prefix plus the maximum possible bit - // suffix. - // - // The maximum possible bit prefix depends on the trie type. - - // The maximum code point that can be used for fast-path access: - let fast_max = match header.trie_type { - TrieType::Fast => FAST_TYPE_FAST_INDEXING_MAX, - TrieType::Small => SMALL_TYPE_FAST_INDEXING_MAX, - }; - // Keep only the prefix bits: - let max_bit_prefix = fast_max >> FAST_TYPE_SHIFT; - // Attempt slice the part of `index` that the fast path can index into. - // Since `max_bit_prefix` is the largest possible value used for - // indexing (inclusive bound), we need to add one to get the exclusive - // bound, which is what `get_subslice` wants. - let fast_index = index - .get_subslice(0..(max_bit_prefix as usize) + 1) - .ok_or(Error::IndexTooShortForFastAccess)?; - // Invariant upheld for `index`: If we got this far, the length of `index` - // satisfies its length invariant on the assumption that `header.trie_type` - // will not change subsequently. - - // Now find the largest offset in the part of `index` reachable by the - // bit prefix. `max` can never actually return `None`, since we already - // know the slice isn't empty. Hence, reusing the error kind instead of - // minting a new one for this check. - let max_offset = fast_index - .iter() - .max() - .ok_or(Error::IndexTooShortForFastAccess)?; - // `FAST_TYPE_DATA_MASK` is the maximum possible bit suffix, since the - // maximum is when all the bits in the suffix are set, and the mask - // has that many bits set. - if (max_offset) as usize + (FAST_TYPE_DATA_MASK as usize) >= data.len() { - return Err(Error::DataTooShortForFastAccess); - } - - // Invariant upheld for `data`: If we got this far, the length of `data` - // satisfies `data`'s length invariant on the assumption that the contents - // of `fast_index` subslice of `index` and `header.trie_type` will not - // change subsequently. - - Ok(error_value) - } - - /// Turns this trie into a version whose trie type is encoded in the Rust type. - #[inline] - pub fn to_typed(self) -> Typed, SmallCodePointTrie<'trie, T>> { - match self.header.trie_type { - TrieType::Fast => Typed::Fast(FastCodePointTrie { inner: self }), - TrieType::Small => Typed::Small(SmallCodePointTrie { inner: self }), - } - } - - /// Obtains a reference to this trie as a Rust type that encodes the trie type in the Rust type. - #[inline] - pub fn as_typed_ref( - &self, - ) -> Typed<&FastCodePointTrie<'trie, T>, &SmallCodePointTrie<'trie, T>> { - // SAFETY: `FastCodePointTrie` and `SmallCodePointTrie` are `repr(transparent)` - // with `CodePointTrie`, so transmuting between the references is OK when the - // actual trie type agrees with the semantics of the typed wrapper. - match self.header.trie_type { - TrieType::Fast => Typed::Fast(unsafe { - core::mem::transmute::<&CodePointTrie<'trie, T>, &FastCodePointTrie<'trie, T>>(self) - }), - TrieType::Small => Typed::Small(unsafe { - core::mem::transmute::<&CodePointTrie<'trie, T>, &SmallCodePointTrie<'trie, T>>( - self, - ) - }), - } - } - /// Returns the position in the data array containing the trie's stored /// error value. - #[inline(always)] // `always` was based on previous normalizer benchmarking + #[inline(always)] // `always` based on normalizer benchmarking fn trie_error_val_index(&self) -> u32 { // We use wrapping_sub here to avoid panicky overflow checks. // len should always be > 1, but if it isn't this will just cause GIGO behavior of producing @@ -519,6 +375,7 @@ impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { /// array for each block of code points in [0, `fastMax`), which in /// turn guarantees that those code points are represented and only need 1 /// lookup. + #[inline(always)] // `always` based on normalizer benchmarking fn fast_index(&self, code_point: u32) -> u32 { let index_array_pos: u32 = code_point >> FAST_TYPE_SHIFT; let index_array_val: u16 = @@ -533,105 +390,6 @@ impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { fast_index_val } - /// Returns the value that is associated with `code_point` in this [`CodePointTrie`] - /// if `code_point` uses fast-path lookup or `None` if `code_point` - /// should use small-path lookup or is above the supported range. - #[inline(always)] // "always" to make the `Option` collapse away - fn get32_by_fast_index(&self, code_point: u32) -> Option { - let fast_max = match self.header.trie_type { - TrieType::Fast => FAST_TYPE_FAST_INDEXING_MAX, - TrieType::Small => SMALL_TYPE_FAST_INDEXING_MAX, - }; - if code_point <= fast_max { - // SAFETY: We just checked the invariant of - // `get32_assuming_fast_index`, - // which is - // "If `self.header.trie_type == TrieType::Small`, `code_point` must be at most - // `SMALL_TYPE_FAST_INDEXING_MAX`. If `self.header.trie_type == - // TrieType::Fast`, `code_point` must be at most `FAST_TYPE_FAST_INDEXING_MAX`." - Some(unsafe { self.get32_assuming_fast_index(code_point) }) - } else { - // The caller needs to call `get32_by_small_index` or determine - // that the argument is above the permitted range. - None - } - } - - /// Performs the actual fast-mode lookup - /// - /// # Safety - /// - /// If `self.header.trie_type == TrieType::Small`, `code_point` must be at most - /// `SMALL_TYPE_FAST_INDEXING_MAX`. If `self.header.trie_type == - /// TrieType::Fast`, `code_point` must be at most `FAST_TYPE_FAST_INDEXING_MAX`. - #[inline(always)] - unsafe fn get32_assuming_fast_index(&self, code_point: u32) -> T { - // Check the safety invariant of this method. - debug_assert!( - code_point - <= match self.header.trie_type { - TrieType::Fast => FAST_TYPE_FAST_INDEXING_MAX, - TrieType::Small => SMALL_TYPE_FAST_INDEXING_MAX, - } - ); - - let bit_prefix = (code_point as usize) >> FAST_TYPE_SHIFT; - debug_assert!(bit_prefix < self.index.len()); - // SAFETY: Relying on the length invariant of `self.index` having - // been checked and on the unchangedness invariant of `self.index` - // and `self.header.trie_type` after construction. - let base_offset_to_data: usize = usize::from(u16::from_unaligned(*unsafe { - self.index.as_ule_slice().get_unchecked(bit_prefix) - })); - let bit_suffix = (code_point & FAST_TYPE_DATA_MASK) as usize; - // SAFETY: Cannot overflow with supported (32-bit and 64-bit) `usize` - // sizes, since `base_offset_to_data` was extended from `u16` and - // `bit_suffix` is at most `FAST_TYPE_DATA_MASK`, which is well - // under what it takes to reach the 32-bit (or 64-bit) max with - // additon from the max of `u16`. - let offset_to_data = w!(base_offset_to_data + bit_suffix); - debug_assert!(offset_to_data < self.data.len()); - // SAFETY: Relying on the length invariant of `self.data` having - // been checked and on the unchangedness invariant of `self.data`, - // `self.index`, and `self.header.trie_type` after construction. - T::from_unaligned(*unsafe { self.data.as_ule_slice().get_unchecked(offset_to_data) }) - } - - /// Coldness wrapper for `get32_by_small_index` to also allow - /// calls without the effects of `#[cold]`. - #[cold] - #[inline(always)] - fn get32_by_small_index_cold(&self, code_point: u32) -> T { - self.get32_by_small_index(code_point) - } - - /// Returns the value that is associated with `code_point` in this [`CodePointTrie`] - /// assuming that the small index path should be used. - /// - /// # Intended Precondition - /// - /// `code_point` must be at most `CODE_POINT_MAX` AND greter than - /// `FAST_TYPE_FAST_INDEXING_MAX` if the trie type is fast or greater - /// than `SMALL_TYPE_FAST_INDEXING_MAX` if the trie type is small. - /// This is checked when debug assertions are enabled. If this - /// precondition is violated, the behavior of this method is - /// memory-safe, but the returned value may be bogus (not - /// necessarily the designated error value). - #[inline(never)] - fn get32_by_small_index(&self, code_point: u32) -> T { - debug_assert!(code_point <= CODE_POINT_MAX); - debug_assert!( - code_point - > match self.header.trie_type { - TrieType::Fast => FAST_TYPE_FAST_INDEXING_MAX, - TrieType::Small => SMALL_TYPE_FAST_INDEXING_MAX, - } - ); - self.data - .get(self.small_index(code_point) as usize) - .unwrap_or(self.error_value) - } - /// Returns the value that is associated with `code_point` in this [`CodePointTrie`]. /// /// # Examples @@ -646,13 +404,11 @@ impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { /// ``` #[inline(always)] // `always` based on normalizer benchmarking pub fn get32(&self, code_point: u32) -> T { - if let Some(v) = self.get32_by_fast_index(code_point) { - v - } else if code_point <= CODE_POINT_MAX { - self.get32_by_small_index_cold(code_point) - } else { - self.error_value - } + // If we cannot read from the data array, then return the sentinel value + // self.error_value() for the instance type for T: TrieValue. + self.get32_ule(code_point) + .map(|t| T::from_unaligned(*t)) + .unwrap_or(self.error_value) } /// Returns the value that is associated with `char` in this [`CodePointTrie`]. @@ -669,41 +425,7 @@ impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { /// ``` #[inline(always)] pub fn get(&self, c: char) -> T { - // LLVM's optimizations have been observed not to be 100% - // reliable around collapsing away unnecessary parts of - // `get32`, so not just calling `get32` here. - let code_point = u32::from(c); - if let Some(v) = self.get32_by_fast_index(code_point) { - v - } else { - self.get32_by_small_index_cold(code_point) - } - } - - /// Returns the value that is associated with `bmp` in this [`CodePointTrie`]. - #[inline(always)] - pub fn get16(&self, bmp: u16) -> T { - // LLVM's optimizations have been observed not to be 100% - // reliable around collapsing away unnecessary parts of - // `get32`, so not just calling `get32` here. - let code_point = u32::from(bmp); - if let Some(v) = self.get32_by_fast_index(code_point) { - v - } else { - self.get32_by_small_index_cold(code_point) - } - } - - /// Lookup trie value by non-Basic Multilingual Plane Scalar Value. - /// - /// The return value may be bogus (not necessarily `error_value`) is the argument is actually in - /// the Basic Multilingual Plane or above the Unicode Scalar Value - /// range (panics instead with debug assertions enabled). - #[inline(always)] - pub fn get32_supplementary(&self, supplementary: u32) -> T { - debug_assert!(supplementary > 0xFFFF); - debug_assert!(supplementary <= CODE_POINT_MAX); - self.get32_by_small_index(supplementary) + self.get32(u32::from(c)) } /// Returns a reference to the ULE of the value that is associated with `code_point` in this [`CodePointTrie`]. @@ -718,7 +440,7 @@ impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { /// assert_eq!(Some(&0), trie.get32_ule(0x13E0)); // 'Ꮰ' as u32 /// assert_eq!(Some(&1), trie.get32_ule(0x10044)); // '𐁄' as u32 /// ``` - #[inline(always)] // `always` was based on previous normalizer benchmarking + #[inline(always)] // `always` based on normalizer benchmarking pub fn get32_ule(&self, code_point: u32) -> Option<&T::ULE> { // All code points up to the fast max limit are represented // individually in the `index` array to hold their `data` array position, and @@ -753,8 +475,6 @@ impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { /// More specifically, panics if [`ZeroVec::try_into_converted()`] panics when converting /// `ZeroVec` into `ZeroVec

`, which happens if `T::ULE` and `P::ULE` differ in size. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ```no_run @@ -777,7 +497,7 @@ impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { let slice = &[error_ule]; let error_vec = ZeroVec::::new_borrowed(slice); let error_converted = error_vec.try_into_converted::

()?; - #[expect(clippy::expect_used)] // we know this cannot fail + #[allow(clippy::expect_used)] // we know this cannot fail Ok(CodePointTrie { header: self.header, index: self.index, @@ -795,8 +515,6 @@ impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { /// If the old and new types are the same size, use the more efficient /// [`CodePointTrie::try_into_converted`]. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -1212,7 +930,7 @@ impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { /// assert_eq!(ranges.next(), None); /// assert_eq!(ranges.next(), None); /// ``` - pub fn iter_ranges(&self) -> CodePointMapRangeIterator<'_, T> { + pub fn iter_ranges(&self) -> CodePointMapRangeIterator { let init_range = Some(CodePointMapRange { range: u32::MAX..=u32::MAX, value: self.error_value(), @@ -1289,8 +1007,6 @@ impl<'trie, T: TrieValue> CodePointTrie<'trie, T> { /// Returns a [`CodePointInversionList`] for the code points that have the given /// [`TrieValue`] in the trie. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -1329,7 +1045,7 @@ impl databake::Bake for CodePointTrie<'_, T> { let index = self.index.bake(env); let data = self.data.bake(env); let error_value = self.error_value.bake(env); - databake::quote! { unsafe { icu_collections::codepointtrie::CodePointTrie::from_parts_unstable_unchecked_v1(#header, #index, #data, #error_value) } } + databake::quote! { icu_collections::codepointtrie::CodePointTrie::from_parts(#header, #index, #data, #error_value) } } } @@ -1422,255 +1138,6 @@ impl Iterator for CodePointMapRangeIterator<'_, T> { } } -/// For sealing `TypedCodePointTrie` -/// -/// # Safety Usable Invariant -/// -/// All implementations of `TypedCodePointTrie` are reviewable in this module. -trait Seal {} - -/// Trait for writing trait bounds for monomorphizing over either -/// `FastCodePointTrie` or `SmallCodePointTrie`. -#[allow(private_bounds)] // Permit sealing -pub trait TypedCodePointTrie<'trie, T: TrieValue>: Seal { - /// The `TrieType` associated with this `TypedCodePointTrie` - /// - /// # Safety Usable Invariant - /// - /// This constant matches `self.as_untyped_ref().header.trie_type`. - const TRIE_TYPE: TrieType; - - /// Lookup trie value as `u32` by Unicode Scalar Value without branching on trie type. - #[inline(always)] - fn get32_u32(&self, code_point: u32) -> u32 { - self.get32(code_point).to_u32() - } - - /// Lookup trie value by Basic Multilingual Plane Code Point without branching on trie type. - #[inline(always)] - fn get16(&self, bmp: u16) -> T { - // LLVM's optimizations have been observed not to be 100% - // reliable around collapsing away unnecessary parts of - // `get32`, so not just calling `get32` here. - let code_point = u32::from(bmp); - if let Some(v) = self.get32_by_fast_index(code_point) { - v - } else { - self.as_untyped_ref().get32_by_small_index_cold(code_point) - } - } - - /// Lookup trie value by non-Basic Multilingual Plane Scalar Value without branching on trie type. - #[inline(always)] - fn get32_supplementary(&self, supplementary: u32) -> T { - self.as_untyped_ref().get32_supplementary(supplementary) - } - - /// Lookup trie value by Unicode Scalar Value without branching on trie type. - #[inline(always)] - fn get(&self, c: char) -> T { - // LLVM's optimizations have been observed not to be 100% - // reliable around collapsing away unnecessary parts of - // `get32`, so not just calling `get32` here. - let code_point = u32::from(c); - if let Some(v) = self.get32_by_fast_index(code_point) { - v - } else { - self.as_untyped_ref().get32_by_small_index_cold(code_point) - } - } - - /// Lookup trie value by Unicode Code Point without branching on trie type. - #[inline(always)] - fn get32(&self, code_point: u32) -> T { - if let Some(v) = self.get32_by_fast_index(code_point) { - v - } else if code_point <= CODE_POINT_MAX { - self.as_untyped_ref().get32_by_small_index_cold(code_point) - } else { - self.as_untyped_ref().error_value - } - } - - /// Returns the value that is associated with `code_point` in this [`CodePointTrie`] - /// if `code_point` uses fast-path lookup or `None` if `code_point` - /// should use small-path lookup or is above the supported range. - #[inline(always)] // "always" to make the `Option` collapse away - fn get32_by_fast_index(&self, code_point: u32) -> Option { - debug_assert_eq!(Self::TRIE_TYPE, self.as_untyped_ref().header.trie_type); - let fast_max = match Self::TRIE_TYPE { - TrieType::Fast => FAST_TYPE_FAST_INDEXING_MAX, - TrieType::Small => SMALL_TYPE_FAST_INDEXING_MAX, - }; - if code_point <= fast_max { - // SAFETY: We just checked the invariant of - // `get32_assuming_fast_index`, - // which is - // "If `self.header.trie_type == TrieType::Small`, `code_point` must be at most - // `SMALL_TYPE_FAST_INDEXING_MAX`. If `self.header.trie_type == - // TrieType::Fast`, `code_point` must be at most `FAST_TYPE_FAST_INDEXING_MAX`." - // ... assuming that `Self::TRIE_TYPE` always matches - // `self.as_untyped_ref().header.trie_type`, i.e. we're relying on - // `CodePointTrie::to_typed` and `CodePointTrie::as_typed_ref` being correct - // and the exclusive ways of obtaining `Self`. - Some(unsafe { self.as_untyped_ref().get32_assuming_fast_index(code_point) }) - } else { - // The caller needs to call `get32_by_small_index` or determine - // that the argument is above the permitted range. - None - } - } - - /// Returns a reference to the wrapped `CodePointTrie`. - fn as_untyped_ref(&self) -> &CodePointTrie<'trie, T>; - - /// Extracts the wrapped `CodePointTrie`. - fn to_untyped(self) -> CodePointTrie<'trie, T>; -} - -/// Type-safe wrapper for a fast trie guaranteeing -/// the the getters don't branch on the trie type -/// and for guarenteeing that `get16` is branchless -/// in release builds. -#[derive(Debug)] -#[repr(transparent)] -pub struct FastCodePointTrie<'trie, T: TrieValue> { - inner: CodePointTrie<'trie, T>, -} - -impl<'trie, T: TrieValue> TypedCodePointTrie<'trie, T> for FastCodePointTrie<'trie, T> { - const TRIE_TYPE: TrieType = TrieType::Fast; - - /// Returns a reference to the wrapped `CodePointTrie`. - #[inline(always)] - fn as_untyped_ref(&self) -> &CodePointTrie<'trie, T> { - &self.inner - } - - /// Extracts the wrapped `CodePointTrie`. - #[inline(always)] - fn to_untyped(self) -> CodePointTrie<'trie, T> { - self.inner - } - - /// Lookup trie value by Basic Multilingual Plane Code Point without branching on trie type. - #[inline(always)] - fn get16(&self, bmp: u16) -> T { - debug_assert!(u32::from(u16::MAX) <= FAST_TYPE_FAST_INDEXING_MAX); - debug_assert_eq!(Self::TRIE_TYPE, TrieType::Fast); - debug_assert_eq!(self.as_untyped_ref().header.trie_type, TrieType::Fast); - let code_point = u32::from(bmp); - // SAFETY: With `TrieType::Fast`, the `u16` range satisfies - // the invariant of `get32_assuming_fast_index`, which is - // "If `self.header.trie_type == TrieType::Small`, `code_point` must be at most - // `SMALL_TYPE_FAST_INDEXING_MAX`. If `self.header.trie_type == - // TrieType::Fast`, `code_point` must be at most `FAST_TYPE_FAST_INDEXING_MAX`." - // - // We're relying on `CodePointTrie::to_typed` and `CodePointTrie::as_typed_ref` - // being correct and the exclusive ways of obtaining `Self`. - unsafe { self.as_untyped_ref().get32_assuming_fast_index(code_point) } - } -} - -impl<'trie, T: TrieValue> Seal for FastCodePointTrie<'trie, T> {} - -impl<'trie, T: TrieValue> TryFrom<&'trie CodePointTrie<'trie, T>> - for &'trie FastCodePointTrie<'trie, T> -{ - type Error = TypedCodePointTrieError; - - fn try_from( - reference: &'trie CodePointTrie<'trie, T>, - ) -> Result<&'trie FastCodePointTrie<'trie, T>, TypedCodePointTrieError> { - match reference.as_typed_ref() { - Typed::Fast(trie) => Ok(trie), - Typed::Small(_) => Err(TypedCodePointTrieError), - } - } -} - -impl<'trie, T: TrieValue> TryFrom> for FastCodePointTrie<'trie, T> { - type Error = TypedCodePointTrieError; - - fn try_from( - value: CodePointTrie<'trie, T>, - ) -> Result, TypedCodePointTrieError> { - match value.to_typed() { - Typed::Fast(trie) => Ok(trie), - Typed::Small(_) => Err(TypedCodePointTrieError), - } - } -} - -/// Type-safe wrapper for a small trie guaranteeing -/// the the getters don't branch on the trie type. -#[derive(Debug)] -#[repr(transparent)] -pub struct SmallCodePointTrie<'trie, T: TrieValue> { - inner: CodePointTrie<'trie, T>, -} - -impl<'trie, T: TrieValue> TypedCodePointTrie<'trie, T> for SmallCodePointTrie<'trie, T> { - const TRIE_TYPE: TrieType = TrieType::Small; - - /// Returns a reference to the wrapped `CodePointTrie`. - #[inline(always)] - fn as_untyped_ref(&self) -> &CodePointTrie<'trie, T> { - &self.inner - } - - /// Extracts the wrapped `CodePointTrie`. - #[inline(always)] - fn to_untyped(self) -> CodePointTrie<'trie, T> { - self.inner - } -} - -impl<'trie, T: TrieValue> Seal for SmallCodePointTrie<'trie, T> {} - -impl<'trie, T: TrieValue> TryFrom<&'trie CodePointTrie<'trie, T>> - for &'trie SmallCodePointTrie<'trie, T> -{ - type Error = TypedCodePointTrieError; - - fn try_from( - reference: &'trie CodePointTrie<'trie, T>, - ) -> Result<&'trie SmallCodePointTrie<'trie, T>, TypedCodePointTrieError> { - match reference.as_typed_ref() { - Typed::Fast(_) => Err(TypedCodePointTrieError), - Typed::Small(trie) => Ok(trie), - } - } -} - -impl<'trie, T: TrieValue> TryFrom> for SmallCodePointTrie<'trie, T> { - type Error = TypedCodePointTrieError; - - fn try_from( - value: CodePointTrie<'trie, T>, - ) -> Result, TypedCodePointTrieError> { - match value.to_typed() { - Typed::Fast(_) => Err(TypedCodePointTrieError), - Typed::Small(trie) => Ok(trie), - } - } -} - -/// Error indicating that the `TrieType` of an untyped trie -/// does not match the requested typed trie type. -#[derive(Debug)] -#[non_exhaustive] -pub struct TypedCodePointTrieError; - -/// Holder for either fast or small trie with the trie -/// type encoded into the Rust type. -pub enum Typed { - /// The trie type is fast. - Fast(F), - /// The trie type is small. - Small(S), -} - #[cfg(test)] mod tests { use super::*; @@ -1812,17 +1279,6 @@ mod tests { Ok(()) } - #[test] - fn test_typed() { - let untyped = planes::get_planes_trie(); - assert_eq!(untyped.get('\u{10000}'), 1); - let small_ref = <&SmallCodePointTrie<_>>::try_from(&untyped).unwrap(); - assert_eq!(small_ref.get('\u{10000}'), 1); - let _ = <&FastCodePointTrie<_>>::try_from(&untyped).is_err(); - let small = >::try_from(untyped).unwrap(); - assert_eq!(small.get('\u{10000}'), 1); - } - #[test] fn test_get_range() { let planes_trie = planes::get_planes_trie(); @@ -1865,26 +1321,23 @@ mod tests { } #[test] - #[allow(unused_unsafe)] // `unsafe` below is both necessary and unnecessary fn databake() { databake::test_bake!( CodePointTrie<'static, u32>, const, - unsafe { - crate::codepointtrie::CodePointTrie::from_parts_unstable_unchecked_v1( - crate::codepointtrie::CodePointTrieHeader { - high_start: 1u32, - shifted12_high_start: 2u16, - index3_null_offset: 3u16, - data_null_offset: 4u32, - null_value: 5u32, - trie_type: crate::codepointtrie::TrieType::Small, - }, - zerovec::ZeroVec::new(), - zerovec::ZeroVec::new(), - 0u32, - ) - }, + crate::codepointtrie::CodePointTrie::from_parts( + crate::codepointtrie::CodePointTrieHeader { + high_start: 1u32, + shifted12_high_start: 2u16, + index3_null_offset: 3u16, + data_null_offset: 4u32, + null_value: 5u32, + trie_type: crate::codepointtrie::TrieType::Small, + }, + zerovec::ZeroVec::new(), + zerovec::ZeroVec::new(), + 0u32, + ), icu_collections, [zerovec], ); diff --git a/deps/crates/vendor/icu_collections/src/codepointtrie/error.rs b/deps/crates/vendor/icu_collections/src/codepointtrie/error.rs index 383949d9561142..4cd157fc3f2762 100644 --- a/deps/crates/vendor/icu_collections/src/codepointtrie/error.rs +++ b/deps/crates/vendor/icu_collections/src/codepointtrie/error.rs @@ -19,12 +19,6 @@ pub enum Error { /// [`CodePointTrie`](super::CodePointTrie) must be constructed from data vector with at least one element #[displaydoc("CodePointTrie must be constructed from data vector with at least one element")] EmptyDataVector, - /// [`CodePointTrie`](super::CodePointTrie) must be constructed from index vector long enough to accommodate fast-path access - #[displaydoc("CodePointTrie must be constructed from index vector long enough to accommodate fast-path access")] - IndexTooShortForFastAccess, - /// [`CodePointTrie`](super::CodePointTrie) must be constructed from data vector long enough to accommodate fast-path access - #[displaydoc("CodePointTrie must be constructed from data vector long enough to accommodate fast-path access")] - DataTooShortForFastAccess, } impl core::error::Error for Error {} diff --git a/deps/crates/vendor/icu_collections/src/codepointtrie/mod.rs b/deps/crates/vendor/icu_collections/src/codepointtrie/mod.rs index dfc5a29ffc21a6..970eab4fbfd570 100644 --- a/deps/crates/vendor/icu_collections/src/codepointtrie/mod.rs +++ b/deps/crates/vendor/icu_collections/src/codepointtrie/mod.rs @@ -29,6 +29,8 @@ //! //! [`ICU4X`]: ../icu/index.html +extern crate alloc; + mod cptrie; mod error; mod impl_const; @@ -44,10 +46,6 @@ pub use cptrie::CodePointMapRange; pub use cptrie::CodePointMapRangeIterator; pub use cptrie::CodePointTrie; pub use cptrie::CodePointTrieHeader; -pub use cptrie::FastCodePointTrie; -pub use cptrie::SmallCodePointTrie; pub use cptrie::TrieType; pub use cptrie::TrieValue; -pub use cptrie::Typed; -pub use cptrie::TypedCodePointTrie; pub use error::Error as CodePointTrieError; diff --git a/deps/crates/vendor/icu_collections/src/codepointtrie/planes.rs b/deps/crates/vendor/icu_collections/src/codepointtrie/planes.rs index a806632992fe55..70ab1629d8b731 100644 --- a/deps/crates/vendor/icu_collections/src/codepointtrie/planes.rs +++ b/deps/crates/vendor/icu_collections/src/codepointtrie/planes.rs @@ -172,9 +172,9 @@ pub fn get_planes_trie() -> CodePointTrie<'static, u8> { 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0x10, 0x10, 0x10, 0, ]; - #[expect(clippy::unwrap_used)] // valid bytes + #[allow(clippy::unwrap_used)] // valid bytes let index: ZeroVec = ZeroVec::parse_bytes(index_array_as_bytes).unwrap(); - #[expect(clippy::unwrap_used)] // valid bytes + #[allow(clippy::unwrap_used)] // valid bytes let data: ZeroVec = ZeroVec::parse_bytes(data_8_array).unwrap(); let high_start = 0x100000; let shifted12_high_start = 0x100; @@ -192,7 +192,7 @@ pub fn get_planes_trie() -> CodePointTrie<'static, u8> { trie_type, }; - #[expect(clippy::unwrap_used)] // valid data + #[allow(clippy::unwrap_used)] // valid data CodePointTrie::try_new(trie_header, index, data).unwrap() } diff --git a/deps/crates/vendor/icu_collections/src/codepointtrie/serde.rs b/deps/crates/vendor/icu_collections/src/codepointtrie/serde.rs index adfb2d8aa08e06..74b9e7bb3ed1b6 100644 --- a/deps/crates/vendor/icu_collections/src/codepointtrie/serde.rs +++ b/deps/crates/vendor/icu_collections/src/codepointtrie/serde.rs @@ -39,31 +39,9 @@ where D: Deserializer<'de>, { let de = CodePointTrieSerde::deserialize(deserializer)?; - // SAFETY: - // `validate_fields` upholds the invariants for the fields that - // fast-path access without bound checks relies on. - let error_value = match CodePointTrie::validate_fields(&de.header, &de.index, &de.data) { - Ok(v) => v, - Err(e) => { - match e { - super::CodePointTrieError::FromDeserialized { reason } => { - // Not supposed to be returned by `validate_fields`. - debug_assert!(false); - return Err(D::Error::custom(reason)); - } - super::CodePointTrieError::EmptyDataVector => { - return Err(D::Error::custom("CodePointTrie must be constructed from data vector with at least one element")); - } - super::CodePointTrieError::IndexTooShortForFastAccess => { - return Err(D::Error::custom("CodePointTrie must be constructed from index vector long enough to accommodate fast-path access")); - } - super::CodePointTrieError::DataTooShortForFastAccess => { - return Err(D::Error::custom("CodePointTrie must be constructed from data vector long enough to accommodate fast-path access")); - } - } - } - }; - // Field invariants upheld: Checked by `validate_fields` above. + let error_value = de.data.last().ok_or_else(|| { + D::Error::custom("CodePointTrie vector must have at least one element") + })?; Ok(CodePointTrie { header: de.header, index: de.index, diff --git a/deps/crates/vendor/icu_collections/src/codepointtrie/toml.rs b/deps/crates/vendor/icu_collections/src/codepointtrie/toml.rs index af54098e1f21ad..f8b0f7b4638e1e 100644 --- a/deps/crates/vendor/icu_collections/src/codepointtrie/toml.rs +++ b/deps/crates/vendor/icu_collections/src/codepointtrie/toml.rs @@ -18,6 +18,7 @@ use zerovec::ZeroVec; /// generated by ICU4C. /// /// Use `TryInto` to convert [`CodePointTrieToml`] to a proper [`CodePointTrie`]. +#[allow(clippy::upper_case_acronyms)] #[derive(serde::Deserialize)] pub struct CodePointTrieToml { #[serde(skip)] @@ -71,7 +72,7 @@ impl CodePointTrieToml { } /// Gets the `data` slice. - pub fn data_slice(&self) -> Result, Error> { + pub fn data_slice(&self) -> Result { if let Some(data_8) = &self.data_8 { Ok(CodePointDataSlice::U8(data_8.as_slice())) } else if let Some(data_16) = &self.data_16 { diff --git a/deps/crates/vendor/icu_collections/src/iterator_utils.rs b/deps/crates/vendor/icu_collections/src/iterator_utils.rs index 0701f32ffd748e..701a77eea31da8 100644 --- a/deps/crates/vendor/icu_collections/src/iterator_utils.rs +++ b/deps/crates/vendor/icu_collections/src/iterator_utils.rs @@ -39,7 +39,7 @@ where }; // Keep pulling ranges - #[expect(clippy::while_let_on_iterator)] + #[allow(clippy::while_let_on_iterator)] // can't move the iterator, also we want it to be explicit that we're not draining the iterator while let Some(next) = self.iter.next() { if *next.range.start() == ret.range.end() + 1 && next.value == ret.value { diff --git a/deps/crates/vendor/icu_collections/tests/cpt.rs b/deps/crates/vendor/icu_collections/tests/cpt.rs index f4b04d55963b09..210277cf40f72c 100644 --- a/deps/crates/vendor/icu_collections/tests/cpt.rs +++ b/deps/crates/vendor/icu_collections/tests/cpt.rs @@ -255,7 +255,7 @@ pub fn check_trie>(trie: &CodePointTrie, check_range let range_value = range_tuple[1]; // Check all values in this range, one-by-one while i < range_limit { - assert_eq!(range_value, trie.get32(i).into(), "trie_get({i})",); + assert_eq!(range_value, trie.get32(i).into(), "trie_get({})", i,); i += 1; } } @@ -335,6 +335,7 @@ pub struct EnumPropCodePointMapData { pub ranges: Vec<(u32, u32, u32)>, } +#[allow(clippy::upper_case_acronyms)] #[cfg_attr(any(feature = "serde", test), derive(serde::Deserialize))] pub struct EnumPropSerializedCPT { #[cfg_attr(any(feature = "serde", test), serde(rename = "struct"))] @@ -346,6 +347,7 @@ pub struct EnumPropSerializedCPT { // using similar functions, some of these structs may be useful to refactor // into main code at a later point. +#[allow(clippy::upper_case_acronyms)] #[cfg_attr(any(feature = "serde", test), derive(serde::Deserialize))] pub struct EnumPropSerializedCPTStruct { #[cfg_attr(any(feature = "serde", test), serde(skip))] diff --git a/deps/crates/vendor/icu_locale/.cargo-checksum.json b/deps/crates/vendor/icu_locale/.cargo-checksum.json index 6fb690bcbf0fb7..6a5d8438d2631c 100644 --- a/deps/crates/vendor/icu_locale/.cargo-checksum.json +++ b/deps/crates/vendor/icu_locale/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo_vcs_info.json":"75f8e5fb1d26d5b74f3aa5d09b4aced17b8ab9a9155ecf57bc5f528445916547","Cargo.lock":"b3f2f2eed3b6035323161be0b43ff6f66864420afe482c7f9d1c3689489ef790","Cargo.toml":"2f55d17536899327b3f4b59f44f20c8d932c84bc4c7016270c49992c081273a4","Cargo.toml.orig":"9cf2a1729c32b9736763644d8af2ab09a4971a6f0fc3d932dfb9d7e03b650594","LICENSE":"f367c1b8e1aa262435251e442901da4607b4650e0e63a026f5044473ecfb90f2","README.md":"3eabddc961d47b3205baacf44113fc4aa414d8429ae0b045a6a7e264af980747","benches/fixtures/locales.json":"9846601a29874baf140cac1252d4624fadc30182fec106d17f008ece886b9185","benches/fixtures/uncanonicalized-locales.json":"a866ed318b92f79d8853567e79b373c02984967023f5f39161140544e71b0c72","benches/locale_canonicalizer.rs":"3b6599352c88d2c039d083f91b5b7e222614946c55a77e3ccb1ae0b5fa2ae346","src/canonicalizer.rs":"88255bae6b4f2799ff9d3f644ec6de8dbd558b5a9f6634e5c5390caa7ec758f2","src/directionality.rs":"af2e0421cf36d08232c1cf6b6d7e08824132128559fc69b888974c2ae007e8f5","src/exemplar_chars.rs":"70f37cde5153f27a4f112b908354d584a00daa6047ef9901569ef64f1a1da5f6","src/expander.rs":"f74f35d1b58b3086cd1d992c35238831057c9063c6afc6bc4dd0ef702bf8cf4b","src/fallback/algorithms.rs":"93c0bdc427570dc2899ccdd2f82ad5e3237e5afe6890c3e7a09ef92dcf63661b","src/fallback/mod.rs":"fd51cb417d0918df4c9f02da3095430e236af7dd9ab87df7fa683fdf2e83b011","src/lib.rs":"683b67c0352bab45eb38c0aa249532a16168edac33ec278c9aed60be8aa5df9f","src/provider.rs":"6ff47585fda0d8f60db3c34492890b1bf0fcf8354cfe2b80ebce884bf78f1179","tests/fixtures/canonicalize.json":"3dc2f661b04e4c9ecced70fc1b98a504eb5f5a0067b38665b10e50c25174bc4a","tests/fixtures/maximize.json":"bc38baf34858d6000e617a63bb30d07c439e838aaac493e2d6513cd36b222c3c","tests/fixtures/minimize.json":"efe180ddaf299670a900cf1d676c5f97caa97f7827d10a2e436ce959d637ba7f","tests/fixtures/mod.rs":"98ee70076a3554bb5043ecb1e3643fd47c6bac126724ee207b0633017b8763ed","tests/locale_canonicalizer.rs":"dc00a426018d2c5ffec6077f962ce6da1f458ff2df14ba53f2cc390ab2fc622e"},"package":"532b11722e350ab6bf916ba6eb0efe3ee54b932666afec989465f9243fe6dd60"} \ No newline at end of file +{"files":{"Cargo.toml":"805f67596f172ac7494771909ebf7b32211d9d6b69010798fe0741e78fc0845d","LICENSE":"f367c1b8e1aa262435251e442901da4607b4650e0e63a026f5044473ecfb90f2","README.md":"3eabddc961d47b3205baacf44113fc4aa414d8429ae0b045a6a7e264af980747","benches/fixtures/locales.json":"9846601a29874baf140cac1252d4624fadc30182fec106d17f008ece886b9185","benches/fixtures/uncanonicalized-locales.json":"a866ed318b92f79d8853567e79b373c02984967023f5f39161140544e71b0c72","benches/locale_canonicalizer.rs":"3b6599352c88d2c039d083f91b5b7e222614946c55a77e3ccb1ae0b5fa2ae346","src/canonicalizer.rs":"a1266f265ea51e724496e1d789c9fc8768dd83ea6653a056bcd71b09cee7e774","src/directionality.rs":"af2e0421cf36d08232c1cf6b6d7e08824132128559fc69b888974c2ae007e8f5","src/exemplar_chars.rs":"70f37cde5153f27a4f112b908354d584a00daa6047ef9901569ef64f1a1da5f6","src/expander.rs":"6e865c782717fc3f1a5d16054142aa3cfb443e2ee4ebc1eb432070355f7f1a0e","src/fallback/algorithms.rs":"8141ff08b43b20275b54f97e5a890e52dca3c293d9a8dad42d48ca43c2304b35","src/fallback/mod.rs":"a4d802f9a06440f97784449b28da49ba349b8402f2b96dfebb7611c982b6fcf6","src/lib.rs":"683b67c0352bab45eb38c0aa249532a16168edac33ec278c9aed60be8aa5df9f","src/provider.rs":"6ff47585fda0d8f60db3c34492890b1bf0fcf8354cfe2b80ebce884bf78f1179","tests/fixtures/canonicalize.json":"3dc2f661b04e4c9ecced70fc1b98a504eb5f5a0067b38665b10e50c25174bc4a","tests/fixtures/maximize.json":"bc38baf34858d6000e617a63bb30d07c439e838aaac493e2d6513cd36b222c3c","tests/fixtures/minimize.json":"efe180ddaf299670a900cf1d676c5f97caa97f7827d10a2e436ce959d637ba7f","tests/fixtures/mod.rs":"98ee70076a3554bb5043ecb1e3643fd47c6bac126724ee207b0633017b8763ed","tests/locale_canonicalizer.rs":"db8f560a0a8591aca4bd8713c13e5bf705b08f8ea184efdf64e240218188b767"},"package":"6ae5921528335e91da1b6c695dbf1ec37df5ac13faa3f91e5640be93aa2fbefd"} \ No newline at end of file diff --git a/deps/crates/vendor/icu_locale/.cargo_vcs_info.json b/deps/crates/vendor/icu_locale/.cargo_vcs_info.json deleted file mode 100644 index 82f90aa2fb05c6..00000000000000 --- a/deps/crates/vendor/icu_locale/.cargo_vcs_info.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "git": { - "sha1": "38a49da495248dd1ded84cf306e4ca42e64d5bb3" - }, - "path_in_vcs": "components/locale" -} \ No newline at end of file diff --git a/deps/crates/vendor/icu_locale/Cargo.lock b/deps/crates/vendor/icu_locale/Cargo.lock deleted file mode 100644 index 921a35c9b3426b..00000000000000 --- a/deps/crates/vendor/icu_locale/Cargo.lock +++ /dev/null @@ -1,845 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "anes" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" - -[[package]] -name = "anstyle" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" - -[[package]] -name = "autocfg" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" - -[[package]] -name = "bumpalo" -version = "3.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" - -[[package]] -name = "cast" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" - -[[package]] -name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" - -[[package]] -name = "ciborium" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" -dependencies = [ - "ciborium-io", - "ciborium-ll", - "serde", -] - -[[package]] -name = "ciborium-io" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" - -[[package]] -name = "ciborium-ll" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" -dependencies = [ - "ciborium-io", - "half", -] - -[[package]] -name = "clap" -version = "4.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" -dependencies = [ - "clap_builder", -] - -[[package]] -name = "clap_builder" -version = "4.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" -dependencies = [ - "anstyle", - "clap_lex", -] - -[[package]] -name = "clap_lex" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" - -[[package]] -name = "cobs" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" -dependencies = [ - "thiserror", -] - -[[package]] -name = "criterion" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" -dependencies = [ - "anes", - "cast", - "ciborium", - "clap", - "criterion-plot", - "is-terminal", - "itertools", - "num-traits", - "once_cell", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", -] - -[[package]] -name = "criterion-plot" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" -dependencies = [ - "cast", - "itertools", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" - -[[package]] -name = "databake" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6ee9e2d2afb173bcdeee45934c89ec341ab26f91c9933774fc15c2b58f83ef" -dependencies = [ - "databake-derive", - "proc-macro2", - "quote", -] - -[[package]] -name = "databake-derive" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6834770958c7b84223607e49758ec0dde273c4df915e734aad50f62968a4c134" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "either" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" - -[[package]] -name = "erased-serde" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "259d404d09818dec19332e31d94558aeb442fea04c817006456c24b5460bbd4b" -dependencies = [ - "serde", - "serde_core", - "typeid", -] - -[[package]] -name = "half" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" -dependencies = [ - "cfg-if", - "crunchy", -] - -[[package]] -name = "hermit-abi" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" - -[[package]] -name = "icu_collections" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" -dependencies = [ - "databake", - "displaydoc", - "potential_utf", - "serde", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale" -version = "2.1.1" -dependencies = [ - "criterion", - "databake", - "icu_collections", - "icu_locale_core", - "icu_locale_data", - "icu_provider", - "potential_utf", - "serde", - "serde_json", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" -dependencies = [ - "databake", - "displaydoc", - "litemap", - "serde", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locale_data" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f03e2fcaefecdf05619f3d6f91740e79ab969b4dd54f77cbf546b1d0d28e3147" - -[[package]] -name = "icu_provider" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" -dependencies = [ - "databake", - "displaydoc", - "erased-serde", - "icu_locale_core", - "postcard", - "serde", - "stable_deref_trait", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "is-terminal" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "js-sys" -version = "0.3.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "libc" -version = "0.2.177" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" - -[[package]] -name = "litemap" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" - -[[package]] -name = "log" -version = "0.4.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" - -[[package]] -name = "memchr" -version = "2.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" - -[[package]] -name = "oorandom" -version = "11.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" - -[[package]] -name = "plotters" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" -dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "plotters-backend" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" - -[[package]] -name = "plotters-svg" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" -dependencies = [ - "plotters-backend", -] - -[[package]] -name = "postcard" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" -dependencies = [ - "cobs", - "serde", -] - -[[package]] -name = "potential_utf" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" -dependencies = [ - "serde_core", - "writeable", - "zerovec", -] - -[[package]] -name = "proc-macro2" -version = "1.0.103" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "regex" -version = "1.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" - -[[package]] -name = "rustversion" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" - -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "serde" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_core" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.145" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", - "serde_core", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "syn" -version = "2.0.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thiserror" -version = "2.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tinystr" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" -dependencies = [ - "databake", - "displaydoc", - "serde_core", - "zerovec", -] - -[[package]] -name = "tinytemplate" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "typeid" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" - -[[package]] -name = "unicode-ident" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "web-sys" -version = "0.3.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link", -] - -[[package]] -name = "writeable" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" - -[[package]] -name = "yoke" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerotrie" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" -dependencies = [ - "displaydoc", -] - -[[package]] -name = "zerovec" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" -dependencies = [ - "databake", - "serde", - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] diff --git a/deps/crates/vendor/icu_locale/Cargo.toml b/deps/crates/vendor/icu_locale/Cargo.toml index 270bc9bfc418a9..7c1c38bb74c4f5 100644 --- a/deps/crates/vendor/icu_locale/Cargo.toml +++ b/deps/crates/vendor/icu_locale/Cargo.toml @@ -11,9 +11,9 @@ [package] edition = "2021" -rust-version = "1.83" +rust-version = "1.82" name = "icu_locale" -version = "2.1.1" +version = "2.0.0" authors = ["The ICU4X Project Developers"] build = false include = [ @@ -91,12 +91,16 @@ features = ["derive"] optional = true default-features = false +[dependencies.displaydoc] +version = "0.2.3" +default-features = false + [dependencies.icu_collections] -version = "~2.1.1" +version = "~2.0.0" default-features = false [dependencies.icu_locale_core] -version = "2.1.1" +version = "2.0.0" features = [ "alloc", "zerovec", @@ -104,17 +108,16 @@ features = [ default-features = false [dependencies.icu_locale_data] -version = "~2.1.1" +version = "~2.0.0" optional = true default-features = false [dependencies.icu_provider] -version = "2.1.1" -features = ["alloc"] +version = "2.0.0" default-features = false [dependencies.potential_utf] -version = "0.1.3" +version = "0.1.1" features = [ "alloc", "zerovec", @@ -122,7 +125,7 @@ features = [ default-features = false [dependencies.serde] -version = "1.0.220" +version = "1.0.110" features = [ "derive", "alloc", @@ -139,7 +142,7 @@ features = [ default-features = false [dependencies.zerovec] -version = "0.11.3" +version = "0.11.1" features = [ "alloc", "yoke", @@ -147,7 +150,7 @@ features = [ default-features = false [dev-dependencies.serde] -version = "1.0.220" +version = "1.0.110" features = ["derive"] default-features = false diff --git a/deps/crates/vendor/icu_locale/Cargo.toml.orig b/deps/crates/vendor/icu_locale/Cargo.toml.orig deleted file mode 100644 index 1d96b0151d25e3..00000000000000 --- a/deps/crates/vendor/icu_locale/Cargo.toml.orig +++ /dev/null @@ -1,62 +0,0 @@ -# This file is part of ICU4X. For terms of use, please see the file -# called LICENSE at the top level of the ICU4X source tree -# (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -[package] -name = "icu_locale" -description = "API for Unicode Language and Locale Identifiers canonicalization" - -authors.workspace = true -categories.workspace = true -edition.workspace = true -homepage.workspace = true -include.workspace = true -license.workspace = true -repository.workspace = true -rust-version.workspace = true -version.workspace = true - -[package.metadata.cargo-all-features] -skip_optional_dependencies = true - -[package.metadata.docs.rs] -all-features = true - -[dependencies] -databake = { workspace = true, optional = true, features = ["derive"] } -icu_locale_core = { workspace = true, features = ["alloc", "zerovec"] } -icu_provider = { workspace = true, features = ["alloc"] } -serde = { workspace = true, features = ["derive", "alloc"], optional = true } -tinystr = { workspace = true, features = ["alloc", "zerovec"] } -potential_utf = { workspace = true, features = ["alloc", "zerovec"] } -zerovec = { workspace = true, features = ["alloc", "yoke"] } - -icu_collections = { workspace = true } - -icu_locale_data = { workspace = true, optional = true } - -[dev-dependencies] -serde = { workspace = true, features = ["derive"] } -serde_json = { workspace = true } -icu = { path = "../../components/icu", default-features = false } -writeable = { path = "../../utils/writeable" } - -[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] -criterion = { workspace = true } - -[lib] -bench = false # This option is required for Benchmark CI - -[features] -default = ["compiled_data"] -serde = ["dep:serde", "icu_locale_core/serde", "tinystr/serde", "zerovec/serde", "icu_provider/serde", "potential_utf/serde", "icu_collections/serde"] -datagen = ["serde", "dep:databake", "zerovec/databake", "icu_locale_core/databake", "tinystr/databake", "icu_collections/databake", "icu_provider/export"] -compiled_data = ["dep:icu_locale_data", "icu_provider/baked"] - -[[bench]] -name = "locale_canonicalizer" -harness = false - -[[test]] -name = "locale_canonicalizer" -required-features = ["serde"] diff --git a/deps/crates/vendor/icu_locale/src/canonicalizer.rs b/deps/crates/vendor/icu_locale/src/canonicalizer.rs index ea6a14a3d4374e..c8320cc1d447fe 100644 --- a/deps/crates/vendor/icu_locale/src/canonicalizer.rs +++ b/deps/crates/vendor/icu_locale/src/canonicalizer.rs @@ -450,7 +450,7 @@ impl> LocaleCanonicalizer { if modified.is_empty() { modified = locale.id.variants.to_vec(); } - #[expect(clippy::indexing_slicing)] + #[allow(clippy::indexing_slicing)] let _ = core::mem::replace(&mut modified[idx], updated); } } @@ -589,7 +589,8 @@ mod test { rule.variants.iter().map(Variant::as_str), ), result, - "{source}" + "{}", + source ); } } diff --git a/deps/crates/vendor/icu_locale/src/expander.rs b/deps/crates/vendor/icu_locale/src/expander.rs index f1d6684dd4a6ac..25291a6649013d 100644 --- a/deps/crates/vendor/icu_locale/src/expander.rs +++ b/deps/crates/vendor/icu_locale/src/expander.rs @@ -310,7 +310,7 @@ impl LocaleExpander { }) } - fn as_borrowed(&self) -> LocaleExpanderBorrowed<'_> { + fn as_borrowed(&self) -> LocaleExpanderBorrowed { LocaleExpanderBorrowed { likely_subtags_l: self.likely_subtags_l.get(), likely_subtags_sr: self.likely_subtags_sr.get(), diff --git a/deps/crates/vendor/icu_locale/src/fallback/algorithms.rs b/deps/crates/vendor/icu_locale/src/fallback/algorithms.rs index 7e9e5f0419cf23..58f2352cc6e860 100644 --- a/deps/crates/vendor/icu_locale/src/fallback/algorithms.rs +++ b/deps/crates/vendor/icu_locale/src/fallback/algorithms.rs @@ -204,6 +204,7 @@ impl LocaleFallbackIteratorInner<'_> { locale.variant = self.backup_variant.take(); } // needed if more fallback is added at the end + #[allow(clippy::needless_return)] return; } else { // 3. Remove the language and apply the maximized script @@ -214,6 +215,7 @@ impl LocaleFallbackIteratorInner<'_> { locale.variant = self.backup_variant.take(); } // needed if more fallback is added at the end + #[allow(clippy::needless_return)] return; } } diff --git a/deps/crates/vendor/icu_locale/src/fallback/mod.rs b/deps/crates/vendor/icu_locale/src/fallback/mod.rs index 8f13a620493ab3..d1266831f65401 100644 --- a/deps/crates/vendor/icu_locale/src/fallback/mod.rs +++ b/deps/crates/vendor/icu_locale/src/fallback/mod.rs @@ -104,7 +104,8 @@ impl LocaleFallbacker { /// /// [📚 Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] - #[expect(clippy::new_ret_no_self)] // keeping constructors together + #[allow(clippy::new_ret_no_self)] // keeping constructors together + #[allow(clippy::new_without_default)] // Deliberate choice, see #5554 pub const fn new<'a>() -> LocaleFallbackerBorrowed<'a> { // Safety: we're transmuting down from LocaleFallbackerBorrowed<'static> to LocaleFallbackerBorrowed<'a> // ZeroMaps use associated types in a way that confuse the compiler which gives up and marks them @@ -156,12 +157,12 @@ impl LocaleFallbacker { /// Associates a configuration with this fallbacker. #[inline] - pub fn for_config(&self, config: LocaleFallbackConfig) -> LocaleFallbackerWithConfig<'_> { + pub fn for_config(&self, config: LocaleFallbackConfig) -> LocaleFallbackerWithConfig { self.as_borrowed().for_config(config) } /// Creates a borrowed version of this fallbacker for performance. - pub fn as_borrowed(&self) -> LocaleFallbackerBorrowed<'_> { + pub fn as_borrowed(&self) -> LocaleFallbackerBorrowed { LocaleFallbackerBorrowed { likely_subtags: self.likely_subtags.get(), parents: self.parents.get(), @@ -188,7 +189,7 @@ impl LocaleFallbackerBorrowed<'static> { /// /// [📚 Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] - #[expect(clippy::new_without_default)] + #[allow(clippy::new_without_default)] pub const fn new() -> Self { Self { likely_subtags: crate::provider::Baked::SINGLETON_LOCALE_LIKELY_SUBTAGS_LANGUAGE_V1, diff --git a/deps/crates/vendor/icu_locale/tests/locale_canonicalizer.rs b/deps/crates/vendor/icu_locale/tests/locale_canonicalizer.rs index b5dceed85568dd..aa91070fcf3a89 100644 --- a/deps/crates/vendor/icu_locale/tests/locale_canonicalizer.rs +++ b/deps/crates/vendor/icu_locale/tests/locale_canonicalizer.rs @@ -25,9 +25,9 @@ fn test_maximize() { let result = lc.maximize(&mut locale.id); assert_writeable_eq!(locale, case.output, "{:?}", case); if result == TransformResult::Modified { - assert_ne!(locale, unmodified, "{case:?}"); + assert_ne!(locale, unmodified, "{:?}", case); } else { - assert_eq!(locale, unmodified, "{case:?}"); + assert_eq!(locale, unmodified, "{:?}", case); } } } @@ -49,9 +49,9 @@ fn test_minimize() { let result = lc.minimize(&mut locale.id); assert_writeable_eq!(locale, case.output, "{:?}", case); if result == TransformResult::Modified { - assert_ne!(locale, unmodified, "{case:?}"); + assert_ne!(locale, unmodified, "{:?}", case); } else { - assert_eq!(locale, unmodified, "{case:?}"); + assert_eq!(locale, unmodified, "{:?}", case); } } } @@ -73,9 +73,9 @@ fn test_canonicalize() { let result = lc.canonicalize(&mut locale); assert_writeable_eq!(locale, case.output, "{:?}", case); if result == TransformResult::Modified { - assert_ne!(locale, unmodified, "{case:?}"); + assert_ne!(locale, unmodified, "{:?}", case); } else { - assert_eq!(locale, unmodified, "{case:?}"); + assert_eq!(locale, unmodified, "{:?}", case); } } } diff --git a/deps/crates/vendor/icu_locale_core/.cargo-checksum.json b/deps/crates/vendor/icu_locale_core/.cargo-checksum.json index c60bf2a096b473..93787cc80f4487 100644 --- a/deps/crates/vendor/icu_locale_core/.cargo-checksum.json +++ b/deps/crates/vendor/icu_locale_core/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo_vcs_info.json":"87472294cb1b942324597b25d40baa022967be22454f8c2172de6089d9ff8d32","Cargo.lock":"060041080fd4db117c6f5604ac650c14f88eedbc28b5169a30f3337d40b4313f","Cargo.toml":"4dd1fdf5dcd1517c4f6339872f8589f2074090ede054ba1f38259ad7d6abb7af","Cargo.toml.orig":"1953cfdf680ff8b4f33d2602aee3a0e8c5dc11c8936325953fb254bf2c3b4840","LICENSE":"f367c1b8e1aa262435251e442901da4607b4650e0e63a026f5044473ecfb90f2","README.md":"3e30d773b84c9682a0f03fbfae067edca276b16a2ed0f0ab99c31f6a53aa68b2","benches/fixtures/langid.json":"373c11527653c63c685c9e229a8de5ae2b557c25b686a9d891c59e1f603232d8","benches/fixtures/locale.json":"669b19db933094290a45bf856559920f4e92401072e364ac82c482119dc9233a","benches/fixtures/mod.rs":"d59ae0ebb4d42c5b9a89376bb20d400145eeb8edcd4e93dcd07adfd55f1db8c0","benches/fixtures/subtags.json":"28be3a639e452d713e807d5779b6819e06277e2dbbf67801ef34964fb9b074b6","benches/helpers/macros.rs":"b9bf068a08156f8421ea39ca2a5b83351f9f9b63336b207706b75d1acb7697ac","benches/helpers/mod.rs":"9118aceb41badd98a6d3e07f79bf6328f3da1f93ae82ef99e6ca7e7229aa4c42","benches/iai_langid.rs":"256aa84228af9fd730a90ffc81b2adafaec131b338d786142b770fa45fc221f1","benches/langid.rs":"0203769d2c5ae9d5269344216b93d43c6cb9f58bf4e3b182247afe00f5bb0287","benches/locale.rs":"172d82598b2924515de72c731837d702ce2ff75fdc3655069288c9015ff30c56","benches/subtags.rs":"6ff85047f04896749dff12ed00060afc882ac2ff27f86a57c3afdcbba13f797a","src/data.rs":"29274b5276adeb92d91a2da4a37cc9216e131e1d8f7984d50d6899f5e71e9d20","src/databake.rs":"b0cb3175eb2a919fe9d48d6c85635676a99d2474fc34b2b2ba503fd6d67fec3e","src/extensions/mod.rs":"93c2d618750068e4f724fc3389330115daae93fdff54f13d3c6d81852127a417","src/extensions/other/mod.rs":"7548cca590f16f04db3245e322b0ba3596eff26c129f89bb554fc2c7d3e97c16","src/extensions/private/mod.rs":"0063cd169fa42285c331a8c4d9c3a24a60a79d9217bebb4b105523fde678faba","src/extensions/private/other.rs":"050fba0eeb47b45c539ebda561cabe8f2d6b1cd6ab272bd8d25eb34b33466c96","src/extensions/transform/fields.rs":"06ba3c3baec94b76f8120bdb8e76ceeb5cdab4e9dba6852f10965e8af8e76dd3","src/extensions/transform/key.rs":"7b44e1ccd95f3fcc0892a018effa054cd74d64a3667535eed2270d41baef1393","src/extensions/transform/mod.rs":"1a24f18770f870985501069d760b0ab26a071c4fb32738fb5a81e309eacd16eb","src/extensions/transform/value.rs":"6ee1205b7576d7d49d9d2b983e7bea7e8b92db9f2a70cd940c1f61bf94e14eef","src/extensions/unicode/attribute.rs":"c2a6cfc920532c58023c40a9bd10632a73aedd4670a1562fa7caa15a500018e1","src/extensions/unicode/attributes.rs":"5fe26de18edf670e93aeff51a1d95f29a2117d4f965796126c6c99baf2640683","src/extensions/unicode/key.rs":"ad3c8844b6b55529d70a7d91889bf53703f92994b316d5c9052fe68b5350e530","src/extensions/unicode/keywords.rs":"25028c190011c26ff98c1f41d756b832c5077d47bc3cda16619080c0ea9256f5","src/extensions/unicode/mod.rs":"c3d96faca4cfbb2097ee163adf7d2284f3bdf809a74aa5465f96af9f8a3b2d1d","src/extensions/unicode/subdivision.rs":"ee1c7d0e4b0e4fe3124dafaafef24356f661077201a6a16269b0315374f0bf7a","src/extensions/unicode/value.rs":"d30a4708c7cc0867bd863ad40b49419116786cc39eedd06205088af1b60a10ee","src/helpers.rs":"b157f722e09e3da2bc1920cb964638940207173c5bcfcc271c3086a8a70cfb77","src/langid.rs":"d37dc4aaf8d07bf2dc21a028ea117295f37f46afefe98845e65740692bdf317c","src/lib.rs":"0f38bc043dd3f9ee84c0934f91aa32a739f0b5f839e32869180f94270c284bc6","src/locale.rs":"c595ec154ea306359c92a4b5bc7e6f42fc0b8cbc1bb3a1d145ce9ba36fe63c4e","src/macros.rs":"c2d9fa8a671561d7e9b8082439d56450a1d87039fa5040742a95bd3ab85e9288","src/parser/errors.rs":"9959d6e1f00f89ce739d18d489cf7733865cb95a26e4a33b9651eda2e310d89d","src/parser/langid.rs":"32b4950254793f77d0d5873cba17d6e134b0c3772cbddf559c9e52f4af80d57f","src/parser/locale.rs":"3ba0374f8af82c3751974c4007cd167753153dc3bca9f0cd70d0b0cd17b36fe0","src/parser/mod.rs":"56430a72c3c407f9661e9b6062b7bb13627c508838330482a1a6630de3169d94","src/preferences/extensions/mod.rs":"8055be6df84eac91b2bb96603e022025ff80b8f6594b5a82c2b0fb95f0367043","src/preferences/extensions/unicode/errors.rs":"9f6e2edfaecd1b8679aa011c1d35250be8d0aac9ea5558b1e0fa58f5f9527ead","src/preferences/extensions/unicode/keywords/calendar.rs":"e78abd46c4488776e720e6e4fbef4cf7d2c0e7a5a73a5897b5a0a43c497c0609","src/preferences/extensions/unicode/keywords/collation.rs":"2fbdf8d32967afa80ae35eb33555fb390d96c8690efcfd0d61e30d09f945781c","src/preferences/extensions/unicode/keywords/currency.rs":"92335724649b7ce1f840fe8f0b02f1896a7dab495d36fc45e7858bfa645420bd","src/preferences/extensions/unicode/keywords/currency_format.rs":"69ca7166d19a3d90953bd898e00ad76db89570b7973f251d930d5b5f090ef3ef","src/preferences/extensions/unicode/keywords/dictionary_break.rs":"2489abf09a017c419de5e443ac4bf014476c27c6d31b84a2b55cf6fa53740826","src/preferences/extensions/unicode/keywords/emoji.rs":"0b34acbba058050452d7b4d0b538cd784d5bb76b54cac7b2acd1f946b3ae04c5","src/preferences/extensions/unicode/keywords/first_day.rs":"65e7be67e62b0f5de16508001d2a9d902361eb630df1be5ef4d0ea4f24713e0e","src/preferences/extensions/unicode/keywords/hour_cycle.rs":"01d36e9066b4c6a8db0bf224f0877fa9f4414217484267fff183779b492a11e5","src/preferences/extensions/unicode/keywords/line_break.rs":"0292b4e9c6dadf9759f7371e1a4b6db0b917211026b7dde1983a1726e1d89206","src/preferences/extensions/unicode/keywords/line_break_word.rs":"6fef4aef3dc44541bb1cbeefc0a8cdb9b97f0a26ad9c4f9be057cb4fb3f1c45b","src/preferences/extensions/unicode/keywords/measurement_system.rs":"ddcadb5c654f6dd253ea70a095534978588788979f03796fa128354d349bf909","src/preferences/extensions/unicode/keywords/measurement_unit_override.rs":"ee3a9417050f6b7d6e5c987ece779218e006a19136fea705485bf080c0865dde","src/preferences/extensions/unicode/keywords/mod.rs":"18c6384f19567e7865b48963eb43f34cb53e4eb52dfa9e6592e3af64a4b4b687","src/preferences/extensions/unicode/keywords/numbering_system.rs":"47105a6613fca0f9306f1db3f0ce9b5b29416218144af5596ed392ab552521f1","src/preferences/extensions/unicode/keywords/region_override.rs":"65590219d58dcf466f48f07f94d6fc0ce1433182e5acd8e926ad01f6a7d245be","src/preferences/extensions/unicode/keywords/regional_subdivision.rs":"77866d9824b3b4569b63c4bfeac26f2d2025d1eab3d2ea147961f6773ee270e9","src/preferences/extensions/unicode/keywords/sentence_supression.rs":"8e991966dd9e4a6de441fdd03f8075a70c544741c76e8e076923159a107b6689","src/preferences/extensions/unicode/keywords/timezone.rs":"1d7f7ba02728919d57e793fe1d695e7d47bd5c173d72e518b7e35f0e724c77d9","src/preferences/extensions/unicode/keywords/variant.rs":"8598a4dd392c32ad08db700a3500a218b5c0674444675a4ca84da8be81b2bcb7","src/preferences/extensions/unicode/macros/enum_keyword.rs":"45cd0ace21a363b813a1bbb571a2b22f93839549ba1a96f776dc442b08b2bdd9","src/preferences/extensions/unicode/macros/mod.rs":"fc4212e6a62a402eebbaba29cec5e0f91109d3aa1d962039e50dd633a7ecc70d","src/preferences/extensions/unicode/macros/struct_keyword.rs":"dba324f98c3e108b7add972cbf2a9586486e560350d736a4e7034834177472d6","src/preferences/extensions/unicode/mod.rs":"9ce8a095b63724f124798a0f7e4b7dcc60bd0e7bfb2523d0f9e11883a81f904d","src/preferences/locale.rs":"759466d81773a853d87f2f8288d096a001fa208a2b6752ee767ec63c4f80e605","src/preferences/mod.rs":"e563ebc4594e54da8f60bcd6a3aefc77677163c7b847db67f576a1680da979e9","src/serde.rs":"a1a3439a0cc2e9ff754784d355ac8daf885cc5f3f210460b6781ff6d0ae2e7a3","src/shortvec/litemap.rs":"51af8e84fa010492ec44938eb65fbef23486267bb4d6c6a03154497b38ba35b1","src/shortvec/mod.rs":"e4ff29488b509354d80f8d75f6468cf68eda4a1de1cfaa54e8f1c9f9dc0b9f6a","src/subtags/language.rs":"94757472cfb54f2f583c79ea6ad7c7662240868a2bc04e4b938998e32a8de394","src/subtags/mod.rs":"f998571e80229552aa0aedcae35d0918a9aff261a58e488cfcc6d67d1f696b8d","src/subtags/region.rs":"1157ea7f2defb86233ee86f4522e494d6dfe4776a2b5f853008c75cbbcc312f0","src/subtags/script.rs":"f562cc5607b5acec4ba5fc14dddf5d7eff1d19129535f3a309fd0fb31607b714","src/subtags/variant.rs":"6230b1bb252b0782c9cb015be8f583e8b2d8ab7ffff79789bb6df600e2b0eb5c","src/subtags/variants.rs":"c3af767be128fa4bcab6efd65188f428e3a6b66ac3c69cb3e6489938cbb7094d","src/zerovec.rs":"a63c99e0ef6d38f4b4903b42b1e800aa821c7cbfd817b07d313dcdf4d377823d","tests/fixtures/canonicalize.json":"5414bd4972eb80ba46c727b407a8ed48a6e12e3639db034033586813c872f59c","tests/fixtures/invalid-extensions.json":"36eb5966085a1c9e966689af504cfbf8ea9b78b741675fe033ec9b6153e63ea6","tests/fixtures/invalid.json":"109169258632bd23d06827dfae6509f02a8127ffec25f48281ed61d795c67765","tests/fixtures/langid.json":"960fd01722217ef1ea9077e2e0821d7089fe318a241bd7fb7918f50bf8f3f5c3","tests/fixtures/locale.json":"df1b195b18780758a6b1c0264206b9cd9ac8c4741c5d6b0cc2b92f8e17991c17","tests/fixtures/mod.rs":"448fcf033391285b2f7ed2d73195a80a1342007083708b0786dc7d822df5831c","tests/langid.rs":"d79f33c1f536bec7a0eb1c466842afd61e15098f5039ea6a8085cdf31128199c","tests/locale.rs":"a7ffc4e9d1ebc70e9d915994033b3853285764953c6f0416f07e30520852b17f"},"package":"edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6"} \ No newline at end of file +{"files":{"Cargo.toml":"1410e3b8b7992dc36ace635a935718887ee70908121633151e9ae31fff773e81","LICENSE":"f367c1b8e1aa262435251e442901da4607b4650e0e63a026f5044473ecfb90f2","README.md":"3e30d773b84c9682a0f03fbfae067edca276b16a2ed0f0ab99c31f6a53aa68b2","benches/fixtures/langid.json":"373c11527653c63c685c9e229a8de5ae2b557c25b686a9d891c59e1f603232d8","benches/fixtures/locale.json":"669b19db933094290a45bf856559920f4e92401072e364ac82c482119dc9233a","benches/fixtures/mod.rs":"d59ae0ebb4d42c5b9a89376bb20d400145eeb8edcd4e93dcd07adfd55f1db8c0","benches/fixtures/subtags.json":"28be3a639e452d713e807d5779b6819e06277e2dbbf67801ef34964fb9b074b6","benches/helpers/macros.rs":"b9bf068a08156f8421ea39ca2a5b83351f9f9b63336b207706b75d1acb7697ac","benches/helpers/mod.rs":"9118aceb41badd98a6d3e07f79bf6328f3da1f93ae82ef99e6ca7e7229aa4c42","benches/iai_langid.rs":"256aa84228af9fd730a90ffc81b2adafaec131b338d786142b770fa45fc221f1","benches/langid.rs":"0203769d2c5ae9d5269344216b93d43c6cb9f58bf4e3b182247afe00f5bb0287","benches/locale.rs":"172d82598b2924515de72c731837d702ce2ff75fdc3655069288c9015ff30c56","benches/subtags.rs":"6ff85047f04896749dff12ed00060afc882ac2ff27f86a57c3afdcbba13f797a","src/data.rs":"bb36f7ed75cdabbfc54c7e108057d85583c712aaf1783b713ef71b5008493032","src/databake.rs":"b0cb3175eb2a919fe9d48d6c85635676a99d2474fc34b2b2ba503fd6d67fec3e","src/extensions/mod.rs":"b5982c55e099b4596371c2d7faed4086009c33d9fc6e10b475f5655bde6727fc","src/extensions/other/mod.rs":"5dc66dcde0263c1b9562f8ef90edcd616c49b118a40059458e314d45a672a337","src/extensions/private/mod.rs":"0a5271741722dbe0495713946c19d257e63dde3b4ab80d7c81c51c251557979d","src/extensions/private/other.rs":"050fba0eeb47b45c539ebda561cabe8f2d6b1cd6ab272bd8d25eb34b33466c96","src/extensions/transform/fields.rs":"88b968c260de0e7ee92efd044bb85392846db22acc19be3b9acfbad410ab1e5f","src/extensions/transform/key.rs":"7b44e1ccd95f3fcc0892a018effa054cd74d64a3667535eed2270d41baef1393","src/extensions/transform/mod.rs":"9072ebdb61afb5427d60855289a686dbf8debbee36feecdc034bdbac8593e97c","src/extensions/transform/value.rs":"5aa653c37cd7c2ae0aec9b37f102986095ec904bdac797c374cabad9059bd9a7","src/extensions/unicode/attribute.rs":"c2a6cfc920532c58023c40a9bd10632a73aedd4670a1562fa7caa15a500018e1","src/extensions/unicode/attributes.rs":"c644d7dcf310e4e24376351e45ec88db08c3d86f1c53d3d163ecc08cfcdda212","src/extensions/unicode/key.rs":"ad3c8844b6b55529d70a7d91889bf53703f92994b316d5c9052fe68b5350e530","src/extensions/unicode/keywords.rs":"73f563d887412ff4bc37947c1df9f361df6e34d1e82f2a4c906cf115844d7dd5","src/extensions/unicode/mod.rs":"a51ce421f1375d8c8108d09094951ccd44eb6488100c1ed57dbd2d2432f0da0f","src/extensions/unicode/subdivision.rs":"a1523c051f55833c94995d95920579a2c30cea98cba9e68cd1f90bc21ce2c9ea","src/extensions/unicode/value.rs":"ac158d119ef833a0b457405ffb792cc4eda7edf2e14906cfc1be737d5f69e444","src/helpers.rs":"20a7de315db2c0b48e343e81a9b45dc5548025facfe880ae81e00f59530259fc","src/langid.rs":"21bc904b0098c42817a271398afd2822b2cd5f87936f8cb676e5c91e05197bac","src/lib.rs":"8128cdc5057eed807e057d241f545b59e76b64e106938c4fc87aa558afcc72b6","src/locale.rs":"0ad643efa17d23ca68f6ce7edc4aee60e42486e5ac7448640d61f9488d162740","src/macros.rs":"ed064e4a5bec77706d3022d73e24a6d410b2e7cd395447b6bcb5822c4714bd1c","src/parser/errors.rs":"9959d6e1f00f89ce739d18d489cf7733865cb95a26e4a33b9651eda2e310d89d","src/parser/langid.rs":"f60fb31f7dea4d6090a411da15773135283b6ea8564f4f51be702ce3d40bacf6","src/parser/locale.rs":"81068dfdcc1e765d759df7eb964c8441a3e6e17be881b059be49af2cf802b4d4","src/parser/mod.rs":"7202edc3c6cea056d9172c0a18c1fa84ad2b9a1409809974da93ae9ab80080ae","src/preferences/extensions/mod.rs":"8055be6df84eac91b2bb96603e022025ff80b8f6594b5a82c2b0fb95f0367043","src/preferences/extensions/unicode/errors.rs":"9f6e2edfaecd1b8679aa011c1d35250be8d0aac9ea5558b1e0fa58f5f9527ead","src/preferences/extensions/unicode/keywords/calendar.rs":"472defc4a3574b56496c8d2542ef98584cc1f2f33c3b0903131983158e19f768","src/preferences/extensions/unicode/keywords/collation.rs":"9c60a1156c8e20f4a0fdfa6a544f047ca0710fc116a9e8bdcbaa8d8fdc743f87","src/preferences/extensions/unicode/keywords/currency.rs":"92335724649b7ce1f840fe8f0b02f1896a7dab495d36fc45e7858bfa645420bd","src/preferences/extensions/unicode/keywords/currency_format.rs":"03c94e5dd3253c4cb1c8a4d5a2708be3d77cae9c334985649213440b8bac42c0","src/preferences/extensions/unicode/keywords/dictionary_break.rs":"a13ad0985a98dbf7cea96e2c50db1b6f9513d099a5b15f8bd55edc1e922699cc","src/preferences/extensions/unicode/keywords/emoji.rs":"0c79aa3b90cc228580204807d82809587e00204bc3d09783e4dfc2c302bec984","src/preferences/extensions/unicode/keywords/first_day.rs":"16471ad310624f059f1c280f3aa518f379d746feb892b6a8533631557d5ce690","src/preferences/extensions/unicode/keywords/hour_cycle.rs":"531e959c95a8289c56050e8b5e6ae899277c49b4c8a7f04f99cebf436db25fd6","src/preferences/extensions/unicode/keywords/line_break.rs":"5380f187ea22ea24576c15507a1b1275c947f374c9ec05ac4ba6576ba26122e2","src/preferences/extensions/unicode/keywords/line_break_word.rs":"7aae1d07ffaa6c2a44617b99c8bc1ba19df048cc3ec7aac10ccff89a6d84304b","src/preferences/extensions/unicode/keywords/measurement_system.rs":"b41bb9ce40c310e7370b11f211ca22cb07b08e8c7a8f0aab2dc99a766ff2b22e","src/preferences/extensions/unicode/keywords/measurement_unit_override.rs":"6670167cd9942cfc1c6c1b45d954ae3acc8c69f0609eefe1e33532fb02cdb8fd","src/preferences/extensions/unicode/keywords/mod.rs":"1ca967da8529fe3f7d1943da6e853d753ba2dd94ac5a86f496c80b3ff22b7df7","src/preferences/extensions/unicode/keywords/numbering_system.rs":"47105a6613fca0f9306f1db3f0ce9b5b29416218144af5596ed392ab552521f1","src/preferences/extensions/unicode/keywords/region_override.rs":"65590219d58dcf466f48f07f94d6fc0ce1433182e5acd8e926ad01f6a7d245be","src/preferences/extensions/unicode/keywords/regional_subdivision.rs":"0e54659cfc99c416fc108580c34c4710fbf32b9183422635b6c766d6a47e0d05","src/preferences/extensions/unicode/keywords/sentence_supression.rs":"31942a4bedc3e247bbd73740baf32e3b95bb4c91522dbc55f97c3374eee8669e","src/preferences/extensions/unicode/keywords/timezone.rs":"1d7f7ba02728919d57e793fe1d695e7d47bd5c173d72e518b7e35f0e724c77d9","src/preferences/extensions/unicode/keywords/variant.rs":"3d96c4da532d59965d81761fdf7aa78ec3bbd316bf72ec23e7d19d292850bc76","src/preferences/extensions/unicode/macros/enum_keyword.rs":"70c3185eacd51a1698c14ff98f68a49a788729893f6975b83cf6ccc8aae8d0e0","src/preferences/extensions/unicode/macros/mod.rs":"7a62888e12399959469a39c7f353e7b5d00988302f78b44df5e3b7fd22e442c7","src/preferences/extensions/unicode/macros/struct_keyword.rs":"dba324f98c3e108b7add972cbf2a9586486e560350d736a4e7034834177472d6","src/preferences/extensions/unicode/mod.rs":"9ce8a095b63724f124798a0f7e4b7dcc60bd0e7bfb2523d0f9e11883a81f904d","src/preferences/locale.rs":"67ae458b6c8cbaa9fbec2f602fe3b33f6a82f9b5a3968c0b45a80ee9aae4a812","src/preferences/mod.rs":"36940ac6a6476276fff513fef174bc45eda3487507e14adeab2bc1794f763376","src/serde.rs":"0a9c35d10714376621bf15e1f12d00bf05fc30f20c1e53be17d67bc64c03d63a","src/shortvec/litemap.rs":"e3970c8984ff951d613a951bc372a67ec4410bb49e209979181e8aedb2eaebee","src/shortvec/mod.rs":"be860b8574ca081a14e4dcf63344c259f0e31b2f11c4ddd75c7fb21c81b4e7c3","src/subtags/language.rs":"94757472cfb54f2f583c79ea6ad7c7662240868a2bc04e4b938998e32a8de394","src/subtags/mod.rs":"29e68217c2a47aa70db941467631eee7343bec96d823cf79eb70fcb8975abfd9","src/subtags/region.rs":"1157ea7f2defb86233ee86f4522e494d6dfe4776a2b5f853008c75cbbcc312f0","src/subtags/script.rs":"f562cc5607b5acec4ba5fc14dddf5d7eff1d19129535f3a309fd0fb31607b714","src/subtags/variant.rs":"6230b1bb252b0782c9cb015be8f583e8b2d8ab7ffff79789bb6df600e2b0eb5c","src/subtags/variants.rs":"c8caa29a442f527f657bee41fb2179c3eb01f30fde9bf80198bc54bc273732ed","src/zerovec.rs":"89442aa13615cfd3d92d9079249f8432e33b7739401dda3266b4c2a9d4a5ff7b","tests/fixtures/canonicalize.json":"5414bd4972eb80ba46c727b407a8ed48a6e12e3639db034033586813c872f59c","tests/fixtures/invalid-extensions.json":"36eb5966085a1c9e966689af504cfbf8ea9b78b741675fe033ec9b6153e63ea6","tests/fixtures/invalid.json":"109169258632bd23d06827dfae6509f02a8127ffec25f48281ed61d795c67765","tests/fixtures/langid.json":"960fd01722217ef1ea9077e2e0821d7089fe318a241bd7fb7918f50bf8f3f5c3","tests/fixtures/locale.json":"df1b195b18780758a6b1c0264206b9cd9ac8c4741c5d6b0cc2b92f8e17991c17","tests/fixtures/mod.rs":"12e5815ba46229304aa8234eb537faa568f10576815739beaa3f815134d7e7ac","tests/langid.rs":"d79f33c1f536bec7a0eb1c466842afd61e15098f5039ea6a8085cdf31128199c","tests/locale.rs":"a7ffc4e9d1ebc70e9d915994033b3853285764953c6f0416f07e30520852b17f"},"package":"93cca704c2d63cf8a91f5c2c5f88e027940dede132319b85a52939db9758f7e5"} \ No newline at end of file diff --git a/deps/crates/vendor/icu_locale_core/.cargo_vcs_info.json b/deps/crates/vendor/icu_locale_core/.cargo_vcs_info.json deleted file mode 100644 index c1582af2bc43cc..00000000000000 --- a/deps/crates/vendor/icu_locale_core/.cargo_vcs_info.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "git": { - "sha1": "38a49da495248dd1ded84cf306e4ca42e64d5bb3", - "dirty": true - }, - "path_in_vcs": "components/locale_core" -} \ No newline at end of file diff --git a/deps/crates/vendor/icu_locale_core/Cargo.lock b/deps/crates/vendor/icu_locale_core/Cargo.lock deleted file mode 100644 index 77a22263621536..00000000000000 --- a/deps/crates/vendor/icu_locale_core/Cargo.lock +++ /dev/null @@ -1,165 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "databake" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6ee9e2d2afb173bcdeee45934c89ec341ab26f91c9933774fc15c2b58f83ef" -dependencies = [ - "databake-derive", - "proc-macro2", - "quote", -] - -[[package]] -name = "databake-derive" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6834770958c7b84223607e49758ec0dde273c4df915e734aad50f62968a4c134" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "icu_locale_core" -version = "2.1.1" -dependencies = [ - "databake", - "displaydoc", - "litemap", - "serde", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "litemap" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" - -[[package]] -name = "proc-macro2" -version = "1.0.103" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "serde" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_core" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "syn" -version = "2.0.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tinystr" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" -dependencies = [ - "displaydoc", - "serde_core", - "zerovec", -] - -[[package]] -name = "unicode-ident" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" - -[[package]] -name = "writeable" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" - -[[package]] -name = "zerovec" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" -dependencies = [ - "serde", - "zerofrom", -] diff --git a/deps/crates/vendor/icu_locale_core/Cargo.toml b/deps/crates/vendor/icu_locale_core/Cargo.toml index 99eb6b9dd720ae..924ab0d1863b42 100644 --- a/deps/crates/vendor/icu_locale_core/Cargo.toml +++ b/deps/crates/vendor/icu_locale_core/Cargo.toml @@ -11,9 +11,9 @@ [package] edition = "2021" -rust-version = "1.83" +rust-version = "1.82" name = "icu_locale_core" -version = "2.1.1" +version = "2.0.1" authors = ["The ICU4X Project Developers"] build = false include = [ @@ -43,12 +43,7 @@ repository = "https://github.com/unicode-org/icu4x" all-features = true [features] -alloc = [ - "litemap/alloc", - "tinystr/alloc", - "writeable/alloc", - "serde?/alloc", -] +alloc = [] databake = [ "dep:databake", "alloc", @@ -56,6 +51,7 @@ databake = [ serde = [ "dep:serde", "tinystr/serde", + "alloc", ] zerovec = [ "dep:zerovec", @@ -107,22 +103,57 @@ default-features = false [dependencies.litemap] version = "0.8.0" +features = ["alloc"] default-features = false [dependencies.serde] -version = "1.0.220" +version = "1.0.110" +features = [ + "alloc", + "derive", +] optional = true default-features = false [dependencies.tinystr] version = "0.8.0" +features = ["alloc"] default-features = false [dependencies.writeable] version = "0.6.0" +features = ["alloc"] default-features = false [dependencies.zerovec] -version = "0.11.3" +version = "0.11.1" optional = true default-features = false + +[dev-dependencies.iai] +version = "0.1.1" + +[dev-dependencies.litemap] +version = "0.8.0" +features = ["testing"] +default-features = false + +[dev-dependencies.postcard] +version = "1.0.3" +features = ["use-std"] +default-features = false + +[dev-dependencies.potential_utf] +version = "0.1.1" +default-features = false + +[dev-dependencies.serde] +version = "1.0.110" +features = ["derive"] +default-features = false + +[dev-dependencies.serde_json] +version = "1.0.45" + +[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies.criterion] +version = "0.5.0" diff --git a/deps/crates/vendor/icu_locale_core/Cargo.toml.orig b/deps/crates/vendor/icu_locale_core/Cargo.toml.orig deleted file mode 100644 index 94d03fa7a7354a..00000000000000 --- a/deps/crates/vendor/icu_locale_core/Cargo.toml.orig +++ /dev/null @@ -1,55 +0,0 @@ -# This file is part of ICU4X. For terms of use, please see the file -# called LICENSE at the top level of the ICU4X source tree -# (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). - -[package] -name = "icu_locale_core" -description = "API for managing Unicode Language and Locale Identifiers" - -authors.workspace = true -categories.workspace = true -edition.workspace = true -homepage.workspace = true -include.workspace = true -license.workspace = true -repository.workspace = true -rust-version.workspace = true -version.workspace = true - -[package.metadata.docs.rs] -all-features = true - -[dependencies] -displaydoc = { workspace = true } -litemap = { workspace = true } -tinystr = { workspace = true } -writeable = { workspace = true } - -databake = { workspace = true, features = ["derive"], optional = true } -serde = { workspace = true, optional = true } -zerovec = { workspace = true, optional = true } - -[features] -databake = ["dep:databake", "alloc"] -serde = ["dep:serde", "tinystr/serde"] -zerovec = ["dep:zerovec", "tinystr/zerovec"] -alloc = ["litemap/alloc", "tinystr/alloc", "writeable/alloc", "serde?/alloc"] - -[lib] -bench = false # This option is required for Benchmark CI - -[[bench]] -name = "subtags" -harness = false - -[[bench]] -name = "langid" -harness = false - -[[bench]] -name = "locale" -harness = false - -[[bench]] -name = "iai_langid" -harness = false diff --git a/deps/crates/vendor/icu_locale_core/src/data.rs b/deps/crates/vendor/icu_locale_core/src/data.rs index 5143bf23b1fa25..5bf0e971bb3d7a 100644 --- a/deps/crates/vendor/icu_locale_core/src/data.rs +++ b/deps/crates/vendor/icu_locale_core/src/data.rs @@ -101,7 +101,7 @@ impl fmt::Debug for DataLocale { } } -impl_writeable_for_each_subtag_str_no_test!(DataLocale, selff, selff.script.is_none() && selff.region.is_none() && selff.variant.is_none() && selff.subdivision.is_none() => Some(selff.language.as_str())); +impl_writeable_for_each_subtag_str_no_test!(DataLocale, selff, selff.script.is_none() && selff.region.is_none() && selff.variant.is_none() && selff.subdivision.is_none() => selff.language.write_to_string()); impl From for DataLocale { fn from(langid: LanguageIdentifier) -> Self { @@ -141,7 +141,6 @@ impl From<&Locale> for DataLocale { } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl FromStr for DataLocale { type Err = ParseError; @@ -154,16 +153,12 @@ impl FromStr for DataLocale { impl DataLocale { #[inline] /// Parses a [`DataLocale`]. - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn try_from_str(s: &str) -> Result { Self::try_from_utf8(s.as_bytes()) } /// Parses a [`DataLocale`] from a UTF-8 byte slice. - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn try_from_utf8(code_units: &[u8]) -> Result { let locale = Locale::try_from_utf8(code_units)?; diff --git a/deps/crates/vendor/icu_locale_core/src/extensions/mod.rs b/deps/crates/vendor/icu_locale_core/src/extensions/mod.rs index 134921a3b96134..1893ad7349e02c 100644 --- a/deps/crates/vendor/icu_locale_core/src/extensions/mod.rs +++ b/deps/crates/vendor/icu_locale_core/src/extensions/mod.rs @@ -194,7 +194,7 @@ impl Extensions { && self.other.is_empty() } - #[expect(clippy::type_complexity)] + #[allow(clippy::type_complexity)] pub(crate) fn as_tuple( &self, ) -> ( @@ -231,8 +231,6 @@ impl Extensions { /// Retains the specified extension types, clearing all others. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -254,7 +252,6 @@ impl Extensions { /// }); /// assert_eq!(only_t_z, "und-t-mul-z-zzz".parse().unwrap()); /// ``` - #[cfg(feature = "alloc")] pub fn retain_by_type(&mut self, mut predicate: F) where F: FnMut(ExtensionType) -> bool, @@ -363,6 +360,7 @@ impl Extensions { } } +#[cfg(feature = "alloc")] impl_writeable_for_each_subtag_str_no_test!(Extensions); #[test] diff --git a/deps/crates/vendor/icu_locale_core/src/extensions/other/mod.rs b/deps/crates/vendor/icu_locale_core/src/extensions/other/mod.rs index 8934c4dff76fa7..050b379c6da0d3 100644 --- a/deps/crates/vendor/icu_locale_core/src/extensions/other/mod.rs +++ b/deps/crates/vendor/icu_locale_core/src/extensions/other/mod.rs @@ -64,8 +64,6 @@ pub struct Other { impl Other { /// A constructor which takes a str slice, parses it and /// produces a well-formed [`Other`]. - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[inline] #[cfg(feature = "alloc")] pub fn try_from_str(s: &str) -> Result { @@ -73,8 +71,6 @@ impl Other { } /// See [`Self::try_from_str`] - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn try_from_utf8(code_units: &[u8]) -> Result { let mut iter = SubtagIterator::new(code_units); @@ -89,8 +85,6 @@ impl Other { /// A constructor which takes a pre-sorted list of [`Subtag`]. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Panics /// /// Panics if `ext` is not ASCII alphabetic. @@ -206,7 +200,6 @@ impl Other { } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl FromStr for Other { type Err = ParseError; @@ -217,7 +210,7 @@ impl FromStr for Other { } } -writeable::impl_display_with_writeable!(Other, #[cfg(feature = "alloc")]); +writeable::impl_display_with_writeable!(Other); impl writeable::Writeable for Other { fn write_to(&self, sink: &mut W) -> core::fmt::Result { @@ -243,6 +236,17 @@ impl writeable::Writeable for Other { } result } + + #[cfg(feature = "alloc")] + fn write_to_string(&self) -> alloc::borrow::Cow { + if self.keys.is_empty() { + return alloc::borrow::Cow::Borrowed(""); + } + let mut string = + alloc::string::String::with_capacity(self.writeable_length_hint().capacity()); + let _ = self.write_to(&mut string); + alloc::borrow::Cow::Owned(string) + } } #[cfg(test)] diff --git a/deps/crates/vendor/icu_locale_core/src/extensions/private/mod.rs b/deps/crates/vendor/icu_locale_core/src/extensions/private/mod.rs index 458259c26e15fa..ee9852921af51d 100644 --- a/deps/crates/vendor/icu_locale_core/src/extensions/private/mod.rs +++ b/deps/crates/vendor/icu_locale_core/src/extensions/private/mod.rs @@ -89,8 +89,6 @@ impl Private { /// A constructor which takes a str slice, parses it and /// produces a well-formed [`Private`]. - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[inline] #[cfg(feature = "alloc")] pub fn try_from_str(s: &str) -> Result { @@ -98,8 +96,6 @@ impl Private { } /// See [`Self::try_from_str`] - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn try_from_utf8(code_units: &[u8]) -> Result { let mut iter = SubtagIterator::new(code_units); @@ -114,8 +110,6 @@ impl Private { /// A constructor which takes a pre-sorted list of [`Subtag`]. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -196,7 +190,6 @@ impl Private { } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl FromStr for Private { type Err = ParseError; @@ -207,7 +200,7 @@ impl FromStr for Private { } } -writeable::impl_display_with_writeable!(Private, #[cfg(feature = "alloc")]); +writeable::impl_display_with_writeable!(Private); impl writeable::Writeable for Private { fn write_to(&self, sink: &mut W) -> core::fmt::Result { diff --git a/deps/crates/vendor/icu_locale_core/src/extensions/transform/fields.rs b/deps/crates/vendor/icu_locale_core/src/extensions/transform/fields.rs index d7a027d9210093..d5d9cf72484124 100644 --- a/deps/crates/vendor/icu_locale_core/src/extensions/transform/fields.rs +++ b/deps/crates/vendor/icu_locale_core/src/extensions/transform/fields.rs @@ -3,6 +3,7 @@ // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). use core::borrow::Borrow; +use core::iter::FromIterator; use litemap::LiteMap; use super::Key; @@ -31,12 +32,7 @@ use super::Value; /// assert_eq!(&fields.to_string(), "h0-hybrid"); /// ``` #[derive(Clone, PartialEq, Eq, Debug, Default, Hash, PartialOrd, Ord)] -pub struct Fields(Inner); - -#[cfg(feature = "alloc")] -type Inner = LiteMap; -#[cfg(not(feature = "alloc"))] -type Inner = LiteMap; +pub struct Fields(LiteMap); impl Fields { /// Returns a new empty list of key-value pairs. Same as [`default()`](Default::default()), but is `const`. @@ -141,8 +137,6 @@ impl Fields { /// Sets the specified keyword, returning the old value if it already existed. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -160,15 +154,12 @@ impl Fields { /// assert_eq!(old_value, Some(casefold)); /// assert_eq!(loc, "en-t-hi-d0-lower".parse().unwrap()); /// ``` - #[cfg(feature = "alloc")] pub fn set(&mut self, key: Key, value: Value) -> Option { self.0.insert(key, value) } /// Retains a subset of fields as specified by the predicate function. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -189,7 +180,6 @@ impl Fields { /// .retain_by_key(|&k| k == key!("d0")); /// assert_eq!(loc, Locale::UNKNOWN); /// ``` - #[cfg(feature = "alloc")] pub fn retain_by_key(&mut self, mut predicate: F) where F: FnMut(&Key) -> bool, @@ -215,17 +205,13 @@ impl Fields { } } -/// ✨ *Enabled with the `alloc` Cargo feature.* -#[cfg(feature = "alloc")] impl From> for Fields { fn from(map: LiteMap) -> Self { Self(map) } } -/// ✨ *Enabled with the `alloc` Cargo feature.* -#[cfg(feature = "alloc")] -impl core::iter::FromIterator<(Key, Value)> for Fields { +impl FromIterator<(Key, Value)> for Fields { fn from_iter>(iter: I) -> Self { LiteMap::from_iter(iter).into() } diff --git a/deps/crates/vendor/icu_locale_core/src/extensions/transform/mod.rs b/deps/crates/vendor/icu_locale_core/src/extensions/transform/mod.rs index 712009954f127f..8f3094f1bf2145 100644 --- a/deps/crates/vendor/icu_locale_core/src/extensions/transform/mod.rs +++ b/deps/crates/vendor/icu_locale_core/src/extensions/transform/mod.rs @@ -117,8 +117,6 @@ impl Transform { /// A constructor which takes a str slice, parses it and /// produces a well-formed [`Transform`]. - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[inline] #[cfg(feature = "alloc")] pub fn try_from_str(s: &str) -> Result { @@ -126,8 +124,6 @@ impl Transform { } /// See [`Self::try_from_str`] - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn try_from_utf8(code_units: &[u8]) -> Result { let mut iter = SubtagIterator::new(code_units); @@ -171,7 +167,7 @@ impl Transform { self.fields.clear(); } - #[expect(clippy::type_complexity)] + #[allow(clippy::type_complexity)] pub(crate) fn as_tuple( &self, ) -> ( @@ -274,7 +270,6 @@ impl Transform { } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl FromStr for Transform { type Err = ParseError; @@ -285,7 +280,7 @@ impl FromStr for Transform { } } -writeable::impl_display_with_writeable!(Transform, #[cfg(feature = "alloc")]); +writeable::impl_display_with_writeable!(Transform); impl writeable::Writeable for Transform { fn write_to(&self, sink: &mut W) -> core::fmt::Result { diff --git a/deps/crates/vendor/icu_locale_core/src/extensions/transform/value.rs b/deps/crates/vendor/icu_locale_core/src/extensions/transform/value.rs index 2d59476ec37ed5..3a54f739dd1b92 100644 --- a/deps/crates/vendor/icu_locale_core/src/extensions/transform/value.rs +++ b/deps/crates/vendor/icu_locale_core/src/extensions/transform/value.rs @@ -40,8 +40,6 @@ impl Value { /// A constructor which takes a str slice, parses it and /// produces a well-formed [`Value`]. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -56,8 +54,6 @@ impl Value { } /// See [`Self::try_from_str`] - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn try_from_utf8(code_units: &[u8]) -> Result { let mut v = ShortBoxSlice::default(); @@ -119,7 +115,6 @@ impl Value { } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl FromStr for Value { type Err = ParseError; @@ -130,7 +125,7 @@ impl FromStr for Value { } } -impl_writeable_for_each_subtag_str_no_test!(Value, selff, selff.0.is_empty() => Some("true")); +impl_writeable_for_each_subtag_str_no_test!(Value, selff, selff.0.is_empty() => alloc::borrow::Cow::Borrowed("true")); #[test] fn test_writeable() { diff --git a/deps/crates/vendor/icu_locale_core/src/extensions/unicode/attributes.rs b/deps/crates/vendor/icu_locale_core/src/extensions/unicode/attributes.rs index fe0b1ef14c8522..7ca0fecfcfc212 100644 --- a/deps/crates/vendor/icu_locale_core/src/extensions/unicode/attributes.rs +++ b/deps/crates/vendor/icu_locale_core/src/extensions/unicode/attributes.rs @@ -57,8 +57,6 @@ impl Attributes { /// A constructor which takes a str slice, parses it and /// produces a well-formed [`Attributes`]. - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[inline] #[cfg(feature = "alloc")] pub fn try_from_str(s: &str) -> Result { @@ -66,8 +64,6 @@ impl Attributes { } /// See [`Self::try_from_str`] - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn try_from_utf8(code_units: &[u8]) -> Result { let mut iter = SubtagIterator::new(code_units); @@ -76,7 +72,6 @@ impl Attributes { /// A constructor which takes a pre-sorted list of [`Attribute`] elements. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* /// /// # Examples /// @@ -148,32 +143,8 @@ impl Attributes { { self.deref().iter().map(|t| t.as_str()).try_for_each(f) } - - /// Extends the `Attributes` with values from another `Attributes`. - /// - /// # Example - /// - /// ``` - /// use icu::locale::extensions::unicode::Attributes; - /// - /// let mut attrs: Attributes = "foobar-foobaz".parse().unwrap(); - /// let attrs2: Attributes = "foobar-fooqux".parse().unwrap(); - /// - /// attrs.extend_from_attributes(attrs2); - /// - /// assert_eq!(attrs, "foobar-foobaz-fooqux".parse().unwrap()); - /// ``` - #[cfg(feature = "alloc")] - pub fn extend_from_attributes(&mut self, other: Attributes) { - for attr in other.0 { - if let Err(idx) = self.binary_search(&attr) { - self.0.insert(idx, attr); - } - } - } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl FromStr for Attributes { type Err = ParseError; diff --git a/deps/crates/vendor/icu_locale_core/src/extensions/unicode/keywords.rs b/deps/crates/vendor/icu_locale_core/src/extensions/unicode/keywords.rs index c7287fc66c7979..726b5490efc52b 100644 --- a/deps/crates/vendor/icu_locale_core/src/extensions/unicode/keywords.rs +++ b/deps/crates/vendor/icu_locale_core/src/extensions/unicode/keywords.rs @@ -96,8 +96,6 @@ impl Keywords { /// A constructor which takes a str slice, parses it and /// produces a well-formed [`Keywords`]. - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[inline] #[cfg(feature = "alloc")] pub fn try_from_str(s: &str) -> Result { @@ -105,8 +103,6 @@ impl Keywords { } /// See [`Self::try_from_str`] - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn try_from_utf8(code_units: &[u8]) -> Result { let mut iter = SubtagIterator::new(code_units); @@ -179,8 +175,6 @@ impl Keywords { /// /// Returns `None` if the key doesn't exist or if the key has no value. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -206,8 +200,6 @@ impl Keywords { /// Sets the specified keyword, returning the old value if it already existed. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -233,8 +225,6 @@ impl Keywords { /// Removes the specified keyword, returning the old value if it existed. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -271,8 +261,6 @@ impl Keywords { /// Retains a subset of keywords as specified by the predicate function. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -386,27 +374,6 @@ impl Keywords { Ok(()) } - /// Extends the `Keywords` with values from another `Keywords`. - /// - /// # Example - /// - /// ``` - /// use icu::locale::extensions::unicode::Keywords; - /// - /// let mut kw: Keywords = "ab-cd-ca-buddhist".parse().unwrap(); - /// let kw2: Keywords = "ca-gregory-hc-h12".parse().unwrap(); - /// - /// kw.extend_from_keywords(kw2); - /// - /// assert_eq!(kw, "ab-cd-ca-gregory-hc-h12".parse().unwrap()); - /// ``` - #[cfg(feature = "alloc")] - pub fn extend_from_keywords(&mut self, other: Keywords) { - for (key, value) in other.0 { - self.0.insert(key, value); - } - } - /// This needs to be its own method to help with type inference in helpers.rs #[cfg(test)] pub(crate) fn from_tuple_vec(v: Vec<(Key, Value)>) -> Self { @@ -420,7 +387,6 @@ impl From>> for Keywords { } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl FromIterator<(Key, Value)> for Keywords { fn from_iter>(iter: I) -> Self { @@ -428,7 +394,6 @@ impl FromIterator<(Key, Value)> for Keywords { } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl FromStr for Keywords { type Err = ParseError; diff --git a/deps/crates/vendor/icu_locale_core/src/extensions/unicode/mod.rs b/deps/crates/vendor/icu_locale_core/src/extensions/unicode/mod.rs index 1a2d984312f787..f51593548ba3b5 100644 --- a/deps/crates/vendor/icu_locale_core/src/extensions/unicode/mod.rs +++ b/deps/crates/vendor/icu_locale_core/src/extensions/unicode/mod.rs @@ -115,8 +115,6 @@ impl Unicode { /// A constructor which takes a str slice, parses it and /// produces a well-formed [`Unicode`]. - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[inline] #[cfg(feature = "alloc")] pub fn try_from_str(s: &str) -> Result { @@ -124,8 +122,6 @@ impl Unicode { } /// See [`Self::try_from_str`] - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn try_from_utf8(code_units: &[u8]) -> Result { let mut iter = SubtagIterator::new(code_units); @@ -214,29 +210,8 @@ impl Unicode { } Ok(()) } - - /// Extends the `Unicode` with values from another `Unicode`. - /// - /// # Example - /// - /// ``` - /// use icu::locale::extensions::unicode::Unicode; - /// - /// let mut ue: Unicode = "u-foobar-ca-buddhist".parse().unwrap(); - /// let ue2: Unicode = "u-ca-gregory-hc-h12".parse().unwrap(); - /// - /// ue.extend(ue2); - /// - /// assert_eq!(ue, "u-foobar-ca-gregory-hc-h12".parse().unwrap()); - /// ``` - #[cfg(feature = "alloc")] - pub fn extend(&mut self, other: Unicode) { - self.keywords.extend_from_keywords(other.keywords); - self.attributes.extend_from_attributes(other.attributes); - } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl FromStr for Unicode { type Err = ParseError; @@ -247,7 +222,7 @@ impl FromStr for Unicode { } } -writeable::impl_display_with_writeable!(Unicode, #[cfg(feature = "alloc")]); +writeable::impl_display_with_writeable!(Unicode); impl writeable::Writeable for Unicode { fn write_to(&self, sink: &mut W) -> core::fmt::Result { diff --git a/deps/crates/vendor/icu_locale_core/src/extensions/unicode/subdivision.rs b/deps/crates/vendor/icu_locale_core/src/extensions/unicode/subdivision.rs index 26e0436e3b0795..5855fed7fc09d4 100644 --- a/deps/crates/vendor/icu_locale_core/src/extensions/unicode/subdivision.rs +++ b/deps/crates/vendor/icu_locale_core/src/extensions/unicode/subdivision.rs @@ -151,7 +151,7 @@ impl writeable::Writeable for SubdivisionId { } } -writeable::impl_display_with_writeable!(SubdivisionId, #[cfg(feature = "alloc")]); +writeable::impl_display_with_writeable!(SubdivisionId); impl FromStr for SubdivisionId { type Err = ParseError; @@ -175,7 +175,7 @@ mod tests { for sample in ["", "gb", "o"] { let oe: Result = sample.parse(); - assert!(oe.is_err(), "Should fail: {sample}"); + assert!(oe.is_err(), "Should fail: {}", sample); } } } diff --git a/deps/crates/vendor/icu_locale_core/src/extensions/unicode/value.rs b/deps/crates/vendor/icu_locale_core/src/extensions/unicode/value.rs index 41beb43915bea3..c2f3381078da5a 100644 --- a/deps/crates/vendor/icu_locale_core/src/extensions/unicode/value.rs +++ b/deps/crates/vendor/icu_locale_core/src/extensions/unicode/value.rs @@ -3,6 +3,7 @@ // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). use crate::parser::ParseError; +#[cfg(feature = "alloc")] use crate::parser::SubtagIterator; use crate::shortvec::{ShortBoxSlice, ShortBoxSliceIntoIter}; use crate::subtags::{subtag, Subtag}; @@ -50,18 +51,14 @@ impl Value { /// /// Value::try_from_str("buddhist").expect("Parsing failed."); /// ``` - /// - /// # `alloc` Cargo feature - /// - /// Without the `alloc` Cargo feature, this only supports parsing - /// up to two (non-`true`) subtags, and will return an error for - /// longer strings. #[inline] + #[cfg(feature = "alloc")] pub fn try_from_str(s: &str) -> Result { Self::try_from_utf8(s.as_bytes()) } /// See [`Self::try_from_str`] + #[cfg(feature = "alloc")] pub fn try_from_utf8(code_units: &[u8]) -> Result { let mut v = ShortBoxSlice::new(); @@ -69,16 +66,7 @@ impl Value { for chunk in SubtagIterator::new(code_units) { let subtag = Subtag::try_from_utf8(chunk)?; if subtag != TRUE_VALUE { - #[cfg(feature = "alloc")] v.push(subtag); - #[cfg(not(feature = "alloc"))] - if v.is_empty() { - v = ShortBoxSlice::new_single(subtag); - } else if let &[prev] = &*v { - v = ShortBoxSlice::new_double(prev, subtag); - } else { - return Err(ParseError::InvalidSubtag); - } } } } @@ -130,8 +118,6 @@ impl Value { /// Appends a subtag to the back of a [`Value`]. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -184,7 +170,7 @@ impl Value { /// use icu::locale::{extensions::unicode::Value, subtags::subtag}; /// /// let mut v = Value::default(); - /// assert!(v.is_empty()); + /// assert_eq!(v.is_empty(), true); /// ``` pub fn is_empty(&self) -> bool { self.0.is_empty() @@ -240,14 +226,8 @@ impl Value { } } - #[doc(hidden)] - pub fn from_two_subtags(f: Subtag, s: Subtag) -> Self { - Self(ShortBoxSlice::new_double(f, s)) - } - /// A constructor which takes a pre-sorted list of [`Value`] elements. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* /// /// # Examples /// @@ -303,7 +283,6 @@ impl IntoIterator for Value { } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl FromIterator for Value { fn from_iter>(iter: T) -> Self { @@ -311,7 +290,6 @@ impl FromIterator for Value { } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl Extend for Value { fn extend>(&mut self, iter: T) { @@ -321,7 +299,6 @@ impl Extend for Value { } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl FromStr for Value { type Err = ParseError; diff --git a/deps/crates/vendor/icu_locale_core/src/helpers.rs b/deps/crates/vendor/icu_locale_core/src/helpers.rs index c4ad9c78620c33..48522f4bb1277a 100644 --- a/deps/crates/vendor/icu_locale_core/src/helpers.rs +++ b/deps/crates/vendor/icu_locale_core/src/helpers.rs @@ -19,6 +19,7 @@ macro_rules! impl_tinystr_subtag { [$bad_example:literal $(, $more_bad_examples:literal)*], ) => { #[derive(Debug, PartialEq, Eq, Clone, Hash, PartialOrd, Ord, Copy)] + #[cfg_attr(feature = "serde", derive(serde::Serialize))] #[repr(transparent)] $(#[$doc])* pub struct $name(tinystr::TinyAsciiStr<$len_end>); @@ -44,6 +45,7 @@ macro_rules! impl_tinystr_subtag { pub const fn try_from_utf8( code_units: &[u8], ) -> Result { + #[allow(clippy::double_comparisons)] // if code_units.len() === 0 if code_units.len() < $len_start || code_units.len() > $len_end { return Err(crate::parser::errors::ParseError::$error); } @@ -155,12 +157,14 @@ macro_rules! impl_tinystr_subtag { fn writeable_length_hint(&self) -> writeable::LengthHint { writeable::LengthHint::exact(self.0.len()) } - fn writeable_borrow(&self) -> Option<&str> { - Some(self.0.as_str()) + #[inline] + #[cfg(feature = "alloc")] + fn write_to_string(&self) -> alloc::borrow::Cow { + alloc::borrow::Cow::Borrowed(self.0.as_str()) } } - writeable::impl_display_with_writeable!($name, #[cfg(feature = "alloc")]); + writeable::impl_display_with_writeable!($name); #[doc = concat!("A macro allowing for compile-time construction of valid [`", stringify!($name), "`] subtags.")] /// @@ -187,6 +191,7 @@ macro_rules! impl_tinystr_subtag { use $crate::$($path ::)+ $name; match $name::try_from_utf8($string.as_bytes()) { Ok(r) => r, + #[allow(clippy::panic)] // const context _ => panic!(concat!("Invalid ", $(stringify!($path), "::",)+ stringify!($name), ": ", $string)), } }}; @@ -236,16 +241,6 @@ macro_rules! impl_tinystr_subtag { )* } - #[cfg(feature = "serde")] - impl serde::Serialize for $name { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - self.0.serialize(serializer) - } - } - #[cfg(feature = "serde")] impl<'de> serde::Deserialize<'de> for $name { fn deserialize(deserializer: D) -> Result @@ -322,7 +317,6 @@ macro_rules! impl_tinystr_subtag { } #[cfg(feature = "zerovec")] - #[cfg(feature = "alloc")] impl<'a> zerovec::maps::ZeroMapKV<'a> for $name { type Container = zerovec::ZeroVec<'a, $name>; type Slice = zerovec::ZeroSlice<$name>; @@ -367,24 +361,28 @@ macro_rules! impl_writeable_for_each_subtag_str_no_test { } $( - fn writeable_borrow(&self) -> Option<&str> { + #[cfg(feature = "alloc")] + fn write_to_string(&self) -> alloc::borrow::Cow { + #[allow(clippy::unwrap_used)] // impl_writeable_for_subtag_list's $borrow uses unwrap let $self = self; if $borrow_cond { $borrow } else { - None + let mut output = alloc::string::String::with_capacity(self.writeable_length_hint().capacity()); + let _ = self.write_to(&mut output); + alloc::borrow::Cow::Owned(output) } } )? } - writeable::impl_display_with_writeable!($type, #[cfg(feature = "alloc")]); + writeable::impl_display_with_writeable!($type); }; } macro_rules! impl_writeable_for_subtag_list { ($type:tt, $sample1:literal, $sample2:literal) => { - impl_writeable_for_each_subtag_str_no_test!($type, selff, selff.0.len() == 1 => #[allow(clippy::unwrap_used)] { Some(selff.0.get(0).unwrap().as_str()) } ); + impl_writeable_for_each_subtag_str_no_test!($type, selff, selff.0.len() == 1 => alloc::borrow::Cow::Borrowed(selff.0.get(0).unwrap().as_str())); #[test] fn test_writeable() { diff --git a/deps/crates/vendor/icu_locale_core/src/langid.rs b/deps/crates/vendor/icu_locale_core/src/langid.rs index 0f8001c0126bb7..82ef5e0d44bb7f 100644 --- a/deps/crates/vendor/icu_locale_core/src/langid.rs +++ b/deps/crates/vendor/icu_locale_core/src/langid.rs @@ -40,14 +40,6 @@ use alloc::borrow::Cow; /// This operation normalizes syntax to be well-formed. No legacy subtag replacements is performed. /// For validation and canonicalization, see `LocaleCanonicalizer`. /// -/// # Serde -/// -/// This type implements `serde::Serialize` and `serde::Deserialize` if the -/// `"serde"` Cargo feature is enabled on the crate. -/// -/// The value will be serialized as a string and parsed when deserialized. -/// For tips on efficient storage and retrieval of locales, see [`crate::zerovec`]. -/// /// # Examples /// /// Simple example: @@ -79,7 +71,7 @@ use alloc::borrow::Cow; /// assert_eq!(li.language, language!("en")); /// assert_eq!(li.script, Some(script!("Latn"))); /// assert_eq!(li.region, Some(region!("US"))); -/// assert_eq!(li.variants.first(), Some(&variant!("valencia"))); +/// assert_eq!(li.variants.get(0), Some(&variant!("valencia"))); /// ``` /// /// [`Unicode BCP47 Language Identifier`]: https://unicode.org/reports/tr35/tr35.html#Unicode_language_identifier @@ -103,8 +95,6 @@ impl LanguageIdentifier { /// A constructor which takes a utf8 slice, parses it and /// produces a well-formed [`LanguageIdentifier`]. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -119,15 +109,13 @@ impl LanguageIdentifier { } /// See [`Self::try_from_str`] - /// - /// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] pub fn try_from_utf8(code_units: &[u8]) -> Result { crate::parser::parse_language_identifier(code_units, parser::ParserMode::LanguageIdentifier) } #[doc(hidden)] // macro use - #[expect(clippy::type_complexity)] + #[allow(clippy::type_complexity)] // The return type should be `Result` once the `const_precise_live_drops` // is stabilized ([rust-lang#73255](https://github.com/rust-lang/rust/issues/73255)). pub const fn try_from_utf8_with_single_variant( @@ -150,8 +138,6 @@ impl LanguageIdentifier { /// A constructor which takes a utf8 slice which may contain extension keys, /// parses it and produces a well-formed [`LanguageIdentifier`]. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -182,8 +168,6 @@ impl LanguageIdentifier { /// /// This operation will normalize casing and the separator. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -195,7 +179,7 @@ impl LanguageIdentifier { /// ); /// ``` #[cfg(feature = "alloc")] - pub fn normalize_utf8(input: &[u8]) -> Result, ParseError> { + pub fn normalize_utf8(input: &[u8]) -> Result, ParseError> { let lang_id = Self::try_from_utf8(input)?; Ok(writeable::to_string_or_borrow(&lang_id, input)) } @@ -204,8 +188,6 @@ impl LanguageIdentifier { /// /// This operation will normalize casing and the separator. /// - /// ✨ *Enabled with the `alloc` Cargo feature.* - /// /// # Examples /// /// ``` @@ -217,7 +199,7 @@ impl LanguageIdentifier { /// ); /// ``` #[cfg(feature = "alloc")] - pub fn normalize(input: &str) -> Result, ParseError> { + pub fn normalize(input: &str) -> Result, ParseError> { Self::normalize_utf8(input.as_bytes()) } @@ -513,7 +495,6 @@ impl core::fmt::Debug for LanguageIdentifier { } } -/// ✨ *Enabled with the `alloc` Cargo feature.* #[cfg(feature = "alloc")] impl FromStr for LanguageIdentifier { type Err = ParseError; @@ -524,7 +505,7 @@ impl FromStr for LanguageIdentifier { } } -impl_writeable_for_each_subtag_str_no_test!(LanguageIdentifier, selff, selff.script.is_none() && selff.region.is_none() && selff.variants.is_empty() => Some(selff.language.as_str())); +impl_writeable_for_each_subtag_str_no_test!(LanguageIdentifier, selff, selff.script.is_none() && selff.region.is_none() && selff.variants.is_empty() => selff.language.write_to_string()); #[test] fn test_writeable() { diff --git a/deps/crates/vendor/icu_locale_core/src/lib.rs b/deps/crates/vendor/icu_locale_core/src/lib.rs index b465710e9525f4..8e8a130411c1a5 100644 --- a/deps/crates/vendor/icu_locale_core/src/lib.rs +++ b/deps/crates/vendor/icu_locale_core/src/lib.rs @@ -89,7 +89,7 @@ pub mod subtags; pub mod preferences; pub mod zerovec; -#[cfg(all(feature = "alloc", feature = "serde"))] +#[cfg(feature = "serde")] mod serde; #[cfg(feature = "databake")] diff --git a/deps/crates/vendor/icu_locale_core/src/locale.rs b/deps/crates/vendor/icu_locale_core/src/locale.rs index 31af244c243ad6..a3435f215f9b28 100644 --- a/deps/crates/vendor/icu_locale_core/src/locale.rs +++ b/deps/crates/vendor/icu_locale_core/src/locale.rs @@ -46,14 +46,6 @@ use core::str::FromStr; /// ICU4X's Locale parsing does not allow for non-BCP-47-compatible locales [allowed by UTS 35 for backwards compatability][tr35-bcp]. /// Furthermore, it currently does not allow for language tags to have more than three characters. /// -/// # Serde -/// -/// This type implements `serde::Serialize` and `serde::Deserialize` if the -/// `"serde"` Cargo feature is enabled on the crate. -/// -/// The value will be serialized as a string and parsed when deserialized. -/// For tips on efficient storage and retrieval of locales, see [`crate::zerovec`]. -/// /// # Examples /// /// Simple example: @@ -90,7 +82,7 @@ use core::str::FromStr; /// assert_eq!(loc.id.script, "Latn".parse:: - - diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index 32d186340386ab..d88b42c22e72ba 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -76,7 +76,7 @@ "path": "url" }, "urlpattern": { - "commit": "11a459a2b1d411506d9230edf9f2ef32babfeb0b", + "commit": "23aac9278460a73394585ff5a15b6a04dfcd5ec8", "path": "urlpattern" }, "user-timing": { diff --git a/test/fuzzers/fuzz_env.cc b/test/fuzzers/fuzz_env.cc index e2169296550da6..326d82ae20e03d 100644 --- a/test/fuzzers/fuzz_env.cc +++ b/test/fuzzers/fuzz_env.cc @@ -35,8 +35,9 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { node::InitializeNodeWithArgs(&node_argv, &exec_argv, &errors); - tracing_agent = node::tracing::Agent::CreateDefault(); - v8::TracingController* tracing_controller = + tracing_agent = std::make_unique(); + node::tracing::TraceEventHelper::SetAgent(tracing_agent.get()); + node::tracing::TracingController* tracing_controller = tracing_agent->GetTracingController(); CHECK_EQ(0, uv_loop_init(¤t_loop)); static constexpr int kV8ThreadPoolSize = 4; diff --git a/test/fuzzers/fuzz_strings.cc b/test/fuzzers/fuzz_strings.cc index 92b386d2ecd4a7..2226a471f3bef9 100644 --- a/test/fuzzers/fuzz_strings.cc +++ b/test/fuzzers/fuzz_strings.cc @@ -42,8 +42,9 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { node::InitializeNodeWithArgs(&node_argv, &exec_argv, &errors); - tracing_agent = node::tracing::Agent::CreateDefault(); - v8::TracingController* tracing_controller = + tracing_agent = std::make_unique(); + node::tracing::TraceEventHelper::SetAgent(tracing_agent.get()); + node::tracing::TracingController* tracing_controller = tracing_agent->GetTracingController(); CHECK_EQ(0, uv_loop_init(¤t_loop)); static constexpr int kV8ThreadPoolSize = 4; diff --git a/test/node-api/test_fatal/test2.js b/test/node-api/test_fatal/test2.js index 44866d63ee7d75..6449f098458d76 100644 --- a/test/node-api/test_fatal/test2.js +++ b/test/node-api/test_fatal/test2.js @@ -12,7 +12,7 @@ if (process.argv[2] === 'child') { } const p = child_process.spawnSync( - process.execPath, [ __filename, 'child' ]); + process.execPath, [ '--napi-modules', __filename, 'child' ]); assert.ifError(p.error); assert.ok(p.stderr.toString().includes( 'FATAL ERROR: test_fatal::Test fatal message')); diff --git a/test/parallel/test-blob-stream-gc.js b/test/parallel/test-blob-stream-gc.js deleted file mode 100644 index 24b2f15efc1265..00000000000000 --- a/test/parallel/test-blob-stream-gc.js +++ /dev/null @@ -1,56 +0,0 @@ -// Flags: --expose-gc --no-concurrent-array-buffer-sweeping -'use strict'; - -const common = require('../common'); -const assert = require('assert'); -const { setImmediate: setImmediatePromise } = require('timers/promises'); - -const MiB = 1024 * 1024; -const iterations = 64; -const maxRetained = 16 * MiB; - -async function collectArrayBuffers() { - for (let i = 0; i < 3; i++) { - global.gc(); - await setImmediatePromise(); - } -} - -async function assertNoBlobStreamRetention(name, fn) { - const buffer = Buffer.alloc(MiB); - - await collectArrayBuffers(); - const before = process.memoryUsage().arrayBuffers; - - for (let i = 0; i < iterations; i++) { - await fn(buffer); - } - - await collectArrayBuffers(); - const retained = process.memoryUsage().arrayBuffers - before; - - assert( - retained < maxRetained, - `${name} retained ${retained} bytes in arrayBuffers`, - ); -} - -(async () => { - await assertNoBlobStreamRetention('unused Blob streams', - common.mustCall(async (buffer) => { - new Blob([buffer]).stream(); - }, iterations)); - - await assertNoBlobStreamRetention('cancelled Blob streams', - common.mustCall(async (buffer) => { - await new Blob([buffer]).stream() - .cancel(); - }, iterations)); - - await assertNoBlobStreamRetention('drained Blob streams', - common.mustCall(async (buffer) => { - await new Response( - new Blob([buffer]).stream(), - ).arrayBuffer(); - }, iterations)); -})().then(common.mustCall()); diff --git a/test/parallel/test-blob.js b/test/parallel/test-blob.js index 9ec2a3c04079a7..19ca24b0319f13 100644 --- a/test/parallel/test-blob.js +++ b/test/parallel/test-blob.js @@ -354,10 +354,8 @@ assert.throws(() => new Blob({}), { assert(!done); setTimeout(common.mustCall(() => { // The blob stream is now a byte stream hence after the first read, - // it may have pulled in the next 'hello' which is 5 bytes hence -5. - // The ordering of this timer and the stream's setImmediate() pull - // continuation can vary across platforms. - assert([0, -5].includes(stream[kState].controller.desiredSize)); + // it should pull in the next 'hello' which is 5 bytes hence -5. + assert.strictEqual(stream[kState].controller.desiredSize, 0); }), 0); })().then(common.mustCall()); diff --git a/test/parallel/test-buffer-isutf8-isascii-fast.js b/test/parallel/test-buffer-isutf8-isascii-fast.js deleted file mode 100644 index fb2b57025c5272..00000000000000 --- a/test/parallel/test-buffer-isutf8-isascii-fast.js +++ /dev/null @@ -1,34 +0,0 @@ -// Flags: --expose-internals --no-warnings --allow-natives-syntax -'use strict'; - -const common = require('../common'); -const assert = require('assert'); -const { Buffer, isAscii, isUtf8 } = require('buffer'); - -const ascii = Buffer.from('hello'); -const utf8 = Buffer.from('hello \xc4\x9f'); - -function testFastIsAscii() { - assert.strictEqual(isAscii(ascii), true); -} - -function testFastIsUtf8() { - assert.strictEqual(isUtf8(utf8), true); -} - -eval('%PrepareFunctionForOptimization(isAscii)'); -testFastIsAscii(); -eval('%OptimizeFunctionOnNextCall(isAscii)'); -testFastIsAscii(); - -eval('%PrepareFunctionForOptimization(isUtf8)'); -testFastIsUtf8(); -eval('%OptimizeFunctionOnNextCall(isUtf8)'); -testFastIsUtf8(); - -if (common.isDebug) { - const { internalBinding } = require('internal/test/binding'); - const { getV8FastApiCallCount } = internalBinding('debug'); - assert.strictEqual(getV8FastApiCallCount('buffer.isAscii'), 1); - assert.strictEqual(getV8FastApiCallCount('buffer.isUtf8'), 1); -} diff --git a/test/parallel/test-crypto-dh-curves.js b/test/parallel/test-crypto-dh-curves.js index be4c2079d99884..ddd5ea9377e63f 100644 --- a/test/parallel/test-crypto-dh-curves.js +++ b/test/parallel/test-crypto-dh-curves.js @@ -5,11 +5,6 @@ if (!common.hasCrypto) const assert = require('assert'); const crypto = require('crypto'); -const { hasOpenSSL } = require('../common/crypto'); -const { - DH_CHECK_P_NOT_PRIME, - DH_CHECK_P_NOT_SAFE_PRIME, -} = crypto.constants; // Second OAKLEY group, see // https://github.com/nodejs/node-v0.x-archive/issues/2338 and @@ -20,64 +15,12 @@ const p = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF'; crypto.createDiffieHellman(p, 'hex'); -if (!process.features.openssl_is_boringssl) { - const notPrime = Buffer.from(p, 'hex'); - notPrime[notPrime.length - 1] = 0xfd; - assert.strictEqual( - crypto.createDiffieHellman(notPrime, Buffer.from([2])).verifyError, - DH_CHECK_P_NOT_PRIME); - - const notSafePrime = Buffer.from( - 'd2d6d13e1c1e0bbb63c742199dee010411f089ac74f0f7213348388280700fd6' + - '0ef9c1e7b096a4257dcbce61c544a5d1d23db4c49c63ce302f63be5cf5804327', - 'hex'); - assert.strictEqual( - crypto.createDiffieHellman(notSafePrime, Buffer.from([2])).verifyError, - DH_CHECK_P_NOT_SAFE_PRIME); - - const group = crypto.getDiffieHellman('modp14'); - const alice = crypto.createDiffieHellman( - group.getPrime(), group.getGenerator()); - alice.generateKeys(); - const groupPrime = BigInt(`0x${group.getPrime('hex')}`); - assert.throws( - () => alice.computeSecret(Buffer.from([1])), - { - code: 'ERR_CRYPTO_INVALID_KEYLEN', - message: 'Supplied key is too small' - }); - assert.throws( - () => alice.computeSecret(group.getPrime()), - { - code: 'ERR_CRYPTO_INVALID_KEYLEN', - message: 'Supplied key is too large' - }); - assert.throws( - () => alice.computeSecret( - Buffer.from((groupPrime - 1n).toString(16), 'hex')), - { - code: 'ERR_CRYPTO_INVALID_KEYLEN', - message: 'Supplied key is too large' - }); -} - // Confirm DH_check() results are exposed for optional examination. const bad_dh = process.features.openssl_is_boringssl ? crypto.createDiffieHellman('abcd', 'hex', 0) : crypto.createDiffieHellman('02', 'hex'); assert.notStrictEqual(bad_dh.verifyError, 0); -if (hasOpenSSL(3)) { - const smallSafePrime = crypto.createDiffieHellman( - Buffer.from([23]), Buffer.from([2])); - assert.notStrictEqual(smallSafePrime.verifyError, 0); - - assert.throws( - () => crypto.createDiffieHellman(Buffer.from(p, 'hex'), - Buffer.from(p, 'hex')), - { code: 'ERR_OSSL_DH_BAD_GENERATOR' }); -} - const availableCurves = new Set(crypto.getCurves()); const availableHashes = new Set(crypto.getHashes()); diff --git a/test/parallel/test-crypto-key-objects.js b/test/parallel/test-crypto-key-objects.js index 775b752ac3b105..7c82e4dd8b97ea 100644 --- a/test/parallel/test-crypto-key-objects.js +++ b/test/parallel/test-crypto-key-objects.js @@ -909,41 +909,6 @@ if (!process.features.openssl_is_boringssl) { } } } - - const der = publicKey.export({ format: 'der', type: 'spki' }); - const saltLengthParam = Buffer.from([0xa2, 0x03, 0x02, 0x01, 0x10]); - const saltLengthOffset = der.indexOf(saltLengthParam); - assert.notStrictEqual(saltLengthOffset, -1); - - const importMalformedPublicKey = common.mustCall((key) => { - const malformedKey = createPublicKey({ - key, - format: 'der', - type: 'spki' - }); - assert.strictEqual(malformedKey.asymmetricKeyType, 'rsa-pss'); - assert.strictEqual(malformedKey.asymmetricKeyDetails.modulusLength, 2048); - assert.strictEqual(malformedKey.asymmetricKeyDetails.publicExponent, - 65537n); - }, 2); - - { - const negativeSaltLength = Buffer.from(der); - negativeSaltLength[saltLengthOffset + saltLengthParam.length - 1] = 0x80; - importMalformedPublicKey(negativeSaltLength); - } - - { - const oversizedSaltLength = Buffer.concat([ - der.subarray(0, saltLengthOffset), - Buffer.from([0xa2, 0x0b, 0x02, 0x09, 1, 0, 0, 0, 0, 0, 0, 0, 0x10]), - der.subarray(saltLengthOffset + saltLengthParam.length), - ]); - oversizedSaltLength.writeUInt16BE(der.readUInt16BE(2) + 8, 2); - oversizedSaltLength[5] = der[5] + 8; - oversizedSaltLength[18] = der[18] + 8; - importMalformedPublicKey(oversizedSaltLength); - } } { diff --git a/test/parallel/test-dgram-custom-lookup.js b/test/parallel/test-dgram-custom-lookup.js index 7a2bf92187bda8..4f80451c526625 100644 --- a/test/parallel/test-dgram-custom-lookup.js +++ b/test/parallel/test-dgram-custom-lookup.js @@ -4,12 +4,10 @@ const assert = require('assert'); const dgram = require('dgram'); const dns = require('dns'); -const originalLookup = dns.lookup; - { // Verify that the provided lookup function is called. const lookup = common.mustCall((host, family, callback) => { - originalLookup(host, family, callback); + dns.lookup(host, family, callback); }); const socket = dgram.createSocket({ type: 'udp4', lookup }); @@ -20,17 +18,17 @@ const originalLookup = dns.lookup; } { - // Verify that the default lookup forwards host names to dns.lookup(). + // Verify that lookup defaults to dns.lookup(). + const originalLookup = dns.lookup; + dns.lookup = common.mustCall((host, family, callback) => { dns.lookup = originalLookup; - assert.strictEqual(host, 'example.invalid'); - assert.strictEqual(family, 4); - callback(null, '127.0.0.1', 4); + originalLookup(host, family, callback); }); const socket = dgram.createSocket({ type: 'udp4' }); - socket.bind(0, 'example.invalid', common.mustCall(() => { + socket.bind(common.mustCall(() => { socket.close(); })); } diff --git a/test/parallel/test-dgram-default-lookup-ip.js b/test/parallel/test-dgram-default-lookup-ip.js deleted file mode 100644 index 826ac7582aac1b..00000000000000 --- a/test/parallel/test-dgram-default-lookup-ip.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; - -// The default dgram lookup resolves a literal IP address of the socket's own -// family to itself, without calling dns.lookup(). Each case below stubs the -// process-global dns.lookup(), so they run sequentially to keep one case from -// observing another's stub. - -const common = require('../common'); -const assert = require('assert'); -const dgram = require('dgram'); -const dns = require('dns'); - -const originalLookup = dns.lookup; - -function ipv4SendSkipsLookup(next) { - dns.lookup = common.mustNotCall('dns.lookup() ran for an IPv4 literal'); - - const receiver = dgram.createSocket('udp4'); - const sender = dgram.createSocket('udp4'); - - receiver.on('message', common.mustCall((msg) => { - assert.strictEqual(msg.toString(), 'payload'); - dns.lookup = originalLookup; - receiver.close(); - sender.close(); - next(); - })); - - receiver.bind(0, '127.0.0.1', common.mustCall(() => { - sender.send('payload', receiver.address().port, '127.0.0.1', common.mustCall()); - })); -} - -function ipv6BindSkipsLookup(next) { - if (!common.hasIPv6) { - next(); - return; - } - - dns.lookup = common.mustNotCall('dns.lookup() ran for an IPv6 literal'); - - const socket = dgram.createSocket('udp6'); - - socket.bind(0, '::1', common.mustCall(() => { - dns.lookup = originalLookup; - socket.close(); - next(); - })); -} - -function mismatchedFamilyFallsThrough(next) { - // '::1' is not an IPv4 literal, so a udp4 socket still resolves it via - // dns.lookup() rather than short-circuiting. - dns.lookup = common.mustCall((host, family, callback) => { - dns.lookup = originalLookup; - assert.strictEqual(host, '::1'); - assert.strictEqual(family, 4); - callback(null, '127.0.0.1', 4); - }); - - const socket = dgram.createSocket('udp4'); - - socket.bind(0, '::1', common.mustCall(() => { - socket.close(); - next(); - })); -} - -const cases = [ - ipv4SendSkipsLookup, - ipv6BindSkipsLookup, - mismatchedFamilyFallsThrough, -]; - -(function runNext() { - const testCase = cases.shift(); - if (testCase !== undefined) { - testCase(runNext); - } -})(); diff --git a/test/parallel/test-fs-mkdtemp-buffer.js b/test/parallel/test-fs-mkdtemp-buffer.js new file mode 100644 index 00000000000000..4403db03570a9a --- /dev/null +++ b/test/parallel/test-fs-mkdtemp-buffer.js @@ -0,0 +1,26 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); + +const tmpdir = require('../common/tmpdir'); +tmpdir.refresh(); + +const prefixString = path.join(tmpdir.path, 'buffer-'); +const prefixBuffer = Buffer.from(prefixString); + +// 1. Test Sync API +const resultSync = fs.mkdtempSync(prefixBuffer); +assert.strictEqual(Buffer.isBuffer(resultSync), true); + +// 2. Test Callback API +fs.mkdtemp(prefixBuffer, common.mustSucceed((resultCb) => { + assert.strictEqual(Buffer.isBuffer(resultCb), true); +})); + +// 3. Test Promises API +fs.promises.mkdtemp(prefixBuffer) + .then(common.mustCall((resultPromise) => { + assert.strictEqual(Buffer.isBuffer(resultPromise), true); + })); diff --git a/test/parallel/test-fs-mkdtemp.js b/test/parallel/test-fs-mkdtemp.js index e93809d5b44546..3c2323440e0803 100644 --- a/test/parallel/test-fs-mkdtemp.js +++ b/test/parallel/test-fs-mkdtemp.js @@ -64,14 +64,13 @@ function handler(err, folder) { { const tmpFolder = fs.mkdtempSync(Buffer.from(tmpdir.resolve('foo.'))); - assert.strictEqual(path.basename(tmpFolder).length, 'foo.XXXXXX'.length); + assert.strictEqual(path.basename(tmpFolder.toString()).length, 'foo.XXXXXX'.length); assert(fs.existsSync(tmpFolder)); const utf8 = fs.mkdtempSync(Buffer.from(tmpdir.resolve('\u0222abc.'))); - assert.strictEqual(Buffer.byteLength(path.basename(utf8)), + assert.strictEqual(Buffer.byteLength(path.basename(utf8.toString())), Buffer.byteLength('\u0222abc.XXXXXX')); assert(fs.existsSync(utf8)); - fs.mkdtemp(Buffer.from(tmpdir.resolve('bar.')), common.mustCall(handler)); // Same test as above, but making sure that passing an options object doesn't diff --git a/test/parallel/test-http-connect-default-host-header.js b/test/parallel/test-http-connect-default-host-header.js deleted file mode 100644 index 9522f028f5165b..00000000000000 --- a/test/parallel/test-http-connect-default-host-header.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('assert'); -const http = require('http'); -const net = require('net'); - -const target = 'target.example.com:443'; - -const server = net.createServer(common.mustCall((socket) => { - socket.once('data', common.mustCall((data) => { - const rawRequest = data.toString(); - const requestLines = rawRequest.split('\r\n'); - - assert.strictEqual(requestLines[0], `CONNECT ${target} HTTP/1.1`); - assert(requestLines.includes(`Host: ${target}`)); - - socket.end('HTTP/1.1 200 Connection established\r\n\r\n'); - })); -})); - -server.listen(0, common.localhostIPv4, common.mustCall(() => { - const req = http.request({ - host: common.localhostIPv4, - port: server.address().port, - method: 'CONNECT', - path: target, - }, common.mustNotCall()); - - req.on('connect', common.mustCall((res, socket) => { - assert.strictEqual(res.statusCode, 200); - socket.destroy(); - server.close(); - })); - - req.end(); -})); diff --git a/test/parallel/test-http-response-drain-cork.js b/test/parallel/test-http-response-drain-cork.js deleted file mode 100644 index 18678748b9c2a4..00000000000000 --- a/test/parallel/test-http-response-drain-cork.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; -const common = require('../common'); -const http = require('http'); -const assert = require('assert'); - -// Test that drain event is emitted correctly when using cork/uncork -// with ServerResponse and the write buffer is full - -const server = http.createServer(common.mustCall(async (req, res) => { - res.cork(); - - // Write small amount - won't need drain - assert.strictEqual(res.write('1'.repeat(10)), true); - - // Write enough to exceed highWaterMark (set in 'connection' listener) - assert.strictEqual(res.write('2'.repeat(1000)), false); - - // Verify writableNeedDrain is set - assert.strictEqual(res.writableNeedDrain, true); - - // Wait for drain event after uncorking - const drainPromise = new Promise((resolve) => { - res.once('drain', common.mustCall(() => { - // After drain, writableNeedDrain should be false - assert.strictEqual(res.writableNeedDrain, false); - resolve(); - })); - }); - - // Uncork should trigger drain - res.uncork(); - await drainPromise; - - res.end(); -})); - -server.on('connection', common.mustCall((socket) => { - // Set high water mark large enough to cover HTTP overhead + first - // small content batch, but not enough to cover second batch. - socket._writableState.highWaterMark = 1000; -})); - -server.listen(0, common.localhostIPv4, common.mustCall(() => { - http.get({ - host: common.localhostIPv4, - port: server.address().port, - }, common.mustCall((res) => { - let data = ''; - res.setEncoding('utf8'); - - res.on('data', (chunk) => { - data += chunk; - }); - - res.on('end', common.mustCall(() => { - // Verify we got all the data - assert.strictEqual(data.length, 10 + 1000); - assert.strictEqual(data.substring(0, 10), '1'.repeat(10)); - assert.strictEqual(data.substring(10), '2'.repeat(1000)); - - server.close(common.mustCall()); - })); - })); -})); diff --git a/test/parallel/test-http-server-consumed-timeout.js b/test/parallel/test-http-server-consumed-timeout.js index 683421394a0fad..b1781913b56866 100644 --- a/test/parallel/test-http-server-consumed-timeout.js +++ b/test/parallel/test-http-server-consumed-timeout.js @@ -7,7 +7,7 @@ const http = require('http'); const durationBetweenIntervals = []; let timeoutTooShort = false; -const TIMEOUT = common.platformTimeout(1000); +const TIMEOUT = common.platformTimeout(200); const INTERVAL = Math.floor(TIMEOUT / 8); runTest(TIMEOUT); diff --git a/test/parallel/test-http2-compat-serverresponse-trailers-streaming.js b/test/parallel/test-http2-compat-serverresponse-trailers-streaming.js deleted file mode 100644 index b15cc4680b00bc..00000000000000 --- a/test/parallel/test-http2-compat-serverresponse-trailers-streaming.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict'; - -const common = require('../common'); -if (!common.hasCrypto) - common.skip('missing crypto'); -const assert = require('assert'); -const h2 = require('http2'); - -// Regression test for the auto-empty-trailers optimization: when the -// response headers are flushed before the response is ended (streaming -// mode), trailers registered afterwards must still be sent, and responses -// that never register trailers must complete normally. - -const server = h2.createServer(); -server.listen(0, common.mustCall(() => { - const port = server.address().port; - server.on('request', (request, response) => { - if (request.url === '/trailers') { - response.writeHead(200); - response.write('hello'); - // Trailers registered after the headers were already flushed. - response.setTrailer('x-checksum', 'abc'); - response.addTrailers({ 'x-count': 2 }); - response.end('world'); - } else { - response.writeHead(200); - response.write('no'); - response.end('trailers'); - } - }); - - const client = h2.connect(`http://localhost:${port}`); - - { - const request = client.request({ ':path': '/trailers' }); - let body = ''; - request.setEncoding('utf8'); - request.on('data', (chunk) => body += chunk); - request.on('trailers', common.mustCall((trailers) => { - assert.strictEqual(trailers['x-checksum'], 'abc'); - assert.strictEqual(trailers['x-count'], '2'); - })); - request.on('end', common.mustCall(() => { - assert.strictEqual(body, 'helloworld'); - maybeClose(); - })); - request.end(); - } - - { - const request = client.request({ ':path': '/plain' }); - let body = ''; - request.setEncoding('utf8'); - request.on('data', (chunk) => body += chunk); - request.on('trailers', common.mustNotCall()); - request.on('end', common.mustCall(() => { - assert.strictEqual(body, 'notrailers'); - maybeClose(); - })); - request.end(); - } - - let remaining = 2; - function maybeClose() { - if (--remaining === 0) { - client.close(); - server.close(); - } - } -})); diff --git a/test/parallel/test-internal-validators-validateport.js b/test/parallel/test-internal-validators-validateport.js index b125d0a93f71ab..a4c92b8dbca929 100644 --- a/test/parallel/test-internal-validators-validateport.js +++ b/test/parallel/test-internal-validators-validateport.js @@ -21,17 +21,3 @@ for (let n = 0; n <= 0xFFFF; n++) { ].forEach((i) => assert.throws(() => validatePort(i), { code: 'ERR_SOCKET_BAD_PORT' })); - -// When allowZero is false, every form of zero must be rejected, including -// the string forms that coerce to 0. Refs: the zero check must coerce the -// value the same way the rest of the validation does (`+port`). -[ - 0, '0', ' 0 ', '00', '0x0', '0o0', '0b0', -].forEach((i) => assert.throws(() => validatePort(i, 'Port', false), { - code: 'ERR_SOCKET_BAD_PORT' -})); - -// With allowZero left at its default (true), those same values are accepted. -[ - 0, '0', ' 0 ', '00', '0x0', '0o0', '0b0', -].forEach((i) => assert.strictEqual(validatePort(i), 0)); diff --git a/test/parallel/test-net-allow-half-open-async-iter.js b/test/parallel/test-net-allow-half-open-async-iter.js deleted file mode 100644 index 30d82fc4e5b327..00000000000000 --- a/test/parallel/test-net-allow-half-open-async-iter.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('assert'); -const net = require('net'); - -(async function() { - let resolveServerSocket; - const serverSocketPromise = new Promise((resolve) => { - resolveServerSocket = resolve; - }); - - const server = net.createServer({ - allowHalfOpen: true, - }, common.mustCall((socket) => { - resolveServerSocket(socket); - })); - - server.on('error', common.mustNotCall()); - server.on('close', common.mustCall()); - - await new Promise((resolve) => { - server.listen(0, common.localhostIPv4, resolve); - }); - - const clientSocket = await new Promise((resolve) => { - const socket = net.createConnection({ - allowHalfOpen: true, - port: server.address().port, - host: server.address().address, - }, common.mustCall(() => { - resolve(socket); - })); - socket.on('error', common.mustNotCall()); - }); - - const serverSocket = await serverSocketPromise; - serverSocket.on('error', common.mustNotCall()); - - await new Promise((resolve, reject) => { - clientSocket.write('data written to client socket', (err) => { - if (err) reject(err); - else resolve(); - }); - }); - - await new Promise((resolve) => { - clientSocket.end(resolve); - }); - - let serverRead = ''; - for await (const chunk of serverSocket) { - serverRead += chunk; - } - - assert.strictEqual(serverRead, 'data written to client socket'); - assert.strictEqual(serverSocket.destroyed, false); - - await new Promise((resolve, reject) => { - serverSocket.write('data written to server socket', (err) => { - if (err) reject(err); - else resolve(); - }); - }); - - await new Promise((resolve) => { - serverSocket.end(resolve); - }); - - let clientRead = ''; - for await (const chunk of clientSocket) { - clientRead += chunk; - } - - assert.strictEqual(clientRead, 'data written to server socket'); - - await new Promise((resolve) => { - server.close(resolve); - }); -})().then(common.mustCall()); diff --git a/test/parallel/test-node-run.js b/test/parallel/test-node-run.js index e24117f6b1658b..26295256849702 100644 --- a/test/parallel/test-node-run.js +++ b/test/parallel/test-node-run.js @@ -143,15 +143,15 @@ describe('node --run [command]', () => { it('appends positional arguments', async () => { const child = await common.spawnPromisified( process.execPath, - [ '--run', `positional-args${envSuffix}`, '--', '--help "hello world test"', 'A', 'B', 'C', 'I think therefore I\'m'], + [ '--run', `positional-args${envSuffix}`, '--', '--help "hello world test"', 'A', 'B', 'C'], { cwd: fixtures.path('run-script') }, ); if (common.isWindows) { - assert.match(child.stdout, /Arguments: '--help ""hello world test"" A B C I think therefore I'm'/); + assert.match(child.stdout, /Arguments: '--help ""hello world test"" A B C'/); } else { - assert.match(child.stdout, /Arguments: '--help "hello world test" A B C I think therefore I'm'/); + assert.match(child.stdout, /Arguments: '--help "hello world test" A B C'/); } - assert.match(child.stdout, /The total number of arguments is: 5/); + assert.match(child.stdout, /The total number of arguments are: 4/); assert.strictEqual(child.stderr, ''); assert.strictEqual(child.code, 0); }); diff --git a/test/parallel/test-permission-child-process-inherit-flags-substring.js b/test/parallel/test-permission-child-process-inherit-flags-substring.js deleted file mode 100644 index f992a1f3dc8f3b..00000000000000 --- a/test/parallel/test-permission-child-process-inherit-flags-substring.js +++ /dev/null @@ -1,96 +0,0 @@ -// Flags: --permission --allow-child-process --allow-fs-read=* --allow-worker -// Tests that NODE_OPTIONS values containing '--permission' as a substring -// in unrelated option values (e.g., --title=--permission) do NOT suppress -// Permission Model flag propagation to child processes. -'use strict'; - -const common = require('../common'); -const { isMainThread } = require('worker_threads'); - -if (!isMainThread) { - common.skip('This test only works on a main thread'); -} -if (process.config.variables.node_without_node_options) { - common.skip('missing NODE_OPTIONS support'); -} - -const assert = require('assert'); -const childProcess = require('child_process'); - -// Verify that the parent has Permission Model enabled -assert.ok(process.permission.has('child')); -assert.strictEqual(process.env.NODE_OPTIONS, undefined); - -// Test cases: NODE_OPTIONS values that contain '--permission' as a substring -// but are NOT actual permission flags. These should NOT suppress propagation. -const testCases = [ - { name: 'title', nodeOptions: '--title=--permission' }, - { name: 'conditions', nodeOptions: '--conditions=--permission' }, - { name: 'trace-event-categories', nodeOptions: '--trace-event-categories=--permission' }, - { name: 'title-audit', nodeOptions: '--title=--permission-audit' }, -]; - -for (const { name, nodeOptions } of testCases) { - // Spawn a child with the problematic NODE_OPTIONS value. - // Without the fix, the substring check causes propagation to be skipped, - // and the child will not have process.permission. - const { status, stdout } = childProcess.spawnSync( - process.execPath, - [ - '-e', - ` - console.log(typeof process.permission); - console.log(process.permission && process.permission.has("child")); - console.log(process.env.NODE_OPTIONS); - `, - ], - { - env: { - ...process.env, - 'NODE_OPTIONS': nodeOptions, - } - } - ); - - assert.strictEqual(status, 0, `child process for ${name} exited with status ${status}`); - - const [permType, hasChild] = stdout.toString().split('\n'); - - // Verify the child has Permission Model enabled (the bug caused it to be absent) - assert.strictEqual(permType, 'object', `child ${name} should have process.permission object`); - - // Verify the child inherited child permission - assert.strictEqual(hasChild, 'true', `child ${name} should have child permission`); -} - -// Also verify that a child with a real --permission flag in NODE_OPTIONS -// still gets its own flags honored (regression test for existing behavior). -{ - const { status, stdout } = childProcess.spawnSync( - process.execPath, - [ - '-e', - ` - console.log(process.permission.has("fs.write")); - console.log(process.permission.has("fs.read")); - console.log(process.permission.has("child")); - `, - ], - { - env: { - ...process.env, - 'NODE_OPTIONS': '--permission --allow-fs-write=*', - } - } - ); - - assert.strictEqual(status, 0); - const [fsWrite, fsRead, child] = stdout.toString().split('\n'); - assert.strictEqual(fsWrite, 'true'); - assert.strictEqual(fsRead, 'false'); - assert.strictEqual(child, 'false'); -} - -{ - assert.strictEqual(process.env.NODE_OPTIONS, undefined); -} diff --git a/test/parallel/test-permission-drop-addons.js b/test/parallel/test-permission-drop-addons.js deleted file mode 100644 index baf87c3b95b858..00000000000000 --- a/test/parallel/test-permission-drop-addons.js +++ /dev/null @@ -1,38 +0,0 @@ -// Flags: --permission --allow-addons --allow-fs-read=* -'use strict'; - -const common = require('../common'); -const { isMainThread } = require('worker_threads'); - -if (!isMainThread) { - common.skip('This test only works on a main thread'); -} - -const assert = require('assert'); - -let bindingPath; -try { - bindingPath = require.resolve( - `../addons/hello-world/build/${common.buildType}/binding`); -} catch (err) { - if (err.code !== 'MODULE_NOT_FOUND') { - throw err; - } - common.skip('addon not found'); -} - -function openAddon() { - process.dlopen({ exports: {} }, bindingPath); -} - -assert.ok(process.permission.has('addon')); -openAddon(); - -process.permission.drop('addon'); -assert.ok(!process.permission.has('addon')); -assert.throws(() => { - openAddon(); -}, common.expectsError({ - code: 'ERR_ACCESS_DENIED', - permission: 'Addon', -})); diff --git a/test/parallel/test-process-env-allowed-flags-are-documented.js b/test/parallel/test-process-env-allowed-flags-are-documented.js index 6028bbab787e29..b592decedd4ccd 100644 --- a/test/parallel/test-process-env-allowed-flags-are-documented.js +++ b/test/parallel/test-process-env-allowed-flags-are-documented.js @@ -133,7 +133,6 @@ assert(undocumented.delete('--experimental-global-customevent')); assert(undocumented.delete('--experimental-global-webcrypto')); assert(undocumented.delete('--experimental-report')); assert(undocumented.delete('--experimental-worker')); -assert(undocumented.delete('--napi-modules')); assert(undocumented.delete('--node-snapshot')); assert(undocumented.delete('--no-node-snapshot')); assert(undocumented.delete('--loader')); diff --git a/test/parallel/test-process-finalization.mjs b/test/parallel/test-process-finalization.mjs index dddd0b8fae19d7..5d3222aaca67d4 100644 --- a/test/parallel/test-process-finalization.mjs +++ b/test/parallel/test-process-finalization.mjs @@ -9,7 +9,6 @@ import assert from 'assert'; const files = [ 'close.mjs', 'before-exit.mjs', - 'finalization-cleanup.mjs', 'gc-not-close.mjs', 'unregister.mjs', 'different-registry-per-thread.mjs', diff --git a/test/parallel/test-quic-session-preferred-address-ipv6.mjs b/test/parallel/test-quic-session-preferred-address-ipv6.mjs index 35e539848b4aba..e9f23c3bf554d5 100644 --- a/test/parallel/test-quic-session-preferred-address-ipv6.mjs +++ b/test/parallel/test-quic-session-preferred-address-ipv6.mjs @@ -100,9 +100,6 @@ const clientSession = await connect(serverEndpoint.address, { family: 'ipv6', }, }, - maxDatagramSendAttempts: 100, // While the connection is restablished, - // all the acknowledgement packets of ngtcp2 are counted as send attempts - // so either this or a delay, or a change in ngtcp2 interfaces }); await clientSession.opened; diff --git a/test/parallel/test-quic-session-preferred-address.mjs b/test/parallel/test-quic-session-preferred-address.mjs index 6a526a8c9ca63f..c4a55ee4d42b74 100644 --- a/test/parallel/test-quic-session-preferred-address.mjs +++ b/test/parallel/test-quic-session-preferred-address.mjs @@ -78,9 +78,6 @@ const clientSession = await connect(serverEndpoint.address, { strictEqual(oldRemote, null); strictEqual(preferred, true); }), - maxDatagramSendAttempts: 100, // While the connection is restablished, - // all the acknowledgement packets of ngtcp2 are counted as send attempts - // so either this or a delay, or a change in ngtcp2 interfaces }); await clientSession.opened; diff --git a/test/parallel/test-quic-session-unobserved-error-close.mjs b/test/parallel/test-quic-session-unobserved-error-close.mjs deleted file mode 100644 index c0440766aaaac1..00000000000000 --- a/test/parallel/test-quic-session-unobserved-error-close.mjs +++ /dev/null @@ -1,47 +0,0 @@ -// Flags: --experimental-quic --no-warnings - -// Regression test: destroying a session with an error while its `closed` -// promise is not being observed must NOT surface as an unhandled rejection. - -import { hasQuic, skip, mustCall, mustNotCall } from '../common/index.mjs'; -import { subscribe, unsubscribe } from 'node:diagnostics_channel'; -import { setImmediate as tick } from 'node:timers/promises'; - -if (!hasQuic) { - skip('QUIC is not enabled'); -} - -const { listen, connect } = await import('../common/quic.mjs'); - -// Any unhandled rejection - e.g. an unobserved `closed` rejecting - fails. -process.on('unhandledRejection', mustNotCall('unexpected unhandled rejection')); - -// We use the diagnostics channel to observe the error close without actually -// observing session.closed (not listening is the whole point of the test): -const serverErrored = Promise.withResolvers(); -function onSessionError() { - unsubscribe('quic.session.error', onSessionError); - serverErrored.resolve(); -} -subscribe('quic.session.error', onSessionError); - -// The server session callback is left deliberately empty, so no response -// is sent and closed remains unobserved: -const serverEndpoint = await listen(mustCall()); - -const clientSession = await connect(serverEndpoint.address); -await clientSession.opened; - -// Finish handshake before close: -await tick(); - -// Cleanly close from the client with an error code, so the server -// receives a peer error close: -await clientSession.close({ code: 1 }); - -// Wait until the server has processed the error close, plus another tick -// to ensure unobserved promise rejection doesn't fire anywhere: -await serverErrored.promise; -await tick(); - -await serverEndpoint.close(); diff --git a/test/parallel/test-quic-stream-uni-no-onstream.mjs b/test/parallel/test-quic-stream-uni-no-onstream.mjs deleted file mode 100644 index feaa657fb07b53..00000000000000 --- a/test/parallel/test-quic-stream-uni-no-onstream.mjs +++ /dev/null @@ -1,47 +0,0 @@ -// Flags: --experimental-quic --no-warnings -// Test: client-initiated unidirectional stream with no onstream -// The client creates a uni stream with no onstream. -// Verify that this causes no crash. - -import { hasQuic, skip, mustCall } from '../common/index.mjs'; -import * as fixtures from '../common/fixtures.mjs'; - -const { readKey } = fixtures; - -if (!hasQuic) { - skip('QUIC is not enabled'); -} - -const { createPrivateKey } = await import('node:crypto'); -const { listen, connect } = await import('../common/quic.mjs'); - -const serverKey = createPrivateKey(readKey('agent1-key.pem')); -const serverCert = readKey('agent1-cert.pem'); - -const done = Promise.withResolvers(); - -const serverEndpoint = await listen(mustCall(async (session) => { - await session.opened; - done.resolve(); -}), { - sni: { '*': { keys: [serverKey], certs: [serverCert] } }, - alpn: ['repro'], -}); - -const clientSession = await connect(serverEndpoint.address, { - servername: 'localhost', - alpn: 'repro', - ca: serverCert, -}); - -await clientSession.opened; - -await clientSession.createUnidirectionalStream({ - body: 'something something darkside', -}); - -await done.promise; - -await clientSession.close(); - -await serverEndpoint.close(); diff --git a/test/parallel/test-quic-version-negotiation-oversized-cid.mjs b/test/parallel/test-quic-version-negotiation-oversized-cid.mjs deleted file mode 100644 index 55b5f6e0f669f8..00000000000000 --- a/test/parallel/test-quic-version-negotiation-oversized-cid.mjs +++ /dev/null @@ -1,89 +0,0 @@ -// Flags: --experimental-quic --no-warnings - -// Regression test for an unauthenticated remote crash in the QUIC Version -// Negotiation path. -// -// ngtcp2_pkt_decode_version_cid() does not clamp the connection ID lengths -// to NGTCP2_MAX_CIDLEN (20) when the packet's version is unsupported -- it -// returns the raw single-byte length fields from the wire, which can be up -// to 255. Endpoint::Receive() used to build CID objects (each backed by a -// fixed 20-byte buffer) directly from those lengths before any bound check, -// so a single crafted UDP datagram with an oversized DCID/SCID length would -// overflow the buffer and abort the process before the handshake. -// -// This test sends such a datagram directly with node:dgram and asserts the -// endpoint drops it without crashing, while a well-formed unsupported-version -// datagram still produces exactly one Version Negotiation response. - -import { hasQuic, skip, mustNotCall } from '../common/index.mjs'; -import assert from 'node:assert'; - -const { strictEqual } = assert; - -if (!hasQuic) { - skip('QUIC is not enabled'); -} - -const { createSocket } = await import('node:dgram'); -const { listen } = await import('../common/quic.mjs'); - -// A long-header QUIC packet must be at least NGTCP2_MAX_UDP_PAYLOAD_SIZE -// (1200) bytes for an unsupported version to decode as a VN trigger. -const PACKET_SIZE = 1200; - -// Build a QUIC long-header packet with an unsupported version and the given -// DCID/SCID lengths. Lengths greater than 20 are only expressible because the -// on-wire length field is a single byte (0-255). -function buildLongHeaderPacket(dcidLen, scidLen) { - const packet = Buffer.alloc(PACKET_SIZE); - // Header form bit (0x80) + fixed bit (0x40). - packet[0] = 0xc0; - // Version 0x0a0a0a0a: nonzero (so it is not a real VN packet) and not a - // version Node supports, which forces the NGTCP2_ERR_VERSION_NEGOTIATION - // decode path. - packet.writeUInt32BE(0x0a0a0a0a, 1); - packet[5] = dcidLen; // DCID length byte - // DCID bytes occupy [6, 6 + dcidLen); SCID length byte follows them. - packet[6 + dcidLen] = scidLen; - // Remaining bytes stay zero-filled as padding to reach PACKET_SIZE. - return packet; -} - -// No handshake ever completes: the test only sends raw datagrams, so the -// session callback must never fire. -const serverEndpoint = await listen(mustNotCall()); -const { address, port } = serverEndpoint.address; - -const socket = createSocket('udp4'); - -function send(packet) { - return new Promise((resolve, reject) => { - socket.send(packet, port, address, (err) => { - if (err) reject(err); - else resolve(); - }); - }); -} - -// 1. Oversized DCID (21 > NGTCP2_MAX_CIDLEN). Before the fix this aborted the -// process. After the fix it must be dropped silently. -await send(buildLongHeaderPacket(21, 0)); - -// 2. A well-formed unsupported-version packet with valid (<= 20 byte) CIDs. -// This must still elicit exactly one Version Negotiation response, proving -// the fix did not break legitimate version negotiation. -await send(buildLongHeaderPacket(8, 8)); - -// Poll until the valid packet has been processed into a VN response. -const deadline = Date.now() + 2000; -while (serverEndpoint.stats.versionNegotiationCount === 0n) { - if (Date.now() > deadline) break; - await new Promise((resolve) => setTimeout(resolve, 25)); -} - -// Exactly one VN response: the oversized packet was dropped (not crashed, not -// negotiated), the valid packet was negotiated. -strictEqual(serverEndpoint.stats.versionNegotiationCount, 1n); - -socket.close(); -await serverEndpoint.close(); diff --git a/test/parallel/test-runner-entry-file.mjs b/test/parallel/test-runner-entry-file.mjs deleted file mode 100644 index 94750e6a745e50..00000000000000 --- a/test/parallel/test-runner-entry-file.mjs +++ /dev/null @@ -1,59 +0,0 @@ -import '../common/index.mjs'; -import * as fixtures from '../common/fixtures.mjs'; -import { describe, it, run } from 'node:test'; -import assert from 'node:assert'; - -const aPath = fixtures.path('test-runner', 'entry-file', 'a.test.mjs'); -const bPath = fixtures.path('test-runner', 'entry-file', 'b.test.mjs'); -const helperPath = fixtures.path('test-runner', 'entry-file', 'helper.mjs'); - -async function collectEvents(options) { - const events = []; - const stream = run({ files: [aPath, bPath], ...options }); - stream.on('test:fail', () => {}); - for await (const event of stream) { - events.push(event); - } - return events; -} - -describe('entryFile attribution in reporter events', { concurrency: false }, () => { - it('stamps entryFile on events forwarded from child processes', async () => { - const events = await collectEvents({ isolation: 'process' }); - const checked = { __proto__: null, A: 0, B: 0 }; - - for (const { type, data } of events) { - if (data?.name === 'restore A' || data?.name === 'restore B') { - const target = data.name === 'restore A' ? 'A' : 'B'; - const expectedEntry = target === 'A' ? aPath : bPath; - assert.strictEqual(data.file, helperPath, - `${type} file should be the definition site`); - assert.strictEqual(data.entryFile, expectedEntry, - `${type} entryFile should be the entry file`); - checked[target]++; - } - } - - // Each subtest emits at least enqueue/dequeue/start/pass/complete. - assert.ok(checked.A >= 4, `expected events for restore A, got ${checked.A}`); - assert.ok(checked.B >= 4, `expected events for restore B, got ${checked.B}`); - }); - - it('stamps entryFile on top-level tests forwarded from child processes', async () => { - const events = await collectEvents({ isolation: 'process' }); - const pass = events.filter(({ type }) => type === 'test:pass'); - const backupA = pass.find(({ data }) => data.name === 'backup A'); - const backupB = pass.find(({ data }) => data.name === 'backup B'); - assert.strictEqual(backupA.data.entryFile, aPath); - assert.strictEqual(backupB.data.entryFile, bPath); - }); - - it('does not stamp entryFile with isolation none', async () => { - const events = await collectEvents({ isolation: 'none' }); - for (const { data } of events) { - if (data?.name === 'restore A' || data?.name === 'restore B') { - assert.strictEqual(data.entryFile, undefined); - } - } - }); -}); diff --git a/test/parallel/test-runner-v8-deserializer.mjs b/test/parallel/test-runner-v8-deserializer.mjs index 6959b93fb5918c..5e50df441da59e 100644 --- a/test/parallel/test-runner-v8-deserializer.mjs +++ b/test/parallel/test-runner-v8-deserializer.mjs @@ -5,7 +5,6 @@ import { describe, it, beforeEach } from 'node:test'; import assert from 'node:assert'; import { finished } from 'node:stream/promises'; import { DefaultSerializer } from 'node:v8'; -import { resolve } from 'node:path'; import serializer from 'internal/test_runner/reporter/v8-serializer'; import runner from 'internal/test_runner/runner'; @@ -15,15 +14,10 @@ async function toArray(chunks) { return arr; } -const entryFile = resolve('filetest'); const diagnosticEvent = { type: 'test:diagnostic', data: { nesting: 0, details: {}, message: 'diagnostic' }, }; -const reportedDiagnosticEvent = { - type: 'test:diagnostic', - data: { ...diagnosticEvent.data, entryFile }, -}; const chunks = await toArray(serializer([diagnosticEvent])); const defaultSerializer = new DefaultSerializer(); defaultSerializer.writeHeader(); @@ -73,28 +67,28 @@ describe('v8 deserializer', common.mustCall(() => { it('should deserialize a chunk with no serialization', async () => { const reported = await collectReported([Buffer.from('unknown')]); assert.deepStrictEqual(reported, [ - { data: { __proto__: null, entryFile, file: 'filetest', message: 'unknown' }, type: 'test:stdout' }, + { data: { __proto__: null, file: 'filetest', message: 'unknown' }, type: 'test:stdout' }, ]); }); it('should deserialize a serialized chunk', async () => { const reported = await collectReported(chunks); - assert.deepStrictEqual(reported, [reportedDiagnosticEvent]); + assert.deepStrictEqual(reported, [diagnosticEvent]); }); it('should deserialize a serialized chunk after non-serialized chunk', async () => { const reported = await collectReported([Buffer.concat([Buffer.from('unknown'), ...chunks])]); assert.deepStrictEqual(reported, [ - { data: { __proto__: null, entryFile, file: 'filetest', message: 'unknown' }, type: 'test:stdout' }, - reportedDiagnosticEvent, + { data: { __proto__: null, file: 'filetest', message: 'unknown' }, type: 'test:stdout' }, + diagnosticEvent, ]); }); it('should deserialize a serialized chunk before non-serialized output', async () => { const reported = await collectReported([Buffer.concat([ ...chunks, Buffer.from('unknown')])]); assert.deepStrictEqual(reported, [ - reportedDiagnosticEvent, - { data: { __proto__: null, entryFile, file: 'filetest', message: 'unknown' }, type: 'test:stdout' }, + diagnosticEvent, + { data: { __proto__: null, file: 'filetest', message: 'unknown' }, type: 'test:stdout' }, ]); }); @@ -137,7 +131,7 @@ describe('v8 deserializer', common.mustCall(() => { oversizedLengthHeader, ...chunks, ]); - assert.deepStrictEqual(reported.at(-1), reportedDiagnosticEvent); + assert.deepStrictEqual(reported.at(-1), diagnosticEvent); assert.strictEqual(reported.filter((event) => event.type === 'test:diagnostic').length, 1); assert.strictEqual(collectStdout(reported), oversizedLengthStdout); }); @@ -158,7 +152,7 @@ describe('v8 deserializer', common.mustCall(() => { const data = chunks[0]; const reported = await collectReported([data.subarray(0, i), data.subarray(i)]); assert.deepStrictEqual(reported, [ - reportedDiagnosticEvent, + diagnosticEvent, ]); }); @@ -169,9 +163,9 @@ describe('v8 deserializer', common.mustCall(() => { Buffer.concat([data.subarray(i), Buffer.from('unknown')]), ]); assert.deepStrictEqual(reported, [ - { data: { __proto__: null, entryFile, file: 'filetest', message: 'unknown' }, type: 'test:stdout' }, - reportedDiagnosticEvent, - { data: { __proto__: null, entryFile, file: 'filetest', message: 'unknown' }, type: 'test:stdout' }, + { data: { __proto__: null, file: 'filetest', message: 'unknown' }, type: 'test:stdout' }, + diagnosticEvent, + { data: { __proto__: null, file: 'filetest', message: 'unknown' }, type: 'test:stdout' }, ]); } ); diff --git a/test/parallel/test-sqlite-statement-sync.js b/test/parallel/test-sqlite-statement-sync.js index b3a1dc434537c3..aa7a3a73ae6649 100644 --- a/test/parallel/test-sqlite-statement-sync.js +++ b/test/parallel/test-sqlite-statement-sync.js @@ -53,29 +53,6 @@ suite('StatementSync.prototype.get()', () => { const stmt = db.prepare('SELECT 1 as __proto__, 2 as constructor, 3 as toString'); t.assert.deepStrictEqual(stmt.get(), { __proto__: null, ['__proto__']: 1, constructor: 2, toString: 3 }); }); - - test('reflects an added column after the schema changes', (t) => { - using db = new DatabaseSync(':memory:'); - db.exec('CREATE TABLE storage(key TEXT, val TEXT)'); - db.prepare('INSERT INTO storage (key, val) VALUES (?, ?)').run('key1', 'val1'); - const stmt = db.prepare('SELECT * FROM storage ORDER BY key'); - db.exec("ALTER TABLE storage ADD COLUMN extra TEXT DEFAULT 'def'"); - t.assert.deepStrictEqual(stmt.get(), { - __proto__: null, key: 'key1', val: 'val1', extra: 'def', - }); - }); - - test('reflects a dropped column after the schema changes', (t) => { - using db = new DatabaseSync(':memory:'); - db.exec('CREATE TABLE storage(key TEXT, val TEXT, extra TEXT)'); - db.prepare('INSERT INTO storage (key, val, extra) VALUES (?, ?, ?)') - .run('key1', 'val1', 'x'); - const stmt = db.prepare('SELECT * FROM storage ORDER BY key'); - db.exec('ALTER TABLE storage DROP COLUMN extra'); - t.assert.deepStrictEqual(stmt.get(), { - __proto__: null, key: 'key1', val: 'val1', - }); - }); }); suite('StatementSync.prototype.all()', () => { @@ -106,29 +83,6 @@ suite('StatementSync.prototype.all()', () => { { __proto__: null, key: 'key2', val: 'val2' }, ]); }); - - test('reflects an added column after the schema changes', (t) => { - using db = new DatabaseSync(':memory:'); - db.exec('CREATE TABLE storage(key TEXT, val TEXT)'); - db.prepare('INSERT INTO storage (key, val) VALUES (?, ?)').run('key1', 'val1'); - const stmt = db.prepare('SELECT * FROM storage ORDER BY key'); - db.exec("ALTER TABLE storage ADD COLUMN extra TEXT DEFAULT 'def'"); - t.assert.deepStrictEqual(stmt.all(), [ - { __proto__: null, key: 'key1', val: 'val1', extra: 'def' }, - ]); - }); - - test('reflects a dropped column after the schema changes', (t) => { - using db = new DatabaseSync(':memory:'); - db.exec('CREATE TABLE storage(key TEXT, val TEXT, extra TEXT)'); - db.prepare('INSERT INTO storage (key, val, extra) VALUES (?, ?, ?)') - .run('key1', 'val1', 'x'); - const stmt = db.prepare('SELECT * FROM storage ORDER BY key'); - db.exec('ALTER TABLE storage DROP COLUMN extra'); - t.assert.deepStrictEqual(stmt.all(), [ - { __proto__: null, key: 'key1', val: 'val1' }, - ]); - }); }); suite('StatementSync.prototype.iterate()', () => { @@ -171,29 +125,6 @@ suite('StatementSync.prototype.iterate()', () => { } }); - test('reflects an added column after the schema changes', (t) => { - using db = new DatabaseSync(':memory:'); - db.exec('CREATE TABLE storage(key TEXT, val TEXT)'); - db.prepare('INSERT INTO storage (key, val) VALUES (?, ?)').run('key1', 'val1'); - const stmt = db.prepare('SELECT * FROM storage ORDER BY key'); - db.exec("ALTER TABLE storage ADD COLUMN extra TEXT DEFAULT 'def'"); - t.assert.deepStrictEqual(stmt.iterate().toArray(), [ - { __proto__: null, key: 'key1', val: 'val1', extra: 'def' }, - ]); - }); - - test('reflects a dropped column after the schema changes', (t) => { - using db = new DatabaseSync(':memory:'); - db.exec('CREATE TABLE storage(key TEXT, val TEXT, extra TEXT)'); - db.prepare('INSERT INTO storage (key, val, extra) VALUES (?, ?, ?)') - .run('key1', 'val1', 'x'); - const stmt = db.prepare('SELECT * FROM storage ORDER BY key'); - db.exec('ALTER TABLE storage DROP COLUMN extra'); - t.assert.deepStrictEqual(stmt.iterate().toArray(), [ - { __proto__: null, key: 'key1', val: 'val1' }, - ]); - }); - test('iterator keeps the prepared statement from being collected', (t) => { const db = new DatabaseSync(':memory:'); db.exec(` diff --git a/test/parallel/test-stream-iter-broadcast-from.js b/test/parallel/test-stream-iter-broadcast-from.js index 39d92c2aef49b3..0203252f26229a 100644 --- a/test/parallel/test-stream-iter-broadcast-from.js +++ b/test/parallel/test-stream-iter-broadcast-from.js @@ -43,28 +43,6 @@ async function testBroadcastFromStringChunks() { assert.strictEqual(data, 'foobar'); } -async function testBroadcastFromStringInput() { - const { broadcast: bc } = Broadcast.from('abc'); - const consumer = bc.push(); - const data = await text(consumer); - assert.strictEqual(data, 'abc'); -} - -async function testBroadcastFromUint8ArrayInput() { - const { broadcast: bc } = Broadcast.from(new Uint8Array([97])); - const consumer = bc.push(); - const data = await text(consumer); - assert.strictEqual(data, 'a'); -} - -async function testBroadcastFromDataViewInput() { - const view = new DataView(new Uint8Array([104, 105]).buffer); - const { broadcast: bc } = Broadcast.from(view); - const consumer = bc.push(); - const data = await text(consumer); - assert.strictEqual(data, 'hi'); -} - async function testBroadcastFromMultipleConsumers() { const source = from('shared-data'); const { broadcast: bc } = Broadcast.from(source); @@ -202,9 +180,6 @@ Promise.all([ testBroadcastFromAsyncIterable(), testBroadcastFromNonArrayChunks(), testBroadcastFromStringChunks(), - testBroadcastFromStringInput(), - testBroadcastFromUint8ArrayInput(), - testBroadcastFromDataViewInput(), testBroadcastFromMultipleConsumers(), testAbortSignal(), testAlreadyAbortedSignal(), diff --git a/test/parallel/test-stream-iter-consumers-bytes.js b/test/parallel/test-stream-iter-consumers-bytes.js index 53d0a3858f87ec..e45ee991d587fd 100644 --- a/test/parallel/test-stream-iter-consumers-bytes.js +++ b/test/parallel/test-stream-iter-consumers-bytes.js @@ -14,7 +14,6 @@ const { arrayBufferSync, array, arraySync, - toAsyncStreamable, } = require('stream/iter'); // ============================================================================= @@ -52,55 +51,6 @@ async function testBytesAsyncAbort() { ); } -async function testAsyncConsumersAbortPendingNext() { - const consumers = [ - ['bytes', bytes], - ['text', text], - ['arrayBuffer', arrayBuffer], - ['array', array], - ]; - - for (const [name, consumer] of consumers) { - const ac = new AbortController(); - const reason = new Error(`${name} boom`); - - async function* never() { - await new Promise(() => {}); - yield []; - } - - const promise = consumer(never(), { __proto__: null, signal: ac.signal }); - ac.abort(reason); - - await assert.rejects(promise, reason); - } -} - -async function testAsyncConsumersAbortPendingNormalization() { - const consumers = [ - ['bytes', bytes], - ['text', text], - ['arrayBuffer', arrayBuffer], - ['array', array], - ]; - - for (const [name, consumer] of consumers) { - const ac = new AbortController(); - const reason = new Error(`${name} normalization boom`); - const source = { - __proto__: null, - [toAsyncStreamable]() { - return new Promise(() => {}); - }, - }; - - const promise = consumer(source, { __proto__: null, signal: ac.signal }); - ac.abort(reason); - - await assert.rejects(promise, reason); - } -} - async function testBytesEmpty() { const data = await bytes(from([])); assert.ok(data instanceof Uint8Array); @@ -253,8 +203,6 @@ Promise.all([ testBytesAsync(), testBytesAsyncLimit(), testBytesAsyncAbort(), - testAsyncConsumersAbortPendingNext(), - testAsyncConsumersAbortPendingNormalization(), testBytesEmpty(), testArrayBufferSyncBasic(), testArrayBufferAsync(), diff --git a/test/parallel/test-stream-iter-consumers-merge.js b/test/parallel/test-stream-iter-consumers-merge.js index 859fcf8c1580fa..97cc8b9ac89477 100644 --- a/test/parallel/test-stream-iter-consumers-merge.js +++ b/test/parallel/test-stream-iter-consumers-merge.js @@ -151,51 +151,6 @@ async function testMergeSignalMidIteration() { await assert.rejects(() => iter.next(), { name: 'AbortError' }); } -async function testMergeSignalDuringPendingMultiSourceRead() { - const ac = new AbortController(); - - async function* pending() { - await new Promise(() => {}); - yield []; - } - - const iter = merge(pending(), pending(), { - __proto__: null, - signal: ac.signal, - })[Symbol.asyncIterator](); - - const next = iter.next(); - ac.abort(); - - await assert.rejects(next, { name: 'AbortError' }); -} - -async function testMergeDoesNotDrainSourcesWhileIdle() { - function source(n) { - return { - __proto__: null, - pulls: 0, - async *[Symbol.asyncIterator]() { - while (this.pulls < n) { - yield [Buffer.from(`${++this.pulls}`)]; - } - }, - }; - } - - const a = source(5); - const b = source(5); - const iterator = merge(a, b)[Symbol.asyncIterator](); - - await iterator.next(); - await new Promise(setImmediate); - - assert.strictEqual(a.pulls, 1); - assert.strictEqual(b.pulls, 1); - - await iterator.return?.(); -} - // merge() accepts string sources (normalized via from()) async function testMergeStringSources() { const batches = []; @@ -331,8 +286,6 @@ Promise.all([ testMergeSourceError(), testMergeConsumerBreak(), testMergeSignalMidIteration(), - testMergeSignalDuringPendingMultiSourceRead(), - testMergeDoesNotDrainSourcesWhileIdle(), testMergeStringSources(), testMergeObjectLikeSources(), testMergeCleanupErrorOnly(), diff --git a/test/parallel/test-stream-iter-from-sync.js b/test/parallel/test-stream-iter-from-sync.js index 50d85dc94a98b7..d3a5cf671e10d8 100644 --- a/test/parallel/test-stream-iter-from-sync.js +++ b/test/parallel/test-stream-iter-from-sync.js @@ -3,7 +3,7 @@ const common = require('../common'); const assert = require('assert'); -const { fromSync, textSync } = require('stream/iter'); +const { fromSync } = require('stream/iter'); function testFromSyncString() { // String input should be UTF-8 encoded @@ -186,30 +186,6 @@ function testFromSyncRejectsAsyncIterable() { assert.throws(() => fromSync(gen()), { code: 'ERR_INVALID_ARG_TYPE' }); } -function testFromSyncPrefersIteratorForDualIterable() { - const input = { - *[Symbol.iterator]() { - yield new TextEncoder().encode('sync'); - }, - async *[Symbol.asyncIterator]() { - yield new TextEncoder().encode('async'); - }, - }; - - assert.strictEqual(textSync(fromSync(input)), 'sync'); -} - -function testFromSyncPrefersIteratorForThenableIterable() { - const input = { - then() {}, - *[Symbol.iterator]() { - yield new TextEncoder().encode('sync'); - }, - }; - - assert.strictEqual(textSync(fromSync(input)), 'sync'); -} - // Promise rejected function testFromSyncRejectsPromise() { assert.throws(() => fromSync(Promise.resolve('hello')), @@ -256,8 +232,6 @@ Promise.all([ testFromSyncTopLevelProtocolOverIterator(), testFromSyncIgnoresAsyncStreamable(), testFromSyncRejectsAsyncIterable(), - testFromSyncPrefersIteratorForDualIterable(), - testFromSyncPrefersIteratorForThenableIterable(), testFromSyncRejectsPromise(), testFromSyncDataView(), ]).then(common.mustCall()); diff --git a/test/parallel/test-stream-iter-validation.js b/test/parallel/test-stream-iter-validation.js index ecefaeb171ec41..19cde169d6f496 100644 --- a/test/parallel/test-stream-iter-validation.js +++ b/test/parallel/test-stream-iter-validation.js @@ -157,8 +157,9 @@ assert.throws(() => broadcast({ backpressure: 'bad' }), { code: 'ERR_INVALID_ARG writer.endSync(); } -// Broadcast.from rejects non-streamable input +// Broadcast.from rejects non-iterable input assert.throws(() => Broadcast.from(42), { code: 'ERR_INVALID_ARG_TYPE' }); +assert.throws(() => Broadcast.from('bad'), { code: 'ERR_INVALID_ARG_TYPE' }); // ============================================================================= // share() / shareSync() validation diff --git a/test/parallel/test-stream-readable-async-iter-half-open-duplex.js b/test/parallel/test-stream-readable-async-iter-half-open-duplex.js deleted file mode 100644 index 13e0d4b2f3dffc..00000000000000 --- a/test/parallel/test-stream-readable-async-iter-half-open-duplex.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('assert'); -const { - Duplex, -} = require('stream'); - -{ - let written = ''; - - const duplex = new Duplex({ - allowHalfOpen: true, - read() { - this.push('hello'); - this.push(null); - }, - write(chunk, encoding, callback) { - written += chunk; - callback(); - }, - }); - - duplex.on('error', common.mustNotCall()); - duplex.on('close', common.mustCall()); - - (async () => { - let read = ''; - for await (const chunk of duplex) { - read += chunk; - } - - assert.strictEqual(read, 'hello'); - assert.strictEqual(duplex.destroyed, false); - - duplex.write('world', common.mustSucceed(() => { - assert.strictEqual(written, 'world'); - duplex.end(); - })); - })().then(common.mustCall()); -} diff --git a/test/parallel/test-tls-check-server-identity.js b/test/parallel/test-tls-check-server-identity.js index e21f39ccc76341..4863fca55165ee 100644 --- a/test/parallel/test-tls-check-server-identity.js +++ b/test/parallel/test-tls-check-server-identity.js @@ -100,27 +100,6 @@ const tests = [ cert: { subject: { CN: '8.8.8.8' }, subjectaltname: 'IP Address:8.8.8.8' } }, - // An "IP Address:" SAN also matches an IPv6 host. Regression test for the - // IDNA-normalization change: domainToASCII('::1') === '' (an IPv6 literal is - // not a domain), which made the normalized host skip IPv6 IP-SAN matching. - { - host: '::1', - cert: { subject: {}, subjectaltname: 'IP Address:::1' } - }, - - // IPv6 hosts and SANs are matched canonically. - { - host: '2001:db8::1', - cert: { subject: {}, subjectaltname: 'IP Address:2001:DB8:0:0:0:0:0:1' } - }, - - // A non-matching IPv6 "IP Address:" SAN is rejected. - { - host: '::1', - cert: { subject: {}, subjectaltname: 'IP Address:::2' }, - error: 'IP: ::1 is not in the cert\'s list: ::2' - }, - // But not when it's a CIDR. { host: '8.8.8.8', diff --git a/test/parallel/test-tls-client-getephemeralkeyinfo.js b/test/parallel/test-tls-client-getephemeralkeyinfo.js index ea6dec7bdc4629..2107d024012c4d 100644 --- a/test/parallel/test-tls-client-getephemeralkeyinfo.js +++ b/test/parallel/test-tls-client-getephemeralkeyinfo.js @@ -18,6 +18,9 @@ const tls = require('tls'); const key = fixtures.readKey('agent2-key.pem'); const cert = fixtures.readKey('agent2-cert.pem'); +// TODO(@sam-github) test works with TLS1.3, rework test to add +// 'ECDH' with 'TLS_AES_128_GCM_SHA256', + function loadDHParam(n) { return fixtures.readKey(`dh${n}.pem`); } @@ -86,57 +89,3 @@ test(256, 'ECDH', 'prime256v1', 'ECDHE-RSA-AES256-GCM-SHA384'); test(521, 'ECDH', 'secp521r1', 'ECDHE-RSA-AES256-GCM-SHA384'); test(253, 'ECDH', 'X25519', 'ECDHE-RSA-AES256-GCM-SHA384'); test(448, 'ECDH', 'X448', 'ECDHE-RSA-AES256-GCM-SHA384'); - -function testTLS13Group(size, type, name) { - const options = { - key, - cert, - ecdhCurve: name, - minVersion: 'TLSv1.3', - maxVersion: 'TLSv1.3', - }; - - const server = tls.createServer(options, common.mustCall((conn) => { - assert.strictEqual(conn.getEphemeralKeyInfo(), null); - conn.end(); - })); - - server.on('close', common.mustSucceed()); - - server.listen(0, common.mustCall(() => { - const client = tls.connect({ - port: server.address().port, - rejectUnauthorized: false, - ecdhCurve: name, - minVersion: 'TLSv1.3', - maxVersion: 'TLSv1.3', - }, common.mustCall(() => { - const ekeyinfo = client.getEphemeralKeyInfo(); - assert.strictEqual(ekeyinfo.type, type); - assert.strictEqual(ekeyinfo.size, size); - assert.strictEqual(ekeyinfo.name, name); - server.close(); - })); - client.on('secureConnect', common.mustCall()); - })); -} - -testTLS13Group(253, 'ECDH', 'X25519'); - -if (hasOpenSSL(3, 5)) { - const tls13Groups = [ - 'MLKEM512', - 'MLKEM768', - 'MLKEM1024', - 'SecP256r1MLKEM768', - 'X25519MLKEM768', - 'SecP384r1MLKEM1024', - ]; - - if (hasOpenSSL(4, 0)) { - tls13Groups.push('curveSM2'); - tls13Groups.push('curveSM2MLKEM768'); - } - - tls13Groups.forEach((name) => testTLS13Group(undefined, 'TLSGroup', name)); -} diff --git a/test/parallel/test-tls-connect-secure-context.js b/test/parallel/test-tls-connect-secure-context.js index 442973118a563f..a0d9170c20904f 100644 --- a/test/parallel/test-tls-connect-secure-context.js +++ b/test/parallel/test-tls-connect-secure-context.js @@ -23,9 +23,6 @@ connect({ return cleanup(); })); -// Invalid dhparam input is silently discarded for compatibility. -tls.createSecureContext({ dhparam: fixtures.readKey('ec-key.pem') }); - connect({ client: { servername: 'agent1', diff --git a/test/parallel/test-tls-over-http-tunnel.js b/test/parallel/test-tls-over-http-tunnel.js index e16400d06aece9..baef7a56f6884a 100644 --- a/test/parallel/test-tls-over-http-tunnel.js +++ b/test/parallel/test-tls-over-http-tunnel.js @@ -61,7 +61,7 @@ const proxy = net.createServer(common.mustCall((clientSocket) => { `CONNECT localhost:${server.address().port} ` + 'HTTP/1.1\r\n' + 'Proxy-Connections: keep-alive\r\n' + - `Host: localhost:${server.address().port}\r\n` + + `Host: localhost:${proxy.address().port}\r\n` + 'Connection: keep-alive\r\n\r\n'); console.log('PROXY: got CONNECT request'); diff --git a/test/parallel/test-vfs-fd.js b/test/parallel/test-vfs-fd.js index f9f6b25f51ce57..ec9145189da299 100644 --- a/test/parallel/test-vfs-fd.js +++ b/test/parallel/test-vfs-fd.js @@ -80,26 +80,6 @@ const vfs = require('node:vfs'); myVfs.closeSync(fd); } -// Test readSync with Node's current-position sentinel -{ - const myVfs = vfs.create(); - myVfs.writeFileSync('/file.txt', 'hello world'); - - const fd = myVfs.openSync('/file.txt'); - const buffer1 = Buffer.alloc(5); - const buffer2 = Buffer.alloc(6); - - let bytesRead = myVfs.readSync(fd, buffer1, 0, 5, -1); - assert.strictEqual(bytesRead, 5); - assert.strictEqual(buffer1.toString(), 'hello'); - - bytesRead = myVfs.readSync(fd, buffer2, 0, 6, -1); - assert.strictEqual(bytesRead, 6); - assert.strictEqual(buffer2.toString(), ' world'); - - myVfs.closeSync(fd); -} - // Test readSync with explicit position { const myVfs = vfs.create(); diff --git a/test/parallel/test-vfs-file-handle.js b/test/parallel/test-vfs-file-handle.js index d9d919446b8ea6..6c653593ce7ea2 100644 --- a/test/parallel/test-vfs-file-handle.js +++ b/test/parallel/test-vfs-file-handle.js @@ -82,12 +82,6 @@ myVfs.writeFileSync('/file.txt', 'hello world'); myVfs.writeSync(fd, buf, 0, 3, 0); myVfs.closeSync(fd); - const fd3 = myVfs.openSync('/sync-current.txt', 'w'); - myVfs.writeSync(fd3, Buffer.from('abc'), 0, 3, -1); - myVfs.writeSync(fd3, Buffer.from('def'), 0, 3, -1); - myVfs.closeSync(fd3); - assert.strictEqual(myVfs.readFileSync('/sync-current.txt', 'utf8'), 'abcdef'); - const fd2 = myVfs.openSync('/sync.txt', 'r'); const out = Buffer.alloc(3); myVfs.readSync(fd2, out, 0, 3, 0); diff --git a/test/parallel/test-vfs-fs-openSync.js b/test/parallel/test-vfs-fs-openSync.js index 28fa17d28b3cf6..f2c73f0d634469 100644 --- a/test/parallel/test-vfs-fs-openSync.js +++ b/test/parallel/test-vfs-fs-openSync.js @@ -30,19 +30,6 @@ myVfs.mount(mountPoint); fs.closeSync(fd); } -// readSync with position null uses and advances the current file position -{ - const fd = fs.openSync(path.join(mountPoint, 'src/hello.txt'), 'r'); - const b1 = Buffer.alloc(5); - const b2 = Buffer.alloc(6); - - assert.strictEqual(fs.readSync(fd, b1, 0, 5, null), 5); - assert.strictEqual(fs.readSync(fd, b2, 0, 6, null), 6); - assert.strictEqual(b1.toString(), 'hello'); - assert.strictEqual(b2.toString(), ' world'); - fs.closeSync(fd); -} - // openSync + writeSync (buffer) + closeSync { const fd = fs.openSync(path.join(mountPoint, 'src/wfd.txt'), 'w'); diff --git a/test/parallel/test-vfs-fs-writeFileSync.js b/test/parallel/test-vfs-fs-writeFileSync.js index eeed2a685f08e3..7469127bb1fde3 100644 --- a/test/parallel/test-vfs-fs-writeFileSync.js +++ b/test/parallel/test-vfs-fs-writeFileSync.js @@ -26,63 +26,4 @@ assert.strictEqual(fs.readFileSync(target, 'utf8'), 'fresh more'); fs.writeFileSync(target, Buffer.from('binary')); assert.strictEqual(fs.readFileSync(target, 'utf8'), 'binary'); -// writeFileSync via a VFS fd writes through the open descriptor. -{ - const fdTarget = path.join(mountPoint, 'src/fd.txt'); - const fd = fs.openSync(fdTarget, 'w+'); - try { - fs.writeFileSync(fd, 'hello'); - fs.writeFileSync(fd, new Uint8Array(Buffer.from(' world'))); - assert.strictEqual(fs.readFileSync(fdTarget, 'utf8'), 'hello world'); - } finally { - fs.closeSync(fd); - } -} - -// appendFileSync via a VFS fd follows normal fd write semantics. -{ - const fdTarget = path.join(mountPoint, 'src/append-fd.txt'); - fs.writeFileSync(fdTarget, 'start'); - const fd = fs.openSync(fdTarget, 'a'); - try { - fs.appendFileSync(fd, ' end'); - assert.strictEqual(fs.readFileSync(fdTarget, 'utf8'), 'start end'); - } finally { - fs.closeSync(fd); - } -} - myVfs.unmount(); - -// writeFileSync via a RealFSProvider fd remains tied to the open descriptor -// after the backing path is renamed. -{ - const root = path.join('/tmp', 'vfs-real-writeFileSync-' + process.pid); - const realMountPoint = path.join('/tmp', 'vfs-real-writeFileSync-mount-' + process.pid); - fs.rmSync(root, { recursive: true, force: true }); - fs.rmSync(realMountPoint, { recursive: true, force: true }); - fs.mkdirSync(root, { recursive: true }); - fs.mkdirSync(realMountPoint, { recursive: true }); - - const realVfs = vfs - .create(new vfs.RealFSProvider(root), { emitExperimentalWarning: false }) - .mount(realMountPoint); - try { - const mountedFile = path.join(realMountPoint, 'a.txt'); - fs.writeFileSync(path.join(root, 'a.txt'), 'old'); - const fd = fs.openSync(mountedFile, 'r+'); - try { - fs.renameSync(path.join(root, 'a.txt'), path.join(root, 'b.txt')); - fs.writeFileSync(path.join(root, 'a.txt'), 'new'); - fs.writeFileSync(fd, 'updated'); - assert.strictEqual(fs.readFileSync(path.join(root, 'b.txt'), 'utf8'), 'updated'); - assert.strictEqual(fs.readFileSync(path.join(root, 'a.txt'), 'utf8'), 'new'); - } finally { - fs.closeSync(fd); - } - } finally { - realVfs.unmount(); - fs.rmSync(root, { recursive: true, force: true }); - fs.rmSync(realMountPoint, { recursive: true, force: true }); - } -} diff --git a/test/parallel/test-vfs-mkdir.js b/test/parallel/test-vfs-mkdir.js index 22487324d242c4..87a823b77d87ca 100644 --- a/test/parallel/test-vfs-mkdir.js +++ b/test/parallel/test-vfs-mkdir.js @@ -4,7 +4,7 @@ // mkdirSync / rmdirSync behaviour: return value, recursive option, mode // option, error cases. -const common = require('../common'); +require('../common'); const assert = require('assert'); const vfs = require('node:vfs'); @@ -17,51 +17,6 @@ const vfs = require('node:vfs'); assert.strictEqual(result, '/a/b'); } -// Recursive mkdir follows symlinked intermediate directories, but returns the -// path of the first created directory as requested by the caller. -{ - const myVfs = vfs.create(); - myVfs.mkdirSync('/target'); - myVfs.symlinkSync('/target', '/link'); - - const result = myVfs.mkdirSync('/link/subdir/deep', { recursive: true }); - - assert.strictEqual(result, '/link/subdir'); - assert.strictEqual(myVfs.existsSync('/target/subdir/deep'), true); - assert.strictEqual(myVfs.existsSync('/link/subdir/deep'), true); -} - -// Recursive mkdir also resolves relative symlink targets from the symlink's -// resolved parent directory. -{ - const myVfs = vfs.create(); - myVfs.mkdirSync('/parent/target', { recursive: true }); - myVfs.symlinkSync('target', '/parent/link'); - - myVfs.mkdirSync('/parent/link/subdir', { recursive: true }); - - assert.strictEqual(myVfs.existsSync('/parent/target/subdir'), true); -} - -// Recursive mkdir through symlinks keeps native error behavior for bad -// intermediate targets. -{ - const myVfs = vfs.create(); - myVfs.symlinkSync('/missing', '/dangling'); - assert.throws( - () => myVfs.mkdirSync('/dangling/subdir', { recursive: true }), - { code: 'ENOENT' }); -} - -{ - const myVfs = vfs.create(); - myVfs.writeFileSync('/file', 'x'); - myVfs.symlinkSync('/file', '/link'); - assert.throws( - () => myVfs.mkdirSync('/link/subdir', { recursive: true }), - { code: 'ENOTDIR' }); -} - // mkdirSync with explicit mode (non-recursive) { const myVfs = vfs.create(); @@ -92,16 +47,3 @@ const vfs = require('node:vfs'); myVfs.writeFileSync('/d/x', ''); assert.throws(() => myVfs.rmdirSync('/d'), { code: 'ENOTEMPTY' }); } - -// promises.mkdir uses the same recursive symlink handling. -(async () => { - const myVfs = vfs.create(); - myVfs.mkdirSync('/target'); - myVfs.symlinkSync('/target', '/link'); - - const result = await myVfs.promises.mkdir('/link/subdir/deep', - { recursive: true }); - - assert.strictEqual(result, '/link/subdir'); - assert.strictEqual(myVfs.existsSync('/target/subdir/deep'), true); -})().then(common.mustCall()); diff --git a/test/parallel/test-vfs-readdir-symlink-recursive.js b/test/parallel/test-vfs-readdir-symlink-recursive.js index 33b52bb5d4a416..1f9661947c7444 100644 --- a/test/parallel/test-vfs-readdir-symlink-recursive.js +++ b/test/parallel/test-vfs-readdir-symlink-recursive.js @@ -3,7 +3,7 @@ // Recursive readdir must follow symlinks to directories. -const common = require('../common'); +require('../common'); const assert = require('assert'); const vfs = require('node:vfs'); @@ -21,59 +21,6 @@ assert.ok( `Expected 'symdir/nested.txt' in entries: ${entries}`, ); -// Recursive readdir avoids following symlink cycles indefinitely. -{ - const v = vfs.create(); - v.mkdirSync('/dir'); - v.writeFileSync('/dir/nested.txt', 'nested'); - v.symlinkSync('/dir', '/dir/loop'); - - assert.deepStrictEqual(v.readdirSync('/', { recursive: true }).sort(), [ - 'dir', - 'dir/loop', - 'dir/nested.txt', - ]); - - const dirents = v.readdirSync('/', { recursive: true, withFileTypes: true }); - assert.strictEqual(dirents.length, 3); - assert.ok(dirents.some((dirent) => - dirent.name === 'loop' && - dirent.parentPath === '/dir' && - dirent.isSymbolicLink())); -} - -// Recursive readdir avoids cycles through multiple symlinks. -{ - const v = vfs.create(); - v.mkdirSync('/a'); - v.mkdirSync('/b'); - v.symlinkSync('/b', '/a/link_to_b'); - v.symlinkSync('/a', '/b/link_to_a'); - - assert.deepStrictEqual(v.readdirSync('/', { recursive: true }).sort(), [ - 'a', - 'a/link_to_b', - 'a/link_to_b/link_to_a', - 'b', - 'b/link_to_a', - 'b/link_to_a/link_to_b', - ]); -} - -(async () => { - const v = vfs.create(); - v.mkdirSync('/dir'); - v.writeFileSync('/dir/nested.txt', 'nested'); - v.symlinkSync('/dir', '/dir/loop'); - - const entries = await v.promises.readdir('/', { recursive: true }); - assert.deepStrictEqual(entries.sort(), [ - 'dir', - 'dir/loop', - 'dir/nested.txt', - ]); -})().then(common.mustCall()); - // Recursive readdir with withFileTypes:true returns Dirent objects whose // parentPath reflects the actual location of the entry (not the entry's // stringified relative path). diff --git a/test/parallel/test-vfs-rename.js b/test/parallel/test-vfs-rename.js index 69daba43c11ddf..26506f01dd7338 100644 --- a/test/parallel/test-vfs-rename.js +++ b/test/parallel/test-vfs-rename.js @@ -44,17 +44,3 @@ const vfs = require('node:vfs'); assert.strictEqual(myVfs.existsSync('/d/a.txt'), false); assert.strictEqual(myVfs.existsSync('/d/b.txt'), true); } - -// Renaming a directory into its own descendant throws EINVAL -{ - const myVfs = vfs.create(); - myVfs.mkdirSync('/a/b', { recursive: true }); - myVfs.writeFileSync('/a/file.txt', 'data'); - - assert.throws(() => myVfs.renameSync('/a', '/a/b/c'), { code: 'EINVAL' }); - assert.deepStrictEqual(myVfs.readdirSync('/'), ['a']); - assert.strictEqual(myVfs.existsSync('/a'), true); - assert.strictEqual(myVfs.existsSync('/a/b'), true); - assert.strictEqual(myVfs.existsSync('/a/b/c'), false); - assert.strictEqual(myVfs.readFileSync('/a/file.txt', 'utf8'), 'data'); -} diff --git a/test/parallel/test-vm-global-restricted-property.js b/test/parallel/test-vm-global-restricted-property.js deleted file mode 100644 index e57cc8dc854613..00000000000000 --- a/test/parallel/test-vm-global-restricted-property.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; -require('../common'); -const assert = require('assert'); - -const vm = require('vm'); - -const ctx = vm.createContext({}); - -// Define a non-configurable ("restricted") property on the context global. -vm.runInContext( - "Object.defineProperty(this, 'foo', { value: 1, configurable: false });", - ctx -); - -// https://tc39.es/ecma262/#sec-globaldeclarationinstantiation 3.d: -// If hasRestrictedGlobal is true, throw a SyntaxError exception. -assert.throws( - () => vm.runInContext('let foo = 2;', ctx), - vm.runInContext('SyntaxError', ctx), -); diff --git a/test/parallel/test-vm-property-definer-partial-update.js b/test/parallel/test-vm-property-definer-partial-update.js deleted file mode 100644 index b2291b00a2ba73..00000000000000 --- a/test/parallel/test-vm-property-definer-partial-update.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict'; - -require('../common'); -const vm = require('vm'); -const assert = require('assert'); - -// Object.defineProperty should only modify specified attributes and preserve -// unspecified ones. Regression test for https://github.com/nodejs/node/issues/64008 -{ - const context = {}; - vm.createContext(context); - - // Changing enumerable should preserve value. - vm.runInContext(` - globalThis.a1 = 1; - Object.defineProperty(globalThis, 'a1', { enumerable: false }); - Object.defineProperty(globalThis, 'a2', { - value: 2, enumerable: false, configurable: true, - }); - Object.defineProperty(globalThis, 'a2', { enumerable: true }); - `, context); - assert.strictEqual(context.a1, 1); - assert.strictEqual( - Object.getOwnPropertyDescriptor(context, 'a1').enumerable, false); - assert.strictEqual(context.a2, 2); - assert.strictEqual( - Object.getOwnPropertyDescriptor(context, 'a2').enumerable, true); - - // Changing writable should preserve value. - vm.runInContext(` - globalThis.b1 = 1; - Object.defineProperty(globalThis, 'b1', { writable: false }); - Object.defineProperty(globalThis, 'b2', { - value: 2, writable: false, configurable: true, - }); - Object.defineProperty(globalThis, 'b2', { writable: true }); - `, context); - assert.strictEqual(context.b1, 1); - assert.strictEqual(context.b2, 2); - - // Changing value should preserve enumerable. - vm.runInContext(` - globalThis.c1 = 1; - Object.defineProperty(globalThis, 'c1', { value: 2 }); - Object.defineProperty(globalThis, 'c2', { - value: 1, enumerable: false, configurable: true, - }); - Object.defineProperty(globalThis, 'c2', { value: 2 }); - `, context); - assert.strictEqual(context.c1, 2); - assert.strictEqual( - Object.getOwnPropertyDescriptor(context, 'c1').enumerable, true); - assert.strictEqual(context.c2, 2); - assert.strictEqual( - Object.getOwnPropertyDescriptor(context, 'c2').enumerable, false); -} diff --git a/test/parallel/test-webstreams-queue-wraparound.js b/test/parallel/test-webstreams-queue-wraparound.js deleted file mode 100644 index 15ffc59689b981..00000000000000 --- a/test/parallel/test-webstreams-queue-wraparound.js +++ /dev/null @@ -1,178 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('assert'); - -// Regression test for the ring-buffer [[queue]] backing store used by the -// WHATWG stream controllers: exercises growth, wrap-around, drain-rewind -// and shrink behavior through the public API only. - -async function testDeepDefaultQueue() { - // Queue 3000 chunks before reading anything: the backing ring must grow - // (and re-linearize) repeatedly, then fully drain (shrink on rewind). - const rs = new ReadableStream({ - start(controller) { - for (let i = 0; i < 3000; i++) - controller.enqueue(i); - controller.close(); - }, - }, { highWaterMark: Infinity }); - - const reader = rs.getReader(); - for (let i = 0; i < 3000; i++) { - const { value, done } = await reader.read(); - assert.strictEqual(done, false); - assert.strictEqual(value, i); - } - const { done } = await reader.read(); - assert.strictEqual(done, true); -} - -async function testInterleavedWraparound() { - // Interleave enqueues and reads so head/tail wrap around the ring many - // times without ever growing it, including repeated empty transitions. - let enqueued = 0; - let controller; - const rs = new ReadableStream({ - start(c) { - controller = c; - }, - }); - - const reader = rs.getReader(); - let expected = 0; - for (let round = 0; round < 500; round++) { - const burst = (round % 3) + 1; - for (let i = 0; i < burst; i++) - controller.enqueue(enqueued++); - for (let i = 0; i < burst; i++) { - const { value, done } = await reader.read(); - assert.strictEqual(done, false); - assert.strictEqual(value, expected++); - } - } - assert.strictEqual(expected, enqueued); -} - -async function testCustomSizesSurviveQueueing() { - // Fractional and zero sizes must round-trip through the queue exactly - // (desiredSize accounting depends on the stored per-chunk size). - const sizes = [0.25, 0, 1.75, 3, 0.5]; - const chunks = ['a', 'b', 'c', 'd', 'e']; - let controller; - const rs = new ReadableStream({ - start(c) { - controller = c; - }, - }, { - highWaterMark: 10, - size(chunk) { - return sizes[chunks.indexOf(chunk)]; - }, - }); - - let expectedDesired = 10; - for (let i = 0; i < chunks.length; i++) { - controller.enqueue(chunks[i]); - expectedDesired -= sizes[i]; - assert.strictEqual(controller.desiredSize, expectedDesired); - } - const reader = rs.getReader(); - for (let i = 0; i < chunks.length; i++) { - const { value } = await reader.read(); - assert.strictEqual(value, chunks[i]); - expectedDesired += sizes[i]; - assert.strictEqual(controller.desiredSize, expectedDesired); - } -} - -async function testByteQueueUnevenReads() { - // Enqueue 7-byte chunks but read through 4-byte BYOB views: the byte - // queue's head record is partially consumed in place across reads. - const total = 7 * 300; - let written = 0; - const rs = new ReadableStream({ - type: 'bytes', - pull(controller) { - if (written >= total) { - controller.close(); - return; - } - const chunk = new Uint8Array(7); - for (let i = 0; i < 7; i++) - chunk[i] = (written + i) % 251; - written += 7; - controller.enqueue(chunk); - }, - }); - - const reader = rs.getReader({ mode: 'byob' }); - let read = 0; - while (read < total) { - const { value, done } = await reader.read(new Uint8Array(4)); - if (done) break; - for (let i = 0; i < value.length; i++) { - assert.strictEqual(value[i], (read + i) % 251, - `byte ${read + i} mismatch`); - } - read += value.length; - } - assert.strictEqual(read, total); -} - -async function testDeepByteQueueBurst() { - // Fill the byte queue with 2500 records before the default reader - // drains it, forcing ring growth and the drain-to-empty rewind. - const rs = new ReadableStream({ - type: 'bytes', - start(controller) { - for (let i = 0; i < 2500; i++) - controller.enqueue(new Uint8Array([i & 0xff])); - controller.close(); - }, - }); - - const reader = rs.getReader(); - for (let i = 0; i < 2500; i++) { - const { value, done } = await reader.read(); - assert.strictEqual(done, false); - assert.strictEqual(value[0], i & 0xff); - } - const { done } = await reader.read(); - assert.strictEqual(done, true); -} - -async function testWritableQueueBackpressureDrain() { - // Buffer thousands of writes behind a slow sink, then let it drain: - // the writable controller queue grows, wraps, and empties while every - // chunk is delivered in order. - const received = []; - let release; - const gate = new Promise((resolve) => { release = resolve; }); - const ws = new WritableStream({ - async write(chunk) { - if (received.length === 0) await gate; - received.push(chunk); - }, - }, { highWaterMark: 1 }); - - const writer = ws.getWriter(); - const writes = []; - for (let i = 0; i < 2000; i++) - writes.push(writer.write(i)); - release(); - await writer.close(); - await Promise.all(writes); - assert.strictEqual(received.length, 2000); - for (let i = 0; i < 2000; i++) - assert.strictEqual(received[i], i); -} - -(async () => { - await testDeepDefaultQueue(); - await testInterleavedWraparound(); - await testCustomSizesSurviveQueueing(); - await testByteQueueUnevenReads(); - await testDeepByteQueueBurst(); - await testWritableQueueBackpressureDrain(); -})().then(common.mustCall()); diff --git a/test/parallel/test-whatwg-readablestream.js b/test/parallel/test-whatwg-readablestream.js index d1001d51b4e8d1..2fd99d33929023 100644 --- a/test/parallel/test-whatwg-readablestream.js +++ b/test/parallel/test-whatwg-readablestream.js @@ -15,7 +15,6 @@ const { ByteLengthQueuingStrategy, CountQueuingStrategy, ReadableStream, - ReadableStreamTee, ReadableStreamDefaultReader, ReadableStreamDefaultController, ReadableByteStreamController, @@ -1528,28 +1527,6 @@ class Source { }).then(common.mustCall()); } -{ - // Test public ReadableStreamTee() cloneForBranch2 argument - assert.strictEqual(typeof ReadableStreamTee, 'function'); - const chunk = new Uint8Array([65]); - const readable = new ReadableStream({ - start(controller) { - controller.enqueue(chunk); - controller.close(); - }, - }); - const [r1, r2] = ReadableStreamTee(readable, true); - - (async () => { - const { value: value1 } = await r1.getReader().read(); - assert.strictEqual(value1[0], 65); - value1[0] = 66; - - const { value: value2 } = await r2.getReader().read(); - assert.strictEqual(value2[0], 65); - })().then(common.mustCall()); -} - { // Test tee() cloneForBranch2 argument const readable = new ReadableStream({ diff --git a/test/parallel/test-worker-stack-overflow-stack-size.js b/test/parallel/test-worker-stack-overflow-stack-size.js index 8aef401ab68ca5..481ff55100ac76 100644 --- a/test/parallel/test-worker-stack-overflow-stack-size.js +++ b/test/parallel/test-worker-stack-overflow-stack-size.js @@ -8,14 +8,6 @@ const { Worker } = require('worker_threads'); // Verify that Workers don't care about --stack-size, as they have their own // fixed and known stack sizes. -// The depth of the stack depends not only on the stack size, but also on the size of each -// stack frame, which in turn depends on which tier the recursive function happens to be -// running at when the overflow occurs. Under load the background tier-up can land at a -// non-deterministic point in the recursion and flake the test. Keep the recursive -// function in the interpreter with %NeverOptimizeFunction() so the frame size - -// and thus the depth - is deterministic. -v8.setFlagsFromString('--allow-natives-syntax'); - async function runWorker(options = {}) { const empiricalStackDepth = new Uint32Array(new SharedArrayBuffer(4)); const worker = new Worker(` @@ -24,7 +16,6 @@ async function runWorker(options = {}) { empiricalStackDepth[0]++; f(); } - %NeverOptimizeFunction(f); f();`, { eval: true, workerData: { empiricalStackDepth }, diff --git a/test/parallel/test-zlib-brotli-flush-invalid-kind.js b/test/parallel/test-zlib-brotli-flush-invalid-kind.js deleted file mode 100644 index af8a2c67d1d9a4..00000000000000 --- a/test/parallel/test-zlib-brotli-flush-invalid-kind.js +++ /dev/null @@ -1,92 +0,0 @@ -'use strict'; -// Regression test for https://github.com/nodejs/node/issues/63701. -// Invalid Brotli flush kinds used to spin in native code. flush(kind) should -// reject invalid kinds before writing the fake flush chunk. - -require('../common'); -const assert = require('assert'); -const zlib = require('zlib'); - -const { - BROTLI_OPERATION_PROCESS, - BROTLI_OPERATION_FLUSH, - BROTLI_OPERATION_FINISH, - BROTLI_OPERATION_EMIT_METADATA, - Z_NO_FLUSH, - Z_BLOCK, - Z_FINISH, - ZSTD_e_continue, - ZSTD_e_flush, - ZSTD_e_end, -} = zlib.constants; - -const noop = () => {}; - -const flushKindTestCases = [ - { - factories: [zlib.createGzip], - validKinds: [Z_NO_FLUSH, Z_FINISH, Z_BLOCK], - invalidKinds: [-1, 6, 100], - }, - { - factories: [zlib.createBrotliCompress, zlib.createBrotliDecompress], - validKinds: [ - BROTLI_OPERATION_PROCESS, - BROTLI_OPERATION_FLUSH, - BROTLI_OPERATION_FINISH, - BROTLI_OPERATION_EMIT_METADATA, - ], - invalidKinds: [-1, Z_FINISH, Z_BLOCK, 6, 100], - }, - { - factories: [zlib.createZstdCompress, zlib.createZstdDecompress], - validKinds: [ZSTD_e_continue, ZSTD_e_flush, ZSTD_e_end], - invalidKinds: [-1, 3, Z_FINISH, Z_BLOCK, 100], - }, -]; - -for (const { factories, validKinds } of flushKindTestCases) { - for (const factory of factories) { - for (const kind of validKinds) { - const stream = factory(); - stream.on('error', noop); - stream.flush(kind); - } - } -} - -for (const { factories, invalidKinds } of flushKindTestCases) { - for (const factory of factories) { - for (const kind of invalidKinds) { - assert.throws( - () => factory().flush(kind), - { code: 'ERR_OUT_OF_RANGE', name: 'RangeError' }, - ); - } - } -} - -for (const { factories } of flushKindTestCases) { - for (const factory of factories) { - for (const kind of ['foobar', null, {}]) { - assert.throws( - () => factory().flush(kind), - { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }, - ); - } - } -} - -for (const { factories } of flushKindTestCases) { - for (const factory of factories) { - for (const kind of [undefined, NaN]) { - const stream = factory(); - stream.on('error', noop); - stream.flush(kind); - } - - const stream = factory(); - stream.on('error', noop); - stream.flush(noop); - } -} diff --git a/test/sea/sea.status b/test/sea/sea.status index 9dc3a376bbc8be..3e521658c46dff 100644 --- a/test/sea/sea.status +++ b/test/sea/sea.status @@ -26,6 +26,11 @@ test-build-sea*: SKIP test-single-executable-application*: PASS, FLAKY test-build-sea*: PASS, FLAKY +[$system==win32] +# https://github.com/nodejs/node/issues/49630 +test-single-executable-application-snapshot: PASS, FLAKY +test-single-executable-application-snapshot-and-code-cache: PASS, FLAKY + [$system==solaris || $system==aix] # Cannot compile LIEF on these platforms test-build-sea*: SKIP diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status index 01a021130c15ca..627e61911d15ca 100644 --- a/test/sequential/sequential.status +++ b/test/sequential/sequential.status @@ -13,6 +13,10 @@ test-watch-mode-inspect: PASS, FLAKY # https://github.com/nodejs/node/issues/47409 test-http2-large-file: PASS, FLAKY +[$system==win32] +# https://github.com/nodejs/node/issues/47409 +test-http2-large-file: PASS, FLAKY + [$system==linux] # https://github.com/nodejs/node/issues/54817 test-http-server-request-timeouts-mixed: PASS, FLAKY diff --git a/test/sequential/test-dgram-implicit-bind-failure.js b/test/sequential/test-dgram-implicit-bind-failure.js index ec00022c693730..89da00d5766fb3 100644 --- a/test/sequential/test-dgram-implicit-bind-failure.js +++ b/test/sequential/test-dgram-implicit-bind-failure.js @@ -4,20 +4,19 @@ const common = require('../common'); const assert = require('assert'); const EventEmitter = require('events'); const dgram = require('dgram'); +const dns = require('dns'); const { kStateSymbol } = require('internal/dgram'); const mockError = new Error('fake DNS'); -const socket = dgram.createSocket('udp4'); - -// Fail the implicit bind by making the handle's address resolution fail. A -// literal bind address is not passed to dns.lookup(), so patching dns.lookup() -// would not be observed here. -socket[kStateSymbol].handle.lookup = function(address, callback) { +// Monkey patch dns.lookup() so that it always fails. +dns.lookup = function(address, family, callback) { process.nextTick(() => { callback(mockError); }); }; +const socket = dgram.createSocket('udp4'); + socket.on(EventEmitter.errorMonitor, common.mustCall((err) => { - // The bind should fail since the lookup is monkey patched. At that point in + // The DNS lookup should fail since it is monkey patched. At that point in // time, the send queue should be populated with the send() operation. assert.strictEqual(err, mockError); assert(Array.isArray(socket[kStateSymbol].queue)); diff --git a/tools/dep_updaters/c-ares.kbx b/tools/dep_updaters/c-ares.kbx deleted file mode 100644 index 720f1df36917d7ccb3c568ccc1ce3599967682f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4217 zcmb7`2T)Vpw#QFGfY7B11TcV7q$5oT9WNsFqXtQ6LZ~8yE>%FJNfo3?Zz4siN>iF3 zRS+VfDT4Ig5ri9f&wJn8`R2WOYi94W_S)r~+55Nu>i_@%2Y~>vrV0`R5X@0UwDG*0 z`~PLc-eAy$7YG25p8yzO<6T?c7LjdQ(VIx8Lw$n&e#1f6Mi>D*f&ie=k0w@X9JAwy4ZxU96Ts;4yB78y9c_aKa*&=(2puj0}bPoEU zrTx{oWm0;SoR(>RSKD@aX9)-T!J9t)9X$CD1MQYV=Dx$5U%xEnF6(ax3jXDp`tpSC zm8WVnFPlyD$hP#^y7YX`kV>cIoE@@4-qn8iPSX3k4+rf-<|8I{l2ppNU1#ph58q4X z4#hRa!UN2=H&5r<`B{%?KmJ}-@=n62<6X3d1(Aw^rS_3z;-%<7NR1V7R8wxQVyxNc za9Qj#@)_t3AYW2coe7KC_oDWK(BcL zz|PeU1Ula!n7xOGtE`BKn2e;bm^h)x$Owx|$%={HkQS?jt68}?*gC@vJZxR8ZLxN6 zgv~`j$==GxN7&s~;WgnP2up!4mI5L{(hzzOIlxH_KHqOJjEI8U0D&(D1LS0v{v5i@OVTsF>YS3NW1BfTMkQ7h{O>n`^zKtv6iaTkvoh>@^&C=eEC5Hqr6US4J68MG+g|<;-|(AHEe3-c7}l@1FOb+^_y7$@h4n)-+QW zw4m_>KV3fR0ocKz?Al$ZyTdjLE?DE(oWtcg6?8N>!}V?IRhtlca#G1!Esu(%_~?i! zUI2e(K|K}ud4x#yI&WcTXPwbup#ak5K;{ud`b3LU*!x#)TL^HaVT1G7C)%|%j=v<6 zEo^ot-#>`^yQaBnPf4OXI2J)={PF_TNYE7sGl3|wKSWXfPjZ&;k)9ctgcsjWe79BO zrM6}U_Osc_6xAo$h%$1o&!EgKO*M&h&AKk6Ap)VIu0Ar#>@4!(uc`8}RW^_z zIgK#8eteZNC%(dQ>{>Euw$b|O&WlrnS6P}=ku`iaR;Sz|GHvu^Or+D5 zKxD6pHqCw)>SQet)@d$6C8cl3kkVw1uLyBDp;+3K@Fp(QYy9lKG9BJzU=WJx@e}EM z@6kLh^mty48$G<-^(bnGdOG<``l!cgFey`pjg>9ikrtYI#)!>jAm*=kG@$p9?Ad1! zc6#hO6r8yU`Dn@Go$vUXKO^o})vUn1HyKrL@-T~!NB4TRw}q?zkb`qBA3Ba@x+N@| z-PLK8$5sgw3IYJ~AO9`8Sp;7cAOhIN18nBH1+Aa;y5~`I%?`;K(!S{-Xe9hxC_Pu4 zbLJJ|JI(~d<64J|X{+b36ol}F?2el29Ny@ZOnXE<`vf;sNcTwSc$v_LJfBCf3rPm! z2_F2sNqE!WO7eNvzhoIq1;JQo@q#V^gYDiB(Hw=C$;+dH8I*(B0rrImZS&*u?J^4vXp3YmVp@}}!I>B4a ztj~6)6_`z^ul_JI6pUgY);XdKL+9@1-1O8LNo6@K@>fd6dQ)h>3<=Eby=-2&PsHD; zCyBcD31Rp4zKWOxU?%%h#q~HyTr0uaNgB#ZJvdQ2qG4m+9pIWLsJHWK$#KwYy|=JL z{Ma_g@5kdfRtn+CpCX@X%{q&TZU`E%gwe#3D>`bW2v@ljm2*qTa(oHWBH~LmyZ1f{ zw!+wFWEsbR_#k{}IYV0UtgKf+F7;RC8fJW5$9%RWMwI1f^_KfQ3)e1EmP%nB{dRl9 zW~;0SZmIg&Y^F$1%hs|P6Eoint zUhtdcceL-OYfnAu<()#u;>_gh9WkqPh3*X`n8e&C?PZ{-TKI@jxRwh zC6J<4wSLv|`%7%{<3(y0%ZZZNm}o(}ybuHkGme)jmE2YO%Fn!+C%a|Hq2c#1Js$Bh zDjIWe&vz|kgXD(vw@YeY#XLm{eAJ6O<=vi;JP&eWP|jc23&;bbrB2rps(H(wWS%Vp zUPZbOND63;mMvzht(tR!2U$@Qvn;Oz?^NU-aX;#n?-V~=aWKqjsmSQx3@%mAsAn4T zt_-M+TWN+kk#C|^Ti@gKbO$Rky_j_bS7#e$(2Za2*qM!J)tAuRO>Q%E9|iq z*1Q@5GcKpyIOTW9F?C@#S*IC}W>|4nfFxT?boqW&*O$*TgEU6jL%s?R=SHd<(Ay2A zAlY!cMHwj>y=JRB7(+wrl0?O{{BTfK7_Gk4LeH8MYP{dw04q^cYksILk*WD{uHya- ze#nYmCu|8V&-Tl#qVKewR1;4-aA+da#ma>{Y5!PnMazbK* z0`UI@IUQy&3=BN_H+5cc2n!QAz)qO+cT#@{PK2y>x7vNzjgUMJHGpP}Jm zH$u#mcCb-AKcStrw%tsU#;a5#T|Y6N!#@q!Qq};#!LHO za-IeVjIz{veOeD5%0U5UY)*)QnosX6BT#8vcO+sXEu%(EMT}Yq7aew z>uYngePa*>k$Ptq*N{82*}aa{Pcim>u1g!(v|PpVgvWurP{TbDp2IaE)iL!u5lAl(L`q&gNp8|P1)T{xzd9bU$*5hDrC}if|dR0LBTO@z|P^RI=UXGRP6r&)`C(-486 zq>*5$|C@LsFzn(F?~l&1-l92%Xs21+rkprasxvn{`Qp_uYRcPPjIYq*WIW53Pi^nF zzQtS1@YGWzBE}>~Olb^@4JIBGDzy;X(#s%?s+>Ze6_!y`pljk8@66S0Rzv#Q67w91q>Bc!WyRSAdG9%(Ecy6$By zE<@d#kNeh7@&}YpDvg5Y@23mOWI8KiJ&)oUbI#CmD$!Ect**7YTVK||>~sFAGGQcw z_N@9=uc4Wji=0co+`v*&8Ex0;^6?a?7cN27atdfdf0R(OK-)W|TxlvHZzDzeUo$~p z!jrP)cAhu)A*38hTofBagi3qBS#fSN6C{_yP7M`9aLL31x1bgVOY6EjiJDzxo_0)W zyIft name.endsWith('.tar.gz')); if(!browser_download_url || !name) throw new Error('No tarball found'); -console.log(`${tag_name.replace(/^v/, '')} ${browser_download_url}`); +console.log(`${tag_name} ${browser_download_url} ${name}`); EOF )" -IFS=' ' read -r NEW_VERSION NEW_VERSION_URL < /dev/null || mktemp -d -t 'tmp') -ARES_TARBALL="$WORKSPACE/c-ares.tgz" cleanup () { EXIT_CODE=$? @@ -48,29 +47,29 @@ cleanup () { trap cleanup INT TERM EXIT +cd "$WORKSPACE" + echo "Fetching c-ares source archive" curl -sL -o "$ARES_TARBALL" "$NEW_VERSION_URL" - -echo "Verifying PGP signature" -curl -sL -o "$ARES_TARBALL.asc" "$NEW_VERSION_URL.asc" -gpgv --keyring "$BASE_DIR/tools/dep_updaters/c-ares.kbx" "${ARES_TARBALL}.asc" "${ARES_TARBALL}" - log_and_verify_sha256sum "c-ares" "$ARES_TARBALL" -tar -C "$WORKSPACE" -xzf "$ARES_TARBALL" +gzip -dc "$ARES_TARBALL" | tar xf - +rm -- "$ARES_TARBALL" + +FOLDER=$(ls -d -- */) -ARES_FOLDER=$(find "$WORKSPACE" -mindepth 1 -maxdepth 1 -type d -print -quit) +mv -- "$FOLDER" cares echo "Removing tests" -rm -rf "$ARES_FOLDER/test" +rm -rf "$WORKSPACE/cares/test" echo "Copying existing .gitignore, config, gyp and gn files" -cp -R "$DEPS_DIR/cares/config" "$ARES_FOLDER" -cp "$DEPS_DIR/cares/.gitignore" "$ARES_FOLDER" -cp "$DEPS_DIR/cares/cares.gyp" "$ARES_FOLDER" -cp "$DEPS_DIR/cares/"*.gn "$DEPS_DIR/cares/"*.gni "$ARES_FOLDER" +cp -R "$DEPS_DIR/cares/config" "$WORKSPACE/cares" +cp "$DEPS_DIR/cares/.gitignore" "$WORKSPACE/cares" +cp "$DEPS_DIR/cares/cares.gyp" "$WORKSPACE/cares" +cp "$DEPS_DIR/cares/"*.gn "$DEPS_DIR/cares/"*.gni "$WORKSPACE/cares" echo "Replacing existing c-ares" -replace_dir "$DEPS_DIR/cares" "$ARES_FOLDER" +replace_dir "$DEPS_DIR/cares" "$WORKSPACE/cares" echo "Updating cares.gyp" "$NODE" "$ROOT/tools/dep_updaters/update-c-ares.mjs" diff --git a/tools/doc/man-page.doc-kit.config.mjs b/tools/doc/man-page.doc-kit.config.mjs deleted file mode 100644 index bed71a8cb80c82..00000000000000 --- a/tools/doc/man-page.doc-kit.config.mjs +++ /dev/null @@ -1,21 +0,0 @@ -// @node-core/doc-kit configuration for generating and linting the Node.js -// man-page (doc/node.1). - -import { fileURLToPath } from 'node:url'; - -const root = new URL('../../', import.meta.url); - -const fromRoot = (path) => fileURLToPath(new URL(path, root)); - -export default { - target: ['man-page'], - - global: { - input: [fromRoot('doc/api/cli.md')], - output: fromRoot('tools/doc/.manpagecheck'), - - // Point every loadable URL at its local file so no network request is made. - changelog: fromRoot('CHANGELOG.md'), - index: fromRoot('doc/api/index.md'), - }, -}; diff --git a/tools/doc/package-lock.json b/tools/doc/package-lock.json index a63b70a7d3c3f3..9ee8c0128d17b3 100644 --- a/tools/doc/package-lock.json +++ b/tools/doc/package-lock.json @@ -6,13 +6,13 @@ "": { "name": "doc", "dependencies": { - "@node-core/doc-kit": "1.4.1" + "@node-core/doc-kit": "1.3.9" } }, "node_modules/@actions/core": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-3.0.1.tgz", - "integrity": "sha512-a6d/Nwahm9fliVGRhdhofo40HjHQasUPusmc7vBfyky+7Z+P2A1J68zyFVaNcEclc/Se+eO595oAr5nwEIoIUA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-3.0.0.tgz", + "integrity": "sha512-zYt6cz+ivnTmiT/ksRVriMBOiuoUpDCJJlZ5KPl2/FRdvwU3f7MPh9qftvbkXJThragzUZieit2nyHUyw53Seg==", "license": "MIT", "dependencies": { "@actions/exec": "^3.0.0", @@ -29,9 +29,9 @@ } }, "node_modules/@actions/http-client": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.1.tgz", - "integrity": "sha512-+Nvd1ImaOZBSoPbsUtEhv+1z99H12xzncCkz0a3RuehINE81FZSe2QTj3uvAPTcJX/SCzUQHQ0D1GrPMbrPitg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.0.tgz", + "integrity": "sha512-QuwPsgVMsD6qaPD57GLZi9sqzAZCtiJT8kVBCDpLtxhL5MydQ4gS+DrejtZZPdIYyB1e95uCK9Luyds7ybHI3g==", "license": "MIT", "dependencies": { "tunnel": "^0.0.6", @@ -44,6 +44,18 @@ "integrity": "sha512-nRBchcMM+QK1pdjO7/idu86rbJI5YHUKCvKs0KxnSYbVe3F51UfGxuZX4Qy/fWlp6l7gWFwIkrOzN+oUK03kfw==", "license": "MIT" }, + "node_modules/@alloc/quick-lru": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", + "integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@emnapi/core": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz", @@ -122,6 +134,51 @@ "react": ">= 16 || ^19.0.0-rc" } }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, "node_modules/@minify-html/wasm": { "version": "0.18.1", "resolved": "https://registry.npmjs.org/@minify-html/wasm/-/wasm-0.18.1.tgz", @@ -264,9 +321,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -283,9 +337,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -302,9 +353,6 @@ "cpu": [ "ppc64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -321,9 +369,6 @@ "cpu": [ "riscv64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -340,9 +385,6 @@ "cpu": [ "s390x" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -359,9 +401,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -378,9 +417,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -455,13 +491,13 @@ } }, "node_modules/@napi-rs/wasm-runtime": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz", - "integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.4.tgz", + "integrity": "sha512-3NQNNgA1YSlJb/kMH1ildASP9HW7/7kYnRI2szWJaofaS1hWmbGI4H+d3+22aGzXXN9IJ+n+GiFVcGipJP18ow==", "license": "MIT", "optional": true, "dependencies": { - "@tybys/wasm-util": "^0.10.3" + "@tybys/wasm-util": "^0.10.1" }, "funding": { "type": "github", @@ -477,7 +513,6 @@ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", "license": "MIT", - "peer": true, "engines": { "node": "^14.21.3 || >=16" }, @@ -486,19 +521,19 @@ } }, "node_modules/@node-core/doc-kit": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@node-core/doc-kit/-/doc-kit-1.4.1.tgz", - "integrity": "sha512-4S9cIGW6+3U3wWsCHRABJg5rjkTLU90Mdyb9v53ljf622A9u8sGQgSzVH9FgQHcKw5z3ofK25h12E/eDGi5SVA==", + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@node-core/doc-kit/-/doc-kit-1.3.9.tgz", + "integrity": "sha512-DVRaycj3humM/GJ4jFk5+kKrnzHEEKAqiNcUWsb/b0BCQePrqVl6sJ8L4E82HP2qTBq6EkNkwdEI5uf+w45tkA==", "dependencies": { "@actions/core": "^3.0.0", "@heroicons/react": "^2.2.0", "@minify-html/wasm": "^0.18.1", "@node-core/rehype-shiki": "^1.4.1", - "@node-core/ui-components": "^1.7.0", + "@node-core/ui-components": "^1.6.3", "@orama/orama": "^3.1.18", "@orama/ui": "^1.5.4", "@rollup/plugin-virtual": "^3.0.2", - "@swc/html-wasm": "^1.15.40", + "@swc/html-wasm": "^1.15.32", "acorn": "^8.16.0", "commander": "^14.0.3", "dedent": "^1.7.2", @@ -510,22 +545,21 @@ "hastscript": "^9.0.1", "lightningcss-wasm": "^1.32.0", "mdast-util-slice-markdown": "^2.0.1", - "piscina": "^5.2.0", - "preact": "^10.29.2", - "preact-render-to-string": "^6.7.0", + "piscina": "^5.1.4", + "preact": "^10.29.0", + "preact-render-to-string": "^6.6.7", "reading-time": "^1.5.0", "recma-jsx": "^1.0.1", "rehype-raw": "^7.0.0", "rehype-recma": "^1.0.0", "rehype-stringify": "^10.0.1", "remark-gfm": "^4.0.1", - "remark-mdx": "^3.1.1", "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-stringify": "^11.0.0", - "rolldown": "1.0.2", + "rolldown": "1.0.0-rc.17", "semver": "^7.8.0", - "shiki": "^4.1.0", + "shiki": "^4.0.2", "tinyglobby": "^0.2.15", "unified": "^11.0.5", "unist-builder": "^4.0.0", @@ -540,18 +574,30 @@ "doc-kit": "bin/cli.mjs" } }, + "node_modules/@node-core/doc-kit/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/@node-core/rehype-shiki": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@node-core/rehype-shiki/-/rehype-shiki-1.4.2.tgz", - "integrity": "sha512-H2T4bi9EZg0s0HLlcdANXzozrxeCfXzhZvbqUEygkggrv5pzJX9MVFU5K0/zGJfiqhzUu6TXMrNgpLqX1pylyw==", - "dependencies": { - "@shikijs/core": "^4.0.2", - "@shikijs/engine-javascript": "^4.0.2", - "@shikijs/engine-oniguruma": "^4.0.2", - "@shikijs/twoslash": "^4.0.2", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@node-core/rehype-shiki/-/rehype-shiki-1.4.1.tgz", + "integrity": "sha512-Ku63bR4wOq6MuZPRSNwj5NcVEU1zmQ+YtXRmwjIMm/Fdp8sZQVAhzyVJLjeYXDKTeYLRPYhtWu8jEu2+G9tumg==", + "dependencies": { + "@shikijs/core": "^3.22.0", + "@shikijs/engine-javascript": "^3.22.0", + "@shikijs/engine-oniguruma": "^3.22.0", + "@shikijs/twoslash": "^3.22.0", "classnames": "~2.5.1", "hast-util-to-string": "^3.0.1", - "shiki": "~4.0.2", + "shiki": "~3.22.0", "typescript": "5.9.3", "unist-util-visit": "^5.1.0" }, @@ -560,125 +606,89 @@ } }, "node_modules/@node-core/rehype-shiki/node_modules/@shikijs/core": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.0.2.tgz", - "integrity": "sha512-hxT0YF4ExEqB8G/qFdtJvpmHXBYJ2lWW7qTHDarVkIudPFE6iCIrqdgWxGn5s+ppkGXI0aEGlibI0PAyzP3zlw==", + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.22.0.tgz", + "integrity": "sha512-iAlTtSDDbJiRpvgL5ugKEATDtHdUVkqgHDm/gbD2ZS9c88mx7G1zSYjjOxp5Qa0eaW0MAQosFRmJSk354PRoQA==", "license": "MIT", "dependencies": { - "@shikijs/primitive": "4.0.2", - "@shikijs/types": "4.0.2", + "@shikijs/types": "3.22.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" - }, - "engines": { - "node": ">=20" } }, "node_modules/@node-core/rehype-shiki/node_modules/@shikijs/engine-javascript": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.0.2.tgz", - "integrity": "sha512-7PW0Nm49DcoUIQEXlJhNNBHyoGMjalRETTCcjMqEaMoJRLljy1Bi/EGV3/qLBgLKQejdspiiYuHGQW6dX94Nag==", + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.22.0.tgz", + "integrity": "sha512-jdKhfgW9CRtj3Tor0L7+yPwdG3CgP7W+ZEqSsojrMzCjD1e0IxIbwUMDDpYlVBlC08TACg4puwFGkZfLS+56Tw==", "license": "MIT", "dependencies": { - "@shikijs/types": "4.0.2", + "@shikijs/types": "3.22.0", "@shikijs/vscode-textmate": "^10.0.2", "oniguruma-to-es": "^4.3.4" - }, - "engines": { - "node": ">=20" } }, "node_modules/@node-core/rehype-shiki/node_modules/@shikijs/engine-oniguruma": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.0.2.tgz", - "integrity": "sha512-UpCB9Y2sUKlS9z8juFSKz7ZtysmeXCgnRF0dlhXBkmQnek7lAToPte8DkxmEYGNTMii72zU/lyXiCB6StuZeJg==", + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.22.0.tgz", + "integrity": "sha512-DyXsOG0vGtNtl7ygvabHd7Mt5EY8gCNqR9Y7Lpbbd/PbJvgWrqaKzH1JW6H6qFkuUa8aCxoiYVv8/YfFljiQxA==", "license": "MIT", "dependencies": { - "@shikijs/types": "4.0.2", + "@shikijs/types": "3.22.0", "@shikijs/vscode-textmate": "^10.0.2" - }, - "engines": { - "node": ">=20" } }, "node_modules/@node-core/rehype-shiki/node_modules/@shikijs/langs": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.0.2.tgz", - "integrity": "sha512-KaXby5dvoeuZzN0rYQiPMjFoUrz4hgwIE+D6Du9owcHcl6/g16/yT5BQxSW5cGt2MZBz6Hl0YuRqf12omRfUUg==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "4.0.2" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@node-core/rehype-shiki/node_modules/@shikijs/primitive": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.0.2.tgz", - "integrity": "sha512-M6UMPrSa3fN5ayeJwFVl9qWofl273wtK1VG8ySDZ1mQBfhCpdd8nEx7nPZ/tk7k+TYcpqBZzj/AnwxT9lO+HJw==", + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.22.0.tgz", + "integrity": "sha512-x/42TfhWmp6H00T6uwVrdTJGKgNdFbrEdhaDwSR5fd5zhQ1Q46bHq9EO61SCEWJR0HY7z2HNDMaBZp8JRmKiIA==", "license": "MIT", "dependencies": { - "@shikijs/types": "4.0.2", - "@shikijs/vscode-textmate": "^10.0.2", - "@types/hast": "^3.0.4" - }, - "engines": { - "node": ">=20" + "@shikijs/types": "3.22.0" } }, "node_modules/@node-core/rehype-shiki/node_modules/@shikijs/themes": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.0.2.tgz", - "integrity": "sha512-mjCafwt8lJJaVSsQvNVrJumbnnj1RI8jbUKrPKgE6E3OvQKxnuRoBaYC51H4IGHePsGN/QtALglWBU7DoKDFnA==", + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.22.0.tgz", + "integrity": "sha512-o+tlOKqsr6FE4+mYJG08tfCFDS+3CG20HbldXeVoyP+cYSUxDhrFf3GPjE60U55iOkkjbpY2uC3It/eeja35/g==", "license": "MIT", "dependencies": { - "@shikijs/types": "4.0.2" - }, - "engines": { - "node": ">=20" + "@shikijs/types": "3.22.0" } }, "node_modules/@node-core/rehype-shiki/node_modules/@shikijs/types": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.0.2.tgz", - "integrity": "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg==", + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.22.0.tgz", + "integrity": "sha512-491iAekgKDBFE67z70Ok5a8KBMsQ2IJwOWw3us/7ffQkIBCyOQfm/aNwVMBUriP02QshIfgHCBSIYAl3u2eWjg==", "license": "MIT", "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" - }, - "engines": { - "node": ">=20" } }, "node_modules/@node-core/rehype-shiki/node_modules/shiki": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.0.2.tgz", - "integrity": "sha512-eAVKTMedR5ckPo4xne/PjYQYrU3qx78gtJZ+sHlXEg5IHhhoQhMfZVzetTYuaJS0L2Ef3AcCRzCHV8T0WI6nIQ==", + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-3.22.0.tgz", + "integrity": "sha512-LBnhsoYEe0Eou4e1VgJACes+O6S6QC0w71fCSp5Oya79inkwkm15gQ1UF6VtQ8j/taMDh79hAB49WUk8ALQW3g==", "license": "MIT", "dependencies": { - "@shikijs/core": "4.0.2", - "@shikijs/engine-javascript": "4.0.2", - "@shikijs/engine-oniguruma": "4.0.2", - "@shikijs/langs": "4.0.2", - "@shikijs/themes": "4.0.2", - "@shikijs/types": "4.0.2", + "@shikijs/core": "3.22.0", + "@shikijs/engine-javascript": "3.22.0", + "@shikijs/engine-oniguruma": "3.22.0", + "@shikijs/langs": "3.22.0", + "@shikijs/themes": "3.22.0", + "@shikijs/types": "3.22.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" - }, - "engines": { - "node": ">=20" } }, "node_modules/@node-core/ui-components": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@node-core/ui-components/-/ui-components-1.7.1.tgz", - "integrity": "sha512-i1un8y0yth6WdT0OXpAQeL8XIkohcZ2P8khSC0oQstWG8H7PCRqX+mdZlJAuVUKq3MaQnC2fO34Q3j7L4TenXg==", + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@node-core/ui-components/-/ui-components-1.6.3.tgz", + "integrity": "sha512-Oy/bI4mZC6V/i8CdIX8q62r81zR6bAEARZE0jwTpv7w49SNomB2WAVb5fnFBSumyigOCgQKgR/OJtwh8XQJnkw==", "dependencies": { "@heroicons/react": "^2.2.0", - "@orama/orama": "^3.1.18", + "@orama/core": "^1.2.19", "@orama/ui": "^1.5.4", "@radix-ui/react-avatar": "^1.1.11", "@radix-ui/react-dialog": "^1.1.15", @@ -688,9 +698,15 @@ "@radix-ui/react-separator": "^1.1.8", "@radix-ui/react-tabs": "^1.1.13", "@radix-ui/react-tooltip": "^1.2.8", + "@tailwindcss/postcss": "~4.2.1", + "@types/react": "^19.2.13", "@vcarl/remark-headings": "~0.1.0", "classnames": "~2.5.1", - "react": "^19.2.6" + "postcss-calc": "10.1.1", + "postcss-cli": "11.0.1", + "react": "^19.2.4", + "tailwindcss": "~4.1.17", + "typescript": "5.9.3" }, "engines": { "node": ">=20" @@ -701,7 +717,6 @@ "resolved": "https://registry.npmjs.org/@orama/core/-/core-1.2.19.tgz", "integrity": "sha512-AVEI0eG/a1RUQK+tBloRMppQf46Ky4kIYKEVjo0V0VfIGZHdLOE2PJR4v949kFwiTnfSJCUaxgwM74FCA1uHUA==", "license": "AGPL-3.0", - "peer": true, "dependencies": { "@orama/cuid2": "2.2.3", "@orama/oramacore-events-parser": "0.0.5" @@ -712,7 +727,6 @@ "resolved": "https://registry.npmjs.org/@orama/cuid2/-/cuid2-2.2.3.tgz", "integrity": "sha512-Lcak3chblMejdlSHgYU2lS2cdOhDpU6vkfIJH4m+YKvqQyLqs1bB8+w6NT1MG5bO12NUK2GFc34Mn2xshMIQ1g==", "license": "MIT", - "peer": true, "dependencies": { "@noble/hashes": "^1.1.5" } @@ -730,8 +744,7 @@ "version": "0.0.5", "resolved": "https://registry.npmjs.org/@orama/oramacore-events-parser/-/oramacore-events-parser-0.0.5.tgz", "integrity": "sha512-yAuSwog+HQBAXgZ60TNKEwu04y81/09mpbYBCmz1RCxnr4ObNY2JnPZI7HmALbjAhLJ8t5p+wc2JHRK93ubO4w==", - "license": "AGPL-3.0", - "peer": true + "license": "AGPL-3.0" }, "node_modules/@orama/stopwords": { "version": "3.1.18", @@ -759,33 +772,33 @@ } }, "node_modules/@oxc-project/types": { - "version": "0.132.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.132.0.tgz", - "integrity": "sha512-FESMOxil5Se014ui/Eq8fT5uHJo6nIRwH0PfJrZJXs6Gek3ZVFOrpUv3YIZT20m+extU98Hg1Ym72U58rlsxUQ==", + "version": "0.127.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.127.0.tgz", + "integrity": "sha512-aIYXQBo4lCbO4z0R3FHeucQHpF46l2LbMdxRvqvuRuW2OxdnSkcng5B8+K12spgLDj93rtN3+J2Vac/TIO+ciQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/Boshen" } }, "node_modules/@radix-ui/number": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.1.2.tgz", - "integrity": "sha512-ceTwaxc4I5IOi97DgCotl3pqiyRGvffcc0oOsE2dQYaJOFIDsDt4VWG6xEbg1QePv9QWausCEIppud/tJ1wNig==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.1.1.tgz", + "integrity": "sha512-MkKCwxlXTgz6CFoJx3pCwn07GKp36+aZyu/u2Ln2VrA5DcdyCZkASEDBTd8x5whTQQL5CiYf4prXKLcgQdv29g==", "license": "MIT" }, "node_modules/@radix-ui/primitive": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.4.tgz", - "integrity": "sha512-7AdCK9PQyiljKoBDbN8OuctCbd/esdwZPQ8RtOE3SsyQtUpiPb+ND75q0jEhC1m1ecBI0MFNeLJvwIh9iKHRcQ==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz", + "integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==", "license": "MIT" }, "node_modules/@radix-ui/react-arrow": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.11.tgz", - "integrity": "sha512-Kdil9BB1rIFC/khmf4hC35bn8701AJcizTU7G7cUbEbk5XqqbjDuHW60uUfKqO5WojjZcbAW51Q7P0hRmMLw8A==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.7.tgz", + "integrity": "sha512-F+M1tLhO+mlQaOWspE8Wstg+z6PwxwRd8oQ8IXceWz92kfAmalTRf0EjrouQeo7QssEPfCn05B4Ihs1K9WQ/7w==", "license": "MIT", "dependencies": { - "@radix-ui/react-primitive": "2.1.7" + "@radix-ui/react-primitive": "2.1.3" }, "peerDependencies": { "@types/react": "*", @@ -802,17 +815,13 @@ } } }, - "node_modules/@radix-ui/react-avatar": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-avatar/-/react-avatar-1.2.1.tgz", - "integrity": "sha512-+8PWoLLZv3AVb5m0pvoiOca/bQGzc9vPVb+982HB2x3Un0DpYEPM3zLMl4oqRpBsocJuNqLkiv/HXTnTrlwr4g==", + "node_modules/@radix-ui/react-arrow/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", "license": "MIT", "dependencies": { - "@radix-ui/react-context": "1.1.4", - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-use-callback-ref": "1.1.2", - "@radix-ui/react-use-is-hydrated": "0.1.1", - "@radix-ui/react-use-layout-effect": "1.1.2" + "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "*", @@ -829,16 +838,17 @@ } } }, - "node_modules/@radix-ui/react-collection": { + "node_modules/@radix-ui/react-avatar": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.11.tgz", - "integrity": "sha512-djW9+zeg137KQdlPtmE8xnaD+K2rcXXMWFrSg0hsmYZ6HRbdTA7tDHFgpaW9+huWVEu0RCabL+985T4TA0BE7g==", + "resolved": "https://registry.npmjs.org/@radix-ui/react-avatar/-/react-avatar-1.1.11.tgz", + "integrity": "sha512-0Qk603AHGV28BOBO34p7IgD5m+V5Sg/YovfayABkoDDBM5d3NCx0Mp4gGrjzLGes1jV5eNOE1r3itqOR33VC6Q==", "license": "MIT", "dependencies": { - "@radix-ui/react-compose-refs": "1.1.3", - "@radix-ui/react-context": "1.1.4", - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-slot": "1.3.0" + "@radix-ui/react-context": "1.1.3", + "@radix-ui/react-primitive": "2.1.4", + "@radix-ui/react-use-callback-ref": "1.1.1", + "@radix-ui/react-use-is-hydrated": "0.1.0", + "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", @@ -855,25 +865,36 @@ } } }, - "node_modules/@radix-ui/react-compose-refs": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.3.tgz", - "integrity": "sha512-rYOP8OMnuuPMQF1uhPVlGNcCDlkokKqGFE3JcxFViIkAXP7EvFWUliJAstrapypaBLJNHbZL6jGhbVDGTwmVhA==", + "node_modules/@radix-ui/react-collection": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.7.tgz", + "integrity": "sha512-Fh9rGN0MoI4ZFUNyfFVNU4y9LUz93u9/0K+yLgA2bwRojxM8JU1DyvvMBabnZPBgMWREAJvU2jjVzq+LrFUglw==", "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-slot": "1.2.3" + }, "peerDependencies": { "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "peerDependenciesMeta": { "@types/react": { "optional": true + }, + "@types/react-dom": { + "optional": true } } }, - "node_modules/@radix-ui/react-context": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.4.tgz", - "integrity": "sha512-QwH4PO5urrbO+FaGd5Aglg+YJgWTyyuZ3g/6mKvsqraLkglDdckw9JafgL5McL5VEJ6EPNduPaT3ZE9BttDAqg==", + "node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-context": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz", + "integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==", "license": "MIT", "peerDependencies": { "@types/react": "*", @@ -885,26 +906,13 @@ } } }, - "node_modules/@radix-ui/react-dialog": { - "version": "1.1.18", - "resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.1.18.tgz", - "integrity": "sha512-apa28mldjMgORmE6g/w3sCcA0Y9UAVeeDVoozN4i7kOw12mLl9RBchfzK3Nn6qxOWjrZhK1Lfy7f07kyzxtnBw==", - "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.4", - "@radix-ui/react-compose-refs": "1.1.3", - "@radix-ui/react-context": "1.1.4", - "@radix-ui/react-dismissable-layer": "1.1.14", - "@radix-ui/react-focus-guards": "1.1.4", - "@radix-ui/react-focus-scope": "1.1.11", - "@radix-ui/react-id": "1.1.2", - "@radix-ui/react-portal": "1.1.13", - "@radix-ui/react-presence": "1.1.6", - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-slot": "1.3.0", - "@radix-ui/react-use-controllable-state": "1.2.3", - "aria-hidden": "^1.2.4", - "react-remove-scroll": "^2.7.2" + "node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "*", @@ -921,10 +929,10 @@ } } }, - "node_modules/@radix-ui/react-direction": { + "node_modules/@radix-ui/react-compose-refs": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.2.tgz", - "integrity": "sha512-C3vFhbyi4SW3PmbAi6Awpu4OzJtd0MxGurvSsYtr7p7nM8RNB3VAF3CUmnp2j50knpkrRcB7+ycVXzgLgF6yNA==", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.2.tgz", + "integrity": "sha512-z4eqJvfiNnFMHIIvXP3CY57y2WJs5g2v3X0zm9mEJkrkNv4rDxu+sg9Jh8EkXyeqBkB7SOcboo9dMVqhyrACIg==", "license": "MIT", "peerDependencies": { "@types/react": "*", @@ -936,46 +944,41 @@ } } }, - "node_modules/@radix-ui/react-dismissable-layer": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.14.tgz", - "integrity": "sha512-4lUhWTWAjbDIqFrAPWJ3WqBOpO5YchVZ88X3nh6H9Lu5AFi5nCUeTPj3D8FSDmabmFeRe9ME0BDA4MwKTha5GQ==", + "node_modules/@radix-ui/react-context": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.3.tgz", + "integrity": "sha512-ieIFACdMpYfMEjF0rEf5KLvfVyIkOz6PDGyNnP+u+4xQ6jny3VCgA4OgXOwNx2aUkxn8zx9fiVcM8CfFYv9Lxw==", "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.4", - "@radix-ui/react-compose-refs": "1.1.3", - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-use-callback-ref": "1.1.2", - "@radix-ui/react-use-effect-event": "0.0.3" - }, "peerDependencies": { "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "peerDependenciesMeta": { "@types/react": { "optional": true - }, - "@types/react-dom": { - "optional": true } } }, - "node_modules/@radix-ui/react-dropdown-menu": { - "version": "2.1.19", - "resolved": "https://registry.npmjs.org/@radix-ui/react-dropdown-menu/-/react-dropdown-menu-2.1.19.tgz", - "integrity": "sha512-HZccBkbK0LOi8nYKIp5jll/zIRW0cCOmG6WWyqsSpmXCU+ZlcBbTqIwlBvPCu886C5RVu6c/kHV7xSP8IgYNHw==", - "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.4", - "@radix-ui/react-compose-refs": "1.1.3", - "@radix-ui/react-context": "1.1.4", - "@radix-ui/react-id": "1.1.2", - "@radix-ui/react-menu": "2.1.19", - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-use-controllable-state": "1.2.3" + "node_modules/@radix-ui/react-dialog": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.1.15.tgz", + "integrity": "sha512-TCglVRtzlffRNxRMEyR36DGBLJpeusFcgMVD9PZEzAKnUs1lKCgX5u9BmC2Yg+LL9MgZDugFFs1Vl+Jp4t/PGw==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-dismissable-layer": "1.1.11", + "@radix-ui/react-focus-guards": "1.1.3", + "@radix-ui/react-focus-scope": "1.1.7", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-portal": "1.1.9", + "@radix-ui/react-presence": "1.1.5", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-slot": "1.2.3", + "@radix-ui/react-use-controllable-state": "1.2.2", + "aria-hidden": "^1.2.4", + "react-remove-scroll": "^2.6.3" }, "peerDependencies": { "@types/react": "*", @@ -992,10 +995,10 @@ } } }, - "node_modules/@radix-ui/react-focus-guards": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.4.tgz", - "integrity": "sha512-cot/aB/mOm0IYVYTTmQcEEK1M48lZWi8FlYe5nDPQQ8NYZUlXEFgncJ9p2Kzer3RKSrY7cTTpEMLZKNo9QoP5Q==", + "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz", + "integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==", "license": "MIT", "peerDependencies": { "@types/react": "*", @@ -1007,15 +1010,13 @@ } } }, - "node_modules/@radix-ui/react-focus-scope": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.11.tgz", - "integrity": "sha512-Mn88Vg2whaRocGJNOH+DKFqYm6ySFPQaiwHNxZPyjn99B52KAEJWWY9NP83+nWdk2HM3rdov+STu9AG471Rt9w==", + "node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", "license": "MIT", "dependencies": { - "@radix-ui/react-compose-refs": "1.1.3", - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-use-callback-ref": "1.1.2" + "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "*", @@ -1032,14 +1033,11 @@ } } }, - "node_modules/@radix-ui/react-id": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.2.tgz", - "integrity": "sha512-orBC88futVpqCmhX1p4cvquNHsELQ+w+vBJnuj3ftETI5bJb0bZn3Tqu3SWN2IOcPycTnMGnhwoermvISt72sA==", + "node_modules/@radix-ui/react-direction": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.1.tgz", + "integrity": "sha512-1UEWRX6jnOA2y4H5WczZ44gOOjTEmlqv1uNW4GAJEO5+bauCBhv8snY65Iw5/VOS/ghKN9gr2KjnLKxrsvoMVw==", "license": "MIT", - "dependencies": { - "@radix-ui/react-use-layout-effect": "1.1.2" - }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" @@ -1050,53 +1048,17 @@ } } }, - "node_modules/@radix-ui/react-label": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/@radix-ui/react-label/-/react-label-2.1.11.tgz", - "integrity": "sha512-3PKvDDxOn62k0oV1n4QtNtD2vpu+zYjXR7ojLBPaO6SPvhy53yg0vAmgNeBQeJW5rV3dffoRG+HYfLBZuzw0CQ==", + "node_modules/@radix-ui/react-dismissable-layer": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.11.tgz", + "integrity": "sha512-Nqcp+t5cTB8BinFkZgXiMJniQH0PsUt2k51FUhbdfeKvc4ACcG2uQniY/8+h1Yv6Kza4Q7lD7PQV0z0oicE0Mg==", "license": "MIT", "dependencies": { - "@radix-ui/react-primitive": "2.1.7" - }, - "peerDependencies": { - "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "@types/react-dom": { - "optional": true - } - } - }, - "node_modules/@radix-ui/react-menu": { - "version": "2.1.19", - "resolved": "https://registry.npmjs.org/@radix-ui/react-menu/-/react-menu-2.1.19.tgz", - "integrity": "sha512-Mht9BVd1AIsNFVQr4KG3bIK7XQn5IXF0TL/2ObsrzOdc1loaly/+kBDL5roSCYn8j8XZkvpOD0WYLz2FQtH1Eg==", - "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.4", - "@radix-ui/react-collection": "1.1.11", - "@radix-ui/react-compose-refs": "1.1.3", - "@radix-ui/react-context": "1.1.4", - "@radix-ui/react-direction": "1.1.2", - "@radix-ui/react-dismissable-layer": "1.1.14", - "@radix-ui/react-focus-guards": "1.1.4", - "@radix-ui/react-focus-scope": "1.1.11", - "@radix-ui/react-id": "1.1.2", - "@radix-ui/react-popper": "1.3.2", - "@radix-ui/react-portal": "1.1.13", - "@radix-ui/react-presence": "1.1.6", - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-roving-focus": "1.1.14", - "@radix-ui/react-slot": "1.3.0", - "@radix-ui/react-use-callback-ref": "1.1.2", - "aria-hidden": "^1.2.4", - "react-remove-scroll": "^2.7.2" + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-callback-ref": "1.1.1", + "@radix-ui/react-use-escape-keydown": "1.1.1" }, "peerDependencies": { "@types/react": "*", @@ -1113,22 +1075,13 @@ } } }, - "node_modules/@radix-ui/react-popper": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.3.2.tgz", - "integrity": "sha512-3QXNeMkdshed1MR3LNoiCirBywRFPkD8ETJa/HlPuLwSajaQixf2ro+isoDNJlGABg9ug41XuZpINZJIle4XWg==", + "node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", "license": "MIT", "dependencies": { - "@floating-ui/react-dom": "^2.0.0", - "@radix-ui/react-arrow": "1.1.11", - "@radix-ui/react-compose-refs": "1.1.3", - "@radix-ui/react-context": "1.1.4", - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-use-callback-ref": "1.1.2", - "@radix-ui/react-use-layout-effect": "1.1.2", - "@radix-ui/react-use-rect": "1.1.2", - "@radix-ui/react-use-size": "1.1.2", - "@radix-ui/rect": "1.1.2" + "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "*", @@ -1145,14 +1098,19 @@ } } }, - "node_modules/@radix-ui/react-portal": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.13.tgz", - "integrity": "sha512-z3oXfmaHLJTF1wktbjgD6cn9jiEbq3WSondB10LIuIt2m2Ym4iJlrW04/euMwENDdWDdE7z+OuY7Qyp1YpRSwA==", + "node_modules/@radix-ui/react-dropdown-menu": { + "version": "2.1.16", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dropdown-menu/-/react-dropdown-menu-2.1.16.tgz", + "integrity": "sha512-1PLGQEynI/3OX/ftV54COn+3Sud/Mn8vALg2rWnBLnRaGtJDduNW/22XjlGgPdpcIbiQxjKtb7BkcjP00nqfJw==", "license": "MIT", "dependencies": { - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-use-layout-effect": "1.1.2" + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-menu": "2.1.16", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-controllable-state": "1.2.2" }, "peerDependencies": { "@types/react": "*", @@ -1169,36 +1127,28 @@ } } }, - "node_modules/@radix-ui/react-presence": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.6.tgz", - "integrity": "sha512-zdTk4PlUO0E18HnZ3wYbW0KkJJxWCdiNYp6g6X1PtONFhxVkg01vliTJAmwIszU6mHiyBOoW9P0rAugl5/hULQ==", + "node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-context": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz", + "integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==", "license": "MIT", - "dependencies": { - "@radix-ui/react-use-layout-effect": "1.1.2" - }, "peerDependencies": { "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "peerDependenciesMeta": { "@types/react": { "optional": true - }, - "@types/react-dom": { - "optional": true } } }, - "node_modules/@radix-ui/react-primitive": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.7.tgz", - "integrity": "sha512-bC3NiwsprbxKjuon9l7X6BUTw7FPVzEYaL92MPEY5SCd/9hUTPXVFtVwRix7778wtRsVao+zE062gL79FZleeQ==", + "node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", "license": "MIT", "dependencies": { - "@radix-ui/react-slot": "1.3.0" + "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "*", @@ -1215,65 +1165,30 @@ } } }, - "node_modules/@radix-ui/react-roving-focus": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.1.14.tgz", - "integrity": "sha512-8Qcnx9447tx/aCBgw6Jenfqg4Skq+vqab9mCBmuGNipIS5YXvL275wbKEu7+ICYHIlAPgCduUMJH1XOYewKF6Q==", + "node_modules/@radix-ui/react-focus-guards": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.3.tgz", + "integrity": "sha512-0rFg/Rj2Q62NCm62jZw0QX7a3sz6QCQU0LpZdNrJX8byRGaGVTqbrW9jAoIAHyMQqsNpeZ81YgSizOt5WXq0Pw==", "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.4", - "@radix-ui/react-collection": "1.1.11", - "@radix-ui/react-compose-refs": "1.1.3", - "@radix-ui/react-context": "1.1.4", - "@radix-ui/react-direction": "1.1.2", - "@radix-ui/react-id": "1.1.2", - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-use-callback-ref": "1.1.2", - "@radix-ui/react-use-controllable-state": "1.2.3" - }, "peerDependencies": { "@types/react": "*", - "@types/react-dom": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", - "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "peerDependenciesMeta": { "@types/react": { "optional": true - }, - "@types/react-dom": { - "optional": true } } }, - "node_modules/@radix-ui/react-select": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.3.2.tgz", - "integrity": "sha512-brXD6C/V0fVK0DDbscLVw6LsXrjQ+ay8jdOBaN+tLb4vsHsAMm6Gt6eT77wHX1Eq8GPtD5rJ+RxFtfDozsb4+Q==", - "license": "MIT", - "dependencies": { - "@radix-ui/number": "1.1.2", - "@radix-ui/primitive": "1.1.4", - "@radix-ui/react-collection": "1.1.11", - "@radix-ui/react-compose-refs": "1.1.3", - "@radix-ui/react-context": "1.1.4", - "@radix-ui/react-direction": "1.1.2", - "@radix-ui/react-dismissable-layer": "1.1.14", - "@radix-ui/react-focus-guards": "1.1.4", - "@radix-ui/react-focus-scope": "1.1.11", - "@radix-ui/react-id": "1.1.2", - "@radix-ui/react-popper": "1.3.2", - "@radix-ui/react-portal": "1.1.13", - "@radix-ui/react-presence": "1.1.6", - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-slot": "1.3.0", - "@radix-ui/react-use-callback-ref": "1.1.2", - "@radix-ui/react-use-controllable-state": "1.2.3", - "@radix-ui/react-use-layout-effect": "1.1.2", - "@radix-ui/react-use-previous": "1.1.2", - "@radix-ui/react-visually-hidden": "1.2.7", - "aria-hidden": "^1.2.4", - "react-remove-scroll": "^2.7.2" + "node_modules/@radix-ui/react-focus-scope": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.7.tgz", + "integrity": "sha512-t2ODlkXBQyn7jkl6TNaw/MtVEVvIGelJDCG41Okq/KwUsJBwQ4XVZsHAVUkK4mBv3ewiAS3PGuUWuY2BoK4ZUw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-callback-ref": "1.1.1" }, "peerDependencies": { "@types/react": "*", @@ -1290,13 +1205,13 @@ } } }, - "node_modules/@radix-ui/react-separator": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/@radix-ui/react-separator/-/react-separator-1.1.11.tgz", - "integrity": "sha512-jRhe86+8PF7VZ1u14eOWVOuh2BuAhALg/FT1VcMC4OHedMTRUazDnDlKTt+yxo5cRNKHMfmvZ4sSQtWDeMV4CQ==", + "node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", "license": "MIT", "dependencies": { - "@radix-ui/react-primitive": "2.1.7" + "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "*", @@ -1313,13 +1228,13 @@ } } }, - "node_modules/@radix-ui/react-slot": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.3.0.tgz", - "integrity": "sha512-MojKku4U/miO8Av4Dkb+ctMAQx7JmY96LmtDQlAarCRtd7rN52QCSzBF+XAvr5S6coSVj9HEPBgHAHKEJVk/WA==", + "node_modules/@radix-ui/react-id": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.1.tgz", + "integrity": "sha512-kGkGegYIdQsOb4XjsfM97rXsiHaBwco+hFI66oO4s9LU+PLAC5oJ7khdOVFxkhsmlbpUqDAvXw11CluXP+jkHg==", "license": "MIT", "dependencies": { - "@radix-ui/react-compose-refs": "1.1.3" + "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", @@ -1331,20 +1246,13 @@ } } }, - "node_modules/@radix-ui/react-tabs": { - "version": "1.1.16", - "resolved": "https://registry.npmjs.org/@radix-ui/react-tabs/-/react-tabs-1.1.16.tgz", - "integrity": "sha512-v3Ab2l7z6U7tRB4xA0IyKdq0OsqaO1o9ZjsIEoKKnSZ/l96mZz8aCTX0NCXw+YVHJXr8Km4d+Mn6/Q8YjXa+gw==", + "node_modules/@radix-ui/react-label": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@radix-ui/react-label/-/react-label-2.1.8.tgz", + "integrity": "sha512-FmXs37I6hSBVDlO4y764TNz1rLgKwjJMQ0EGte6F3Cb3f4bIuHB/iLa/8I9VKkmOy+gNHq8rql3j686ACVV21A==", "license": "MIT", "dependencies": { - "@radix-ui/primitive": "1.1.4", - "@radix-ui/react-context": "1.1.4", - "@radix-ui/react-direction": "1.1.2", - "@radix-ui/react-id": "1.1.2", - "@radix-ui/react-presence": "1.1.6", - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-roving-focus": "1.1.14", - "@radix-ui/react-use-controllable-state": "1.2.3" + "@radix-ui/react-primitive": "2.1.4" }, "peerDependencies": { "@types/react": "*", @@ -1361,24 +1269,30 @@ } } }, - "node_modules/@radix-ui/react-tooltip": { - "version": "1.2.11", - "resolved": "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.2.11.tgz", - "integrity": "sha512-8XZ6Py3y3W2nEzAUGCN5cfVKaUi+CVApcz1d6lrNVVf2hvYEixMRkq8k9ggPKnQUpRRuOV5avt8uvxViH2jLwA==", - "license": "MIT", - "dependencies": { - "@radix-ui/primitive": "1.1.4", - "@radix-ui/react-compose-refs": "1.1.3", - "@radix-ui/react-context": "1.1.4", - "@radix-ui/react-dismissable-layer": "1.1.14", - "@radix-ui/react-id": "1.1.2", - "@radix-ui/react-popper": "1.3.2", - "@radix-ui/react-portal": "1.1.13", - "@radix-ui/react-presence": "1.1.6", - "@radix-ui/react-primitive": "2.1.7", - "@radix-ui/react-slot": "1.3.0", - "@radix-ui/react-use-controllable-state": "1.2.3", - "@radix-ui/react-visually-hidden": "1.2.7" + "node_modules/@radix-ui/react-menu": { + "version": "2.1.16", + "resolved": "https://registry.npmjs.org/@radix-ui/react-menu/-/react-menu-2.1.16.tgz", + "integrity": "sha512-72F2T+PLlphrqLcAotYPp0uJMr5SjP5SL01wfEspJbru5Zs5vQaSHb4VB3ZMJPimgHHCHG7gMOeOB9H3Hdmtxg==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-collection": "1.1.7", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-direction": "1.1.1", + "@radix-ui/react-dismissable-layer": "1.1.11", + "@radix-ui/react-focus-guards": "1.1.3", + "@radix-ui/react-focus-scope": "1.1.7", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-popper": "1.2.8", + "@radix-ui/react-portal": "1.1.9", + "@radix-ui/react-presence": "1.1.5", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-roving-focus": "1.1.11", + "@radix-ui/react-slot": "1.2.3", + "@radix-ui/react-use-callback-ref": "1.1.1", + "aria-hidden": "^1.2.4", + "react-remove-scroll": "^2.6.3" }, "peerDependencies": { "@types/react": "*", @@ -1395,10 +1309,10 @@ } } }, - "node_modules/@radix-ui/react-use-callback-ref": { + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-context": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.2.tgz", - "integrity": "sha512-xCso9j1/u8sEgP1RNHjFrXJLApL8LiqOkI1R4ywuN00rxWdYg4oQXuwKLS3i0j5NWLromUD27/4nlxj2UFVvIw==", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz", + "integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==", "license": "MIT", "peerDependencies": { "@types/react": "*", @@ -1410,47 +1324,65 @@ } } }, - "node_modules/@radix-ui/react-use-controllable-state": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.2.3.tgz", - "integrity": "sha512-PLzC90MS+ReootmjC597dvopoelpZ8Q61HJkDXZSExitIq7PL55vHNnesAHwguHK0aPfBnpdNzQtv1uliaqQrA==", + "node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", "license": "MIT", "dependencies": { - "@radix-ui/react-use-effect-event": "0.0.3", - "@radix-ui/react-use-layout-effect": "1.1.2" + "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "peerDependenciesMeta": { "@types/react": { "optional": true + }, + "@types/react-dom": { + "optional": true } } }, - "node_modules/@radix-ui/react-use-effect-event": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-effect-event/-/react-use-effect-event-0.0.3.tgz", - "integrity": "sha512-6c8ZqvPTWILEKnyVkP53EGRCcpnJiKTC21sS/6R1GF5xKyHJJWQEPfkqlcgUkdRQivd6tb23abUwe4ngWmY0JA==", + "node_modules/@radix-ui/react-popper": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.8.tgz", + "integrity": "sha512-0NJQ4LFFUuWkE7Oxf0htBKS6zLkkjBH+hM1uk7Ng705ReR8m/uelduy1DBo0PyBXPKVnBA6YBlU94MBGXrSBCw==", "license": "MIT", "dependencies": { - "@radix-ui/react-use-layout-effect": "1.1.2" + "@floating-ui/react-dom": "^2.0.0", + "@radix-ui/react-arrow": "1.1.7", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-callback-ref": "1.1.1", + "@radix-ui/react-use-layout-effect": "1.1.1", + "@radix-ui/react-use-rect": "1.1.1", + "@radix-ui/react-use-size": "1.1.1", + "@radix-ui/rect": "1.1.1" }, "peerDependencies": { "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "peerDependenciesMeta": { "@types/react": { "optional": true + }, + "@types/react-dom": { + "optional": true } } }, - "node_modules/@radix-ui/react-use-is-hydrated": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-is-hydrated/-/react-use-is-hydrated-0.1.1.tgz", - "integrity": "sha512-qwOiz4Tjo8CNnrOLAYUMXeZwDzXgXpvK4TKQPmWLECM9XoWvA6+0Z2/7Ag3A4ivjS4ovbLJPbskkxioFyBhr8A==", + "node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-context": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz", + "integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==", "license": "MIT", "peerDependencies": { "@types/react": "*", @@ -1462,79 +1394,107 @@ } } }, - "node_modules/@radix-ui/react-use-layout-effect": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.2.tgz", - "integrity": "sha512-jrBWOxZITuGcnjRCM2t2U5ZPkCLxD+Ym6DjfssS5haTj2iiak/DOb64JeN6OdLfLgptb6/e2kKR+ZuTrGoZTPA==", + "node_modules/@radix-ui/react-popper/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.2.3" + }, "peerDependencies": { "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "peerDependenciesMeta": { "@types/react": { "optional": true + }, + "@types/react-dom": { + "optional": true } } }, - "node_modules/@radix-ui/react-use-previous": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-previous/-/react-use-previous-1.1.2.tgz", - "integrity": "sha512-IGBQPtRFdhN6MQ8dbegVmBq1LVZluya3F1jWY+puIcQC3MHctRwTDSBWCkL/3ZcnMJLTMJ++Z+ktmvg0F89iCw==", + "node_modules/@radix-ui/react-portal": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.9.tgz", + "integrity": "sha512-bpIxvq03if6UNwXZ+HTK71JLh4APvnXntDc6XOX8UVq4XQOVl7lwok0AvIl+b8zgCw3fSaVTZMpAPPagXbKmHQ==", "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-layout-effect": "1.1.1" + }, "peerDependencies": { "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "peerDependenciesMeta": { "@types/react": { "optional": true + }, + "@types/react-dom": { + "optional": true } } }, - "node_modules/@radix-ui/react-use-rect": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.1.2.tgz", - "integrity": "sha512-d8a+bBY/FxikNPlgJJoaBHZX+zKVbWHYJGTLnLvveQgFSTntkGdEKv3JDtHrMS0DNYpllz2nRsTLGLKYttbpmw==", + "node_modules/@radix-ui/react-portal/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", "license": "MIT", "dependencies": { - "@radix-ui/rect": "1.1.2" + "@radix-ui/react-slot": "1.2.3" }, "peerDependencies": { "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "peerDependenciesMeta": { "@types/react": { "optional": true + }, + "@types/react-dom": { + "optional": true } } }, - "node_modules/@radix-ui/react-use-size": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.1.2.tgz", - "integrity": "sha512-giWQp+4mxjBPt4KZ0MmyuykFNWfbDxKt4x+fPkRYmgRFJSbCZFzUglvMb/Kjn38tm10YP4ufiQZDx3zna4LU6w==", + "node_modules/@radix-ui/react-presence": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.5.tgz", + "integrity": "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ==", "license": "MIT", "dependencies": { - "@radix-ui/react-use-layout-effect": "1.1.2" + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", - "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "peerDependenciesMeta": { "@types/react": { "optional": true + }, + "@types/react-dom": { + "optional": true } } }, - "node_modules/@radix-ui/react-visually-hidden": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.2.7.tgz", - "integrity": "sha512-1wNZBggTDK3GRuuQ6nP4k2yi7a6l7I5qbMPbZcRsrGsGVead/f/d5FhEzUvqFs0bcrDLx7n1zKQ3JvLR6whaaw==", + "node_modules/@radix-ui/react-primitive": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.4.tgz", + "integrity": "sha512-9hQc4+GNVtJAIEPEqlYqW5RiYdrr8ea5XQ0ZOnD6fgru+83kqT15mq2OCcbe8KnjRZl5vF3ks69AKz3kh1jrhg==", "license": "MIT", "dependencies": { - "@radix-ui/react-primitive": "2.1.7" + "@radix-ui/react-slot": "1.2.4" }, "peerDependencies": { "@types/react": "*", @@ -1551,139 +1511,1065 @@ } } }, - "node_modules/@radix-ui/rect": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/rect/-/rect-1.1.2.tgz", - "integrity": "sha512-xnXE7wG13PI+cxieVssYXlQJuYVRhH9NBoxt3KNwzghDIA69GMm7d4wXRouHIYjE+KvS6U/MsMO73NdS2MH9ZA==", - "license": "MIT" - }, - "node_modules/@rolldown/binding-android-arm64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.2.tgz", - "integrity": "sha512-ZS4D1JPGn/MYQN/SYDWftIE/nVsM8j/AFOYEzAoOE2O3NktQOZru+/vYXGbR/qtdLdIfGCP0lcoJiYVzsEz+iQ==", - "cpu": [ - "arm64" - ], + "node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.4.tgz", + "integrity": "sha512-Jl+bCv8HxKnlTLVrcDE8zTMJ09R9/ukw4qBs/oZClOfoQk/cOTbDn+NceXfV7j09YPVQUryJPHurafcSg6EVKA==", "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.2" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } } }, - "node_modules/@rolldown/binding-darwin-arm64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.2.tgz", - "integrity": "sha512-vdFA9+C/rekyGce7WqHs/xoT0ioZEWaOFyZLIV1mEeNFaFDUQrPIo8Vs2GvJ6eetb3rzDUtUBgzto3ExpXJB3w==", - "cpu": [ - "arm64" - ], + "node_modules/@radix-ui/react-roving-focus": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.1.11.tgz", + "integrity": "sha512-7A6S9jSgm/S+7MdtNDSb+IU859vQqJ/QAtcYQcfFC6W8RS4IxIZDldLR0xqCFZ6DCyrQLjLPsxtTNch5jVA4lA==", "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-collection": "1.1.7", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-direction": "1.1.1", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-use-callback-ref": "1.1.1", + "@radix-ui/react-use-controllable-state": "1.2.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } } }, - "node_modules/@rolldown/binding-darwin-x64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.2.tgz", - "integrity": "sha512-BewSOwTHazv77DTYiAZXSqqKZ4KP/KonFisDMVU7PImxoWfB2aepnPhd2E4SWz3zDzYgDNbs6jBmTdgNnF02GA==", - "cpu": [ - "x64" - ], + "node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-context": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz", + "integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==", "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } } }, - "node_modules/@rolldown/binding-freebsd-x64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.2.tgz", - "integrity": "sha512-m41o7M0YWtUdqk61Tb+jnKb2rN++iRdIASlExkUoKfIAH30DOHCB8fVLzSUpbWHHU8esmEioY62PxzexE8MBuA==", - "cpu": [ - "x64" - ], + "node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" + "dependencies": { + "@radix-ui/react-slot": "1.2.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } } }, - "node_modules/@rolldown/binding-linux-arm-gnueabihf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.2.tgz", - "integrity": "sha512-jcojB9H7W/jS29pMKWAK1N+fU99vXodHDTatS3b3y/XSOCiHo0kkA74pL3jJmkoQtYpOCxDvaKs1fo2Ij/1X5w==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" + "node_modules/@radix-ui/react-select": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.2.6.tgz", + "integrity": "sha512-I30RydO+bnn2PQztvo25tswPH+wFBjehVGtmagkU78yMdwTwVf12wnAOF+AeP8S2N8xD+5UPbGhkUfPyvT+mwQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/number": "1.1.1", + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-collection": "1.1.7", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-direction": "1.1.1", + "@radix-ui/react-dismissable-layer": "1.1.11", + "@radix-ui/react-focus-guards": "1.1.3", + "@radix-ui/react-focus-scope": "1.1.7", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-popper": "1.2.8", + "@radix-ui/react-portal": "1.1.9", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-slot": "1.2.3", + "@radix-ui/react-use-callback-ref": "1.1.1", + "@radix-ui/react-use-controllable-state": "1.2.2", + "@radix-ui/react-use-layout-effect": "1.1.1", + "@radix-ui/react-use-previous": "1.1.1", + "@radix-ui/react-visually-hidden": "1.2.3", + "aria-hidden": "^1.2.4", + "react-remove-scroll": "^2.6.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } } }, - "node_modules/@rolldown/binding-linux-arm64-gnu": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.2.tgz", - "integrity": "sha512-1jn6qDU5iiOgFgygDzKUuKP0maTi0/f1+sBLgvij/76C77Nm3ts6ufz9Bjg5q5dduxiUIxtq86JIoBvo1xQ4Ig==", - "cpu": [ - "arm64" - ], - "libc": [ - "glibc" - ], + "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-context": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz", + "integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==", "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } } }, - "node_modules/@rolldown/binding-linux-arm64-musl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.2.tgz", - "integrity": "sha512-QVLO/czFMdoMFSqlX3bcswcJNm/23r+qoa/jgtmFc/qEp6/jXmIkDjF/XIo8dPfGaiwy1xfQn8o77L79GeXFgw==", - "cpu": [ - "arm64" - ], - "libc": [ - "musl" - ], + "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^20.19.0 || >=22.12.0" + "dependencies": { + "@radix-ui/react-slot": "1.2.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } } }, - "node_modules/@rolldown/binding-linux-ppc64-gnu": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.2.tgz", - "integrity": "sha512-hgO5Abm0w5UL6FEa2iFnZqo2KlK7TQ5QhV5x09hujBf7t5KzHQ1VmfPuTpqRy/rNlSxua3eWH374xxiVrP+lcA==", + "node_modules/@radix-ui/react-separator": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/@radix-ui/react-separator/-/react-separator-1.1.8.tgz", + "integrity": "sha512-sDvqVY4itsKwwSMEe0jtKgfTh+72Sy3gPmQpjqcQneqQ4PFmr/1I0YA+2/puilhggCe2gJcx5EBAYFkWkdpa5g==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.1.4" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-slot": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz", + "integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.2" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tabs": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/@radix-ui/react-tabs/-/react-tabs-1.1.13.tgz", + "integrity": "sha512-7xdcatg7/U+7+Udyoj2zodtI9H/IIopqo+YOIcZOq1nJwXWBZ9p8xiu5llXlekDbZkca79a/fozEYQXIA4sW6A==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-direction": "1.1.1", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-presence": "1.1.5", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-roving-focus": "1.1.11", + "@radix-ui/react-use-controllable-state": "1.2.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-context": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz", + "integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.2.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.2.8.tgz", + "integrity": "sha512-tY7sVt1yL9ozIxvmbtN5qtmH2krXcBCfjEiCgKGLqunJHvgvZG2Pcl2oQ3kbcZARb1BGEHdkLzcYGO8ynVlieg==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-dismissable-layer": "1.1.11", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-popper": "1.2.8", + "@radix-ui/react-portal": "1.1.9", + "@radix-ui/react-presence": "1.1.5", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-slot": "1.2.3", + "@radix-ui/react-use-controllable-state": "1.2.2", + "@radix-ui/react-visually-hidden": "1.2.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-context": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.2.tgz", + "integrity": "sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.2.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-callback-ref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.1.tgz", + "integrity": "sha512-FkBMwD+qbGQeMu1cOHnuGB6x4yzPjho8ap5WtbEJ26umhgqVXbhekKUQO+hZEL1vU92a3wHwdp0HAcqAUF5iDg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.2.2.tgz", + "integrity": "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-effect-event": "0.0.2", + "@radix-ui/react-use-layout-effect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-effect-event": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-effect-event/-/react-use-effect-event-0.0.2.tgz", + "integrity": "sha512-Qp8WbZOBe+blgpuUT+lw2xheLP8q0oatc9UpmiemEICxGvFLYmHm9QowVZGHtJlGbS6A6yJ3iViad/2cVjnOiA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-escape-keydown": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.1.tgz", + "integrity": "sha512-Il0+boE7w/XebUHyBjroE+DbByORGR9KKmITzbR7MyQ4akpORYP/ZmbhAr0DG7RmmBqoOnZdy2QlvajJ2QA59g==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-callback-ref": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-is-hydrated": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-is-hydrated/-/react-use-is-hydrated-0.1.0.tgz", + "integrity": "sha512-U+UORVEq+cTnRIaostJv9AGdV3G6Y+zbVd+12e18jQ5A3c0xL03IhnHuiU4UV69wolOQp5GfR58NW/EgdQhwOA==", + "license": "MIT", + "dependencies": { + "use-sync-external-store": "^1.5.0" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-layout-effect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.1.tgz", + "integrity": "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-previous": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-previous/-/react-use-previous-1.1.1.tgz", + "integrity": "sha512-2dHfToCj/pzca2Ck724OZ5L0EVrr3eHRNsG/b3xQJLA2hZpVCS99bLAX+hm1IHXDEnzU6by5z/5MIY794/a8NQ==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-rect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.1.1.tgz", + "integrity": "sha512-QTYuDesS0VtuHNNvMh+CjlKJ4LJickCMUAqjlE3+j8w+RlRpwyX3apEQKGFzbZGdo7XNG1tXa+bQqIE7HIXT2w==", + "license": "MIT", + "dependencies": { + "@radix-ui/rect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-size": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.1.1.tgz", + "integrity": "sha512-ewrXRDTAqAXlkl6t/fkXWNAhFX9I+CkKlw6zjEwk86RSPKwZr3xpBRso655aqYafwtnbpHLj6toFzmd6xdVptQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-visually-hidden": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.2.3.tgz", + "integrity": "sha512-pzJq12tEaaIhqjbzpCuv/OypJY/BPavOofm+dbab+MHLajy277+1lLm6JFcGgF5eskJ6mquGirhXY2GD/8u8Ug==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.1.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-visually-hidden/node_modules/@radix-ui/react-primitive": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.3.tgz", + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.2.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/rect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@radix-ui/rect/-/rect-1.1.1.tgz", + "integrity": "sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==", + "license": "MIT" + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.0-rc.17.tgz", + "integrity": "sha512-s70pVGhw4zqGeFnXWvAzJDlvxhlRollagdCCKRgOsgUOH3N1l0LIxf83AtGzmb5SiVM4Hjl5HyarMRfdfj3DaQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.0-rc.17.tgz", + "integrity": "sha512-4ksWc9n0mhlZpZ9PMZgTGjeOPRu8MB1Z3Tz0Mo02eWfWCHMW1zN82Qz/pL/rC+yQa+8ZnutMF0JjJe7PjwasYw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.0-rc.17.tgz", + "integrity": "sha512-SUSDOI6WwUVNcWxd02QEBjLdY1VPHvlEkw6T/8nYG322iYWCTxRb1vzk4E+mWWYehTp7ERibq54LSJGjmouOsw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.0-rc.17.tgz", + "integrity": "sha512-hwnz3nw9dbJ05EDO/PvcjaaewqqDy7Y1rn1UO81l8iIK1GjenME75dl16ajbvSSMfv66WXSRCYKIqfgq2KCfxw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.0-rc.17.tgz", + "integrity": "sha512-IS+W7epTcwANmFSQFrS1SivEXHtl1JtuQA9wlxrZTcNi6mx+FDOYrakGevvvTwgj2JvWiK8B29/qD9BELZPyXQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.0-rc.17.tgz", + "integrity": "sha512-e6usGaHKW5BMNZOymS1UcEYGowQMWcgZ71Z17Sl/h2+ZziNJ1a9n3Zvcz6LdRyIW5572wBCTH/Z+bKuZouGk9Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.0-rc.17.tgz", + "integrity": "sha512-b/CgbwAJpmrRLp02RPfhbudf5tZnN9nsPWK82znefso832etkem8H7FSZwxrOI9djcdTP7U6YfNhbRnh7djErg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.0-rc.17.tgz", + "integrity": "sha512-4EII1iNGRUN5WwGbF/kOh/EIkoDN9HsupgLQoXfY+D1oyJm7/F4t5PYU5n8SWZgG0FEwakyM8pGgwcBYruGTlA==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.0-rc.17.tgz", + "integrity": "sha512-AH8oq3XqQo4IibpVXvPeLDI5pzkpYn0WiZAfT05kFzoJ6tQNzwRdDYQ45M8I/gslbodRZwW8uxLhbSBbkv96rA==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.0-rc.17.tgz", + "integrity": "sha512-cLnjV3xfo7KslbU41Z7z8BH/E1y5mzUYzAqih1d1MDaIGZRCMqTijqLv76/P7fyHuvUcfGsIpqCdddbxLLK9rA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.0-rc.17.tgz", + "integrity": "sha512-0phclDw1spsL7dUB37sIARuis2tAgomCJXAHZlpt8PXZ4Ba0dRP1e+66lsRqrfhISeN9bEGNjQs+T/Fbd7oYGw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.0-rc.17.tgz", + "integrity": "sha512-0ag/hEgXOwgw4t8QyQvUCxvEg+V0KBcA6YuOx9g0r02MprutRF5dyljgm3EmR02O292UX7UeS6HzWHAl6KgyhA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.0-rc.17.tgz", + "integrity": "sha512-LEXei6vo0E5wTGwpkJ4KoT3OZJRnglwldt5ziLzOlc6qqb55z4tWNq2A+PFqCJuvWWdP53CVhG1Z9NtToDPJrA==", + "cpu": [ + "wasm32" + ], + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "1.10.0", + "@emnapi/runtime": "1.10.0", + "@napi-rs/wasm-runtime": "^1.1.4" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.0-rc.17.tgz", + "integrity": "sha512-gUmyzBl3SPMa6hrqFUth9sVfcLBlYsbMzBx5PlexMroZStgzGqlZ26pYG89rBb45Mnia+oil6YAIFeEWGWhoZA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.0-rc.17.tgz", + "integrity": "sha512-3hkiolcUAvPB9FLb3UZdfjVVNWherN1f/skkGWJP/fgSQhYUZpSIRr0/I8ZK9TkF3F7kxvJAk0+IcKvPHk9qQg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.17.tgz", + "integrity": "sha512-n8iosDOt6Ig1UhJ2AYqoIhHWh/isz0xpicHTzpKBeotdVsTEcxsSA/i3EVM7gQAj0rU27OLAxCjzlj15IWY7bg==", + "license": "MIT" + }, + "node_modules/@rollup/plugin-virtual": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-virtual/-/plugin-virtual-3.0.2.tgz", + "integrity": "sha512-10monEYsBp3scM4/ND4LNH5Rxvh3e/cVeL3jWTgZ2SrQ+BmUoQcopVQvnaMcOnykb1VkxUFuDAN+0FnpTFRy2A==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@shikijs/core": { + "version": "3.23.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.23.0.tgz", + "integrity": "sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.23.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4", + "hast-util-to-html": "^9.0.5" + } + }, + "node_modules/@shikijs/langs": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.0.2.tgz", + "integrity": "sha512-KaXby5dvoeuZzN0rYQiPMjFoUrz4hgwIE+D6Du9owcHcl6/g16/yT5BQxSW5cGt2MZBz6Hl0YuRqf12omRfUUg==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.0.2" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/langs/node_modules/@shikijs/types": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.0.2.tgz", + "integrity": "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg==", + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/primitive": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.0.2.tgz", + "integrity": "sha512-M6UMPrSa3fN5ayeJwFVl9qWofl273wtK1VG8ySDZ1mQBfhCpdd8nEx7nPZ/tk7k+TYcpqBZzj/AnwxT9lO+HJw==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.0.2", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/primitive/node_modules/@shikijs/types": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.0.2.tgz", + "integrity": "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg==", + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/themes": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.0.2.tgz", + "integrity": "sha512-mjCafwt8lJJaVSsQvNVrJumbnnj1RI8jbUKrPKgE6E3OvQKxnuRoBaYC51H4IGHePsGN/QtALglWBU7DoKDFnA==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.0.2" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/themes/node_modules/@shikijs/types": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.0.2.tgz", + "integrity": "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg==", + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/twoslash": { + "version": "3.23.0", + "resolved": "https://registry.npmjs.org/@shikijs/twoslash/-/twoslash-3.23.0.tgz", + "integrity": "sha512-pNaLJWMA3LU7PhT8tm9OQBZ1epy0jmdgeJzntBtr1EVXLbHxGzTj3mnf9vOdcl84l96qnlJXkJ/NGXZYBpXl5g==", + "license": "MIT", + "dependencies": { + "@shikijs/core": "3.23.0", + "@shikijs/types": "3.23.0", + "twoslash": "^0.3.6" + }, + "peerDependencies": { + "typescript": ">=5.5.0" + } + }, + "node_modules/@shikijs/types": { + "version": "3.23.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.23.0.tgz", + "integrity": "sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ==", + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", + "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", + "license": "MIT" + }, + "node_modules/@swc/html-wasm": { + "version": "1.15.40", + "resolved": "https://registry.npmjs.org/@swc/html-wasm/-/html-wasm-1.15.40.tgz", + "integrity": "sha512-WbRp7vSPK9bAGwpP1U8+RDE/xw1yj6P8ZYVqzA/64nlnFuB4MrW92EdkHiKvTPdlFDUZUno8yJKRKcRkE/UK6Q==", + "license": "Apache-2.0" + }, + "node_modules/@tailwindcss/node": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.2.2.tgz", + "integrity": "sha512-pXS+wJ2gZpVXqFaUEjojq7jzMpTGf8rU6ipJz5ovJV6PUGmlJ+jvIwGrzdHdQ80Sg+wmQxUFuoW1UAAwHNEdFA==", + "license": "MIT", + "dependencies": { + "@jridgewell/remapping": "^2.3.5", + "enhanced-resolve": "^5.19.0", + "jiti": "^2.6.1", + "lightningcss": "1.32.0", + "magic-string": "^0.30.21", + "source-map-js": "^1.2.1", + "tailwindcss": "4.2.2" + } + }, + "node_modules/@tailwindcss/node/node_modules/tailwindcss": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.2.2.tgz", + "integrity": "sha512-KWBIxs1Xb6NoLdMVqhbhgwZf2PGBpPEiwOqgI4pFIYbNTfBXiKYyWoTsXgBQ9WFg/OlhnvHaY+AEpW7wSmFo2Q==", + "license": "MIT" + }, + "node_modules/@tailwindcss/oxide": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.2.2.tgz", + "integrity": "sha512-qEUA07+E5kehxYp9BVMpq9E8vnJuBHfJEC0vPC5e7iL/hw7HR61aDKoVoKzrG+QKp56vhNZe4qwkRmMC0zDLvg==", + "license": "MIT", + "engines": { + "node": ">= 20" + }, + "optionalDependencies": { + "@tailwindcss/oxide-android-arm64": "4.2.2", + "@tailwindcss/oxide-darwin-arm64": "4.2.2", + "@tailwindcss/oxide-darwin-x64": "4.2.2", + "@tailwindcss/oxide-freebsd-x64": "4.2.2", + "@tailwindcss/oxide-linux-arm-gnueabihf": "4.2.2", + "@tailwindcss/oxide-linux-arm64-gnu": "4.2.2", + "@tailwindcss/oxide-linux-arm64-musl": "4.2.2", + "@tailwindcss/oxide-linux-x64-gnu": "4.2.2", + "@tailwindcss/oxide-linux-x64-musl": "4.2.2", + "@tailwindcss/oxide-wasm32-wasi": "4.2.2", + "@tailwindcss/oxide-win32-arm64-msvc": "4.2.2", + "@tailwindcss/oxide-win32-x64-msvc": "4.2.2" + } + }, + "node_modules/@tailwindcss/oxide-android-arm64": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.2.2.tgz", + "integrity": "sha512-dXGR1n+P3B6748jZO/SvHZq7qBOqqzQ+yFrXpoOWWALWndF9MoSKAT3Q0fYgAzYzGhxNYOoysRvYlpixRBBoDg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-darwin-arm64": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.2.2.tgz", + "integrity": "sha512-iq9Qjr6knfMpZHj55/37ouZeykwbDqF21gPFtfnhCCKGDcPI/21FKC9XdMO/XyBM7qKORx6UIhGgg6jLl7BZlg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-darwin-x64": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.2.2.tgz", + "integrity": "sha512-BlR+2c3nzc8f2G639LpL89YY4bdcIdUmiOOkv2GQv4/4M0vJlpXEa0JXNHhCHU7VWOKWT/CjqHdTP8aUuDJkuw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-freebsd-x64": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.2.2.tgz", + "integrity": "sha512-YUqUgrGMSu2CDO82hzlQ5qSb5xmx3RUrke/QgnoEx7KvmRJHQuZHZmZTLSuuHwFf0DJPybFMXMYf+WJdxHy/nQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.2.2.tgz", + "integrity": "sha512-FPdhvsW6g06T9BWT0qTwiVZYE2WIFo2dY5aCSpjG/S/u1tby+wXoslXS0kl3/KXnULlLr1E3NPRRw0g7t2kgaQ==", "cpu": [ - "ppc64" - ], - "libc": [ - "glibc" + "arm" ], "license": "MIT", "optional": true, @@ -1691,18 +2577,15 @@ "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">= 20" } }, - "node_modules/@rolldown/binding-linux-s390x-gnu": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.2.tgz", - "integrity": "sha512-fy8rXxuYEu602abC8MUNaPjYLIFzReOaEIEMKMUa0rFEUxNpVXhs15KSSQ4qlqSaM7B6rcj9rDZgADh/IGDzLQ==", + "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.2.2.tgz", + "integrity": "sha512-4og1V+ftEPXGttOO7eCmW7VICmzzJWgMx+QXAJRAhjrSjumCwWqMfkDrNu1LXEQzNAwz28NCUpucgQPrR4S2yw==", "cpu": [ - "s390x" - ], - "libc": [ - "glibc" + "arm64" ], "license": "MIT", "optional": true, @@ -1710,18 +2593,15 @@ "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">= 20" } }, - "node_modules/@rolldown/binding-linux-x64-gnu": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.2.tgz", - "integrity": "sha512-0+bOkiQ779+r1WpoHOWHqncvyySci0vKph+myNDYb+im6meJAzHQXay6oEgnkHuUGouM1LKTZwqKpBow6Kj7CQ==", + "node_modules/@tailwindcss/oxide-linux-arm64-musl": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.2.2.tgz", + "integrity": "sha512-oCfG/mS+/+XRlwNjnsNLVwnMWYH7tn/kYPsNPh+JSOMlnt93mYNCKHYzylRhI51X+TbR+ufNhhKKzm6QkqX8ag==", "cpu": [ - "x64" - ], - "libc": [ - "glibc" + "arm64" ], "license": "MIT", "optional": true, @@ -1729,66 +2609,74 @@ "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">= 20" } }, - "node_modules/@rolldown/binding-linux-x64-musl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.2.tgz", - "integrity": "sha512-mjSkrzZK5Qsl0a9d1JgILOiuZOSDTVdKENcSXBoqbzSrspLR/4/IRVDo5wd2GgZjNss/viBFJdeq+j7qH2nypw==", + "node_modules/@tailwindcss/oxide-linux-x64-gnu": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.2.2.tgz", + "integrity": "sha512-rTAGAkDgqbXHNp/xW0iugLVmX62wOp2PoE39BTCGKjv3Iocf6AFbRP/wZT/kuCxC9QBh9Pu8XPkv/zCZB2mcMg==", "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">= 20" } }, - "node_modules/@rolldown/binding-openharmony-arm64": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.2.tgz", - "integrity": "sha512-1v5vHasdfQAZoEHakBV72LIFAC9JjnymsiKxp+GEr/ma3+NJCPSaYK+qavInOovJkgwFrs7GccX2d6IgDA3Z5w==", + "node_modules/@tailwindcss/oxide-linux-x64-musl": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.2.2.tgz", + "integrity": "sha512-XW3t3qwbIwiSyRCggeO2zxe3KWaEbM0/kW9e8+0XpBgyKU4ATYzcVSMKteZJ1iukJ3HgHBjbg9P5YPRCVUxlnQ==", "cpu": [ - "arm64" + "x64" ], "license": "MIT", "optional": true, "os": [ - "openharmony" + "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">= 20" } }, - "node_modules/@rolldown/binding-wasm32-wasi": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.2.tgz", - "integrity": "sha512-mb1VobWn6NheziTk5/WEaR6AKVbrwT5sOi6C7zk3gy/pD1qtJfU1j4PgTo2NJnOtbL9Dl3Aeei8w9jJ7qC2jZQ==", + "node_modules/@tailwindcss/oxide-wasm32-wasi": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.2.2.tgz", + "integrity": "sha512-eKSztKsmEsn1O5lJ4ZAfyn41NfG7vzCg496YiGtMDV86jz1q/irhms5O0VrY6ZwTUkFy/EKG3RfWgxSI3VbZ8Q==", + "bundleDependencies": [ + "@napi-rs/wasm-runtime", + "@emnapi/core", + "@emnapi/runtime", + "@tybys/wasm-util", + "@emnapi/wasi-threads", + "tslib" + ], "cpu": [ "wasm32" ], "license": "MIT", "optional": true, "dependencies": { - "@emnapi/core": "1.10.0", - "@emnapi/runtime": "1.10.0", - "@napi-rs/wasm-runtime": "^1.1.4" + "@emnapi/core": "^1.8.1", + "@emnapi/runtime": "^1.8.1", + "@emnapi/wasi-threads": "^1.1.0", + "@napi-rs/wasm-runtime": "^1.1.1", + "@tybys/wasm-util": "^0.10.1", + "tslib": "^2.8.1" }, "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=14.0.0" } }, - "node_modules/@rolldown/binding-win32-arm64-msvc": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.2.tgz", - "integrity": "sha512-SqKonF56vA/L2yHwHYcEp2P34URpOZ7d1fS635cTkpDnUtEGdUbhI6NzsPdqeSWvAAeGDrxjWjNmibDIdFf9/A==", + "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.2.2.tgz", + "integrity": "sha512-qPmaQM4iKu5mxpsrWZMOZRgZv1tOZpUm+zdhhQP0VhJfyGGO3aUKdbh3gDZc/dPLQwW4eSqWGrrcWNBZWUWaXQ==", "cpu": [ "arm64" ], @@ -1798,13 +2686,13 @@ "win32" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">= 20" } }, - "node_modules/@rolldown/binding-win32-x64-msvc": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.2.tgz", - "integrity": "sha512-v7qRI7gXLRINcOGXt+7YmAZ6iFuyZVMIoXAxhd8oP+DR9dLfL9GfNIx7PLMxmhZdvq8waUJBQiWN9EKNy+TRBQ==", + "node_modules/@tailwindcss/oxide-win32-x64-msvc": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.2.2.tgz", + "integrity": "sha512-1T/37VvI7WyH66b+vqHj/cLwnCxt7Qt3WFu5Q8hk65aOvlwAhs7rAp1VkulBJw/N4tMirXjVnylTR72uI0HGcA==", "cpu": [ "x64" ], @@ -1814,159 +2702,32 @@ "win32" ], "engines": { - "node": "^20.19.0 || >=22.12.0" - } - }, - "node_modules/@rolldown/pluginutils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", - "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", - "license": "MIT" - }, - "node_modules/@rollup/plugin-virtual": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-virtual/-/plugin-virtual-3.0.2.tgz", - "integrity": "sha512-10monEYsBp3scM4/ND4LNH5Rxvh3e/cVeL3jWTgZ2SrQ+BmUoQcopVQvnaMcOnykb1VkxUFuDAN+0FnpTFRy2A==", - "license": "MIT", - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@shikijs/core": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.3.1.tgz", - "integrity": "sha512-ANMDxuaPsNMdDC1m4vfvhlDmJweMwkE5XitTwrq2rWHx5jM+dlm4MmHt2PP6t0uejfR77SuhrhJ0zEijIF/uhA==", - "license": "MIT", - "dependencies": { - "@shikijs/primitive": "4.3.1", - "@shikijs/types": "4.3.1", - "@shikijs/vscode-textmate": "^10.0.2", - "@types/hast": "^3.0.4", - "hast-util-to-html": "^9.0.5" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/engine-javascript": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.3.1.tgz", - "integrity": "sha512-JBItcnPuYq7jVJdZo/vMj94r+szT7XEjHFX+mvFDGSEIbVAXAGyHAHzhbWzpGOwYidCZrErJLLgn2PVeiokHnQ==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "4.3.1", - "@shikijs/vscode-textmate": "^10.0.2", - "oniguruma-to-es": "^4.3.6" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/engine-oniguruma": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.3.1.tgz", - "integrity": "sha512-OXyNMzg0pews+msMj4cHeqT4xiYKKvbnn6VbdAXxfoFl3SSx4fJTc8FadECuc5/H9p3BzhNAoAUXKwAu9rWYhg==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "4.3.1", - "@shikijs/vscode-textmate": "^10.0.2" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/langs": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.3.1.tgz", - "integrity": "sha512-m0l9nsDqgBHvbZbk7A0/kXz/impK3uB/c6rAn6Gpg/uPtdZRQ+alsN/17MU5thb68XTj/4DxkZAotrM0GGSpDQ==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "4.3.1" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/primitive": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.3.1.tgz", - "integrity": "sha512-CXQRQOYy1leqQ8ceTeJdmXv/bsUY++6QyLpXJ94LZAAYj5X2SKRdc5ipguv4NPyGVKItB2PPwUpRNe0Sjh5S1A==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "4.3.1", - "@shikijs/vscode-textmate": "^10.0.2", - "@types/hast": "^3.0.4" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/themes": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.3.1.tgz", - "integrity": "sha512-dgpoJ4WqNi2yTmizQHBJ5zcX6j2lE6icN/0yt4l1kkf16jrY/pwPLoTb1ETsWMz0OBLf9ZNvwmxft+cH+N9qSA==", - "license": "MIT", - "dependencies": { - "@shikijs/types": "4.3.1" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/@shikijs/twoslash": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/twoslash/-/twoslash-4.3.1.tgz", - "integrity": "sha512-xK8inH/gK++1V4rTxrwCwjvaNwkkJ7oDjOIpdqONVxIpAFnVC3gzqjH5KiXGTelUcxpUJ3PtOKWct1YQ0kAloA==", - "license": "MIT", - "dependencies": { - "@shikijs/core": "4.3.1", - "@shikijs/types": "4.3.1", - "twoslash": "^0.3.9" - }, - "engines": { - "node": ">=20" - }, - "peerDependencies": { - "typescript": ">=5.5.0" + "node": ">= 20" } }, - "node_modules/@shikijs/types": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.3.1.tgz", - "integrity": "sha512-CHFxE0jztBIZRHH6gxXE7DXUCFXjReEGxZ/j0rfSLGKZuwp2xBYycEP14875DSa9KLL/6700oxIq6oO6ef9K2g==", + "node_modules/@tailwindcss/postcss": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@tailwindcss/postcss/-/postcss-4.2.2.tgz", + "integrity": "sha512-n4goKQbW8RVXIbNKRB/45LzyUqN451deQK0nzIeauVEqjlI49slUlgKYJM2QyUzap/PcpnS7kzSUmPb1sCRvYQ==", "license": "MIT", "dependencies": { - "@shikijs/vscode-textmate": "^10.0.2", - "@types/hast": "^3.0.4" - }, - "engines": { - "node": ">=20" + "@alloc/quick-lru": "^5.2.0", + "@tailwindcss/node": "4.2.2", + "@tailwindcss/oxide": "4.2.2", + "postcss": "^8.5.6", + "tailwindcss": "4.2.2" } }, - "node_modules/@shikijs/vscode-textmate": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", - "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", + "node_modules/@tailwindcss/postcss/node_modules/tailwindcss": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.2.2.tgz", + "integrity": "sha512-KWBIxs1Xb6NoLdMVqhbhgwZf2PGBpPEiwOqgI4pFIYbNTfBXiKYyWoTsXgBQ9WFg/OlhnvHaY+AEpW7wSmFo2Q==", "license": "MIT" }, - "node_modules/@swc/html-wasm": { - "version": "1.15.43", - "resolved": "https://registry.npmjs.org/@swc/html-wasm/-/html-wasm-1.15.43.tgz", - "integrity": "sha512-tw1DpLmh54BDNPDBY/tHLDFcLnxzji242Fu/8Y8nrbSBdDndO0Lv56g869mRgrsmZBvsoS31JqgDkf6YYtvi3g==", - "license": "Apache-2.0" - }, "node_modules/@tybys/wasm-util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz", - "integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz", + "integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==", "license": "MIT", "optional": true, "dependencies": { @@ -1974,18 +2735,18 @@ } }, "node_modules/@types/debug": { - "version": "4.1.13", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", - "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", "license": "MIT", "dependencies": { "@types/ms": "*" } }, "node_modules/@types/estree": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", - "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", "license": "MIT" }, "node_modules/@types/estree-jsx": { @@ -2022,11 +2783,10 @@ "license": "MIT" }, "node_modules/@types/react": { - "version": "19.2.17", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.17.tgz", - "integrity": "sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw==", + "version": "19.2.14", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", + "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", "license": "MIT", - "peer": true, "dependencies": { "csstype": "^3.2.2" } @@ -2050,9 +2810,9 @@ } }, "node_modules/@ungap/structured-clone": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.2.tgz", - "integrity": "sha512-5jsZFwgR5rTdKwidH9Qmat75RKwqfpKlWWB1frDkljN127mwqBu8K0PYo7/hFpF03IEJpfVPpCQDY/eDx3iHvA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", "license": "ISC" }, "node_modules/@vcarl/remark-headings": { @@ -2114,9 +2874,9 @@ } }, "node_modules/acorn": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", - "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", + "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -2134,6 +2894,43 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/aria-hidden": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.6.tgz", @@ -2165,12 +2962,36 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "license": "ISC" }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ccount": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", @@ -2221,12 +3042,68 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/classnames": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==", "license": "MIT" }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, "node_modules/comma-separated-tokens": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", @@ -2262,12 +3139,23 @@ ], "license": "MIT" }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/csstype": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/debug": { "version": "4.4.3", @@ -2313,6 +3201,15 @@ } } }, + "node_modules/dependency-graph": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-1.0.0.tgz", + "integrity": "sha512-cW3gggJ28HZ/LExwxP2B++aiKxhJXMSIt9K48FOXQkm+vuG5gyatXnLsONRJdzO/7VfjDIiaOOa/bs4l464Lwg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -2322,6 +3219,15 @@ "node": ">=6" } }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, "node_modules/detect-node-es": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", @@ -2341,6 +3247,25 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/enhanced-resolve": { + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.20.1.tgz", + "integrity": "sha512-Qohcme7V1inbAfvjItgw0EaxVX5q2rdVEZHRBrEQdRZTssLDGsL8Lwrznl8oQ/6kuTJONLaDcGjkNP247XEhcA==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.3.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/entities": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", @@ -2385,6 +3310,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/escape-string-regexp": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", @@ -2455,21 +3389,53 @@ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "license": "MIT" }, - "node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs-extra": { + "version": "11.3.4", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.4.tgz", + "integrity": "sha512-CTXd6rk/M3/ULNQj8FBqBWHYBVYybQ3VPBw0xGKFe3tuH7ytT6ACnvzpIQ3UZtB8yvUKC2cXn1a+x+5EVQLovA==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" } }, "node_modules/get-nonce": { @@ -2488,17 +3454,23 @@ "license": "ISC" }, "node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "license": "ISC", "dependencies": { - "is-glob": "^4.0.3" + "is-glob": "^4.0.1" }, "engines": { - "node": ">=10.13.0" + "node": ">= 6" } }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, "node_modules/hast-util-from-parse5": { "version": "8.0.3", "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-8.0.3.tgz", @@ -2747,6 +3719,18 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-decimal": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", @@ -2766,6 +3750,15 @@ "node": ">=0.10.0" } }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -2788,6 +3781,15 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", @@ -2800,17 +3802,292 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lightningcss-wasm": { + "node_modules/jiti": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz", + "integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==", + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, + "node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/lightningcss": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", + "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.32.0", + "lightningcss-darwin-arm64": "1.32.0", + "lightningcss-darwin-x64": "1.32.0", + "lightningcss-freebsd-x64": "1.32.0", + "lightningcss-linux-arm-gnueabihf": "1.32.0", + "lightningcss-linux-arm64-gnu": "1.32.0", + "lightningcss-linux-arm64-musl": "1.32.0", + "lightningcss-linux-x64-gnu": "1.32.0", + "lightningcss-linux-x64-musl": "1.32.0", + "lightningcss-win32-arm64-msvc": "1.32.0", + "lightningcss-win32-x64-msvc": "1.32.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", + "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", + "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", + "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", + "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", + "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", + "cpu": [ + "arm" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", + "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", + "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", + "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", + "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-wasm": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-wasm/-/lightningcss-wasm-1.32.0.tgz", + "integrity": "sha512-SteAkCtRuSCDYPGHKhLV/dDs5Bk+7I4QUxWxfk4xwsTI1rQk8MQyYtpGcd3NECsUGzK0q2/KqoVS+YHCqKHUTQ==", + "bundleDependencies": [ + "napi-wasm" + ], + "license": "MPL-2.0", + "dependencies": { + "napi-wasm": "^1.0.1" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-wasm/node_modules/napi-wasm": { + "version": "1.1.3", + "inBundle": true, + "license": "MIT" + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", + "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-wasm/-/lightningcss-wasm-1.32.0.tgz", - "integrity": "sha512-SteAkCtRuSCDYPGHKhLV/dDs5Bk+7I4QUxWxfk4xwsTI1rQk8MQyYtpGcd3NECsUGzK0q2/KqoVS+YHCqKHUTQ==", - "bundleDependencies": [ - "napi-wasm" + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", + "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", + "cpu": [ + "x64" ], "license": "MPL-2.0", - "dependencies": { - "napi-wasm": "^1.0.1" - }, + "optional": true, + "os": [ + "win32" + ], "engines": { "node": ">= 12.0.0" }, @@ -2819,10 +4096,17 @@ "url": "https://opencollective.com/parcel" } }, - "node_modules/lightningcss-wasm/node_modules/napi-wasm": { - "version": "1.1.3", - "inBundle": true, - "license": "MIT" + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } }, "node_modules/longest-streak": { "version": "3.1.0", @@ -2834,6 +4118,15 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, "node_modules/markdown-table": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", @@ -2998,23 +4291,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/mdast-util-mdx": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz", - "integrity": "sha512-JfbYLAW7XnYTTbUsmpu0kdBUVe+yKVJZBItEjwyYJiDJuZ9w4eeaqks4HQO+R7objWgS2ymV60GYpI14Ug554w==", - "license": "MIT", - "dependencies": { - "mdast-util-from-markdown": "^2.0.0", - "mdast-util-mdx-expression": "^2.0.0", - "mdast-util-mdx-jsx": "^3.0.0", - "mdast-util-mdxjs-esm": "^2.0.0", - "mdast-util-to-markdown": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/mdast-util-mdx-expression": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", @@ -3368,108 +4644,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/micromark-extension-mdx-expression": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.1.tgz", - "integrity": "sha512-dD/ADLJ1AeMvSAKBwO22zG22N4ybhe7kFIZ3LsDI0GlsNr2A3KYxb0LdC1u5rj4Nw+CHKY0RVdnHX8vj8ejm4Q==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "devlop": "^1.0.0", - "micromark-factory-mdx-expression": "^2.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-events-to-acorn": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0" - } - }, - "node_modules/micromark-extension-mdx-jsx": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-3.0.2.tgz", - "integrity": "sha512-e5+q1DjMh62LZAJOnDraSSbDMvGJ8x3cbjygy2qFEi7HCeUT4BDKCvMozPozcD6WmOt6sVvYDNBKhFSz3kjOVQ==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "devlop": "^1.0.0", - "estree-util-is-identifier-name": "^3.0.0", - "micromark-factory-mdx-expression": "^2.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-events-to-acorn": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-mdx-md": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-mdx-md/-/micromark-extension-mdx-md-2.0.0.tgz", - "integrity": "sha512-EpAiszsB3blw4Rpba7xTOUptcFeBFi+6PY8VnJ2hhimH+vCQDirWgsMpz7w1XcZE7LVrSAUGb9VJpG9ghlYvYQ==", - "license": "MIT", - "dependencies": { - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-mdxjs": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs/-/micromark-extension-mdxjs-3.0.0.tgz", - "integrity": "sha512-A873fJfhnJ2siZyUrJ31l34Uqwy4xIFmvPY1oj+Ean5PHcPBYzEsvqvWGaWcfEIr11O5Dlw3p2y0tZWpKHDejQ==", - "license": "MIT", - "dependencies": { - "acorn": "^8.0.0", - "acorn-jsx": "^5.0.0", - "micromark-extension-mdx-expression": "^3.0.0", - "micromark-extension-mdx-jsx": "^3.0.0", - "micromark-extension-mdx-md": "^2.0.0", - "micromark-extension-mdxjs-esm": "^3.0.0", - "micromark-util-combine-extensions": "^2.0.0", - "micromark-util-types": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, - "node_modules/micromark-extension-mdxjs-esm": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-3.0.0.tgz", - "integrity": "sha512-DJFl4ZqkErRpq/dAPyeWp15tGrcrrJho1hKK5uBS70BCtfrIFg81sqcTVu3Ta+KD1Tk5vAtBNElWxtAa+m8K9A==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "devlop": "^1.0.0", - "micromark-core-commonmark": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-events-to-acorn": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0", - "unist-util-position-from-estree": "^2.0.0", - "vfile-message": "^4.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/micromark-factory-destination": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", @@ -3513,33 +4687,6 @@ "micromark-util-types": "^2.0.0" } }, - "node_modules/micromark-factory-mdx-expression": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-2.0.3.tgz", - "integrity": "sha512-kQnEtA3vzucU2BkrIa8/VaSAsP+EJ3CKOvhMuJgOEGg9KDC6OAY6nSnNDVRiVNRqj7Y4SlSzcStaH/5jge8JdQ==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "devlop": "^1.0.0", - "micromark-factory-space": "^2.0.0", - "micromark-util-character": "^2.0.0", - "micromark-util-events-to-acorn": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0", - "unist-util-position-from-estree": "^2.0.0", - "vfile-message": "^4.0.0" - } - }, "node_modules/micromark-factory-space": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", @@ -3741,31 +4888,6 @@ ], "license": "MIT" }, - "node_modules/micromark-util-events-to-acorn": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/micromark-util-events-to-acorn/-/micromark-util-events-to-acorn-2.0.3.tgz", - "integrity": "sha512-jmsiEIiZ1n7X1Rr5k8wVExBQCg5jy4UXVADItHmNk1zkwEVhBuIUKRu3fqv+hs4nxLISi2DQGlqIOGiFxgbfHg==", - "funding": [ - { - "type": "GitHub Sponsors", - "url": "https://github.com/sponsors/unifiedjs" - }, - { - "type": "OpenCollective", - "url": "https://opencollective.com/unified" - } - ], - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0", - "@types/unist": "^3.0.0", - "devlop": "^1.0.0", - "estree-util-visit": "^2.0.0", - "micromark-util-symbol": "^2.0.0", - "micromark-util-types": "^2.0.0", - "vfile-message": "^4.0.0" - } - }, "node_modules/micromark-util-html-tag-name": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", @@ -3901,6 +5023,33 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/nth-check": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", @@ -3914,18 +5063,18 @@ } }, "node_modules/oniguruma-parser": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz", - "integrity": "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==", + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.1.tgz", + "integrity": "sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==", "license": "MIT" }, "node_modules/oniguruma-to-es": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz", - "integrity": "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.5.tgz", + "integrity": "sha512-Zjygswjpsewa0NLTsiizVuMQZbp0MDyM6lIt66OxsF21npUDlzpHi1Mgb/qhQdkb+dWFTzJmFbEWdvZgRho8eQ==", "license": "MIT", "dependencies": { - "oniguruma-parser": "^0.12.2", + "oniguruma-parser": "^0.12.1", "regex": "^6.1.0", "regex-recursion": "^6.0.2" } @@ -3955,46 +5104,217 @@ "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", "license": "MIT" }, - "node_modules/parse5": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", - "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", + "node_modules/parse5": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", + "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", + "license": "MIT", + "dependencies": { + "entities": "^6.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/piscina": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/piscina/-/piscina-5.2.0.tgz", + "integrity": "sha512-DszUCKeVN/5G5QKo6jAVHL8fmKnkJvQ0ACiVgY7YGCq3TUB2oznAOayvZPIAdEThvhczkXR+qm3IHsNXpFCYfA==", + "license": "MIT", + "engines": { + "node": ">=20.x" + }, + "optionalDependencies": { + "@napi-rs/nice": "^1.0.4" + } + }, + "node_modules/postcss": { + "version": "8.5.10", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.10.tgz", + "integrity": "sha512-pMMHxBOZKFU6HgAZ4eyGnwXF/EvPGGqUr0MnZ5+99485wwW41kW91A4LOGxSHhgugZmSChL5AlElNdwlNgcnLQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-calc": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-10.1.1.tgz", + "integrity": "sha512-NYEsLHh8DgG/PRH2+G9BTuUdtf9ViS+vdoQ0YA5OQdGsfN4ztiwtDWNtBl9EKeqNMFnIu8IKZ0cLxEQ5r5KVMw==", + "license": "MIT", + "dependencies": { + "postcss-selector-parser": "^7.0.0", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^18.12 || ^20.9 || >=22.0" + }, + "peerDependencies": { + "postcss": "^8.4.38" + } + }, + "node_modules/postcss-cli": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/postcss-cli/-/postcss-cli-11.0.1.tgz", + "integrity": "sha512-0UnkNPSayHKRe/tc2YGW6XnSqqOA9eqpiRMgRlV1S6HdGi16vwJBx7lviARzbV1HpQHqLLRH3o8vTcB0cLc+5g==", + "license": "MIT", + "dependencies": { + "chokidar": "^3.3.0", + "dependency-graph": "^1.0.0", + "fs-extra": "^11.0.0", + "picocolors": "^1.0.0", + "postcss-load-config": "^5.0.0", + "postcss-reporter": "^7.0.0", + "pretty-hrtime": "^1.0.3", + "read-cache": "^1.0.0", + "slash": "^5.0.0", + "tinyglobby": "^0.2.12", + "yargs": "^17.0.0" + }, + "bin": { + "postcss": "index.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/postcss-load-config": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-5.1.0.tgz", + "integrity": "sha512-G5AJ+IX0aD0dygOE0yFZQ/huFFMSNneyfp0e3/bT05a8OfPC5FUoZRPfGijUdGOJNMewJiwzcHJXFafFzeKFVA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "license": "MIT", "dependencies": { - "entities": "^6.0.0" + "lilconfig": "^3.1.1", + "yaml": "^2.4.2" }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "jiti": ">=1.21.0", + "postcss": ">=8.0.9", + "tsx": "^4.8.1" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + }, + "postcss": { + "optional": true + }, + "tsx": { + "optional": true + } } }, - "node_modules/picomatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", - "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "node_modules/postcss-reporter": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/postcss-reporter/-/postcss-reporter-7.1.0.tgz", + "integrity": "sha512-/eoEylGWyy6/DOiMP5lmFRdmDKThqgn7D6hP2dXKJI/0rJSO1ADFNngZfDzxL0YAxFvws+Rtpuji1YIHj4mySA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "license": "MIT", + "dependencies": { + "picocolors": "^1.0.0", + "thenby": "^1.3.4" + }, "engines": { - "node": ">=12" + "node": ">=10" }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "peerDependencies": { + "postcss": "^8.1.0" } }, - "node_modules/piscina": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/piscina/-/piscina-5.2.0.tgz", - "integrity": "sha512-DszUCKeVN/5G5QKo6jAVHL8fmKnkJvQ0ACiVgY7YGCq3TUB2oznAOayvZPIAdEThvhczkXR+qm3IHsNXpFCYfA==", + "node_modules/postcss-selector-parser": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.1.tgz", + "integrity": "sha512-orRsuYpJVw8LdAwqqLykBj9ecS5/cRHlI5+nvTo8LcCKmzDmqVORXtOIYEEQuL9D4BxtA1lm5isAqzQZCoQ6Eg==", "license": "MIT", - "engines": { - "node": ">=20.x" + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" }, - "optionalDependencies": { - "@napi-rs/nice": "^1.0.4" + "engines": { + "node": ">=4" } }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "license": "MIT" + }, "node_modules/preact": { - "version": "10.29.4", - "resolved": "https://registry.npmjs.org/preact/-/preact-10.29.4.tgz", - "integrity": "sha512-GMpwh9+NJ8tSmqwIaVyFRQkiKfBEzQ+k7r7tle4W+kaJ+7wJiB9hFz9BixAomMtenPPSBfM4bZhXozGxhf0uFQ==", + "version": "10.29.1", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.29.1.tgz", + "integrity": "sha512-gQCLc/vWroE8lIpleXtdJhTFDogTdZG9AjMUpVkDf2iTCNwYNWA+u16dL41TqUDJO4gm2IgrcMv3uTpjd4Pwmg==", "license": "MIT", "funding": { "type": "opencollective", @@ -4002,14 +5322,23 @@ } }, "node_modules/preact-render-to-string": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-6.7.0.tgz", - "integrity": "sha512-Z4WR8fmLMRpdYqJ9i7vrlXSsSrxVJydwrkEXHapexfARbWfGb7vGcnvNQnIzN0cXciMVOlz/XLoiMCi9gUsy9Q==", + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-6.6.7.tgz", + "integrity": "sha512-3XdbsX3+vn9dQW+jJI/FsI9rlkgl6dbeUpqLsChak6jp3j3auFqBCkno7VChbMFs5Q8ylBj6DrUkKRwtVN3nvw==", "license": "MIT", "peerDependencies": { "preact": ">=10 || >= 11.0.0-0" } }, + "node_modules/pretty-hrtime": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", + "integrity": "sha512-66hKPCr+72mlfiSjlEB1+45IjXSqvVAIy6mocupoww4tBFE9R9IhwwUGoI4G++Tc9Aq+2rxOt0RFU6gPcrte0A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/prism-react-renderer": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/prism-react-renderer/-/prism-react-renderer-1.3.5.tgz", @@ -4020,9 +5349,9 @@ } }, "node_modules/property-information": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", - "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", + "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", "license": "MIT", "funding": { "type": "github", @@ -4030,25 +5359,25 @@ } }, "node_modules/react": { - "version": "19.2.7", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.7.tgz", - "integrity": "sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ==", + "version": "19.2.4", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", + "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/react-dom": { - "version": "19.2.7", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.7.tgz", - "integrity": "sha512-t0BRVXvbiE/o20Hfw669rLbMCDWtYZLvmJigy2f0MxsXF+71pxhR3xOkspmsO8h3ZlNzyibAmtCa3l4lYKk6gQ==", + "version": "19.2.4", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz", + "integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==", "license": "MIT", "peer": true, "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { - "react": "^19.2.7" + "react": "^19.2.4" } }, "node_modules/react-markdown": { @@ -4147,6 +5476,27 @@ } } }, + "node_modules/read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", + "license": "MIT", + "dependencies": { + "pify": "^2.3.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/reading-time": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/reading-time/-/reading-time-1.5.0.tgz", @@ -4292,20 +5642,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remark-mdx": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.1.1.tgz", - "integrity": "sha512-Pjj2IYlUY3+D8x00UJsIOg5BEvfMyeI+2uLPn9VO9Wg4MEtN/VTIq2NEJQfde9PnX15KgtHyl9S0BcTnWrIuWg==", - "license": "MIT", - "dependencies": { - "mdast-util-mdx": "^3.0.0", - "micromark-extension-mdxjs": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/remark-parse": { "version": "11.0.0", "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", @@ -4354,14 +5690,23 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/rolldown": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.2.tgz", - "integrity": "sha512-oZx5zVDtVB44AW3eaifgDml1gWRDZGvjcfdxonE4swNPG98PrrXjaO/KrnUjzlMnztCCRVlUueA1kCXhARGk6g==", + "version": "1.0.0-rc.17", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.0-rc.17.tgz", + "integrity": "sha512-ZrT53oAKrtA4+YtBWPQbtPOxIbVDbxT0orcYERKd63VJTF13zPcgXTvD4843L8pcsI7M6MErt8QtON6lrB9tyA==", "license": "MIT", "dependencies": { - "@oxc-project/types": "=0.132.0", - "@rolldown/pluginutils": "^1.0.0" + "@oxc-project/types": "=0.127.0", + "@rolldown/pluginutils": "1.0.0-rc.17" }, "bin": { "rolldown": "bin/cli.mjs" @@ -4370,21 +5715,21 @@ "node": "^20.19.0 || >=22.12.0" }, "optionalDependencies": { - "@rolldown/binding-android-arm64": "1.0.2", - "@rolldown/binding-darwin-arm64": "1.0.2", - "@rolldown/binding-darwin-x64": "1.0.2", - "@rolldown/binding-freebsd-x64": "1.0.2", - "@rolldown/binding-linux-arm-gnueabihf": "1.0.2", - "@rolldown/binding-linux-arm64-gnu": "1.0.2", - "@rolldown/binding-linux-arm64-musl": "1.0.2", - "@rolldown/binding-linux-ppc64-gnu": "1.0.2", - "@rolldown/binding-linux-s390x-gnu": "1.0.2", - "@rolldown/binding-linux-x64-gnu": "1.0.2", - "@rolldown/binding-linux-x64-musl": "1.0.2", - "@rolldown/binding-openharmony-arm64": "1.0.2", - "@rolldown/binding-wasm32-wasi": "1.0.2", - "@rolldown/binding-win32-arm64-msvc": "1.0.2", - "@rolldown/binding-win32-x64-msvc": "1.0.2" + "@rolldown/binding-android-arm64": "1.0.0-rc.17", + "@rolldown/binding-darwin-arm64": "1.0.0-rc.17", + "@rolldown/binding-darwin-x64": "1.0.0-rc.17", + "@rolldown/binding-freebsd-x64": "1.0.0-rc.17", + "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.17", + "@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.17", + "@rolldown/binding-linux-arm64-musl": "1.0.0-rc.17", + "@rolldown/binding-linux-ppc64-gnu": "1.0.0-rc.17", + "@rolldown/binding-linux-s390x-gnu": "1.0.0-rc.17", + "@rolldown/binding-linux-x64-gnu": "1.0.0-rc.17", + "@rolldown/binding-linux-x64-musl": "1.0.0-rc.17", + "@rolldown/binding-openharmony-arm64": "1.0.0-rc.17", + "@rolldown/binding-wasm32-wasi": "1.0.0-rc.17", + "@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.17", + "@rolldown/binding-win32-x64-msvc": "1.0.0-rc.17" } }, "node_modules/scheduler": { @@ -4395,9 +5740,9 @@ "peer": true }, "node_modules/semver": { - "version": "7.8.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", - "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz", + "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -4407,17 +5752,73 @@ } }, "node_modules/shiki": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.3.1.tgz", - "integrity": "sha512-oR+qDVi2OjX1tmDpyv+3KviX01KzO6Af+0NNnKnsp9491UEGz2YpxTuJboS/6VhYpTdqzmuJBuiTlrAWWJAssw==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.0.2.tgz", + "integrity": "sha512-eAVKTMedR5ckPo4xne/PjYQYrU3qx78gtJZ+sHlXEg5IHhhoQhMfZVzetTYuaJS0L2Ef3AcCRzCHV8T0WI6nIQ==", + "license": "MIT", + "dependencies": { + "@shikijs/core": "4.0.2", + "@shikijs/engine-javascript": "4.0.2", + "@shikijs/engine-oniguruma": "4.0.2", + "@shikijs/langs": "4.0.2", + "@shikijs/themes": "4.0.2", + "@shikijs/types": "4.0.2", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/shiki/node_modules/@shikijs/core": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.0.2.tgz", + "integrity": "sha512-hxT0YF4ExEqB8G/qFdtJvpmHXBYJ2lWW7qTHDarVkIudPFE6iCIrqdgWxGn5s+ppkGXI0aEGlibI0PAyzP3zlw==", + "license": "MIT", + "dependencies": { + "@shikijs/primitive": "4.0.2", + "@shikijs/types": "4.0.2", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4", + "hast-util-to-html": "^9.0.5" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/shiki/node_modules/@shikijs/engine-javascript": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.0.2.tgz", + "integrity": "sha512-7PW0Nm49DcoUIQEXlJhNNBHyoGMjalRETTCcjMqEaMoJRLljy1Bi/EGV3/qLBgLKQejdspiiYuHGQW6dX94Nag==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.0.2", + "@shikijs/vscode-textmate": "^10.0.2", + "oniguruma-to-es": "^4.3.4" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/shiki/node_modules/@shikijs/engine-oniguruma": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.0.2.tgz", + "integrity": "sha512-UpCB9Y2sUKlS9z8juFSKz7ZtysmeXCgnRF0dlhXBkmQnek7lAToPte8DkxmEYGNTMii72zU/lyXiCB6StuZeJg==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.0.2", + "@shikijs/vscode-textmate": "^10.0.2" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/shiki/node_modules/@shikijs/types": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.0.2.tgz", + "integrity": "sha512-qzbeRooUTPnLE+sHD/Z8DStmaDgnbbc/pMrU203950aRqjX/6AFHeDYT+j00y2lPdz0ywJKx7o/7qnqTivtlXg==", "license": "MIT", "dependencies": { - "@shikijs/core": "4.3.1", - "@shikijs/engine-javascript": "4.3.1", - "@shikijs/engine-oniguruma": "4.3.1", - "@shikijs/langs": "4.3.1", - "@shikijs/themes": "4.3.1", - "@shikijs/types": "4.3.1", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" }, @@ -4425,6 +5826,18 @@ "node": ">=20" } }, + "node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/source-map": { "version": "0.7.6", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", @@ -4434,6 +5847,15 @@ "node": ">= 12" } }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/space-separated-tokens": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", @@ -4444,6 +5866,20 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/stringify-entities": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", @@ -4458,6 +5894,18 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/style-to-js": { "version": "1.1.21", "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.21.tgz", @@ -4476,6 +5924,31 @@ "inline-style-parser": "0.2.7" } }, + "node_modules/tailwindcss": { + "version": "4.1.18", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.18.tgz", + "integrity": "sha512-4+Z+0yiYyEtUVCScyfHCxOYP06L5Ne+JiHhY2IjR2KWMIWhJOYZKLSGZaP5HkZ8+bY0cxfzwDE5uOmzFXyIwxw==", + "license": "MIT" + }, + "node_modules/tapable": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", + "integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==", + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/thenby": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/thenby/-/thenby-1.3.4.tgz", + "integrity": "sha512-89Gi5raiWA3QZ4b2ePcEwswC3me9JIg+ToSgtE0JWeCynLnLxNr/f9G+xfo9K+Oj4AFdom8YNJjibIARTJmapQ==", + "license": "Apache-2.0" + }, "node_modules/throttleit": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-2.1.0.tgz", @@ -4489,13 +5962,13 @@ } }, "node_modules/tinyglobby": { - "version": "0.2.17", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", - "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", "license": "MIT", "dependencies": { "fdir": "^6.5.0", - "picomatch": "^4.0.4" + "picomatch": "^4.0.3" }, "engines": { "node": ">=12.0.0" @@ -4504,6 +5977,47 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/trim-lines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", @@ -4540,22 +6054,22 @@ } }, "node_modules/twoslash": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/twoslash/-/twoslash-0.3.9.tgz", - "integrity": "sha512-rDclk+OtzuTX+tnea7DYLCkqGQ3eP0IyfD+kzUJ7t46X/NzlaxwrhecmEBNuSCuEn3V+n1PhcjUUQQ7gUJzX5Q==", + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/twoslash/-/twoslash-0.3.6.tgz", + "integrity": "sha512-VuI5OKl+MaUO9UIW3rXKoPgHI3X40ZgB/j12VY6h98Ae1mCBihjPvhOPeJWlxCYcmSbmeZt5ZKkK0dsVtp+6pA==", "license": "MIT", "dependencies": { - "@typescript/vfs": "^1.6.4", - "twoslash-protocol": "0.3.9" + "@typescript/vfs": "^1.6.2", + "twoslash-protocol": "0.3.6" }, "peerDependencies": { - "typescript": "^5.5.0 || ^6.0.0" + "typescript": "^5.5.0" } }, "node_modules/twoslash-protocol": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/twoslash-protocol/-/twoslash-protocol-0.3.9.tgz", - "integrity": "sha512-9/iwp+CXOnjFMPQuPL5PkuRbZnDoNpBvtJCLs9t8kDYkL3YHujbvnHfZA1i5fApDftVEdBw+T/4F+dH5kIzpYQ==", + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/twoslash-protocol/-/twoslash-protocol-0.3.6.tgz", + "integrity": "sha512-FHGsJ9Q+EsNr5bEbgG3hnbkvEBdW5STgPU824AHUjB4kw0Dn4p8tABT7Ncg1Ie6V0+mDg3Qpy41VafZXcQhWMA==", "license": "MIT" }, "node_modules/typescript": { @@ -4572,9 +6086,9 @@ } }, "node_modules/undici": { - "version": "6.27.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.27.0.tgz", - "integrity": "sha512-YmfV3YnEDzXRC5lZ2jWtWWHKGUm1zIt8AhesR1tens+HTNv+YZlN/dp6G727LOvMJ8xjP9Be7Y2Sdr96LDm+pg==", + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.24.1.tgz", + "integrity": "sha512-sC+b0tB1whOCzbtlx20fx3WgCXwkW627p4EA9uM+/tNNPkSS+eSEld6pAs9nDv7WbY1UUljBMYPtu9BCOrCWKA==", "license": "MIT", "engines": { "node": ">=18.17" @@ -4739,6 +6253,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/use-callback-ref": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.3.tgz", @@ -4782,6 +6305,21 @@ } } }, + "node_modules/use-sync-external-store": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz", + "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, "node_modules/vfile": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", @@ -4834,6 +6372,32 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, "node_modules/yaml": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz", @@ -4849,6 +6413,33 @@ "url": "https://github.com/sponsors/eemeli" } }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", diff --git a/tools/doc/package.json b/tools/doc/package.json index 9d59db21ef0e1a..42e9916b908571 100644 --- a/tools/doc/package.json +++ b/tools/doc/package.json @@ -2,6 +2,6 @@ "name": "doc", "private": true, "dependencies": { - "@node-core/doc-kit": "1.4.1" + "@node-core/doc-kit": "1.3.9" } } diff --git a/tools/eslint/package-lock.json b/tools/eslint/package-lock.json index de8e6862cdb1b6..47edf403673e5d 100644 --- a/tools/eslint/package-lock.json +++ b/tools/eslint/package-lock.json @@ -8,27 +8,27 @@ "name": "eslint-tools", "version": "0.0.0", "dependencies": { - "@babel/core": "^8.0.1", - "@babel/eslint-parser": "^8.0.1", - "@babel/plugin-syntax-import-defer": "^8.0.1", - "@babel/plugin-syntax-import-source": "^8.0.1", + "@babel/core": "^8.0.0-rc.6", + "@babel/eslint-parser": "^8.0.0-rc.6", + "@babel/plugin-syntax-import-defer": "^8.0.0-rc.6", + "@babel/plugin-syntax-import-source": "^8.0.0-rc.6", "@eslint/js": "^10.0.1", "@eslint/markdown": "^8.0.2", "@stylistic/eslint-plugin": "^5.10.0", - "eslint": "^10.5.0", + "eslint": "^10.4.0", "eslint-formatter-tap": "^9.0.1", - "eslint-plugin-jsdoc": "^63.0.9", - "eslint-plugin-regexp": "^3.1.1", - "globals": "^17.7.0" + "eslint-plugin-jsdoc": "^63.0.0", + "eslint-plugin-regexp": "^3.1.0", + "globals": "^17.6.0" } }, "node_modules/@babel/code-frame": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-8.0.0.tgz", - "integrity": "sha512-dYYg153EyN2Ekbqw2zAsbd6/JR+9N2SEoC7YV2GyyqMM7x9bLDTjBD6XBhSMLH0wtIVyJj03jWNriQhaN+eoCw==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-8.0.0-rc.6.tgz", + "integrity": "sha512-Ru0EdYEptXbJGAGDMsenx+RcelHazuj8spqi7l0geXEPXv0X7qVisqWX+2pMaEZsWhS3Q6Um7oITwhnLe0cHJQ==", "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^8.0.0", + "@babel/helper-validator-identifier": "^8.0.0-rc.6", "js-tokens": "^10.0.0" }, "engines": { @@ -36,31 +36,31 @@ } }, "node_modules/@babel/compat-data": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-8.0.0.tgz", - "integrity": "sha512-DOjnob/cXOUgDOozCDeq/aK2p5y8dUIVdf6tNhEV1HQRd6I8aQ4f4fbtHRVEvb6lP3BGomrKHiS8ICAASSVQSw==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-8.0.0-rc.6.tgz", + "integrity": "sha512-9ikfbIp7PCtV/mo8NYrzag1TYInVJAKLwpSoA28+3Bl5z1KVYt5ZGvBZD57yJlf/0HsCntlTlHHodu+eMpUffQ==", "license": "MIT", "engines": { "node": "^22.18.0 || >=24.11.0" } }, "node_modules/@babel/core": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-8.0.1.tgz", - "integrity": "sha512-5FgxM4dLQpMJHSiVATk8foW263dVHQHBVpXYiimNECVWG01f4nFyEbQixeT6Mwvg7TayREJ2gpKl3o2RoMdnqw==", - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^8.0.0", - "@babel/generator": "^8.0.0", - "@babel/helper-compilation-targets": "^8.0.0", - "@babel/helpers": "^8.0.0", - "@babel/parser": "^8.0.0", - "@babel/template": "^8.0.0", - "@babel/traverse": "^8.0.0", - "@babel/types": "^8.0.0", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-8.0.0-rc.6.tgz", + "integrity": "sha512-89SVbTu7p+M/W052SFC7R5QuQYgypfuO6HmBBbhA/Kzl6gME8Ly2QrVpIegvTxmcQKOzAPIxiEIfNk+Jxd26mw==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^8.0.0-rc.6", + "@babel/generator": "^8.0.0-rc.6", + "@babel/helper-compilation-targets": "^8.0.0-rc.6", + "@babel/helpers": "^8.0.0-rc.6", + "@babel/parser": "^8.0.0-rc.6", + "@babel/template": "^8.0.0-rc.6", + "@babel/traverse": "^8.0.0-rc.6", + "@babel/types": "^8.0.0-rc.6", "@types/gensync": "^1.0.5", "convert-source-map": "^2.0.0", - "empathic": "^2.0.1", + "find-up-simple": "^1.0.1", "gensync": "^1.0.0-beta.2", "import-meta-resolve": "^4.2.0", "json5": "^2.2.3", @@ -76,9 +76,9 @@ } }, "node_modules/@babel/eslint-parser": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-8.0.1.tgz", - "integrity": "sha512-2javO8pAQv/ld6sS6OcxoLAlzZEZy+xm99bnoAfMhzKSumKhdF5wylpbZB7XTorWr3KLPtx5K95eduJPOy1mzA==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-8.0.0-rc.6.tgz", + "integrity": "sha512-qVHD7K5PyUXj57bsJWbyT5V9JtOX/4dtX9QSQpqGfBG4xiVE/mrCYCT25Ih+wHvISR98Lctl9BtvEUtGyYsrvA==", "license": "MIT", "dependencies": { "eslint-scope": "^9.1.0", @@ -89,18 +89,18 @@ "node": "^22.18.0 || >=24.11.0" }, "peerDependencies": { - "@babel/core": "^8.0.0", + "@babel/core": "^8.0.0-rc.6", "eslint": "^9.0.0 || ^10.0.0" } }, "node_modules/@babel/generator": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-8.0.0.tgz", - "integrity": "sha512-NT9NrVwJsbSV6Y2FSstWa71EETOnzrjkL5/wX3D2mYHtKM+qvqB1DvR4D0Setb/gDBsHzRICifwEWMO8CnTF6g==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-8.0.0-rc.6.tgz", + "integrity": "sha512-6mIzgVK8DgEzvIapoQwhXTMnnkuE4STQmVv9H03i/tZ2ml8oev3TRvZJgTenK2Bsq0YWNtzOrFdTyNzCMFtjJQ==", "license": "MIT", "dependencies": { - "@babel/parser": "^8.0.0", - "@babel/types": "^8.0.0", + "@babel/parser": "^8.0.0-rc.6", + "@babel/types": "^8.0.0-rc.6", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "@types/jsesc": "^2.5.0", @@ -111,15 +111,15 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-8.0.0.tgz", - "integrity": "sha512-JwculLABZvyPvyLBpwU/E/IbH2uM3mnxNtIJpxnIfb24y1PrdVxK5Dqjle4DpgqpGRnwgC7G8IkzPdSXZrO1Ew==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-8.0.0-rc.6.tgz", + "integrity": "sha512-jqQD45/yUSy63U8zs9hE5FMXS8J1TLAI/NTMx76C6xWO021e13gJACQvuGmEF7syloC39LkkKwhqtAbMku1rwg==", "license": "MIT", "dependencies": { - "@babel/compat-data": "^8.0.0", - "@babel/helper-validator-option": "^8.0.0", + "@babel/compat-data": "^8.0.0-rc.6", + "@babel/helper-validator-option": "^8.0.0-rc.6", "browserslist": "^4.24.0", - "lru-cache": "^11.0.0", + "lru-cache": "^7.14.1", "semver": "^7.7.3" }, "engines": { @@ -127,73 +127,73 @@ } }, "node_modules/@babel/helper-globals": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-8.0.0.tgz", - "integrity": "sha512-lLozHOM6sWWlxNo8CYqHy4MBZeTvHXNgVPBfPOGsjPKUzHC2Az9QwB6gxdQmpwHl6GlQtbGgS+lj5887guDiLw==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-8.0.0-rc.6.tgz", + "integrity": "sha512-ZF5FsxE4y7Eb6DiEbsLW3Gz3e73U/Uq3/ZotWf/moxv0DnZziXSMnW/tcXJF8b1mQE8XJnwPNSQOksKcKTz8kQ==", "license": "MIT", "engines": { "node": "^22.18.0 || >=24.11.0" } }, "node_modules/@babel/helper-plugin-utils": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-8.0.1.tgz", - "integrity": "sha512-3PKFgjTyPlhFhorfP+SjKQxLViIL++zWjFOO4hGriYU+Bsm983DxEM1JmDRJVWXV0O9npu+xXRqz7Pbd3mh70g==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-8.0.0-rc.6.tgz", + "integrity": "sha512-sLAjvuIcjzUQJR+CoHwU0JA4i706o71bCJtF+W9sc4KuHK3LCIJCjbKRuzbVn1eubUc66uAEZdBNWSqhLpwp2g==", "license": "MIT", "engines": { "node": "^22.18.0 || >=24.11.0" }, "peerDependencies": { - "@babel/core": "^8.0.0" + "@babel/core": "^8.0.0-rc.6" } }, "node_modules/@babel/helper-string-parser": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-8.0.0.tgz", - "integrity": "sha512-6mJgmFFFIIO82vvoLt9XtRC7/TkzXfts1t/SpRX4IHSzMgqoPYCWesVu1udUPUWioAE/2fcG6WuI8zrkE1gwrg==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-8.0.0-rc.6.tgz", + "integrity": "sha512-BCkFy+zN6kXQed3YOT7aJl93NfDSzQc3pBfsvTVPs9gU9X3V0aefEF5kwBT0E+mDWH9QgKaZstYUQN9VdQZT4g==", "license": "MIT", "engines": { "node": "^22.18.0 || >=24.11.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-8.0.2.tgz", - "integrity": "sha512-9Fr9QeyCAyi1BR1jKZ6uYQ24EIhQUx5ReHfQU7drOE+TPOb+w11/dsqLkMOT2U29OdCT71XajrOT8xDc1C7orA==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-8.0.0-rc.6.tgz", + "integrity": "sha512-nVJ+1JcCgntv8d78rRo++o2wuODT0Irknx2BF8Np4Ft2CRgjLqIs4qzSZ8b66yGbBdMWGmZBO9WEZv1hhNiSpg==", "license": "MIT", "engines": { "node": "^22.18.0 || >=24.11.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-8.0.0.tgz", - "integrity": "sha512-U4Dybxh4WESWHt5XhBeExi4DrY0/DNK1aHpQbsrQXCUbFHuMweT0TpLEWKvaraV2Y6fS+ZXunsZ8zIuZIgvF2Q==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-8.0.0-rc.6.tgz", + "integrity": "sha512-uonhzCIL2Vf0xA10g5C0zD5thR7a6XxOSwZAzYfyl8n2zEev5bAB9J4b2oZ7u5YkyqdONfkptl2DesvW2P56Kg==", "license": "MIT", "engines": { "node": "^22.18.0 || >=24.11.0" } }, "node_modules/@babel/helpers": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-8.0.0.tgz", - "integrity": "sha512-wfbi91pM3py96oIiJEz7qIpyXDytgr9zQC1HEWwlGNVRAEmItuU/0a41ZUKu1sJGyhhOIpc4t5vk4PYzt8wpsg==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-8.0.0-rc.6.tgz", + "integrity": "sha512-kTTqnw+Ubp1/WGXiIpDcl+WYVGTUVGjrQKswGI9VOamk7eWVf5ZYOcCB+o1UxaaHjs/L+QK7IRPlyP7vg579OQ==", "license": "MIT", "dependencies": { - "@babel/template": "^8.0.0", - "@babel/types": "^8.0.0" + "@babel/template": "^8.0.0-rc.6", + "@babel/types": "^8.0.0-rc.6" }, "engines": { "node": "^22.18.0 || >=24.11.0" } }, "node_modules/@babel/parser": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-8.0.0.tgz", - "integrity": "sha512-aLxAE+imI9bCcyaPrUDjBv3uSkWieifjLe0kuFOZF0zli0L6GCsTmsePnTr55adbIAgYz2zhN1vnFimCBUYcRQ==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-8.0.0-rc.6.tgz", + "integrity": "sha512-rOS8IpdO7mQELkTPlCsTgPejO0bFuZdEDCGQJouYbYf9e1FLTym7Fei2pEjq8q7MWbX0ravcd7QQYKs1TxOuog==", "license": "MIT", "dependencies": { - "@babel/types": "^8.0.0" + "@babel/types": "^8.0.0-rc.6" }, "bin": { "parser": "bin/babel-parser.js" @@ -203,61 +203,61 @@ } }, "node_modules/@babel/plugin-syntax-import-defer": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-defer/-/plugin-syntax-import-defer-8.0.1.tgz", - "integrity": "sha512-fRveH6xm797m3R8dIP0JlW/pGVsWeBPArVoh0+QG3biW8o66oukSKtTkjGRVCwTTdfspra/XU0Jq482mECzB+g==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-defer/-/plugin-syntax-import-defer-8.0.0-rc.6.tgz", + "integrity": "sha512-VUzalsGv2W89DJbKyXy8mP7uhsXFZoE4td5iDndOGART94WLXvnKuF72ndJFFYE8t4eRS0zX5PZFmMGBVGmIUw==", "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^8.0.1" + "@babel/helper-plugin-utils": "^8.0.0-rc.6" }, "engines": { "node": "^22.18.0 || >=24.11.0" }, "peerDependencies": { - "@babel/core": "^8.0.0" + "@babel/core": "^8.0.0-rc.6" } }, "node_modules/@babel/plugin-syntax-import-source": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-source/-/plugin-syntax-import-source-8.0.1.tgz", - "integrity": "sha512-qtgn6T5XL3GxNq+7MPj/12D8lCnVHBJQVzRYqHbgZhu+Y5XEYeEM6h9FlMinGkrbS5SMH/b6oTX7ewXtfcMR8A==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-source/-/plugin-syntax-import-source-8.0.0-rc.6.tgz", + "integrity": "sha512-kvUkjNZhBdZleJjJ60gH5QGHD2ttZBzEZACPnqaAMraDdPz0bERCWNyptdiCZFTOBo6LRhD9QtMAzdZK3jvPZQ==", "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^8.0.1" + "@babel/helper-plugin-utils": "^8.0.0-rc.6" }, "engines": { "node": "^22.18.0 || >=24.11.0" }, "peerDependencies": { - "@babel/core": "^8.0.0" + "@babel/core": "^8.0.0-rc.6" } }, "node_modules/@babel/template": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-8.0.0.tgz", - "integrity": "sha512-eAD0QW/AlbamBbw0FeGiwasbCVPq5ncW0HNVyLP3B9czqLyh4gvw+5JTSNt6le9+ziAU7mqDZsKTHf3jTb4chQ==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-8.0.0-rc.6.tgz", + "integrity": "sha512-CZFjZblLiIUEFghbB3sKs3rpYrwo65rLIklw/gNpwBm326cU6TH/xzvJZlZ+H9HpDi00eDXqNJR8CtEKW3oc/A==", "license": "MIT", "dependencies": { - "@babel/code-frame": "^8.0.0", - "@babel/parser": "^8.0.0", - "@babel/types": "^8.0.0" + "@babel/code-frame": "^8.0.0-rc.6", + "@babel/parser": "^8.0.0-rc.6", + "@babel/types": "^8.0.0-rc.6" }, "engines": { "node": "^22.18.0 || >=24.11.0" } }, "node_modules/@babel/traverse": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-8.0.0.tgz", - "integrity": "sha512-bxTj/W2VclGE6CctlfQOpxg8MPDzXArRqkOBePw8EHfebcjF7fETWSS3BriEECo+UiU/Yblq+xUtSImFu7cTbw==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-8.0.0-rc.6.tgz", + "integrity": "sha512-/txuBViGaE9gpM8MSGShru1O2Bzp3zb3m/XKZNUsNv2SyNn++lKDDIWkiIQ/345j2FBy7CHiYTZuKhewHWyefw==", "license": "MIT", "dependencies": { - "@babel/code-frame": "^8.0.0", - "@babel/generator": "^8.0.0", - "@babel/helper-globals": "^8.0.0", - "@babel/parser": "^8.0.0", - "@babel/template": "^8.0.0", - "@babel/types": "^8.0.0", + "@babel/code-frame": "^8.0.0-rc.6", + "@babel/generator": "^8.0.0-rc.6", + "@babel/helper-globals": "^8.0.0-rc.6", + "@babel/parser": "^8.0.0-rc.6", + "@babel/template": "^8.0.0-rc.6", + "@babel/types": "^8.0.0-rc.6", "obug": "^2.1.1" }, "engines": { @@ -265,27 +265,27 @@ } }, "node_modules/@babel/types": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-8.0.0.tgz", - "integrity": "sha512-K8ponJDxBwDHigkeFqaqT5wLGl4bTlwMafR8k7b5CPxr6Ww+UG9ls8Yx6Tcpboxu97eeGVEEyKcHmEyOwN1vSw==", + "version": "8.0.0-rc.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-8.0.0-rc.6.tgz", + "integrity": "sha512-p7/ABylAYlexb31wtRdIfH9L9A0Z2T/9H6zAqzqndkY2PLkvNNc580wGhp/gGKN4Sp9sQvSkhc6Oga8/O+wTyw==", "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^8.0.0", - "@babel/helper-validator-identifier": "^8.0.0" + "@babel/helper-string-parser": "^8.0.0-rc.6", + "@babel/helper-validator-identifier": "^8.0.0-rc.6" }, "engines": { "node": "^22.18.0 || >=24.11.0" } }, "node_modules/@es-joy/jsdoccomment": { - "version": "0.87.0", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.87.0.tgz", - "integrity": "sha512-mFXZloZMzuJZXSHUmAFu/pXTk0ZJTJBluuAkrvbzidpTN8W6F2bpRFuedSH+85kbdlRLJqc+gfN+kD3JOLJK5g==", + "version": "0.86.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.86.0.tgz", + "integrity": "sha512-ukZmRQ81WiTpDWO6D/cTBM7XbrNtutHKvAVnZN/8pldAwLoJArGOvkNyxPTBGsPjsoaQBJxlH+tE2TNA/92Qgw==", "license": "MIT", "dependencies": { - "@types/estree": "^1.0.9", - "@typescript-eslint/types": "^8.59.4", - "comment-parser": "1.4.7", + "@types/estree": "^1.0.8", + "@typescript-eslint/types": "^8.58.0", + "comment-parser": "1.4.6", "esquery": "^1.7.0", "jsdoc-type-pratt-parser": "~7.2.0" }, @@ -589,9 +589,9 @@ "license": "MIT" }, "node_modules/@types/estree": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", - "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", "license": "MIT" }, "node_modules/@types/gensync": { @@ -649,9 +649,9 @@ "license": "MIT" }, "node_modules/@typescript-eslint/types": { - "version": "8.62.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.62.1.tgz", - "integrity": "sha512-ooCzJFaf+Hg+uG6fA3NRFGuFjlfNlDhBthbv4ZPU/0elCAFUfnyXUvf/WOpHz/jYwSmvU2GkR2LtyUfy1AxZ1Q==", + "version": "8.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.59.0.tgz", + "integrity": "sha512-nLzdsT1gdOgFxxxwrlNVUBzSNBEEHJ86bblmk4QAS6stfig7rcJzWKqCyxFy3YRRHXDWEkb2NralA1nOYkkm/A==", "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -723,9 +723,9 @@ } }, "node_modules/baseline-browser-mapping": { - "version": "2.10.40", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.40.tgz", - "integrity": "sha512-BSSLZ9/Cjjv7Gtj5B68ZzXcXUg8iOf3fme+FCuh8rC/Go+Kmh8cox7M3A8dolou16s64QjLPOSdngh7GxXvkSw==", + "version": "2.10.33", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.33.tgz", + "integrity": "sha512-bA6+tcSLpz2tIEdDXZPpPTIuxBcC4+w6SieaYyfigIa4h8GlFxbA17v22Vx3JUtuZQj9SgOsnbK+aTBzyDyEuw==", "license": "Apache-2.0", "bin": { "baseline-browser-mapping": "dist/cli.cjs" @@ -747,9 +747,9 @@ } }, "node_modules/browserslist": { - "version": "4.28.4", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.4.tgz", - "integrity": "sha512-MTc8i/x9jBQd1iMw2CFGS+rwMa07eYjLR0CCTLDACl9xhxy+nIs3KeML/biicXtk9JrZ6dnnTatmc7ErPXIxqw==", + "version": "4.28.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", + "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", "funding": [ { "type": "opencollective", @@ -766,10 +766,10 @@ ], "license": "MIT", "dependencies": { - "baseline-browser-mapping": "^2.10.38", - "caniuse-lite": "^1.0.30001799", - "electron-to-chromium": "^1.5.376", - "node-releases": "^2.0.48", + "baseline-browser-mapping": "^2.10.12", + "caniuse-lite": "^1.0.30001782", + "electron-to-chromium": "^1.5.328", + "node-releases": "^2.0.36", "update-browserslist-db": "^1.2.3" }, "bin": { @@ -780,9 +780,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001800", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001800.tgz", - "integrity": "sha512-MMHtuAz9Ys840zAY5F4k6fV5GaivZ9sPk+nz0mY+GYVzRBnYkN0mpqkSR92oWRQ19yQWo4HvBV/FnC16AJX8MA==", + "version": "1.0.30001793", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001793.tgz", + "integrity": "sha512-iwSsYWaCOoh26cV8NwNRViHlrfUvYsHDfRVcbtmw0Kg6PJIZZXwMkj1442FYLBGkeUf1juAsU3DTfxW579mrPA==", "funding": [ { "type": "opencollective", @@ -829,9 +829,9 @@ } }, "node_modules/comment-parser": { - "version": "1.4.7", - "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.7.tgz", - "integrity": "sha512-0h+uSNtQGW3D98eQt3jJ8L06Fves8hncB4V/PKdw/Qb8Hnk19VaKuTr55UNRYiSoVa7WwrFls+rh3ux9agmkeQ==", + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.6.tgz", + "integrity": "sha512-ObxuY6vnbWTN6Od72xfwN9DbzC7Y2vv8u1Soi9ahRKL37gb6y1qk6/dgjs+3JWuXJHWvsg3BXIwzd/rkmAwavg==", "license": "MIT", "engines": { "node": ">= 12.0.0" @@ -916,20 +916,11 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.383", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.383.tgz", - "integrity": "sha512-I2484/KkAvl8lm9VyjH2JnbOIV0d/UCqT7gbzs6l+o6Vmn9wgB66uVcKX+Vk6HrXtY6fbWTOEXuv8waDTuFNCw==", + "version": "1.5.366", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.366.tgz", + "integrity": "sha512-OlRuhb688YTCzzU3gXPLn6nGyd+F+53INE1qaKKlu6kETErE8FYsyDh0XqXEU+uBRn0MpCzz2vfNwORhkap8qg==", "license": "ISC" }, - "node_modules/empathic": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/empathic/-/empathic-2.0.1.tgz", - "integrity": "sha512-YGRs8knHhKHVShLkFET/rWAU8kmHbOV5LwN938RHI0pljAJ1Gf6SzXsSmRaEzcXTtOOmVqJ5+WtQPL5uigY50Q==", - "license": "MIT", - "engines": { - "node": ">=14" - } - }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -952,20 +943,17 @@ } }, "node_modules/eslint": { - "version": "10.5.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.5.0.tgz", - "integrity": "sha512-1y+7C+vi12bUK1IpZeaV3gsH9fHLBmPvYmPx42pvT/E9yG0IC8g3PUZZgp0+JLJl7ZDK0flc2gc+Aw9dpCvIsQ==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.4.0.tgz", + "integrity": "sha512-loXy6bWOoP3EP6JA7jo6p5jMpBJmHmsNZM5SFRHLdh1MGOPurMnNBj4ZlAbaqUAaQWbCr7jHV4P7gzAyryZWkQ==", "license": "MIT", - "workspaces": [ - "packages/*" - ], "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", "@eslint/config-array": "^0.23.5", "@eslint/config-helpers": "^0.6.0", "@eslint/core": "^1.2.1", - "@eslint/plugin-kit": "^0.7.2", + "@eslint/plugin-kit": "^0.7.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", @@ -1022,23 +1010,23 @@ } }, "node_modules/eslint-plugin-jsdoc": { - "version": "63.0.9", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-63.0.9.tgz", - "integrity": "sha512-SJskF1zzPPRVfsmJyr/PqUXcpjA7o5Y0YnEoLBMDQlQWhELbYMRvK/8Fzlvh5XwEwJW8glAtKGKucaL0WGPMkw==", + "version": "63.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-63.0.0.tgz", + "integrity": "sha512-eDHuVGyZydr4BKgjXouU7bsn5qaqUlObXBSWRJk3vXcQgXVFnrwWIqpP7uBhRX9NQpk6NIIFyRc6F6omZNi/8g==", "license": "BSD-3-Clause", "dependencies": { - "@es-joy/jsdoccomment": "~0.87.0", + "@es-joy/jsdoccomment": "~0.86.0", "@es-joy/resolve.exports": "1.2.0", "are-docs-informative": "^0.0.2", - "comment-parser": "1.4.7", + "comment-parser": "1.4.6", "debug": "^4.4.3", "escape-string-regexp": "^4.0.0", "espree": "^11.2.0", "esquery": "^1.7.0", "html-entities": "^2.6.0", - "object-deep-merge": "^2.0.1", + "object-deep-merge": "^2.0.0", "parse-imports-exports": "^0.2.4", - "semver": "^7.8.2", + "semver": "^7.8.0", "spdx-expression-parse": "^4.0.0", "to-valid-identifier": "^1.0.0" }, @@ -1067,9 +1055,9 @@ } }, "node_modules/eslint-plugin-regexp": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-regexp/-/eslint-plugin-regexp-3.1.1.tgz", - "integrity": "sha512-MxR5nqoQCtVWmJwia0D2+NlXX1xzdpkslsVOZLEYQ4PQWEaL65PCZXURxaBc3lPnkNFpNxzMIRmYVxdl8giXRA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-regexp/-/eslint-plugin-regexp-3.1.0.tgz", + "integrity": "sha512-qGXIC3DIKZHcK1H9A9+Byz9gmndY6TTSRkSMTZpNXdyCw2ObSehRgccJv35n9AdUakEjQp5VFNLas6BMXizCZg==", "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", @@ -1264,6 +1252,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/find-up-simple": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/find-up-simple/-/find-up-simple-1.0.1.tgz", + "integrity": "sha512-afd4O7zpqHeRyg4PfDQsXmlDe2PfdHtJt6Akt8jOWaApLOZk5JXs6VMR29lz03pRe9mpykrRCYIYxaJYcfpncQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/flat-cache": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", @@ -1319,9 +1319,9 @@ } }, "node_modules/globals": { - "version": "17.7.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-17.7.0.tgz", - "integrity": "sha512-Czmyns5dUsq4seFBR/Kdydhmo8y9kC79hiSkPn0YcGtNnYWnrgt0vjrSjx9tspoDGWm2CMarffRuLjM4xUz8xg==", + "version": "17.6.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.6.0.tgz", + "integrity": "sha512-sepffkT8stwnIYbsMBpoCHJuJM5l98FUF2AnE07hfvE0m/qp3R586hw4jF4uadbhvg1ooIdzuu7CsfD2jzCaNA==", "license": "MIT", "engines": { "node": ">=18" @@ -1544,12 +1544,12 @@ } }, "node_modules/lru-cache": { - "version": "11.5.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", - "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", - "license": "BlueOak-1.0.0", + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "license": "ISC", "engines": { - "node": "20 || >=22" + "node": ">=12" } }, "node_modules/markdown-table": { @@ -2438,32 +2438,29 @@ "license": "MIT" }, "node_modules/node-releases": { - "version": "2.0.50", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.50.tgz", - "integrity": "sha512-J6l92tKHX6w8Jy5nO1Vuc01NoIiRGi/d6qBKVxh+IQ8Cr3b6HbVNfKiF8ZpFKufTwpwxMmce2W3iQZ861ZRyTg==", + "version": "2.0.47", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.47.tgz", + "integrity": "sha512-Uzmd6LXpouKo8EUK68IjH4+E01w/hXyV3R3g/geCJo+rXLNfh1xucB+LOzYEOQPSiUK3h/xZf0cQGcSsmyL2Og==", "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/object-deep-merge": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object-deep-merge/-/object-deep-merge-2.0.1.tgz", - "integrity": "sha512-aKttDKcU3pyZqKcCkDhsMn70WmZFG2JGDQLP9EcLyTSIFQRCPWLAmBZRLJnrVUrhPG1jETEEbfdgbNtJf1LyMg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/object-deep-merge/-/object-deep-merge-2.0.0.tgz", + "integrity": "sha512-3DC3UMpeffLTHiuXSy/UG4NOIYTLlY9u3V82+djSCLYClWobZiS4ivYzpIUWrRY/nfsJ8cWsKyG3QfyLePmhvg==", "license": "MIT" }, "node_modules/obug": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.3.tgz", - "integrity": "sha512-9miFgM2OFba7hB+pRgvtV84pYTBaoTHohvmIgiRt6dRIzbwEOIaNaP+dIlGs2fNFoB0SeISs0Jz5WFVRid6Xyg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz", + "integrity": "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==", "funding": [ "https://github.com/sponsors/sxzz", "https://opencollective.com/debug" ], - "license": "MIT", - "engines": { - "node": ">=12.20.0" - } + "license": "MIT" }, "node_modules/optionator": { "version": "0.9.4", @@ -2633,9 +2630,9 @@ } }, "node_modules/semver": { - "version": "7.8.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", - "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.1.tgz", + "integrity": "sha512-rkVq3IXh+4FDGch+KwzX3aV9W3kO54GyEgpvBzSyctDA6Xtd7RJQV1xmXbeQp5v7+VzLOfVqiutSE6GICgPFvg==", "license": "ISC", "bin": { "semver": "bin/semver.js" diff --git a/tools/eslint/package.json b/tools/eslint/package.json index 3199c2bb7b175a..0002933967b711 100644 --- a/tools/eslint/package.json +++ b/tools/eslint/package.json @@ -3,17 +3,17 @@ "version": "0.0.0", "private": true, "dependencies": { - "@babel/core": "^8.0.1", - "@babel/eslint-parser": "^8.0.1", - "@babel/plugin-syntax-import-defer": "^8.0.1", - "@babel/plugin-syntax-import-source": "^8.0.1", + "@babel/core": "^8.0.0-rc.6", + "@babel/eslint-parser": "^8.0.0-rc.6", + "@babel/plugin-syntax-import-defer": "^8.0.0-rc.6", + "@babel/plugin-syntax-import-source": "^8.0.0-rc.6", "@eslint/js": "^10.0.1", "@eslint/markdown": "^8.0.2", "@stylistic/eslint-plugin": "^5.10.0", - "eslint": "^10.5.0", + "eslint": "^10.4.0", "eslint-formatter-tap": "^9.0.1", - "eslint-plugin-jsdoc": "^63.0.9", - "eslint-plugin-regexp": "^3.1.1", - "globals": "^17.7.0" + "eslint-plugin-jsdoc": "^63.0.0", + "eslint-plugin-regexp": "^3.1.0", + "globals": "^17.6.0" } } diff --git a/tools/nix/benchmarkTools.nix b/tools/nix/benchmarkTools.nix index 7c37c423c2530a..62c744a552b7d1 100644 --- a/tools/nix/benchmarkTools.nix +++ b/tools/nix/benchmarkTools.nix @@ -1,11 +1,9 @@ { pkgs ? import ./pkgs.nix { }, - withHttpBenchmarkDeps ? true, }: [ pkgs.R pkgs.rPackages.ggplot2 pkgs.rPackages.plyr + pkgs.wrk ] -++ pkgs.lib.optional withHttpBenchmarkDeps pkgs.wrk -++ pkgs.lib.optional pkgs.stdenv.buildPlatform.isLinux pkgs.glibcLocales diff --git a/tools/nix/pkgs.nix b/tools/nix/pkgs.nix index 09678d12da7fc5..c9dd5e10b20a7b 100644 --- a/tools/nix/pkgs.nix +++ b/tools/nix/pkgs.nix @@ -1,10 +1,10 @@ arg: let repo = "https://github.com/NixOS/nixpkgs"; - rev = "d33369954a67ae3322177dc9a3d564092912120c"; + rev = "3e41b24abd260e8f71dbe2f5737d24122f972158"; nixpkgs = import (builtins.fetchTarball { url = "${repo}/archive/${rev}.tar.gz"; - sha256 = "0ffi2k8hllbgqw9vvdfaxw88qz53gl7myll4lwri6ynq5l0lnvbc"; + sha256 = "1rb3aw213s8ms3nxj9b1dya90zh1drscjq7aly4v85farywvw4xg"; }) arg; in nixpkgs diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 7953fa44b432d9..38732b4b34cf68 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -342,12 +342,12 @@ '<(V8_ROOT)/src/builtins/arm64/builtins-arm64.cc', ], }], - ['v8_target_arch=="riscv64"', { + ['v8_target_arch=="riscv64" or v8_target_arch=="riscv64"', { 'sources': [ '<(V8_ROOT)/src/builtins/riscv/builtins-riscv.cc', ], }], - ['v8_target_arch=="loong64"', { + ['v8_target_arch=="loong64" or v8_target_arch=="loong64"', { 'sources': [ '<(V8_ROOT)/src/builtins/loong64/builtins-loong64.cc', ], @@ -671,11 +671,6 @@ '