@warp-ds/elements 2.1.0 → 2.1.1-next.2

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.
@@ -723,9 +723,9 @@ var require_moo = __commonJS({
723
723
  }
724
724
  });
725
725
 
726
- // node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/lexer.js
726
+ // node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js
727
727
  var require_lexer = __commonJS({
728
- "node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
728
+ "node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
729
729
  "use strict";
730
730
  var __importDefault = exports && exports.__importDefault || function(mod) {
731
731
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -738,7 +738,7 @@ var require_lexer = __commonJS({
738
738
  doubleapos: { match: "''", value: () => "'" },
739
739
  quoted: {
740
740
  lineBreaks: true,
741
- match: /'[{}#](?:[^]*?[^'])?'(?!')/u,
741
+ match: /'[{}#](?:[^']|'')*'(?!')/u,
742
742
  value: (src) => src.slice(1, -1).replace(/''/g, "'")
743
743
  },
744
744
  argument: {
@@ -790,12 +790,13 @@ var require_lexer = __commonJS({
790
790
  }
791
791
  });
792
792
 
793
- // node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/parser.js
793
+ // node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js
794
794
  var require_parser = __commonJS({
795
- "node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/parser.js"(exports) {
795
+ "node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js"(exports) {
796
796
  "use strict";
797
797
  Object.defineProperty(exports, "__esModule", { value: true });
798
- exports.parse = exports.ParseError = void 0;
798
+ exports.ParseError = void 0;
799
+ exports.parse = parse2;
799
800
  var lexer_js_1 = require_lexer();
800
801
  var getContext = (lt) => ({
801
802
  offset: lt.offset,
@@ -861,8 +862,9 @@ var require_parser = __commonJS({
861
862
  }
862
863
  checkSelectKey(lt, type, key) {
863
864
  if (key[0] === "=") {
864
- if (type === "select")
865
+ if (type === "select") {
865
866
  throw new ParseError(lt, `The case ${key} is not valid with select`);
867
+ }
866
868
  } else if (type !== "select") {
867
869
  const keys = type === "plural" ? this.cardinalKeys : this.ordinalKeys;
868
870
  if (this.strictPluralKeys && keys.length > 0 && !keys.includes(key)) {
@@ -880,10 +882,12 @@ var require_parser = __commonJS({
880
882
  for (const lt of this.lexer) {
881
883
  switch (lt.type) {
882
884
  case "offset":
883
- if (type === "select")
885
+ if (type === "select") {
884
886
  throw new ParseError(lt, "Unexpected plural offset for select");
885
- if (sel.cases.length > 0)
887
+ }
888
+ if (sel.cases.length > 0) {
886
889
  throw new ParseError(lt, "Plural offset must be set before cases");
890
+ }
887
891
  sel.pluralOffset = Number(lt.value);
888
892
  ctx.text += lt.text;
889
893
  ctx.lineBreaks += lt.lineBreaks;
@@ -923,11 +927,13 @@ var require_parser = __commonJS({
923
927
  const end = this.lexer.next();
924
928
  if (!end)
925
929
  throw new ParseError(null, "Unexpected message end");
926
- if (end.type !== "end")
930
+ if (end.type !== "end") {
927
931
  throw new ParseError(end, `Unexpected lexer token: ${end.type}`);
932
+ }
928
933
  ctx.text += end.text;
929
- if (isSelectType(argType.value.toLowerCase()))
934
+ if (isSelectType(argType.value.toLowerCase())) {
930
935
  throw new ParseError(argType, `Invalid type identifier: ${argType.value}`);
936
+ }
931
937
  return {
932
938
  type: "function",
933
939
  arg: lt.value,
@@ -941,8 +947,9 @@ var require_parser = __commonJS({
941
947
  throw new ParseError(argType, msg);
942
948
  }
943
949
  let param = this.parseBody(this.strict ? false : inPlural);
944
- if (this.strict && param.length > 0)
950
+ if (this.strict && param.length > 0) {
945
951
  param = strictArgStyleParam(lt, param);
952
+ }
946
953
  return {
947
954
  type: "function",
948
955
  arg: lt.value,
@@ -952,10 +959,11 @@ var require_parser = __commonJS({
952
959
  };
953
960
  }
954
961
  case "select":
955
- if (isSelectType(argType.value))
962
+ if (isSelectType(argType.value)) {
956
963
  return this.parseSelect(lt, inPlural, ctx, argType.value);
957
- else
964
+ } else {
958
965
  throw new ParseError(argType, `Unexpected select type ${argType.value}`);
966
+ }
959
967
  default:
960
968
  throw new ParseError(argType, `Unexpected lexer token: ${argType.type}`);
961
969
  }
@@ -1002,22 +1010,279 @@ var require_parser = __commonJS({
1002
1010
  const parser = new Parser(src, options);
1003
1011
  return parser.parse();
1004
1012
  }
1005
- exports.parse = parse2;
1006
1013
  }
1007
1014
  });
1008
1015
 
1009
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
1016
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/close-16.js
1010
1017
  import { LitElement } from "lit";
1011
1018
  import { unsafeStatic, html } from "lit/static-html.js";
1012
1019
 
1013
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1020
+ // node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_typescri_qfhfd5z2jpd4amxt2golzdalsi/node_modules/@lingui/core/dist/index.mjs
1014
1021
  var import_unraw = __toESM(require_dist(), 1);
1015
1022
 
1016
- // node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1023
+ // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1017
1024
  var import_parser = __toESM(require_parser(), 1);
1025
+ var DateFormatError = class extends Error {
1026
+ /** @internal */
1027
+ constructor(msg, token, type) {
1028
+ super(msg);
1029
+ this.token = token;
1030
+ this.type = type || "error";
1031
+ }
1032
+ };
1033
+ var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
1034
+ var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
1035
+ function yearOptions(token, onError) {
1036
+ switch (token.char) {
1037
+ case "y":
1038
+ return { year: numeric(token.width) };
1039
+ case "r":
1040
+ return { calendar: "gregory", year: "numeric" };
1041
+ case "u":
1042
+ case "U":
1043
+ case "Y":
1044
+ default:
1045
+ onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
1046
+ return { year: "numeric" };
1047
+ }
1048
+ }
1049
+ function monthStyle(token, onError) {
1050
+ switch (token.width) {
1051
+ case 1:
1052
+ return "numeric";
1053
+ case 2:
1054
+ return "2-digit";
1055
+ case 3:
1056
+ return "short";
1057
+ case 4:
1058
+ return "long";
1059
+ case 5:
1060
+ return "narrow";
1061
+ default:
1062
+ onError(`${token.desc} is not supported with width ${token.width}`);
1063
+ return void 0;
1064
+ }
1065
+ }
1066
+ function dayStyle(token, onError) {
1067
+ const { char, desc, width } = token;
1068
+ if (char === "d") {
1069
+ return numeric(width);
1070
+ } else {
1071
+ onError(`${desc} is not supported`);
1072
+ return void 0;
1073
+ }
1074
+ }
1075
+ function weekdayStyle(token, onError) {
1076
+ const { char, desc, width } = token;
1077
+ if ((char === "c" || char === "e") && width < 3) {
1078
+ const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
1079
+ onError(msg, DateFormatError.WARNING);
1080
+ }
1081
+ return alpha(width);
1082
+ }
1083
+ function hourOptions(token) {
1084
+ const hour = numeric(token.width);
1085
+ let hourCycle;
1086
+ switch (token.char) {
1087
+ case "h":
1088
+ hourCycle = "h12";
1089
+ break;
1090
+ case "H":
1091
+ hourCycle = "h23";
1092
+ break;
1093
+ case "k":
1094
+ hourCycle = "h24";
1095
+ break;
1096
+ case "K":
1097
+ hourCycle = "h11";
1098
+ break;
1099
+ }
1100
+ return hourCycle ? { hour, hourCycle } : { hour };
1101
+ }
1102
+ function timeZoneNameStyle(token, onError) {
1103
+ const { char, desc, width } = token;
1104
+ switch (char) {
1105
+ case "v":
1106
+ case "z":
1107
+ return width === 4 ? "long" : "short";
1108
+ case "V":
1109
+ if (width === 4)
1110
+ return "long";
1111
+ onError(`${desc} is not supported with width ${width}`);
1112
+ return void 0;
1113
+ case "X":
1114
+ onError(`${desc} is not supported`);
1115
+ return void 0;
1116
+ }
1117
+ return "short";
1118
+ }
1119
+ function compileOptions(token, onError) {
1120
+ switch (token.field) {
1121
+ case "era":
1122
+ return { era: alpha(token.width) };
1123
+ case "year":
1124
+ return yearOptions(token, onError);
1125
+ case "month":
1126
+ return { month: monthStyle(token, onError) };
1127
+ case "day":
1128
+ return { day: dayStyle(token, onError) };
1129
+ case "weekday":
1130
+ return { weekday: weekdayStyle(token, onError) };
1131
+ case "period":
1132
+ return void 0;
1133
+ case "hour":
1134
+ return hourOptions(token);
1135
+ case "min":
1136
+ return { minute: numeric(token.width) };
1137
+ case "sec":
1138
+ return { second: numeric(token.width) };
1139
+ case "tz":
1140
+ return { timeZoneName: timeZoneNameStyle(token, onError) };
1141
+ case "quarter":
1142
+ case "week":
1143
+ case "sec-frac":
1144
+ case "ms":
1145
+ onError(`${token.desc} is not supported`);
1146
+ }
1147
+ return void 0;
1148
+ }
1149
+ function getDateFormatOptions(tokens, timeZone, onError = (error) => {
1150
+ throw error;
1151
+ }) {
1152
+ const options = {
1153
+ timeZone
1154
+ };
1155
+ const fields2 = [];
1156
+ for (const token of tokens) {
1157
+ const { error, field, str } = token;
1158
+ if (error) {
1159
+ const dte = new DateFormatError(error.message, token);
1160
+ dte.stack = error.stack;
1161
+ onError(dte);
1162
+ }
1163
+ if (str) {
1164
+ const msg = `Ignoring string part: ${str}`;
1165
+ onError(new DateFormatError(msg, token, DateFormatError.WARNING));
1166
+ }
1167
+ if (field) {
1168
+ if (fields2.indexOf(field) === -1)
1169
+ fields2.push(field);
1170
+ else
1171
+ onError(new DateFormatError(`Duplicate ${field} token`, token));
1172
+ }
1173
+ const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
1174
+ if (opt)
1175
+ Object.assign(options, opt);
1176
+ }
1177
+ return options;
1178
+ }
1179
+ var fields = {
1180
+ G: { field: "era", desc: "Era" },
1181
+ y: { field: "year", desc: "Year" },
1182
+ Y: { field: "year", desc: 'Year of "Week of Year"' },
1183
+ u: { field: "year", desc: "Extended year" },
1184
+ U: { field: "year", desc: "Cyclic year name" },
1185
+ r: { field: "year", desc: "Related Gregorian year" },
1186
+ Q: { field: "quarter", desc: "Quarter" },
1187
+ q: { field: "quarter", desc: "Stand-alone quarter" },
1188
+ M: { field: "month", desc: "Month in year" },
1189
+ L: { field: "month", desc: "Stand-alone month in year" },
1190
+ w: { field: "week", desc: "Week of year" },
1191
+ W: { field: "week", desc: "Week of month" },
1192
+ d: { field: "day", desc: "Day in month" },
1193
+ D: { field: "day", desc: "Day of year" },
1194
+ F: { field: "day", desc: "Day of week in month" },
1195
+ g: { field: "day", desc: "Modified julian day" },
1196
+ E: { field: "weekday", desc: "Day of week" },
1197
+ e: { field: "weekday", desc: "Local day of week" },
1198
+ c: { field: "weekday", desc: "Stand-alone local day of week" },
1199
+ a: { field: "period", desc: "AM/PM marker" },
1200
+ b: { field: "period", desc: "AM/PM/noon/midnight marker" },
1201
+ B: { field: "period", desc: "Flexible day period" },
1202
+ h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
1203
+ H: { field: "hour", desc: "Hour in day (0~23)" },
1204
+ k: { field: "hour", desc: "Hour in day (1~24)" },
1205
+ K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
1206
+ j: { field: "hour", desc: "Hour in preferred cycle" },
1207
+ J: { field: "hour", desc: "Hour in preferred cycle without marker" },
1208
+ C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
1209
+ m: { field: "min", desc: "Minute in hour" },
1210
+ s: { field: "sec", desc: "Second in minute" },
1211
+ S: { field: "sec-frac", desc: "Fractional second" },
1212
+ A: { field: "ms", desc: "Milliseconds in day" },
1213
+ z: { field: "tz", desc: "Time Zone: specific non-location" },
1214
+ Z: { field: "tz", desc: "Time Zone" },
1215
+ O: { field: "tz", desc: "Time Zone: localized" },
1216
+ v: { field: "tz", desc: "Time Zone: generic non-location" },
1217
+ V: { field: "tz", desc: "Time Zone: ID" },
1218
+ X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
1219
+ x: { field: "tz", desc: "Time Zone: ISO8601" }
1220
+ };
1221
+ var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
1222
+ function readFieldToken(src, pos) {
1223
+ const char = src[pos];
1224
+ let width = 1;
1225
+ while (src[++pos] === char)
1226
+ ++width;
1227
+ const field = fields[char];
1228
+ if (!field) {
1229
+ const msg = `The letter ${char} is not a valid field identifier`;
1230
+ return { char, error: new Error(msg), width };
1231
+ }
1232
+ return { char, field: field.field, desc: field.desc, width };
1233
+ }
1234
+ function readQuotedToken(src, pos) {
1235
+ let str = src[++pos];
1236
+ let width = 2;
1237
+ if (str === "'")
1238
+ return { char: "'", str, width };
1239
+ while (true) {
1240
+ const next = src[++pos];
1241
+ ++width;
1242
+ if (next === void 0) {
1243
+ const msg = `Unterminated quoted literal in pattern: ${str || src}`;
1244
+ return { char: "'", error: new Error(msg), str, width };
1245
+ } else if (next === "'") {
1246
+ if (src[++pos] !== "'")
1247
+ return { char: "'", str, width };
1248
+ else
1249
+ ++width;
1250
+ }
1251
+ str += next;
1252
+ }
1253
+ }
1254
+ function readToken(src, pos) {
1255
+ const char = src[pos];
1256
+ if (!char)
1257
+ return null;
1258
+ if (isLetter(char))
1259
+ return readFieldToken(src, pos);
1260
+ if (char === "'")
1261
+ return readQuotedToken(src, pos);
1262
+ let str = char;
1263
+ let width = 1;
1264
+ while (true) {
1265
+ const next = src[++pos];
1266
+ if (!next || isLetter(next) || next === "'")
1267
+ return { char, str, width };
1268
+ str += next;
1269
+ width += 1;
1270
+ }
1271
+ }
1272
+ function parseDateTokens(src) {
1273
+ const tokens = [];
1274
+ let pos = 0;
1275
+ while (true) {
1276
+ const token = readToken(src, pos);
1277
+ if (!token)
1278
+ return tokens;
1279
+ tokens.push(token);
1280
+ pos += token.width;
1281
+ }
1282
+ }
1018
1283
  function processTokens(tokens, mapText) {
1019
1284
  if (!tokens.filter((token) => token.type !== "content").length) {
1020
- return tokens.map((token) => mapText(token.value)).join("");
1285
+ return tokens.map((token) => mapText(token.value));
1021
1286
  }
1022
1287
  return tokens.map((token) => {
1023
1288
  var _a;
@@ -1029,6 +1294,12 @@ function processTokens(tokens, mapText) {
1029
1294
  return [token.arg];
1030
1295
  } else if (token.type === "function") {
1031
1296
  const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
1297
+ if (token.key === "date" && _param) {
1298
+ const opts = compileDateExpression(_param.value.trim(), (e) => {
1299
+ throw new Error(`Unable to compile date expression: ${e.message}`);
1300
+ });
1301
+ return [token.arg, token.key, opts];
1302
+ }
1032
1303
  if (_param) {
1033
1304
  return [token.arg, token.key, _param.value.trim()];
1034
1305
  } else {
@@ -1050,6 +1321,13 @@ function processTokens(tokens, mapText) {
1050
1321
  ];
1051
1322
  });
1052
1323
  }
1324
+ function compileDateExpression(format, onError) {
1325
+ if (/^::/.test(format)) {
1326
+ const tokens = parseDateTokens(format.substring(2));
1327
+ return getDateFormatOptions(tokens, void 0, onError);
1328
+ }
1329
+ return format;
1330
+ }
1053
1331
  function compileMessage(message, mapText = (v) => v) {
1054
1332
  try {
1055
1333
  return processTokens((0, import_parser.parse)(message), mapText);
@@ -1057,11 +1335,11 @@ function compileMessage(message, mapText = (v) => v) {
1057
1335
  console.error(`${e.message}
1058
1336
 
1059
1337
  Message: ${message}`);
1060
- return message;
1338
+ return [message];
1061
1339
  }
1062
1340
  }
1063
1341
 
1064
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1342
+ // node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_typescri_qfhfd5z2jpd4amxt2golzdalsi/node_modules/@lingui/core/dist/index.mjs
1065
1343
  var isString = (s) => typeof s === "string";
1066
1344
  var isFunction = (f) => typeof f === "function";
1067
1345
  var cache = /* @__PURE__ */ new Map();
@@ -1072,12 +1350,59 @@ function normalizeLocales(locales) {
1072
1350
  }
1073
1351
  function date(locales, value, format) {
1074
1352
  const _locales = normalizeLocales(locales);
1353
+ if (!format) {
1354
+ format = "default";
1355
+ }
1356
+ let o;
1357
+ if (typeof format === "string") {
1358
+ o = {
1359
+ day: "numeric",
1360
+ month: "short",
1361
+ year: "numeric"
1362
+ };
1363
+ switch (format) {
1364
+ case "full":
1365
+ o.weekday = "long";
1366
+ case "long":
1367
+ o.month = "long";
1368
+ break;
1369
+ case "short":
1370
+ o.month = "numeric";
1371
+ break;
1372
+ }
1373
+ } else {
1374
+ o = format;
1375
+ }
1075
1376
  const formatter = getMemoized(
1076
1377
  () => cacheKey("date", _locales, format),
1077
- () => new Intl.DateTimeFormat(_locales, format)
1378
+ () => new Intl.DateTimeFormat(_locales, o)
1078
1379
  );
1079
1380
  return formatter.format(isString(value) ? new Date(value) : value);
1080
1381
  }
1382
+ function time(locales, value, format) {
1383
+ let o;
1384
+ if (!format) {
1385
+ format = "default";
1386
+ }
1387
+ if (typeof format === "string") {
1388
+ o = {
1389
+ second: "numeric",
1390
+ minute: "numeric",
1391
+ hour: "numeric"
1392
+ };
1393
+ switch (format) {
1394
+ case "full":
1395
+ case "long":
1396
+ o.timeZoneName = "short";
1397
+ break;
1398
+ case "short":
1399
+ delete o.second;
1400
+ }
1401
+ } else {
1402
+ o = format;
1403
+ }
1404
+ return date(locales, value, o);
1405
+ }
1081
1406
  function number(locales, value, format) {
1082
1407
  const _locales = normalizeLocales(locales);
1083
1408
  const formatter = getMemoized(
@@ -1112,12 +1437,14 @@ function cacheKey(type, locales, options) {
1112
1437
  const localeKey = locales.join("-");
1113
1438
  return `${type}-${localeKey}-${JSON.stringify(options)}`;
1114
1439
  }
1115
- var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
1440
+ var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
1116
1441
  var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1117
1442
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1118
1443
  const locales = passedLocales || locale;
1119
1444
  const style = (format) => {
1120
- return typeof format === "object" ? format : formats[format] || { style: format };
1445
+ if (typeof format === "object")
1446
+ return format;
1447
+ return formats[format];
1121
1448
  };
1122
1449
  const replaceOctothorpe = (value, message) => {
1123
1450
  const numberFormat = Object.keys(formats).length ? style("number") : void 0;
@@ -1136,8 +1463,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1136
1463
  return replaceOctothorpe(value - offset, message);
1137
1464
  },
1138
1465
  select: selectFormatter,
1139
- number: (value, format) => number(locales, value, style(format)),
1140
- date: (value, format) => date(locales, value, style(format))
1466
+ number: (value, format) => number(
1467
+ locales,
1468
+ value,
1469
+ style(format) || { style: format }
1470
+ ),
1471
+ date: (value, format) => date(locales, value, style(format) || format),
1472
+ time: (value, format) => time(locales, value, style(format) || format)
1141
1473
  };
1142
1474
  };
1143
1475
  var selectFormatter = (value, rules) => {
@@ -1186,10 +1518,10 @@ function interpolate(translation, locale, locales) {
1186
1518
  };
1187
1519
  const result = formatMessage(translation);
1188
1520
  if (isString(result) && UNICODE_REGEX.test(result)) {
1189
- return (0, import_unraw.unraw)(result.trim());
1521
+ return (0, import_unraw.unraw)(result);
1190
1522
  }
1191
1523
  if (isString(result))
1192
- return result.trim();
1524
+ return result;
1193
1525
  return result ? String(result) : "";
1194
1526
  };
1195
1527
  }
@@ -1244,7 +1576,11 @@ var I18n = class extends EventEmitter {
1244
1576
  __publicField2(this, "_localeData", {});
1245
1577
  __publicField2(this, "_messages", {});
1246
1578
  __publicField2(this, "_missing");
1579
+ __publicField2(this, "_messageCompiler");
1247
1580
  __publicField2(this, "t", this._.bind(this));
1581
+ if (true) {
1582
+ this.setMessagesCompiler(compileMessage);
1583
+ }
1248
1584
  if (params.missing != null)
1249
1585
  this._missing = params.missing;
1250
1586
  if (params.messages != null)
@@ -1280,12 +1616,30 @@ var I18n = class extends EventEmitter {
1280
1616
  Object.assign(maybeLocaleData, localeData);
1281
1617
  }
1282
1618
  }
1619
+ /**
1620
+ * Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
1621
+ *
1622
+ * In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
1623
+ * By default, message catalogs should be precompiled during the build process. However,
1624
+ * if you need to compile catalogs at runtime, you can use this method to set a message compiler.
1625
+ *
1626
+ * Example usage:
1627
+ *
1628
+ * ```ts
1629
+ * import { compileMessage } from "@lingui/message-utils/compileMessage";
1630
+ *
1631
+ * i18n.setMessagesCompiler(compileMessage);
1632
+ * ```
1633
+ */
1634
+ setMessagesCompiler(compiler) {
1635
+ this._messageCompiler = compiler;
1636
+ return this;
1637
+ }
1283
1638
  /**
1284
1639
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1285
1640
  */
1286
- // @ts-ignore deprecated, so ignore the reported error
1287
1641
  loadLocaleData(localeOrAllData, localeData) {
1288
- if (localeData != null) {
1642
+ if (typeof localeOrAllData === "string") {
1289
1643
  this._loadLocaleData(localeOrAllData, localeData);
1290
1644
  } else {
1291
1645
  Object.keys(localeOrAllData).forEach(
@@ -1332,6 +1686,11 @@ var I18n = class extends EventEmitter {
1332
1686
  this.emit("change");
1333
1687
  }
1334
1688
  _(id, values, options) {
1689
+ if (!this.locale) {
1690
+ throw new Error(
1691
+ "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."
1692
+ );
1693
+ }
1335
1694
  let message = options == null ? void 0 : options.message;
1336
1695
  if (!id) {
1337
1696
  id = "";
@@ -1351,8 +1710,20 @@ var I18n = class extends EventEmitter {
1351
1710
  this.emit("missing", { id, locale: this._locale });
1352
1711
  }
1353
1712
  let translation = messageForId || message || id;
1354
- if (true) {
1355
- translation = isString(translation) ? compileMessage(translation) : translation;
1713
+ if (isString(translation)) {
1714
+ if (this._messageCompiler) {
1715
+ translation = this._messageCompiler(translation);
1716
+ } else {
1717
+ console.warn(`Uncompiled message detected! Message:
1718
+
1719
+ > ${translation}
1720
+
1721
+ That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
1722
+ ICU features such as interpolation and plurals will not work properly for that message.
1723
+
1724
+ Please compile your catalog first.
1725
+ `);
1726
+ }
1356
1727
  }
1357
1728
  if (isString(translation) && UNICODE_REGEX.test(translation))
1358
1729
  return JSON.parse(`"${translation}"`);
@@ -1376,12 +1747,12 @@ function setupI18n(params = {}) {
1376
1747
  }
1377
1748
  var i18n = setupI18n();
1378
1749
 
1379
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
1380
- var messages = JSON.parse('{"icon.title.close":"Kryss"}');
1381
- var messages2 = JSON.parse('{"icon.title.close":"Cross"}');
1382
- var messages3 = JSON.parse('{"icon.title.close":"Rasti"}');
1383
- var messages4 = JSON.parse('{"icon.title.close":"Kryds"}');
1384
- var messages5 = JSON.parse('{"icon.title.close":"Kryss"}');
1750
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/close-16.js
1751
+ var messages = JSON.parse('{"icon.title.close":["Kryss"]}');
1752
+ var messages2 = JSON.parse('{"icon.title.close":["Cross"]}');
1753
+ var messages3 = JSON.parse('{"icon.title.close":["Rasti"]}');
1754
+ var messages4 = JSON.parse('{"icon.title.close":["Kryds"]}');
1755
+ var messages5 = JSON.parse('{"icon.title.close":["Kryss"]}');
1385
1756
  var supportedLocales = ["en", "nb", "fi", "da", "sv"];
1386
1757
  var defaultLocale2 = "en";
1387
1758
  var detectByBrand = () => {
@@ -1481,7 +1852,7 @@ var r = function() {
1481
1852
  }, []).join(" ");
1482
1853
  };
1483
1854
 
1484
- // node_modules/.pnpm/@warp-ds+css@2.0.0_@warp-ds+uno@2.0.0_unocss@0.62.0_postcss@8.4.41_rollup@4.20.0_vite@5.3.3_@_vyiy5vwpqfzwy5hpmfkwp3zmle/node_modules/@warp-ds/css/component-classes/index.js
1855
+ // node_modules/.pnpm/@warp-ds+css@2.1.1_@warp-ds+uno@2.1.0_unocss@0.62.0_postcss@8.5.1_rollup@4.32.1_vite@5.3.3_@t_sgrraibu65gdmqpe655kfrpl6a/node_modules/@warp-ds/css/component-classes/index.js
1485
1856
  var pill = {
1486
1857
  wrapper: "flex items-center",
1487
1858
  button: "inline-flex items-center focusable text-xs transition-all",
@@ -1777,19 +2148,19 @@ function kebabCaseAttributes(constructor) {
1777
2148
  }
1778
2149
 
1779
2150
  // packages/pill/locales/da/messages.mjs
1780
- var messages6 = JSON.parse('{"pill.aria.openFilter":"\xC5bn filter","pill.aria.removeFilter":["Fjern filter ",["label"]]}');
2151
+ var messages6 = JSON.parse('{"pill.aria.openFilter":["\xC5bn filter"],"pill.aria.removeFilter":["Fjern filter ",["label"]]}');
1781
2152
 
1782
2153
  // packages/pill/locales/en/messages.mjs
1783
- var messages7 = JSON.parse('{"pill.aria.openFilter":"Open filter","pill.aria.removeFilter":["Remove filter ",["label"]]}');
2154
+ var messages7 = JSON.parse('{"pill.aria.openFilter":["Open filter"],"pill.aria.removeFilter":["Remove filter ",["label"]]}');
1784
2155
 
1785
2156
  // packages/pill/locales/fi/messages.mjs
1786
- var messages8 = JSON.parse('{"pill.aria.openFilter":"Avaa suodatin","pill.aria.removeFilter":["Tyhjenn\xE4 suodatin ",["label"]]}');
2157
+ var messages8 = JSON.parse('{"pill.aria.openFilter":["Avaa suodatin"],"pill.aria.removeFilter":["Tyhjenn\xE4 suodatin ",["label"]]}');
1787
2158
 
1788
2159
  // packages/pill/locales/nb/messages.mjs
1789
- var messages9 = JSON.parse('{"pill.aria.openFilter":"\xC5pne filter","pill.aria.removeFilter":["Fjern filter ",["label"]]}');
2160
+ var messages9 = JSON.parse('{"pill.aria.openFilter":["\xC5pne filter"],"pill.aria.removeFilter":["Fjern filter ",["label"]]}');
1790
2161
 
1791
2162
  // packages/pill/locales/sv/messages.mjs
1792
- var messages10 = JSON.parse('{"pill.aria.openFilter":"\xD6ppna filter","pill.aria.removeFilter":["Ta bort filtret ",["label"]]}');
2163
+ var messages10 = JSON.parse('{"pill.aria.openFilter":["\xD6ppna filter"],"pill.aria.removeFilter":["Ta bort filtret ",["label"]]}');
1793
2164
 
1794
2165
  // packages/pill/index.js
1795
2166
  var WarpPill = class extends kebabCaseAttributes(WarpElement) {