react-semaphor 0.1.449 → 0.1.453

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.
Files changed (134) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +115 -109
  3. package/dist/appearance/index.cjs +1 -1
  4. package/dist/appearance/index.js +1 -1
  5. package/dist/brand-studio/index.cjs +4 -4
  6. package/dist/brand-studio/index.js +15 -13
  7. package/dist/briefings/index.cjs +1 -1
  8. package/dist/briefings/index.js +39 -2131
  9. package/dist/chunks/{analyze-result-contract-BHb7sUUW.cjs → analyze-result-contract-Dxw66nUG.cjs} +1 -1
  10. package/dist/chunks/{analyze-result-contract-T-0Ntzys.js → analyze-result-contract-GHKFwThg.js} +1 -1
  11. package/dist/chunks/canonical-result-keys-Drc2x-lf.cjs +1 -0
  12. package/dist/chunks/canonical-result-keys-KLk__J_O.js +466 -0
  13. package/dist/chunks/color-CJvdlFM_.js +2162 -0
  14. package/dist/chunks/color-CyB5o13F.cjs +4 -0
  15. package/dist/chunks/{common-types-CQ6SHfLk.cjs → common-types-Ci66eflG.cjs} +1 -1
  16. package/dist/chunks/{common-types-B7Jk3Rtj.js → common-types-F6qk6PPS.js} +1 -1
  17. package/dist/chunks/contracts-CoCOpd_i.js +11 -0
  18. package/dist/chunks/contracts-CtB2VONT.cjs +1 -0
  19. package/dist/chunks/{dashboard-briefing-launcher-DCHiEkLE.js → dashboard-briefing-launcher-CFpX0WX3.js} +86 -84
  20. package/dist/chunks/dashboard-briefing-launcher-mUXWuiOZ.cjs +26 -0
  21. package/dist/chunks/{dashboard-controls-DwRFCcHV.js → dashboard-controls-BeYAmOJc.js} +15 -13
  22. package/dist/chunks/{dashboard-controls-CaFioayc.cjs → dashboard-controls-SoNubIu1.cjs} +1 -1
  23. package/dist/chunks/dashboard-json-BublPnQ4.cjs +1 -0
  24. package/dist/chunks/{dashboard-json-WoILbfTe.js → dashboard-json-DeLUagVV.js} +25 -23
  25. package/dist/chunks/edit-dashboard-visual-CrvPcO7A.cjs +172 -0
  26. package/dist/chunks/{edit-dashboard-visual-ciFhxqaI.js → edit-dashboard-visual-Go0h82DR.js} +6925 -6947
  27. package/dist/chunks/editor-action-buttons-1Lo0fIh7.cjs +16 -0
  28. package/dist/chunks/{editor-action-buttons-BPo_45pM.js → editor-action-buttons-BFNtjFzO.js} +41 -39
  29. package/dist/chunks/format-types-CFHQoIuk.js +1350 -0
  30. package/dist/chunks/format-types-PSZZ7hG8.cjs +1 -0
  31. package/dist/chunks/index-B3ZugihZ.js +3713 -0
  32. package/dist/chunks/{index-CPuawpXJ.js → index-BsH32bn1.js} +47472 -47845
  33. package/dist/chunks/index-ByFbacH7.cjs +1 -0
  34. package/dist/chunks/index-CACdoqu3.js +318 -0
  35. package/dist/chunks/index-DSKR3nKn.js +421 -0
  36. package/dist/chunks/index-DjiIh_9n.cjs +4 -0
  37. package/dist/chunks/index-F25jnH0p.cjs +1 -0
  38. package/dist/chunks/index-q12_nNUS.cjs +1392 -0
  39. package/dist/chunks/{metric-comparison-97zHGEx5.js → metric-comparison-D0T0MKRK.js} +1 -1
  40. package/dist/chunks/{metric-comparison-CUAJ8n4y.cjs → metric-comparison-DYR3RXam.cjs} +1 -1
  41. package/dist/chunks/pivot-header-presentation-DcfPaCiy.cjs +4 -0
  42. package/dist/chunks/pivot-header-presentation-nk604qc1.js +557 -0
  43. package/dist/chunks/{pivot-result-identity-CwJWpKI7.js → pivot-result-identity-C43Ai5Kr.js} +1 -1
  44. package/dist/chunks/{pivot-result-identity-CDLRT-YG.cjs → pivot-result-identity-CRUokNgm.cjs} +1 -1
  45. package/dist/chunks/pivot-result-lifecycle-4kSe0Hk1.js +1642 -0
  46. package/dist/chunks/pivot-result-lifecycle-BiJepH5S.cjs +1 -0
  47. package/dist/chunks/raw-temporal-contract-BF7PjBY9.js +64 -0
  48. package/dist/chunks/raw-temporal-contract-CxbRFwnd.cjs +1 -0
  49. package/dist/chunks/report-preferences-dialog-BEVZAE3m.cjs +1 -0
  50. package/dist/chunks/report-preferences-dialog-BNV7qXYH.js +723 -0
  51. package/dist/chunks/{report-runtime-context-bCy3CVzK.js → report-runtime-context-BJQDu2fV.js} +1 -1
  52. package/dist/chunks/{report-runtime-context-C8LZFsqV.cjs → report-runtime-context-DjYqLV-c.cjs} +1 -1
  53. package/dist/chunks/saved-temporal-bucket-format-DiZdQXOL.js +924 -0
  54. package/dist/chunks/saved-temporal-bucket-format-Gfbh4IiP.cjs +1 -0
  55. package/dist/chunks/switch-CjJ6FHYJ.cjs +138 -0
  56. package/dist/chunks/{switch-BXet-Sno.js → switch-DgLwr7O-.js} +4352 -5249
  57. package/dist/chunks/temporal-bucket-Dnj8qT9l.cjs +1 -0
  58. package/dist/chunks/temporal-bucket-FBZGrDCe.js +560 -0
  59. package/dist/chunks/temporal-bucket-authoring-7hv2laOG.cjs +1 -0
  60. package/dist/chunks/temporal-bucket-authoring-FIRnJz0e.js +221 -0
  61. package/dist/chunks/{temporal-bucket-contract-_F6vNhhH.js → temporal-bucket-contract-BQOj6Frl.js} +1 -1
  62. package/dist/chunks/{temporal-bucket-contract-ChDBWX8I.cjs → temporal-bucket-contract-anl4h-vg.cjs} +1 -1
  63. package/dist/chunks/{token-types-BHR58aTy.js → token-types-CRpQJ4kv.js} +1 -1
  64. package/dist/chunks/{token-types-BdQ8kHBm.cjs → token-types-D0i0IUX3.cjs} +1 -1
  65. package/dist/chunks/{update-policy-BxvYMYz0.cjs → update-policy-C1i9bgsy.cjs} +1 -1
  66. package/dist/chunks/{update-policy-g0rCQ9BM.js → update-policy-CaJz9aPG.js} +1 -1
  67. package/dist/chunks/{validators-Cs74WVie.js → validators-DeMXwRON.js} +253 -233
  68. package/dist/chunks/validators-Dm7Kpz6p.cjs +1 -0
  69. package/dist/dashboard/index.cjs +1 -1
  70. package/dist/dashboard/index.js +2 -2
  71. package/dist/dashboard-authoring/index.cjs +3 -3
  72. package/dist/dashboard-authoring/index.js +32 -29
  73. package/dist/data-app-builder/index.cjs +1 -1
  74. package/dist/data-app-builder/index.js +2 -2
  75. package/dist/data-app-codegen/index.cjs +1 -1
  76. package/dist/data-app-codegen/index.js +2 -2
  77. package/dist/data-app-codegen-node/index.cjs +1 -1
  78. package/dist/data-app-codegen-node/index.js +3 -3
  79. package/dist/data-app-sdk/index.cjs +1 -1
  80. package/dist/data-app-sdk/index.js +3 -3
  81. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  82. package/dist/data-app-sdk-adapters/index.js +2 -2
  83. package/dist/data-app-sdk-validation/index.cjs +1 -1
  84. package/dist/data-app-sdk-validation/index.js +3 -3
  85. package/dist/format-utils/index.cjs +3 -3
  86. package/dist/format-utils/index.js +162 -145
  87. package/dist/index.cjs +1 -1
  88. package/dist/index.js +157 -155
  89. package/dist/report-runtime-context/index.cjs +1 -1
  90. package/dist/report-runtime-context/index.js +2 -2
  91. package/dist/style.css +1 -1
  92. package/dist/surfboard/index.cjs +1 -1
  93. package/dist/surfboard/index.js +3 -3
  94. package/dist/types/analytics-protocol.d.ts +37 -0
  95. package/dist/types/briefings.d.ts +718 -7
  96. package/dist/types/dashboard-assistant.d.ts +18 -0
  97. package/dist/types/dashboard-authoring.d.ts +52 -2
  98. package/dist/types/dashboard.d.ts +128 -0
  99. package/dist/types/data-app-sdk-validation.d.ts +13 -0
  100. package/dist/types/data-app-sdk.d.ts +13 -0
  101. package/dist/types/format-utils.d.ts +190 -3
  102. package/dist/types/index.cjs +1 -1
  103. package/dist/types/index.js +4 -4
  104. package/dist/types/main.d.ts +103 -12
  105. package/dist/types/shared.d.ts +5 -0
  106. package/dist/types/surfboard.d.ts +129 -1
  107. package/dist/types/types.d.ts +98 -6
  108. package/dist/types/value-format-preferences.d.ts +3 -0
  109. package/package.json +2 -1
  110. package/dist/chunks/card-config-utils-15sRtebL.cjs +0 -1
  111. package/dist/chunks/card-config-utils-BYZ5MJOh.js +0 -16
  112. package/dist/chunks/dashboard-briefing-launcher-DDgDr2s3.cjs +0 -26
  113. package/dist/chunks/dashboard-json-CYtvwtvj.cjs +0 -1
  114. package/dist/chunks/edit-dashboard-visual-DwKcvlsF.cjs +0 -177
  115. package/dist/chunks/editor-action-buttons-BVmsk0Aj.cjs +0 -16
  116. package/dist/chunks/format-types-CSv0V7mm.cjs +0 -1
  117. package/dist/chunks/format-types-DZGgYj39.js +0 -1663
  118. package/dist/chunks/index-CJdxSyQq.js +0 -2578
  119. package/dist/chunks/index-DPv8_Ild.cjs +0 -1395
  120. package/dist/chunks/index-DRlMUglg.cjs +0 -4
  121. package/dist/chunks/pivot-result-lifecycle-BBabQ_da.js +0 -914
  122. package/dist/chunks/pivot-result-lifecycle-DPc0ANwk.cjs +0 -4
  123. package/dist/chunks/presentation-execution-BLfPTGX_.js +0 -637
  124. package/dist/chunks/presentation-execution-BTV-Q43g.cjs +0 -1
  125. package/dist/chunks/report-preferences-dialog-D9ZCGh9l.js +0 -691
  126. package/dist/chunks/report-preferences-dialog-DaqTEcac.cjs +0 -1
  127. package/dist/chunks/switch-Cjk6G06r.cjs +0 -138
  128. package/dist/chunks/temporal-bucket-BnPxGrAi.js +0 -446
  129. package/dist/chunks/temporal-bucket-authoring-CPTwHzvs.cjs +0 -1
  130. package/dist/chunks/temporal-bucket-authoring-CgOuakGW.js +0 -205
  131. package/dist/chunks/temporal-bucket-pMnV-4Nj.cjs +0 -1
  132. package/dist/chunks/temporal-result-owner-6peubmhU.js +0 -443
  133. package/dist/chunks/temporal-result-owner-f6-i65Fb.cjs +0 -1
  134. package/dist/chunks/validators-9D4KBqKD.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";const l=require("./color-CyB5o13F.cjs"),m=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#84cc16","#f97316"],M={version:1,mode:"system",schemes:{light:{tokens:{color:{background:"hsl(0 0% 100%)",foreground:"hsl(240 5.9% 10%)",muted:"hsl(0 0% 98%)",mutedForeground:"hsl(240 3.8% 46.1%)",border:"hsl(240 5.9% 90%)",input:"hsl(240 5.9% 90%)",primary:"hsl(240 5.9% 10%)",primaryForeground:"hsl(0 0% 98%)",accent:"hsl(240 4.8% 95.9%)",accentForeground:"hsl(240 5.9% 10%)",card:"hsl(0 0% 100%)",cardForeground:"hsl(240 5.9% 10%)",positive:"#16a34a",negative:"#dc2626",warning:"#d97706",info:"#0284c7",destructive:"hsl(0 72.2% 50.6%)",destructiveForeground:"hsl(0 0% 98%)"},typography:{fontFamily:l.SEMAPHOR_DEFAULT_FONT_FAMILY,headingFontFamily:l.SEMAPHOR_HEADING_FONT_FAMILY,monoFontFamily:l.SEMAPHOR_MONO_FONT_FAMILY,baseFontSize:14,density:"comfortable"},radius:{control:5,card:5,table:5,badge:999},spacing:{dashboardPadding:16,gridGap:12,cardPadding:16,controlGap:8,tableCellX:12,tableCellY:8},shadow:{card:"0 1px 2px rgba(15, 23, 42, 0.08)",popover:"0 12px 32px rgba(15, 23, 42, 0.14)",focusRing:"0 0 0 2px rgba(37, 99, 235, 0.35)"}},components:{chart:{palette:m},table:{density:"compact"}}},dark:{tokens:{color:{background:"hsl(240 10% 3.9%)",foreground:"hsl(0 0% 93%)",muted:"hsl(240 5.9% 10%)",mutedForeground:"hsl(240 5% 64.9%)",border:"hsl(240 3.7% 15.9%)",input:"hsl(240 3.7% 15.9%)",primary:"hsl(0 0% 98%)",primaryForeground:"hsl(240 5.9% 10%)",accent:"hsl(240 3.7% 15.9%)",accentForeground:"hsl(0 0% 93%)",card:"hsl(240 10% 3.9%)",cardForeground:"hsl(0 0% 93%)",positive:"#22c55e",negative:"#f87171",warning:"#fbbf24",info:"#38bdf8",destructive:"hsl(0 62.8% 30.6%)",destructiveForeground:"hsl(0 0% 93%)"},typography:{fontFamily:l.SEMAPHOR_DEFAULT_FONT_FAMILY,headingFontFamily:l.SEMAPHOR_HEADING_FONT_FAMILY,monoFontFamily:l.SEMAPHOR_MONO_FONT_FAMILY,baseFontSize:14,density:"comfortable"},radius:{control:5,card:5,table:5,badge:999},spacing:{dashboardPadding:16,gridGap:12,cardPadding:16,controlGap:8,tableCellX:12,tableCellY:8},shadow:{card:"0 1px 2px rgba(0, 0, 0, 0.3)",popover:"0 12px 32px rgba(0, 0, 0, 0.45)",focusRing:"0 0 0 2px rgba(96, 165, 250, 0.35)"}},components:{chart:{palette:m},table:{density:"compact"}}}}},A=v(M);function v(e){if(typeof e!="object"||e===null||Object.isFrozen(e))return e;Object.freeze(e);for(const o of Object.values(e))v(o);return e}const y=1,w=new Set(["light","dark","system"]),x=new Set(["compact","comfortable","spacious"]),L=Object.fromEntries(["background","foreground","muted","mutedForeground","border","input","primary","primaryForeground","accent","accentForeground","card","cardForeground","positive","negative","warning","info","destructive","destructiveForeground"].map(e=>[e,n])),j={fontFamily:d,headingFontFamily:d,monoFontFamily:d,baseFontSize:u,density:O},H={control:c,card:c,table:c,badge:c},I={dashboardPadding:c,gridGap:c,cardPadding:c,controlGap:c,tableCellX:c,tableCellY:c},D={card:d,popover:d,focusRing:d},f={background:n,foreground:n,borderColor:n,borderRadius:c,shadow:d,padding:c},z={...f,toolbarBackground:n},V={palette:K,background:n,foreground:n,gridColor:n,axisColor:n},Y={background:n,borderColor:n,borderRadius:c,shadow:d},g={density:O,container:t(Y),header:t({background:n,foreground:n,dividerColor:n,fontWeight:u,uppercase:b,sticky:b}),row:t({height:u,dividerColor:n,zebra:b,zebraBackground:n,hoverBackground:n,selectedBackground:n}),cell:t({paddingX:c,paddingY:c,verticalAlign:q,wrap:J}),subtotal:t({background:n,foreground:n,fontWeight:u}),grandTotal:t({background:n,foreground:n,fontWeight:u,borderColor:n}),pagination:t({background:n,foreground:n,borderColor:n})},U={color:t(L),typography:t(j),radius:t(H),spacing:t(I),shadow:t(D)},$={dashboard:t(f),card:t(f),interactive:t(z),chart:t(V),table:t(g),pivotTable:t(g),aggregateTable:t(g),pagination:t(f)},E={tokens:t(U),components:t($)},G={light:t(E),dark:t(E)},B={version:W,mode:X,schemes:t(G)};function P(e){const o=[];return t(B)(e,"$",o),C(e)&&!("version"in e)&&i(o,"$.version","invalid_version","version must be 1"),o.length>0?{success:!1,issues:o}:{success:!0,value:e,issues:[]}}function F(e){const o=P(e);if(o.success)return;const r=o.issues[0];throw new Error(`Invalid AppearanceSpec at ${r.path}: ${r.message}`)}function t(e){return(o,r,a)=>{if(!C(o)){i(a,r,"invalid_type","expected an object");return}for(const s of Object.keys(o)){const S=e[s],_=`${r}.${s}`;if(!S){i(a,_,"unsupported_field","field is not supported in AppearanceSpec V1");continue}S(o[s],_,a)}}}function W(e,o,r){e!==y&&i(r,o,"invalid_version","version must be 1")}function X(e,o,r){(typeof e!="string"||!w.has(e))&&i(r,o,"invalid_value","mode must be light, dark, or system")}function O(e,o,r){(typeof e!="string"||!x.has(e))&&i(r,o,"invalid_value","density must be compact, comfortable, or spacious")}function q(e,o,r){e!=="top"&&e!=="middle"&&e!=="bottom"&&i(r,o,"invalid_value","verticalAlign must be top, middle, or bottom")}function J(e,o,r){e!=="wrap"&&e!=="nowrap"&&i(r,o,"invalid_value","wrap must be wrap or nowrap")}function b(e,o,r){typeof e!="boolean"&&i(r,o,"invalid_type","expected a boolean")}function n(e,o,r){if(typeof e!="string"||e.trim()===""){i(r,o,"invalid_type","color must be a non-empty string");return}l.parseAppearanceColor(e)||i(r,o,"invalid_color","color must be a valid opaque CSS color")}function K(e,o,r){if(!Array.isArray(e)){i(r,o,"invalid_type","expected an array of colors");return}if(e.length===0){i(r,o,"invalid_value","palette must contain at least one color");return}e.forEach((a,s)=>n(a,`${o}[${s}]`,r))}function d(e,o,r){(typeof e!="string"||e.trim()==="")&&i(r,o,"invalid_type","expected a non-empty string")}function u(e,o,r){(typeof e!="number"||!Number.isFinite(e)||e<=0)&&i(r,o,"invalid_value","expected a positive number")}function c(e,o,r){(typeof e!="number"||!Number.isFinite(e)||e<0)&&i(r,o,"invalid_value","expected a non-negative number")}function i(e,o,r,a){e.push({path:o,code:r,message:a})}function C(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const o=Object.getPrototypeOf(e);return o===Object.prototype||o===null}function k(e,o=A){return F(e),N(o,e)}function R(e,o){return F(o),N(e,o)}function N(e,o){return T(e,o)}function T(e,o){if(o===void 0)return p(e);if(Array.isArray(e)||Array.isArray(o))return p(o);if(h(e)&&h(o)){const r=p(e);for(const[a,s]of Object.entries(o)){if(a==="version"){r[a]=s;continue}r[a]=a in r?T(r[a],s):p(s)}return r}return p(o)}function p(e){return Array.isArray(e)?e.map(o=>p(o)):h(e)?Object.fromEntries(Object.entries(e).map(([o,r])=>[o,p(r)])):e}function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Q(e={}){const o=e.defaults??A;let r=k({version:y},o);for(const a of[e.organizationAppearance,e.tokenAppearance,e.reactAppearance])a&&(r=R(r,a));return r}exports.APPEARANCE_SPEC_VERSION=y;exports.SEMAPHOR_DEFAULT_APPEARANCE_SPEC=A;exports.SEMAPHOR_DEFAULT_CHART_PALETTE=m;exports.assertValidAppearanceSpec=F;exports.mergeAppearanceSpecs=R;exports.normalizeAppearanceSpec=k;exports.resolveAppearance=Q;exports.validateAppearanceSpec=P;
@@ -0,0 +1,318 @@
1
+ function F(e, t) {
2
+ const n = b(t);
3
+ return "formatToParts" in n ? $(n, e) : A(n, e);
4
+ }
5
+ const _ = {
6
+ year: 0,
7
+ month: 1,
8
+ day: 2,
9
+ hour: 3,
10
+ minute: 4,
11
+ second: 5
12
+ };
13
+ function $(e, t) {
14
+ try {
15
+ const n = e.formatToParts(t), r = [];
16
+ for (let i = 0; i < n.length; i++) {
17
+ const a = _[n[i].type];
18
+ a !== void 0 && (r[a] = parseInt(n[i].value, 10));
19
+ }
20
+ return r;
21
+ } catch (n) {
22
+ if (n instanceof RangeError)
23
+ return [NaN];
24
+ throw n;
25
+ }
26
+ }
27
+ function A(e, t) {
28
+ const n = e.format(t), r = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);
29
+ return [
30
+ parseInt(r[3], 10),
31
+ parseInt(r[1], 10),
32
+ parseInt(r[2], 10),
33
+ parseInt(r[4], 10),
34
+ parseInt(r[5], 10),
35
+ parseInt(r[6], 10)
36
+ ];
37
+ }
38
+ const f = {}, m = new Intl.DateTimeFormat("en-US", {
39
+ hourCycle: "h23",
40
+ timeZone: "America/New_York",
41
+ year: "numeric",
42
+ month: "2-digit",
43
+ day: "2-digit",
44
+ hour: "2-digit",
45
+ minute: "2-digit",
46
+ second: "2-digit"
47
+ }).format(/* @__PURE__ */ new Date("2014-06-25T04:00:00.123Z")), S = m === "06/25/2014, 00:00:00" || m === "‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";
48
+ function b(e) {
49
+ return f[e] || (f[e] = S ? new Intl.DateTimeFormat("en-US", {
50
+ hourCycle: "h23",
51
+ timeZone: e,
52
+ year: "numeric",
53
+ month: "numeric",
54
+ day: "2-digit",
55
+ hour: "2-digit",
56
+ minute: "2-digit",
57
+ second: "2-digit"
58
+ }) : new Intl.DateTimeFormat("en-US", {
59
+ hour12: !1,
60
+ timeZone: e,
61
+ year: "numeric",
62
+ month: "numeric",
63
+ day: "2-digit",
64
+ hour: "2-digit",
65
+ minute: "2-digit",
66
+ second: "2-digit"
67
+ })), f[e];
68
+ }
69
+ function Y(e, t, n, r, i, a, s) {
70
+ const u = /* @__PURE__ */ new Date(0);
71
+ return u.setUTCFullYear(e, t, n), u.setUTCHours(r, i, a, s), u;
72
+ }
73
+ const T = 36e5, L = 6e4, D = {
74
+ timezoneZ: /^(Z)$/,
75
+ timezoneHH: /^([+-]\d{2})$/,
76
+ timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/
77
+ };
78
+ function O(e, t, n) {
79
+ if (!e)
80
+ return 0;
81
+ let r = D.timezoneZ.exec(e);
82
+ if (r)
83
+ return 0;
84
+ let i, a;
85
+ if (r = D.timezoneHH.exec(e), r)
86
+ return i = parseInt(r[1], 10), I(i) ? -(i * T) : NaN;
87
+ if (r = D.timezoneHHMM.exec(e), r) {
88
+ i = parseInt(r[2], 10);
89
+ const s = parseInt(r[3], 10);
90
+ return I(i, s) ? (a = Math.abs(i) * T + s * L, r[1] === "+" ? -a : a) : NaN;
91
+ }
92
+ if (z(e)) {
93
+ t = new Date(t || Date.now());
94
+ const s = n ? t : Z(t), u = p(s, e);
95
+ return -(n ? u : E(t, u, e));
96
+ }
97
+ return NaN;
98
+ }
99
+ function Z(e) {
100
+ return Y(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds());
101
+ }
102
+ function p(e, t) {
103
+ const n = F(e, t), r = Y(n[0], n[1] - 1, n[2], n[3] % 24, n[4], n[5], 0).getTime();
104
+ let i = e.getTime();
105
+ const a = i % 1e3;
106
+ return i -= a >= 0 ? a : 1e3 + a, r - i;
107
+ }
108
+ function E(e, t, n) {
109
+ let i = e.getTime() - t;
110
+ const a = p(new Date(i), n);
111
+ if (t === a)
112
+ return t;
113
+ i -= a - t;
114
+ const s = p(new Date(i), n);
115
+ return a === s ? a : Math.max(a, s);
116
+ }
117
+ function I(e, t) {
118
+ return -23 <= e && e <= 23 && (t == null || 0 <= t && t <= 59);
119
+ }
120
+ const w = {};
121
+ function z(e) {
122
+ if (w[e])
123
+ return !0;
124
+ try {
125
+ return new Intl.DateTimeFormat(void 0, { timeZone: e }), w[e] = !0, !0;
126
+ } catch {
127
+ return !1;
128
+ }
129
+ }
130
+ function g(e) {
131
+ const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()));
132
+ return t.setUTCFullYear(e.getFullYear()), +e - +t;
133
+ }
134
+ const U = /(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/, N = 36e5, M = 6e4, W = 2, o = {
135
+ dateTimePattern: /^([0-9W+-]+)(T| )(.*)/,
136
+ datePattern: /^([0-9W+-]+)(.*)/,
137
+ // year tokens
138
+ YY: /^(\d{2})$/,
139
+ YYY: [
140
+ /^([+-]\d{2})$/,
141
+ // 0 additional digits
142
+ /^([+-]\d{3})$/,
143
+ // 1 additional digit
144
+ /^([+-]\d{4})$/
145
+ // 2 additional digits
146
+ ],
147
+ YYYY: /^(\d{4})/,
148
+ YYYYY: [
149
+ /^([+-]\d{4})/,
150
+ // 0 additional digits
151
+ /^([+-]\d{5})/,
152
+ // 1 additional digit
153
+ /^([+-]\d{6})/
154
+ // 2 additional digits
155
+ ],
156
+ // date tokens
157
+ MM: /^-(\d{2})$/,
158
+ DDD: /^-?(\d{3})$/,
159
+ MMDD: /^-?(\d{2})-?(\d{2})$/,
160
+ Www: /^-?W(\d{2})$/,
161
+ WwwD: /^-?W(\d{2})-?(\d{1})$/,
162
+ HH: /^(\d{2}([.,]\d*)?)$/,
163
+ HHMM: /^(\d{2}):?(\d{2}([.,]\d*)?)$/,
164
+ HHMMSS: /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,
165
+ // time zone tokens (to identify the presence of a tz)
166
+ timeZone: U
167
+ };
168
+ function h(e, t = {}) {
169
+ if (arguments.length < 1)
170
+ throw new TypeError("1 argument required, but only " + arguments.length + " present");
171
+ if (e === null)
172
+ return /* @__PURE__ */ new Date(NaN);
173
+ const n = t.additionalDigits == null ? W : Number(t.additionalDigits);
174
+ if (n !== 2 && n !== 1 && n !== 0)
175
+ throw new RangeError("additionalDigits must be 0, 1 or 2");
176
+ if (e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]")
177
+ return new Date(e.getTime());
178
+ if (typeof e == "number" || Object.prototype.toString.call(e) === "[object Number]")
179
+ return new Date(e);
180
+ if (Object.prototype.toString.call(e) !== "[object String]")
181
+ return /* @__PURE__ */ new Date(NaN);
182
+ const r = k(e), { year: i, restDateString: a } = P(r.date, n), s = v(a, i);
183
+ if (s === null || isNaN(s.getTime()))
184
+ return /* @__PURE__ */ new Date(NaN);
185
+ if (s) {
186
+ const u = s.getTime();
187
+ let c = 0, l;
188
+ if (r.time && (c = j(r.time), c === null || isNaN(c)))
189
+ return /* @__PURE__ */ new Date(NaN);
190
+ if (r.timeZone || t.timeZone) {
191
+ if (l = O(r.timeZone || t.timeZone, new Date(u + c)), isNaN(l))
192
+ return /* @__PURE__ */ new Date(NaN);
193
+ } else
194
+ l = g(new Date(u + c)), l = g(new Date(u + c + l));
195
+ return new Date(u + c + l);
196
+ } else
197
+ return /* @__PURE__ */ new Date(NaN);
198
+ }
199
+ function k(e) {
200
+ const t = {};
201
+ let n = o.dateTimePattern.exec(e), r;
202
+ if (n ? (t.date = n[1], r = n[3]) : (n = o.datePattern.exec(e), n ? (t.date = n[1], r = n[2]) : (t.date = null, r = e)), r) {
203
+ const i = o.timeZone.exec(r);
204
+ i ? (t.time = r.replace(i[1], ""), t.timeZone = i[1].trim()) : t.time = r;
205
+ }
206
+ return t;
207
+ }
208
+ function P(e, t) {
209
+ if (e) {
210
+ const n = o.YYY[t], r = o.YYYYY[t];
211
+ let i = o.YYYY.exec(e) || r.exec(e);
212
+ if (i) {
213
+ const a = i[1];
214
+ return {
215
+ year: parseInt(a, 10),
216
+ restDateString: e.slice(a.length)
217
+ };
218
+ }
219
+ if (i = o.YY.exec(e) || n.exec(e), i) {
220
+ const a = i[1];
221
+ return {
222
+ year: parseInt(a, 10) * 100,
223
+ restDateString: e.slice(a.length)
224
+ };
225
+ }
226
+ }
227
+ return {
228
+ year: null
229
+ };
230
+ }
231
+ function v(e, t) {
232
+ if (t === null)
233
+ return null;
234
+ let n, r, i;
235
+ if (!e || !e.length)
236
+ return n = /* @__PURE__ */ new Date(0), n.setUTCFullYear(t), n;
237
+ let a = o.MM.exec(e);
238
+ if (a)
239
+ return n = /* @__PURE__ */ new Date(0), r = parseInt(a[1], 10) - 1, x(t, r) ? (n.setUTCFullYear(t, r), n) : /* @__PURE__ */ new Date(NaN);
240
+ if (a = o.DDD.exec(e), a) {
241
+ n = /* @__PURE__ */ new Date(0);
242
+ const s = parseInt(a[1], 10);
243
+ return q(t, s) ? (n.setUTCFullYear(t, 0, s), n) : /* @__PURE__ */ new Date(NaN);
244
+ }
245
+ if (a = o.MMDD.exec(e), a) {
246
+ n = /* @__PURE__ */ new Date(0), r = parseInt(a[1], 10) - 1;
247
+ const s = parseInt(a[2], 10);
248
+ return x(t, r, s) ? (n.setUTCFullYear(t, r, s), n) : /* @__PURE__ */ new Date(NaN);
249
+ }
250
+ if (a = o.Www.exec(e), a)
251
+ return i = parseInt(a[1], 10) - 1, C(i) ? H(t, i) : /* @__PURE__ */ new Date(NaN);
252
+ if (a = o.WwwD.exec(e), a) {
253
+ i = parseInt(a[1], 10) - 1;
254
+ const s = parseInt(a[2], 10) - 1;
255
+ return C(i, s) ? H(t, i, s) : /* @__PURE__ */ new Date(NaN);
256
+ }
257
+ return null;
258
+ }
259
+ function j(e) {
260
+ let t, n, r = o.HH.exec(e);
261
+ if (r)
262
+ return t = parseFloat(r[1].replace(",", ".")), d(t) ? t % 24 * N : NaN;
263
+ if (r = o.HHMM.exec(e), r)
264
+ return t = parseInt(r[1], 10), n = parseFloat(r[2].replace(",", ".")), d(t, n) ? t % 24 * N + n * M : NaN;
265
+ if (r = o.HHMMSS.exec(e), r) {
266
+ t = parseInt(r[1], 10), n = parseInt(r[2], 10);
267
+ const i = parseFloat(r[3].replace(",", "."));
268
+ return d(t, n, i) ? t % 24 * N + n * M + i * 1e3 : NaN;
269
+ }
270
+ return null;
271
+ }
272
+ function H(e, t, n) {
273
+ t = t || 0, n = n || 0;
274
+ const r = /* @__PURE__ */ new Date(0);
275
+ r.setUTCFullYear(e, 0, 4);
276
+ const i = r.getUTCDay() || 7, a = t * 7 + n + 1 - i;
277
+ return r.setUTCDate(r.getUTCDate() + a), r;
278
+ }
279
+ const R = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], G = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
280
+ function y(e) {
281
+ return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
282
+ }
283
+ function x(e, t, n) {
284
+ if (t < 0 || t > 11)
285
+ return !1;
286
+ if (n != null) {
287
+ if (n < 1)
288
+ return !1;
289
+ const r = y(e);
290
+ if (r && n > G[t] || !r && n > R[t])
291
+ return !1;
292
+ }
293
+ return !0;
294
+ }
295
+ function q(e, t) {
296
+ if (t < 1)
297
+ return !1;
298
+ const n = y(e);
299
+ return !(n && t > 366 || !n && t > 365);
300
+ }
301
+ function C(e, t) {
302
+ return !(e < 0 || e > 52 || t != null && (t < 0 || t > 6));
303
+ }
304
+ function d(e, t, n) {
305
+ return !(e < 0 || e >= 25 || t != null && (t < 0 || t >= 60) || n != null && (n < 0 || n >= 60));
306
+ }
307
+ function J(e, t, n) {
308
+ if (typeof e == "string" && !e.match(U))
309
+ return h(e, { ...n, timeZone: t });
310
+ e = h(e, n);
311
+ const r = Y(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()).getTime(), i = O(t, new Date(r));
312
+ return new Date(r + i);
313
+ }
314
+ export {
315
+ h as a,
316
+ J as f,
317
+ O as t
318
+ };