@react-aria/i18n 3.6.2 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ // useMessageFormatter is deprecated, but has a large dependency on intl-messageformat
2
+ // that we want to avoid. If it is built into the same file as the rest of the package,
3
+ // it deopts tree shaking in Parcel even when unused. Instead, it is split into a separate
4
+ // file and re-exported here, which allows tree shaking to work properly.
5
+ export * from './real-module.mjs';
6
+ export * from './useMessageFormatter.module.mjs';
package/dist/main.js CHANGED
@@ -3,4 +3,4 @@
3
3
  // it deopts tree shaking in Parcel even when unused. Instead, it is split into a separate
4
4
  // file and re-exported here, which allows tree shaking to work properly.
5
5
  module.exports = require('./real-main.js');
6
- Object.defineProperties(module.exports, Object.getOwnPropertyDescriptors(require('./useMessageFormatter.cjs.js')));
6
+ Object.defineProperties(module.exports, Object.getOwnPropertyDescriptors(require('./useMessageFormatter.js')));
package/dist/real-main.js CHANGED
@@ -21,6 +21,26 @@ $parcel$export(module.exports, "useNumberFormatter", () => $fea93c5b7c90d9f4$exp
21
21
  $parcel$export(module.exports, "useCollator", () => $27a5ce66022270ad$export$a16aca283550c30d);
22
22
  $parcel$export(module.exports, "useFilter", () => $832d079b867c7223$export$3274cf84b703fff);
23
23
  /*
24
+ * Copyright 2020 Adobe. All rights reserved.
25
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
26
+ * you may not use this file except in compliance with the License. You may obtain a copy
27
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
28
+ *
29
+ * Unless required by applicable law or agreed to in writing, software distributed under
30
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
31
+ * OF ANY KIND, either express or implied. See the License for the specific language
32
+ * governing permissions and limitations under the License.
33
+ */ /*
34
+ * Copyright 2020 Adobe. All rights reserved.
35
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
36
+ * you may not use this file except in compliance with the License. You may obtain a copy
37
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
38
+ *
39
+ * Unless required by applicable law or agreed to in writing, software distributed under
40
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
41
+ * OF ANY KIND, either express or implied. See the License for the specific language
42
+ * governing permissions and limitations under the License.
43
+ */ /*
24
44
  * Copyright 2020 Adobe. All rights reserved.
25
45
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
26
46
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -32,37 +52,37 @@ $parcel$export(module.exports, "useFilter", () => $832d079b867c7223$export$3274c
32
52
  * governing permissions and limitations under the License.
33
53
  */ // https://en.wikipedia.org/wiki/Right-to-left
34
54
  const $4d65847630a056a8$var$RTL_SCRIPTS = new Set([
35
- 'Arab',
36
- 'Syrc',
37
- 'Samr',
38
- 'Mand',
39
- 'Thaa',
40
- 'Mend',
41
- 'Nkoo',
42
- 'Adlm',
43
- 'Rohg',
44
- 'Hebr'
55
+ "Arab",
56
+ "Syrc",
57
+ "Samr",
58
+ "Mand",
59
+ "Thaa",
60
+ "Mend",
61
+ "Nkoo",
62
+ "Adlm",
63
+ "Rohg",
64
+ "Hebr"
45
65
  ]);
46
66
  const $4d65847630a056a8$var$RTL_LANGS = new Set([
47
- 'ae',
48
- 'ar',
49
- 'arc',
50
- 'bcc',
51
- 'bqi',
52
- 'ckb',
53
- 'dv',
54
- 'fa',
55
- 'glk',
56
- 'he',
57
- 'ku',
58
- 'mzn',
59
- 'nqo',
60
- 'pnb',
61
- 'ps',
62
- 'sd',
63
- 'ug',
64
- 'ur',
65
- 'yi'
67
+ "ae",
68
+ "ar",
69
+ "arc",
70
+ "bcc",
71
+ "bqi",
72
+ "ckb",
73
+ "dv",
74
+ "fa",
75
+ "glk",
76
+ "he",
77
+ "ku",
78
+ "mzn",
79
+ "nqo",
80
+ "pnb",
81
+ "ps",
82
+ "sd",
83
+ "ug",
84
+ "ur",
85
+ "yi"
66
86
  ]);
67
87
  function $4d65847630a056a8$export$702d680b21cbd764(locale) {
68
88
  // If the Intl.Locale API is available, use it to get the script for the locale.
@@ -74,28 +94,38 @@ function $4d65847630a056a8$export$702d680b21cbd764(locale) {
74
94
  return $4d65847630a056a8$var$RTL_SCRIPTS.has(script);
75
95
  }
76
96
  // If not, just guess by the language (first part of the locale)
77
- let lang = locale.split('-')[0];
97
+ let lang = locale.split("-")[0];
78
98
  return $4d65847630a056a8$var$RTL_LANGS.has(lang);
79
99
  }
80
100
 
81
101
 
82
-
102
+ /*
103
+ * Copyright 2020 Adobe. All rights reserved.
104
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
105
+ * you may not use this file except in compliance with the License. You may obtain a copy
106
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
107
+ *
108
+ * Unless required by applicable law or agreed to in writing, software distributed under
109
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
110
+ * OF ANY KIND, either express or implied. See the License for the specific language
111
+ * governing permissions and limitations under the License.
112
+ */
83
113
 
84
114
 
85
115
  function $2919bdec75484e64$export$f09106e7c6677ec5() {
86
116
  // @ts-ignore
87
- let locale = typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
117
+ let locale = typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
88
118
  try {
89
119
  // @ts-ignore
90
120
  Intl.DateTimeFormat.supportedLocalesOf([
91
121
  locale
92
122
  ]);
93
123
  } catch (_err) {
94
- locale = 'en-US';
124
+ locale = "en-US";
95
125
  }
96
126
  return {
97
127
  locale: locale,
98
- direction: $4d65847630a056a8$export$702d680b21cbd764(locale) ? 'rtl' : 'ltr'
128
+ direction: (0, $4d65847630a056a8$export$702d680b21cbd764)(locale) ? "rtl" : "ltr"
99
129
  };
100
130
  }
101
131
  let $2919bdec75484e64$var$currentLocale = $2919bdec75484e64$export$f09106e7c6677ec5();
@@ -105,42 +135,42 @@ function $2919bdec75484e64$var$updateLocale() {
105
135
  for (let listener of $2919bdec75484e64$var$listeners)listener($2919bdec75484e64$var$currentLocale);
106
136
  }
107
137
  function $2919bdec75484e64$export$188ec29ebc2bdc3a() {
108
- let isSSR = $87SwK$reactariassr.useIsSSR();
109
- let [defaultLocale, setDefaultLocale] = $87SwK$react.useState($2919bdec75484e64$var$currentLocale);
110
- $87SwK$react.useEffect(()=>{
111
- if ($2919bdec75484e64$var$listeners.size === 0) window.addEventListener('languagechange', $2919bdec75484e64$var$updateLocale);
138
+ let isSSR = (0, $87SwK$reactariassr.useIsSSR)();
139
+ let [defaultLocale, setDefaultLocale] = (0, $87SwK$react.useState)($2919bdec75484e64$var$currentLocale);
140
+ (0, $87SwK$react.useEffect)(()=>{
141
+ if ($2919bdec75484e64$var$listeners.size === 0) window.addEventListener("languagechange", $2919bdec75484e64$var$updateLocale);
112
142
  $2919bdec75484e64$var$listeners.add(setDefaultLocale);
113
143
  return ()=>{
114
144
  $2919bdec75484e64$var$listeners.delete(setDefaultLocale);
115
- if ($2919bdec75484e64$var$listeners.size === 0) window.removeEventListener('languagechange', $2919bdec75484e64$var$updateLocale);
145
+ if ($2919bdec75484e64$var$listeners.size === 0) window.removeEventListener("languagechange", $2919bdec75484e64$var$updateLocale);
116
146
  };
117
147
  }, []);
118
148
  // We cannot determine the browser's language on the server, so default to
119
149
  // en-US. This will be updated after hydration on the client to the correct value.
120
150
  if (isSSR) return {
121
- locale: 'en-US',
122
- direction: 'ltr'
151
+ locale: "en-US",
152
+ direction: "ltr"
123
153
  };
124
154
  return defaultLocale;
125
155
  }
126
156
 
127
157
 
128
158
 
129
- const $47fa5ec5ff482271$var$I18nContext = /*#__PURE__*/ ($parcel$interopDefault($87SwK$react)).createContext(null);
159
+ const $47fa5ec5ff482271$var$I18nContext = /*#__PURE__*/ (0, ($parcel$interopDefault($87SwK$react))).createContext(null);
130
160
  function $47fa5ec5ff482271$export$a54013f0d02a8f82(props) {
131
161
  let { locale: locale , children: children } = props;
132
- let defaultLocale = $2919bdec75484e64$export$188ec29ebc2bdc3a();
162
+ let defaultLocale = (0, $2919bdec75484e64$export$188ec29ebc2bdc3a)();
133
163
  let value = locale ? {
134
164
  locale: locale,
135
- direction: $4d65847630a056a8$export$702d680b21cbd764(locale) ? 'rtl' : 'ltr'
165
+ direction: (0, $4d65847630a056a8$export$702d680b21cbd764)(locale) ? "rtl" : "ltr"
136
166
  } : defaultLocale;
137
- return(/*#__PURE__*/ ($parcel$interopDefault($87SwK$react)).createElement($47fa5ec5ff482271$var$I18nContext.Provider, {
167
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($87SwK$react))).createElement($47fa5ec5ff482271$var$I18nContext.Provider, {
138
168
  value: value
139
- }, children));
169
+ }, children);
140
170
  }
141
171
  function $47fa5ec5ff482271$export$43bb16f9c6d9e3f7() {
142
- let defaultLocale = $2919bdec75484e64$export$188ec29ebc2bdc3a();
143
- let context = $87SwK$react.useContext($47fa5ec5ff482271$var$I18nContext);
172
+ let defaultLocale = (0, $2919bdec75484e64$export$188ec29ebc2bdc3a)();
173
+ let context = (0, $87SwK$react.useContext)($47fa5ec5ff482271$var$I18nContext);
144
174
  return context || defaultLocale;
145
175
  }
146
176
 
@@ -149,57 +179,82 @@ var $227f31f0c647c5fc$exports = {};
149
179
  "use strict";
150
180
 
151
181
 
152
-
182
+ /*
183
+ * Copyright 2022 Adobe. All rights reserved.
184
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
185
+ * you may not use this file except in compliance with the License. You may obtain a copy
186
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
187
+ *
188
+ * Unless required by applicable law or agreed to in writing, software distributed under
189
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
190
+ * OF ANY KIND, either express or implied. See the License for the specific language
191
+ * governing permissions and limitations under the License.
192
+ */
153
193
 
154
194
 
155
195
  const $fc53663969a3d00a$var$cache = new WeakMap();
156
196
  function $fc53663969a3d00a$var$getCachedDictionary(strings) {
157
197
  let dictionary = $fc53663969a3d00a$var$cache.get(strings);
158
198
  if (!dictionary) {
159
- dictionary = new $87SwK$internationalizedstring.LocalizedStringDictionary(strings);
199
+ dictionary = new (0, $87SwK$internationalizedstring.LocalizedStringDictionary)(strings);
160
200
  $fc53663969a3d00a$var$cache.set(strings, dictionary);
161
201
  }
162
202
  return dictionary;
163
203
  }
164
204
  function $fc53663969a3d00a$export$f12b703ca79dfbb1(strings) {
165
- let { locale: locale } = $47fa5ec5ff482271$export$43bb16f9c6d9e3f7();
166
- let dictionary = $87SwK$react.useMemo(()=>$fc53663969a3d00a$var$getCachedDictionary(strings)
167
- , [
205
+ let { locale: locale } = (0, $47fa5ec5ff482271$export$43bb16f9c6d9e3f7)();
206
+ let dictionary = (0, $87SwK$react.useMemo)(()=>$fc53663969a3d00a$var$getCachedDictionary(strings), [
168
207
  strings
169
208
  ]);
170
- return $87SwK$react.useMemo(()=>new $87SwK$internationalizedstring.LocalizedStringFormatter(locale, dictionary)
171
- , [
209
+ return (0, $87SwK$react.useMemo)(()=>new (0, $87SwK$internationalizedstring.LocalizedStringFormatter)(locale, dictionary), [
172
210
  locale,
173
211
  dictionary
174
212
  ]);
175
213
  }
176
214
 
177
215
 
216
+ /*
217
+ * Copyright 2020 Adobe. All rights reserved.
218
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
219
+ * you may not use this file except in compliance with the License. You may obtain a copy
220
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
221
+ *
222
+ * Unless required by applicable law or agreed to in writing, software distributed under
223
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
224
+ * OF ANY KIND, either express or implied. See the License for the specific language
225
+ * governing permissions and limitations under the License.
226
+ */
178
227
 
179
-
180
- function $cb6a3e7d490e97a4$export$a2f47a3d2973640(options = {
181
- }) {
182
- let { locale: locale } = $47fa5ec5ff482271$export$43bb16f9c6d9e3f7();
228
+ function $cb6a3e7d490e97a4$export$a2f47a3d2973640(options = {}) {
229
+ let { locale: locale } = (0, $47fa5ec5ff482271$export$43bb16f9c6d9e3f7)();
183
230
  // @ts-ignore
184
- return $87SwK$react.useMemo(()=>new Intl.ListFormat(locale, options)
185
- , [
231
+ return (0, $87SwK$react.useMemo)(()=>new Intl.ListFormat(locale, options), [
186
232
  locale,
187
233
  options
188
234
  ]);
189
235
  }
190
236
 
191
237
 
192
-
238
+ /*
239
+ * Copyright 2020 Adobe. All rights reserved.
240
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
241
+ * you may not use this file except in compliance with the License. You may obtain a copy
242
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
243
+ *
244
+ * Unless required by applicable law or agreed to in writing, software distributed under
245
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
246
+ * OF ANY KIND, either express or implied. See the License for the specific language
247
+ * governing permissions and limitations under the License.
248
+ */
193
249
 
194
250
 
195
251
  function $b80c530ff2e20243$export$85fd5fdf27bacc79(options) {
196
252
  // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.
197
- let lastOptions = $87SwK$react.useRef(null);
253
+ let lastOptions = (0, $87SwK$react.useRef)(null);
198
254
  if (options && lastOptions.current && $b80c530ff2e20243$var$isEqual(options, lastOptions.current)) options = lastOptions.current;
199
255
  lastOptions.current = options;
200
- let { locale: locale } = $47fa5ec5ff482271$export$43bb16f9c6d9e3f7();
201
- return $87SwK$react.useMemo(()=>new $87SwK$internationalizeddate.DateFormatter(locale, options)
202
- , [
256
+ let { locale: locale } = (0, $47fa5ec5ff482271$export$43bb16f9c6d9e3f7)();
257
+ return (0, $87SwK$react.useMemo)(()=>new (0, $87SwK$internationalizeddate.DateFormatter)(locale, options), [
203
258
  locale,
204
259
  options
205
260
  ]);
@@ -216,26 +271,43 @@ function $b80c530ff2e20243$var$isEqual(a, b) {
216
271
  }
217
272
 
218
273
 
274
+ /*
275
+ * Copyright 2020 Adobe. All rights reserved.
276
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
277
+ * you may not use this file except in compliance with the License. You may obtain a copy
278
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
279
+ *
280
+ * Unless required by applicable law or agreed to in writing, software distributed under
281
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
282
+ * OF ANY KIND, either express or implied. See the License for the specific language
283
+ * governing permissions and limitations under the License.
284
+ */
219
285
 
220
286
 
221
-
222
- function $fea93c5b7c90d9f4$export$b7a616150fdb9f44(options = {
223
- }) {
224
- let { locale: locale } = $47fa5ec5ff482271$export$43bb16f9c6d9e3f7();
225
- return $87SwK$react.useMemo(()=>new $87SwK$internationalizednumber.NumberFormatter(locale, options)
226
- , [
287
+ function $fea93c5b7c90d9f4$export$b7a616150fdb9f44(options = {}) {
288
+ let { locale: locale } = (0, $47fa5ec5ff482271$export$43bb16f9c6d9e3f7)();
289
+ return (0, $87SwK$react.useMemo)(()=>new (0, $87SwK$internationalizednumber.NumberFormatter)(locale, options), [
227
290
  locale,
228
291
  options
229
292
  ]);
230
293
  }
231
294
 
232
295
 
233
-
296
+ /*
297
+ * Copyright 2020 Adobe. All rights reserved.
298
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
299
+ * you may not use this file except in compliance with the License. You may obtain a copy
300
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
301
+ *
302
+ * Unless required by applicable law or agreed to in writing, software distributed under
303
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
304
+ * OF ANY KIND, either express or implied. See the License for the specific language
305
+ * governing permissions and limitations under the License.
306
+ */
234
307
  let $27a5ce66022270ad$var$cache = new Map();
235
308
  function $27a5ce66022270ad$export$a16aca283550c30d(options) {
236
- let { locale: locale } = $47fa5ec5ff482271$export$43bb16f9c6d9e3f7();
237
- let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1
238
- ).join() : '');
309
+ let { locale: locale } = (0, $47fa5ec5ff482271$export$43bb16f9c6d9e3f7)();
310
+ let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : "");
239
311
  if ($27a5ce66022270ad$var$cache.has(cacheKey)) return $27a5ce66022270ad$var$cache.get(cacheKey);
240
312
  let formatter = new Intl.Collator(locale, options);
241
313
  $27a5ce66022270ad$var$cache.set(cacheKey, formatter);
@@ -243,41 +315,65 @@ function $27a5ce66022270ad$export$a16aca283550c30d(options) {
243
315
  }
244
316
 
245
317
 
318
+ /*
319
+ * Copyright 2020 Adobe. All rights reserved.
320
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
321
+ * you may not use this file except in compliance with the License. You may obtain a copy
322
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
323
+ *
324
+ * Unless required by applicable law or agreed to in writing, software distributed under
325
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
326
+ * OF ANY KIND, either express or implied. See the License for the specific language
327
+ * governing permissions and limitations under the License.
328
+ */
246
329
 
247
330
  function $832d079b867c7223$export$3274cf84b703fff(options) {
248
- let collator = $27a5ce66022270ad$export$a16aca283550c30d({
249
- usage: 'search',
331
+ let collator = (0, $27a5ce66022270ad$export$a16aca283550c30d)({
332
+ usage: "search",
250
333
  ...options
251
334
  });
252
335
  // TODO(later): these methods don't currently support the ignorePunctuation option.
253
- return {
254
- startsWith (string, substring) {
255
- if (substring.length === 0) return true;
256
- // Normalize both strings so we can slice safely
257
- // TODO: take into account the ignorePunctuation option as well...
258
- string = string.normalize('NFC');
259
- substring = substring.normalize('NFC');
260
- return collator.compare(string.slice(0, substring.length), substring) === 0;
261
- },
262
- endsWith (string, substring) {
263
- if (substring.length === 0) return true;
264
- string = string.normalize('NFC');
265
- substring = substring.normalize('NFC');
266
- return collator.compare(string.slice(-substring.length), substring) === 0;
267
- },
268
- contains (string, substring) {
269
- if (substring.length === 0) return true;
270
- string = string.normalize('NFC');
271
- substring = substring.normalize('NFC');
272
- let scan = 0;
273
- let sliceLen = substring.length;
274
- for(; scan + sliceLen <= string.length; scan++){
275
- let slice = string.slice(scan, scan + sliceLen);
276
- if (collator.compare(substring, slice) === 0) return true;
277
- }
278
- return false;
336
+ let startsWith = (0, $87SwK$react.useCallback)((string, substring)=>{
337
+ if (substring.length === 0) return true;
338
+ // Normalize both strings so we can slice safely
339
+ // TODO: take into account the ignorePunctuation option as well...
340
+ string = string.normalize("NFC");
341
+ substring = substring.normalize("NFC");
342
+ return collator.compare(string.slice(0, substring.length), substring) === 0;
343
+ }, [
344
+ collator
345
+ ]);
346
+ let endsWith = (0, $87SwK$react.useCallback)((string, substring)=>{
347
+ if (substring.length === 0) return true;
348
+ string = string.normalize("NFC");
349
+ substring = substring.normalize("NFC");
350
+ return collator.compare(string.slice(-substring.length), substring) === 0;
351
+ }, [
352
+ collator
353
+ ]);
354
+ let contains = (0, $87SwK$react.useCallback)((string, substring)=>{
355
+ if (substring.length === 0) return true;
356
+ string = string.normalize("NFC");
357
+ substring = substring.normalize("NFC");
358
+ let scan = 0;
359
+ let sliceLen = substring.length;
360
+ for(; scan + sliceLen <= string.length; scan++){
361
+ let slice = string.slice(scan, scan + sliceLen);
362
+ if (collator.compare(substring, slice) === 0) return true;
279
363
  }
280
- };
364
+ return false;
365
+ }, [
366
+ collator
367
+ ]);
368
+ return (0, $87SwK$react.useMemo)(()=>({
369
+ startsWith: startsWith,
370
+ endsWith: endsWith,
371
+ contains: contains
372
+ }), [
373
+ startsWith,
374
+ endsWith,
375
+ contains
376
+ ]);
281
377
  }
282
378
 
283
379
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;AEAA,EAUG,AAVH;;;;;;;;;;CAUG,AAVH,EAUG,CAEH,EAA8C,AAA9C,4CAA8C;AAC9C,KAAK,CAAC,iCAAW,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IAAA,CAAM;IAAE,CAAM;IAAE,CAAM;IAAE,CAAM;IAAE,CAAM;IAAE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,MAAM,CAAC,IAAI;YAEf,CAAC;YAED,MAAM,CAAC,KAAK;QACd,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-aria/i18n/src/index.ts","packages/@react-aria/i18n/src/context.tsx","packages/@react-aria/i18n/src/utils.ts","packages/@react-aria/i18n/src/useDefaultLocale.ts","node_modules/@parcel/node-resolver-core/lib/_empty.js","packages/@react-aria/i18n/src/useLocalizedStringFormatter.ts","packages/@react-aria/i18n/src/useListFormatter.tsx","packages/@react-aria/i18n/src/useDateFormatter.ts","packages/@react-aria/i18n/src/useNumberFormatter.ts","packages/@react-aria/i18n/src/useCollator.ts","packages/@react-aria/i18n/src/useFilter.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {I18nProvider, useLocale} from './context';\nexport {useMessageFormatter} from './useMessageFormatter';\nexport {useLocalizedStringFormatter} from './useLocalizedStringFormatter';\nexport {useListFormatter} from './useListFormatter';\nexport {useDateFormatter} from './useDateFormatter';\nexport {useNumberFormatter} from './useNumberFormatter';\nexport {useCollator} from './useCollator';\nexport {useFilter} from './useFilter';\n\nexport type {FormatMessage} from './useMessageFormatter';\nexport type {I18nProviderProps} from './context';\nexport type {Locale} from './useDefaultLocale';\nexport type {LocalizedStrings} from '@internationalized/message';\nexport type {DateFormatterOptions} from './useDateFormatter';\nexport type {DateFormatter} from '@internationalized/date';\nexport type {Filter} from './useFilter';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {isRTL} from './utils';\nimport {Locale, useDefaultLocale} from './useDefaultLocale';\nimport React, {ReactNode, useContext} from 'react';\n\nexport interface I18nProviderProps {\n /** Contents that should have the locale applied. */\n children: ReactNode,\n /** The locale to apply to the children. */\n locale?: string\n}\n\nconst I18nContext = React.createContext<Locale>(null);\n\n/**\n * Provides the locale for the application to all child components.\n */\nexport function I18nProvider(props: I18nProviderProps) {\n let {locale, children} = props;\n let defaultLocale = useDefaultLocale();\n\n let value: Locale = locale ? {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n } : defaultLocale;\n\n return (\n <I18nContext.Provider value={value}>\n {children}\n </I18nContext.Provider>\n );\n}\n\n/**\n * Returns the current locale and layout direction.\n */\nexport function useLocale(): Locale {\n let defaultLocale = useDefaultLocale();\n let context = useContext(I18nContext);\n return context || defaultLocale;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set(['Arab', 'Syrc', 'Samr', 'Mand', 'Thaa', 'Mend', 'Nkoo', 'Adlm', 'Rohg', 'Hebr']);\nconst RTL_LANGS = new Set(['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi']);\n\n/**\n * Determines if a locale is read right to left using [Intl.Locale]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale}.\n */\nexport function isRTL(locale: string) {\n // If the Intl.Locale API is available, use it to get the script for the locale.\n // This is more accurate than guessing by language, since languages can be written in multiple scripts.\n // @ts-ignore\n if (Intl.Locale) {\n // @ts-ignore\n let script = new Intl.Locale(locale).maximize().script;\n return RTL_SCRIPTS.has(script);\n }\n\n // If not, just guess by the language (first part of the locale)\n let lang = locale.split('-')[0];\n return RTL_LANGS.has(lang);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\nimport {isRTL} from './utils';\nimport {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport interface Locale {\n /** The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale. */\n locale: string,\n /** The writing direction for the locale. */\n direction: Direction\n}\n\n/**\n * Gets the locale setting of the browser.\n */\nexport function getDefaultLocale(): Locale {\n // @ts-ignore\n let locale = (typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage)) || 'en-US';\n try {\n // @ts-ignore\n Intl.DateTimeFormat.supportedLocalesOf([locale]);\n } catch (_err) {\n locale = 'en-US';\n }\n return {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n };\n}\n\nlet currentLocale = getDefaultLocale();\nlet listeners = new Set<(locale: Locale) => void>();\n\nfunction updateLocale() {\n currentLocale = getDefaultLocale();\n for (let listener of listeners) {\n listener(currentLocale);\n }\n}\n\n/**\n * Returns the current browser/system language, and updates when it changes.\n */\nexport function useDefaultLocale(): Locale {\n let isSSR = useIsSSR();\n let [defaultLocale, setDefaultLocale] = useState(currentLocale);\n\n useEffect(() => {\n if (listeners.size === 0) {\n window.addEventListener('languagechange', updateLocale);\n }\n\n listeners.add(setDefaultLocale);\n\n return () => {\n listeners.delete(setDefaultLocale);\n if (listeners.size === 0) {\n window.removeEventListener('languagechange', updateLocale);\n }\n };\n }, []);\n\n // We cannot determine the browser's language on the server, so default to\n // en-US. This will be updated after hydration on the client to the correct value.\n if (isSSR) {\n return {\n locale: 'en-US',\n direction: 'ltr'\n };\n }\n\n return defaultLocale;\n}\n","\"use strict\";","/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {LocalizedString, LocalizedStringDictionary, LocalizedStringFormatter, LocalizedStrings} from '@internationalized/string';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\nconst cache = new WeakMap();\nfunction getCachedDictionary<K extends string, T extends LocalizedString>(strings: LocalizedStrings<K, T>): LocalizedStringDictionary<K, T> {\n let dictionary = cache.get(strings);\n if (!dictionary) {\n dictionary = new LocalizedStringDictionary(strings);\n cache.set(strings, dictionary);\n }\n\n return dictionary;\n}\n\n/**\n * Provides localized string formatting for the current locale. Supports interpolating variables,\n * selecting the correct pluralization, and formatting numbers. Automatically updates when the locale changes.\n * @param strings - A mapping of languages to localized strings by key.\n */\nexport function useLocalizedStringFormatter<K extends string = string, T extends LocalizedString = string>(strings: LocalizedStrings<K, T>): LocalizedStringFormatter<K, T> {\n let {locale} = useLocale();\n let dictionary = useMemo(() => getCachedDictionary(strings), [strings]);\n return useMemo(() => new LocalizedStringFormatter(locale, dictionary), [locale, dictionary]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\n/**\n * Provides localized list formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the list formatter for performance.\n * @param options - Formatting options.\n */\n\n// Typescript version 4.7 supports Intl.ListFormat - TODO upgrade\n// @ts-ignore\nexport function useListFormatter(options: Intl.ListFormatOptions = {}): Intl.ListFormat {\n let {locale} = useLocale();\n // @ts-ignore\n return useMemo(() => new Intl.ListFormat(locale, options), [locale, options]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DateFormatter} from '@internationalized/date';\nimport {useLocale} from './context';\nimport {useMemo, useRef} from 'react';\n\nexport interface DateFormatterOptions extends Intl.DateTimeFormatOptions {\n calendar?: string\n}\n\n/**\n * Provides localized date formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the date formatter for performance.\n * @param options - Formatting options.\n */\nexport function useDateFormatter(options?: DateFormatterOptions): DateFormatter {\n // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.\n let lastOptions = useRef(null);\n if (options && lastOptions.current && isEqual(options, lastOptions.current)) {\n options = lastOptions.current;\n }\n\n lastOptions.current = options;\n\n let {locale} = useLocale();\n return useMemo(() => new DateFormatter(locale, options), [locale, options]);\n}\n\nfunction isEqual(a: DateFormatterOptions, b: DateFormatterOptions) {\n if (a === b) {\n return true;\n }\n\n let aKeys = Object.keys(a);\n let bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n for (let key of aKeys) {\n if (b[key] !== a[key]) {\n return false;\n }\n }\n\n return true;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {NumberFormatOptions, NumberFormatter} from '@internationalized/number';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\n/**\n * Provides localized number formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the number formatter for performance.\n * @param options - Formatting options.\n */\nexport function useNumberFormatter(options: NumberFormatOptions = {}): Intl.NumberFormat {\n let {locale} = useLocale();\n return useMemo(() => new NumberFormatter(locale, options), [locale, options]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useLocale} from './context';\n\nlet cache = new Map<string, Intl.Collator>();\n\n/**\n * Provides localized string collation for the current locale. Automatically updates when the locale changes,\n * and handles caching of the collator for performance.\n * @param options - Collator options.\n */\nexport function useCollator(options?: Intl.CollatorOptions): Intl.Collator {\n let {locale} = useLocale();\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (cache.has(cacheKey)) {\n return cache.get(cacheKey);\n }\n\n let formatter = new Intl.Collator(locale, options);\n cache.set(cacheKey, formatter);\n return formatter;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useCollator} from './useCollator';\n\nexport interface Filter {\n /** Returns whether a string starts with a given substring. */\n startsWith(string: string, substring: string): boolean,\n /** Returns whether a string ends with a given substring. */\n endsWith(string: string, substring: string): boolean,\n /** Returns whether a string contains a given substring. */\n contains(string: string, substring: string): boolean\n}\n\n/**\n * Provides localized string search functionality that is useful for filtering or matching items\n * in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.\n */\nexport function useFilter(options?: Intl.CollatorOptions): Filter {\n let collator = useCollator({\n usage: 'search',\n ...options\n });\n\n // TODO(later): these methods don't currently support the ignorePunctuation option.\n\n return {\n startsWith(string, substring) {\n if (substring.length === 0) {\n return true;\n }\n\n // Normalize both strings so we can slice safely\n // TODO: take into account the ignorePunctuation option as well...\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n return collator.compare(string.slice(0, substring.length), substring) === 0;\n },\n endsWith(string, substring) {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n return collator.compare(string.slice(-substring.length), substring) === 0;\n },\n contains(string, substring) {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n\n let scan = 0;\n let sliceLen = substring.length;\n for (; scan + sliceLen <= string.length; scan++) {\n let slice = string.slice(scan, scan + sliceLen);\n if (collator.compare(substring, slice) === 0) {\n return true;\n }\n }\n\n return false;\n }\n };\n}\n"],"names":[],"version":3,"file":"real-main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED,8CAA8C;AAC9C,MAAM,oCAAc,IAAI,IAAI;IAAC;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;CAAO;AAC5G,MAAM,kCAAY,IAAI,IAAI;IAAC;IAAM;IAAM;IAAO;IAAO;IAAO;IAAO;IAAM;IAAM;IAAO;IAAM;IAAM;IAAO;IAAO;IAAO;IAAM;IAAM;IAAM;IAAM;CAAK;AAK7I,SAAS,0CAAM,MAAc,EAAE;IACpC,gFAAgF;IAChF,uGAAuG;IACvG,aAAa;IACb,IAAI,KAAK,MAAM,EAAE;QACf,aAAa;QACb,IAAI,SAAS,IAAI,KAAK,MAAM,CAAC,QAAQ,QAAQ,GAAG,MAAM;QACtD,OAAO,kCAAY,GAAG,CAAC;IACzB,CAAC;IAED,gEAAgE;IAChE,IAAI,OAAO,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE;IAC/B,OAAO,gCAAU,GAAG,CAAC;AACvB;;CDtBC,GAED;AEZA;;;;;;;;;;CAUC,GAED;;;AAeO,SAAS,4CAA2B;IACzC,aAAa;IACb,IAAI,SAAS,AAAC,OAAO,cAAc,eAAgB,CAAA,UAAU,QAAQ,IAAI,UAAU,YAAY,AAAD,KAAO;IACrG,IAAI;QACF,aAAa;QACb,KAAK,cAAc,CAAC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A;QACF,CAAA,GAAI;QAAC;QAAY;QAAU;KAAS;AACtC;","sources":["packages/@react-aria/i18n/src/index.ts","packages/@react-aria/i18n/src/context.tsx","packages/@react-aria/i18n/src/utils.ts","packages/@react-aria/i18n/src/useDefaultLocale.ts","node_modules/@parcel/node-resolver-core/lib/_empty.js","packages/@react-aria/i18n/src/useLocalizedStringFormatter.ts","packages/@react-aria/i18n/src/useListFormatter.tsx","packages/@react-aria/i18n/src/useDateFormatter.ts","packages/@react-aria/i18n/src/useNumberFormatter.ts","packages/@react-aria/i18n/src/useCollator.ts","packages/@react-aria/i18n/src/useFilter.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {I18nProvider, useLocale} from './context';\nexport {useMessageFormatter} from './useMessageFormatter';\nexport {useLocalizedStringFormatter} from './useLocalizedStringFormatter';\nexport {useListFormatter} from './useListFormatter';\nexport {useDateFormatter} from './useDateFormatter';\nexport {useNumberFormatter} from './useNumberFormatter';\nexport {useCollator} from './useCollator';\nexport {useFilter} from './useFilter';\n\nexport type {FormatMessage} from './useMessageFormatter';\nexport type {I18nProviderProps} from './context';\nexport type {Locale} from './useDefaultLocale';\nexport type {LocalizedStrings} from '@internationalized/message';\nexport type {DateFormatterOptions} from './useDateFormatter';\nexport type {DateFormatter} from '@internationalized/date';\nexport type {Filter} from './useFilter';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {isRTL} from './utils';\nimport {Locale, useDefaultLocale} from './useDefaultLocale';\nimport React, {ReactNode, useContext} from 'react';\n\nexport interface I18nProviderProps {\n /** Contents that should have the locale applied. */\n children: ReactNode,\n /** The locale to apply to the children. */\n locale?: string\n}\n\nconst I18nContext = React.createContext<Locale>(null);\n\n/**\n * Provides the locale for the application to all child components.\n */\nexport function I18nProvider(props: I18nProviderProps) {\n let {locale, children} = props;\n let defaultLocale = useDefaultLocale();\n\n let value: Locale = locale ? {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n } : defaultLocale;\n\n return (\n <I18nContext.Provider value={value}>\n {children}\n </I18nContext.Provider>\n );\n}\n\n/**\n * Returns the current locale and layout direction.\n */\nexport function useLocale(): Locale {\n let defaultLocale = useDefaultLocale();\n let context = useContext(I18nContext);\n return context || defaultLocale;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set(['Arab', 'Syrc', 'Samr', 'Mand', 'Thaa', 'Mend', 'Nkoo', 'Adlm', 'Rohg', 'Hebr']);\nconst RTL_LANGS = new Set(['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi']);\n\n/**\n * Determines if a locale is read right to left using [Intl.Locale]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale}.\n */\nexport function isRTL(locale: string) {\n // If the Intl.Locale API is available, use it to get the script for the locale.\n // This is more accurate than guessing by language, since languages can be written in multiple scripts.\n // @ts-ignore\n if (Intl.Locale) {\n // @ts-ignore\n let script = new Intl.Locale(locale).maximize().script;\n return RTL_SCRIPTS.has(script);\n }\n\n // If not, just guess by the language (first part of the locale)\n let lang = locale.split('-')[0];\n return RTL_LANGS.has(lang);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\nimport {isRTL} from './utils';\nimport {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport interface Locale {\n /** The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale. */\n locale: string,\n /** The writing direction for the locale. */\n direction: Direction\n}\n\n/**\n * Gets the locale setting of the browser.\n */\nexport function getDefaultLocale(): Locale {\n // @ts-ignore\n let locale = (typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage)) || 'en-US';\n try {\n // @ts-ignore\n Intl.DateTimeFormat.supportedLocalesOf([locale]);\n } catch (_err) {\n locale = 'en-US';\n }\n return {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n };\n}\n\nlet currentLocale = getDefaultLocale();\nlet listeners = new Set<(locale: Locale) => void>();\n\nfunction updateLocale() {\n currentLocale = getDefaultLocale();\n for (let listener of listeners) {\n listener(currentLocale);\n }\n}\n\n/**\n * Returns the current browser/system language, and updates when it changes.\n */\nexport function useDefaultLocale(): Locale {\n let isSSR = useIsSSR();\n let [defaultLocale, setDefaultLocale] = useState(currentLocale);\n\n useEffect(() => {\n if (listeners.size === 0) {\n window.addEventListener('languagechange', updateLocale);\n }\n\n listeners.add(setDefaultLocale);\n\n return () => {\n listeners.delete(setDefaultLocale);\n if (listeners.size === 0) {\n window.removeEventListener('languagechange', updateLocale);\n }\n };\n }, []);\n\n // We cannot determine the browser's language on the server, so default to\n // en-US. This will be updated after hydration on the client to the correct value.\n if (isSSR) {\n return {\n locale: 'en-US',\n direction: 'ltr'\n };\n }\n\n return defaultLocale;\n}\n","\"use strict\";","/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {LocalizedString, LocalizedStringDictionary, LocalizedStringFormatter, LocalizedStrings} from '@internationalized/string';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\nconst cache = new WeakMap();\nfunction getCachedDictionary<K extends string, T extends LocalizedString>(strings: LocalizedStrings<K, T>): LocalizedStringDictionary<K, T> {\n let dictionary = cache.get(strings);\n if (!dictionary) {\n dictionary = new LocalizedStringDictionary(strings);\n cache.set(strings, dictionary);\n }\n\n return dictionary;\n}\n\n/**\n * Provides localized string formatting for the current locale. Supports interpolating variables,\n * selecting the correct pluralization, and formatting numbers. Automatically updates when the locale changes.\n * @param strings - A mapping of languages to localized strings by key.\n */\nexport function useLocalizedStringFormatter<K extends string = string, T extends LocalizedString = string>(strings: LocalizedStrings<K, T>): LocalizedStringFormatter<K, T> {\n let {locale} = useLocale();\n let dictionary = useMemo(() => getCachedDictionary(strings), [strings]);\n return useMemo(() => new LocalizedStringFormatter(locale, dictionary), [locale, dictionary]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\n/**\n * Provides localized list formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the list formatter for performance.\n * @param options - Formatting options.\n */\n\n// Typescript version 4.7 supports Intl.ListFormat - TODO upgrade\n// @ts-ignore\nexport function useListFormatter(options: Intl.ListFormatOptions = {}): Intl.ListFormat {\n let {locale} = useLocale();\n // @ts-ignore\n return useMemo(() => new Intl.ListFormat(locale, options), [locale, options]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DateFormatter} from '@internationalized/date';\nimport {useLocale} from './context';\nimport {useMemo, useRef} from 'react';\n\nexport interface DateFormatterOptions extends Intl.DateTimeFormatOptions {\n calendar?: string\n}\n\n/**\n * Provides localized date formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the date formatter for performance.\n * @param options - Formatting options.\n */\nexport function useDateFormatter(options?: DateFormatterOptions): DateFormatter {\n // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.\n let lastOptions = useRef(null);\n if (options && lastOptions.current && isEqual(options, lastOptions.current)) {\n options = lastOptions.current;\n }\n\n lastOptions.current = options;\n\n let {locale} = useLocale();\n return useMemo(() => new DateFormatter(locale, options), [locale, options]);\n}\n\nfunction isEqual(a: DateFormatterOptions, b: DateFormatterOptions) {\n if (a === b) {\n return true;\n }\n\n let aKeys = Object.keys(a);\n let bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n for (let key of aKeys) {\n if (b[key] !== a[key]) {\n return false;\n }\n }\n\n return true;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {NumberFormatOptions, NumberFormatter} from '@internationalized/number';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\n/**\n * Provides localized number formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the number formatter for performance.\n * @param options - Formatting options.\n */\nexport function useNumberFormatter(options: NumberFormatOptions = {}): Intl.NumberFormat {\n let {locale} = useLocale();\n return useMemo(() => new NumberFormatter(locale, options), [locale, options]);\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useLocale} from './context';\n\nlet cache = new Map<string, Intl.Collator>();\n\n/**\n * Provides localized string collation for the current locale. Automatically updates when the locale changes,\n * and handles caching of the collator for performance.\n * @param options - Collator options.\n */\nexport function useCollator(options?: Intl.CollatorOptions): Intl.Collator {\n let {locale} = useLocale();\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (cache.has(cacheKey)) {\n return cache.get(cacheKey);\n }\n\n let formatter = new Intl.Collator(locale, options);\n cache.set(cacheKey, formatter);\n return formatter;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useCallback, useMemo} from 'react';\nimport {useCollator} from './useCollator';\n\nexport interface Filter {\n /** Returns whether a string starts with a given substring. */\n startsWith(string: string, substring: string): boolean,\n /** Returns whether a string ends with a given substring. */\n endsWith(string: string, substring: string): boolean,\n /** Returns whether a string contains a given substring. */\n contains(string: string, substring: string): boolean\n}\n\n/**\n * Provides localized string search functionality that is useful for filtering or matching items\n * in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.\n */\nexport function useFilter(options?: Intl.CollatorOptions): Filter {\n let collator = useCollator({\n usage: 'search',\n ...options\n });\n\n // TODO(later): these methods don't currently support the ignorePunctuation option.\n let startsWith = useCallback((string, substring) => {\n if (substring.length === 0) {\n return true;\n }\n\n // Normalize both strings so we can slice safely\n // TODO: take into account the ignorePunctuation option as well...\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n return collator.compare(string.slice(0, substring.length), substring) === 0;\n }, [collator]);\n\n let endsWith = useCallback((string, substring) => {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n return collator.compare(string.slice(-substring.length), substring) === 0;\n }, [collator]);\n\n let contains = useCallback((string, substring) => {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n\n let scan = 0;\n let sliceLen = substring.length;\n for (; scan + sliceLen <= string.length; scan++) {\n let slice = string.slice(scan, scan + sliceLen);\n if (collator.compare(substring, slice) === 0) {\n return true;\n }\n }\n\n return false;\n }, [collator]);\n\n return useMemo(() => ({\n startsWith,\n endsWith,\n contains\n }), [startsWith, endsWith, contains]);\n}\n"],"names":[],"version":3,"file":"real-main.js.map"}