@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.
@@ -1,10 +1,30 @@
1
- import $iFADg$react, {useContext as $iFADg$useContext, useState as $iFADg$useState, useEffect as $iFADg$useEffect, useMemo as $iFADg$useMemo, useRef as $iFADg$useRef} from "react";
1
+ import $iFADg$react, {useContext as $iFADg$useContext, useState as $iFADg$useState, useEffect as $iFADg$useEffect, useMemo as $iFADg$useMemo, useRef as $iFADg$useRef, useCallback as $iFADg$useCallback} from "react";
2
2
  import {useIsSSR as $iFADg$useIsSSR} from "@react-aria/ssr";
3
3
  import {LocalizedStringDictionary as $iFADg$LocalizedStringDictionary, LocalizedStringFormatter as $iFADg$LocalizedStringFormatter} from "@internationalized/string";
4
4
  import {DateFormatter as $iFADg$DateFormatter} from "@internationalized/date";
5
5
  import {NumberFormatter as $iFADg$NumberFormatter} from "@internationalized/number";
6
6
 
7
7
  /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */ /*
18
+ * Copyright 2020 Adobe. All rights reserved.
19
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
20
+ * you may not use this file except in compliance with the License. You may obtain a copy
21
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software distributed under
24
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
25
+ * OF ANY KIND, either express or implied. See the License for the specific language
26
+ * governing permissions and limitations under the License.
27
+ */ /*
8
28
  * Copyright 2020 Adobe. All rights reserved.
9
29
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
30
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -16,37 +36,37 @@ import {NumberFormatter as $iFADg$NumberFormatter} from "@internationalized/numb
16
36
  * governing permissions and limitations under the License.
17
37
  */ // https://en.wikipedia.org/wiki/Right-to-left
18
38
  const $148a7a147e38ea7f$var$RTL_SCRIPTS = new Set([
19
- 'Arab',
20
- 'Syrc',
21
- 'Samr',
22
- 'Mand',
23
- 'Thaa',
24
- 'Mend',
25
- 'Nkoo',
26
- 'Adlm',
27
- 'Rohg',
28
- 'Hebr'
39
+ "Arab",
40
+ "Syrc",
41
+ "Samr",
42
+ "Mand",
43
+ "Thaa",
44
+ "Mend",
45
+ "Nkoo",
46
+ "Adlm",
47
+ "Rohg",
48
+ "Hebr"
29
49
  ]);
30
50
  const $148a7a147e38ea7f$var$RTL_LANGS = new Set([
31
- 'ae',
32
- 'ar',
33
- 'arc',
34
- 'bcc',
35
- 'bqi',
36
- 'ckb',
37
- 'dv',
38
- 'fa',
39
- 'glk',
40
- 'he',
41
- 'ku',
42
- 'mzn',
43
- 'nqo',
44
- 'pnb',
45
- 'ps',
46
- 'sd',
47
- 'ug',
48
- 'ur',
49
- 'yi'
51
+ "ae",
52
+ "ar",
53
+ "arc",
54
+ "bcc",
55
+ "bqi",
56
+ "ckb",
57
+ "dv",
58
+ "fa",
59
+ "glk",
60
+ "he",
61
+ "ku",
62
+ "mzn",
63
+ "nqo",
64
+ "pnb",
65
+ "ps",
66
+ "sd",
67
+ "ug",
68
+ "ur",
69
+ "yi"
50
70
  ]);
51
71
  function $148a7a147e38ea7f$export$702d680b21cbd764(locale) {
52
72
  // If the Intl.Locale API is available, use it to get the script for the locale.
@@ -58,28 +78,38 @@ function $148a7a147e38ea7f$export$702d680b21cbd764(locale) {
58
78
  return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(script);
59
79
  }
60
80
  // If not, just guess by the language (first part of the locale)
61
- let lang = locale.split('-')[0];
81
+ let lang = locale.split("-")[0];
62
82
  return $148a7a147e38ea7f$var$RTL_LANGS.has(lang);
63
83
  }
64
84
 
65
85
 
66
-
86
+ /*
87
+ * Copyright 2020 Adobe. All rights reserved.
88
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
89
+ * you may not use this file except in compliance with the License. You may obtain a copy
90
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
91
+ *
92
+ * Unless required by applicable law or agreed to in writing, software distributed under
93
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
94
+ * OF ANY KIND, either express or implied. See the License for the specific language
95
+ * governing permissions and limitations under the License.
96
+ */
67
97
 
68
98
 
69
99
  function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {
70
100
  // @ts-ignore
71
- let locale = typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
101
+ let locale = typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
72
102
  try {
73
103
  // @ts-ignore
74
104
  Intl.DateTimeFormat.supportedLocalesOf([
75
105
  locale
76
106
  ]);
77
107
  } catch (_err) {
78
- locale = 'en-US';
108
+ locale = "en-US";
79
109
  }
80
110
  return {
81
111
  locale: locale,
82
- direction: $148a7a147e38ea7f$export$702d680b21cbd764(locale) ? 'rtl' : 'ltr'
112
+ direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? "rtl" : "ltr"
83
113
  };
84
114
  }
85
115
  let $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
@@ -89,42 +119,42 @@ function $1e5a04cdaf7d1af8$var$updateLocale() {
89
119
  for (let listener of $1e5a04cdaf7d1af8$var$listeners)listener($1e5a04cdaf7d1af8$var$currentLocale);
90
120
  }
91
121
  function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() {
92
- let isSSR = $iFADg$useIsSSR();
93
- let [defaultLocale, setDefaultLocale] = $iFADg$useState($1e5a04cdaf7d1af8$var$currentLocale);
94
- $iFADg$useEffect(()=>{
95
- if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale);
122
+ let isSSR = (0, $iFADg$useIsSSR)();
123
+ let [defaultLocale, setDefaultLocale] = (0, $iFADg$useState)($1e5a04cdaf7d1af8$var$currentLocale);
124
+ (0, $iFADg$useEffect)(()=>{
125
+ if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
96
126
  $1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale);
97
127
  return ()=>{
98
128
  $1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale);
99
- if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale);
129
+ if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
100
130
  };
101
131
  }, []);
102
132
  // We cannot determine the browser's language on the server, so default to
103
133
  // en-US. This will be updated after hydration on the client to the correct value.
104
134
  if (isSSR) return {
105
- locale: 'en-US',
106
- direction: 'ltr'
135
+ locale: "en-US",
136
+ direction: "ltr"
107
137
  };
108
138
  return defaultLocale;
109
139
  }
110
140
 
111
141
 
112
142
 
113
- const $18f2051aff69b9bf$var$I18nContext = /*#__PURE__*/ $iFADg$react.createContext(null);
143
+ const $18f2051aff69b9bf$var$I18nContext = /*#__PURE__*/ (0, $iFADg$react).createContext(null);
114
144
  function $18f2051aff69b9bf$export$a54013f0d02a8f82(props) {
115
145
  let { locale: locale , children: children } = props;
116
- let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a();
146
+ let defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();
117
147
  let value = locale ? {
118
148
  locale: locale,
119
- direction: $148a7a147e38ea7f$export$702d680b21cbd764(locale) ? 'rtl' : 'ltr'
149
+ direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? "rtl" : "ltr"
120
150
  } : defaultLocale;
121
- return(/*#__PURE__*/ $iFADg$react.createElement($18f2051aff69b9bf$var$I18nContext.Provider, {
151
+ return /*#__PURE__*/ (0, $iFADg$react).createElement($18f2051aff69b9bf$var$I18nContext.Provider, {
122
152
  value: value
123
- }, children));
153
+ }, children);
124
154
  }
125
155
  function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {
126
- let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a();
127
- let context = $iFADg$useContext($18f2051aff69b9bf$var$I18nContext);
156
+ let defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();
157
+ let context = (0, $iFADg$useContext)($18f2051aff69b9bf$var$I18nContext);
128
158
  return context || defaultLocale;
129
159
  }
130
160
 
@@ -133,57 +163,82 @@ var $2aa2084a6c2b6b4f$exports = {};
133
163
  "use strict";
134
164
 
135
165
 
136
-
166
+ /*
167
+ * Copyright 2022 Adobe. All rights reserved.
168
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
169
+ * you may not use this file except in compliance with the License. You may obtain a copy
170
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
171
+ *
172
+ * Unless required by applicable law or agreed to in writing, software distributed under
173
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
174
+ * OF ANY KIND, either express or implied. See the License for the specific language
175
+ * governing permissions and limitations under the License.
176
+ */
137
177
 
138
178
 
139
179
  const $fca6afa0e843324b$var$cache = new WeakMap();
140
180
  function $fca6afa0e843324b$var$getCachedDictionary(strings) {
141
181
  let dictionary = $fca6afa0e843324b$var$cache.get(strings);
142
182
  if (!dictionary) {
143
- dictionary = new $iFADg$LocalizedStringDictionary(strings);
183
+ dictionary = new (0, $iFADg$LocalizedStringDictionary)(strings);
144
184
  $fca6afa0e843324b$var$cache.set(strings, dictionary);
145
185
  }
146
186
  return dictionary;
147
187
  }
148
188
  function $fca6afa0e843324b$export$f12b703ca79dfbb1(strings) {
149
- let { locale: locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
150
- let dictionary = $iFADg$useMemo(()=>$fca6afa0e843324b$var$getCachedDictionary(strings)
151
- , [
189
+ let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
190
+ let dictionary = (0, $iFADg$useMemo)(()=>$fca6afa0e843324b$var$getCachedDictionary(strings), [
152
191
  strings
153
192
  ]);
154
- return $iFADg$useMemo(()=>new $iFADg$LocalizedStringFormatter(locale, dictionary)
155
- , [
193
+ return (0, $iFADg$useMemo)(()=>new (0, $iFADg$LocalizedStringFormatter)(locale, dictionary), [
156
194
  locale,
157
195
  dictionary
158
196
  ]);
159
197
  }
160
198
 
161
199
 
200
+ /*
201
+ * Copyright 2020 Adobe. All rights reserved.
202
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
203
+ * you may not use this file except in compliance with the License. You may obtain a copy
204
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
205
+ *
206
+ * Unless required by applicable law or agreed to in writing, software distributed under
207
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
208
+ * OF ANY KIND, either express or implied. See the License for the specific language
209
+ * governing permissions and limitations under the License.
210
+ */
162
211
 
163
-
164
- function $33bf17300c498528$export$a2f47a3d2973640(options = {
165
- }) {
166
- let { locale: locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
212
+ function $33bf17300c498528$export$a2f47a3d2973640(options = {}) {
213
+ let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
167
214
  // @ts-ignore
168
- return $iFADg$useMemo(()=>new Intl.ListFormat(locale, options)
169
- , [
215
+ return (0, $iFADg$useMemo)(()=>new Intl.ListFormat(locale, options), [
170
216
  locale,
171
217
  options
172
218
  ]);
173
219
  }
174
220
 
175
221
 
176
-
222
+ /*
223
+ * Copyright 2020 Adobe. All rights reserved.
224
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
225
+ * you may not use this file except in compliance with the License. You may obtain a copy
226
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
227
+ *
228
+ * Unless required by applicable law or agreed to in writing, software distributed under
229
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
230
+ * OF ANY KIND, either express or implied. See the License for the specific language
231
+ * governing permissions and limitations under the License.
232
+ */
177
233
 
178
234
 
179
235
  function $896ba0a80a8f4d36$export$85fd5fdf27bacc79(options) {
180
236
  // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.
181
- let lastOptions = $iFADg$useRef(null);
237
+ let lastOptions = (0, $iFADg$useRef)(null);
182
238
  if (options && lastOptions.current && $896ba0a80a8f4d36$var$isEqual(options, lastOptions.current)) options = lastOptions.current;
183
239
  lastOptions.current = options;
184
- let { locale: locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
185
- return $iFADg$useMemo(()=>new $iFADg$DateFormatter(locale, options)
186
- , [
240
+ let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
241
+ return (0, $iFADg$useMemo)(()=>new (0, $iFADg$DateFormatter)(locale, options), [
187
242
  locale,
188
243
  options
189
244
  ]);
@@ -200,26 +255,43 @@ function $896ba0a80a8f4d36$var$isEqual(a, b) {
200
255
  }
201
256
 
202
257
 
258
+ /*
259
+ * Copyright 2020 Adobe. All rights reserved.
260
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
261
+ * you may not use this file except in compliance with the License. You may obtain a copy
262
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
263
+ *
264
+ * Unless required by applicable law or agreed to in writing, software distributed under
265
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
266
+ * OF ANY KIND, either express or implied. See the License for the specific language
267
+ * governing permissions and limitations under the License.
268
+ */
203
269
 
204
270
 
205
-
206
- function $a916eb452884faea$export$b7a616150fdb9f44(options = {
207
- }) {
208
- let { locale: locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
209
- return $iFADg$useMemo(()=>new $iFADg$NumberFormatter(locale, options)
210
- , [
271
+ function $a916eb452884faea$export$b7a616150fdb9f44(options = {}) {
272
+ let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
273
+ return (0, $iFADg$useMemo)(()=>new (0, $iFADg$NumberFormatter)(locale, options), [
211
274
  locale,
212
275
  options
213
276
  ]);
214
277
  }
215
278
 
216
279
 
217
-
280
+ /*
281
+ * Copyright 2020 Adobe. All rights reserved.
282
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
283
+ * you may not use this file except in compliance with the License. You may obtain a copy
284
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
285
+ *
286
+ * Unless required by applicable law or agreed to in writing, software distributed under
287
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
288
+ * OF ANY KIND, either express or implied. See the License for the specific language
289
+ * governing permissions and limitations under the License.
290
+ */
218
291
  let $325a3faab7a68acd$var$cache = new Map();
219
292
  function $325a3faab7a68acd$export$a16aca283550c30d(options) {
220
- let { locale: locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
221
- let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1
222
- ).join() : '');
293
+ let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
294
+ let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : "");
223
295
  if ($325a3faab7a68acd$var$cache.has(cacheKey)) return $325a3faab7a68acd$var$cache.get(cacheKey);
224
296
  let formatter = new Intl.Collator(locale, options);
225
297
  $325a3faab7a68acd$var$cache.set(cacheKey, formatter);
@@ -227,41 +299,65 @@ function $325a3faab7a68acd$export$a16aca283550c30d(options) {
227
299
  }
228
300
 
229
301
 
302
+ /*
303
+ * Copyright 2020 Adobe. All rights reserved.
304
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
305
+ * you may not use this file except in compliance with the License. You may obtain a copy
306
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
307
+ *
308
+ * Unless required by applicable law or agreed to in writing, software distributed under
309
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
310
+ * OF ANY KIND, either express or implied. See the License for the specific language
311
+ * governing permissions and limitations under the License.
312
+ */
230
313
 
231
314
  function $bb77f239b46e8c72$export$3274cf84b703fff(options) {
232
- let collator = $325a3faab7a68acd$export$a16aca283550c30d({
233
- usage: 'search',
315
+ let collator = (0, $325a3faab7a68acd$export$a16aca283550c30d)({
316
+ usage: "search",
234
317
  ...options
235
318
  });
236
319
  // TODO(later): these methods don't currently support the ignorePunctuation option.
237
- return {
238
- startsWith (string, substring) {
239
- if (substring.length === 0) return true;
240
- // Normalize both strings so we can slice safely
241
- // TODO: take into account the ignorePunctuation option as well...
242
- string = string.normalize('NFC');
243
- substring = substring.normalize('NFC');
244
- return collator.compare(string.slice(0, substring.length), substring) === 0;
245
- },
246
- endsWith (string, substring) {
247
- if (substring.length === 0) return true;
248
- string = string.normalize('NFC');
249
- substring = substring.normalize('NFC');
250
- return collator.compare(string.slice(-substring.length), substring) === 0;
251
- },
252
- contains (string, substring) {
253
- if (substring.length === 0) return true;
254
- string = string.normalize('NFC');
255
- substring = substring.normalize('NFC');
256
- let scan = 0;
257
- let sliceLen = substring.length;
258
- for(; scan + sliceLen <= string.length; scan++){
259
- let slice = string.slice(scan, scan + sliceLen);
260
- if (collator.compare(substring, slice) === 0) return true;
261
- }
262
- return false;
320
+ let startsWith = (0, $iFADg$useCallback)((string, substring)=>{
321
+ if (substring.length === 0) return true;
322
+ // Normalize both strings so we can slice safely
323
+ // TODO: take into account the ignorePunctuation option as well...
324
+ string = string.normalize("NFC");
325
+ substring = substring.normalize("NFC");
326
+ return collator.compare(string.slice(0, substring.length), substring) === 0;
327
+ }, [
328
+ collator
329
+ ]);
330
+ let endsWith = (0, $iFADg$useCallback)((string, substring)=>{
331
+ if (substring.length === 0) return true;
332
+ string = string.normalize("NFC");
333
+ substring = substring.normalize("NFC");
334
+ return collator.compare(string.slice(-substring.length), substring) === 0;
335
+ }, [
336
+ collator
337
+ ]);
338
+ let contains = (0, $iFADg$useCallback)((string, substring)=>{
339
+ if (substring.length === 0) return true;
340
+ string = string.normalize("NFC");
341
+ substring = substring.normalize("NFC");
342
+ let scan = 0;
343
+ let sliceLen = substring.length;
344
+ for(; scan + sliceLen <= string.length; scan++){
345
+ let slice = string.slice(scan, scan + sliceLen);
346
+ if (collator.compare(substring, slice) === 0) return true;
263
347
  }
264
- };
348
+ return false;
349
+ }, [
350
+ collator
351
+ ]);
352
+ return (0, $iFADg$useMemo)(()=>({
353
+ startsWith: startsWith,
354
+ endsWith: endsWith,
355
+ contains: contains
356
+ }), [
357
+ startsWith,
358
+ endsWith,
359
+ contains
360
+ ]);
265
361
  }
266
362
 
267
363
 
@@ -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,CAAM;IAAE,CAAM;IAAE,CAAM;IAAE,CAAM;IAAE,CAAM;AAAA,CAAC;AAC5G,KAAK,CAAC,+BAAS,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IAAA,CAAI;IAAE,CAAI;IAAE,CAAK;IAAE,CAAK;IAAE,CAAK;IAAE,CAAK;IAAE,CAAI;IAAE,CAAI;IAAE,CAAK;IAAE,CAAI;IAAE,CAAI;IA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SAAS,CAAC,MAAM,GAAG,SAAS,MAAM,CAAC;QAC7E,CAAC;QACD,QAAQ,EAAC,MAAM,EAAE,SAAS,EAAE,CAAC;YAC3B,EAAE,EAAE,SAAS,CAAC,MAAM,KAAK,CAAC,EACxB,MAAM,CAAC,IAAI;YAGb,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAK;YAC/B,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAK;YACrC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,MAAM,CAAC;QAC3E,CAAC;QACD,QAAQ,EAAC,MAAM,EAAE,SAAS,EAAE,CAAC;YAC3B,EAAE,EAAE,SAAS,CAAC,MAAM,KAAK,CAAC,EACxB,MAAM,CAAC,IAAI;YAGb,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAK;YAC/B,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAK;YAErC,GAAG,CAAC,IAAI,GAAG,CAAC;YACZ,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC,MAAM;YAC/B,GAAG,GAAI,IAAI,GAAG,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,GAAI,CAAC;gBAChD,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ;gBAC9C,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,MAAM,CAAC,EAC1C,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;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AC;QAC1B,YAAY,UAAU,SAAS,CAAC;QAChC,OAAO,SAAS,OAAO,CAAC,OAAO,KAAK,CAAC,GAAG,UAAU,MAAM,GAAG,eAAe;IAC5E,GAAG;QAAC;KAAS;IAEb,IAAI,WAAW,CAAA,GAAA,kBAAW,AAAD,EAAE,CAAC,QAAQ,YAAc;QAChD,IAAI,UAAU,MAAM,KAAK,GACvB,OAAO,IAAI;QAGb,SAAS,OAAO,SAAS,CAAC;QAC1B,YAAY,UAAU,SAAS,CAAC;QAChC,OAAO,SAAS,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,UAAU,MAAM,GAAG,eAAe;IAC1E,GAAG;QAAC;KAAS;IAEb,IAAI,WAAW,CAAA,GAAA,kBAAW,AAAD,EAAE,CAAC,QAAQ,YAAc;QAChD,IAAI,UAAU,MAAM,KAAK,GACvB,OAAO,IAAI;QAGb,SAAS,OAAO,SAAS,CAAC;QAC1B,YAAY,UAAU,SAAS,CAAC;QAEhC,IAAI,OAAO;QACX,IAAI,WAAW,UAAU,MAAM;QAC/B,MAAO,OAAO,YAAY,OAAO,MAAM,EAAE,OAAQ;YAC/C,IAAI,QAAQ,OAAO,KAAK,CAAC,MAAM,OAAO;YACtC,IAAI,SAAS,OAAO,CAAC,WAAW,WAAW,GACzC,OAAO,IAAI;QAEf;QAEA,OAAO,KAAK;IACd,GAAG;QAAC;KAAS;IAEb,OAAO,CAAA,GAAA,cAAO,AAAD,EAAE,IAAO,CAAA;wBACpB;sBACA;sBACA;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-module.js.map"}