@elqnt/chat 2.0.5 → 2.0.8

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/dist/index.js CHANGED
@@ -2197,1576 +2197,8 @@ var ChatInput = ({ userId, orgId, onFileUpload }) => {
2197
2197
  // components/customer/chat-messages.tsx
2198
2198
  var import_react8 = require("react");
2199
2199
 
2200
- // ../../node_modules/date-fns/constants.js
2201
- var daysInYear = 365.2425;
2202
- var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
2203
- var minTime = -maxTime;
2204
- var millisecondsInWeek = 6048e5;
2205
- var millisecondsInDay = 864e5;
2206
- var secondsInHour = 3600;
2207
- var secondsInDay = secondsInHour * 24;
2208
- var secondsInWeek = secondsInDay * 7;
2209
- var secondsInYear = secondsInDay * daysInYear;
2210
- var secondsInMonth = secondsInYear / 12;
2211
- var secondsInQuarter = secondsInMonth * 3;
2212
- var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
2213
-
2214
- // ../../node_modules/date-fns/constructFrom.js
2215
- function constructFrom(date, value) {
2216
- if (typeof date === "function") return date(value);
2217
- if (date && typeof date === "object" && constructFromSymbol in date)
2218
- return date[constructFromSymbol](value);
2219
- if (date instanceof Date) return new date.constructor(value);
2220
- return new Date(value);
2221
- }
2222
-
2223
- // ../../node_modules/date-fns/toDate.js
2224
- function toDate(argument, context) {
2225
- return constructFrom(context || argument, argument);
2226
- }
2227
-
2228
- // ../../node_modules/date-fns/_lib/defaultOptions.js
2229
- var defaultOptions = {};
2230
- function getDefaultOptions() {
2231
- return defaultOptions;
2232
- }
2233
-
2234
- // ../../node_modules/date-fns/startOfWeek.js
2235
- function startOfWeek(date, options) {
2236
- const defaultOptions2 = getDefaultOptions();
2237
- const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
2238
- const _date = toDate(date, options?.in);
2239
- const day = _date.getDay();
2240
- const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
2241
- _date.setDate(_date.getDate() - diff);
2242
- _date.setHours(0, 0, 0, 0);
2243
- return _date;
2244
- }
2245
-
2246
- // ../../node_modules/date-fns/startOfISOWeek.js
2247
- function startOfISOWeek(date, options) {
2248
- return startOfWeek(date, { ...options, weekStartsOn: 1 });
2249
- }
2250
-
2251
- // ../../node_modules/date-fns/getISOWeekYear.js
2252
- function getISOWeekYear(date, options) {
2253
- const _date = toDate(date, options?.in);
2254
- const year = _date.getFullYear();
2255
- const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
2256
- fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
2257
- fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
2258
- const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
2259
- const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
2260
- fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
2261
- fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
2262
- const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
2263
- if (_date.getTime() >= startOfNextYear.getTime()) {
2264
- return year + 1;
2265
- } else if (_date.getTime() >= startOfThisYear.getTime()) {
2266
- return year;
2267
- } else {
2268
- return year - 1;
2269
- }
2270
- }
2271
-
2272
- // ../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
2273
- function getTimezoneOffsetInMilliseconds(date) {
2274
- const _date = toDate(date);
2275
- const utcDate = new Date(
2276
- Date.UTC(
2277
- _date.getFullYear(),
2278
- _date.getMonth(),
2279
- _date.getDate(),
2280
- _date.getHours(),
2281
- _date.getMinutes(),
2282
- _date.getSeconds(),
2283
- _date.getMilliseconds()
2284
- )
2285
- );
2286
- utcDate.setUTCFullYear(_date.getFullYear());
2287
- return +date - +utcDate;
2288
- }
2289
-
2290
- // ../../node_modules/date-fns/_lib/normalizeDates.js
2291
- function normalizeDates(context, ...dates) {
2292
- const normalize = constructFrom.bind(
2293
- null,
2294
- context || dates.find((date) => typeof date === "object")
2295
- );
2296
- return dates.map(normalize);
2297
- }
2298
-
2299
- // ../../node_modules/date-fns/startOfDay.js
2300
- function startOfDay(date, options) {
2301
- const _date = toDate(date, options?.in);
2302
- _date.setHours(0, 0, 0, 0);
2303
- return _date;
2304
- }
2305
-
2306
- // ../../node_modules/date-fns/differenceInCalendarDays.js
2307
- function differenceInCalendarDays(laterDate, earlierDate, options) {
2308
- const [laterDate_, earlierDate_] = normalizeDates(
2309
- options?.in,
2310
- laterDate,
2311
- earlierDate
2312
- );
2313
- const laterStartOfDay = startOfDay(laterDate_);
2314
- const earlierStartOfDay = startOfDay(earlierDate_);
2315
- const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
2316
- const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
2317
- return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
2318
- }
2319
-
2320
- // ../../node_modules/date-fns/startOfISOWeekYear.js
2321
- function startOfISOWeekYear(date, options) {
2322
- const year = getISOWeekYear(date, options);
2323
- const fourthOfJanuary = constructFrom(options?.in || date, 0);
2324
- fourthOfJanuary.setFullYear(year, 0, 4);
2325
- fourthOfJanuary.setHours(0, 0, 0, 0);
2326
- return startOfISOWeek(fourthOfJanuary);
2327
- }
2328
-
2329
- // ../../node_modules/date-fns/isDate.js
2330
- function isDate(value) {
2331
- return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
2332
- }
2333
-
2334
- // ../../node_modules/date-fns/isValid.js
2335
- function isValid(date) {
2336
- return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
2337
- }
2338
-
2339
- // ../../node_modules/date-fns/startOfYear.js
2340
- function startOfYear(date, options) {
2341
- const date_ = toDate(date, options?.in);
2342
- date_.setFullYear(date_.getFullYear(), 0, 1);
2343
- date_.setHours(0, 0, 0, 0);
2344
- return date_;
2345
- }
2346
-
2347
- // ../../node_modules/date-fns/locale/en-US/_lib/formatDistance.js
2348
- var formatDistanceLocale = {
2349
- lessThanXSeconds: {
2350
- one: "less than a second",
2351
- other: "less than {{count}} seconds"
2352
- },
2353
- xSeconds: {
2354
- one: "1 second",
2355
- other: "{{count}} seconds"
2356
- },
2357
- halfAMinute: "half a minute",
2358
- lessThanXMinutes: {
2359
- one: "less than a minute",
2360
- other: "less than {{count}} minutes"
2361
- },
2362
- xMinutes: {
2363
- one: "1 minute",
2364
- other: "{{count}} minutes"
2365
- },
2366
- aboutXHours: {
2367
- one: "about 1 hour",
2368
- other: "about {{count}} hours"
2369
- },
2370
- xHours: {
2371
- one: "1 hour",
2372
- other: "{{count}} hours"
2373
- },
2374
- xDays: {
2375
- one: "1 day",
2376
- other: "{{count}} days"
2377
- },
2378
- aboutXWeeks: {
2379
- one: "about 1 week",
2380
- other: "about {{count}} weeks"
2381
- },
2382
- xWeeks: {
2383
- one: "1 week",
2384
- other: "{{count}} weeks"
2385
- },
2386
- aboutXMonths: {
2387
- one: "about 1 month",
2388
- other: "about {{count}} months"
2389
- },
2390
- xMonths: {
2391
- one: "1 month",
2392
- other: "{{count}} months"
2393
- },
2394
- aboutXYears: {
2395
- one: "about 1 year",
2396
- other: "about {{count}} years"
2397
- },
2398
- xYears: {
2399
- one: "1 year",
2400
- other: "{{count}} years"
2401
- },
2402
- overXYears: {
2403
- one: "over 1 year",
2404
- other: "over {{count}} years"
2405
- },
2406
- almostXYears: {
2407
- one: "almost 1 year",
2408
- other: "almost {{count}} years"
2409
- }
2410
- };
2411
- var formatDistance = (token, count, options) => {
2412
- let result;
2413
- const tokenValue = formatDistanceLocale[token];
2414
- if (typeof tokenValue === "string") {
2415
- result = tokenValue;
2416
- } else if (count === 1) {
2417
- result = tokenValue.one;
2418
- } else {
2419
- result = tokenValue.other.replace("{{count}}", count.toString());
2420
- }
2421
- if (options?.addSuffix) {
2422
- if (options.comparison && options.comparison > 0) {
2423
- return "in " + result;
2424
- } else {
2425
- return result + " ago";
2426
- }
2427
- }
2428
- return result;
2429
- };
2430
-
2431
- // ../../node_modules/date-fns/locale/_lib/buildFormatLongFn.js
2432
- function buildFormatLongFn(args) {
2433
- return (options = {}) => {
2434
- const width = options.width ? String(options.width) : args.defaultWidth;
2435
- const format2 = args.formats[width] || args.formats[args.defaultWidth];
2436
- return format2;
2437
- };
2438
- }
2439
-
2440
- // ../../node_modules/date-fns/locale/en-US/_lib/formatLong.js
2441
- var dateFormats = {
2442
- full: "EEEE, MMMM do, y",
2443
- long: "MMMM do, y",
2444
- medium: "MMM d, y",
2445
- short: "MM/dd/yyyy"
2446
- };
2447
- var timeFormats = {
2448
- full: "h:mm:ss a zzzz",
2449
- long: "h:mm:ss a z",
2450
- medium: "h:mm:ss a",
2451
- short: "h:mm a"
2452
- };
2453
- var dateTimeFormats = {
2454
- full: "{{date}} 'at' {{time}}",
2455
- long: "{{date}} 'at' {{time}}",
2456
- medium: "{{date}}, {{time}}",
2457
- short: "{{date}}, {{time}}"
2458
- };
2459
- var formatLong = {
2460
- date: buildFormatLongFn({
2461
- formats: dateFormats,
2462
- defaultWidth: "full"
2463
- }),
2464
- time: buildFormatLongFn({
2465
- formats: timeFormats,
2466
- defaultWidth: "full"
2467
- }),
2468
- dateTime: buildFormatLongFn({
2469
- formats: dateTimeFormats,
2470
- defaultWidth: "full"
2471
- })
2472
- };
2473
-
2474
- // ../../node_modules/date-fns/locale/en-US/_lib/formatRelative.js
2475
- var formatRelativeLocale = {
2476
- lastWeek: "'last' eeee 'at' p",
2477
- yesterday: "'yesterday at' p",
2478
- today: "'today at' p",
2479
- tomorrow: "'tomorrow at' p",
2480
- nextWeek: "eeee 'at' p",
2481
- other: "P"
2482
- };
2483
- var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
2484
-
2485
- // ../../node_modules/date-fns/locale/_lib/buildLocalizeFn.js
2486
- function buildLocalizeFn(args) {
2487
- return (value, options) => {
2488
- const context = options?.context ? String(options.context) : "standalone";
2489
- let valuesArray;
2490
- if (context === "formatting" && args.formattingValues) {
2491
- const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
2492
- const width = options?.width ? String(options.width) : defaultWidth;
2493
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
2494
- } else {
2495
- const defaultWidth = args.defaultWidth;
2496
- const width = options?.width ? String(options.width) : args.defaultWidth;
2497
- valuesArray = args.values[width] || args.values[defaultWidth];
2498
- }
2499
- const index = args.argumentCallback ? args.argumentCallback(value) : value;
2500
- return valuesArray[index];
2501
- };
2502
- }
2503
-
2504
- // ../../node_modules/date-fns/locale/en-US/_lib/localize.js
2505
- var eraValues = {
2506
- narrow: ["B", "A"],
2507
- abbreviated: ["BC", "AD"],
2508
- wide: ["Before Christ", "Anno Domini"]
2509
- };
2510
- var quarterValues = {
2511
- narrow: ["1", "2", "3", "4"],
2512
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
2513
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
2514
- };
2515
- var monthValues = {
2516
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
2517
- abbreviated: [
2518
- "Jan",
2519
- "Feb",
2520
- "Mar",
2521
- "Apr",
2522
- "May",
2523
- "Jun",
2524
- "Jul",
2525
- "Aug",
2526
- "Sep",
2527
- "Oct",
2528
- "Nov",
2529
- "Dec"
2530
- ],
2531
- wide: [
2532
- "January",
2533
- "February",
2534
- "March",
2535
- "April",
2536
- "May",
2537
- "June",
2538
- "July",
2539
- "August",
2540
- "September",
2541
- "October",
2542
- "November",
2543
- "December"
2544
- ]
2545
- };
2546
- var dayValues = {
2547
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
2548
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
2549
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
2550
- wide: [
2551
- "Sunday",
2552
- "Monday",
2553
- "Tuesday",
2554
- "Wednesday",
2555
- "Thursday",
2556
- "Friday",
2557
- "Saturday"
2558
- ]
2559
- };
2560
- var dayPeriodValues = {
2561
- narrow: {
2562
- am: "a",
2563
- pm: "p",
2564
- midnight: "mi",
2565
- noon: "n",
2566
- morning: "morning",
2567
- afternoon: "afternoon",
2568
- evening: "evening",
2569
- night: "night"
2570
- },
2571
- abbreviated: {
2572
- am: "AM",
2573
- pm: "PM",
2574
- midnight: "midnight",
2575
- noon: "noon",
2576
- morning: "morning",
2577
- afternoon: "afternoon",
2578
- evening: "evening",
2579
- night: "night"
2580
- },
2581
- wide: {
2582
- am: "a.m.",
2583
- pm: "p.m.",
2584
- midnight: "midnight",
2585
- noon: "noon",
2586
- morning: "morning",
2587
- afternoon: "afternoon",
2588
- evening: "evening",
2589
- night: "night"
2590
- }
2591
- };
2592
- var formattingDayPeriodValues = {
2593
- narrow: {
2594
- am: "a",
2595
- pm: "p",
2596
- midnight: "mi",
2597
- noon: "n",
2598
- morning: "in the morning",
2599
- afternoon: "in the afternoon",
2600
- evening: "in the evening",
2601
- night: "at night"
2602
- },
2603
- abbreviated: {
2604
- am: "AM",
2605
- pm: "PM",
2606
- midnight: "midnight",
2607
- noon: "noon",
2608
- morning: "in the morning",
2609
- afternoon: "in the afternoon",
2610
- evening: "in the evening",
2611
- night: "at night"
2612
- },
2613
- wide: {
2614
- am: "a.m.",
2615
- pm: "p.m.",
2616
- midnight: "midnight",
2617
- noon: "noon",
2618
- morning: "in the morning",
2619
- afternoon: "in the afternoon",
2620
- evening: "in the evening",
2621
- night: "at night"
2622
- }
2623
- };
2624
- var ordinalNumber = (dirtyNumber, _options) => {
2625
- const number = Number(dirtyNumber);
2626
- const rem100 = number % 100;
2627
- if (rem100 > 20 || rem100 < 10) {
2628
- switch (rem100 % 10) {
2629
- case 1:
2630
- return number + "st";
2631
- case 2:
2632
- return number + "nd";
2633
- case 3:
2634
- return number + "rd";
2635
- }
2636
- }
2637
- return number + "th";
2638
- };
2639
- var localize = {
2640
- ordinalNumber,
2641
- era: buildLocalizeFn({
2642
- values: eraValues,
2643
- defaultWidth: "wide"
2644
- }),
2645
- quarter: buildLocalizeFn({
2646
- values: quarterValues,
2647
- defaultWidth: "wide",
2648
- argumentCallback: (quarter) => quarter - 1
2649
- }),
2650
- month: buildLocalizeFn({
2651
- values: monthValues,
2652
- defaultWidth: "wide"
2653
- }),
2654
- day: buildLocalizeFn({
2655
- values: dayValues,
2656
- defaultWidth: "wide"
2657
- }),
2658
- dayPeriod: buildLocalizeFn({
2659
- values: dayPeriodValues,
2660
- defaultWidth: "wide",
2661
- formattingValues: formattingDayPeriodValues,
2662
- defaultFormattingWidth: "wide"
2663
- })
2664
- };
2665
-
2666
- // ../../node_modules/date-fns/locale/_lib/buildMatchFn.js
2667
- function buildMatchFn(args) {
2668
- return (string, options = {}) => {
2669
- const width = options.width;
2670
- const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
2671
- const matchResult = string.match(matchPattern);
2672
- if (!matchResult) {
2673
- return null;
2674
- }
2675
- const matchedString = matchResult[0];
2676
- const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
2677
- const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
2678
- // [TODO] -- I challenge you to fix the type
2679
- findKey(parsePatterns, (pattern) => pattern.test(matchedString))
2680
- );
2681
- let value;
2682
- value = args.valueCallback ? args.valueCallback(key) : key;
2683
- value = options.valueCallback ? (
2684
- // [TODO] -- I challenge you to fix the type
2685
- options.valueCallback(value)
2686
- ) : value;
2687
- const rest = string.slice(matchedString.length);
2688
- return { value, rest };
2689
- };
2690
- }
2691
- function findKey(object, predicate) {
2692
- for (const key in object) {
2693
- if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
2694
- return key;
2695
- }
2696
- }
2697
- return void 0;
2698
- }
2699
- function findIndex(array, predicate) {
2700
- for (let key = 0; key < array.length; key++) {
2701
- if (predicate(array[key])) {
2702
- return key;
2703
- }
2704
- }
2705
- return void 0;
2706
- }
2707
-
2708
- // ../../node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
2709
- function buildMatchPatternFn(args) {
2710
- return (string, options = {}) => {
2711
- const matchResult = string.match(args.matchPattern);
2712
- if (!matchResult) return null;
2713
- const matchedString = matchResult[0];
2714
- const parseResult = string.match(args.parsePattern);
2715
- if (!parseResult) return null;
2716
- let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
2717
- value = options.valueCallback ? options.valueCallback(value) : value;
2718
- const rest = string.slice(matchedString.length);
2719
- return { value, rest };
2720
- };
2721
- }
2722
-
2723
- // ../../node_modules/date-fns/locale/en-US/_lib/match.js
2724
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
2725
- var parseOrdinalNumberPattern = /\d+/i;
2726
- var matchEraPatterns = {
2727
- narrow: /^(b|a)/i,
2728
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
2729
- wide: /^(before christ|before common era|anno domini|common era)/i
2730
- };
2731
- var parseEraPatterns = {
2732
- any: [/^b/i, /^(a|c)/i]
2733
- };
2734
- var matchQuarterPatterns = {
2735
- narrow: /^[1234]/i,
2736
- abbreviated: /^q[1234]/i,
2737
- wide: /^[1234](th|st|nd|rd)? quarter/i
2738
- };
2739
- var parseQuarterPatterns = {
2740
- any: [/1/i, /2/i, /3/i, /4/i]
2741
- };
2742
- var matchMonthPatterns = {
2743
- narrow: /^[jfmasond]/i,
2744
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
2745
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
2746
- };
2747
- var parseMonthPatterns = {
2748
- narrow: [
2749
- /^j/i,
2750
- /^f/i,
2751
- /^m/i,
2752
- /^a/i,
2753
- /^m/i,
2754
- /^j/i,
2755
- /^j/i,
2756
- /^a/i,
2757
- /^s/i,
2758
- /^o/i,
2759
- /^n/i,
2760
- /^d/i
2761
- ],
2762
- any: [
2763
- /^ja/i,
2764
- /^f/i,
2765
- /^mar/i,
2766
- /^ap/i,
2767
- /^may/i,
2768
- /^jun/i,
2769
- /^jul/i,
2770
- /^au/i,
2771
- /^s/i,
2772
- /^o/i,
2773
- /^n/i,
2774
- /^d/i
2775
- ]
2776
- };
2777
- var matchDayPatterns = {
2778
- narrow: /^[smtwf]/i,
2779
- short: /^(su|mo|tu|we|th|fr|sa)/i,
2780
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
2781
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
2782
- };
2783
- var parseDayPatterns = {
2784
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
2785
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
2786
- };
2787
- var matchDayPeriodPatterns = {
2788
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
2789
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
2790
- };
2791
- var parseDayPeriodPatterns = {
2792
- any: {
2793
- am: /^a/i,
2794
- pm: /^p/i,
2795
- midnight: /^mi/i,
2796
- noon: /^no/i,
2797
- morning: /morning/i,
2798
- afternoon: /afternoon/i,
2799
- evening: /evening/i,
2800
- night: /night/i
2801
- }
2802
- };
2803
- var match = {
2804
- ordinalNumber: buildMatchPatternFn({
2805
- matchPattern: matchOrdinalNumberPattern,
2806
- parsePattern: parseOrdinalNumberPattern,
2807
- valueCallback: (value) => parseInt(value, 10)
2808
- }),
2809
- era: buildMatchFn({
2810
- matchPatterns: matchEraPatterns,
2811
- defaultMatchWidth: "wide",
2812
- parsePatterns: parseEraPatterns,
2813
- defaultParseWidth: "any"
2814
- }),
2815
- quarter: buildMatchFn({
2816
- matchPatterns: matchQuarterPatterns,
2817
- defaultMatchWidth: "wide",
2818
- parsePatterns: parseQuarterPatterns,
2819
- defaultParseWidth: "any",
2820
- valueCallback: (index) => index + 1
2821
- }),
2822
- month: buildMatchFn({
2823
- matchPatterns: matchMonthPatterns,
2824
- defaultMatchWidth: "wide",
2825
- parsePatterns: parseMonthPatterns,
2826
- defaultParseWidth: "any"
2827
- }),
2828
- day: buildMatchFn({
2829
- matchPatterns: matchDayPatterns,
2830
- defaultMatchWidth: "wide",
2831
- parsePatterns: parseDayPatterns,
2832
- defaultParseWidth: "any"
2833
- }),
2834
- dayPeriod: buildMatchFn({
2835
- matchPatterns: matchDayPeriodPatterns,
2836
- defaultMatchWidth: "any",
2837
- parsePatterns: parseDayPeriodPatterns,
2838
- defaultParseWidth: "any"
2839
- })
2840
- };
2841
-
2842
- // ../../node_modules/date-fns/locale/en-US.js
2843
- var enUS = {
2844
- code: "en-US",
2845
- formatDistance,
2846
- formatLong,
2847
- formatRelative,
2848
- localize,
2849
- match,
2850
- options: {
2851
- weekStartsOn: 0,
2852
- firstWeekContainsDate: 1
2853
- }
2854
- };
2855
-
2856
- // ../../node_modules/date-fns/getDayOfYear.js
2857
- function getDayOfYear(date, options) {
2858
- const _date = toDate(date, options?.in);
2859
- const diff = differenceInCalendarDays(_date, startOfYear(_date));
2860
- const dayOfYear = diff + 1;
2861
- return dayOfYear;
2862
- }
2863
-
2864
- // ../../node_modules/date-fns/getISOWeek.js
2865
- function getISOWeek(date, options) {
2866
- const _date = toDate(date, options?.in);
2867
- const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
2868
- return Math.round(diff / millisecondsInWeek) + 1;
2869
- }
2870
-
2871
- // ../../node_modules/date-fns/getWeekYear.js
2872
- function getWeekYear(date, options) {
2873
- const _date = toDate(date, options?.in);
2874
- const year = _date.getFullYear();
2875
- const defaultOptions2 = getDefaultOptions();
2876
- const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
2877
- const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
2878
- firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
2879
- firstWeekOfNextYear.setHours(0, 0, 0, 0);
2880
- const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
2881
- const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
2882
- firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
2883
- firstWeekOfThisYear.setHours(0, 0, 0, 0);
2884
- const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
2885
- if (+_date >= +startOfNextYear) {
2886
- return year + 1;
2887
- } else if (+_date >= +startOfThisYear) {
2888
- return year;
2889
- } else {
2890
- return year - 1;
2891
- }
2892
- }
2893
-
2894
- // ../../node_modules/date-fns/startOfWeekYear.js
2895
- function startOfWeekYear(date, options) {
2896
- const defaultOptions2 = getDefaultOptions();
2897
- const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
2898
- const year = getWeekYear(date, options);
2899
- const firstWeek = constructFrom(options?.in || date, 0);
2900
- firstWeek.setFullYear(year, 0, firstWeekContainsDate);
2901
- firstWeek.setHours(0, 0, 0, 0);
2902
- const _date = startOfWeek(firstWeek, options);
2903
- return _date;
2904
- }
2905
-
2906
- // ../../node_modules/date-fns/getWeek.js
2907
- function getWeek(date, options) {
2908
- const _date = toDate(date, options?.in);
2909
- const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
2910
- return Math.round(diff / millisecondsInWeek) + 1;
2911
- }
2912
-
2913
- // ../../node_modules/date-fns/_lib/addLeadingZeros.js
2914
- function addLeadingZeros(number, targetLength) {
2915
- const sign = number < 0 ? "-" : "";
2916
- const output = Math.abs(number).toString().padStart(targetLength, "0");
2917
- return sign + output;
2918
- }
2919
-
2920
- // ../../node_modules/date-fns/_lib/format/lightFormatters.js
2921
- var lightFormatters = {
2922
- // Year
2923
- y(date, token) {
2924
- const signedYear = date.getFullYear();
2925
- const year = signedYear > 0 ? signedYear : 1 - signedYear;
2926
- return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
2927
- },
2928
- // Month
2929
- M(date, token) {
2930
- const month = date.getMonth();
2931
- return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
2932
- },
2933
- // Day of the month
2934
- d(date, token) {
2935
- return addLeadingZeros(date.getDate(), token.length);
2936
- },
2937
- // AM or PM
2938
- a(date, token) {
2939
- const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
2940
- switch (token) {
2941
- case "a":
2942
- case "aa":
2943
- return dayPeriodEnumValue.toUpperCase();
2944
- case "aaa":
2945
- return dayPeriodEnumValue;
2946
- case "aaaaa":
2947
- return dayPeriodEnumValue[0];
2948
- case "aaaa":
2949
- default:
2950
- return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
2951
- }
2952
- },
2953
- // Hour [1-12]
2954
- h(date, token) {
2955
- return addLeadingZeros(date.getHours() % 12 || 12, token.length);
2956
- },
2957
- // Hour [0-23]
2958
- H(date, token) {
2959
- return addLeadingZeros(date.getHours(), token.length);
2960
- },
2961
- // Minute
2962
- m(date, token) {
2963
- return addLeadingZeros(date.getMinutes(), token.length);
2964
- },
2965
- // Second
2966
- s(date, token) {
2967
- return addLeadingZeros(date.getSeconds(), token.length);
2968
- },
2969
- // Fraction of second
2970
- S(date, token) {
2971
- const numberOfDigits = token.length;
2972
- const milliseconds = date.getMilliseconds();
2973
- const fractionalSeconds = Math.trunc(
2974
- milliseconds * Math.pow(10, numberOfDigits - 3)
2975
- );
2976
- return addLeadingZeros(fractionalSeconds, token.length);
2977
- }
2978
- };
2979
-
2980
- // ../../node_modules/date-fns/_lib/format/formatters.js
2981
- var dayPeriodEnum = {
2982
- am: "am",
2983
- pm: "pm",
2984
- midnight: "midnight",
2985
- noon: "noon",
2986
- morning: "morning",
2987
- afternoon: "afternoon",
2988
- evening: "evening",
2989
- night: "night"
2990
- };
2991
- var formatters = {
2992
- // Era
2993
- G: function(date, token, localize2) {
2994
- const era = date.getFullYear() > 0 ? 1 : 0;
2995
- switch (token) {
2996
- // AD, BC
2997
- case "G":
2998
- case "GG":
2999
- case "GGG":
3000
- return localize2.era(era, { width: "abbreviated" });
3001
- // A, B
3002
- case "GGGGG":
3003
- return localize2.era(era, { width: "narrow" });
3004
- // Anno Domini, Before Christ
3005
- case "GGGG":
3006
- default:
3007
- return localize2.era(era, { width: "wide" });
3008
- }
3009
- },
3010
- // Year
3011
- y: function(date, token, localize2) {
3012
- if (token === "yo") {
3013
- const signedYear = date.getFullYear();
3014
- const year = signedYear > 0 ? signedYear : 1 - signedYear;
3015
- return localize2.ordinalNumber(year, { unit: "year" });
3016
- }
3017
- return lightFormatters.y(date, token);
3018
- },
3019
- // Local week-numbering year
3020
- Y: function(date, token, localize2, options) {
3021
- const signedWeekYear = getWeekYear(date, options);
3022
- const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
3023
- if (token === "YY") {
3024
- const twoDigitYear = weekYear % 100;
3025
- return addLeadingZeros(twoDigitYear, 2);
3026
- }
3027
- if (token === "Yo") {
3028
- return localize2.ordinalNumber(weekYear, { unit: "year" });
3029
- }
3030
- return addLeadingZeros(weekYear, token.length);
3031
- },
3032
- // ISO week-numbering year
3033
- R: function(date, token) {
3034
- const isoWeekYear = getISOWeekYear(date);
3035
- return addLeadingZeros(isoWeekYear, token.length);
3036
- },
3037
- // Extended year. This is a single number designating the year of this calendar system.
3038
- // The main difference between `y` and `u` localizers are B.C. years:
3039
- // | Year | `y` | `u` |
3040
- // |------|-----|-----|
3041
- // | AC 1 | 1 | 1 |
3042
- // | BC 1 | 1 | 0 |
3043
- // | BC 2 | 2 | -1 |
3044
- // Also `yy` always returns the last two digits of a year,
3045
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
3046
- u: function(date, token) {
3047
- const year = date.getFullYear();
3048
- return addLeadingZeros(year, token.length);
3049
- },
3050
- // Quarter
3051
- Q: function(date, token, localize2) {
3052
- const quarter = Math.ceil((date.getMonth() + 1) / 3);
3053
- switch (token) {
3054
- // 1, 2, 3, 4
3055
- case "Q":
3056
- return String(quarter);
3057
- // 01, 02, 03, 04
3058
- case "QQ":
3059
- return addLeadingZeros(quarter, 2);
3060
- // 1st, 2nd, 3rd, 4th
3061
- case "Qo":
3062
- return localize2.ordinalNumber(quarter, { unit: "quarter" });
3063
- // Q1, Q2, Q3, Q4
3064
- case "QQQ":
3065
- return localize2.quarter(quarter, {
3066
- width: "abbreviated",
3067
- context: "formatting"
3068
- });
3069
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
3070
- case "QQQQQ":
3071
- return localize2.quarter(quarter, {
3072
- width: "narrow",
3073
- context: "formatting"
3074
- });
3075
- // 1st quarter, 2nd quarter, ...
3076
- case "QQQQ":
3077
- default:
3078
- return localize2.quarter(quarter, {
3079
- width: "wide",
3080
- context: "formatting"
3081
- });
3082
- }
3083
- },
3084
- // Stand-alone quarter
3085
- q: function(date, token, localize2) {
3086
- const quarter = Math.ceil((date.getMonth() + 1) / 3);
3087
- switch (token) {
3088
- // 1, 2, 3, 4
3089
- case "q":
3090
- return String(quarter);
3091
- // 01, 02, 03, 04
3092
- case "qq":
3093
- return addLeadingZeros(quarter, 2);
3094
- // 1st, 2nd, 3rd, 4th
3095
- case "qo":
3096
- return localize2.ordinalNumber(quarter, { unit: "quarter" });
3097
- // Q1, Q2, Q3, Q4
3098
- case "qqq":
3099
- return localize2.quarter(quarter, {
3100
- width: "abbreviated",
3101
- context: "standalone"
3102
- });
3103
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
3104
- case "qqqqq":
3105
- return localize2.quarter(quarter, {
3106
- width: "narrow",
3107
- context: "standalone"
3108
- });
3109
- // 1st quarter, 2nd quarter, ...
3110
- case "qqqq":
3111
- default:
3112
- return localize2.quarter(quarter, {
3113
- width: "wide",
3114
- context: "standalone"
3115
- });
3116
- }
3117
- },
3118
- // Month
3119
- M: function(date, token, localize2) {
3120
- const month = date.getMonth();
3121
- switch (token) {
3122
- case "M":
3123
- case "MM":
3124
- return lightFormatters.M(date, token);
3125
- // 1st, 2nd, ..., 12th
3126
- case "Mo":
3127
- return localize2.ordinalNumber(month + 1, { unit: "month" });
3128
- // Jan, Feb, ..., Dec
3129
- case "MMM":
3130
- return localize2.month(month, {
3131
- width: "abbreviated",
3132
- context: "formatting"
3133
- });
3134
- // J, F, ..., D
3135
- case "MMMMM":
3136
- return localize2.month(month, {
3137
- width: "narrow",
3138
- context: "formatting"
3139
- });
3140
- // January, February, ..., December
3141
- case "MMMM":
3142
- default:
3143
- return localize2.month(month, { width: "wide", context: "formatting" });
3144
- }
3145
- },
3146
- // Stand-alone month
3147
- L: function(date, token, localize2) {
3148
- const month = date.getMonth();
3149
- switch (token) {
3150
- // 1, 2, ..., 12
3151
- case "L":
3152
- return String(month + 1);
3153
- // 01, 02, ..., 12
3154
- case "LL":
3155
- return addLeadingZeros(month + 1, 2);
3156
- // 1st, 2nd, ..., 12th
3157
- case "Lo":
3158
- return localize2.ordinalNumber(month + 1, { unit: "month" });
3159
- // Jan, Feb, ..., Dec
3160
- case "LLL":
3161
- return localize2.month(month, {
3162
- width: "abbreviated",
3163
- context: "standalone"
3164
- });
3165
- // J, F, ..., D
3166
- case "LLLLL":
3167
- return localize2.month(month, {
3168
- width: "narrow",
3169
- context: "standalone"
3170
- });
3171
- // January, February, ..., December
3172
- case "LLLL":
3173
- default:
3174
- return localize2.month(month, { width: "wide", context: "standalone" });
3175
- }
3176
- },
3177
- // Local week of year
3178
- w: function(date, token, localize2, options) {
3179
- const week = getWeek(date, options);
3180
- if (token === "wo") {
3181
- return localize2.ordinalNumber(week, { unit: "week" });
3182
- }
3183
- return addLeadingZeros(week, token.length);
3184
- },
3185
- // ISO week of year
3186
- I: function(date, token, localize2) {
3187
- const isoWeek = getISOWeek(date);
3188
- if (token === "Io") {
3189
- return localize2.ordinalNumber(isoWeek, { unit: "week" });
3190
- }
3191
- return addLeadingZeros(isoWeek, token.length);
3192
- },
3193
- // Day of the month
3194
- d: function(date, token, localize2) {
3195
- if (token === "do") {
3196
- return localize2.ordinalNumber(date.getDate(), { unit: "date" });
3197
- }
3198
- return lightFormatters.d(date, token);
3199
- },
3200
- // Day of year
3201
- D: function(date, token, localize2) {
3202
- const dayOfYear = getDayOfYear(date);
3203
- if (token === "Do") {
3204
- return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
3205
- }
3206
- return addLeadingZeros(dayOfYear, token.length);
3207
- },
3208
- // Day of week
3209
- E: function(date, token, localize2) {
3210
- const dayOfWeek = date.getDay();
3211
- switch (token) {
3212
- // Tue
3213
- case "E":
3214
- case "EE":
3215
- case "EEE":
3216
- return localize2.day(dayOfWeek, {
3217
- width: "abbreviated",
3218
- context: "formatting"
3219
- });
3220
- // T
3221
- case "EEEEE":
3222
- return localize2.day(dayOfWeek, {
3223
- width: "narrow",
3224
- context: "formatting"
3225
- });
3226
- // Tu
3227
- case "EEEEEE":
3228
- return localize2.day(dayOfWeek, {
3229
- width: "short",
3230
- context: "formatting"
3231
- });
3232
- // Tuesday
3233
- case "EEEE":
3234
- default:
3235
- return localize2.day(dayOfWeek, {
3236
- width: "wide",
3237
- context: "formatting"
3238
- });
3239
- }
3240
- },
3241
- // Local day of week
3242
- e: function(date, token, localize2, options) {
3243
- const dayOfWeek = date.getDay();
3244
- const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
3245
- switch (token) {
3246
- // Numerical value (Nth day of week with current locale or weekStartsOn)
3247
- case "e":
3248
- return String(localDayOfWeek);
3249
- // Padded numerical value
3250
- case "ee":
3251
- return addLeadingZeros(localDayOfWeek, 2);
3252
- // 1st, 2nd, ..., 7th
3253
- case "eo":
3254
- return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
3255
- case "eee":
3256
- return localize2.day(dayOfWeek, {
3257
- width: "abbreviated",
3258
- context: "formatting"
3259
- });
3260
- // T
3261
- case "eeeee":
3262
- return localize2.day(dayOfWeek, {
3263
- width: "narrow",
3264
- context: "formatting"
3265
- });
3266
- // Tu
3267
- case "eeeeee":
3268
- return localize2.day(dayOfWeek, {
3269
- width: "short",
3270
- context: "formatting"
3271
- });
3272
- // Tuesday
3273
- case "eeee":
3274
- default:
3275
- return localize2.day(dayOfWeek, {
3276
- width: "wide",
3277
- context: "formatting"
3278
- });
3279
- }
3280
- },
3281
- // Stand-alone local day of week
3282
- c: function(date, token, localize2, options) {
3283
- const dayOfWeek = date.getDay();
3284
- const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
3285
- switch (token) {
3286
- // Numerical value (same as in `e`)
3287
- case "c":
3288
- return String(localDayOfWeek);
3289
- // Padded numerical value
3290
- case "cc":
3291
- return addLeadingZeros(localDayOfWeek, token.length);
3292
- // 1st, 2nd, ..., 7th
3293
- case "co":
3294
- return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
3295
- case "ccc":
3296
- return localize2.day(dayOfWeek, {
3297
- width: "abbreviated",
3298
- context: "standalone"
3299
- });
3300
- // T
3301
- case "ccccc":
3302
- return localize2.day(dayOfWeek, {
3303
- width: "narrow",
3304
- context: "standalone"
3305
- });
3306
- // Tu
3307
- case "cccccc":
3308
- return localize2.day(dayOfWeek, {
3309
- width: "short",
3310
- context: "standalone"
3311
- });
3312
- // Tuesday
3313
- case "cccc":
3314
- default:
3315
- return localize2.day(dayOfWeek, {
3316
- width: "wide",
3317
- context: "standalone"
3318
- });
3319
- }
3320
- },
3321
- // ISO day of week
3322
- i: function(date, token, localize2) {
3323
- const dayOfWeek = date.getDay();
3324
- const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
3325
- switch (token) {
3326
- // 2
3327
- case "i":
3328
- return String(isoDayOfWeek);
3329
- // 02
3330
- case "ii":
3331
- return addLeadingZeros(isoDayOfWeek, token.length);
3332
- // 2nd
3333
- case "io":
3334
- return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
3335
- // Tue
3336
- case "iii":
3337
- return localize2.day(dayOfWeek, {
3338
- width: "abbreviated",
3339
- context: "formatting"
3340
- });
3341
- // T
3342
- case "iiiii":
3343
- return localize2.day(dayOfWeek, {
3344
- width: "narrow",
3345
- context: "formatting"
3346
- });
3347
- // Tu
3348
- case "iiiiii":
3349
- return localize2.day(dayOfWeek, {
3350
- width: "short",
3351
- context: "formatting"
3352
- });
3353
- // Tuesday
3354
- case "iiii":
3355
- default:
3356
- return localize2.day(dayOfWeek, {
3357
- width: "wide",
3358
- context: "formatting"
3359
- });
3360
- }
3361
- },
3362
- // AM or PM
3363
- a: function(date, token, localize2) {
3364
- const hours = date.getHours();
3365
- const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
3366
- switch (token) {
3367
- case "a":
3368
- case "aa":
3369
- return localize2.dayPeriod(dayPeriodEnumValue, {
3370
- width: "abbreviated",
3371
- context: "formatting"
3372
- });
3373
- case "aaa":
3374
- return localize2.dayPeriod(dayPeriodEnumValue, {
3375
- width: "abbreviated",
3376
- context: "formatting"
3377
- }).toLowerCase();
3378
- case "aaaaa":
3379
- return localize2.dayPeriod(dayPeriodEnumValue, {
3380
- width: "narrow",
3381
- context: "formatting"
3382
- });
3383
- case "aaaa":
3384
- default:
3385
- return localize2.dayPeriod(dayPeriodEnumValue, {
3386
- width: "wide",
3387
- context: "formatting"
3388
- });
3389
- }
3390
- },
3391
- // AM, PM, midnight, noon
3392
- b: function(date, token, localize2) {
3393
- const hours = date.getHours();
3394
- let dayPeriodEnumValue;
3395
- if (hours === 12) {
3396
- dayPeriodEnumValue = dayPeriodEnum.noon;
3397
- } else if (hours === 0) {
3398
- dayPeriodEnumValue = dayPeriodEnum.midnight;
3399
- } else {
3400
- dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
3401
- }
3402
- switch (token) {
3403
- case "b":
3404
- case "bb":
3405
- return localize2.dayPeriod(dayPeriodEnumValue, {
3406
- width: "abbreviated",
3407
- context: "formatting"
3408
- });
3409
- case "bbb":
3410
- return localize2.dayPeriod(dayPeriodEnumValue, {
3411
- width: "abbreviated",
3412
- context: "formatting"
3413
- }).toLowerCase();
3414
- case "bbbbb":
3415
- return localize2.dayPeriod(dayPeriodEnumValue, {
3416
- width: "narrow",
3417
- context: "formatting"
3418
- });
3419
- case "bbbb":
3420
- default:
3421
- return localize2.dayPeriod(dayPeriodEnumValue, {
3422
- width: "wide",
3423
- context: "formatting"
3424
- });
3425
- }
3426
- },
3427
- // in the morning, in the afternoon, in the evening, at night
3428
- B: function(date, token, localize2) {
3429
- const hours = date.getHours();
3430
- let dayPeriodEnumValue;
3431
- if (hours >= 17) {
3432
- dayPeriodEnumValue = dayPeriodEnum.evening;
3433
- } else if (hours >= 12) {
3434
- dayPeriodEnumValue = dayPeriodEnum.afternoon;
3435
- } else if (hours >= 4) {
3436
- dayPeriodEnumValue = dayPeriodEnum.morning;
3437
- } else {
3438
- dayPeriodEnumValue = dayPeriodEnum.night;
3439
- }
3440
- switch (token) {
3441
- case "B":
3442
- case "BB":
3443
- case "BBB":
3444
- return localize2.dayPeriod(dayPeriodEnumValue, {
3445
- width: "abbreviated",
3446
- context: "formatting"
3447
- });
3448
- case "BBBBB":
3449
- return localize2.dayPeriod(dayPeriodEnumValue, {
3450
- width: "narrow",
3451
- context: "formatting"
3452
- });
3453
- case "BBBB":
3454
- default:
3455
- return localize2.dayPeriod(dayPeriodEnumValue, {
3456
- width: "wide",
3457
- context: "formatting"
3458
- });
3459
- }
3460
- },
3461
- // Hour [1-12]
3462
- h: function(date, token, localize2) {
3463
- if (token === "ho") {
3464
- let hours = date.getHours() % 12;
3465
- if (hours === 0) hours = 12;
3466
- return localize2.ordinalNumber(hours, { unit: "hour" });
3467
- }
3468
- return lightFormatters.h(date, token);
3469
- },
3470
- // Hour [0-23]
3471
- H: function(date, token, localize2) {
3472
- if (token === "Ho") {
3473
- return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
3474
- }
3475
- return lightFormatters.H(date, token);
3476
- },
3477
- // Hour [0-11]
3478
- K: function(date, token, localize2) {
3479
- const hours = date.getHours() % 12;
3480
- if (token === "Ko") {
3481
- return localize2.ordinalNumber(hours, { unit: "hour" });
3482
- }
3483
- return addLeadingZeros(hours, token.length);
3484
- },
3485
- // Hour [1-24]
3486
- k: function(date, token, localize2) {
3487
- let hours = date.getHours();
3488
- if (hours === 0) hours = 24;
3489
- if (token === "ko") {
3490
- return localize2.ordinalNumber(hours, { unit: "hour" });
3491
- }
3492
- return addLeadingZeros(hours, token.length);
3493
- },
3494
- // Minute
3495
- m: function(date, token, localize2) {
3496
- if (token === "mo") {
3497
- return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
3498
- }
3499
- return lightFormatters.m(date, token);
3500
- },
3501
- // Second
3502
- s: function(date, token, localize2) {
3503
- if (token === "so") {
3504
- return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
3505
- }
3506
- return lightFormatters.s(date, token);
3507
- },
3508
- // Fraction of second
3509
- S: function(date, token) {
3510
- return lightFormatters.S(date, token);
3511
- },
3512
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
3513
- X: function(date, token, _localize) {
3514
- const timezoneOffset = date.getTimezoneOffset();
3515
- if (timezoneOffset === 0) {
3516
- return "Z";
3517
- }
3518
- switch (token) {
3519
- // Hours and optional minutes
3520
- case "X":
3521
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
3522
- // Hours, minutes and optional seconds without `:` delimiter
3523
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
3524
- // so this token always has the same output as `XX`
3525
- case "XXXX":
3526
- case "XX":
3527
- return formatTimezone(timezoneOffset);
3528
- // Hours, minutes and optional seconds with `:` delimiter
3529
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
3530
- // so this token always has the same output as `XXX`
3531
- case "XXXXX":
3532
- case "XXX":
3533
- // Hours and minutes with `:` delimiter
3534
- default:
3535
- return formatTimezone(timezoneOffset, ":");
3536
- }
3537
- },
3538
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
3539
- x: function(date, token, _localize) {
3540
- const timezoneOffset = date.getTimezoneOffset();
3541
- switch (token) {
3542
- // Hours and optional minutes
3543
- case "x":
3544
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
3545
- // Hours, minutes and optional seconds without `:` delimiter
3546
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
3547
- // so this token always has the same output as `xx`
3548
- case "xxxx":
3549
- case "xx":
3550
- return formatTimezone(timezoneOffset);
3551
- // Hours, minutes and optional seconds with `:` delimiter
3552
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
3553
- // so this token always has the same output as `xxx`
3554
- case "xxxxx":
3555
- case "xxx":
3556
- // Hours and minutes with `:` delimiter
3557
- default:
3558
- return formatTimezone(timezoneOffset, ":");
3559
- }
3560
- },
3561
- // Timezone (GMT)
3562
- O: function(date, token, _localize) {
3563
- const timezoneOffset = date.getTimezoneOffset();
3564
- switch (token) {
3565
- // Short
3566
- case "O":
3567
- case "OO":
3568
- case "OOO":
3569
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
3570
- // Long
3571
- case "OOOO":
3572
- default:
3573
- return "GMT" + formatTimezone(timezoneOffset, ":");
3574
- }
3575
- },
3576
- // Timezone (specific non-location)
3577
- z: function(date, token, _localize) {
3578
- const timezoneOffset = date.getTimezoneOffset();
3579
- switch (token) {
3580
- // Short
3581
- case "z":
3582
- case "zz":
3583
- case "zzz":
3584
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
3585
- // Long
3586
- case "zzzz":
3587
- default:
3588
- return "GMT" + formatTimezone(timezoneOffset, ":");
3589
- }
3590
- },
3591
- // Seconds timestamp
3592
- t: function(date, token, _localize) {
3593
- const timestamp = Math.trunc(+date / 1e3);
3594
- return addLeadingZeros(timestamp, token.length);
3595
- },
3596
- // Milliseconds timestamp
3597
- T: function(date, token, _localize) {
3598
- return addLeadingZeros(+date, token.length);
3599
- }
3600
- };
3601
- function formatTimezoneShort(offset, delimiter = "") {
3602
- const sign = offset > 0 ? "-" : "+";
3603
- const absOffset = Math.abs(offset);
3604
- const hours = Math.trunc(absOffset / 60);
3605
- const minutes = absOffset % 60;
3606
- if (minutes === 0) {
3607
- return sign + String(hours);
3608
- }
3609
- return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
3610
- }
3611
- function formatTimezoneWithOptionalMinutes(offset, delimiter) {
3612
- if (offset % 60 === 0) {
3613
- const sign = offset > 0 ? "-" : "+";
3614
- return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
3615
- }
3616
- return formatTimezone(offset, delimiter);
3617
- }
3618
- function formatTimezone(offset, delimiter = "") {
3619
- const sign = offset > 0 ? "-" : "+";
3620
- const absOffset = Math.abs(offset);
3621
- const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
3622
- const minutes = addLeadingZeros(absOffset % 60, 2);
3623
- return sign + hours + delimiter + minutes;
3624
- }
3625
-
3626
- // ../../node_modules/date-fns/_lib/format/longFormatters.js
3627
- var dateLongFormatter = (pattern, formatLong2) => {
3628
- switch (pattern) {
3629
- case "P":
3630
- return formatLong2.date({ width: "short" });
3631
- case "PP":
3632
- return formatLong2.date({ width: "medium" });
3633
- case "PPP":
3634
- return formatLong2.date({ width: "long" });
3635
- case "PPPP":
3636
- default:
3637
- return formatLong2.date({ width: "full" });
3638
- }
3639
- };
3640
- var timeLongFormatter = (pattern, formatLong2) => {
3641
- switch (pattern) {
3642
- case "p":
3643
- return formatLong2.time({ width: "short" });
3644
- case "pp":
3645
- return formatLong2.time({ width: "medium" });
3646
- case "ppp":
3647
- return formatLong2.time({ width: "long" });
3648
- case "pppp":
3649
- default:
3650
- return formatLong2.time({ width: "full" });
3651
- }
3652
- };
3653
- var dateTimeLongFormatter = (pattern, formatLong2) => {
3654
- const matchResult = pattern.match(/(P+)(p+)?/) || [];
3655
- const datePattern = matchResult[1];
3656
- const timePattern = matchResult[2];
3657
- if (!timePattern) {
3658
- return dateLongFormatter(pattern, formatLong2);
3659
- }
3660
- let dateTimeFormat;
3661
- switch (datePattern) {
3662
- case "P":
3663
- dateTimeFormat = formatLong2.dateTime({ width: "short" });
3664
- break;
3665
- case "PP":
3666
- dateTimeFormat = formatLong2.dateTime({ width: "medium" });
3667
- break;
3668
- case "PPP":
3669
- dateTimeFormat = formatLong2.dateTime({ width: "long" });
3670
- break;
3671
- case "PPPP":
3672
- default:
3673
- dateTimeFormat = formatLong2.dateTime({ width: "full" });
3674
- break;
3675
- }
3676
- return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
3677
- };
3678
- var longFormatters = {
3679
- p: timeLongFormatter,
3680
- P: dateTimeLongFormatter
3681
- };
3682
-
3683
- // ../../node_modules/date-fns/_lib/protectedTokens.js
3684
- var dayOfYearTokenRE = /^D+$/;
3685
- var weekYearTokenRE = /^Y+$/;
3686
- var throwTokens = ["D", "DD", "YY", "YYYY"];
3687
- function isProtectedDayOfYearToken(token) {
3688
- return dayOfYearTokenRE.test(token);
3689
- }
3690
- function isProtectedWeekYearToken(token) {
3691
- return weekYearTokenRE.test(token);
3692
- }
3693
- function warnOrThrowProtectedError(token, format2, input) {
3694
- const _message = message(token, format2, input);
3695
- console.warn(_message);
3696
- if (throwTokens.includes(token)) throw new RangeError(_message);
3697
- }
3698
- function message(token, format2, input) {
3699
- const subject = token[0] === "Y" ? "years" : "days of the month";
3700
- return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format2}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
3701
- }
3702
-
3703
- // ../../node_modules/date-fns/format.js
3704
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
3705
- var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
3706
- var escapedStringRegExp = /^'([^]*?)'?$/;
3707
- var doubleQuoteRegExp = /''/g;
3708
- var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
3709
- function format(date, formatStr, options) {
3710
- const defaultOptions2 = getDefaultOptions();
3711
- const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
3712
- const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
3713
- const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
3714
- const originalDate = toDate(date, options?.in);
3715
- if (!isValid(originalDate)) {
3716
- throw new RangeError("Invalid time value");
3717
- }
3718
- let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
3719
- const firstCharacter = substring[0];
3720
- if (firstCharacter === "p" || firstCharacter === "P") {
3721
- const longFormatter = longFormatters[firstCharacter];
3722
- return longFormatter(substring, locale.formatLong);
3723
- }
3724
- return substring;
3725
- }).join("").match(formattingTokensRegExp).map((substring) => {
3726
- if (substring === "''") {
3727
- return { isToken: false, value: "'" };
3728
- }
3729
- const firstCharacter = substring[0];
3730
- if (firstCharacter === "'") {
3731
- return { isToken: false, value: cleanEscapedString(substring) };
3732
- }
3733
- if (formatters[firstCharacter]) {
3734
- return { isToken: true, value: substring };
3735
- }
3736
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
3737
- throw new RangeError(
3738
- "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
3739
- );
3740
- }
3741
- return { isToken: false, value: substring };
3742
- });
3743
- if (locale.localize.preprocessor) {
3744
- parts = locale.localize.preprocessor(originalDate, parts);
3745
- }
3746
- const formatterOptions = {
3747
- firstWeekContainsDate,
3748
- weekStartsOn,
3749
- locale
3750
- };
3751
- return parts.map((part) => {
3752
- if (!part.isToken) return part.value;
3753
- const token = part.value;
3754
- if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
3755
- warnOrThrowProtectedError(token, formatStr, String(date));
3756
- }
3757
- const formatter = formatters[token[0]];
3758
- return formatter(originalDate, token, locale.localize, formatterOptions);
3759
- }).join("");
3760
- }
3761
- function cleanEscapedString(input) {
3762
- const matched = input.match(escapedStringRegExp);
3763
- if (!matched) {
3764
- return input;
3765
- }
3766
- return matched[1].replace(doubleQuoteRegExp, "'");
3767
- }
3768
-
3769
2200
  // components/customer/chat-message.tsx
2201
+ var import_date_fns = require("date-fns");
3770
2202
  var import_lucide_react5 = require("lucide-react");
3771
2203
 
3772
2204
  // components/markdown-renderer.tsx
@@ -3817,7 +2249,7 @@ function MarkdownRenderer({ content }) {
3817
2249
  // components/customer/chat-message.tsx
3818
2250
  var import_jsx_runtime11 = require("react/jsx-runtime");
3819
2251
  var Message = ({
3820
- message: message2,
2252
+ message,
3821
2253
  isConsecutive,
3822
2254
  onRetry
3823
2255
  }) => {
@@ -3846,34 +2278,34 @@ var Message = ({
3846
2278
  "div",
3847
2279
  {
3848
2280
  className: "flex justify-start gap-2",
3849
- "data-message-id": message2.id,
2281
+ "data-message-id": message.id,
3850
2282
  role: "article",
3851
- "aria-label": `Message from ${message2.senderId}`,
2283
+ "aria-label": `Message from ${message.senderId}`,
3852
2284
  children: [
3853
2285
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex pt-10 w-10", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w-8 h-8 rounded-full flex justify-center", children: [
3854
- message2.role === "user" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.User, {}),
3855
- message2.role === "ai" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.Bot, {}),
3856
- message2.role === "humanAgent" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.UserCog, {})
2286
+ message.role === "user" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.User, {}),
2287
+ message.role === "ai" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.Bot, {}),
2288
+ message.role === "humanAgent" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.UserCog, {})
3857
2289
  ] }) }),
3858
2290
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3859
2291
  "div",
3860
2292
  {
3861
2293
  className: `p-3 rounded-lg max-w-[80%] bg-gray-100 text-primary-900 ${isConsecutive ? "mt-1" : "mt-4"}`,
3862
2294
  children: [
3863
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "break-words", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkdownRenderer, { content: message2.content }) }),
3864
- message2.attachments?.map(
2295
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "break-words", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkdownRenderer, { content: message.content }) }),
2296
+ message.attachments?.map(
3865
2297
  (attachment, i) => renderAttachment(attachment, i)
3866
2298
  ),
3867
2299
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-end space-x-1 mt-1", children: [
3868
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-xs opacity-70", children: format(message2.time, "HH:mm") }),
3869
- message2.role === "user" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
3870
- message2.status === "sending" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-4 h-4 animate-spin rounded-full border-2 border-gray-300 border-t-white" }),
3871
- message2.status === "sent" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.Check, { className: "w-4 h-4" }),
3872
- message2.status === "delivered" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.CheckCheck, { className: "w-4 h-4" }),
3873
- message2.status === "failed" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2300
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-xs opacity-70", children: (0, import_date_fns.format)(message.time, "HH:mm") }),
2301
+ message.role === "user" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
2302
+ message.status === "sending" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-4 h-4 animate-spin rounded-full border-2 border-gray-300 border-t-white" }),
2303
+ message.status === "sent" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.Check, { className: "w-4 h-4" }),
2304
+ message.status === "delivered" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.CheckCheck, { className: "w-4 h-4" }),
2305
+ message.status === "failed" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3874
2306
  "button",
3875
2307
  {
3876
- onClick: () => onRetry(message2.id),
2308
+ onClick: () => onRetry(message.id),
3877
2309
  className: "text-red-300 hover:text-red-400",
3878
2310
  "aria-label": "Retry sending message",
3879
2311
  children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.AlertCircle, { className: "w-4 h-4" })