chunk-PHRSJJ3U.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import {
  2. g,
  3. l
  4. } from "./chunk-XH7RUGVZ.js";
  5. import {
  6. T
  7. } from "./chunk-ULGDPLM2.js";
  8. import {
  9. s3 as s
  10. } from "./chunk-EMJ4ZSM2.js";
  11. // node_modules/@arcgis/core/intl/messages.js
  12. var r = /^([a-z]{2})(?:[-_]([A-Za-z]{2}))?$/;
  13. var o = { ar: true, bg: true, bs: true, ca: true, cs: true, da: true, de: true, el: true, en: true, es: true, et: true, fi: true, fr: true, he: true, hr: true, hu: true, id: true, it: true, ja: true, ko: true, lt: true, lv: true, nb: true, nl: true, pl: true, "pt-BR": true, "pt-PT": true, ro: true, ru: true, sk: true, sl: true, sr: true, sv: true, th: true, tr: true, uk: true, vi: true, "zh-CN": true, "zh-HK": true, "zh-TW": true };
  14. function i(t) {
  15. return o[t] ?? false;
  16. }
  17. var a = [];
  18. var c = new Map();
  19. function d(t) {
  20. for (const e of c.keys())
  21. m(t.pattern, e) && c.delete(e);
  22. }
  23. function l2(t) {
  24. return a.includes(t) || (d(t), a.unshift(t)), { remove() {
  25. const e = a.indexOf(t);
  26. e > -1 && (a.splice(e, 1), d(t));
  27. } };
  28. }
  29. async function h(t) {
  30. const e = l();
  31. c.has(t) || c.set(t, f(t, e));
  32. const n = c.get(t);
  33. return await _.add(n), n;
  34. }
  35. function u(t) {
  36. if (!r.test(t))
  37. return null;
  38. const [, e, n] = r.exec(t), s2 = e + (n ? "-" + n.toUpperCase() : "");
  39. return i(s2) ? s2 : i(e) ? e : null;
  40. }
  41. async function f(e, n) {
  42. const s2 = [];
  43. for (const t of a)
  44. if (m(t.pattern, e))
  45. try {
  46. return await t.fetchMessageBundle(e, n);
  47. } catch (r2) {
  48. s2.push(r2);
  49. }
  50. if (s2.length)
  51. throw new s("intl:message-bundle-error", `Errors occurred while loading "${e}"`, { errors: s2 });
  52. throw new s("intl:no-message-bundle-loader", `No loader found for message bundle "${e}"`);
  53. }
  54. function m(t, e) {
  55. return typeof t == "string" ? e.startsWith(t) : t.test(e);
  56. }
  57. g(() => {
  58. c.clear();
  59. });
  60. var _ = new class {
  61. constructor() {
  62. this._numLoading = 0;
  63. }
  64. async waitForAll() {
  65. this._dfd && await this._dfd.promise;
  66. }
  67. add(t) {
  68. return this._increase(), t.then(() => this._decrease(), () => this._decrease()), this.waitForAll();
  69. }
  70. _increase() {
  71. this._numLoading++, this._dfd || (this._dfd = T());
  72. }
  73. _decrease() {
  74. this._numLoading = Math.max(this._numLoading - 1, 0), this._dfd && this._numLoading === 0 && (this._dfd.resolve(), this._dfd = null);
  75. }
  76. }();
  77. export {
  78. l2 as l,
  79. h,
  80. u
  81. };
  82. //# sourceMappingURL=chunk-PHRSJJ3U.js.map