@eldrajs/sdk 0.3.2 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +90 -0
- package/dist/{client-Cn3at4Zh.js → client-DLMV5fcx.js} +180 -10
- package/dist/date-DzIUeT6Y.js +12215 -0
- package/dist/format/date.d.ts +1 -3
- package/dist/format/date.js +1 -12214
- package/dist/format/display-names.d.ts +1 -3
- package/dist/format/display-names.js +5 -9
- package/dist/format/intl.d.ts +21 -0
- package/dist/format/intl.js +159 -0
- package/dist/format/list.d.ts +1 -3
- package/dist/format/list.js +5 -9
- package/dist/format/relative-time.d.ts +1 -3
- package/dist/format/relative-time.js +6 -10
- package/dist/format.d.ts +1 -5
- package/dist/format.js +2 -3
- package/dist/index.d.ts +2 -39
- package/dist/index.js +4 -54
- package/dist/{locale-DOZdbAbY.js → locale-vZLrJAy8.js} +3 -6
- package/dist/{number-D3Vt6TOL.js → number-nkpzAc71.js} +6 -11
- package/dist/{types-BAYHYEat.d.ts → types-CiA-DRIp.d.ts} +63 -5
- package/dist/vite.d.ts +2 -4
- package/dist/vite.js +2 -3
- package/package.json +5 -1
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
//#region src/format/display-names.d.ts
|
|
2
1
|
/** `new Intl.DisplayNames(locale, options)` with the same names everywhere: `Danmörk`. */
|
|
3
|
-
export declare function displayNames(locale: string, options: Intl.DisplayNamesOptions): Intl.DisplayNames;
|
|
4
|
-
//#endregion
|
|
2
|
+
export declare function displayNames(locale: string, options: Intl.DisplayNamesOptions): Intl.DisplayNames;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as ResolveLocale, n as usesBundledData, r as LookupSupportedLocales, t as cached } from "../locale-
|
|
2
|
-
|
|
1
|
+
import { i as ResolveLocale, n as usesBundledData, r as LookupSupportedLocales, t as cached } from "../locale-vZLrJAy8.js";
|
|
2
|
+
// ../../node_modules/.pnpm/@formatjs+intl-displaynames@7.3.15/node_modules/@formatjs/intl-displaynames/index.js
|
|
3
3
|
const defaultContent = {
|
|
4
4
|
"aa": ["aa-ET"],
|
|
5
5
|
"ab": ["ab-GE"],
|
|
@@ -749,8 +749,7 @@ function getNameForTypeLanguage(languageDisplay, localeData, style, canonicalCod
|
|
|
749
749
|
}
|
|
750
750
|
} else return name;
|
|
751
751
|
}
|
|
752
|
-
|
|
753
|
-
//#region src/format/data/display-names-en.json
|
|
752
|
+
// src/format/data/display-names-en.json
|
|
754
753
|
var display_names_en_default = {
|
|
755
754
|
data: {
|
|
756
755
|
"patterns": { "locale": "{0} ({1})" },
|
|
@@ -3038,8 +3037,7 @@ var display_names_en_default = {
|
|
|
3038
3037
|
},
|
|
3039
3038
|
locale: "en"
|
|
3040
3039
|
};
|
|
3041
|
-
|
|
3042
|
-
//#region src/format/data/display-names-is.json
|
|
3040
|
+
// src/format/data/display-names-is.json
|
|
3043
3041
|
var display_names_is_default = {
|
|
3044
3042
|
data: {
|
|
3045
3043
|
"patterns": { "locale": "{0} ({1})" },
|
|
@@ -4885,8 +4883,7 @@ var display_names_is_default = {
|
|
|
4885
4883
|
},
|
|
4886
4884
|
locale: "is"
|
|
4887
4885
|
};
|
|
4888
|
-
|
|
4889
|
-
//#region src/format/display-names.ts
|
|
4886
|
+
// src/format/display-names.ts
|
|
4890
4887
|
let loaded = false;
|
|
4891
4888
|
const formats = /* @__PURE__ */ new Map();
|
|
4892
4889
|
/** `new Intl.DisplayNames(locale, options)` with the same names everywhere: `Danmörk`. */
|
|
@@ -4901,5 +4898,4 @@ function displayNames(locale, options) {
|
|
|
4901
4898
|
return new DisplayNames(locale, options);
|
|
4902
4899
|
});
|
|
4903
4900
|
}
|
|
4904
|
-
//#endregion
|
|
4905
4901
|
export { displayNames };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type Restore = () => void;
|
|
2
|
+
export interface InstallIcelandicIntlOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Patch even where the runtime has Icelandic data (Node, Safari, Firefox), so every runtime prints
|
|
5
|
+
* the same Icelandic. Off by default: there the runtime's own Icelandic is left alone.
|
|
6
|
+
*/
|
|
7
|
+
force?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Formats Icelandic from this package's data wherever the runtime has none, and leaves every other
|
|
11
|
+
* locale to the runtime. Call it once, before anything formats (a Nuxt client plugin, the top of
|
|
12
|
+
* `main.ts`). Returns a function that puts the runtime's own `Intl` back.
|
|
13
|
+
*
|
|
14
|
+
* Covers numbers and dates. Dates in a zone other than UTC (Iceland's) stay with the runtime, since
|
|
15
|
+
* the bundled data carries no time zones. Lists, relative times, names and sorting are not patched:
|
|
16
|
+
* use `listFormat`, `relativeTimeFormat`, `displayNames` and `comparator` for those.
|
|
17
|
+
*
|
|
18
|
+
* Only the call that installs the patch can remove it, once; a call made while it is installed
|
|
19
|
+
* changes nothing and returns a function that does nothing.
|
|
20
|
+
*/
|
|
21
|
+
export declare function installIcelandicIntl(options?: InstallIcelandicIntlOptions): Restore;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { n as isUtcZone, t as dateTimeFormat } from "../date-DzIUeT6Y.js";
|
|
2
|
+
import { n as numberFormat } from "../number-nkpzAc71.js";
|
|
3
|
+
// src/format/intl.ts
|
|
4
|
+
/**
|
|
5
|
+
* `installIcelandicIntl()` — Icelandic for code you do not control.
|
|
6
|
+
*
|
|
7
|
+
* `@eldrajs/sdk/format`'s functions are the way to format text you write. A date picker, vue-i18n's
|
|
8
|
+
* `n()`/`d()` or a chart library calls `Intl` itself, and where the runtime has no Icelandic data
|
|
9
|
+
* (Chrome, Edge, Cloudflare Workers) it prints English. This patches `Intl.NumberFormat`,
|
|
10
|
+
* `Intl.DateTimeFormat`, `Number.prototype.toLocaleString` and the three `Date.prototype.toLocale*`
|
|
11
|
+
* methods so that a request for Icelandic is formatted from this package's own data, and every other
|
|
12
|
+
* locale is left to the runtime exactly as before. Unlike a polyfill that replaces `Intl`, nothing
|
|
13
|
+
* changes for a browser on `en-GB` or `de-DE`, and there is no default locale to get wrong.
|
|
14
|
+
*/
|
|
15
|
+
const INSTALLED = Symbol.for("@eldrajs/sdk/format/intl");
|
|
16
|
+
/** Whether the runtime would format `locales` as Icelandic if it could: an Icelandic tag before any tag it supports. */
|
|
17
|
+
function wantsIcelandic(Runtime, locales) {
|
|
18
|
+
if (locales === void 0) return false;
|
|
19
|
+
for (const tag of Intl.getCanonicalLocales(locales)) {
|
|
20
|
+
if (/^is(-|$)/i.test(tag)) return true;
|
|
21
|
+
if (Runtime.supportedLocalesOf([tag]).length > 0) return false;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
function supportedLocalesOf(Runtime) {
|
|
26
|
+
return (locales, options) => {
|
|
27
|
+
const supported = new Set(Runtime.supportedLocalesOf(locales, options));
|
|
28
|
+
return Intl.getCanonicalLocales(locales).filter((tag) => supported.has(tag) || /^is(-|$)/i.test(tag));
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const DATE_FIELDS = [
|
|
32
|
+
"weekday",
|
|
33
|
+
"year",
|
|
34
|
+
"month",
|
|
35
|
+
"day"
|
|
36
|
+
];
|
|
37
|
+
const TIME_FIELDS = [
|
|
38
|
+
"dayPeriod",
|
|
39
|
+
"hour",
|
|
40
|
+
"minute",
|
|
41
|
+
"second",
|
|
42
|
+
"fractionalSecondDigits"
|
|
43
|
+
];
|
|
44
|
+
/** ECMA-402's ToDateTimeOptions: the fields `toLocale{Date,Time,}String` add when none are asked for. */
|
|
45
|
+
function withDefaults(options, required, defaults) {
|
|
46
|
+
const resolved = { ...options };
|
|
47
|
+
if (required === "date" && resolved.timeStyle !== void 0) throw new TypeError("toLocaleDateString does not accept timeStyle");
|
|
48
|
+
if (required === "time" && resolved.dateStyle !== void 0) throw new TypeError("toLocaleTimeString does not accept dateStyle");
|
|
49
|
+
const has = (fields) => fields.some((field) => resolved[field] !== void 0);
|
|
50
|
+
let needDefaults = true;
|
|
51
|
+
if ((required === "date" || required === "any") && has(DATE_FIELDS)) needDefaults = false;
|
|
52
|
+
if ((required === "time" || required === "any") && has(TIME_FIELDS)) needDefaults = false;
|
|
53
|
+
if (resolved.dateStyle !== void 0 || resolved.timeStyle !== void 0) needDefaults = false;
|
|
54
|
+
if (!needDefaults) return resolved;
|
|
55
|
+
if (defaults === "date" || defaults === "all") Object.assign(resolved, {
|
|
56
|
+
year: "numeric",
|
|
57
|
+
month: "numeric",
|
|
58
|
+
day: "numeric"
|
|
59
|
+
});
|
|
60
|
+
if (defaults === "time" || defaults === "all") Object.assign(resolved, {
|
|
61
|
+
hour: "numeric",
|
|
62
|
+
minute: "numeric",
|
|
63
|
+
second: "numeric"
|
|
64
|
+
});
|
|
65
|
+
return resolved;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Formats Icelandic from this package's data wherever the runtime has none, and leaves every other
|
|
69
|
+
* locale to the runtime. Call it once, before anything formats (a Nuxt client plugin, the top of
|
|
70
|
+
* `main.ts`). Returns a function that puts the runtime's own `Intl` back.
|
|
71
|
+
*
|
|
72
|
+
* Covers numbers and dates. Dates in a zone other than UTC (Iceland's) stay with the runtime, since
|
|
73
|
+
* the bundled data carries no time zones. Lists, relative times, names and sorting are not patched:
|
|
74
|
+
* use `listFormat`, `relativeTimeFormat`, `displayNames` and `comparator` for those.
|
|
75
|
+
*
|
|
76
|
+
* Only the call that installs the patch can remove it, once; a call made while it is installed
|
|
77
|
+
* changes nothing and returns a function that does nothing.
|
|
78
|
+
*/
|
|
79
|
+
function installIcelandicIntl(options = {}) {
|
|
80
|
+
const intl = Intl;
|
|
81
|
+
const RuntimeNumberFormat = Intl.NumberFormat;
|
|
82
|
+
const RuntimeDateTimeFormat = Intl.DateTimeFormat;
|
|
83
|
+
if (RuntimeNumberFormat[INSTALLED]) return () => {};
|
|
84
|
+
if (RuntimeNumberFormat.supportedLocalesOf(["is"]).length > 0 && RuntimeDateTimeFormat.supportedLocalesOf(["is"]).length > 0 && !options.force) return () => {};
|
|
85
|
+
/**
|
|
86
|
+
* The zone a date formatter would use: the one asked for, else the runtime's own, read on every
|
|
87
|
+
* call because it can change while the page is open.
|
|
88
|
+
*/
|
|
89
|
+
const zoneOf = (dateOptions) => dateOptions?.timeZone ?? new RuntimeDateTimeFormat().resolvedOptions().timeZone;
|
|
90
|
+
const icelandicNumbers = (locales) => wantsIcelandic(RuntimeNumberFormat, locales);
|
|
91
|
+
/** The UTC zone to format an Icelandic date in, or `undefined` when the runtime keeps it. */
|
|
92
|
+
const icelandicZone = (locales, dateOptions) => {
|
|
93
|
+
if (!wantsIcelandic(RuntimeDateTimeFormat, locales)) return void 0;
|
|
94
|
+
const zone = zoneOf(dateOptions);
|
|
95
|
+
return isUtcZone(zone) ? zone : void 0;
|
|
96
|
+
};
|
|
97
|
+
/** The formatters this patch hands out, so `instanceof` recognises them as well as native ones. */
|
|
98
|
+
const bundled = /* @__PURE__ */ new WeakSet();
|
|
99
|
+
const handOut = (formatter) => {
|
|
100
|
+
bundled.add(formatter);
|
|
101
|
+
return formatter;
|
|
102
|
+
};
|
|
103
|
+
const icelandicDateFormat = (dateOptions, zone) => handOut(dateTimeFormat("is", {
|
|
104
|
+
...dateOptions,
|
|
105
|
+
timeZone: zone
|
|
106
|
+
}));
|
|
107
|
+
const NumberFormat = function NumberFormat(locales, numberOptions) {
|
|
108
|
+
if (icelandicNumbers(locales)) return handOut(numberFormat("is", numberOptions));
|
|
109
|
+
return Reflect.construct(RuntimeNumberFormat, [locales, numberOptions], new.target ?? RuntimeNumberFormat);
|
|
110
|
+
};
|
|
111
|
+
Object.defineProperties(NumberFormat, {
|
|
112
|
+
prototype: { value: RuntimeNumberFormat.prototype },
|
|
113
|
+
supportedLocalesOf: { value: supportedLocalesOf(RuntimeNumberFormat) },
|
|
114
|
+
[Symbol.hasInstance]: { value: (value) => value instanceof RuntimeNumberFormat || typeof value === "object" && value !== null && bundled.has(value) }
|
|
115
|
+
});
|
|
116
|
+
const DateTimeFormat = function DateTimeFormat(locales, dateOptions) {
|
|
117
|
+
const zone = icelandicZone(locales, dateOptions);
|
|
118
|
+
if (zone !== void 0) return icelandicDateFormat(dateOptions, zone);
|
|
119
|
+
return Reflect.construct(RuntimeDateTimeFormat, [locales, dateOptions], new.target ?? RuntimeDateTimeFormat);
|
|
120
|
+
};
|
|
121
|
+
Object.defineProperties(DateTimeFormat, {
|
|
122
|
+
prototype: { value: RuntimeDateTimeFormat.prototype },
|
|
123
|
+
supportedLocalesOf: { value: supportedLocalesOf(RuntimeDateTimeFormat) },
|
|
124
|
+
[Symbol.hasInstance]: { value: (value) => value instanceof RuntimeDateTimeFormat || typeof value === "object" && value !== null && bundled.has(value) }
|
|
125
|
+
});
|
|
126
|
+
NumberFormat[INSTALLED] = true;
|
|
127
|
+
const numberToLocaleString = Number.prototype.toLocaleString;
|
|
128
|
+
const numberValueOf = Number.prototype.valueOf;
|
|
129
|
+
const dateGetTime = Date.prototype.getTime;
|
|
130
|
+
const dateToLocaleString = Date.prototype.toLocaleString;
|
|
131
|
+
const dateToLocaleDateString = Date.prototype.toLocaleDateString;
|
|
132
|
+
const dateToLocaleTimeString = Date.prototype.toLocaleTimeString;
|
|
133
|
+
Number.prototype.toLocaleString = function toLocaleString(locales, numberOptions) {
|
|
134
|
+
const value = numberValueOf.call(this);
|
|
135
|
+
return icelandicNumbers(locales) ? numberFormat("is", numberOptions).format(value) : numberToLocaleString.call(this, locales, numberOptions);
|
|
136
|
+
};
|
|
137
|
+
const patchDate = (original, required, defaults) => function(locales, dateOptions) {
|
|
138
|
+
const zone = Number.isNaN(dateGetTime.call(this)) ? void 0 : icelandicZone(locales, dateOptions);
|
|
139
|
+
if (zone === void 0) return original.call(this, locales, dateOptions);
|
|
140
|
+
return icelandicDateFormat(withDefaults(dateOptions, required, defaults), zone).format(this);
|
|
141
|
+
};
|
|
142
|
+
Date.prototype.toLocaleString = patchDate(dateToLocaleString, "any", "all");
|
|
143
|
+
Date.prototype.toLocaleDateString = patchDate(dateToLocaleDateString, "date", "date");
|
|
144
|
+
Date.prototype.toLocaleTimeString = patchDate(dateToLocaleTimeString, "time", "time");
|
|
145
|
+
intl.NumberFormat = NumberFormat;
|
|
146
|
+
intl.DateTimeFormat = DateTimeFormat;
|
|
147
|
+
let restored = false;
|
|
148
|
+
return () => {
|
|
149
|
+
if (restored) return;
|
|
150
|
+
restored = true;
|
|
151
|
+
intl.NumberFormat = RuntimeNumberFormat;
|
|
152
|
+
intl.DateTimeFormat = RuntimeDateTimeFormat;
|
|
153
|
+
Number.prototype.toLocaleString = numberToLocaleString;
|
|
154
|
+
Date.prototype.toLocaleString = dateToLocaleString;
|
|
155
|
+
Date.prototype.toLocaleDateString = dateToLocaleDateString;
|
|
156
|
+
Date.prototype.toLocaleTimeString = dateToLocaleTimeString;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
export { installIcelandicIntl };
|
package/dist/format/list.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
//#region src/format/list.d.ts
|
|
2
1
|
/** `new Intl.ListFormat(locale, options)` with the same text everywhere: `a, b og c`. */
|
|
3
|
-
export declare function listFormat(locale: string, options?: Intl.ListFormatOptions): Intl.ListFormat;
|
|
4
|
-
//#endregion
|
|
2
|
+
export declare function listFormat(locale: string, options?: Intl.ListFormatOptions): Intl.ListFormat;
|
package/dist/format/list.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as ResolveLocale, n as usesBundledData, r as LookupSupportedLocales, t as cached } from "../locale-
|
|
2
|
-
|
|
1
|
+
import { i as ResolveLocale, n as usesBundledData, r as LookupSupportedLocales, t as cached } from "../locale-vZLrJAy8.js";
|
|
2
|
+
// ../../node_modules/.pnpm/@formatjs+intl-listformat@8.3.15/node_modules/@formatjs/intl-listformat/index.js
|
|
3
3
|
const defaultContent = {
|
|
4
4
|
"aa": ["aa-ET"],
|
|
5
5
|
"ab": ["ab-GE"],
|
|
@@ -748,8 +748,7 @@ try {
|
|
|
748
748
|
configurable: true
|
|
749
749
|
});
|
|
750
750
|
} catch {}
|
|
751
|
-
|
|
752
|
-
//#region src/format/data/list-en.json
|
|
751
|
+
// src/format/data/list-en.json
|
|
753
752
|
var list_en_default = {
|
|
754
753
|
data: {
|
|
755
754
|
"conjunction": {
|
|
@@ -815,8 +814,7 @@ var list_en_default = {
|
|
|
815
814
|
},
|
|
816
815
|
locale: "en"
|
|
817
816
|
};
|
|
818
|
-
|
|
819
|
-
//#region src/format/data/list-is.json
|
|
817
|
+
// src/format/data/list-is.json
|
|
820
818
|
var list_is_default = {
|
|
821
819
|
data: {
|
|
822
820
|
"conjunction": {
|
|
@@ -882,8 +880,7 @@ var list_is_default = {
|
|
|
882
880
|
},
|
|
883
881
|
locale: "is"
|
|
884
882
|
};
|
|
885
|
-
|
|
886
|
-
//#region src/format/list.ts
|
|
883
|
+
// src/format/list.ts
|
|
887
884
|
let loaded = false;
|
|
888
885
|
const formats = /* @__PURE__ */ new Map();
|
|
889
886
|
/** `new Intl.ListFormat(locale, options)` with the same text everywhere: `a, b og c`. */
|
|
@@ -898,5 +895,4 @@ function listFormat(locale, options = {}) {
|
|
|
898
895
|
return new ListFormat(locale, options);
|
|
899
896
|
});
|
|
900
897
|
}
|
|
901
|
-
//#endregion
|
|
902
898
|
export { listFormat };
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
//#region src/format/relative-time.d.ts
|
|
2
1
|
/** `new Intl.RelativeTimeFormat(locale, options)` with the same text everywhere: `fyrir 3 dögum`. */
|
|
3
|
-
export declare function relativeTimeFormat(locale: string, options?: Intl.RelativeTimeFormatOptions): Intl.RelativeTimeFormat;
|
|
4
|
-
//#endregion
|
|
2
|
+
export declare function relativeTimeFormat(locale: string, options?: Intl.RelativeTimeFormatOptions): Intl.RelativeTimeFormat;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { i as ResolveLocale, n as usesBundledData, r as LookupSupportedLocales, t as cached } from "../locale-vZLrJAy8.js";
|
|
2
|
+
import { r as withOurNumberFormat } from "../number-nkpzAc71.js";
|
|
3
|
+
// ../../node_modules/.pnpm/@formatjs+intl-relativetimeformat@12.3.15/node_modules/@formatjs/intl-relativetimeformat/index.js
|
|
4
4
|
const defaultContent = {
|
|
5
5
|
"aa": ["aa-ET"],
|
|
6
6
|
"ab": ["ab-GE"],
|
|
@@ -758,8 +758,7 @@ try {
|
|
|
758
758
|
configurable: true
|
|
759
759
|
});
|
|
760
760
|
} catch {}
|
|
761
|
-
|
|
762
|
-
//#region src/format/data/relative-time-en.json
|
|
761
|
+
// src/format/data/relative-time-en.json
|
|
763
762
|
var relative_time_en_default = {
|
|
764
763
|
data: {
|
|
765
764
|
"day": {
|
|
@@ -1139,8 +1138,7 @@ var relative_time_en_default = {
|
|
|
1139
1138
|
},
|
|
1140
1139
|
locale: "en"
|
|
1141
1140
|
};
|
|
1142
|
-
|
|
1143
|
-
//#region src/format/data/relative-time-is.json
|
|
1141
|
+
// src/format/data/relative-time-is.json
|
|
1144
1142
|
var relative_time_is_default = {
|
|
1145
1143
|
data: {
|
|
1146
1144
|
"day": {
|
|
@@ -1526,8 +1524,7 @@ var relative_time_is_default = {
|
|
|
1526
1524
|
},
|
|
1527
1525
|
locale: "is"
|
|
1528
1526
|
};
|
|
1529
|
-
|
|
1530
|
-
//#region src/format/relative-time.ts
|
|
1527
|
+
// src/format/relative-time.ts
|
|
1531
1528
|
let loaded = false;
|
|
1532
1529
|
const formats = /* @__PURE__ */ new Map();
|
|
1533
1530
|
/** `new Intl.RelativeTimeFormat(locale, options)` with the same text everywhere: `fyrir 3 dögum`. */
|
|
@@ -1542,5 +1539,4 @@ function relativeTimeFormat(locale, options = {}) {
|
|
|
1542
1539
|
return withOurNumberFormat(() => new RelativeTimeFormat(locale, options));
|
|
1543
1540
|
});
|
|
1544
1541
|
}
|
|
1545
|
-
//#endregion
|
|
1546
1542
|
export { relativeTimeFormat };
|
package/dist/format.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
//#region src/format/compare.d.ts
|
|
2
1
|
/** Icelandic alphabetical order (`Intl.Collator('is')`), for runtimes that ship without it. */
|
|
3
2
|
export declare function compareIcelandic(a: string, b: string): number;
|
|
4
3
|
/** A sort comparator for `locale`: Icelandic order from {@link compareIcelandic}, any other from the runtime. */
|
|
5
4
|
export declare function comparator(locale: string): (a: string, b: string) => number;
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/format/number.d.ts
|
|
8
5
|
/** `new Intl.NumberFormat(locale, options)` with the same text on every runtime, Chrome and Workers included. */
|
|
9
6
|
export declare function numberFormat(locale: string, options?: Intl.NumberFormatOptions): Intl.NumberFormat;
|
|
10
7
|
/** A price in major units, the way every Eldra surface writes it: `12.900 kr.`, `ISK 12,900`. */
|
|
11
|
-
export declare function formatPrice(amount: number, currency: string, locale: string): string;
|
|
12
|
-
//#endregion
|
|
8
|
+
export declare function formatPrice(amount: number, currency: string, locale: string): string;
|
package/dist/format.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as numberFormat, t as formatPrice } from "./number-
|
|
2
|
-
|
|
1
|
+
import { n as numberFormat, t as formatPrice } from "./number-nkpzAc71.js";
|
|
2
|
+
// src/format/compare.ts
|
|
3
3
|
const PUNCTUATION = " \xA0_-–—,;:!¡?¿.…·'‘’\"“”„«»()[]{}§@*/\\&#%`^°+÷×<=>|~$£€";
|
|
4
4
|
const LETTERS = "aábcdðeéfghiíjklłmnoópqrstuúvwxyýzþæöå";
|
|
5
5
|
const IGNORED = /* @__PURE__ */ new Set([
|
|
@@ -68,5 +68,4 @@ function comparator(locale) {
|
|
|
68
68
|
if ((Intl.getCanonicalLocales(locale)[0] ?? locale).split("-")[0] === "is") return compareIcelandic;
|
|
69
69
|
return new Intl.Collator(locale).compare;
|
|
70
70
|
}
|
|
71
|
-
//#endregion
|
|
72
71
|
export { comparator, compareIcelandic, formatPrice, numberFormat };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { $ as EldraOrganizationFeature, A as EldraFeature, At as EldraContractMethod, B as EldraFormSubmitResult, C as EldraCmsResolveEntryListResponse, Ct as EldraStockAvailabilityInput, D as EldraCollectionListOptions, Dt as EldraContract, E as EldraCollectionList, Et as RuntimeValue, F as EldraFormField, Ft as EldraContractResponse, G as EldraInventoryClient, H as EldraFormsClient, I as EldraFormFieldOption, J as EldraOrderLine, K as EldraLocaleOptions, L as EldraFormFieldType, M as EldraFeatureClient, Mt as EldraContractPaths, N as EldraFormActionKind, Nt as EldraContractProp, O as EldraCollectionProductsOptions, Ot as EldraContractBody, P as EldraFormDefinition, Pt as EldraContractQuery, Q as EldraOrganizationDetails, R as EldraFormLocalized, S as EldraCmsResolveEntryListOptions, St as EldraStockAvailability, T as EldraCollection, Tt as RuntimeEnv, U as EldraHttpClient, V as EldraFormTokenResult, W as EldraHttpRequest, X as EldraOrdersClient, Y as EldraOrderReadOptions, Z as EldraOrganizationCommerce, _ as EldraCmsEntryListEntry, _t as EldraRequestContext, a as EldraCartTotals, at as EldraPlatformConfig, b as EldraCmsGetOptions, bt as EldraSearchOptions, c as EldraCatalogListProductsOptions, ct as EldraProductList, d as EldraCheckoutUrlOptions, dt as EldraProductOption, et as EldraOrganizationLocales, f as EldraClient, ft as EldraProductOptionValue, g as EldraCmsEntryListDisplayMode, gt as EldraRecoveredBasketItem, h as EldraCmsEntryList, ht as EldraRecoveredBasket, i as EldraCartItem, it as EldraPlatformClient, j as EldraFeatureCapabilities, jt as EldraContractPath, k as EldraDiscountResult, kt as EldraContractItem, l as EldraCategory, lt as EldraProductListItem, m as EldraCmsClient, mt as EldraProductVariant, n as EldraCart, nt as EldraPageMeta, o as EldraCatalogClient, ot as EldraPlatformReadOptions, p as EldraClientOptions, pt as EldraProductThumbnail, q as EldraOrder, r as EldraCartClient, rt as EldraPaginated, s as EldraCatalogGetProductOptions, st as EldraProductDetails, t as EldraAddCartItemInput, tt as EldraOrganizationOptions, u as EldraCheckoutClient, ut as EldraProductMediaLink, v as EldraCmsEntryListFilterCriterion, vt as EldraRequestOptions, w as EldraCmsResolvedEntryList, wt as EldraStockAvailabilityItem, x as EldraCmsListOptions, xt as EldraSearchResponse, y as EldraCmsGetEntryByUniqueFieldOptions, yt as EldraRetryOptions, z as EldraFormSubmitInput } from "./types-
|
|
2
|
-
//#region src/client.d.ts
|
|
1
|
+
import { $ as EldraOrganizationFeature, A as EldraFeature, At as EldraContractMethod, B as EldraFormSubmitResult, Bt as grantCampaignAttributionConsent, C as EldraCmsResolveEntryListResponse, Ct as EldraStockAvailabilityInput, D as EldraCollectionListOptions, Dt as EldraContract, E as EldraCollectionList, Et as RuntimeValue, F as EldraFormField, Ft as EldraContractResponse, G as EldraInventoryClient, Gt as EldraKeyValueStorage, H as EldraFormsClient, Ht as withdrawCampaignAttributionConsent, I as EldraFormFieldOption, It as EldraCampaignAttribution, J as EldraOrderLine, Jt as createCartSession, K as EldraLocaleOptions, Kt as EldraOrderAccessTokenOptions, L as EldraFormFieldType, Lt as EldraCampaignAttributionOptions, M as EldraFeatureClient, Mt as EldraContractPaths, N as EldraFormActionKind, Nt as EldraContractProp, O as EldraCollectionProductsOptions, Ot as EldraContractBody, P as EldraFormDefinition, Pt as EldraContractQuery, Q as EldraOrganizationDetails, R as EldraFormLocalized, Rt as captureCampaignAttribution, S as EldraCmsResolveEntryListOptions, St as EldraStockAvailability, T as EldraCollection, Tt as RuntimeEnv, U as EldraHttpClient, Ut as EldraCartSession, V as EldraFormTokenResult, Vt as readCampaignAttribution, W as EldraHttpRequest, Wt as EldraCartSessionOptions, X as EldraOrdersClient, Y as EldraOrderReadOptions, Yt as createOrderAccessTokens, Z as EldraOrganizationCommerce, _ as EldraCmsEntryListEntry, _t as EldraRequestContext, a as EldraCartTotals, at as EldraPlatformConfig, b as EldraCmsGetOptions, bt as EldraSearchOptions, c as EldraCatalogListProductsOptions, ct as EldraProductList, d as EldraCheckoutUrlOptions, dt as EldraProductOption, et as EldraOrganizationLocales, f as EldraClient, ft as EldraProductOptionValue, g as EldraCmsEntryListDisplayMode, gt as EldraRecoveredBasketItem, h as EldraCmsEntryList, ht as EldraRecoveredBasket, i as EldraCartItem, it as EldraPlatformClient, j as EldraFeatureCapabilities, jt as EldraContractPath, k as EldraDiscountResult, kt as EldraContractItem, l as EldraCategory, lt as EldraProductListItem, m as EldraCmsClient, mt as EldraProductVariant, n as EldraCart, nt as EldraPageMeta, o as EldraCatalogClient, ot as EldraPlatformReadOptions, p as EldraClientOptions, pt as EldraProductThumbnail, q as EldraOrder, qt as EldraOrderAccessTokens, r as EldraCartClient, rt as EldraPaginated, s as EldraCatalogGetProductOptions, st as EldraProductDetails, t as EldraAddCartItemInput, tt as EldraOrganizationOptions, u as EldraCheckoutClient, ut as EldraProductMediaLink, v as EldraCmsEntryListFilterCriterion, vt as EldraRequestOptions, w as EldraCmsResolvedEntryList, wt as EldraStockAvailabilityItem, x as EldraCmsListOptions, xt as EldraSearchResponse, y as EldraCmsGetEntryByUniqueFieldOptions, yt as EldraRetryOptions, z as EldraFormSubmitInput, zt as clearCampaignAttribution } from "./types-CiA-DRIp.js";
|
|
3
2
|
export declare const DEFAULT_ELDRA_API_BASE_URL = "https://web.eldra.app/api";
|
|
4
3
|
export declare class EldraHttpError extends Error {
|
|
5
4
|
readonly status: number;
|
|
@@ -21,39 +20,6 @@ export declare class EldraHttpError extends Error {
|
|
|
21
20
|
export declare function initEldraClient(options: EldraClientOptions): EldraClient;
|
|
22
21
|
export declare function getEldraClient(): EldraClient;
|
|
23
22
|
export declare function createEldraClient(options: EldraClientOptions): EldraClient;
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region src/storage.d.ts
|
|
26
|
-
interface EldraKeyValueStorage {
|
|
27
|
-
getItem(key: string): string | null;
|
|
28
|
-
setItem(key: string, value: string): void;
|
|
29
|
-
removeItem(key: string): void;
|
|
30
|
-
}
|
|
31
|
-
interface EldraCartSession {
|
|
32
|
-
read(): string | null;
|
|
33
|
-
remember(cartId: string): void;
|
|
34
|
-
forget(): void;
|
|
35
|
-
}
|
|
36
|
-
interface EldraOrderAccessTokens {
|
|
37
|
-
remember(orderId: string, token: string | undefined): void;
|
|
38
|
-
read(orderId: string): string | null;
|
|
39
|
-
}
|
|
40
|
-
interface EldraCartSessionOptions {
|
|
41
|
-
storage?: EldraKeyValueStorage | null;
|
|
42
|
-
key?: string;
|
|
43
|
-
}
|
|
44
|
-
interface EldraOrderAccessTokenOptions {
|
|
45
|
-
storage?: EldraKeyValueStorage | null;
|
|
46
|
-
keyPrefix?: string;
|
|
47
|
-
}
|
|
48
|
-
/** The cart id a browser holds between visits. Lives in localStorage so the basket survives a closed tab. */
|
|
49
|
-
export declare function createCartSession(options?: EldraCartSessionOptions): EldraCartSession;
|
|
50
|
-
/**
|
|
51
|
-
* The one-time order access token, kept in sessionStorage rather than the return URL so it
|
|
52
|
-
* survives the payment provider's redirect without landing in a URL, a log or a Referer.
|
|
53
|
-
*/
|
|
54
|
-
export declare function createOrderAccessTokens(options?: EldraOrderAccessTokenOptions): EldraOrderAccessTokens;
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region src/tracker.d.ts
|
|
57
23
|
interface EldraTrackerScriptOptions extends Pick<EldraClientOptions, 'apiBaseUrl' | 'orgId' | 'env'> {
|
|
58
24
|
/** Origin that receives events when the script is served through a first-party proxy. */
|
|
59
25
|
eventOrigin?: string;
|
|
@@ -73,8 +39,6 @@ interface EldraTrackerScript {
|
|
|
73
39
|
* in builds that should not report at all.
|
|
74
40
|
*/
|
|
75
41
|
export declare function analyticsTrackerScript(options?: EldraTrackerScriptOptions): EldraTrackerScript | undefined;
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/image.d.ts
|
|
78
42
|
/** A size the media host serves by path suffix; `original` is the uploaded file, untransformed. */
|
|
79
43
|
type EldraImageVariant = 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'original';
|
|
80
44
|
/** The variants the media host resizes, narrowest first. */
|
|
@@ -150,5 +114,4 @@ interface EldraResponsiveImage {
|
|
|
150
114
|
* as `src` and no `srcset`. Returns `undefined` when there is no URL to render.
|
|
151
115
|
*/
|
|
152
116
|
export declare function responsiveImage(source: EldraImageSource, options: EldraResponsiveImageOptions): EldraResponsiveImage | undefined;
|
|
153
|
-
|
|
154
|
-
export type { EldraAddCartItemInput, EldraCart, EldraCartClient, EldraCartItem, EldraCartSession, EldraCartSessionOptions, EldraCartTotals, EldraCatalogClient, EldraCatalogGetProductOptions, EldraCatalogListProductsOptions, EldraCategory, EldraCheckoutClient, EldraCheckoutUrlOptions, EldraClient, EldraClientOptions, EldraCmsClient, EldraCmsEntryList, EldraCmsEntryListDisplayMode, EldraCmsEntryListEntry, EldraCmsEntryListFilterCriterion, EldraCmsGetEntryByUniqueFieldOptions, EldraCmsGetOptions, EldraCmsListOptions, EldraCmsResolveEntryListOptions, EldraCmsResolveEntryListResponse, EldraCmsResolvedEntryList, EldraCollection, EldraCollectionList, EldraCollectionListOptions, EldraCollectionProductsOptions, EldraContract, EldraContractBody, EldraContractItem, EldraContractMethod, EldraContractPath, EldraContractPaths, EldraContractProp, EldraContractQuery, EldraContractResponse, EldraDiscountResult, EldraFeature, EldraFeatureCapabilities, EldraFeatureClient, EldraFormActionKind, EldraFormDefinition, EldraFormField, EldraFormFieldOption, EldraFormFieldType, EldraFormLocalized, EldraFormSubmitInput, EldraFormSubmitResult, EldraFormTokenResult, EldraFormsClient, EldraHttpClient, EldraHttpRequest, EldraImageSource, EldraImageSrcsetOptions, EldraImageVariant, EldraInventoryClient, EldraKeyValueStorage, EldraLocaleOptions, EldraOrder, EldraOrderAccessTokenOptions, EldraOrderAccessTokens, EldraOrderLine, EldraOrderReadOptions, EldraOrdersClient, EldraOrganizationCommerce, EldraOrganizationDetails, EldraOrganizationFeature, EldraOrganizationLocales, EldraOrganizationOptions, EldraPageMeta, EldraPaginated, EldraPlatformClient, EldraPlatformConfig, EldraPlatformReadOptions, EldraProductDetails, EldraProductList, EldraProductListItem, EldraProductMediaLink, EldraProductOption, EldraProductOptionValue, EldraProductThumbnail, EldraProductVariant, EldraRecoveredBasket, EldraRecoveredBasketItem, EldraRequestContext, EldraRequestOptions, EldraResponsiveImage, EldraResponsiveImageOptions, EldraRetryOptions, EldraSearchOptions, EldraSearchResponse, EldraSizedImageVariant, EldraStockAvailability, EldraStockAvailabilityInput, EldraStockAvailabilityItem, EldraTrackerScript, EldraTrackerScriptOptions, RuntimeEnv, RuntimeValue };
|
|
117
|
+
export { type EldraAddCartItemInput, type EldraCampaignAttribution, type EldraCampaignAttributionOptions, type EldraCart, type EldraCartClient, type EldraCartItem, type EldraCartSession, type EldraCartSessionOptions, type EldraCartTotals, type EldraCatalogClient, type EldraCatalogGetProductOptions, type EldraCatalogListProductsOptions, type EldraCategory, type EldraCheckoutClient, type EldraCheckoutUrlOptions, type EldraClient, type EldraClientOptions, type EldraCmsClient, type EldraCmsEntryList, type EldraCmsEntryListDisplayMode, type EldraCmsEntryListEntry, type EldraCmsEntryListFilterCriterion, type EldraCmsGetEntryByUniqueFieldOptions, type EldraCmsGetOptions, type EldraCmsListOptions, type EldraCmsResolveEntryListOptions, type EldraCmsResolveEntryListResponse, type EldraCmsResolvedEntryList, type EldraCollection, type EldraCollectionList, type EldraCollectionListOptions, type EldraCollectionProductsOptions, type EldraContract, type EldraContractBody, type EldraContractItem, type EldraContractMethod, type EldraContractPath, type EldraContractPaths, type EldraContractProp, type EldraContractQuery, type EldraContractResponse, type EldraDiscountResult, type EldraFeature, type EldraFeatureCapabilities, type EldraFeatureClient, type EldraFormActionKind, type EldraFormDefinition, type EldraFormField, type EldraFormFieldOption, type EldraFormFieldType, type EldraFormLocalized, type EldraFormSubmitInput, type EldraFormSubmitResult, type EldraFormTokenResult, type EldraFormsClient, type EldraHttpClient, type EldraHttpRequest, type EldraImageSource, type EldraImageSrcsetOptions, type EldraImageVariant, type EldraInventoryClient, type EldraKeyValueStorage, type EldraLocaleOptions, type EldraOrder, type EldraOrderAccessTokenOptions, type EldraOrderAccessTokens, type EldraOrderLine, type EldraOrderReadOptions, type EldraOrdersClient, type EldraOrganizationCommerce, type EldraOrganizationDetails, type EldraOrganizationFeature, type EldraOrganizationLocales, type EldraOrganizationOptions, type EldraPageMeta, type EldraPaginated, type EldraPlatformClient, type EldraPlatformConfig, type EldraPlatformReadOptions, type EldraProductDetails, type EldraProductList, type EldraProductListItem, type EldraProductMediaLink, type EldraProductOption, type EldraProductOptionValue, type EldraProductThumbnail, type EldraProductVariant, type EldraRecoveredBasket, type EldraRecoveredBasketItem, type EldraRequestContext, type EldraRequestOptions, type EldraResponsiveImage, type EldraResponsiveImageOptions, type EldraRetryOptions, type EldraSearchOptions, type EldraSearchResponse, type EldraSizedImageVariant, type EldraStockAvailability, type EldraStockAvailabilityInput, type EldraStockAvailabilityItem, type EldraTrackerScript, type EldraTrackerScriptOptions, type RuntimeEnv, type RuntimeValue, captureCampaignAttribution, clearCampaignAttribution, createCartSession, createOrderAccessTokens, grantCampaignAttributionConsent, readCampaignAttribution, withdrawCampaignAttributionConsent };
|
package/dist/index.js
CHANGED
|
@@ -1,53 +1,5 @@
|
|
|
1
|
-
import { a as initEldraClient, i as getEldraClient, n as EldraHttpError, o as resolveApiBaseUrl, r as createEldraClient, s as resolveOrgId, t as DEFAULT_ELDRA_API_BASE_URL } from "./client-
|
|
2
|
-
|
|
3
|
-
const DEFAULT_CART_KEY = "eldra.cartId";
|
|
4
|
-
const DEFAULT_ORDER_TOKEN_PREFIX = "eldra.orderAccessToken.";
|
|
5
|
-
function browserStorage(name) {
|
|
6
|
-
try {
|
|
7
|
-
return globalThis[name] ?? null;
|
|
8
|
-
} catch {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function safeRead(storage, key) {
|
|
13
|
-
try {
|
|
14
|
-
return storage?.getItem(key) ?? null;
|
|
15
|
-
} catch {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function safeWrite(storage, key, value) {
|
|
20
|
-
try {
|
|
21
|
-
if (value === null) storage?.removeItem(key);
|
|
22
|
-
else storage?.setItem(key, value);
|
|
23
|
-
} catch {}
|
|
24
|
-
}
|
|
25
|
-
/** The cart id a browser holds between visits. Lives in localStorage so the basket survives a closed tab. */
|
|
26
|
-
function createCartSession(options = {}) {
|
|
27
|
-
const storage = options.storage === void 0 ? browserStorage("localStorage") : options.storage;
|
|
28
|
-
const key = options.key ?? DEFAULT_CART_KEY;
|
|
29
|
-
return {
|
|
30
|
-
read: () => safeRead(storage, key),
|
|
31
|
-
remember: (cartId) => safeWrite(storage, key, cartId),
|
|
32
|
-
forget: () => safeWrite(storage, key, null)
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* The one-time order access token, kept in sessionStorage rather than the return URL so it
|
|
37
|
-
* survives the payment provider's redirect without landing in a URL, a log or a Referer.
|
|
38
|
-
*/
|
|
39
|
-
function createOrderAccessTokens(options = {}) {
|
|
40
|
-
const storage = options.storage === void 0 ? browserStorage("sessionStorage") : options.storage;
|
|
41
|
-
const prefix = options.keyPrefix ?? DEFAULT_ORDER_TOKEN_PREFIX;
|
|
42
|
-
return {
|
|
43
|
-
remember: (orderId, token) => {
|
|
44
|
-
if (token) safeWrite(storage, prefix + orderId, token);
|
|
45
|
-
},
|
|
46
|
-
read: (orderId) => safeRead(storage, prefix + orderId)
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/tracker.ts
|
|
1
|
+
import { a as initEldraClient, c as captureCampaignAttribution, d as readCampaignAttribution, f as withdrawCampaignAttributionConsent, i as getEldraClient, l as clearCampaignAttribution, m as createOrderAccessTokens, n as EldraHttpError, o as resolveApiBaseUrl, p as createCartSession, r as createEldraClient, s as resolveOrgId, t as DEFAULT_ELDRA_API_BASE_URL, u as grantCampaignAttributionConsent } from "./client-DLMV5fcx.js";
|
|
2
|
+
// src/tracker.ts
|
|
51
3
|
/**
|
|
52
4
|
* Builds the tracker `<script>` attributes from the same configuration the client uses, so the
|
|
53
5
|
* script comes from the gateway the site reads from and reports there, unless `eventOrigin` names a
|
|
@@ -66,8 +18,7 @@ function analyticsTrackerScript(options = {}) {
|
|
|
66
18
|
if (options.eventOrigin) script["data-api"] = options.eventOrigin;
|
|
67
19
|
return script;
|
|
68
20
|
}
|
|
69
|
-
|
|
70
|
-
//#region src/image.ts
|
|
21
|
+
// src/image.ts
|
|
71
22
|
/**
|
|
72
23
|
* The maximum width in pixels of each resized variant. The host scales down only, so an original
|
|
73
24
|
* narrower than a variant comes back at its own width.
|
|
@@ -178,5 +129,4 @@ function responsiveImage(source, options) {
|
|
|
178
129
|
}
|
|
179
130
|
return image;
|
|
180
131
|
}
|
|
181
|
-
|
|
182
|
-
export { DEFAULT_ELDRA_API_BASE_URL, ELDRA_IMAGE_VARIANT_WIDTHS, EldraHttpError, analyticsTrackerScript, createCartSession, createEldraClient, createOrderAccessTokens, getEldraClient, imageSrcset, imageUrl, imageVariantFor, initEldraClient, isEldraImage, responsiveImage };
|
|
132
|
+
export { DEFAULT_ELDRA_API_BASE_URL, ELDRA_IMAGE_VARIANT_WIDTHS, EldraHttpError, analyticsTrackerScript, captureCampaignAttribution, clearCampaignAttribution, createCartSession, createEldraClient, createOrderAccessTokens, getEldraClient, grantCampaignAttributionConsent, imageSrcset, imageUrl, imageVariantFor, initEldraClient, isEldraImage, readCampaignAttribution, responsiveImage, withdrawCampaignAttributionConsent };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../node_modules/.pnpm/@formatjs+fast-memoize@3.1.7/node_modules/@formatjs/fast-memoize/index.js
|
|
2
2
|
function memoize(fn, options) {
|
|
3
3
|
const cache = options && options.cache ? options.cache : cacheDefault;
|
|
4
4
|
const serializer = options && options.serializer ? options.serializer : serializerDefault;
|
|
@@ -53,8 +53,7 @@ var ObjectWithoutPrototypeCache = class {
|
|
|
53
53
|
const cacheDefault = { create: function create() {
|
|
54
54
|
return new ObjectWithoutPrototypeCache();
|
|
55
55
|
} };
|
|
56
|
-
|
|
57
|
-
//#region ../../node_modules/.pnpm/@formatjs+intl-localematcher@0.9.0/node_modules/@formatjs/intl-localematcher/index.js
|
|
56
|
+
// ../../node_modules/.pnpm/@formatjs+intl-localematcher@0.9.0/node_modules/@formatjs/intl-localematcher/index.js
|
|
58
57
|
const data = { supplemental: { languageMatching: { "written-new": [
|
|
59
58
|
{ paradigmLocales: { _locales: "en en_GB es es_419 pt_BR pt_PT" } },
|
|
60
59
|
{ $enUS: { _value: "AS+CA+GU+MH+MP+PH+PR+UM+US+VI" } },
|
|
@@ -3985,8 +3984,7 @@ function LookupSupportedLocales(availableLocales, requestedLocales) {
|
|
|
3985
3984
|
}
|
|
3986
3985
|
return subset;
|
|
3987
3986
|
}
|
|
3988
|
-
|
|
3989
|
-
//#region src/format/locale.ts
|
|
3987
|
+
// src/format/locale.ts
|
|
3990
3988
|
const BUNDLED = /* @__PURE__ */ new Set([
|
|
3991
3989
|
"is",
|
|
3992
3990
|
"is-IS",
|
|
@@ -4007,5 +4005,4 @@ function cached(cache, locale, options, create) {
|
|
|
4007
4005
|
}
|
|
4008
4006
|
return value;
|
|
4009
4007
|
}
|
|
4010
|
-
//#endregion
|
|
4011
4008
|
export { ResolveLocale as i, usesBundledData as n, LookupSupportedLocales as r, cached as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as ResolveLocale, n as usesBundledData, r as LookupSupportedLocales, t as cached } from "./locale-
|
|
2
|
-
|
|
1
|
+
import { i as ResolveLocale, n as usesBundledData, r as LookupSupportedLocales, t as cached } from "./locale-vZLrJAy8.js";
|
|
2
|
+
// ../../node_modules/.pnpm/@formatjs+bigdecimal@0.2.7/node_modules/@formatjs/bigdecimal/index.js
|
|
3
3
|
const DIV_PRECISION = 40;
|
|
4
4
|
function removeTrailingZeros(mantissa, exponent) {
|
|
5
5
|
if (mantissa === 0n) return [0n, 0];
|
|
@@ -456,8 +456,7 @@ var BigDecimal = class BigDecimal {
|
|
|
456
456
|
return BigDecimal._create(0n, 0, 1, false);
|
|
457
457
|
}
|
|
458
458
|
};
|
|
459
|
-
|
|
460
|
-
//#region ../../node_modules/.pnpm/@formatjs+intl-numberformat@9.4.3/node_modules/@formatjs/intl-numberformat/index.js
|
|
459
|
+
// ../../node_modules/.pnpm/@formatjs+intl-numberformat@9.4.3/node_modules/@formatjs/intl-numberformat/index.js
|
|
461
460
|
const defaultContent = {
|
|
462
461
|
"aa": ["aa-ET"],
|
|
463
462
|
"ab": ["ab-GE"],
|
|
@@ -3463,8 +3462,7 @@ try {
|
|
|
3463
3462
|
value: NumberFormat.prototype
|
|
3464
3463
|
});
|
|
3465
3464
|
} catch {}
|
|
3466
|
-
|
|
3467
|
-
//#region src/format/data/number-en.json
|
|
3465
|
+
// src/format/data/number-en.json
|
|
3468
3466
|
var number_en_default = {
|
|
3469
3467
|
data: {
|
|
3470
3468
|
"currencies": {
|
|
@@ -6846,8 +6844,7 @@ var number_en_default = {
|
|
|
6846
6844
|
},
|
|
6847
6845
|
locale: "en"
|
|
6848
6846
|
};
|
|
6849
|
-
|
|
6850
|
-
//#region src/format/data/number-is.json
|
|
6847
|
+
// src/format/data/number-is.json
|
|
6851
6848
|
var number_is_default = {
|
|
6852
6849
|
data: {
|
|
6853
6850
|
"currencies": {
|
|
@@ -9547,8 +9544,7 @@ var number_is_default = {
|
|
|
9547
9544
|
},
|
|
9548
9545
|
locale: "is"
|
|
9549
9546
|
};
|
|
9550
|
-
|
|
9551
|
-
//#region src/format/number.ts
|
|
9547
|
+
// src/format/number.ts
|
|
9552
9548
|
const RuntimeNumberFormat = Intl.NumberFormat;
|
|
9553
9549
|
let loaded = false;
|
|
9554
9550
|
const formats = /* @__PURE__ */ new Map();
|
|
@@ -9581,5 +9577,4 @@ function formatPrice(amount, currency, locale) {
|
|
|
9581
9577
|
currency
|
|
9582
9578
|
}).format(amount);
|
|
9583
9579
|
}
|
|
9584
|
-
//#endregion
|
|
9585
9580
|
export { BigDecimal as i, numberFormat as n, withOurNumberFormat as r, formatPrice as t };
|