@warp-ds/elements 2.2.0-next.3 → 2.2.0-next.30
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/README.md +217 -28
- package/dist/.storybook/utilities.d.ts +28 -0
- package/dist/.storybook/utilities.js +52 -0
- package/dist/api.js +1 -49
- package/dist/api.js.map +4 -4
- package/dist/custom-elements.json +3059 -0
- package/dist/index.d.ts +942 -18
- package/dist/packages/affix/affix.react.stories.d.ts +9 -0
- package/dist/packages/affix/affix.react.stories.js +10 -0
- package/dist/packages/affix/affix.stories.d.ts +10 -0
- package/dist/packages/affix/affix.stories.js +25 -0
- package/dist/packages/affix/affix.test.d.ts +1 -0
- package/dist/packages/affix/affix.test.js +9 -0
- package/dist/packages/affix/index.d.ts +47 -24
- package/dist/packages/affix/index.js +2448 -2240
- package/dist/packages/affix/index.js.map +4 -4
- package/dist/packages/affix/react.d.ts +2 -0
- package/dist/packages/affix/react.js +15 -0
- package/dist/packages/affix/styles.d.ts +1 -0
- package/dist/packages/affix/styles.js +2 -0
- package/dist/packages/alert/alert.react.stories.d.ts +13 -0
- package/dist/packages/alert/alert.react.stories.js +44 -0
- package/dist/packages/alert/alert.stories.d.ts +15 -0
- package/dist/packages/alert/alert.stories.js +68 -0
- package/dist/packages/alert/alert.test.d.ts +1 -0
- package/dist/packages/alert/alert.test.js +18 -0
- package/dist/packages/alert/index.d.ts +23 -17
- package/dist/packages/alert/index.js +2452 -2446
- package/dist/packages/alert/index.js.map +4 -4
- package/dist/packages/alert/react.d.ts +2 -0
- package/dist/packages/alert/react.js +11 -0
- package/dist/packages/alert/styles.d.ts +1 -0
- package/dist/packages/alert/styles.js +2 -0
- package/dist/packages/attention/attention.react.stories.d.ts +15 -0
- package/dist/packages/attention/attention.react.stories.js +92 -0
- package/dist/packages/attention/attention.stories.d.ts +16 -0
- package/dist/packages/attention/attention.stories.js +180 -0
- package/dist/packages/attention/attention.test.d.ts +1 -0
- package/dist/packages/attention/attention.test.js +11 -0
- package/dist/packages/attention/index.d.ts +61 -89
- package/dist/packages/attention/index.js +3530 -3924
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/attention/layout-styles.d.ts +1 -0
- package/dist/packages/attention/layout-styles.js +905 -0
- package/dist/packages/attention/locales/da/messages.mjs +1 -0
- package/dist/packages/attention/locales/en/messages.mjs +1 -0
- package/dist/packages/attention/locales/fi/messages.mjs +1 -0
- package/dist/packages/attention/locales/nb/messages.mjs +1 -0
- package/dist/packages/attention/locales/sv/messages.mjs +1 -0
- package/dist/packages/attention/react.d.ts +15 -0
- package/dist/packages/attention/react.js +17 -0
- package/dist/packages/attention/styles.d.ts +1 -0
- package/dist/packages/attention/styles.js +2 -0
- package/dist/packages/badge/badge.react.stories.d.ts +18 -0
- package/dist/packages/badge/badge.react.stories.js +60 -0
- package/dist/packages/badge/badge.stories.d.ts +17 -0
- package/dist/packages/badge/badge.stories.js +68 -0
- package/dist/packages/badge/badge.test.d.ts +1 -0
- package/dist/packages/badge/badge.test.js +9 -0
- package/dist/packages/badge/index.d.ts +12 -12
- package/dist/packages/badge/index.js +2441 -300
- package/dist/packages/badge/index.js.map +4 -4
- package/dist/packages/badge/react.d.ts +2 -0
- package/dist/packages/badge/react.js +11 -0
- package/dist/packages/badge/styles.d.ts +1 -0
- package/dist/packages/badge/styles.js +2 -0
- package/dist/packages/box/box.react.stories.d.ts +15 -0
- package/dist/packages/box/box.react.stories.js +45 -0
- package/dist/packages/box/box.stories.d.ts +14 -0
- package/dist/packages/box/box.stories.js +59 -0
- package/dist/packages/box/box.test.d.ts +1 -0
- package/dist/packages/box/box.test.js +9 -0
- package/dist/packages/box/index.d.ts +16 -21
- package/dist/packages/box/index.js +2443 -299
- package/dist/packages/box/index.js.map +4 -4
- package/dist/packages/box/react.d.ts +2 -0
- package/dist/packages/box/react.js +11 -0
- package/dist/packages/box/slot.test.d.ts +1 -0
- package/dist/packages/box/slot.test.js +9 -0
- package/dist/packages/box/styles.d.ts +1 -0
- package/dist/packages/box/styles.js +2 -0
- package/dist/packages/breadcrumbs/breadcrumbs.react.stories.d.ts +13 -0
- package/dist/packages/breadcrumbs/breadcrumbs.react.stories.js +40 -0
- package/dist/packages/breadcrumbs/breadcrumbs.stories.d.ts +12 -0
- package/dist/packages/breadcrumbs/breadcrumbs.stories.js +60 -0
- package/dist/packages/breadcrumbs/breadcrumbs.test.d.ts +1 -0
- package/dist/packages/breadcrumbs/breadcrumbs.test.js +16 -0
- package/dist/packages/breadcrumbs/index.d.ts +19 -16
- package/dist/packages/breadcrumbs/index.js +2402 -2051
- package/dist/packages/breadcrumbs/index.js.map +4 -4
- package/dist/packages/breadcrumbs/locales/da/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/locales/en/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/locales/fi/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/locales/nb/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/locales/sv/messages.mjs +1 -0
- package/dist/packages/breadcrumbs/react.d.ts +2 -0
- package/dist/packages/breadcrumbs/react.js +11 -0
- package/dist/packages/breadcrumbs/styles.d.ts +1 -0
- package/dist/packages/breadcrumbs/styles.js +2 -0
- package/dist/packages/button/button.react.stories.d.ts +22 -0
- package/dist/packages/button/button.react.stories.js +102 -0
- package/dist/packages/button/button.stories.d.ts +25 -0
- package/dist/packages/button/button.stories.js +151 -0
- package/dist/packages/button/button.test.d.ts +1 -1
- package/dist/packages/button/button.test.js +25 -0
- package/dist/packages/button/index.d.ts +83 -9
- package/dist/packages/button/index.js +2614 -2422
- package/dist/packages/button/index.js.map +4 -4
- package/dist/packages/button/locales/da/messages.mjs +1 -0
- package/dist/packages/button/locales/en/messages.mjs +1 -0
- package/dist/packages/button/locales/fi/messages.mjs +1 -0
- package/dist/packages/button/locales/nb/messages.mjs +1 -0
- package/dist/packages/button/locales/sv/messages.mjs +1 -0
- package/dist/packages/button/react.d.ts +2 -0
- package/dist/packages/button/react.js +11 -0
- package/dist/packages/button/styles.d.ts +1 -0
- package/dist/packages/button/styles.js +2 -0
- package/dist/packages/card/card.react.stories.d.ts +16 -0
- package/dist/packages/card/card.react.stories.js +63 -0
- package/dist/packages/card/card.stories.d.ts +15 -0
- package/dist/packages/card/card.stories.js +82 -0
- package/dist/packages/card/card.test.d.ts +1 -0
- package/dist/packages/card/card.test.js +9 -0
- package/dist/packages/card/index.d.ts +27 -16
- package/dist/packages/card/index.js +2403 -2067
- package/dist/packages/card/index.js.map +4 -4
- package/dist/packages/card/locales/da/messages.mjs +1 -0
- package/dist/packages/card/locales/en/messages.mjs +1 -0
- package/dist/packages/card/locales/fi/messages.mjs +1 -0
- package/dist/packages/card/locales/nb/messages.mjs +1 -0
- package/dist/packages/card/locales/sv/messages.mjs +1 -0
- package/dist/packages/card/react.d.ts +2 -0
- package/dist/packages/card/react.js +11 -0
- package/dist/packages/card/styles.d.ts +1 -0
- package/dist/packages/card/styles.js +2 -0
- package/dist/packages/expandable/expandable.react.stories.d.ts +18 -0
- package/dist/packages/expandable/expandable.react.stories.js +103 -0
- package/dist/packages/expandable/expandable.stories.d.ts +19 -0
- package/dist/packages/expandable/expandable.stories.js +132 -0
- package/dist/packages/expandable/expandable.test.d.ts +1 -0
- package/dist/packages/expandable/expandable.test.js +24 -0
- package/dist/packages/expandable/index.d.ts +52 -50
- package/dist/packages/expandable/index.js +2424 -2286
- package/dist/packages/expandable/index.js.map +4 -4
- package/dist/packages/expandable/react.d.ts +2 -0
- package/dist/packages/expandable/react.js +11 -0
- package/dist/packages/expandable/styles.d.ts +1 -0
- package/dist/packages/expandable/styles.js +2 -0
- package/dist/packages/i18n.js +45 -0
- package/dist/packages/link/index.d.ts +34 -0
- package/dist/packages/link/index.js +99 -0
- package/dist/packages/link/styles.d.ts +1 -0
- package/dist/packages/link/styles.js +200 -0
- package/dist/packages/modal/index.d.ts +5 -6
- package/dist/packages/modal/index.js +5 -2611
- package/dist/packages/modal/locales/da/messages.mjs +1 -0
- package/dist/packages/modal/locales/en/messages.mjs +1 -0
- package/dist/packages/modal/locales/fi/messages.mjs +1 -0
- package/dist/packages/modal/locales/nb/messages.mjs +1 -0
- package/dist/packages/modal/locales/sv/messages.mjs +1 -0
- package/dist/packages/modal/modal-footer.d.ts +12 -10
- package/dist/packages/modal/modal-footer.js +2460 -0
- package/dist/packages/modal/modal-footer.js.map +7 -0
- package/dist/packages/modal/modal-header.d.ts +15 -13
- package/dist/packages/modal/modal-header.js +2567 -0
- package/dist/packages/modal/modal-header.js.map +7 -0
- package/dist/packages/modal/modal-main.d.ts +14 -8
- package/dist/packages/modal/modal-main.js +2572 -0
- package/dist/packages/modal/modal-main.js.map +7 -0
- package/dist/packages/modal/modal.react.stories.d.ts +14 -0
- package/dist/packages/modal/modal.react.stories.js +27 -0
- package/dist/packages/modal/modal.stories.d.ts +19 -0
- package/dist/packages/modal/modal.stories.js +254 -0
- package/dist/packages/modal/react.d.ts +12 -0
- package/dist/packages/modal/react.js +31 -0
- package/dist/packages/modal/util.d.ts +7 -17
- package/dist/packages/modal/util.js +21 -0
- package/dist/packages/pill/index.d.ts +39 -23
- package/dist/packages/pill/index.js +2408 -2175
- package/dist/packages/pill/index.js.map +4 -4
- package/dist/packages/pill/locales/da/messages.mjs +1 -0
- package/dist/packages/pill/locales/en/messages.mjs +1 -0
- package/dist/packages/pill/locales/fi/messages.mjs +1 -0
- package/dist/packages/pill/locales/nb/messages.mjs +1 -0
- package/dist/packages/pill/locales/sv/messages.mjs +1 -0
- package/dist/packages/pill/pill.react.stories.d.ts +23 -0
- package/dist/packages/pill/pill.react.stories.js +22 -0
- package/dist/packages/pill/pill.stories.d.ts +12 -0
- package/dist/packages/pill/pill.stories.js +33 -0
- package/dist/packages/pill/pill.test.d.ts +1 -0
- package/dist/packages/pill/pill.test.js +25 -0
- package/dist/packages/pill/react.d.ts +7 -0
- package/dist/packages/pill/react.js +17 -0
- package/dist/packages/pill/styles.d.ts +1 -0
- package/dist/packages/pill/styles.js +2 -0
- package/dist/packages/select/index.d.ts +56 -60
- package/dist/packages/select/index.js +2428 -2533
- package/dist/packages/select/index.js.map +4 -4
- package/dist/packages/select/locales/da/messages.mjs +1 -0
- package/dist/packages/select/locales/en/messages.mjs +1 -0
- package/dist/packages/select/locales/fi/messages.mjs +1 -0
- package/dist/packages/select/locales/nb/messages.mjs +1 -0
- package/dist/packages/select/locales/sv/messages.mjs +1 -0
- package/dist/packages/select/react.d.ts +6 -0
- package/dist/packages/select/react.js +20 -0
- package/dist/packages/select/select.react.stories.d.ts +18 -0
- package/dist/packages/select/select.react.stories.js +28 -0
- package/dist/packages/select/select.stories.d.ts +17 -0
- package/dist/packages/select/select.stories.js +100 -0
- package/dist/packages/select/select.test.d.ts +1 -0
- package/dist/packages/select/select.test.js +31 -0
- package/dist/packages/select/styles.d.ts +1 -0
- package/dist/packages/select/styles.js +2 -0
- package/dist/packages/styles.js +2442 -0
- package/dist/packages/textfield/index.d.ts +78 -74
- package/dist/packages/textfield/index.js +2522 -707
- package/dist/packages/textfield/index.js.map +4 -4
- package/dist/packages/textfield/react.d.ts +11 -0
- package/dist/packages/textfield/react.js +21 -0
- package/dist/packages/textfield/styles/w-textfield.styles.d.ts +1 -0
- package/dist/packages/textfield/styles/w-textfield.styles.js +55 -0
- package/dist/packages/textfield/styles.d.ts +1 -0
- package/dist/packages/textfield/styles.js +2 -0
- package/dist/packages/textfield/textfield.react.stories.d.ts +37 -0
- package/dist/packages/textfield/textfield.react.stories.js +88 -0
- package/dist/packages/textfield/textfield.stories.d.ts +18 -0
- package/dist/packages/textfield/textfield.stories.js +105 -0
- package/dist/packages/textfield/textfield.test.d.ts +2 -0
- package/dist/packages/textfield/textfield.test.js +68 -0
- package/dist/packages/toast/api.d.ts +4 -45
- package/dist/packages/toast/api.js +41 -0
- package/dist/packages/toast/index.d.ts +3 -3
- package/dist/packages/toast/index.js +3 -2804
- package/dist/packages/toast/locales/da/messages.mjs +1 -0
- package/dist/packages/toast/locales/en/messages.mjs +1 -0
- package/dist/packages/toast/locales/fi/messages.mjs +1 -0
- package/dist/packages/toast/locales/nb/messages.mjs +1 -0
- package/dist/packages/toast/locales/sv/messages.mjs +1 -0
- package/dist/packages/toast/styles.d.ts +1 -0
- package/dist/packages/toast/styles.js +2 -0
- package/dist/packages/toast/toast-container.d.ts +13 -63
- package/dist/packages/toast/toast-container.js +2458 -0
- package/dist/packages/toast/toast-container.js.map +7 -0
- package/dist/packages/toast/toast.d.ts +36 -29
- package/dist/packages/toast/toast.js +2466 -0
- package/dist/packages/toast/toast.js.map +7 -0
- package/dist/packages/toast/toast.stories.d.ts +12 -0
- package/dist/packages/toast/toast.stories.js +50 -0
- package/dist/packages/toast/types.d.ts +15 -0
- package/dist/packages/toast/types.js +1 -0
- package/dist/packages/utils/expand-transition.d.ts +3 -3
- package/dist/packages/utils/expand-transition.js +59 -0
- package/dist/packages/utils/index.d.ts +1 -1
- package/dist/packages/utils/index.js +37 -0
- package/dist/packages/utils/unstyled-heading.d.ts +3 -4
- package/dist/packages/utils/unstyled-heading.js +22 -0
- package/dist/packages/utils/window-exists.js +1 -0
- package/dist/setup-tests.d.ts +1 -0
- package/dist/setup-tests.js +1 -0
- package/dist/vscode.css-custom-data.json +6 -0
- package/dist/vscode.html-custom-data.json +296 -0
- package/dist/web-types.json +661 -0
- package/package.json +89 -36
- package/dist/index.js +0 -9820
- package/dist/index.js.map +0 -7
- package/dist/packages/modal/index.js.map +0 -7
- package/dist/packages/toast/index.js.map +0 -7
|
@@ -1,2611 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a2, b2) => {
|
|
13
|
-
for (var prop in b2 || (b2 = {}))
|
|
14
|
-
if (__hasOwnProp.call(b2, prop))
|
|
15
|
-
__defNormalProp(a2, prop, b2[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b2)) {
|
|
18
|
-
if (__propIsEnum.call(b2, prop))
|
|
19
|
-
__defNormalProp(a2, prop, b2[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a2;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
|
|
24
|
-
var __objRest = (source, exclude) => {
|
|
25
|
-
var target = {};
|
|
26
|
-
for (var prop in source)
|
|
27
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
if (source != null && __getOwnPropSymbols)
|
|
30
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
-
target[prop] = source[prop];
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
};
|
|
36
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
37
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
38
|
-
};
|
|
39
|
-
var __copyProps = (to, from, except, desc) => {
|
|
40
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
-
for (let key of __getOwnPropNames(from))
|
|
42
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
-
}
|
|
45
|
-
return to;
|
|
46
|
-
};
|
|
47
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
48
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
49
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
50
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
51
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
52
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
53
|
-
mod
|
|
54
|
-
));
|
|
55
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
56
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
57
|
-
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
58
|
-
if (decorator = decorators[i2])
|
|
59
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
60
|
-
if (kind && result) __defProp(target, key, result);
|
|
61
|
-
return result;
|
|
62
|
-
};
|
|
63
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
64
|
-
|
|
65
|
-
// node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/errors.js
|
|
66
|
-
var require_errors = __commonJS({
|
|
67
|
-
"node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/errors.js"(exports) {
|
|
68
|
-
"use strict";
|
|
69
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
|
-
exports.errorMessages = exports.ErrorType = void 0;
|
|
71
|
-
var ErrorType;
|
|
72
|
-
(function(ErrorType2) {
|
|
73
|
-
ErrorType2["MalformedUnicode"] = "MALFORMED_UNICODE";
|
|
74
|
-
ErrorType2["MalformedHexadecimal"] = "MALFORMED_HEXADECIMAL";
|
|
75
|
-
ErrorType2["CodePointLimit"] = "CODE_POINT_LIMIT";
|
|
76
|
-
ErrorType2["OctalDeprecation"] = "OCTAL_DEPRECATION";
|
|
77
|
-
ErrorType2["EndOfString"] = "END_OF_STRING";
|
|
78
|
-
})(ErrorType = exports.ErrorType || (exports.ErrorType = {}));
|
|
79
|
-
exports.errorMessages = /* @__PURE__ */ new Map([
|
|
80
|
-
[ErrorType.MalformedUnicode, "malformed Unicode character escape sequence"],
|
|
81
|
-
[
|
|
82
|
-
ErrorType.MalformedHexadecimal,
|
|
83
|
-
"malformed hexadecimal character escape sequence"
|
|
84
|
-
],
|
|
85
|
-
[
|
|
86
|
-
ErrorType.CodePointLimit,
|
|
87
|
-
"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"
|
|
88
|
-
],
|
|
89
|
-
[
|
|
90
|
-
ErrorType.OctalDeprecation,
|
|
91
|
-
'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'
|
|
92
|
-
],
|
|
93
|
-
[ErrorType.EndOfString, "malformed escape sequence at end of string"]
|
|
94
|
-
]);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/index.js
|
|
99
|
-
var require_dist = __commonJS({
|
|
100
|
-
"node_modules/.pnpm/unraw@3.0.0/node_modules/unraw/dist/index.js"(exports) {
|
|
101
|
-
"use strict";
|
|
102
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
103
|
-
exports.unraw = exports.errorMessages = exports.ErrorType = void 0;
|
|
104
|
-
var errors_1 = require_errors();
|
|
105
|
-
Object.defineProperty(exports, "ErrorType", { enumerable: true, get: function() {
|
|
106
|
-
return errors_1.ErrorType;
|
|
107
|
-
} });
|
|
108
|
-
Object.defineProperty(exports, "errorMessages", { enumerable: true, get: function() {
|
|
109
|
-
return errors_1.errorMessages;
|
|
110
|
-
} });
|
|
111
|
-
function parseHexToInt(hex) {
|
|
112
|
-
const isOnlyHexChars = !hex.match(/[^a-f0-9]/i);
|
|
113
|
-
return isOnlyHexChars ? parseInt(hex, 16) : NaN;
|
|
114
|
-
}
|
|
115
|
-
function validateAndParseHex(hex, errorName, enforcedLength) {
|
|
116
|
-
const parsedHex = parseHexToInt(hex);
|
|
117
|
-
if (Number.isNaN(parsedHex) || enforcedLength !== void 0 && enforcedLength !== hex.length) {
|
|
118
|
-
throw new SyntaxError(errors_1.errorMessages.get(errorName));
|
|
119
|
-
}
|
|
120
|
-
return parsedHex;
|
|
121
|
-
}
|
|
122
|
-
function parseHexadecimalCode(code) {
|
|
123
|
-
const parsedCode = validateAndParseHex(code, errors_1.ErrorType.MalformedHexadecimal, 2);
|
|
124
|
-
return String.fromCharCode(parsedCode);
|
|
125
|
-
}
|
|
126
|
-
function parseUnicodeCode(code, surrogateCode) {
|
|
127
|
-
const parsedCode = validateAndParseHex(code, errors_1.ErrorType.MalformedUnicode, 4);
|
|
128
|
-
if (surrogateCode !== void 0) {
|
|
129
|
-
const parsedSurrogateCode = validateAndParseHex(surrogateCode, errors_1.ErrorType.MalformedUnicode, 4);
|
|
130
|
-
return String.fromCharCode(parsedCode, parsedSurrogateCode);
|
|
131
|
-
}
|
|
132
|
-
return String.fromCharCode(parsedCode);
|
|
133
|
-
}
|
|
134
|
-
function isCurlyBraced(text) {
|
|
135
|
-
return text.charAt(0) === "{" && text.charAt(text.length - 1) === "}";
|
|
136
|
-
}
|
|
137
|
-
function parseUnicodeCodePointCode(codePoint) {
|
|
138
|
-
if (!isCurlyBraced(codePoint)) {
|
|
139
|
-
throw new SyntaxError(errors_1.errorMessages.get(errors_1.ErrorType.MalformedUnicode));
|
|
140
|
-
}
|
|
141
|
-
const withoutBraces = codePoint.slice(1, -1);
|
|
142
|
-
const parsedCode = validateAndParseHex(withoutBraces, errors_1.ErrorType.MalformedUnicode);
|
|
143
|
-
try {
|
|
144
|
-
return String.fromCodePoint(parsedCode);
|
|
145
|
-
} catch (err) {
|
|
146
|
-
throw err instanceof RangeError ? new SyntaxError(errors_1.errorMessages.get(errors_1.ErrorType.CodePointLimit)) : err;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function parseOctalCode(code, error = false) {
|
|
150
|
-
if (error) {
|
|
151
|
-
throw new SyntaxError(errors_1.errorMessages.get(errors_1.ErrorType.OctalDeprecation));
|
|
152
|
-
}
|
|
153
|
-
const parsedCode = parseInt(code, 8);
|
|
154
|
-
return String.fromCharCode(parsedCode);
|
|
155
|
-
}
|
|
156
|
-
var singleCharacterEscapes = /* @__PURE__ */ new Map([
|
|
157
|
-
["b", "\b"],
|
|
158
|
-
["f", "\f"],
|
|
159
|
-
["n", "\n"],
|
|
160
|
-
["r", "\r"],
|
|
161
|
-
["t", " "],
|
|
162
|
-
["v", "\v"],
|
|
163
|
-
["0", "\0"]
|
|
164
|
-
]);
|
|
165
|
-
function parseSingleCharacterCode(code) {
|
|
166
|
-
return singleCharacterEscapes.get(code) || code;
|
|
167
|
-
}
|
|
168
|
-
var escapeMatch = /\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;
|
|
169
|
-
function unraw2(raw, allowOctals = false) {
|
|
170
|
-
return raw.replace(escapeMatch, function(_, backslash, hex, codePoint, unicodeWithSurrogate, surrogate, unicode, octal, singleCharacter) {
|
|
171
|
-
if (backslash !== void 0) {
|
|
172
|
-
return "\\";
|
|
173
|
-
}
|
|
174
|
-
if (hex !== void 0) {
|
|
175
|
-
return parseHexadecimalCode(hex);
|
|
176
|
-
}
|
|
177
|
-
if (codePoint !== void 0) {
|
|
178
|
-
return parseUnicodeCodePointCode(codePoint);
|
|
179
|
-
}
|
|
180
|
-
if (unicodeWithSurrogate !== void 0) {
|
|
181
|
-
return parseUnicodeCode(unicodeWithSurrogate, surrogate);
|
|
182
|
-
}
|
|
183
|
-
if (unicode !== void 0) {
|
|
184
|
-
return parseUnicodeCode(unicode);
|
|
185
|
-
}
|
|
186
|
-
if (octal === "0") {
|
|
187
|
-
return "\0";
|
|
188
|
-
}
|
|
189
|
-
if (octal !== void 0) {
|
|
190
|
-
return parseOctalCode(octal, !allowOctals);
|
|
191
|
-
}
|
|
192
|
-
if (singleCharacter !== void 0) {
|
|
193
|
-
return parseSingleCharacterCode(singleCharacter);
|
|
194
|
-
}
|
|
195
|
-
throw new SyntaxError(errors_1.errorMessages.get(errors_1.ErrorType.EndOfString));
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
exports.unraw = unraw2;
|
|
199
|
-
exports.default = unraw2;
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
// node_modules/.pnpm/moo@0.5.2/node_modules/moo/moo.js
|
|
204
|
-
var require_moo = __commonJS({
|
|
205
|
-
"node_modules/.pnpm/moo@0.5.2/node_modules/moo/moo.js"(exports, module) {
|
|
206
|
-
(function(root, factory) {
|
|
207
|
-
if (typeof define === "function" && define.amd) {
|
|
208
|
-
define([], factory);
|
|
209
|
-
} else if (typeof module === "object" && module.exports) {
|
|
210
|
-
module.exports = factory();
|
|
211
|
-
} else {
|
|
212
|
-
root.moo = factory();
|
|
213
|
-
}
|
|
214
|
-
})(exports, function() {
|
|
215
|
-
"use strict";
|
|
216
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
217
|
-
var toString = Object.prototype.toString;
|
|
218
|
-
var hasSticky = typeof new RegExp().sticky === "boolean";
|
|
219
|
-
function isRegExp(o) {
|
|
220
|
-
return o && toString.call(o) === "[object RegExp]";
|
|
221
|
-
}
|
|
222
|
-
function isObject(o) {
|
|
223
|
-
return o && typeof o === "object" && !isRegExp(o) && !Array.isArray(o);
|
|
224
|
-
}
|
|
225
|
-
function reEscape(s) {
|
|
226
|
-
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
227
|
-
}
|
|
228
|
-
function reGroups(s) {
|
|
229
|
-
var re = new RegExp("|" + s);
|
|
230
|
-
return re.exec("").length - 1;
|
|
231
|
-
}
|
|
232
|
-
function reCapture(s) {
|
|
233
|
-
return "(" + s + ")";
|
|
234
|
-
}
|
|
235
|
-
function reUnion(regexps) {
|
|
236
|
-
if (!regexps.length) return "(?!)";
|
|
237
|
-
var source = regexps.map(function(s) {
|
|
238
|
-
return "(?:" + s + ")";
|
|
239
|
-
}).join("|");
|
|
240
|
-
return "(?:" + source + ")";
|
|
241
|
-
}
|
|
242
|
-
function regexpOrLiteral(obj) {
|
|
243
|
-
if (typeof obj === "string") {
|
|
244
|
-
return "(?:" + reEscape(obj) + ")";
|
|
245
|
-
} else if (isRegExp(obj)) {
|
|
246
|
-
if (obj.ignoreCase) throw new Error("RegExp /i flag not allowed");
|
|
247
|
-
if (obj.global) throw new Error("RegExp /g flag is implied");
|
|
248
|
-
if (obj.sticky) throw new Error("RegExp /y flag is implied");
|
|
249
|
-
if (obj.multiline) throw new Error("RegExp /m flag is implied");
|
|
250
|
-
return obj.source;
|
|
251
|
-
} else {
|
|
252
|
-
throw new Error("Not a pattern: " + obj);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
function pad(s, length) {
|
|
256
|
-
if (s.length > length) {
|
|
257
|
-
return s;
|
|
258
|
-
}
|
|
259
|
-
return Array(length - s.length + 1).join(" ") + s;
|
|
260
|
-
}
|
|
261
|
-
function lastNLines(string, numLines) {
|
|
262
|
-
var position = string.length;
|
|
263
|
-
var lineBreaks = 0;
|
|
264
|
-
while (true) {
|
|
265
|
-
var idx = string.lastIndexOf("\n", position - 1);
|
|
266
|
-
if (idx === -1) {
|
|
267
|
-
break;
|
|
268
|
-
} else {
|
|
269
|
-
lineBreaks++;
|
|
270
|
-
}
|
|
271
|
-
position = idx;
|
|
272
|
-
if (lineBreaks === numLines) {
|
|
273
|
-
break;
|
|
274
|
-
}
|
|
275
|
-
if (position === 0) {
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
var startPosition = lineBreaks < numLines ? 0 : position + 1;
|
|
280
|
-
return string.substring(startPosition).split("\n");
|
|
281
|
-
}
|
|
282
|
-
function objectToRules(object) {
|
|
283
|
-
var keys = Object.getOwnPropertyNames(object);
|
|
284
|
-
var result = [];
|
|
285
|
-
for (var i2 = 0; i2 < keys.length; i2++) {
|
|
286
|
-
var key = keys[i2];
|
|
287
|
-
var thing = object[key];
|
|
288
|
-
var rules = [].concat(thing);
|
|
289
|
-
if (key === "include") {
|
|
290
|
-
for (var j = 0; j < rules.length; j++) {
|
|
291
|
-
result.push({ include: rules[j] });
|
|
292
|
-
}
|
|
293
|
-
continue;
|
|
294
|
-
}
|
|
295
|
-
var match = [];
|
|
296
|
-
rules.forEach(function(rule) {
|
|
297
|
-
if (isObject(rule)) {
|
|
298
|
-
if (match.length) result.push(ruleOptions(key, match));
|
|
299
|
-
result.push(ruleOptions(key, rule));
|
|
300
|
-
match = [];
|
|
301
|
-
} else {
|
|
302
|
-
match.push(rule);
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
if (match.length) result.push(ruleOptions(key, match));
|
|
306
|
-
}
|
|
307
|
-
return result;
|
|
308
|
-
}
|
|
309
|
-
function arrayToRules(array) {
|
|
310
|
-
var result = [];
|
|
311
|
-
for (var i2 = 0; i2 < array.length; i2++) {
|
|
312
|
-
var obj = array[i2];
|
|
313
|
-
if (obj.include) {
|
|
314
|
-
var include = [].concat(obj.include);
|
|
315
|
-
for (var j = 0; j < include.length; j++) {
|
|
316
|
-
result.push({ include: include[j] });
|
|
317
|
-
}
|
|
318
|
-
continue;
|
|
319
|
-
}
|
|
320
|
-
if (!obj.type) {
|
|
321
|
-
throw new Error("Rule has no type: " + JSON.stringify(obj));
|
|
322
|
-
}
|
|
323
|
-
result.push(ruleOptions(obj.type, obj));
|
|
324
|
-
}
|
|
325
|
-
return result;
|
|
326
|
-
}
|
|
327
|
-
function ruleOptions(type, obj) {
|
|
328
|
-
if (!isObject(obj)) {
|
|
329
|
-
obj = { match: obj };
|
|
330
|
-
}
|
|
331
|
-
if (obj.include) {
|
|
332
|
-
throw new Error("Matching rules cannot also include states");
|
|
333
|
-
}
|
|
334
|
-
var options = {
|
|
335
|
-
defaultType: type,
|
|
336
|
-
lineBreaks: !!obj.error || !!obj.fallback,
|
|
337
|
-
pop: false,
|
|
338
|
-
next: null,
|
|
339
|
-
push: null,
|
|
340
|
-
error: false,
|
|
341
|
-
fallback: false,
|
|
342
|
-
value: null,
|
|
343
|
-
type: null,
|
|
344
|
-
shouldThrow: false
|
|
345
|
-
};
|
|
346
|
-
for (var key in obj) {
|
|
347
|
-
if (hasOwnProperty.call(obj, key)) {
|
|
348
|
-
options[key] = obj[key];
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
if (typeof options.type === "string" && type !== options.type) {
|
|
352
|
-
throw new Error("Type transform cannot be a string (type '" + options.type + "' for token '" + type + "')");
|
|
353
|
-
}
|
|
354
|
-
var match = options.match;
|
|
355
|
-
options.match = Array.isArray(match) ? match : match ? [match] : [];
|
|
356
|
-
options.match.sort(function(a2, b2) {
|
|
357
|
-
return isRegExp(a2) && isRegExp(b2) ? 0 : isRegExp(b2) ? -1 : isRegExp(a2) ? 1 : b2.length - a2.length;
|
|
358
|
-
});
|
|
359
|
-
return options;
|
|
360
|
-
}
|
|
361
|
-
function toRules(spec) {
|
|
362
|
-
return Array.isArray(spec) ? arrayToRules(spec) : objectToRules(spec);
|
|
363
|
-
}
|
|
364
|
-
var defaultErrorRule = ruleOptions("error", { lineBreaks: true, shouldThrow: true });
|
|
365
|
-
function compileRules(rules, hasStates) {
|
|
366
|
-
var errorRule = null;
|
|
367
|
-
var fast = /* @__PURE__ */ Object.create(null);
|
|
368
|
-
var fastAllowed = true;
|
|
369
|
-
var unicodeFlag = null;
|
|
370
|
-
var groups = [];
|
|
371
|
-
var parts = [];
|
|
372
|
-
for (var i2 = 0; i2 < rules.length; i2++) {
|
|
373
|
-
if (rules[i2].fallback) {
|
|
374
|
-
fastAllowed = false;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
for (var i2 = 0; i2 < rules.length; i2++) {
|
|
378
|
-
var options = rules[i2];
|
|
379
|
-
if (options.include) {
|
|
380
|
-
throw new Error("Inheritance is not allowed in stateless lexers");
|
|
381
|
-
}
|
|
382
|
-
if (options.error || options.fallback) {
|
|
383
|
-
if (errorRule) {
|
|
384
|
-
if (!options.fallback === !errorRule.fallback) {
|
|
385
|
-
throw new Error("Multiple " + (options.fallback ? "fallback" : "error") + " rules not allowed (for token '" + options.defaultType + "')");
|
|
386
|
-
} else {
|
|
387
|
-
throw new Error("fallback and error are mutually exclusive (for token '" + options.defaultType + "')");
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
errorRule = options;
|
|
391
|
-
}
|
|
392
|
-
var match = options.match.slice();
|
|
393
|
-
if (fastAllowed) {
|
|
394
|
-
while (match.length && typeof match[0] === "string" && match[0].length === 1) {
|
|
395
|
-
var word = match.shift();
|
|
396
|
-
fast[word.charCodeAt(0)] = options;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
if (options.pop || options.push || options.next) {
|
|
400
|
-
if (!hasStates) {
|
|
401
|
-
throw new Error("State-switching options are not allowed in stateless lexers (for token '" + options.defaultType + "')");
|
|
402
|
-
}
|
|
403
|
-
if (options.fallback) {
|
|
404
|
-
throw new Error("State-switching options are not allowed on fallback tokens (for token '" + options.defaultType + "')");
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
if (match.length === 0) {
|
|
408
|
-
continue;
|
|
409
|
-
}
|
|
410
|
-
fastAllowed = false;
|
|
411
|
-
groups.push(options);
|
|
412
|
-
for (var j = 0; j < match.length; j++) {
|
|
413
|
-
var obj = match[j];
|
|
414
|
-
if (!isRegExp(obj)) {
|
|
415
|
-
continue;
|
|
416
|
-
}
|
|
417
|
-
if (unicodeFlag === null) {
|
|
418
|
-
unicodeFlag = obj.unicode;
|
|
419
|
-
} else if (unicodeFlag !== obj.unicode && options.fallback === false) {
|
|
420
|
-
throw new Error("If one rule is /u then all must be");
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
var pat = reUnion(match.map(regexpOrLiteral));
|
|
424
|
-
var regexp = new RegExp(pat);
|
|
425
|
-
if (regexp.test("")) {
|
|
426
|
-
throw new Error("RegExp matches empty string: " + regexp);
|
|
427
|
-
}
|
|
428
|
-
var groupCount = reGroups(pat);
|
|
429
|
-
if (groupCount > 0) {
|
|
430
|
-
throw new Error("RegExp has capture groups: " + regexp + "\nUse (?: \u2026 ) instead");
|
|
431
|
-
}
|
|
432
|
-
if (!options.lineBreaks && regexp.test("\n")) {
|
|
433
|
-
throw new Error("Rule should declare lineBreaks: " + regexp);
|
|
434
|
-
}
|
|
435
|
-
parts.push(reCapture(pat));
|
|
436
|
-
}
|
|
437
|
-
var fallbackRule = errorRule && errorRule.fallback;
|
|
438
|
-
var flags = hasSticky && !fallbackRule ? "ym" : "gm";
|
|
439
|
-
var suffix = hasSticky || fallbackRule ? "" : "|";
|
|
440
|
-
if (unicodeFlag === true) flags += "u";
|
|
441
|
-
var combined = new RegExp(reUnion(parts) + suffix, flags);
|
|
442
|
-
return { regexp: combined, groups, fast, error: errorRule || defaultErrorRule };
|
|
443
|
-
}
|
|
444
|
-
function compile(rules) {
|
|
445
|
-
var result = compileRules(toRules(rules));
|
|
446
|
-
return new Lexer({ start: result }, "start");
|
|
447
|
-
}
|
|
448
|
-
function checkStateGroup(g2, name, map) {
|
|
449
|
-
var state2 = g2 && (g2.push || g2.next);
|
|
450
|
-
if (state2 && !map[state2]) {
|
|
451
|
-
throw new Error("Missing state '" + state2 + "' (in token '" + g2.defaultType + "' of state '" + name + "')");
|
|
452
|
-
}
|
|
453
|
-
if (g2 && g2.pop && +g2.pop !== 1) {
|
|
454
|
-
throw new Error("pop must be 1 (in token '" + g2.defaultType + "' of state '" + name + "')");
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
function compileStates(states, start) {
|
|
458
|
-
var all = states.$all ? toRules(states.$all) : [];
|
|
459
|
-
delete states.$all;
|
|
460
|
-
var keys = Object.getOwnPropertyNames(states);
|
|
461
|
-
if (!start) start = keys[0];
|
|
462
|
-
var ruleMap = /* @__PURE__ */ Object.create(null);
|
|
463
|
-
for (var i2 = 0; i2 < keys.length; i2++) {
|
|
464
|
-
var key = keys[i2];
|
|
465
|
-
ruleMap[key] = toRules(states[key]).concat(all);
|
|
466
|
-
}
|
|
467
|
-
for (var i2 = 0; i2 < keys.length; i2++) {
|
|
468
|
-
var key = keys[i2];
|
|
469
|
-
var rules = ruleMap[key];
|
|
470
|
-
var included = /* @__PURE__ */ Object.create(null);
|
|
471
|
-
for (var j = 0; j < rules.length; j++) {
|
|
472
|
-
var rule = rules[j];
|
|
473
|
-
if (!rule.include) continue;
|
|
474
|
-
var splice = [j, 1];
|
|
475
|
-
if (rule.include !== key && !included[rule.include]) {
|
|
476
|
-
included[rule.include] = true;
|
|
477
|
-
var newRules = ruleMap[rule.include];
|
|
478
|
-
if (!newRules) {
|
|
479
|
-
throw new Error("Cannot include nonexistent state '" + rule.include + "' (in state '" + key + "')");
|
|
480
|
-
}
|
|
481
|
-
for (var k = 0; k < newRules.length; k++) {
|
|
482
|
-
var newRule = newRules[k];
|
|
483
|
-
if (rules.indexOf(newRule) !== -1) continue;
|
|
484
|
-
splice.push(newRule);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
rules.splice.apply(rules, splice);
|
|
488
|
-
j--;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
var map = /* @__PURE__ */ Object.create(null);
|
|
492
|
-
for (var i2 = 0; i2 < keys.length; i2++) {
|
|
493
|
-
var key = keys[i2];
|
|
494
|
-
map[key] = compileRules(ruleMap[key], true);
|
|
495
|
-
}
|
|
496
|
-
for (var i2 = 0; i2 < keys.length; i2++) {
|
|
497
|
-
var name = keys[i2];
|
|
498
|
-
var state2 = map[name];
|
|
499
|
-
var groups = state2.groups;
|
|
500
|
-
for (var j = 0; j < groups.length; j++) {
|
|
501
|
-
checkStateGroup(groups[j], name, map);
|
|
502
|
-
}
|
|
503
|
-
var fastKeys = Object.getOwnPropertyNames(state2.fast);
|
|
504
|
-
for (var j = 0; j < fastKeys.length; j++) {
|
|
505
|
-
checkStateGroup(state2.fast[fastKeys[j]], name, map);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
return new Lexer(map, start);
|
|
509
|
-
}
|
|
510
|
-
function keywordTransform(map) {
|
|
511
|
-
var isMap = typeof Map !== "undefined";
|
|
512
|
-
var reverseMap = isMap ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
|
|
513
|
-
var types = Object.getOwnPropertyNames(map);
|
|
514
|
-
for (var i2 = 0; i2 < types.length; i2++) {
|
|
515
|
-
var tokenType = types[i2];
|
|
516
|
-
var item = map[tokenType];
|
|
517
|
-
var keywordList = Array.isArray(item) ? item : [item];
|
|
518
|
-
keywordList.forEach(function(keyword) {
|
|
519
|
-
if (typeof keyword !== "string") {
|
|
520
|
-
throw new Error("keyword must be string (in keyword '" + tokenType + "')");
|
|
521
|
-
}
|
|
522
|
-
if (isMap) {
|
|
523
|
-
reverseMap.set(keyword, tokenType);
|
|
524
|
-
} else {
|
|
525
|
-
reverseMap[keyword] = tokenType;
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
return function(k) {
|
|
530
|
-
return isMap ? reverseMap.get(k) : reverseMap[k];
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
var Lexer = function(states, state2) {
|
|
534
|
-
this.startState = state2;
|
|
535
|
-
this.states = states;
|
|
536
|
-
this.buffer = "";
|
|
537
|
-
this.stack = [];
|
|
538
|
-
this.reset();
|
|
539
|
-
};
|
|
540
|
-
Lexer.prototype.reset = function(data, info) {
|
|
541
|
-
this.buffer = data || "";
|
|
542
|
-
this.index = 0;
|
|
543
|
-
this.line = info ? info.line : 1;
|
|
544
|
-
this.col = info ? info.col : 1;
|
|
545
|
-
this.queuedToken = info ? info.queuedToken : null;
|
|
546
|
-
this.queuedText = info ? info.queuedText : "";
|
|
547
|
-
this.queuedThrow = info ? info.queuedThrow : null;
|
|
548
|
-
this.setState(info ? info.state : this.startState);
|
|
549
|
-
this.stack = info && info.stack ? info.stack.slice() : [];
|
|
550
|
-
return this;
|
|
551
|
-
};
|
|
552
|
-
Lexer.prototype.save = function() {
|
|
553
|
-
return {
|
|
554
|
-
line: this.line,
|
|
555
|
-
col: this.col,
|
|
556
|
-
state: this.state,
|
|
557
|
-
stack: this.stack.slice(),
|
|
558
|
-
queuedToken: this.queuedToken,
|
|
559
|
-
queuedText: this.queuedText,
|
|
560
|
-
queuedThrow: this.queuedThrow
|
|
561
|
-
};
|
|
562
|
-
};
|
|
563
|
-
Lexer.prototype.setState = function(state2) {
|
|
564
|
-
if (!state2 || this.state === state2) return;
|
|
565
|
-
this.state = state2;
|
|
566
|
-
var info = this.states[state2];
|
|
567
|
-
this.groups = info.groups;
|
|
568
|
-
this.error = info.error;
|
|
569
|
-
this.re = info.regexp;
|
|
570
|
-
this.fast = info.fast;
|
|
571
|
-
};
|
|
572
|
-
Lexer.prototype.popState = function() {
|
|
573
|
-
this.setState(this.stack.pop());
|
|
574
|
-
};
|
|
575
|
-
Lexer.prototype.pushState = function(state2) {
|
|
576
|
-
this.stack.push(this.state);
|
|
577
|
-
this.setState(state2);
|
|
578
|
-
};
|
|
579
|
-
var eat = hasSticky ? function(re, buffer) {
|
|
580
|
-
return re.exec(buffer);
|
|
581
|
-
} : function(re, buffer) {
|
|
582
|
-
var match = re.exec(buffer);
|
|
583
|
-
if (match[0].length === 0) {
|
|
584
|
-
return null;
|
|
585
|
-
}
|
|
586
|
-
return match;
|
|
587
|
-
};
|
|
588
|
-
Lexer.prototype._getGroup = function(match) {
|
|
589
|
-
var groupCount = this.groups.length;
|
|
590
|
-
for (var i2 = 0; i2 < groupCount; i2++) {
|
|
591
|
-
if (match[i2 + 1] !== void 0) {
|
|
592
|
-
return this.groups[i2];
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
throw new Error("Cannot find token type for matched text");
|
|
596
|
-
};
|
|
597
|
-
function tokenToString() {
|
|
598
|
-
return this.value;
|
|
599
|
-
}
|
|
600
|
-
Lexer.prototype.next = function() {
|
|
601
|
-
var index = this.index;
|
|
602
|
-
if (this.queuedGroup) {
|
|
603
|
-
var token = this._token(this.queuedGroup, this.queuedText, index);
|
|
604
|
-
this.queuedGroup = null;
|
|
605
|
-
this.queuedText = "";
|
|
606
|
-
return token;
|
|
607
|
-
}
|
|
608
|
-
var buffer = this.buffer;
|
|
609
|
-
if (index === buffer.length) {
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
var group = this.fast[buffer.charCodeAt(index)];
|
|
613
|
-
if (group) {
|
|
614
|
-
return this._token(group, buffer.charAt(index), index);
|
|
615
|
-
}
|
|
616
|
-
var re = this.re;
|
|
617
|
-
re.lastIndex = index;
|
|
618
|
-
var match = eat(re, buffer);
|
|
619
|
-
var error = this.error;
|
|
620
|
-
if (match == null) {
|
|
621
|
-
return this._token(error, buffer.slice(index, buffer.length), index);
|
|
622
|
-
}
|
|
623
|
-
var group = this._getGroup(match);
|
|
624
|
-
var text = match[0];
|
|
625
|
-
if (error.fallback && match.index !== index) {
|
|
626
|
-
this.queuedGroup = group;
|
|
627
|
-
this.queuedText = text;
|
|
628
|
-
return this._token(error, buffer.slice(index, match.index), index);
|
|
629
|
-
}
|
|
630
|
-
return this._token(group, text, index);
|
|
631
|
-
};
|
|
632
|
-
Lexer.prototype._token = function(group, text, offset) {
|
|
633
|
-
var lineBreaks = 0;
|
|
634
|
-
if (group.lineBreaks) {
|
|
635
|
-
var matchNL = /\n/g;
|
|
636
|
-
var nl = 1;
|
|
637
|
-
if (text === "\n") {
|
|
638
|
-
lineBreaks = 1;
|
|
639
|
-
} else {
|
|
640
|
-
while (matchNL.exec(text)) {
|
|
641
|
-
lineBreaks++;
|
|
642
|
-
nl = matchNL.lastIndex;
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
var token = {
|
|
647
|
-
type: typeof group.type === "function" && group.type(text) || group.defaultType,
|
|
648
|
-
value: typeof group.value === "function" ? group.value(text) : text,
|
|
649
|
-
text,
|
|
650
|
-
toString: tokenToString,
|
|
651
|
-
offset,
|
|
652
|
-
lineBreaks,
|
|
653
|
-
line: this.line,
|
|
654
|
-
col: this.col
|
|
655
|
-
};
|
|
656
|
-
var size = text.length;
|
|
657
|
-
this.index += size;
|
|
658
|
-
this.line += lineBreaks;
|
|
659
|
-
if (lineBreaks !== 0) {
|
|
660
|
-
this.col = size - nl + 1;
|
|
661
|
-
} else {
|
|
662
|
-
this.col += size;
|
|
663
|
-
}
|
|
664
|
-
if (group.shouldThrow) {
|
|
665
|
-
var err = new Error(this.formatError(token, "invalid syntax"));
|
|
666
|
-
throw err;
|
|
667
|
-
}
|
|
668
|
-
if (group.pop) this.popState();
|
|
669
|
-
else if (group.push) this.pushState(group.push);
|
|
670
|
-
else if (group.next) this.setState(group.next);
|
|
671
|
-
return token;
|
|
672
|
-
};
|
|
673
|
-
if (typeof Symbol !== "undefined" && Symbol.iterator) {
|
|
674
|
-
var LexerIterator = function(lexer) {
|
|
675
|
-
this.lexer = lexer;
|
|
676
|
-
};
|
|
677
|
-
LexerIterator.prototype.next = function() {
|
|
678
|
-
var token = this.lexer.next();
|
|
679
|
-
return { value: token, done: !token };
|
|
680
|
-
};
|
|
681
|
-
LexerIterator.prototype[Symbol.iterator] = function() {
|
|
682
|
-
return this;
|
|
683
|
-
};
|
|
684
|
-
Lexer.prototype[Symbol.iterator] = function() {
|
|
685
|
-
return new LexerIterator(this);
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
Lexer.prototype.formatError = function(token, message) {
|
|
689
|
-
if (token == null) {
|
|
690
|
-
var text = this.buffer.slice(this.index);
|
|
691
|
-
var token = {
|
|
692
|
-
text,
|
|
693
|
-
offset: this.index,
|
|
694
|
-
lineBreaks: text.indexOf("\n") === -1 ? 0 : 1,
|
|
695
|
-
line: this.line,
|
|
696
|
-
col: this.col
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
var numLinesAround = 2;
|
|
700
|
-
var firstDisplayedLine = Math.max(token.line - numLinesAround, 1);
|
|
701
|
-
var lastDisplayedLine = token.line + numLinesAround;
|
|
702
|
-
var lastLineDigits = String(lastDisplayedLine).length;
|
|
703
|
-
var displayedLines = lastNLines(
|
|
704
|
-
this.buffer,
|
|
705
|
-
this.line - token.line + numLinesAround + 1
|
|
706
|
-
).slice(0, 5);
|
|
707
|
-
var errorLines = [];
|
|
708
|
-
errorLines.push(message + " at line " + token.line + " col " + token.col + ":");
|
|
709
|
-
errorLines.push("");
|
|
710
|
-
for (var i2 = 0; i2 < displayedLines.length; i2++) {
|
|
711
|
-
var line = displayedLines[i2];
|
|
712
|
-
var lineNo = firstDisplayedLine + i2;
|
|
713
|
-
errorLines.push(pad(String(lineNo), lastLineDigits) + " " + line);
|
|
714
|
-
if (lineNo === token.line) {
|
|
715
|
-
errorLines.push(pad("", lastLineDigits + token.col + 1) + "^");
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
return errorLines.join("\n");
|
|
719
|
-
};
|
|
720
|
-
Lexer.prototype.clone = function() {
|
|
721
|
-
return new Lexer(this.states, this.state);
|
|
722
|
-
};
|
|
723
|
-
Lexer.prototype.has = function(tokenType) {
|
|
724
|
-
return true;
|
|
725
|
-
};
|
|
726
|
-
return {
|
|
727
|
-
compile,
|
|
728
|
-
states: compileStates,
|
|
729
|
-
error: Object.freeze({ error: true }),
|
|
730
|
-
fallback: Object.freeze({ fallback: true }),
|
|
731
|
-
keywords: keywordTransform
|
|
732
|
-
};
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
});
|
|
736
|
-
|
|
737
|
-
// node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js
|
|
738
|
-
var require_lexer = __commonJS({
|
|
739
|
-
"node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
|
|
740
|
-
"use strict";
|
|
741
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
742
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
743
|
-
};
|
|
744
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
745
|
-
exports.lexer = exports.states = void 0;
|
|
746
|
-
var moo_1 = __importDefault(require_moo());
|
|
747
|
-
exports.states = {
|
|
748
|
-
body: {
|
|
749
|
-
doubleapos: { match: "''", value: () => "'" },
|
|
750
|
-
quoted: {
|
|
751
|
-
lineBreaks: true,
|
|
752
|
-
match: /'[{}#](?:[^']|'')*'(?!')/u,
|
|
753
|
-
value: (src) => src.slice(1, -1).replace(/''/g, "'")
|
|
754
|
-
},
|
|
755
|
-
argument: {
|
|
756
|
-
lineBreaks: true,
|
|
757
|
-
match: /\{\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,
|
|
758
|
-
push: "arg",
|
|
759
|
-
value: (src) => src.substring(1).trim()
|
|
760
|
-
},
|
|
761
|
-
octothorpe: "#",
|
|
762
|
-
end: { match: "}", pop: 1 },
|
|
763
|
-
content: { lineBreaks: true, match: /[^][^{}#']*/u }
|
|
764
|
-
},
|
|
765
|
-
arg: {
|
|
766
|
-
select: {
|
|
767
|
-
lineBreaks: true,
|
|
768
|
-
match: /,\s*(?:plural|select|selectordinal)\s*,\s*/u,
|
|
769
|
-
next: "select",
|
|
770
|
-
value: (src) => src.split(",")[1].trim()
|
|
771
|
-
},
|
|
772
|
-
"func-args": {
|
|
773
|
-
lineBreaks: true,
|
|
774
|
-
match: /,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*,/u,
|
|
775
|
-
next: "body",
|
|
776
|
-
value: (src) => src.split(",")[1].trim()
|
|
777
|
-
},
|
|
778
|
-
"func-simple": {
|
|
779
|
-
lineBreaks: true,
|
|
780
|
-
match: /,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,
|
|
781
|
-
value: (src) => src.substring(1).trim()
|
|
782
|
-
},
|
|
783
|
-
end: { match: "}", pop: 1 }
|
|
784
|
-
},
|
|
785
|
-
select: {
|
|
786
|
-
offset: {
|
|
787
|
-
lineBreaks: true,
|
|
788
|
-
match: /\s*offset\s*:\s*\d+\s*/u,
|
|
789
|
-
value: (src) => src.split(":")[1].trim()
|
|
790
|
-
},
|
|
791
|
-
case: {
|
|
792
|
-
lineBreaks: true,
|
|
793
|
-
match: /\s*(?:=\d+|[^\p{Pat_Syn}\p{Pat_WS}]+)\s*\{/u,
|
|
794
|
-
push: "body",
|
|
795
|
-
value: (src) => src.substring(0, src.indexOf("{")).trim()
|
|
796
|
-
},
|
|
797
|
-
end: { match: /\s*\}/u, pop: 1 }
|
|
798
|
-
}
|
|
799
|
-
};
|
|
800
|
-
exports.lexer = moo_1.default.states(exports.states);
|
|
801
|
-
}
|
|
802
|
-
});
|
|
803
|
-
|
|
804
|
-
// node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js
|
|
805
|
-
var require_parser = __commonJS({
|
|
806
|
-
"node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js"(exports) {
|
|
807
|
-
"use strict";
|
|
808
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
809
|
-
exports.ParseError = void 0;
|
|
810
|
-
exports.parse = parse2;
|
|
811
|
-
var lexer_js_1 = require_lexer();
|
|
812
|
-
var getContext = (lt) => ({
|
|
813
|
-
offset: lt.offset,
|
|
814
|
-
line: lt.line,
|
|
815
|
-
col: lt.col,
|
|
816
|
-
text: lt.text,
|
|
817
|
-
lineBreaks: lt.lineBreaks
|
|
818
|
-
});
|
|
819
|
-
var isSelectType = (type) => type === "plural" || type === "select" || type === "selectordinal";
|
|
820
|
-
function strictArgStyleParam(lt, param) {
|
|
821
|
-
let value = "";
|
|
822
|
-
let text = "";
|
|
823
|
-
for (const p2 of param) {
|
|
824
|
-
const pText = p2.ctx.text;
|
|
825
|
-
text += pText;
|
|
826
|
-
switch (p2.type) {
|
|
827
|
-
case "content":
|
|
828
|
-
value += p2.value;
|
|
829
|
-
break;
|
|
830
|
-
case "argument":
|
|
831
|
-
case "function":
|
|
832
|
-
case "octothorpe":
|
|
833
|
-
value += pText;
|
|
834
|
-
break;
|
|
835
|
-
default:
|
|
836
|
-
throw new ParseError(lt, `Unsupported part in strict mode function arg style: ${pText}`);
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
const c2 = {
|
|
840
|
-
type: "content",
|
|
841
|
-
value: value.trim(),
|
|
842
|
-
ctx: Object.assign({}, param[0].ctx, { text })
|
|
843
|
-
};
|
|
844
|
-
return [c2];
|
|
845
|
-
}
|
|
846
|
-
var strictArgTypes = [
|
|
847
|
-
"number",
|
|
848
|
-
"date",
|
|
849
|
-
"time",
|
|
850
|
-
"spellout",
|
|
851
|
-
"ordinal",
|
|
852
|
-
"duration"
|
|
853
|
-
];
|
|
854
|
-
var defaultPluralKeys = ["zero", "one", "two", "few", "many", "other"];
|
|
855
|
-
var ParseError = class extends Error {
|
|
856
|
-
/** @internal */
|
|
857
|
-
constructor(lt, msg) {
|
|
858
|
-
super(lexer_js_1.lexer.formatError(lt, msg));
|
|
859
|
-
}
|
|
860
|
-
};
|
|
861
|
-
exports.ParseError = ParseError;
|
|
862
|
-
var Parser = class {
|
|
863
|
-
constructor(src, opt) {
|
|
864
|
-
var _a, _b, _c, _d;
|
|
865
|
-
this.lexer = lexer_js_1.lexer.reset(src);
|
|
866
|
-
this.cardinalKeys = (_a = opt === null || opt === void 0 ? void 0 : opt.cardinal) !== null && _a !== void 0 ? _a : defaultPluralKeys;
|
|
867
|
-
this.ordinalKeys = (_b = opt === null || opt === void 0 ? void 0 : opt.ordinal) !== null && _b !== void 0 ? _b : defaultPluralKeys;
|
|
868
|
-
this.strict = (_c = opt === null || opt === void 0 ? void 0 : opt.strict) !== null && _c !== void 0 ? _c : false;
|
|
869
|
-
this.strictPluralKeys = (_d = opt === null || opt === void 0 ? void 0 : opt.strictPluralKeys) !== null && _d !== void 0 ? _d : true;
|
|
870
|
-
}
|
|
871
|
-
parse() {
|
|
872
|
-
return this.parseBody(false, true);
|
|
873
|
-
}
|
|
874
|
-
checkSelectKey(lt, type, key) {
|
|
875
|
-
if (key[0] === "=") {
|
|
876
|
-
if (type === "select") {
|
|
877
|
-
throw new ParseError(lt, `The case ${key} is not valid with select`);
|
|
878
|
-
}
|
|
879
|
-
} else if (type !== "select") {
|
|
880
|
-
const keys = type === "plural" ? this.cardinalKeys : this.ordinalKeys;
|
|
881
|
-
if (this.strictPluralKeys && keys.length > 0 && !keys.includes(key)) {
|
|
882
|
-
const msg = `The ${type} case ${key} is not valid in this locale`;
|
|
883
|
-
throw new ParseError(lt, msg);
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
parseSelect({ value: arg }, inPlural, ctx, type) {
|
|
888
|
-
const sel = { type, arg, cases: [], ctx };
|
|
889
|
-
if (type === "plural" || type === "selectordinal")
|
|
890
|
-
inPlural = true;
|
|
891
|
-
else if (this.strict)
|
|
892
|
-
inPlural = false;
|
|
893
|
-
for (const lt of this.lexer) {
|
|
894
|
-
switch (lt.type) {
|
|
895
|
-
case "offset":
|
|
896
|
-
if (type === "select") {
|
|
897
|
-
throw new ParseError(lt, "Unexpected plural offset for select");
|
|
898
|
-
}
|
|
899
|
-
if (sel.cases.length > 0) {
|
|
900
|
-
throw new ParseError(lt, "Plural offset must be set before cases");
|
|
901
|
-
}
|
|
902
|
-
sel.pluralOffset = Number(lt.value);
|
|
903
|
-
ctx.text += lt.text;
|
|
904
|
-
ctx.lineBreaks += lt.lineBreaks;
|
|
905
|
-
break;
|
|
906
|
-
case "case": {
|
|
907
|
-
this.checkSelectKey(lt, type, lt.value);
|
|
908
|
-
sel.cases.push({
|
|
909
|
-
key: lt.value,
|
|
910
|
-
tokens: this.parseBody(inPlural),
|
|
911
|
-
ctx: getContext(lt)
|
|
912
|
-
});
|
|
913
|
-
break;
|
|
914
|
-
}
|
|
915
|
-
case "end":
|
|
916
|
-
return sel;
|
|
917
|
-
default:
|
|
918
|
-
throw new ParseError(lt, `Unexpected lexer token: ${lt.type}`);
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
throw new ParseError(null, "Unexpected message end");
|
|
922
|
-
}
|
|
923
|
-
parseArgToken(lt, inPlural) {
|
|
924
|
-
const ctx = getContext(lt);
|
|
925
|
-
const argType = this.lexer.next();
|
|
926
|
-
if (!argType)
|
|
927
|
-
throw new ParseError(null, "Unexpected message end");
|
|
928
|
-
ctx.text += argType.text;
|
|
929
|
-
ctx.lineBreaks += argType.lineBreaks;
|
|
930
|
-
if (this.strict && (argType.type === "func-simple" || argType.type === "func-args") && !strictArgTypes.includes(argType.value)) {
|
|
931
|
-
const msg = `Invalid strict mode function arg type: ${argType.value}`;
|
|
932
|
-
throw new ParseError(lt, msg);
|
|
933
|
-
}
|
|
934
|
-
switch (argType.type) {
|
|
935
|
-
case "end":
|
|
936
|
-
return { type: "argument", arg: lt.value, ctx };
|
|
937
|
-
case "func-simple": {
|
|
938
|
-
const end = this.lexer.next();
|
|
939
|
-
if (!end)
|
|
940
|
-
throw new ParseError(null, "Unexpected message end");
|
|
941
|
-
if (end.type !== "end") {
|
|
942
|
-
throw new ParseError(end, `Unexpected lexer token: ${end.type}`);
|
|
943
|
-
}
|
|
944
|
-
ctx.text += end.text;
|
|
945
|
-
if (isSelectType(argType.value.toLowerCase())) {
|
|
946
|
-
throw new ParseError(argType, `Invalid type identifier: ${argType.value}`);
|
|
947
|
-
}
|
|
948
|
-
return {
|
|
949
|
-
type: "function",
|
|
950
|
-
arg: lt.value,
|
|
951
|
-
key: argType.value,
|
|
952
|
-
ctx
|
|
953
|
-
};
|
|
954
|
-
}
|
|
955
|
-
case "func-args": {
|
|
956
|
-
if (isSelectType(argType.value.toLowerCase())) {
|
|
957
|
-
const msg = `Invalid type identifier: ${argType.value}`;
|
|
958
|
-
throw new ParseError(argType, msg);
|
|
959
|
-
}
|
|
960
|
-
let param = this.parseBody(this.strict ? false : inPlural);
|
|
961
|
-
if (this.strict && param.length > 0) {
|
|
962
|
-
param = strictArgStyleParam(lt, param);
|
|
963
|
-
}
|
|
964
|
-
return {
|
|
965
|
-
type: "function",
|
|
966
|
-
arg: lt.value,
|
|
967
|
-
key: argType.value,
|
|
968
|
-
param,
|
|
969
|
-
ctx
|
|
970
|
-
};
|
|
971
|
-
}
|
|
972
|
-
case "select":
|
|
973
|
-
if (isSelectType(argType.value)) {
|
|
974
|
-
return this.parseSelect(lt, inPlural, ctx, argType.value);
|
|
975
|
-
} else {
|
|
976
|
-
throw new ParseError(argType, `Unexpected select type ${argType.value}`);
|
|
977
|
-
}
|
|
978
|
-
default:
|
|
979
|
-
throw new ParseError(argType, `Unexpected lexer token: ${argType.type}`);
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
parseBody(inPlural, atRoot) {
|
|
983
|
-
const tokens = [];
|
|
984
|
-
let content = null;
|
|
985
|
-
for (const lt of this.lexer) {
|
|
986
|
-
if (lt.type === "argument") {
|
|
987
|
-
if (content)
|
|
988
|
-
content = null;
|
|
989
|
-
tokens.push(this.parseArgToken(lt, inPlural));
|
|
990
|
-
} else if (lt.type === "octothorpe" && inPlural) {
|
|
991
|
-
if (content)
|
|
992
|
-
content = null;
|
|
993
|
-
tokens.push({ type: "octothorpe", ctx: getContext(lt) });
|
|
994
|
-
} else if (lt.type === "end" && !atRoot) {
|
|
995
|
-
return tokens;
|
|
996
|
-
} else {
|
|
997
|
-
let value = lt.value;
|
|
998
|
-
if (!inPlural && lt.type === "quoted" && value[0] === "#") {
|
|
999
|
-
if (value.includes("{")) {
|
|
1000
|
-
const errMsg = `Unsupported escape pattern: ${value}`;
|
|
1001
|
-
throw new ParseError(lt, errMsg);
|
|
1002
|
-
}
|
|
1003
|
-
value = lt.text;
|
|
1004
|
-
}
|
|
1005
|
-
if (content) {
|
|
1006
|
-
content.value += value;
|
|
1007
|
-
content.ctx.text += lt.text;
|
|
1008
|
-
content.ctx.lineBreaks += lt.lineBreaks;
|
|
1009
|
-
} else {
|
|
1010
|
-
content = { type: "content", value, ctx: getContext(lt) };
|
|
1011
|
-
tokens.push(content);
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
if (atRoot)
|
|
1016
|
-
return tokens;
|
|
1017
|
-
throw new ParseError(null, "Unexpected message end");
|
|
1018
|
-
}
|
|
1019
|
-
};
|
|
1020
|
-
function parse2(src, options = {}) {
|
|
1021
|
-
const parser = new Parser(src, options);
|
|
1022
|
-
return parser.parse();
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
});
|
|
1026
|
-
|
|
1027
|
-
// packages/modal/modal-footer.ts
|
|
1028
|
-
import { html, css, LitElement } from "lit";
|
|
1029
|
-
|
|
1030
|
-
// packages/modal/util.js
|
|
1031
|
-
var CanCloseMixin = (superClass) => class extends superClass {
|
|
1032
|
-
constructor() {
|
|
1033
|
-
super(...arguments);
|
|
1034
|
-
__publicField(this, "patchClose", true);
|
|
1035
|
-
__publicField(this, "_close", null);
|
|
1036
|
-
}
|
|
1037
|
-
close() {
|
|
1038
|
-
this._close();
|
|
1039
|
-
}
|
|
1040
|
-
};
|
|
1041
|
-
var ProvidesCanCloseToSlotsMixin = (superClass) => class extends superClass {
|
|
1042
|
-
// HACK: slot-props don't seem to exist and neither does the context pattern for this
|
|
1043
|
-
/** @param {Event} evt */
|
|
1044
|
-
handleSlotChange(evt) {
|
|
1045
|
-
const children = evt.target.assignedNodes({ flatten: true });
|
|
1046
|
-
for (const child of children.filter((e) => e.patchClose)) {
|
|
1047
|
-
child._close = () => this.close();
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
};
|
|
1051
|
-
|
|
1052
|
-
// packages/modal/modal-footer.ts
|
|
1053
|
-
var ModalFooter = class extends CanCloseMixin(ProvidesCanCloseToSlotsMixin(LitElement)) {
|
|
1054
|
-
render() {
|
|
1055
|
-
return html`
|
|
1056
|
-
<div class="footer">
|
|
1057
|
-
<slot @slotchange="${this.handleSlotChange}"></slot>
|
|
1058
|
-
</div>
|
|
1059
|
-
`;
|
|
1060
|
-
}
|
|
1061
|
-
};
|
|
1062
|
-
ModalFooter.styles = css`
|
|
1063
|
-
.footer {
|
|
1064
|
-
display:flex;
|
|
1065
|
-
flex-shrink:0;
|
|
1066
|
-
justify-content:flex-end;
|
|
1067
|
-
padding-left:1.6rem;
|
|
1068
|
-
padding-right:1.6rem;
|
|
1069
|
-
padding-top:2.4rem;
|
|
1070
|
-
}
|
|
1071
|
-
@media (min-width: 480px){
|
|
1072
|
-
.footer {
|
|
1073
|
-
padding-left:3.2rem;
|
|
1074
|
-
padding-right:3.2rem;
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
`;
|
|
1078
|
-
|
|
1079
|
-
// packages/modal/modal-header.ts
|
|
1080
|
-
import { css as css2, html as html4, LitElement as LitElement4, nothing } from "lit";
|
|
1081
|
-
|
|
1082
|
-
// node_modules/.pnpm/@itsy+animate@0.0.9/node_modules/@itsy/animate/src/utility.js
|
|
1083
|
-
var computeDeltas = (first, last) => ({
|
|
1084
|
-
dx: first.left - last.left,
|
|
1085
|
-
dy: first.top - last.top,
|
|
1086
|
-
dw: first.width / last.width,
|
|
1087
|
-
dh: first.height / last.height,
|
|
1088
|
-
first,
|
|
1089
|
-
last
|
|
1090
|
-
});
|
|
1091
|
-
var moveKeyframes = ({ dx, dy }) => [
|
|
1092
|
-
{ transform: `translate(${dx}px, ${dy}px)` },
|
|
1093
|
-
{ transform: "none" }
|
|
1094
|
-
];
|
|
1095
|
-
var animationDefaults = { easing: "ease", duration: 300 };
|
|
1096
|
-
|
|
1097
|
-
// node_modules/.pnpm/@itsy+animate@0.0.9/node_modules/@itsy/animate/src/reduce-motion.js
|
|
1098
|
-
var reduceMotion = false;
|
|
1099
|
-
var windowExists = typeof window !== "undefined";
|
|
1100
|
-
if (windowExists) {
|
|
1101
|
-
const query3 = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
1102
|
-
const callback = ({ matches }) => reduceMotion = matches;
|
|
1103
|
-
if (query3.addEventListener) query3.addEventListener("change", callback);
|
|
1104
|
-
callback(query3);
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
// node_modules/.pnpm/@itsy+animate@0.0.9/node_modules/@itsy/animate/src/move.js
|
|
1108
|
-
var Move = class {
|
|
1109
|
-
constructor(el, { animation = {}, keyframes, respectReduceMotion = true } = {}) {
|
|
1110
|
-
/** @type {DOMRect | {}} */
|
|
1111
|
-
__publicField(this, "first");
|
|
1112
|
-
/** @type {DOMRect | {}} */
|
|
1113
|
-
__publicField(this, "last");
|
|
1114
|
-
/** @type {HTMLElement} */
|
|
1115
|
-
__publicField(this, "el");
|
|
1116
|
-
this.el = el;
|
|
1117
|
-
this.first = {};
|
|
1118
|
-
this.last = {};
|
|
1119
|
-
this.userAnimationOptions = animation;
|
|
1120
|
-
this.keyframeGenerator = keyframes || moveKeyframes;
|
|
1121
|
-
this.shouldReduceMotion = respectReduceMotion;
|
|
1122
|
-
}
|
|
1123
|
-
async when(cb) {
|
|
1124
|
-
this.prep();
|
|
1125
|
-
const v = await cb();
|
|
1126
|
-
await this.play();
|
|
1127
|
-
return v;
|
|
1128
|
-
}
|
|
1129
|
-
prep() {
|
|
1130
|
-
this.first = this.el.getBoundingClientRect();
|
|
1131
|
-
}
|
|
1132
|
-
async play() {
|
|
1133
|
-
this.last = this.el.getBoundingClientRect();
|
|
1134
|
-
if (!this.el.animate) return;
|
|
1135
|
-
const animation = this.el.animate(this.keyframes, this.animationOptions);
|
|
1136
|
-
await animation.finished;
|
|
1137
|
-
}
|
|
1138
|
-
get keyframes() {
|
|
1139
|
-
return this.keyframeGenerator(computeDeltas(this.first, this.last));
|
|
1140
|
-
}
|
|
1141
|
-
get defaults() {
|
|
1142
|
-
return animationDefaults;
|
|
1143
|
-
}
|
|
1144
|
-
get mergedOptions() {
|
|
1145
|
-
return __spreadValues(__spreadValues({}, this.defaults), this.userAnimationOptions);
|
|
1146
|
-
}
|
|
1147
|
-
get animationOptions() {
|
|
1148
|
-
if (!this.shouldReduceMotion) return this.mergedOptions;
|
|
1149
|
-
if (!reduceMotion) return this.mergedOptions;
|
|
1150
|
-
return __spreadProps(__spreadValues({}, this.mergedOptions), { duration: 0 });
|
|
1151
|
-
}
|
|
1152
|
-
};
|
|
1153
|
-
|
|
1154
|
-
// node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_ty_33a2537ce57a59324989ce8020998d0e/node_modules/@lingui/core/dist/index.mjs
|
|
1155
|
-
var import_unraw = __toESM(require_dist(), 1);
|
|
1156
|
-
|
|
1157
|
-
// node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
|
|
1158
|
-
var import_parser = __toESM(require_parser(), 1);
|
|
1159
|
-
var DateFormatError = class extends Error {
|
|
1160
|
-
/** @internal */
|
|
1161
|
-
constructor(msg, token, type) {
|
|
1162
|
-
super(msg);
|
|
1163
|
-
this.token = token;
|
|
1164
|
-
this.type = type || "error";
|
|
1165
|
-
}
|
|
1166
|
-
};
|
|
1167
|
-
var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
|
|
1168
|
-
var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
|
|
1169
|
-
function yearOptions(token, onError) {
|
|
1170
|
-
switch (token.char) {
|
|
1171
|
-
case "y":
|
|
1172
|
-
return { year: numeric(token.width) };
|
|
1173
|
-
case "r":
|
|
1174
|
-
return { calendar: "gregory", year: "numeric" };
|
|
1175
|
-
case "u":
|
|
1176
|
-
case "U":
|
|
1177
|
-
case "Y":
|
|
1178
|
-
default:
|
|
1179
|
-
onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
|
|
1180
|
-
return { year: "numeric" };
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
function monthStyle(token, onError) {
|
|
1184
|
-
switch (token.width) {
|
|
1185
|
-
case 1:
|
|
1186
|
-
return "numeric";
|
|
1187
|
-
case 2:
|
|
1188
|
-
return "2-digit";
|
|
1189
|
-
case 3:
|
|
1190
|
-
return "short";
|
|
1191
|
-
case 4:
|
|
1192
|
-
return "long";
|
|
1193
|
-
case 5:
|
|
1194
|
-
return "narrow";
|
|
1195
|
-
default:
|
|
1196
|
-
onError(`${token.desc} is not supported with width ${token.width}`);
|
|
1197
|
-
return void 0;
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
function dayStyle(token, onError) {
|
|
1201
|
-
const { char, desc, width } = token;
|
|
1202
|
-
if (char === "d") {
|
|
1203
|
-
return numeric(width);
|
|
1204
|
-
} else {
|
|
1205
|
-
onError(`${desc} is not supported`);
|
|
1206
|
-
return void 0;
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
function weekdayStyle(token, onError) {
|
|
1210
|
-
const { char, desc, width } = token;
|
|
1211
|
-
if ((char === "c" || char === "e") && width < 3) {
|
|
1212
|
-
const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
|
|
1213
|
-
onError(msg, DateFormatError.WARNING);
|
|
1214
|
-
}
|
|
1215
|
-
return alpha(width);
|
|
1216
|
-
}
|
|
1217
|
-
function hourOptions(token) {
|
|
1218
|
-
const hour = numeric(token.width);
|
|
1219
|
-
let hourCycle;
|
|
1220
|
-
switch (token.char) {
|
|
1221
|
-
case "h":
|
|
1222
|
-
hourCycle = "h12";
|
|
1223
|
-
break;
|
|
1224
|
-
case "H":
|
|
1225
|
-
hourCycle = "h23";
|
|
1226
|
-
break;
|
|
1227
|
-
case "k":
|
|
1228
|
-
hourCycle = "h24";
|
|
1229
|
-
break;
|
|
1230
|
-
case "K":
|
|
1231
|
-
hourCycle = "h11";
|
|
1232
|
-
break;
|
|
1233
|
-
}
|
|
1234
|
-
return hourCycle ? { hour, hourCycle } : { hour };
|
|
1235
|
-
}
|
|
1236
|
-
function timeZoneNameStyle(token, onError) {
|
|
1237
|
-
const { char, desc, width } = token;
|
|
1238
|
-
switch (char) {
|
|
1239
|
-
case "v":
|
|
1240
|
-
case "z":
|
|
1241
|
-
return width === 4 ? "long" : "short";
|
|
1242
|
-
case "V":
|
|
1243
|
-
if (width === 4)
|
|
1244
|
-
return "long";
|
|
1245
|
-
onError(`${desc} is not supported with width ${width}`);
|
|
1246
|
-
return void 0;
|
|
1247
|
-
case "X":
|
|
1248
|
-
onError(`${desc} is not supported`);
|
|
1249
|
-
return void 0;
|
|
1250
|
-
}
|
|
1251
|
-
return "short";
|
|
1252
|
-
}
|
|
1253
|
-
function compileOptions(token, onError) {
|
|
1254
|
-
switch (token.field) {
|
|
1255
|
-
case "era":
|
|
1256
|
-
return { era: alpha(token.width) };
|
|
1257
|
-
case "year":
|
|
1258
|
-
return yearOptions(token, onError);
|
|
1259
|
-
case "month":
|
|
1260
|
-
return { month: monthStyle(token, onError) };
|
|
1261
|
-
case "day":
|
|
1262
|
-
return { day: dayStyle(token, onError) };
|
|
1263
|
-
case "weekday":
|
|
1264
|
-
return { weekday: weekdayStyle(token, onError) };
|
|
1265
|
-
case "period":
|
|
1266
|
-
return void 0;
|
|
1267
|
-
case "hour":
|
|
1268
|
-
return hourOptions(token);
|
|
1269
|
-
case "min":
|
|
1270
|
-
return { minute: numeric(token.width) };
|
|
1271
|
-
case "sec":
|
|
1272
|
-
return { second: numeric(token.width) };
|
|
1273
|
-
case "tz":
|
|
1274
|
-
return { timeZoneName: timeZoneNameStyle(token, onError) };
|
|
1275
|
-
case "quarter":
|
|
1276
|
-
case "week":
|
|
1277
|
-
case "sec-frac":
|
|
1278
|
-
case "ms":
|
|
1279
|
-
onError(`${token.desc} is not supported`);
|
|
1280
|
-
}
|
|
1281
|
-
return void 0;
|
|
1282
|
-
}
|
|
1283
|
-
function getDateFormatOptions(tokens, timeZone, onError = (error) => {
|
|
1284
|
-
throw error;
|
|
1285
|
-
}) {
|
|
1286
|
-
const options = {
|
|
1287
|
-
timeZone
|
|
1288
|
-
};
|
|
1289
|
-
const fields2 = [];
|
|
1290
|
-
for (const token of tokens) {
|
|
1291
|
-
const { error, field, str } = token;
|
|
1292
|
-
if (error) {
|
|
1293
|
-
const dte = new DateFormatError(error.message, token);
|
|
1294
|
-
dte.stack = error.stack;
|
|
1295
|
-
onError(dte);
|
|
1296
|
-
}
|
|
1297
|
-
if (str) {
|
|
1298
|
-
const msg = `Ignoring string part: ${str}`;
|
|
1299
|
-
onError(new DateFormatError(msg, token, DateFormatError.WARNING));
|
|
1300
|
-
}
|
|
1301
|
-
if (field) {
|
|
1302
|
-
if (fields2.indexOf(field) === -1)
|
|
1303
|
-
fields2.push(field);
|
|
1304
|
-
else
|
|
1305
|
-
onError(new DateFormatError(`Duplicate ${field} token`, token));
|
|
1306
|
-
}
|
|
1307
|
-
const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
|
|
1308
|
-
if (opt)
|
|
1309
|
-
Object.assign(options, opt);
|
|
1310
|
-
}
|
|
1311
|
-
return options;
|
|
1312
|
-
}
|
|
1313
|
-
var fields = {
|
|
1314
|
-
G: { field: "era", desc: "Era" },
|
|
1315
|
-
y: { field: "year", desc: "Year" },
|
|
1316
|
-
Y: { field: "year", desc: 'Year of "Week of Year"' },
|
|
1317
|
-
u: { field: "year", desc: "Extended year" },
|
|
1318
|
-
U: { field: "year", desc: "Cyclic year name" },
|
|
1319
|
-
r: { field: "year", desc: "Related Gregorian year" },
|
|
1320
|
-
Q: { field: "quarter", desc: "Quarter" },
|
|
1321
|
-
q: { field: "quarter", desc: "Stand-alone quarter" },
|
|
1322
|
-
M: { field: "month", desc: "Month in year" },
|
|
1323
|
-
L: { field: "month", desc: "Stand-alone month in year" },
|
|
1324
|
-
w: { field: "week", desc: "Week of year" },
|
|
1325
|
-
W: { field: "week", desc: "Week of month" },
|
|
1326
|
-
d: { field: "day", desc: "Day in month" },
|
|
1327
|
-
D: { field: "day", desc: "Day of year" },
|
|
1328
|
-
F: { field: "day", desc: "Day of week in month" },
|
|
1329
|
-
g: { field: "day", desc: "Modified julian day" },
|
|
1330
|
-
E: { field: "weekday", desc: "Day of week" },
|
|
1331
|
-
e: { field: "weekday", desc: "Local day of week" },
|
|
1332
|
-
c: { field: "weekday", desc: "Stand-alone local day of week" },
|
|
1333
|
-
a: { field: "period", desc: "AM/PM marker" },
|
|
1334
|
-
b: { field: "period", desc: "AM/PM/noon/midnight marker" },
|
|
1335
|
-
B: { field: "period", desc: "Flexible day period" },
|
|
1336
|
-
h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
|
|
1337
|
-
H: { field: "hour", desc: "Hour in day (0~23)" },
|
|
1338
|
-
k: { field: "hour", desc: "Hour in day (1~24)" },
|
|
1339
|
-
K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
|
|
1340
|
-
j: { field: "hour", desc: "Hour in preferred cycle" },
|
|
1341
|
-
J: { field: "hour", desc: "Hour in preferred cycle without marker" },
|
|
1342
|
-
C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
|
|
1343
|
-
m: { field: "min", desc: "Minute in hour" },
|
|
1344
|
-
s: { field: "sec", desc: "Second in minute" },
|
|
1345
|
-
S: { field: "sec-frac", desc: "Fractional second" },
|
|
1346
|
-
A: { field: "ms", desc: "Milliseconds in day" },
|
|
1347
|
-
z: { field: "tz", desc: "Time Zone: specific non-location" },
|
|
1348
|
-
Z: { field: "tz", desc: "Time Zone" },
|
|
1349
|
-
O: { field: "tz", desc: "Time Zone: localized" },
|
|
1350
|
-
v: { field: "tz", desc: "Time Zone: generic non-location" },
|
|
1351
|
-
V: { field: "tz", desc: "Time Zone: ID" },
|
|
1352
|
-
X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
|
|
1353
|
-
x: { field: "tz", desc: "Time Zone: ISO8601" }
|
|
1354
|
-
};
|
|
1355
|
-
var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
|
|
1356
|
-
function readFieldToken(src, pos) {
|
|
1357
|
-
const char = src[pos];
|
|
1358
|
-
let width = 1;
|
|
1359
|
-
while (src[++pos] === char)
|
|
1360
|
-
++width;
|
|
1361
|
-
const field = fields[char];
|
|
1362
|
-
if (!field) {
|
|
1363
|
-
const msg = `The letter ${char} is not a valid field identifier`;
|
|
1364
|
-
return { char, error: new Error(msg), width };
|
|
1365
|
-
}
|
|
1366
|
-
return { char, field: field.field, desc: field.desc, width };
|
|
1367
|
-
}
|
|
1368
|
-
function readQuotedToken(src, pos) {
|
|
1369
|
-
let str = src[++pos];
|
|
1370
|
-
let width = 2;
|
|
1371
|
-
if (str === "'")
|
|
1372
|
-
return { char: "'", str, width };
|
|
1373
|
-
while (true) {
|
|
1374
|
-
const next = src[++pos];
|
|
1375
|
-
++width;
|
|
1376
|
-
if (next === void 0) {
|
|
1377
|
-
const msg = `Unterminated quoted literal in pattern: ${str || src}`;
|
|
1378
|
-
return { char: "'", error: new Error(msg), str, width };
|
|
1379
|
-
} else if (next === "'") {
|
|
1380
|
-
if (src[++pos] !== "'")
|
|
1381
|
-
return { char: "'", str, width };
|
|
1382
|
-
else
|
|
1383
|
-
++width;
|
|
1384
|
-
}
|
|
1385
|
-
str += next;
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
function readToken(src, pos) {
|
|
1389
|
-
const char = src[pos];
|
|
1390
|
-
if (!char)
|
|
1391
|
-
return null;
|
|
1392
|
-
if (isLetter(char))
|
|
1393
|
-
return readFieldToken(src, pos);
|
|
1394
|
-
if (char === "'")
|
|
1395
|
-
return readQuotedToken(src, pos);
|
|
1396
|
-
let str = char;
|
|
1397
|
-
let width = 1;
|
|
1398
|
-
while (true) {
|
|
1399
|
-
const next = src[++pos];
|
|
1400
|
-
if (!next || isLetter(next) || next === "'")
|
|
1401
|
-
return { char, str, width };
|
|
1402
|
-
str += next;
|
|
1403
|
-
width += 1;
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
|
-
function parseDateTokens(src) {
|
|
1407
|
-
const tokens = [];
|
|
1408
|
-
let pos = 0;
|
|
1409
|
-
while (true) {
|
|
1410
|
-
const token = readToken(src, pos);
|
|
1411
|
-
if (!token)
|
|
1412
|
-
return tokens;
|
|
1413
|
-
tokens.push(token);
|
|
1414
|
-
pos += token.width;
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
function processTokens(tokens, mapText) {
|
|
1418
|
-
if (!tokens.filter((token) => token.type !== "content").length) {
|
|
1419
|
-
return tokens.map((token) => mapText(token.value));
|
|
1420
|
-
}
|
|
1421
|
-
return tokens.map((token) => {
|
|
1422
|
-
var _a;
|
|
1423
|
-
if (token.type === "content") {
|
|
1424
|
-
return mapText(token.value);
|
|
1425
|
-
} else if (token.type === "octothorpe") {
|
|
1426
|
-
return "#";
|
|
1427
|
-
} else if (token.type === "argument") {
|
|
1428
|
-
return [token.arg];
|
|
1429
|
-
} else if (token.type === "function") {
|
|
1430
|
-
const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
|
|
1431
|
-
if (token.key === "date" && _param) {
|
|
1432
|
-
const opts = compileDateExpression(_param.value.trim(), (e) => {
|
|
1433
|
-
throw new Error(`Unable to compile date expression: ${e.message}`);
|
|
1434
|
-
});
|
|
1435
|
-
return [token.arg, token.key, opts];
|
|
1436
|
-
}
|
|
1437
|
-
if (_param) {
|
|
1438
|
-
return [token.arg, token.key, _param.value.trim()];
|
|
1439
|
-
} else {
|
|
1440
|
-
return [token.arg, token.key];
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
const offset = token.pluralOffset;
|
|
1444
|
-
const formatProps = {};
|
|
1445
|
-
token.cases.forEach(({ key, tokens: tokens2 }) => {
|
|
1446
|
-
const prop = key[0] === "=" ? key.slice(1) : key;
|
|
1447
|
-
formatProps[prop] = processTokens(tokens2, mapText);
|
|
1448
|
-
});
|
|
1449
|
-
return [
|
|
1450
|
-
token.arg,
|
|
1451
|
-
token.type,
|
|
1452
|
-
__spreadValues({
|
|
1453
|
-
offset
|
|
1454
|
-
}, formatProps)
|
|
1455
|
-
];
|
|
1456
|
-
});
|
|
1457
|
-
}
|
|
1458
|
-
function compileDateExpression(format, onError) {
|
|
1459
|
-
if (/^::/.test(format)) {
|
|
1460
|
-
const tokens = parseDateTokens(format.substring(2));
|
|
1461
|
-
return getDateFormatOptions(tokens, void 0, onError);
|
|
1462
|
-
}
|
|
1463
|
-
return format;
|
|
1464
|
-
}
|
|
1465
|
-
function compileMessage(message, mapText = (v) => v) {
|
|
1466
|
-
try {
|
|
1467
|
-
return processTokens((0, import_parser.parse)(message), mapText);
|
|
1468
|
-
} catch (e) {
|
|
1469
|
-
console.error(`${e.message}
|
|
1470
|
-
|
|
1471
|
-
Message: ${message}`);
|
|
1472
|
-
return [message];
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
// node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_ty_33a2537ce57a59324989ce8020998d0e/node_modules/@lingui/core/dist/index.mjs
|
|
1477
|
-
var isString = (s) => typeof s === "string";
|
|
1478
|
-
var isFunction = (f2) => typeof f2 === "function";
|
|
1479
|
-
var cache = /* @__PURE__ */ new Map();
|
|
1480
|
-
var defaultLocale = "en";
|
|
1481
|
-
function normalizeLocales(locales) {
|
|
1482
|
-
const out = Array.isArray(locales) ? locales : [locales];
|
|
1483
|
-
return [...out, defaultLocale];
|
|
1484
|
-
}
|
|
1485
|
-
function date(locales, value, format) {
|
|
1486
|
-
const _locales = normalizeLocales(locales);
|
|
1487
|
-
if (!format) {
|
|
1488
|
-
format = "default";
|
|
1489
|
-
}
|
|
1490
|
-
let o;
|
|
1491
|
-
if (typeof format === "string") {
|
|
1492
|
-
o = {
|
|
1493
|
-
day: "numeric",
|
|
1494
|
-
month: "short",
|
|
1495
|
-
year: "numeric"
|
|
1496
|
-
};
|
|
1497
|
-
switch (format) {
|
|
1498
|
-
case "full":
|
|
1499
|
-
o.weekday = "long";
|
|
1500
|
-
case "long":
|
|
1501
|
-
o.month = "long";
|
|
1502
|
-
break;
|
|
1503
|
-
case "short":
|
|
1504
|
-
o.month = "numeric";
|
|
1505
|
-
break;
|
|
1506
|
-
}
|
|
1507
|
-
} else {
|
|
1508
|
-
o = format;
|
|
1509
|
-
}
|
|
1510
|
-
const formatter = getMemoized(
|
|
1511
|
-
() => cacheKey("date", _locales, format),
|
|
1512
|
-
() => new Intl.DateTimeFormat(_locales, o)
|
|
1513
|
-
);
|
|
1514
|
-
return formatter.format(isString(value) ? new Date(value) : value);
|
|
1515
|
-
}
|
|
1516
|
-
function time(locales, value, format) {
|
|
1517
|
-
let o;
|
|
1518
|
-
if (!format) {
|
|
1519
|
-
format = "default";
|
|
1520
|
-
}
|
|
1521
|
-
if (typeof format === "string") {
|
|
1522
|
-
o = {
|
|
1523
|
-
second: "numeric",
|
|
1524
|
-
minute: "numeric",
|
|
1525
|
-
hour: "numeric"
|
|
1526
|
-
};
|
|
1527
|
-
switch (format) {
|
|
1528
|
-
case "full":
|
|
1529
|
-
case "long":
|
|
1530
|
-
o.timeZoneName = "short";
|
|
1531
|
-
break;
|
|
1532
|
-
case "short":
|
|
1533
|
-
delete o.second;
|
|
1534
|
-
}
|
|
1535
|
-
} else {
|
|
1536
|
-
o = format;
|
|
1537
|
-
}
|
|
1538
|
-
return date(locales, value, o);
|
|
1539
|
-
}
|
|
1540
|
-
function number(locales, value, format) {
|
|
1541
|
-
const _locales = normalizeLocales(locales);
|
|
1542
|
-
const formatter = getMemoized(
|
|
1543
|
-
() => cacheKey("number", _locales, format),
|
|
1544
|
-
() => new Intl.NumberFormat(_locales, format)
|
|
1545
|
-
);
|
|
1546
|
-
return formatter.format(value);
|
|
1547
|
-
}
|
|
1548
|
-
function plural(locales, ordinal, value, _a) {
|
|
1549
|
-
var _b = _a, { offset = 0 } = _b, rules = __objRest(_b, ["offset"]);
|
|
1550
|
-
var _a2, _b2;
|
|
1551
|
-
const _locales = normalizeLocales(locales);
|
|
1552
|
-
const plurals = ordinal ? getMemoized(
|
|
1553
|
-
() => cacheKey("plural-ordinal", _locales),
|
|
1554
|
-
() => new Intl.PluralRules(_locales, { type: "ordinal" })
|
|
1555
|
-
) : getMemoized(
|
|
1556
|
-
() => cacheKey("plural-cardinal", _locales),
|
|
1557
|
-
() => new Intl.PluralRules(_locales, { type: "cardinal" })
|
|
1558
|
-
);
|
|
1559
|
-
return (_b2 = (_a2 = rules[value]) != null ? _a2 : rules[plurals.select(value - offset)]) != null ? _b2 : rules.other;
|
|
1560
|
-
}
|
|
1561
|
-
function getMemoized(getKey, construct) {
|
|
1562
|
-
const key = getKey();
|
|
1563
|
-
let formatter = cache.get(key);
|
|
1564
|
-
if (!formatter) {
|
|
1565
|
-
formatter = construct();
|
|
1566
|
-
cache.set(key, formatter);
|
|
1567
|
-
}
|
|
1568
|
-
return formatter;
|
|
1569
|
-
}
|
|
1570
|
-
function cacheKey(type, locales, options) {
|
|
1571
|
-
const localeKey = locales.join("-");
|
|
1572
|
-
return `${type}-${localeKey}-${JSON.stringify(options)}`;
|
|
1573
|
-
}
|
|
1574
|
-
var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
|
|
1575
|
-
var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
|
|
1576
|
-
var getDefaultFormats = (locale, passedLocales, formats = {}) => {
|
|
1577
|
-
const locales = passedLocales || locale;
|
|
1578
|
-
const style = (format) => {
|
|
1579
|
-
if (typeof format === "object")
|
|
1580
|
-
return format;
|
|
1581
|
-
return formats[format];
|
|
1582
|
-
};
|
|
1583
|
-
const replaceOctothorpe = (value, message) => {
|
|
1584
|
-
const numberFormat = Object.keys(formats).length ? style("number") : void 0;
|
|
1585
|
-
const valueStr = number(locales, value, numberFormat);
|
|
1586
|
-
return message.replace(new RegExp(OCTOTHORPE_PH, "g"), valueStr);
|
|
1587
|
-
};
|
|
1588
|
-
return {
|
|
1589
|
-
plural: (value, cases) => {
|
|
1590
|
-
const { offset = 0 } = cases;
|
|
1591
|
-
const message = plural(locales, false, value, cases);
|
|
1592
|
-
return replaceOctothorpe(value - offset, message);
|
|
1593
|
-
},
|
|
1594
|
-
selectordinal: (value, cases) => {
|
|
1595
|
-
const { offset = 0 } = cases;
|
|
1596
|
-
const message = plural(locales, true, value, cases);
|
|
1597
|
-
return replaceOctothorpe(value - offset, message);
|
|
1598
|
-
},
|
|
1599
|
-
select: selectFormatter,
|
|
1600
|
-
number: (value, format) => number(
|
|
1601
|
-
locales,
|
|
1602
|
-
value,
|
|
1603
|
-
style(format) || { style: format }
|
|
1604
|
-
),
|
|
1605
|
-
date: (value, format) => date(locales, value, style(format) || format),
|
|
1606
|
-
time: (value, format) => time(locales, value, style(format) || format)
|
|
1607
|
-
};
|
|
1608
|
-
};
|
|
1609
|
-
var selectFormatter = (value, rules) => {
|
|
1610
|
-
var _a;
|
|
1611
|
-
return (_a = rules[value]) != null ? _a : rules.other;
|
|
1612
|
-
};
|
|
1613
|
-
function interpolate(translation, locale, locales) {
|
|
1614
|
-
return (values = {}, formats) => {
|
|
1615
|
-
const formatters = getDefaultFormats(locale, locales, formats);
|
|
1616
|
-
const formatMessage = (tokens, replaceOctothorpe = false) => {
|
|
1617
|
-
if (!Array.isArray(tokens))
|
|
1618
|
-
return tokens;
|
|
1619
|
-
return tokens.reduce((message, token) => {
|
|
1620
|
-
if (token === "#" && replaceOctothorpe) {
|
|
1621
|
-
return message + OCTOTHORPE_PH;
|
|
1622
|
-
}
|
|
1623
|
-
if (isString(token)) {
|
|
1624
|
-
return message + token;
|
|
1625
|
-
}
|
|
1626
|
-
const [name, type, format] = token;
|
|
1627
|
-
let interpolatedFormat = {};
|
|
1628
|
-
if (type === "plural" || type === "selectordinal" || type === "select") {
|
|
1629
|
-
Object.entries(format).forEach(
|
|
1630
|
-
([key, value2]) => {
|
|
1631
|
-
interpolatedFormat[key] = formatMessage(
|
|
1632
|
-
value2,
|
|
1633
|
-
type === "plural" || type === "selectordinal"
|
|
1634
|
-
);
|
|
1635
|
-
}
|
|
1636
|
-
);
|
|
1637
|
-
} else {
|
|
1638
|
-
interpolatedFormat = format;
|
|
1639
|
-
}
|
|
1640
|
-
let value;
|
|
1641
|
-
if (type) {
|
|
1642
|
-
const formatter = formatters[type];
|
|
1643
|
-
value = formatter(values[name], interpolatedFormat);
|
|
1644
|
-
} else {
|
|
1645
|
-
value = values[name];
|
|
1646
|
-
}
|
|
1647
|
-
if (value == null) {
|
|
1648
|
-
return message;
|
|
1649
|
-
}
|
|
1650
|
-
return message + value;
|
|
1651
|
-
}, "");
|
|
1652
|
-
};
|
|
1653
|
-
const result = formatMessage(translation);
|
|
1654
|
-
if (isString(result) && UNICODE_REGEX.test(result)) {
|
|
1655
|
-
return (0, import_unraw.unraw)(result);
|
|
1656
|
-
}
|
|
1657
|
-
if (isString(result))
|
|
1658
|
-
return result;
|
|
1659
|
-
return result ? String(result) : "";
|
|
1660
|
-
};
|
|
1661
|
-
}
|
|
1662
|
-
var __defProp$1 = Object.defineProperty;
|
|
1663
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1664
|
-
var __publicField$1 = (obj, key, value) => {
|
|
1665
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1666
|
-
return value;
|
|
1667
|
-
};
|
|
1668
|
-
var EventEmitter = class {
|
|
1669
|
-
constructor() {
|
|
1670
|
-
__publicField$1(this, "_events", {});
|
|
1671
|
-
}
|
|
1672
|
-
on(event, listener) {
|
|
1673
|
-
var _a2;
|
|
1674
|
-
var _a;
|
|
1675
|
-
(_a2 = (_a = this._events)[event]) != null ? _a2 : _a[event] = [];
|
|
1676
|
-
this._events[event].push(listener);
|
|
1677
|
-
return () => this.removeListener(event, listener);
|
|
1678
|
-
}
|
|
1679
|
-
removeListener(event, listener) {
|
|
1680
|
-
const maybeListeners = this._getListeners(event);
|
|
1681
|
-
if (!maybeListeners)
|
|
1682
|
-
return;
|
|
1683
|
-
const index = maybeListeners.indexOf(listener);
|
|
1684
|
-
if (~index)
|
|
1685
|
-
maybeListeners.splice(index, 1);
|
|
1686
|
-
}
|
|
1687
|
-
emit(event, ...args) {
|
|
1688
|
-
const maybeListeners = this._getListeners(event);
|
|
1689
|
-
if (!maybeListeners)
|
|
1690
|
-
return;
|
|
1691
|
-
maybeListeners.map((listener) => listener.apply(this, args));
|
|
1692
|
-
}
|
|
1693
|
-
_getListeners(event) {
|
|
1694
|
-
const maybeListeners = this._events[event];
|
|
1695
|
-
return Array.isArray(maybeListeners) ? maybeListeners : false;
|
|
1696
|
-
}
|
|
1697
|
-
};
|
|
1698
|
-
var __defProp2 = Object.defineProperty;
|
|
1699
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1700
|
-
var __publicField2 = (obj, key, value) => {
|
|
1701
|
-
__defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1702
|
-
return value;
|
|
1703
|
-
};
|
|
1704
|
-
var I18n = class extends EventEmitter {
|
|
1705
|
-
constructor(params) {
|
|
1706
|
-
var _a;
|
|
1707
|
-
super();
|
|
1708
|
-
__publicField2(this, "_locale", "");
|
|
1709
|
-
__publicField2(this, "_locales");
|
|
1710
|
-
__publicField2(this, "_localeData", {});
|
|
1711
|
-
__publicField2(this, "_messages", {});
|
|
1712
|
-
__publicField2(this, "_missing");
|
|
1713
|
-
__publicField2(this, "_messageCompiler");
|
|
1714
|
-
__publicField2(this, "t", this._.bind(this));
|
|
1715
|
-
if (true) {
|
|
1716
|
-
this.setMessagesCompiler(compileMessage);
|
|
1717
|
-
}
|
|
1718
|
-
if (params.missing != null)
|
|
1719
|
-
this._missing = params.missing;
|
|
1720
|
-
if (params.messages != null)
|
|
1721
|
-
this.load(params.messages);
|
|
1722
|
-
if (params.localeData != null)
|
|
1723
|
-
this.loadLocaleData(params.localeData);
|
|
1724
|
-
if (typeof params.locale === "string" || params.locales) {
|
|
1725
|
-
this.activate((_a = params.locale) != null ? _a : defaultLocale, params.locales);
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
get locale() {
|
|
1729
|
-
return this._locale;
|
|
1730
|
-
}
|
|
1731
|
-
get locales() {
|
|
1732
|
-
return this._locales;
|
|
1733
|
-
}
|
|
1734
|
-
get messages() {
|
|
1735
|
-
var _a;
|
|
1736
|
-
return (_a = this._messages[this._locale]) != null ? _a : {};
|
|
1737
|
-
}
|
|
1738
|
-
/**
|
|
1739
|
-
* @deprecated this has no effect. Please remove this from the code. Deprecated in v4
|
|
1740
|
-
*/
|
|
1741
|
-
get localeData() {
|
|
1742
|
-
var _a;
|
|
1743
|
-
return (_a = this._localeData[this._locale]) != null ? _a : {};
|
|
1744
|
-
}
|
|
1745
|
-
_loadLocaleData(locale, localeData) {
|
|
1746
|
-
const maybeLocaleData = this._localeData[locale];
|
|
1747
|
-
if (!maybeLocaleData) {
|
|
1748
|
-
this._localeData[locale] = localeData;
|
|
1749
|
-
} else {
|
|
1750
|
-
Object.assign(maybeLocaleData, localeData);
|
|
1751
|
-
}
|
|
1752
|
-
}
|
|
1753
|
-
/**
|
|
1754
|
-
* Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
|
|
1755
|
-
*
|
|
1756
|
-
* In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
|
|
1757
|
-
* By default, message catalogs should be precompiled during the build process. However,
|
|
1758
|
-
* if you need to compile catalogs at runtime, you can use this method to set a message compiler.
|
|
1759
|
-
*
|
|
1760
|
-
* Example usage:
|
|
1761
|
-
*
|
|
1762
|
-
* ```ts
|
|
1763
|
-
* import { compileMessage } from "@lingui/message-utils/compileMessage";
|
|
1764
|
-
*
|
|
1765
|
-
* i18n.setMessagesCompiler(compileMessage);
|
|
1766
|
-
* ```
|
|
1767
|
-
*/
|
|
1768
|
-
setMessagesCompiler(compiler) {
|
|
1769
|
-
this._messageCompiler = compiler;
|
|
1770
|
-
return this;
|
|
1771
|
-
}
|
|
1772
|
-
/**
|
|
1773
|
-
* @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
|
|
1774
|
-
*/
|
|
1775
|
-
loadLocaleData(localeOrAllData, localeData) {
|
|
1776
|
-
if (typeof localeOrAllData === "string") {
|
|
1777
|
-
this._loadLocaleData(localeOrAllData, localeData);
|
|
1778
|
-
} else {
|
|
1779
|
-
Object.keys(localeOrAllData).forEach(
|
|
1780
|
-
(locale) => this._loadLocaleData(locale, localeOrAllData[locale])
|
|
1781
|
-
);
|
|
1782
|
-
}
|
|
1783
|
-
this.emit("change");
|
|
1784
|
-
}
|
|
1785
|
-
_load(locale, messages12) {
|
|
1786
|
-
const maybeMessages = this._messages[locale];
|
|
1787
|
-
if (!maybeMessages) {
|
|
1788
|
-
this._messages[locale] = messages12;
|
|
1789
|
-
} else {
|
|
1790
|
-
Object.assign(maybeMessages, messages12);
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
load(localeOrMessages, messages12) {
|
|
1794
|
-
if (typeof localeOrMessages == "string" && typeof messages12 === "object") {
|
|
1795
|
-
this._load(localeOrMessages, messages12);
|
|
1796
|
-
} else {
|
|
1797
|
-
Object.entries(localeOrMessages).forEach(
|
|
1798
|
-
([locale, messages23]) => this._load(locale, messages23)
|
|
1799
|
-
);
|
|
1800
|
-
}
|
|
1801
|
-
this.emit("change");
|
|
1802
|
-
}
|
|
1803
|
-
/**
|
|
1804
|
-
* @param options {@link LoadAndActivateOptions}
|
|
1805
|
-
*/
|
|
1806
|
-
loadAndActivate({ locale, locales, messages: messages12 }) {
|
|
1807
|
-
this._locale = locale;
|
|
1808
|
-
this._locales = locales || void 0;
|
|
1809
|
-
this._messages[this._locale] = messages12;
|
|
1810
|
-
this.emit("change");
|
|
1811
|
-
}
|
|
1812
|
-
activate(locale, locales) {
|
|
1813
|
-
if (true) {
|
|
1814
|
-
if (!this._messages[locale]) {
|
|
1815
|
-
console.warn(`Messages for locale "${locale}" not loaded.`);
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
this._locale = locale;
|
|
1819
|
-
this._locales = locales;
|
|
1820
|
-
this.emit("change");
|
|
1821
|
-
}
|
|
1822
|
-
_(id, values, options) {
|
|
1823
|
-
if (!this.locale) {
|
|
1824
|
-
throw new Error(
|
|
1825
|
-
"Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic."
|
|
1826
|
-
);
|
|
1827
|
-
}
|
|
1828
|
-
let message = options == null ? void 0 : options.message;
|
|
1829
|
-
if (!id) {
|
|
1830
|
-
id = "";
|
|
1831
|
-
}
|
|
1832
|
-
if (!isString(id)) {
|
|
1833
|
-
values = id.values || values;
|
|
1834
|
-
message = id.message;
|
|
1835
|
-
id = id.id;
|
|
1836
|
-
}
|
|
1837
|
-
const messageForId = this.messages[id];
|
|
1838
|
-
const messageMissing = messageForId === void 0;
|
|
1839
|
-
const missing = this._missing;
|
|
1840
|
-
if (missing && messageMissing) {
|
|
1841
|
-
return isFunction(missing) ? missing(this._locale, id) : missing;
|
|
1842
|
-
}
|
|
1843
|
-
if (messageMissing) {
|
|
1844
|
-
this.emit("missing", { id, locale: this._locale });
|
|
1845
|
-
}
|
|
1846
|
-
let translation = messageForId || message || id;
|
|
1847
|
-
if (isString(translation)) {
|
|
1848
|
-
if (this._messageCompiler) {
|
|
1849
|
-
translation = this._messageCompiler(translation);
|
|
1850
|
-
} else {
|
|
1851
|
-
console.warn(`Uncompiled message detected! Message:
|
|
1852
|
-
|
|
1853
|
-
> ${translation}
|
|
1854
|
-
|
|
1855
|
-
That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
|
|
1856
|
-
ICU features such as interpolation and plurals will not work properly for that message.
|
|
1857
|
-
|
|
1858
|
-
Please compile your catalog first.
|
|
1859
|
-
`);
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
1862
|
-
if (isString(translation) && UNICODE_REGEX.test(translation))
|
|
1863
|
-
return JSON.parse(`"${translation}"`);
|
|
1864
|
-
if (isString(translation))
|
|
1865
|
-
return translation;
|
|
1866
|
-
return interpolate(
|
|
1867
|
-
translation,
|
|
1868
|
-
this._locale,
|
|
1869
|
-
this._locales
|
|
1870
|
-
)(values, options == null ? void 0 : options.formats);
|
|
1871
|
-
}
|
|
1872
|
-
date(value, format) {
|
|
1873
|
-
return date(this._locales || this._locale, value, format);
|
|
1874
|
-
}
|
|
1875
|
-
number(value, format) {
|
|
1876
|
-
return number(this._locales || this._locale, value, format);
|
|
1877
|
-
}
|
|
1878
|
-
};
|
|
1879
|
-
function setupI18n(params = {}) {
|
|
1880
|
-
return new I18n(params);
|
|
1881
|
-
}
|
|
1882
|
-
var i18n = setupI18n();
|
|
1883
|
-
|
|
1884
|
-
// packages/modal/modal-header.ts
|
|
1885
|
-
import { property, query, state } from "lit/decorators.js";
|
|
1886
|
-
|
|
1887
|
-
// node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-p_f73b1d3c5bd9121d6f30248535f1f172/node_modules/@warp-ds/icons/dist/elements/arrow-left-16.js
|
|
1888
|
-
import { LitElement as LitElement2 } from "lit";
|
|
1889
|
-
import { unsafeStatic, html as html2 } from "lit/static-html.js";
|
|
1890
|
-
var messages = JSON.parse('{"icon.title.arrow-left":["Pil som peker mot venstre"]}');
|
|
1891
|
-
var messages2 = JSON.parse('{"icon.title.arrow-left":["Leftward-pointing arrow"]}');
|
|
1892
|
-
var messages3 = JSON.parse('{"icon.title.arrow-left":["Vasemmalle osoittava nuoli"]}');
|
|
1893
|
-
var messages4 = JSON.parse('{"icon.title.arrow-left":["Pil til venstre"]}');
|
|
1894
|
-
var messages5 = JSON.parse('{"icon.title.arrow-left":["Pil som pekar v\xE4nster"]}');
|
|
1895
|
-
var supportedLocales = ["en", "nb", "fi", "da", "sv"];
|
|
1896
|
-
var defaultLocale2 = "en";
|
|
1897
|
-
var detectByBrand = () => {
|
|
1898
|
-
var _a;
|
|
1899
|
-
let value;
|
|
1900
|
-
switch ((_a = process == null ? void 0 : process.env) == null ? void 0 : _a.NMP_BRAND) {
|
|
1901
|
-
case "FINN":
|
|
1902
|
-
value = "nb";
|
|
1903
|
-
break;
|
|
1904
|
-
case "TORI":
|
|
1905
|
-
value = "fi";
|
|
1906
|
-
break;
|
|
1907
|
-
case "BLOCKET":
|
|
1908
|
-
value = "sv";
|
|
1909
|
-
break;
|
|
1910
|
-
case "DBA":
|
|
1911
|
-
value = "da";
|
|
1912
|
-
break;
|
|
1913
|
-
default:
|
|
1914
|
-
value = "en";
|
|
1915
|
-
}
|
|
1916
|
-
return value;
|
|
1917
|
-
};
|
|
1918
|
-
var detectByHost = () => {
|
|
1919
|
-
var _a;
|
|
1920
|
-
const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
|
|
1921
|
-
if (hostname == null ? void 0 : hostname.includes("finn")) {
|
|
1922
|
-
return "nb";
|
|
1923
|
-
} else if (hostname.includes("tori")) {
|
|
1924
|
-
return "fi";
|
|
1925
|
-
} else if (hostname.includes("blocket")) {
|
|
1926
|
-
return "sv";
|
|
1927
|
-
} else if (hostname.includes("dba")) {
|
|
1928
|
-
return "da";
|
|
1929
|
-
} else {
|
|
1930
|
-
return defaultLocale2;
|
|
1931
|
-
}
|
|
1932
|
-
};
|
|
1933
|
-
var getSupportedLocale = (usedLocale) => {
|
|
1934
|
-
return supportedLocales.find(
|
|
1935
|
-
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
1936
|
-
) || detectByHost();
|
|
1937
|
-
};
|
|
1938
|
-
function detectLocale() {
|
|
1939
|
-
var _a;
|
|
1940
|
-
if (typeof window === "undefined") {
|
|
1941
|
-
const serverLocale = detectByBrand();
|
|
1942
|
-
return getSupportedLocale(serverLocale);
|
|
1943
|
-
}
|
|
1944
|
-
try {
|
|
1945
|
-
const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
|
|
1946
|
-
const hostLocale = detectByHost();
|
|
1947
|
-
if (!supportedLocales.includes(htmlLocale)) {
|
|
1948
|
-
console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
|
|
1949
|
-
return getSupportedLocale(hostLocale);
|
|
1950
|
-
}
|
|
1951
|
-
return getSupportedLocale(htmlLocale != null ? htmlLocale : hostLocale);
|
|
1952
|
-
} catch (e) {
|
|
1953
|
-
console.warn("could not detect locale, falling back to source locale", e);
|
|
1954
|
-
return defaultLocale2;
|
|
1955
|
-
}
|
|
1956
|
-
}
|
|
1957
|
-
var getMessages = (locale, enMsg, nbMsg, fiMsg, daMsg, svMsg) => {
|
|
1958
|
-
if (locale === "nb") return nbMsg;
|
|
1959
|
-
if (locale === "fi") return fiMsg;
|
|
1960
|
-
if (locale === "da") return daMsg;
|
|
1961
|
-
if (locale === "sv") return svMsg;
|
|
1962
|
-
return enMsg;
|
|
1963
|
-
};
|
|
1964
|
-
var activateI18n = (enMessages, nbMessages, fiMessages, daMessages, svMessages) => {
|
|
1965
|
-
const locale = detectLocale();
|
|
1966
|
-
const messages62 = getMessages(locale, enMessages, nbMessages, fiMessages, daMessages, svMessages);
|
|
1967
|
-
i18n.load(locale, messages62);
|
|
1968
|
-
i18n.activate(locale);
|
|
1969
|
-
};
|
|
1970
|
-
activateI18n(messages2, messages, messages3, messages4, messages5);
|
|
1971
|
-
var IconArrowLeft16 = class extends LitElement2 {
|
|
1972
|
-
render() {
|
|
1973
|
-
const title = i18n.t({ message: `Leftward-pointing arrow`, id: "icon.title.arrow-left", comment: "Title for table arrow left icon" });
|
|
1974
|
-
return html2`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-arrow-left-16-part">${unsafeStatic(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-width="1.5" d="M5.222 8h6.667"></path><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7.444 11.75 4.111 8l3.333-3.75"></path></svg>`;
|
|
1975
|
-
}
|
|
1976
|
-
};
|
|
1977
|
-
if (!customElements.get("w-icon-arrow-left-16")) {
|
|
1978
|
-
customElements.define("w-icon-arrow-left-16", IconArrowLeft16);
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
// node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-p_f73b1d3c5bd9121d6f30248535f1f172/node_modules/@warp-ds/icons/dist/elements/close-16.js
|
|
1982
|
-
import { LitElement as LitElement3 } from "lit";
|
|
1983
|
-
import { unsafeStatic as unsafeStatic2, html as html3 } from "lit/static-html.js";
|
|
1984
|
-
var messages6 = JSON.parse('{"icon.title.close":["Kryss"]}');
|
|
1985
|
-
var messages22 = JSON.parse('{"icon.title.close":["Cross"]}');
|
|
1986
|
-
var messages32 = JSON.parse('{"icon.title.close":["Rasti"]}');
|
|
1987
|
-
var messages42 = JSON.parse('{"icon.title.close":["Kryds"]}');
|
|
1988
|
-
var messages52 = JSON.parse('{"icon.title.close":["Kryss"]}');
|
|
1989
|
-
var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
|
|
1990
|
-
var defaultLocale3 = "en";
|
|
1991
|
-
var detectByBrand2 = () => {
|
|
1992
|
-
var _a;
|
|
1993
|
-
let value;
|
|
1994
|
-
switch ((_a = process == null ? void 0 : process.env) == null ? void 0 : _a.NMP_BRAND) {
|
|
1995
|
-
case "FINN":
|
|
1996
|
-
value = "nb";
|
|
1997
|
-
break;
|
|
1998
|
-
case "TORI":
|
|
1999
|
-
value = "fi";
|
|
2000
|
-
break;
|
|
2001
|
-
case "BLOCKET":
|
|
2002
|
-
value = "sv";
|
|
2003
|
-
break;
|
|
2004
|
-
case "DBA":
|
|
2005
|
-
value = "da";
|
|
2006
|
-
break;
|
|
2007
|
-
default:
|
|
2008
|
-
value = "en";
|
|
2009
|
-
}
|
|
2010
|
-
return value;
|
|
2011
|
-
};
|
|
2012
|
-
var detectByHost2 = () => {
|
|
2013
|
-
var _a;
|
|
2014
|
-
const hostname = (_a = document == null ? void 0 : document.location) == null ? void 0 : _a.hostname;
|
|
2015
|
-
if (hostname == null ? void 0 : hostname.includes("finn")) {
|
|
2016
|
-
return "nb";
|
|
2017
|
-
} else if (hostname.includes("tori")) {
|
|
2018
|
-
return "fi";
|
|
2019
|
-
} else if (hostname.includes("blocket")) {
|
|
2020
|
-
return "sv";
|
|
2021
|
-
} else if (hostname.includes("dba")) {
|
|
2022
|
-
return "da";
|
|
2023
|
-
} else {
|
|
2024
|
-
return defaultLocale3;
|
|
2025
|
-
}
|
|
2026
|
-
};
|
|
2027
|
-
var getSupportedLocale2 = (usedLocale) => {
|
|
2028
|
-
return supportedLocales2.find(
|
|
2029
|
-
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
2030
|
-
) || detectByHost2();
|
|
2031
|
-
};
|
|
2032
|
-
function detectLocale2() {
|
|
2033
|
-
var _a;
|
|
2034
|
-
if (typeof window === "undefined") {
|
|
2035
|
-
const serverLocale = detectByBrand2();
|
|
2036
|
-
return getSupportedLocale2(serverLocale);
|
|
2037
|
-
}
|
|
2038
|
-
try {
|
|
2039
|
-
const htmlLocale = (_a = document == null ? void 0 : document.documentElement) == null ? void 0 : _a.lang;
|
|
2040
|
-
const hostLocale = detectByHost2();
|
|
2041
|
-
if (!supportedLocales2.includes(htmlLocale)) {
|
|
2042
|
-
console.warn("Unsupported locale set in html lang tag, falling back to detection by hostname");
|
|
2043
|
-
return getSupportedLocale2(hostLocale);
|
|
2044
|
-
}
|
|
2045
|
-
return getSupportedLocale2(htmlLocale != null ? htmlLocale : hostLocale);
|
|
2046
|
-
} catch (e) {
|
|
2047
|
-
console.warn("could not detect locale, falling back to source locale", e);
|
|
2048
|
-
return defaultLocale3;
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
var getMessages2 = (locale, enMsg, nbMsg, fiMsg, daMsg, svMsg) => {
|
|
2052
|
-
if (locale === "nb") return nbMsg;
|
|
2053
|
-
if (locale === "fi") return fiMsg;
|
|
2054
|
-
if (locale === "da") return daMsg;
|
|
2055
|
-
if (locale === "sv") return svMsg;
|
|
2056
|
-
return enMsg;
|
|
2057
|
-
};
|
|
2058
|
-
var activateI18n2 = (enMessages, nbMessages, fiMessages, daMessages, svMessages) => {
|
|
2059
|
-
const locale = detectLocale2();
|
|
2060
|
-
const messages62 = getMessages2(locale, enMessages, nbMessages, fiMessages, daMessages, svMessages);
|
|
2061
|
-
i18n.load(locale, messages62);
|
|
2062
|
-
i18n.activate(locale);
|
|
2063
|
-
};
|
|
2064
|
-
activateI18n2(messages22, messages6, messages32, messages42, messages52);
|
|
2065
|
-
var IconClose16 = class extends LitElement3 {
|
|
2066
|
-
render() {
|
|
2067
|
-
const title = i18n.t({ message: `Cross`, id: "icon.title.close", comment: "Title for close icon" });
|
|
2068
|
-
return html3`<svg xmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16" part="w-icon-close-16-part">${unsafeStatic2(`<title>${title}</title>`)}<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m12.5 3.5-9 9m0-9 9 9"></path></svg>`;
|
|
2069
|
-
}
|
|
2070
|
-
};
|
|
2071
|
-
if (!customElements.get("w-icon-close-16")) {
|
|
2072
|
-
customElements.define("w-icon-close-16", IconClose16);
|
|
2073
|
-
}
|
|
2074
|
-
|
|
2075
|
-
// packages/i18n.ts
|
|
2076
|
-
var supportedLocales3 = ["en", "nb", "fi", "da", "sv"];
|
|
2077
|
-
var defaultLocale4 = "en";
|
|
2078
|
-
var getSupportedLocale3 = (usedLocale) => {
|
|
2079
|
-
return supportedLocales3.find(
|
|
2080
|
-
(locale) => usedLocale === locale || usedLocale.toLowerCase().includes(locale)
|
|
2081
|
-
) || defaultLocale4;
|
|
2082
|
-
};
|
|
2083
|
-
function detectLocale3() {
|
|
2084
|
-
if (typeof window === "undefined") {
|
|
2085
|
-
const serverLocale = process.env.NMP_LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale;
|
|
2086
|
-
return getSupportedLocale3(serverLocale);
|
|
2087
|
-
}
|
|
2088
|
-
try {
|
|
2089
|
-
const htmlLocale = document.documentElement.lang;
|
|
2090
|
-
return getSupportedLocale3(htmlLocale);
|
|
2091
|
-
} catch (e) {
|
|
2092
|
-
console.warn("could not detect locale, falling back to source locale", e);
|
|
2093
|
-
return defaultLocale4;
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
var getMessages3 = (locale, enMsg, nbMsg, fiMsg, daMsg, svMsg) => {
|
|
2097
|
-
if (locale === "nb") return nbMsg;
|
|
2098
|
-
if (locale === "fi") return fiMsg;
|
|
2099
|
-
if (locale === "da") return daMsg;
|
|
2100
|
-
if (locale === "sv") return svMsg;
|
|
2101
|
-
return enMsg;
|
|
2102
|
-
};
|
|
2103
|
-
var activateI18n3 = (enMessages, nbMessages, fiMessages, daMessages, svMessages) => {
|
|
2104
|
-
const locale = detectLocale3();
|
|
2105
|
-
const messages12 = getMessages3(locale, enMessages, nbMessages, fiMessages, daMessages, svMessages);
|
|
2106
|
-
i18n.load(locale, messages12);
|
|
2107
|
-
i18n.activate(locale);
|
|
2108
|
-
};
|
|
2109
|
-
|
|
2110
|
-
// packages/modal/locales/da/messages.mjs
|
|
2111
|
-
var messages7 = JSON.parse('{"modal.aria.back":["Tilbage"],"modal.aria.close":["Luk"]}');
|
|
2112
|
-
|
|
2113
|
-
// packages/modal/locales/en/messages.mjs
|
|
2114
|
-
var messages8 = JSON.parse('{"modal.aria.back":["Back"],"modal.aria.close":["Close"]}');
|
|
2115
|
-
|
|
2116
|
-
// packages/modal/locales/fi/messages.mjs
|
|
2117
|
-
var messages9 = JSON.parse('{"modal.aria.back":["Takaisin"],"modal.aria.close":["Sulje"]}');
|
|
2118
|
-
|
|
2119
|
-
// packages/modal/locales/nb/messages.mjs
|
|
2120
|
-
var messages10 = JSON.parse('{"modal.aria.back":["Tilbake"],"modal.aria.close":["Lukk"]}');
|
|
2121
|
-
|
|
2122
|
-
// packages/modal/locales/sv/messages.mjs
|
|
2123
|
-
var messages11 = JSON.parse('{"modal.aria.back":["Tillbaka"],"modal.aria.close":["St\xE4ng"]}');
|
|
2124
|
-
|
|
2125
|
-
// packages/modal/modal-header.ts
|
|
2126
|
-
var ModalHeader = class extends CanCloseMixin(LitElement4) {
|
|
2127
|
-
constructor() {
|
|
2128
|
-
super();
|
|
2129
|
-
this._hasTopContent = false;
|
|
2130
|
-
activateI18n3(messages8, messages10, messages9, messages7, messages11);
|
|
2131
|
-
}
|
|
2132
|
-
render() {
|
|
2133
|
-
return html4`
|
|
2134
|
-
<div class="header">
|
|
2135
|
-
<slot name="top" @slotchange=${this.handleTopSlotChange}></slot>
|
|
2136
|
-
<div class="${this._hasTopContent ? "" : "header-title-bar"}">
|
|
2137
|
-
${this.backButton}
|
|
2138
|
-
<h1 class="title-el ${this.titleClasses}">${this.title}</h1>
|
|
2139
|
-
${this.closeButton}
|
|
2140
|
-
</div>
|
|
2141
|
-
</div>
|
|
2142
|
-
`;
|
|
2143
|
-
}
|
|
2144
|
-
async willUpdate(changedProperties) {
|
|
2145
|
-
if (changedProperties.has("back")) {
|
|
2146
|
-
const move = new Move(this.titleEl);
|
|
2147
|
-
move.when(async () => {
|
|
2148
|
-
await this.updateComplete;
|
|
2149
|
-
});
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
get titleClasses() {
|
|
2153
|
-
return [
|
|
2154
|
-
"header-title",
|
|
2155
|
-
this.back ? "header-title-with-back-button" : "header-title-without-back-button",
|
|
2156
|
-
this._hasTopContent ? "header-title-with-top-area" : ""
|
|
2157
|
-
].join(" ");
|
|
2158
|
-
}
|
|
2159
|
-
get backButton() {
|
|
2160
|
-
return this.back && !this._hasTopContent ? html4`<button
|
|
2161
|
-
type="button"
|
|
2162
|
-
aria-label="${i18n._({
|
|
2163
|
-
id: "modal.aria.back",
|
|
2164
|
-
message: "Back",
|
|
2165
|
-
comment: "Aria label for the back button in modal"
|
|
2166
|
-
})}"
|
|
2167
|
-
class="header-button header-button-left"
|
|
2168
|
-
@click="${this.emitBack}">
|
|
2169
|
-
<w-icon-arrow-left-16></w-icon-arrow-left-16>
|
|
2170
|
-
</button>` : nothing;
|
|
2171
|
-
}
|
|
2172
|
-
get closeButton() {
|
|
2173
|
-
if (this.noClose) return nothing;
|
|
2174
|
-
return html4`<button
|
|
2175
|
-
type="button"
|
|
2176
|
-
aria-label="${i18n._({
|
|
2177
|
-
id: "modal.aria.close",
|
|
2178
|
-
message: "Close",
|
|
2179
|
-
comment: "Aria label for the close button in modal"
|
|
2180
|
-
})}"
|
|
2181
|
-
class="header-button ${this._hasTopContent ? "header-close-button-on-image" : "header-close-button"}"
|
|
2182
|
-
@click="${this.close}">
|
|
2183
|
-
<w-icon-close-16></w-icon-close-16>
|
|
2184
|
-
</button>`;
|
|
2185
|
-
}
|
|
2186
|
-
emitBack() {
|
|
2187
|
-
this.dispatchEvent(new CustomEvent("backClicked", { bubbles: true, composed: true }));
|
|
2188
|
-
}
|
|
2189
|
-
handleTopSlotChange(slotEvent) {
|
|
2190
|
-
const topContent = slotEvent.target.assignedElements({ flatten: true });
|
|
2191
|
-
this._hasTopContent = !!topContent.length;
|
|
2192
|
-
}
|
|
2193
|
-
};
|
|
2194
|
-
ModalHeader.styles = css2`
|
|
2195
|
-
.header {
|
|
2196
|
-
position: relative;
|
|
2197
|
-
padding-bottom: 0.8rem;
|
|
2198
|
-
}
|
|
2199
|
-
.header-title-bar {
|
|
2200
|
-
display:grid;
|
|
2201
|
-
flex-shrink:0 !important;
|
|
2202
|
-
gap:1.2rem;
|
|
2203
|
-
grid-template-columns:auto 1fr auto;
|
|
2204
|
-
align-items:flex-start;
|
|
2205
|
-
padding-left:1.6rem;
|
|
2206
|
-
padding-right:1.6rem;
|
|
2207
|
-
padding-top:1.6rem;
|
|
2208
|
-
}
|
|
2209
|
-
.header-title {
|
|
2210
|
-
font-weight:700;
|
|
2211
|
-
font-size:var(--w-font-size-l);
|
|
2212
|
-
line-height:var(--w-line-height-l);
|
|
2213
|
-
align-self:center;
|
|
2214
|
-
margin: 0;
|
|
2215
|
-
}
|
|
2216
|
-
.header-title-with-back-button {
|
|
2217
|
-
justify-self:center;
|
|
2218
|
-
}
|
|
2219
|
-
.header-title-without-back-button {
|
|
2220
|
-
grid-column:span 2/span 2;
|
|
2221
|
-
}
|
|
2222
|
-
.header-title-with-top-area {
|
|
2223
|
-
padding-left:1.6rem;
|
|
2224
|
-
padding-right:1.6rem;
|
|
2225
|
-
padding-top:1.6rem;
|
|
2226
|
-
}
|
|
2227
|
-
.header-button:hover {
|
|
2228
|
-
-webkit-background-clip:padding-box;
|
|
2229
|
-
background-clip:padding-box;
|
|
2230
|
-
}
|
|
2231
|
-
.header-button:focus, .header-button:focus-visible {
|
|
2232
|
-
outline:2px solid var(--w-s-color-border-focus);
|
|
2233
|
-
outline-offset:var(--w-outline-offset, 1px);
|
|
2234
|
-
}
|
|
2235
|
-
.header-button:not(:focus-visible){
|
|
2236
|
-
outline:none;
|
|
2237
|
-
}
|
|
2238
|
-
.header-button {
|
|
2239
|
-
border-width:0;
|
|
2240
|
-
border-radius:9999px;
|
|
2241
|
-
display:inline-flex;
|
|
2242
|
-
align-items:center;
|
|
2243
|
-
justify-content:center;
|
|
2244
|
-
min-height:40px;
|
|
2245
|
-
min-width:40px;
|
|
2246
|
-
padding:0.4rem;
|
|
2247
|
-
font-weight:700;
|
|
2248
|
-
transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;
|
|
2249
|
-
transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);
|
|
2250
|
-
transition-duration:150ms;
|
|
2251
|
-
font-size:var(--w-font-size-m);line-height:var(--w-line-height-m);
|
|
2252
|
-
line-height:2.4rem;
|
|
2253
|
-
}
|
|
2254
|
-
.header-button-left {
|
|
2255
|
-
background-color:transparent;
|
|
2256
|
-
color:var(--w-s-color-icon);
|
|
2257
|
-
margin-left:-0.8rem;
|
|
2258
|
-
}
|
|
2259
|
-
.header-button-left:hover {
|
|
2260
|
-
background-color:var(--w-color-button-pill-background-hover);
|
|
2261
|
-
}
|
|
2262
|
-
.header-button-left:active {
|
|
2263
|
-
background-color:var(--w-color-button-pill-background-active);
|
|
2264
|
-
}
|
|
2265
|
-
.header-close-button {
|
|
2266
|
-
background-color:transparent;
|
|
2267
|
-
color:var(--w-s-color-icon);
|
|
2268
|
-
margin-right:-0.8rem;
|
|
2269
|
-
}
|
|
2270
|
-
.header-close-button:hover {
|
|
2271
|
-
background-color:var(--w-color-button-pill-background-hover);
|
|
2272
|
-
}
|
|
2273
|
-
.header-close-button:active {
|
|
2274
|
-
background-color:var(--w-color-button-pill-background-active);
|
|
2275
|
-
}
|
|
2276
|
-
.header-close-button-on-image {
|
|
2277
|
-
background-color:rgba(var(--w-rgb-black),0.7);
|
|
2278
|
-
right:0.8rem;
|
|
2279
|
-
top:0.8rem;
|
|
2280
|
-
position:absolute;
|
|
2281
|
-
z-index:10;
|
|
2282
|
-
color:var(--w-s-color-text-inverted);
|
|
2283
|
-
}
|
|
2284
|
-
.header-close-button-on-image:hover {
|
|
2285
|
-
background-color:rgba(var(--w-rgb-black),0.85);
|
|
2286
|
-
}
|
|
2287
|
-
.header-close-button-on-image:active {
|
|
2288
|
-
background-color:var(--w-black);
|
|
2289
|
-
}
|
|
2290
|
-
@media (min-width: 480px){
|
|
2291
|
-
.header-title-bar {
|
|
2292
|
-
padding-left:3.2rem;
|
|
2293
|
-
padding-right:3.2rem;
|
|
2294
|
-
padding-top:2.4rem;
|
|
2295
|
-
}
|
|
2296
|
-
.header-title-with-top-area {
|
|
2297
|
-
padding-left:3.2rem;
|
|
2298
|
-
padding-right:3.2rem;
|
|
2299
|
-
}
|
|
2300
|
-
.header-button {
|
|
2301
|
-
min-height:32px;
|
|
2302
|
-
min-width:32px;
|
|
2303
|
-
}
|
|
2304
|
-
}
|
|
2305
|
-
`;
|
|
2306
|
-
__decorateClass([
|
|
2307
|
-
property({ type: String })
|
|
2308
|
-
], ModalHeader.prototype, "title", 2);
|
|
2309
|
-
__decorateClass([
|
|
2310
|
-
property({ type: Boolean })
|
|
2311
|
-
], ModalHeader.prototype, "back", 2);
|
|
2312
|
-
__decorateClass([
|
|
2313
|
-
property({ type: Boolean, attribute: "no-close" })
|
|
2314
|
-
], ModalHeader.prototype, "noClose", 2);
|
|
2315
|
-
__decorateClass([
|
|
2316
|
-
state()
|
|
2317
|
-
], ModalHeader.prototype, "_hasTopContent", 2);
|
|
2318
|
-
__decorateClass([
|
|
2319
|
-
query(".title-el")
|
|
2320
|
-
], ModalHeader.prototype, "titleEl", 2);
|
|
2321
|
-
|
|
2322
|
-
// packages/modal/modal-main.ts
|
|
2323
|
-
import { css as css3, html as html5, LitElement as LitElement5 } from "lit";
|
|
2324
|
-
|
|
2325
|
-
// node_modules/.pnpm/scroll-doctor@2.0.2/node_modules/scroll-doctor/dist/scroll-doctor.js
|
|
2326
|
-
var n = [];
|
|
2327
|
-
var c = { documentElement: {}, body: {} };
|
|
2328
|
-
var i = Object.freeze({
|
|
2329
|
-
// html
|
|
2330
|
-
documentElement: {
|
|
2331
|
-
"scrollbar-gutter": "stable"
|
|
2332
|
-
},
|
|
2333
|
-
body: {
|
|
2334
|
-
overflow: "hidden",
|
|
2335
|
-
position: "relative",
|
|
2336
|
-
height: "100%"
|
|
2337
|
-
}
|
|
2338
|
-
});
|
|
2339
|
-
var r = (t) => {
|
|
2340
|
-
var _a;
|
|
2341
|
-
t.touches.length > 1 || ((_a = t.preventDefault) == null ? void 0 : _a.call(t));
|
|
2342
|
-
};
|
|
2343
|
-
var h = (t) => ([e, s]) => {
|
|
2344
|
-
c[t][e] = document[t].style[e], document[t].style[e] = s;
|
|
2345
|
-
};
|
|
2346
|
-
var a = () => Object.entries(i).forEach(([t, e]) => {
|
|
2347
|
-
Object.entries(e).forEach(h(t));
|
|
2348
|
-
});
|
|
2349
|
-
var d = (t) => ([e, s]) => {
|
|
2350
|
-
document[t].style[e] = c[t][e];
|
|
2351
|
-
};
|
|
2352
|
-
var f = () => Object.entries(c).forEach(([t, e]) => {
|
|
2353
|
-
Object.entries(e).forEach(d(t));
|
|
2354
|
-
});
|
|
2355
|
-
var m = (t) => t.scrollHeight - Math.abs(t.scrollTop) === t.clientHeight;
|
|
2356
|
-
function y(t) {
|
|
2357
|
-
let e = -1;
|
|
2358
|
-
const s = (o) => {
|
|
2359
|
-
if (o.targetTouches.length !== 1)
|
|
2360
|
-
return;
|
|
2361
|
-
const l = o.targetTouches[0].clientY - e;
|
|
2362
|
-
return t.scrollTop === 0 && l > 0 || m(t) && l < 0 ? r(o) : (o.stopPropagation(), true);
|
|
2363
|
-
};
|
|
2364
|
-
t.ontouchstart = (o) => {
|
|
2365
|
-
o.targetTouches.length === 1 && (e = o.targetTouches[0].clientY);
|
|
2366
|
-
}, t.ontouchmove = s;
|
|
2367
|
-
}
|
|
2368
|
-
function p(t) {
|
|
2369
|
-
t.ontouchstart = null, t.ontouchmove = null;
|
|
2370
|
-
}
|
|
2371
|
-
var u = (t) => () => document[t ? "addEventListener" : "removeEventListener"]("touchmove", r, { passive: false });
|
|
2372
|
-
var b = u(true);
|
|
2373
|
-
var g = u();
|
|
2374
|
-
function E(t) {
|
|
2375
|
-
if (!t)
|
|
2376
|
-
throw Error("Could not run setup, an element must be provided");
|
|
2377
|
-
n.some((e) => e === t) || (n.length || (a(), b()), y(t), n.push(t));
|
|
2378
|
-
}
|
|
2379
|
-
function T() {
|
|
2380
|
-
n.forEach(p), g(), f(), n = [];
|
|
2381
|
-
}
|
|
2382
|
-
|
|
2383
|
-
// packages/modal/modal-main.ts
|
|
2384
|
-
import { property as property2, query as query2 } from "lit/decorators.js";
|
|
2385
|
-
var ModalMain = class extends ProvidesCanCloseToSlotsMixin(LitElement5) {
|
|
2386
|
-
constructor() {
|
|
2387
|
-
super();
|
|
2388
|
-
this.interceptEscape = this.interceptEscape.bind(this);
|
|
2389
|
-
this.closeOnBackdropClick = this.closeOnBackdropClick.bind(this);
|
|
2390
|
-
this.eventPreventer = this.eventPreventer.bind(this);
|
|
2391
|
-
this.modifyBorderRadius = this.modifyBorderRadius.bind(this);
|
|
2392
|
-
}
|
|
2393
|
-
async open() {
|
|
2394
|
-
this.dialogEl.showModal();
|
|
2395
|
-
this.handleListeners();
|
|
2396
|
-
E(this.contentEl);
|
|
2397
|
-
await this.updateComplete;
|
|
2398
|
-
this.dispatchEvent(new CustomEvent("shown", { bubbles: true, composed: true }));
|
|
2399
|
-
}
|
|
2400
|
-
close() {
|
|
2401
|
-
this.handleListeners("removeEventListener");
|
|
2402
|
-
this.dialogEl.classList.add("close");
|
|
2403
|
-
this.dialogEl.addEventListener(
|
|
2404
|
-
"animationend",
|
|
2405
|
-
async () => {
|
|
2406
|
-
this.dialogEl.classList.remove("close");
|
|
2407
|
-
this.dialogEl.close();
|
|
2408
|
-
T();
|
|
2409
|
-
await this.updateComplete;
|
|
2410
|
-
this.dispatchEvent(new CustomEvent("hidden", { bubbles: true, composed: true }));
|
|
2411
|
-
},
|
|
2412
|
-
{ once: true }
|
|
2413
|
-
);
|
|
2414
|
-
}
|
|
2415
|
-
render() {
|
|
2416
|
-
return html5`
|
|
2417
|
-
<dialog class="dialog-el">
|
|
2418
|
-
<div class="dialog-inner-el">
|
|
2419
|
-
<slot name="header" @slotchange="${this.handleSlotChange}"></slot>
|
|
2420
|
-
<div class="content-el" id=${this.contentId}>
|
|
2421
|
-
<slot name="content" @slotchange="${this.handleSlotChange}"></slot>
|
|
2422
|
-
</div>
|
|
2423
|
-
<slot name="footer" @slotchange="${this.handleSlotChange}"></slot>
|
|
2424
|
-
</div>
|
|
2425
|
-
</dialog>
|
|
2426
|
-
`;
|
|
2427
|
-
}
|
|
2428
|
-
updated(changedProperties) {
|
|
2429
|
-
if (changedProperties.has("show")) this[this.show ? "open" : "close"]();
|
|
2430
|
-
}
|
|
2431
|
-
handleListeners(verb = "addEventListener") {
|
|
2432
|
-
document[verb]("keydown", this.interceptEscape);
|
|
2433
|
-
if (!this.ignoreBackdropClicks) this.dialogEl[verb]("mousedown", this.closeOnBackdropClick);
|
|
2434
|
-
this.dialogEl[verb]("close", this.eventPreventer);
|
|
2435
|
-
this.dialogEl[verb]("cancel", this.eventPreventer);
|
|
2436
|
-
this.dialogInnerEl[verb]("transitionend", this.modifyBorderRadius);
|
|
2437
|
-
}
|
|
2438
|
-
eventPreventer(evt) {
|
|
2439
|
-
evt.preventDefault();
|
|
2440
|
-
}
|
|
2441
|
-
closeOnBackdropClick(evt) {
|
|
2442
|
-
if (this.dialogEl === evt.target) this.close();
|
|
2443
|
-
}
|
|
2444
|
-
interceptEscape(evt) {
|
|
2445
|
-
if (evt.key === "Escape") {
|
|
2446
|
-
evt.preventDefault();
|
|
2447
|
-
this.close();
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
modifyBorderRadius() {
|
|
2451
|
-
if (this.dialogInnerEl.scrollHeight * 1.02 > innerHeight) this.dialogInnerEl.style.borderRadius = "0px";
|
|
2452
|
-
else this.dialogInnerEl.style.borderRadius = null;
|
|
2453
|
-
}
|
|
2454
|
-
};
|
|
2455
|
-
ModalMain.styles = [
|
|
2456
|
-
css3`
|
|
2457
|
-
.dialog-el {
|
|
2458
|
-
--w-modal-translate-distance: 100%;
|
|
2459
|
-
--w-modal-max-height:80%;
|
|
2460
|
-
--w-modal-width:640px;
|
|
2461
|
-
background-color:transparent;
|
|
2462
|
-
border-width:0;
|
|
2463
|
-
align-items:flex-end;
|
|
2464
|
-
inset:0rem;
|
|
2465
|
-
height:unset;
|
|
2466
|
-
max-height:unset;
|
|
2467
|
-
max-width:unset;
|
|
2468
|
-
width:unset;
|
|
2469
|
-
margin:auto;
|
|
2470
|
-
padding:0rem;
|
|
2471
|
-
backface-visibility:hidden;
|
|
2472
|
-
}
|
|
2473
|
-
.dialog-inner-el {
|
|
2474
|
-
will-change:height;
|
|
2475
|
-
border-radius:8px;
|
|
2476
|
-
display:flex;
|
|
2477
|
-
flex-direction:column;
|
|
2478
|
-
overflow:hidden;
|
|
2479
|
-
position:relative;
|
|
2480
|
-
background-color:var(--w-s-color-background);
|
|
2481
|
-
box-shadow:var(--w-shadow-m);
|
|
2482
|
-
height:var(--w-modal-height);
|
|
2483
|
-
max-height:var(--w-modal-max-height);
|
|
2484
|
-
min-height:var(--w-modal-min-height);
|
|
2485
|
-
width:var(--w-modal-width);
|
|
2486
|
-
backface-visibility:hidden;
|
|
2487
|
-
padding-bottom:calc(32px + env(safe-area-inset-bottom, 0px));
|
|
2488
|
-
transition-property:all;
|
|
2489
|
-
transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);
|
|
2490
|
-
transition-duration:150ms;
|
|
2491
|
-
transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);
|
|
2492
|
-
}
|
|
2493
|
-
.content-el {
|
|
2494
|
-
display:block;
|
|
2495
|
-
flex-shrink:1;
|
|
2496
|
-
flex-grow:1;
|
|
2497
|
-
overflow-x:hidden;
|
|
2498
|
-
overflow-y:auto;
|
|
2499
|
-
position:relative;
|
|
2500
|
-
margin-bottom:0rem;
|
|
2501
|
-
padding-left:1.6rem;
|
|
2502
|
-
padding-right:1.6rem;
|
|
2503
|
-
}
|
|
2504
|
-
@media (min-width: 480px) {
|
|
2505
|
-
.dialog-el {
|
|
2506
|
-
--w-modal-translate-distance: 50%;
|
|
2507
|
-
place-content:center;
|
|
2508
|
-
place-items:center;
|
|
2509
|
-
}
|
|
2510
|
-
.dialog-inner-el {
|
|
2511
|
-
margin-left:1.6rem;
|
|
2512
|
-
margin-right:1.6rem;
|
|
2513
|
-
padding-bottom:3.2rem;
|
|
2514
|
-
}
|
|
2515
|
-
.content-el {
|
|
2516
|
-
padding-left:3.2rem;
|
|
2517
|
-
padding-right:3.2rem;
|
|
2518
|
-
}
|
|
2519
|
-
}
|
|
2520
|
-
@media (max-width: 479.9px){
|
|
2521
|
-
.dialog-inner-el {
|
|
2522
|
-
border-bottom-left-radius:0;
|
|
2523
|
-
border-bottom-right-radius:0;
|
|
2524
|
-
}
|
|
2525
|
-
}
|
|
2526
|
-
.dialog-el[open] {
|
|
2527
|
-
animation: w-modal-in 0.3s ease-in-out forwards;
|
|
2528
|
-
display:flex;
|
|
2529
|
-
position:fixed;
|
|
2530
|
-
}
|
|
2531
|
-
.dialog-el.close {
|
|
2532
|
-
animation: w-modal-out 0.3s ease-in-out forwards;
|
|
2533
|
-
}
|
|
2534
|
-
.dialog-el[open]::backdrop {
|
|
2535
|
-
animation: backdrop-in 0.3s ease-in-out forwards;
|
|
2536
|
-
}
|
|
2537
|
-
.dialog-el.close::backdrop {
|
|
2538
|
-
animation: backdrop-out 0.3s ease-in-out forwards;
|
|
2539
|
-
}
|
|
2540
|
-
/* shouldn't need two (in/out) animations declared here, but reversing is being weird */
|
|
2541
|
-
@keyframes w-modal-in {
|
|
2542
|
-
from {
|
|
2543
|
-
transform: translateY(var(--w-modal-translate-distance));
|
|
2544
|
-
opacity: 0;
|
|
2545
|
-
}
|
|
2546
|
-
to {
|
|
2547
|
-
transform: translateY(0);
|
|
2548
|
-
opacity: 1;
|
|
2549
|
-
}
|
|
2550
|
-
}
|
|
2551
|
-
@keyframes w-modal-out {
|
|
2552
|
-
from {
|
|
2553
|
-
transform: translateY(0);
|
|
2554
|
-
opacity: 1;
|
|
2555
|
-
}
|
|
2556
|
-
to {
|
|
2557
|
-
transform: translateY(var(--w-modal-translate-distance));
|
|
2558
|
-
opacity: 0;
|
|
2559
|
-
}
|
|
2560
|
-
}
|
|
2561
|
-
@keyframes backdrop-in {
|
|
2562
|
-
from {
|
|
2563
|
-
background: transparent;
|
|
2564
|
-
}
|
|
2565
|
-
to {
|
|
2566
|
-
background: rgba(0, 0, 0, 0.25);
|
|
2567
|
-
}
|
|
2568
|
-
}
|
|
2569
|
-
@keyframes backdrop-out {
|
|
2570
|
-
from {
|
|
2571
|
-
background: rgba(0, 0, 0, 0.25);
|
|
2572
|
-
}
|
|
2573
|
-
to {
|
|
2574
|
-
background: transparent;
|
|
2575
|
-
}
|
|
2576
|
-
}
|
|
2577
|
-
`
|
|
2578
|
-
];
|
|
2579
|
-
__decorateClass([
|
|
2580
|
-
property2({ type: Boolean })
|
|
2581
|
-
], ModalMain.prototype, "show", 2);
|
|
2582
|
-
__decorateClass([
|
|
2583
|
-
property2({ type: String, attribute: "content-id" })
|
|
2584
|
-
], ModalMain.prototype, "contentId", 2);
|
|
2585
|
-
__decorateClass([
|
|
2586
|
-
property2({ type: Boolean, attribute: "ignore-backdrop-clicks" })
|
|
2587
|
-
], ModalMain.prototype, "ignoreBackdropClicks", 2);
|
|
2588
|
-
__decorateClass([
|
|
2589
|
-
query2(".dialog-el")
|
|
2590
|
-
], ModalMain.prototype, "dialogEl", 2);
|
|
2591
|
-
__decorateClass([
|
|
2592
|
-
query2(".dialog-inner-el")
|
|
2593
|
-
], ModalMain.prototype, "dialogInnerEl", 2);
|
|
2594
|
-
__decorateClass([
|
|
2595
|
-
query2(".content-el")
|
|
2596
|
-
], ModalMain.prototype, "contentEl", 2);
|
|
2597
|
-
|
|
2598
|
-
// packages/modal/index.js
|
|
2599
|
-
if (!customElements.get("w-modal")) {
|
|
2600
|
-
customElements.define("w-modal", ModalMain);
|
|
2601
|
-
customElements.define("w-modal-header", ModalHeader);
|
|
2602
|
-
customElements.define("w-modal-footer", ModalFooter);
|
|
2603
|
-
}
|
|
2604
|
-
export {
|
|
2605
|
-
CanCloseMixin as ModalCanCloseMixin,
|
|
2606
|
-
ProvidesCanCloseToSlotsMixin as ModalProvidesCanCloseToSlotsMixin,
|
|
2607
|
-
ModalMain as WarpModal,
|
|
2608
|
-
ModalFooter as WarpModalFooter,
|
|
2609
|
-
ModalHeader as WarpModalHeader
|
|
2610
|
-
};
|
|
2611
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { ModalFooter } from './modal-footer.js';
|
|
2
|
+
import { ModalHeader } from './modal-header.js';
|
|
3
|
+
import { ModalMain } from './modal-main.js';
|
|
4
|
+
import { CanCloseMixin, ProvidesCanCloseToSlotsMixin } from './util.js';
|
|
5
|
+
export { ModalMain as WarpModal, ModalHeader as WarpModalHeader, ModalFooter as WarpModalFooter, CanCloseMixin as ModalCanCloseMixin, ProvidesCanCloseToSlotsMixin as ModalProvidesCanCloseToSlotsMixin, };
|