@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,7 +1010,6 @@ 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
 
@@ -1019,7 +1026,7 @@ var r = function() {
1019
1026
  }, []).join(" ");
1020
1027
  };
1021
1028
 
1022
- // 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
1029
+ // 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
1023
1030
  var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
1024
1031
  var buttonColors = {
1025
1032
  primary: "s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",
@@ -1266,18 +1273,276 @@ var attention = {
1266
1273
  // packages/alert/index.js
1267
1274
  import WarpElement from "@warp-ds/elements-core";
1268
1275
 
1269
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/info-16.js
1276
+ // 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/info-16.js
1270
1277
  import { LitElement } from "lit";
1271
1278
  import { unsafeStatic, html } from "lit/static-html.js";
1272
1279
 
1273
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1280
+ // 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
1274
1281
  var import_unraw = __toESM(require_dist(), 1);
1275
1282
 
1276
- // node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1283
+ // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1277
1284
  var import_parser = __toESM(require_parser(), 1);
1285
+ var DateFormatError = class extends Error {
1286
+ /** @internal */
1287
+ constructor(msg, token, type) {
1288
+ super(msg);
1289
+ this.token = token;
1290
+ this.type = type || "error";
1291
+ }
1292
+ };
1293
+ var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
1294
+ var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
1295
+ function yearOptions(token, onError) {
1296
+ switch (token.char) {
1297
+ case "y":
1298
+ return { year: numeric(token.width) };
1299
+ case "r":
1300
+ return { calendar: "gregory", year: "numeric" };
1301
+ case "u":
1302
+ case "U":
1303
+ case "Y":
1304
+ default:
1305
+ onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
1306
+ return { year: "numeric" };
1307
+ }
1308
+ }
1309
+ function monthStyle(token, onError) {
1310
+ switch (token.width) {
1311
+ case 1:
1312
+ return "numeric";
1313
+ case 2:
1314
+ return "2-digit";
1315
+ case 3:
1316
+ return "short";
1317
+ case 4:
1318
+ return "long";
1319
+ case 5:
1320
+ return "narrow";
1321
+ default:
1322
+ onError(`${token.desc} is not supported with width ${token.width}`);
1323
+ return void 0;
1324
+ }
1325
+ }
1326
+ function dayStyle(token, onError) {
1327
+ const { char, desc, width } = token;
1328
+ if (char === "d") {
1329
+ return numeric(width);
1330
+ } else {
1331
+ onError(`${desc} is not supported`);
1332
+ return void 0;
1333
+ }
1334
+ }
1335
+ function weekdayStyle(token, onError) {
1336
+ const { char, desc, width } = token;
1337
+ if ((char === "c" || char === "e") && width < 3) {
1338
+ const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
1339
+ onError(msg, DateFormatError.WARNING);
1340
+ }
1341
+ return alpha(width);
1342
+ }
1343
+ function hourOptions(token) {
1344
+ const hour = numeric(token.width);
1345
+ let hourCycle;
1346
+ switch (token.char) {
1347
+ case "h":
1348
+ hourCycle = "h12";
1349
+ break;
1350
+ case "H":
1351
+ hourCycle = "h23";
1352
+ break;
1353
+ case "k":
1354
+ hourCycle = "h24";
1355
+ break;
1356
+ case "K":
1357
+ hourCycle = "h11";
1358
+ break;
1359
+ }
1360
+ return hourCycle ? { hour, hourCycle } : { hour };
1361
+ }
1362
+ function timeZoneNameStyle(token, onError) {
1363
+ const { char, desc, width } = token;
1364
+ switch (char) {
1365
+ case "v":
1366
+ case "z":
1367
+ return width === 4 ? "long" : "short";
1368
+ case "V":
1369
+ if (width === 4)
1370
+ return "long";
1371
+ onError(`${desc} is not supported with width ${width}`);
1372
+ return void 0;
1373
+ case "X":
1374
+ onError(`${desc} is not supported`);
1375
+ return void 0;
1376
+ }
1377
+ return "short";
1378
+ }
1379
+ function compileOptions(token, onError) {
1380
+ switch (token.field) {
1381
+ case "era":
1382
+ return { era: alpha(token.width) };
1383
+ case "year":
1384
+ return yearOptions(token, onError);
1385
+ case "month":
1386
+ return { month: monthStyle(token, onError) };
1387
+ case "day":
1388
+ return { day: dayStyle(token, onError) };
1389
+ case "weekday":
1390
+ return { weekday: weekdayStyle(token, onError) };
1391
+ case "period":
1392
+ return void 0;
1393
+ case "hour":
1394
+ return hourOptions(token);
1395
+ case "min":
1396
+ return { minute: numeric(token.width) };
1397
+ case "sec":
1398
+ return { second: numeric(token.width) };
1399
+ case "tz":
1400
+ return { timeZoneName: timeZoneNameStyle(token, onError) };
1401
+ case "quarter":
1402
+ case "week":
1403
+ case "sec-frac":
1404
+ case "ms":
1405
+ onError(`${token.desc} is not supported`);
1406
+ }
1407
+ return void 0;
1408
+ }
1409
+ function getDateFormatOptions(tokens, timeZone, onError = (error) => {
1410
+ throw error;
1411
+ }) {
1412
+ const options = {
1413
+ timeZone
1414
+ };
1415
+ const fields2 = [];
1416
+ for (const token of tokens) {
1417
+ const { error, field, str } = token;
1418
+ if (error) {
1419
+ const dte = new DateFormatError(error.message, token);
1420
+ dte.stack = error.stack;
1421
+ onError(dte);
1422
+ }
1423
+ if (str) {
1424
+ const msg = `Ignoring string part: ${str}`;
1425
+ onError(new DateFormatError(msg, token, DateFormatError.WARNING));
1426
+ }
1427
+ if (field) {
1428
+ if (fields2.indexOf(field) === -1)
1429
+ fields2.push(field);
1430
+ else
1431
+ onError(new DateFormatError(`Duplicate ${field} token`, token));
1432
+ }
1433
+ const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
1434
+ if (opt)
1435
+ Object.assign(options, opt);
1436
+ }
1437
+ return options;
1438
+ }
1439
+ var fields = {
1440
+ G: { field: "era", desc: "Era" },
1441
+ y: { field: "year", desc: "Year" },
1442
+ Y: { field: "year", desc: 'Year of "Week of Year"' },
1443
+ u: { field: "year", desc: "Extended year" },
1444
+ U: { field: "year", desc: "Cyclic year name" },
1445
+ r: { field: "year", desc: "Related Gregorian year" },
1446
+ Q: { field: "quarter", desc: "Quarter" },
1447
+ q: { field: "quarter", desc: "Stand-alone quarter" },
1448
+ M: { field: "month", desc: "Month in year" },
1449
+ L: { field: "month", desc: "Stand-alone month in year" },
1450
+ w: { field: "week", desc: "Week of year" },
1451
+ W: { field: "week", desc: "Week of month" },
1452
+ d: { field: "day", desc: "Day in month" },
1453
+ D: { field: "day", desc: "Day of year" },
1454
+ F: { field: "day", desc: "Day of week in month" },
1455
+ g: { field: "day", desc: "Modified julian day" },
1456
+ E: { field: "weekday", desc: "Day of week" },
1457
+ e: { field: "weekday", desc: "Local day of week" },
1458
+ c: { field: "weekday", desc: "Stand-alone local day of week" },
1459
+ a: { field: "period", desc: "AM/PM marker" },
1460
+ b: { field: "period", desc: "AM/PM/noon/midnight marker" },
1461
+ B: { field: "period", desc: "Flexible day period" },
1462
+ h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
1463
+ H: { field: "hour", desc: "Hour in day (0~23)" },
1464
+ k: { field: "hour", desc: "Hour in day (1~24)" },
1465
+ K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
1466
+ j: { field: "hour", desc: "Hour in preferred cycle" },
1467
+ J: { field: "hour", desc: "Hour in preferred cycle without marker" },
1468
+ C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
1469
+ m: { field: "min", desc: "Minute in hour" },
1470
+ s: { field: "sec", desc: "Second in minute" },
1471
+ S: { field: "sec-frac", desc: "Fractional second" },
1472
+ A: { field: "ms", desc: "Milliseconds in day" },
1473
+ z: { field: "tz", desc: "Time Zone: specific non-location" },
1474
+ Z: { field: "tz", desc: "Time Zone" },
1475
+ O: { field: "tz", desc: "Time Zone: localized" },
1476
+ v: { field: "tz", desc: "Time Zone: generic non-location" },
1477
+ V: { field: "tz", desc: "Time Zone: ID" },
1478
+ X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
1479
+ x: { field: "tz", desc: "Time Zone: ISO8601" }
1480
+ };
1481
+ var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
1482
+ function readFieldToken(src, pos) {
1483
+ const char = src[pos];
1484
+ let width = 1;
1485
+ while (src[++pos] === char)
1486
+ ++width;
1487
+ const field = fields[char];
1488
+ if (!field) {
1489
+ const msg = `The letter ${char} is not a valid field identifier`;
1490
+ return { char, error: new Error(msg), width };
1491
+ }
1492
+ return { char, field: field.field, desc: field.desc, width };
1493
+ }
1494
+ function readQuotedToken(src, pos) {
1495
+ let str = src[++pos];
1496
+ let width = 2;
1497
+ if (str === "'")
1498
+ return { char: "'", str, width };
1499
+ while (true) {
1500
+ const next = src[++pos];
1501
+ ++width;
1502
+ if (next === void 0) {
1503
+ const msg = `Unterminated quoted literal in pattern: ${str || src}`;
1504
+ return { char: "'", error: new Error(msg), str, width };
1505
+ } else if (next === "'") {
1506
+ if (src[++pos] !== "'")
1507
+ return { char: "'", str, width };
1508
+ else
1509
+ ++width;
1510
+ }
1511
+ str += next;
1512
+ }
1513
+ }
1514
+ function readToken(src, pos) {
1515
+ const char = src[pos];
1516
+ if (!char)
1517
+ return null;
1518
+ if (isLetter(char))
1519
+ return readFieldToken(src, pos);
1520
+ if (char === "'")
1521
+ return readQuotedToken(src, pos);
1522
+ let str = char;
1523
+ let width = 1;
1524
+ while (true) {
1525
+ const next = src[++pos];
1526
+ if (!next || isLetter(next) || next === "'")
1527
+ return { char, str, width };
1528
+ str += next;
1529
+ width += 1;
1530
+ }
1531
+ }
1532
+ function parseDateTokens(src) {
1533
+ const tokens = [];
1534
+ let pos = 0;
1535
+ while (true) {
1536
+ const token = readToken(src, pos);
1537
+ if (!token)
1538
+ return tokens;
1539
+ tokens.push(token);
1540
+ pos += token.width;
1541
+ }
1542
+ }
1278
1543
  function processTokens(tokens, mapText) {
1279
1544
  if (!tokens.filter((token) => token.type !== "content").length) {
1280
- return tokens.map((token) => mapText(token.value)).join("");
1545
+ return tokens.map((token) => mapText(token.value));
1281
1546
  }
1282
1547
  return tokens.map((token) => {
1283
1548
  var _a;
@@ -1289,6 +1554,12 @@ function processTokens(tokens, mapText) {
1289
1554
  return [token.arg];
1290
1555
  } else if (token.type === "function") {
1291
1556
  const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
1557
+ if (token.key === "date" && _param) {
1558
+ const opts = compileDateExpression(_param.value.trim(), (e) => {
1559
+ throw new Error(`Unable to compile date expression: ${e.message}`);
1560
+ });
1561
+ return [token.arg, token.key, opts];
1562
+ }
1292
1563
  if (_param) {
1293
1564
  return [token.arg, token.key, _param.value.trim()];
1294
1565
  } else {
@@ -1310,6 +1581,13 @@ function processTokens(tokens, mapText) {
1310
1581
  ];
1311
1582
  });
1312
1583
  }
1584
+ function compileDateExpression(format, onError) {
1585
+ if (/^::/.test(format)) {
1586
+ const tokens = parseDateTokens(format.substring(2));
1587
+ return getDateFormatOptions(tokens, void 0, onError);
1588
+ }
1589
+ return format;
1590
+ }
1313
1591
  function compileMessage(message, mapText = (v) => v) {
1314
1592
  try {
1315
1593
  return processTokens((0, import_parser.parse)(message), mapText);
@@ -1317,11 +1595,11 @@ function compileMessage(message, mapText = (v) => v) {
1317
1595
  console.error(`${e.message}
1318
1596
 
1319
1597
  Message: ${message}`);
1320
- return message;
1598
+ return [message];
1321
1599
  }
1322
1600
  }
1323
1601
 
1324
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1602
+ // 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
1325
1603
  var isString = (s) => typeof s === "string";
1326
1604
  var isFunction = (f) => typeof f === "function";
1327
1605
  var cache = /* @__PURE__ */ new Map();
@@ -1332,12 +1610,59 @@ function normalizeLocales(locales) {
1332
1610
  }
1333
1611
  function date(locales, value, format) {
1334
1612
  const _locales = normalizeLocales(locales);
1613
+ if (!format) {
1614
+ format = "default";
1615
+ }
1616
+ let o;
1617
+ if (typeof format === "string") {
1618
+ o = {
1619
+ day: "numeric",
1620
+ month: "short",
1621
+ year: "numeric"
1622
+ };
1623
+ switch (format) {
1624
+ case "full":
1625
+ o.weekday = "long";
1626
+ case "long":
1627
+ o.month = "long";
1628
+ break;
1629
+ case "short":
1630
+ o.month = "numeric";
1631
+ break;
1632
+ }
1633
+ } else {
1634
+ o = format;
1635
+ }
1335
1636
  const formatter = getMemoized(
1336
1637
  () => cacheKey("date", _locales, format),
1337
- () => new Intl.DateTimeFormat(_locales, format)
1638
+ () => new Intl.DateTimeFormat(_locales, o)
1338
1639
  );
1339
1640
  return formatter.format(isString(value) ? new Date(value) : value);
1340
1641
  }
1642
+ function time(locales, value, format) {
1643
+ let o;
1644
+ if (!format) {
1645
+ format = "default";
1646
+ }
1647
+ if (typeof format === "string") {
1648
+ o = {
1649
+ second: "numeric",
1650
+ minute: "numeric",
1651
+ hour: "numeric"
1652
+ };
1653
+ switch (format) {
1654
+ case "full":
1655
+ case "long":
1656
+ o.timeZoneName = "short";
1657
+ break;
1658
+ case "short":
1659
+ delete o.second;
1660
+ }
1661
+ } else {
1662
+ o = format;
1663
+ }
1664
+ return date(locales, value, o);
1665
+ }
1341
1666
  function number(locales, value, format) {
1342
1667
  const _locales = normalizeLocales(locales);
1343
1668
  const formatter = getMemoized(
@@ -1372,12 +1697,14 @@ function cacheKey(type, locales, options) {
1372
1697
  const localeKey = locales.join("-");
1373
1698
  return `${type}-${localeKey}-${JSON.stringify(options)}`;
1374
1699
  }
1375
- var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
1700
+ var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
1376
1701
  var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1377
1702
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1378
1703
  const locales = passedLocales || locale;
1379
1704
  const style = (format) => {
1380
- return typeof format === "object" ? format : formats[format] || { style: format };
1705
+ if (typeof format === "object")
1706
+ return format;
1707
+ return formats[format];
1381
1708
  };
1382
1709
  const replaceOctothorpe = (value, message) => {
1383
1710
  const numberFormat = Object.keys(formats).length ? style("number") : void 0;
@@ -1396,8 +1723,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1396
1723
  return replaceOctothorpe(value - offset, message);
1397
1724
  },
1398
1725
  select: selectFormatter,
1399
- number: (value, format) => number(locales, value, style(format)),
1400
- date: (value, format) => date(locales, value, style(format))
1726
+ number: (value, format) => number(
1727
+ locales,
1728
+ value,
1729
+ style(format) || { style: format }
1730
+ ),
1731
+ date: (value, format) => date(locales, value, style(format) || format),
1732
+ time: (value, format) => time(locales, value, style(format) || format)
1401
1733
  };
1402
1734
  };
1403
1735
  var selectFormatter = (value, rules) => {
@@ -1446,10 +1778,10 @@ function interpolate(translation, locale, locales) {
1446
1778
  };
1447
1779
  const result = formatMessage(translation);
1448
1780
  if (isString(result) && UNICODE_REGEX.test(result)) {
1449
- return (0, import_unraw.unraw)(result.trim());
1781
+ return (0, import_unraw.unraw)(result);
1450
1782
  }
1451
1783
  if (isString(result))
1452
- return result.trim();
1784
+ return result;
1453
1785
  return result ? String(result) : "";
1454
1786
  };
1455
1787
  }
@@ -1504,7 +1836,11 @@ var I18n = class extends EventEmitter {
1504
1836
  __publicField2(this, "_localeData", {});
1505
1837
  __publicField2(this, "_messages", {});
1506
1838
  __publicField2(this, "_missing");
1839
+ __publicField2(this, "_messageCompiler");
1507
1840
  __publicField2(this, "t", this._.bind(this));
1841
+ if (true) {
1842
+ this.setMessagesCompiler(compileMessage);
1843
+ }
1508
1844
  if (params.missing != null)
1509
1845
  this._missing = params.missing;
1510
1846
  if (params.messages != null)
@@ -1540,12 +1876,30 @@ var I18n = class extends EventEmitter {
1540
1876
  Object.assign(maybeLocaleData, localeData);
1541
1877
  }
1542
1878
  }
1879
+ /**
1880
+ * Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
1881
+ *
1882
+ * In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
1883
+ * By default, message catalogs should be precompiled during the build process. However,
1884
+ * if you need to compile catalogs at runtime, you can use this method to set a message compiler.
1885
+ *
1886
+ * Example usage:
1887
+ *
1888
+ * ```ts
1889
+ * import { compileMessage } from "@lingui/message-utils/compileMessage";
1890
+ *
1891
+ * i18n.setMessagesCompiler(compileMessage);
1892
+ * ```
1893
+ */
1894
+ setMessagesCompiler(compiler) {
1895
+ this._messageCompiler = compiler;
1896
+ return this;
1897
+ }
1543
1898
  /**
1544
1899
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1545
1900
  */
1546
- // @ts-ignore deprecated, so ignore the reported error
1547
1901
  loadLocaleData(localeOrAllData, localeData) {
1548
- if (localeData != null) {
1902
+ if (typeof localeOrAllData === "string") {
1549
1903
  this._loadLocaleData(localeOrAllData, localeData);
1550
1904
  } else {
1551
1905
  Object.keys(localeOrAllData).forEach(
@@ -1592,6 +1946,11 @@ var I18n = class extends EventEmitter {
1592
1946
  this.emit("change");
1593
1947
  }
1594
1948
  _(id, values, options) {
1949
+ if (!this.locale) {
1950
+ throw new Error(
1951
+ "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."
1952
+ );
1953
+ }
1595
1954
  let message = options == null ? void 0 : options.message;
1596
1955
  if (!id) {
1597
1956
  id = "";
@@ -1611,8 +1970,20 @@ var I18n = class extends EventEmitter {
1611
1970
  this.emit("missing", { id, locale: this._locale });
1612
1971
  }
1613
1972
  let translation = messageForId || message || id;
1614
- if (true) {
1615
- translation = isString(translation) ? compileMessage(translation) : translation;
1973
+ if (isString(translation)) {
1974
+ if (this._messageCompiler) {
1975
+ translation = this._messageCompiler(translation);
1976
+ } else {
1977
+ console.warn(`Uncompiled message detected! Message:
1978
+
1979
+ > ${translation}
1980
+
1981
+ That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
1982
+ ICU features such as interpolation and plurals will not work properly for that message.
1983
+
1984
+ Please compile your catalog first.
1985
+ `);
1986
+ }
1616
1987
  }
1617
1988
  if (isString(translation) && UNICODE_REGEX.test(translation))
1618
1989
  return JSON.parse(`"${translation}"`);
@@ -1636,12 +2007,12 @@ function setupI18n(params = {}) {
1636
2007
  }
1637
2008
  var i18n = setupI18n();
1638
2009
 
1639
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/info-16.js
1640
- var messages = JSON.parse('{"icon.title.info":"Informasjonssirkel"}');
1641
- var messages2 = JSON.parse('{"icon.title.info":"Information circle"}');
1642
- var messages3 = JSON.parse('{"icon.title.info":"Ympyr\xE4, jonka sis\xE4ll\xE4 on i-kirjain"}');
1643
- var messages4 = JSON.parse('{"icon.title.info":"Informationscirkel"}');
1644
- var messages5 = JSON.parse('{"icon.title.info":"Informationscirkel"}');
2010
+ // 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/info-16.js
2011
+ var messages = JSON.parse('{"icon.title.info":["Informasjonssirkel"]}');
2012
+ var messages2 = JSON.parse('{"icon.title.info":["Information circle"]}');
2013
+ var messages3 = JSON.parse('{"icon.title.info":["Ympyr\xE4, jonka sis\xE4ll\xE4 on i-kirjain"]}');
2014
+ var messages4 = JSON.parse('{"icon.title.info":["Informationscirkel"]}');
2015
+ var messages5 = JSON.parse('{"icon.title.info":["Informationscirkel"]}');
1645
2016
  var supportedLocales = ["en", "nb", "fi", "da", "sv"];
1646
2017
  var defaultLocale2 = "en";
1647
2018
  var detectByBrand = () => {
@@ -1728,14 +2099,14 @@ if (!customElements.get("w-icon-info-16")) {
1728
2099
  customElements.define("w-icon-info-16", IconInfo16);
1729
2100
  }
1730
2101
 
1731
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/warning-16.js
2102
+ // 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/warning-16.js
1732
2103
  import { LitElement as LitElement2 } from "lit";
1733
2104
  import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
1734
- var messages6 = JSON.parse('{"icon.title.warning":"Varseltrekant med utropstegn"}');
1735
- var messages22 = JSON.parse('{"icon.title.warning":"Warning triangle with exclamation point"}');
1736
- var messages32 = JSON.parse('{"icon.title.warning":"Varoituskolmio, jonka sis\xE4ll\xE4 on huutomerkki"}');
1737
- var messages42 = JSON.parse('{"icon.title.warning":"Advarselstrekant med et udr\xE5bstegn"}');
1738
- var messages52 = JSON.parse('{"icon.title.warning":"Varningstriangel med utropstecken"}');
2105
+ var messages6 = JSON.parse('{"icon.title.warning":["Varseltrekant med utropstegn"]}');
2106
+ var messages22 = JSON.parse('{"icon.title.warning":["Warning triangle with exclamation point"]}');
2107
+ var messages32 = JSON.parse('{"icon.title.warning":["Varoituskolmio, jonka sis\xE4ll\xE4 on huutomerkki"]}');
2108
+ var messages42 = JSON.parse('{"icon.title.warning":["Advarselstrekant med et udr\xE5bstegn"]}');
2109
+ var messages52 = JSON.parse('{"icon.title.warning":["Varningstriangel med utropstecken"]}');
1739
2110
  var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
1740
2111
  var defaultLocale3 = "en";
1741
2112
  var detectByBrand2 = () => {
@@ -1822,14 +2193,14 @@ if (!customElements.get("w-icon-warning-16")) {
1822
2193
  customElements.define("w-icon-warning-16", IconWarning16);
1823
2194
  }
1824
2195
 
1825
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/error-16.js
2196
+ // 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/error-16.js
1826
2197
  import { LitElement as LitElement3 } from "lit";
1827
2198
  import { unsafeStatic as unsafeStatic3, html as html3 } from "lit/static-html.js";
1828
- var messages7 = JSON.parse('{"icon.title.error":"\xC5ttekant med utropstegn"}');
1829
- var messages23 = JSON.parse('{"icon.title.error":"Octagon with exclamation point"}');
1830
- var messages33 = JSON.parse('{"icon.title.error":"Kahdeksankulmio, jonka sis\xE4ll\xE4 on huutomerkki"}');
1831
- var messages43 = JSON.parse('{"icon.title.error":"Ottekant med et udr\xE5bstegn"}');
1832
- var messages53 = JSON.parse('{"icon.title.error":"Oktagon med utropstecken"}');
2199
+ var messages7 = JSON.parse('{"icon.title.error":["\xC5ttekant med utropstegn"]}');
2200
+ var messages23 = JSON.parse('{"icon.title.error":["Octagon with exclamation point"]}');
2201
+ var messages33 = JSON.parse('{"icon.title.error":["Kahdeksankulmio, jonka sis\xE4ll\xE4 on huutomerkki"]}');
2202
+ var messages43 = JSON.parse('{"icon.title.error":["Ottekant med et udr\xE5bstegn"]}');
2203
+ var messages53 = JSON.parse('{"icon.title.error":["Oktagon med utropstecken"]}');
1833
2204
  var supportedLocales3 = ["en", "nb", "fi", "da", "sv"];
1834
2205
  var defaultLocale4 = "en";
1835
2206
  var detectByBrand3 = () => {
@@ -1916,14 +2287,14 @@ if (!customElements.get("w-icon-error-16")) {
1916
2287
  customElements.define("w-icon-error-16", IconError16);
1917
2288
  }
1918
2289
 
1919
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/success-16.js
2290
+ // 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/success-16.js
1920
2291
  import { LitElement as LitElement4 } from "lit";
1921
2292
  import { unsafeStatic as unsafeStatic4, html as html4 } from "lit/static-html.js";
1922
- var messages8 = JSON.parse('{"icon.title.success":"Sirkel med sjekkmerke"}');
1923
- var messages24 = JSON.parse('{"icon.title.success":"Circle with checkmark"}');
1924
- var messages34 = JSON.parse('{"icon.title.success":"Ympyr\xE4, jonka sis\xE4ll\xE4 on valintamerkki"}');
1925
- var messages44 = JSON.parse('{"icon.title.success":"Cirkel med et flueben"}');
1926
- var messages54 = JSON.parse('{"icon.title.success":"Cirkel med bock"}');
2293
+ var messages8 = JSON.parse('{"icon.title.success":["Sirkel med sjekkmerke"]}');
2294
+ var messages24 = JSON.parse('{"icon.title.success":["Circle with checkmark"]}');
2295
+ var messages34 = JSON.parse('{"icon.title.success":["Ympyr\xE4, jonka sis\xE4ll\xE4 on valintamerkki"]}');
2296
+ var messages44 = JSON.parse('{"icon.title.success":["Cirkel med et flueben"]}');
2297
+ var messages54 = JSON.parse('{"icon.title.success":["Cirkel med bock"]}');
1927
2298
  var supportedLocales4 = ["en", "nb", "fi", "da", "sv"];
1928
2299
  var defaultLocale5 = "en";
1929
2300
  var detectByBrand4 = () => {