react-semaphor 0.1.443 → 0.1.445

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 (133) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/analytics-protocol/index.cjs +1 -1
  3. package/dist/analytics-protocol/index.js +123 -107
  4. package/dist/appearance/index.cjs +1 -1
  5. package/dist/brand-studio/index.cjs +2 -2
  6. package/dist/brand-studio/index.js +5 -4
  7. package/dist/briefings/index.cjs +1 -1
  8. package/dist/briefings/index.js +526 -457
  9. package/dist/chunks/analyze-result-contract-BHb7sUUW.cjs +1 -0
  10. package/dist/chunks/analyze-result-contract-DUv3QnMl.js +29 -0
  11. package/dist/chunks/{braces-CbO-aIwH.js → braces-BKimshER.cjs} +1 -1
  12. package/dist/chunks/{code-editor-BpADiIlq.js → code-editor-B4gTfvc5.js} +6800 -6560
  13. package/dist/chunks/code-editor-BYVorgOf.cjs +138 -0
  14. package/dist/chunks/common-types-CQ6SHfLk.cjs +1 -0
  15. package/dist/chunks/{common-types-ClkOI-3O.js → common-types-DFsDdpH7.js} +22 -21
  16. package/dist/chunks/dashboard-CAiwJW3L.cjs +1397 -0
  17. package/dist/chunks/{dashboard-briefing-launcher-C60n8LqW.js → dashboard-briefing-launcher-2SLNOaTg.js} +26 -24
  18. package/dist/chunks/{dashboard-briefing-launcher-BYMLjZxG.js → dashboard-briefing-launcher-CHwjpUYz.cjs} +2 -2
  19. package/dist/chunks/{dashboard-controls-ti9Rcel2.js → dashboard-controls-BfL14aqO.js} +11 -9
  20. package/dist/chunks/{dashboard-controls-BH_fZYDU.js → dashboard-controls-BgGTg4yw.cjs} +2 -2
  21. package/dist/chunks/dashboard-date-comparison-definition-DZq0htjG.cjs +1 -0
  22. package/dist/chunks/dashboard-json-BOv8tCa9.cjs +1 -0
  23. package/dist/chunks/{dashboard-json-Bturr634.js → dashboard-json-BZwq3EcS.js} +14 -12
  24. package/dist/chunks/{dashboard-Bd1Quco-.js → dashboard-u61yfU6u.js} +50081 -47351
  25. package/dist/chunks/edit-dashboard-visual-BdVCH0DJ.cjs +182 -0
  26. package/dist/chunks/{edit-dashboard-visual-DglMds57.js → edit-dashboard-visual-njLPYip3.js} +6825 -6656
  27. package/dist/chunks/{editor-action-buttons-CRi0fhVW.js → editor-action-buttons-BhLX5Q6m.js} +24 -23
  28. package/dist/chunks/{editor-action-buttons-Cxo7_tNG.js → editor-action-buttons-CBVMFipA.cjs} +1 -1
  29. package/dist/chunks/{index-D7KJindZ.js → format-types-CSv0V7mm.cjs} +1 -1
  30. package/dist/chunks/{index-CnujJ3fa.js → format-types-CZH5w1lo.js} +23 -17
  31. package/dist/chunks/{layout-grid-B08pP7v6.js → layout-grid-3-HWzEwU.cjs} +1 -1
  32. package/dist/chunks/{metric-comparison-CPoDx56y.js → metric-comparison-BJ_Qu1ZF.js} +1 -1
  33. package/dist/chunks/metric-comparison-CUAJ8n4y.cjs +1 -0
  34. package/dist/chunks/{palette-C0yjT5Tv.js → palette-DW_l7Jr0.cjs} +1 -1
  35. package/dist/chunks/pivot-result-identity-B6QCWOSi.js +94 -0
  36. package/dist/chunks/pivot-result-identity-CDLRT-YG.cjs +1 -0
  37. package/dist/chunks/pivot-result-lifecycle-BM3Pl-D1.js +914 -0
  38. package/dist/chunks/pivot-result-lifecycle-DPc0ANwk.cjs +4 -0
  39. package/dist/chunks/presentation-execution-BTV-Q43g.cjs +1 -0
  40. package/dist/chunks/presentation-execution-CGlb7YZ6.js +637 -0
  41. package/dist/chunks/{report-preferences-dialog-TtwdAuNn.js → report-preferences-dialog-D_NJu2wU.js} +7 -6
  42. package/dist/chunks/report-preferences-dialog-r8QzOSFb.cjs +1 -0
  43. package/dist/chunks/report-runtime-context-C8LZFsqV.cjs +1 -0
  44. package/dist/chunks/report-runtime-context-Qzn11HQe.js +387 -0
  45. package/dist/chunks/{save-Xdc4pnys.js → save-4_uMnE6s.cjs} +1 -1
  46. package/dist/chunks/{search-Dcud9ajy.js → search-6ZmeMq55.cjs} +1 -1
  47. package/dist/chunks/temporal-bucket-BnPxGrAi.js +446 -0
  48. package/dist/chunks/temporal-bucket-authoring-BUZMuVca.js +205 -0
  49. package/dist/chunks/temporal-bucket-authoring-CPTwHzvs.cjs +1 -0
  50. package/dist/chunks/temporal-bucket-contract-B2bJ1oe4.js +108 -0
  51. package/dist/chunks/temporal-bucket-contract-ChDBWX8I.cjs +1 -0
  52. package/dist/chunks/temporal-bucket-pMnV-4Nj.cjs +1 -0
  53. package/dist/chunks/{comparison-document-migration-Dj6xZMCb.js → temporal-result-owner-Cb27SSG9.js} +152 -123
  54. package/dist/chunks/temporal-result-owner-f6-i65Fb.cjs +1 -0
  55. package/dist/chunks/token-types-BdQ8kHBm.cjs +1 -0
  56. package/dist/chunks/token-types-DLo91nOf.js +8 -0
  57. package/dist/chunks/{update-policy-DnF_74zC.js → update-policy-BxvYMYz0.cjs} +1 -1
  58. package/dist/chunks/{update-policy-De2NswtM.js → update-policy-eg59mQqv.js} +1 -1
  59. package/dist/chunks/validators-9D4KBqKD.cjs +1 -0
  60. package/dist/chunks/validators-wZ2WlNHc.js +4640 -0
  61. package/dist/dashboard/index.cjs +1 -1
  62. package/dist/dashboard/index.js +2 -2
  63. package/dist/dashboard-authoring/index.cjs +3 -3
  64. package/dist/dashboard-authoring/index.js +136 -126
  65. package/dist/data-app-builder/index.cjs +1 -1
  66. package/dist/data-app-builder/index.js +2 -2
  67. package/dist/data-app-codegen/index.cjs +1 -1
  68. package/dist/data-app-codegen/index.js +2 -2
  69. package/dist/data-app-codegen-node/index.cjs +1 -1
  70. package/dist/data-app-codegen-node/index.js +3 -3
  71. package/dist/data-app-sdk/index.cjs +2 -2
  72. package/dist/data-app-sdk/index.js +34 -35
  73. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  74. package/dist/data-app-sdk-adapters/index.js +5 -5
  75. package/dist/data-app-sdk-validation/index.cjs +1 -1
  76. package/dist/data-app-sdk-validation/index.js +9 -10
  77. package/dist/format-utils/index.cjs +3 -3
  78. package/dist/format-utils/index.js +155 -176
  79. package/dist/index.cjs +1 -1
  80. package/dist/index.js +180 -174
  81. package/dist/report-runtime-context/index.cjs +1 -1
  82. package/dist/report-runtime-context/index.js +7 -392
  83. package/dist/shared/index.cjs +1 -1
  84. package/dist/style.css +1 -1
  85. package/dist/surfboard/index.cjs +1 -1
  86. package/dist/surfboard/index.js +3 -3
  87. package/dist/types/analytics-protocol.d.ts +257 -48
  88. package/dist/types/briefings.d.ts +138 -50
  89. package/dist/types/dashboard-assistant.d.ts +207 -52
  90. package/dist/types/dashboard-authoring.d.ts +182 -50
  91. package/dist/types/dashboard.d.ts +290 -48
  92. package/dist/types/data-app-builder.d.ts +48 -42
  93. package/dist/types/data-app-codegen-node.d.ts +50 -44
  94. package/dist/types/data-app-codegen.d.ts +50 -44
  95. package/dist/types/data-app-sdk-adapters.d.ts +48 -42
  96. package/dist/types/data-app-sdk-validation.d.ts +81 -43
  97. package/dist/types/data-app-sdk.d.ts +83 -45
  98. package/dist/types/format-utils.d.ts +645 -67
  99. package/dist/types/index.cjs +1 -1
  100. package/dist/types/index.js +19 -19
  101. package/dist/types/main.d.ts +298 -94
  102. package/dist/types/report-runtime-context.d.ts +3 -0
  103. package/dist/types/shared.d.ts +116 -41
  104. package/dist/types/surfboard.d.ts +290 -48
  105. package/dist/types/types.d.ts +455 -65
  106. package/package.json +3 -1
  107. package/dist/chunks/analyze-result-contract-BswhsmWT.js +0 -1
  108. package/dist/chunks/analyze-result-contract-CfOBEwaC.js +0 -1998
  109. package/dist/chunks/code-editor-M7HTUhdF.js +0 -138
  110. package/dist/chunks/common-types-C73-Ud1-.js +0 -1
  111. package/dist/chunks/comparison-document-migration-DbU_BTxR.js +0 -1
  112. package/dist/chunks/csv-utils-BZDvO2Fw.js +0 -376
  113. package/dist/chunks/csv-utils-Co0WxHke.js +0 -4
  114. package/dist/chunks/dashboard-cB3xmTNn.js +0 -1402
  115. package/dist/chunks/dashboard-date-comparison-definition-DGZr3m-b.js +0 -1
  116. package/dist/chunks/dashboard-json-Dw_55vSZ.js +0 -1
  117. package/dist/chunks/edit-dashboard-visual-BUc3NBQ4.js +0 -182
  118. package/dist/chunks/metric-comparison-DVy3fll_.js +0 -1
  119. package/dist/chunks/numeric-presentation-BJs5lSar.js +0 -517
  120. package/dist/chunks/numeric-presentation-Dlb-Dk4c.js +0 -1
  121. package/dist/chunks/report-preferences-dialog-CCvFqH4Q.js +0 -1
  122. package/dist/chunks/source-identity-5OPV4gvg.js +0 -92
  123. package/dist/chunks/source-identity-Cbo2LOHQ.js +0 -1
  124. package/dist/chunks/validators-B2vUAqTf.js +0 -1
  125. package/dist/chunks/validators-Bce_J7Vd.js +0 -2448
  126. /package/dist/chunks/{card-config-utils-15sRtebL.js → card-config-utils-15sRtebL.cjs} +0 -0
  127. /package/dist/chunks/{catalog-field-grounding-Bnx-3tE0.js → catalog-field-grounding-Bnx-3tE0.cjs} +0 -0
  128. /package/dist/chunks/{dashboard-input-contract-DV3cshjz.js → dashboard-input-contract-DV3cshjz.cjs} +0 -0
  129. /package/dist/chunks/{index-Dpm_VET4.js → index-Dpm_VET4.cjs} +0 -0
  130. /package/dist/chunks/{index-jSrCwPQz.js → index-jSrCwPQz.cjs} +0 -0
  131. /package/dist/chunks/{normalize-dashboard-for-dirty-check-BXRUMVb2.js → normalize-dashboard-for-dirty-check-BXRUMVb2.cjs} +0 -0
  132. /package/dist/chunks/{operators-DrTQsJXv.js → operators-DrTQsJXv.cjs} +0 -0
  133. /package/dist/chunks/{use-debounced-dirty-check-XHSwAefL.js → use-debounced-dirty-check-XHSwAefL.cjs} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),l=require("react"),n=require("./dashboard-CAiwJW3L.cjs"),o=require("./code-editor-BYVorgOf.cjs"),V=require("./report-runtime-context-C8LZFsqV.cjs");require("./index-jSrCwPQz.cjs");require("./validators-9D4KBqKD.cjs");require("./analyze-result-contract-BHb7sUUW.cjs");const D=require("../value-format-preferences/index.cjs");function M(s={}){const{authToken:i,tokenProps:a}=n.useSemaphorContext(),p=o.useDashboardStore(C=>C.actions.applyResolvedCalendarPreferences),d=s.enabled??!0,c=(i==null?void 0:i.accessToken)??null,m=(a==null?void 0:a.apiServiceUrl)??null,[v,b]=l.useState(!1),[g,j]=l.useState(!1),[y,k]=l.useState(!1),[T,f]=l.useState(null),[N,P]=l.useState(null),h=l.useRef(c);h.current=c,l.useEffect(()=>{P(null),f(null),b(!1),j(!1),k(!1)},[c]);const w=l.useCallback(async C=>{const r=V.parseCalendarPreferencesResponse(await C.json());if(!r.ok)throw new Error("Calendar preferences response is invalid");return r.value},[]),S=l.useCallback(async()=>{if(!d||!c||!m)return;const C=c;b(!0),f(null);try{const r=await fetch(`${m}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${c}`}});if(!r.ok){const x=await r.json().catch(()=>({}));throw new Error(x.error||"Failed to fetch preferences")}const t=await w(r);h.current===C&&P(t)}catch(r){h.current===C&&f(r instanceof Error?r.message:"Unknown error")}finally{h.current===C&&b(!1)}},[c,m,d,w]);l.useEffect(()=>{d&&S()},[d,S]);const E=l.useCallback(async C=>{if(!c||!m)return f("Not authenticated"),!1;const r=c;j(!0),f(null);try{const t=await fetch(`${m}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify(C)});if(!t.ok){const z=await t.json().catch(()=>({}));throw new Error(z.error||"Failed to update preferences")}const x=await w(t);return h.current!==r?!1:(P(x),p(x.resolved,x.sources),!0)}catch(t){return h.current===r&&f(t instanceof Error?t.message:"Unknown error"),!1}finally{h.current===r&&j(!1)}},[c,m,p,w]),A=l.useCallback(async()=>{if(!c||!m)return f("Not authenticated"),!1;const C=c;k(!0),f(null);try{const r=await fetch(`${m}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${c}`}});if(!r.ok){const x=await r.json().catch(()=>({}));throw new Error(x.error||"Failed to clear preferences")}const t=await w(r);return h.current!==C?!1:(P(t),p(t.resolved,t.sources),!0)}catch(r){return h.current===C&&f(r instanceof Error?r.message:"Unknown error"),!1}finally{h.current===C&&k(!1)}},[c,m,p,w]);return{preferences:N,isLoading:v,isSaving:g,isClearing:y,error:T,updatePreferences:E,clearPreferences:A,refetch:S}}const F=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],I=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],R="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function _(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return F.map(s=>s.value)}function G(s){if(!s)return"default";if(s.tz!==s.weekStart)return"inherited";switch(s.tz){case"viewer_tenant":return"tenant";case"viewer_organization":return"organization";case"system_default":return"system";case"session_initial":return"embedded";default:return"default"}}function U(s){const i=F.find(a=>a.value===s);return i?i.label:s}function W(s){const i=I.find(a=>a.value===s);return i?i.label:String(s)}function H({active:s,onClose:i}){const{preferences:a,isLoading:p,isSaving:d,isClearing:c,updatePreferences:m,clearPreferences:v}=M({enabled:s}),b=n.useCalendarContext(),g=(a==null?void 0:a.resolved.tz)||(b==null?void 0:b.tz)||"UTC",j=(a==null?void 0:a.resolved.weekStart)??(b==null?void 0:b.weekStart)??1,[y,k]=l.useState((a==null?void 0:a.stored)===null),[T,f]=l.useState(!1),[N,P]=l.useState(g),[h,w]=l.useState(j),[S,E]=l.useState(!1),A=l.useMemo(()=>_(),[]),C=l.useMemo(()=>A.filter(u=>!F.some($=>$.value===u)),[A]),r=l.useMemo(()=>U(N),[N]),t=a!=null&&a.inherited?U(a.inherited.tz):"UTC",x=a!=null&&a.inherited?W(a.inherited.weekStart):"Monday",z=G(a==null?void 0:a.inheritedSources);l.useEffect(()=>{if(!s){f(!1);return}T||(a&&k(a.stored===null),P(g),w(j))},[s,T,a,g,j]);const q=async()=>{if(p){n.ue.error("Preferences are still loading. Please try again.");return}y?await v()?(n.ue.success("Now using default settings."),i()):n.ue.error("Failed to save preferences. Please try again."):await m({tz:N,weekStart:h})?(n.ue.success("Preferences saved."),i()):n.ue.error("Failed to save preferences. Please try again.")},B=()=>{i()},L=d||c,O=L||p;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(n.RadioGroup,{value:y?"defaults":"custom",onValueChange:u=>{f(!0),k(u==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",y&&"bg-muted/50"),onClick:()=>{f(!0),k(!0)},children:[e.jsx(n.RadioGroupItem,{value:"defaults",id:"mode-defaults",className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-[13px] font-medium text-foreground",children:["Use ",z," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[t,", week starts ",x]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!y&&"bg-muted/50"),onClick:()=>{f(!0),k(!1)},children:[e.jsx(n.RadioGroupItem,{value:"custom",id:"mode-custom",className:"mt-0.5"}),e.jsx("p",{className:"flex-1 text-[13px] font-medium text-foreground",children:"Use custom settings"})]})]}),e.jsxs("div",{className:o.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",y&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:R,children:"Timezone"}),e.jsxs(o.Popover,{open:S,onOpenChange:E,modal:!0,children:[e.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxs(o.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":S,className:"w-full justify-between text-[12px] font-normal",disabled:y,children:[e.jsx("span",{className:"truncate",children:r}),e.jsx(n.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(o.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(n.Command,{className:"overflow-visible",children:[e.jsx(n.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(n.CommandList,{children:[e.jsx(n.CommandEmpty,{children:"No timezone found."}),e.jsx(n.CommandGroup,{heading:"Common",children:F.map(u=>e.jsxs(n.CommandItem,{value:`${u.value} ${u.label}`,onSelect:()=>{f(!0),P(u.value),E(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",N===u.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:u.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:u.value})]},u.value))}),e.jsx(n.CommandSeparator,{}),e.jsx(n.CommandGroup,{heading:"All timezones",children:C.map(u=>e.jsxs(n.CommandItem,{value:u,onSelect:()=>{f(!0),P(u),E(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",N===u?"opacity-100":"opacity-0")}),u]},u))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:R,children:"Week starts on"}),e.jsx(n.RadioGroup,{value:String(h),onValueChange:u=>{f(!0),w(Number(u))},className:"flex gap-4",disabled:y,children:I.map(u=>e.jsxs("label",{htmlFor:`week-start-${u.value}`,className:o.cn("flex cursor-pointer items-center gap-2 text-[13px]",y&&"cursor-not-allowed"),children:[e.jsx(n.RadioGroupItem,{value:String(u.value),id:`week-start-${u.value}`,disabled:y}),u.label]},u.value))})]})]})]}),e.jsxs(n.DialogFooter,{children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:B,disabled:L,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:q,disabled:O,children:L?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})}function K(s={}){const{authToken:i,tokenProps:a}=n.useSemaphorContext(),p=o.useDashboardStore(r=>r.actions.applyResolvedValueFormatPreferences),d=s.enabled??!0,c=(i==null?void 0:i.accessToken)??null,m=(a==null?void 0:a.apiServiceUrl)??null,v=l.useRef(c);v.current=c;const[b,g]=l.useState(null),[j,y]=l.useState(!1),[k,T]=l.useState(!1),[f,N]=l.useState(!1),[P,h]=l.useState(null);l.useEffect(()=>{g(null),h(null),y(!1),T(!1),N(!1)},[c]);const w=l.useCallback(async r=>{const t=D.parseValueFormatPreferencesResponse(await r.json());if(!t.ok)throw new Error("Value format preferences response is invalid");return t.value},[]),S=l.useCallback(async(r,t)=>{if(!c||!m)throw new Error("Not authenticated");const x=await fetch(`${m}/v1/user-preferences/value-format`,{method:r,headers:{Authorization:`Bearer ${c}`,...t?{"Content-Type":"application/json"}:{}},body:t?JSON.stringify(t):void 0});if(!x.ok){const z=await x.json().catch(()=>({}));throw new Error(z.error||"Failed to update preferences")}return w(x)},[c,m,w]),E=l.useCallback(async()=>{if(!d||!c||!m)return;const r=c;y(!0),h(null);try{const t=await S("GET");v.current===r&&g(t)}catch(t){v.current===r&&h(t instanceof Error?t.message:"Unknown error")}finally{v.current===r&&y(!1)}},[c,m,d,S]);l.useEffect(()=>{d&&E()},[d,E]);const A=l.useCallback(async r=>{const t=c;T(!0),h(null);try{const x=await S("PATCH",r);return v.current!==t?!1:(g(x),p(x.resolved,x.sources),!0)}catch(x){return v.current===t&&h(x instanceof Error?x.message:"Unknown error"),!1}finally{v.current===t&&T(!1)}},[c,p,S]),C=l.useCallback(async()=>{const r=c;N(!0),h(null);try{const t=await S("DELETE");return v.current!==r?!1:(g(t),p(t.resolved,t.sources),!0)}catch(t){return v.current===r&&h(t instanceof Error?t.message:"Unknown error"),!1}finally{v.current===r&&N(!1)}},[c,p,S]);return{preferences:b,isLoading:j,isSaving:k,isClearing:f,error:P,updatePreferences:A,clearPreferences:C,refetch:E}}function J({active:s,onClose:i}){var v,b;const{preferences:a,isLoading:p,isSaving:d,updatePreferences:c}=K({enabled:s});if(!s)return null;if(!a)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"flex min-h-36 items-center justify-center text-[12px] text-muted-foreground",children:p?"Loading preferences…":"Preferences unavailable."})}),e.jsxs(n.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",disabled:!0,children:"Reset locale and currency"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:i,children:"Cancel"}),e.jsx(o.Button,{size:"xs",disabled:!0,children:"Save"})]})]})]});const m=[((v=a.stored)==null?void 0:v.locale)??"",((b=a.stored)==null?void 0:b.defaultCurrency)??""].join(":");return e.jsx(Z,{preferences:a,isSaving:d,updatePreferences:c,onClose:i},m)}function Z({preferences:s,isSaving:i,updatePreferences:a,onClose:p}){const[d,c]=l.useState(()=>{var g,j;return{locale:(g=s.stored)==null?void 0:g.locale,defaultCurrency:(j=s.stored)==null?void 0:j.defaultCurrency}}),m=(d.locale===void 0||D.canonicalizeSupportedLocale(d.locale)!==void 0)&&(d.defaultCurrency===void 0||D.canonicalizeSupportedCurrencyCode(d.defaultCurrency)!==void 0),v=async()=>{var T,f;const g={},j=[];d.locale!==void 0?g.locale=d.locale:((T=s.stored)==null?void 0:T.locale)!==void 0&&j.push("locale"),d.defaultCurrency!==void 0?g.defaultCurrency=d.defaultCurrency:((f=s.stored)==null?void 0:f.defaultCurrency)!==void 0&&j.push("defaultCurrency");const y={...Object.keys(g).length>0?{set:g}:{},...j.length>0?{clear:j}:{}};(Object.keys(y).length===0?!0:await a(y))?(n.ue.success("Display format preferences saved."),p()):n.ue.error("Failed to save preferences. Please try again.")},b=async()=>{await a({clear:["locale","defaultCurrency"]})?(n.ue.success("Locale and currency preferences reset."),p()):n.ue.error("Failed to reset locale and currency preferences. Please try again.")};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(n.DisplayFormatPreferencesFields,{value:d,inherited:s.inherited,inheritedSources:s.inheritedSources,onChange:c,disabled:i})}),e.jsxs(n.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",onClick:b,disabled:i||s.stored===null,children:"Reset locale and currency"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:p,disabled:i,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:v,disabled:i||!m,children:i?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})]})}function Y({open:s,onOpenChange:i}){const[a,p]=l.useState("display"),d=()=>i(!1);return e.jsx(n.Dialog,{open:s,onOpenChange:i,children:e.jsxs(n.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(n.DialogHeader,{children:[e.jsx(n.DialogTitle,{className:"text-[15px]",children:"Report preferences"}),e.jsx(n.DialogDescription,{className:"text-[13px] leading-5",children:"Set how values and Calendar periods appear for you."})]}),e.jsxs(o.Tabs,{value:a,onValueChange:p,children:[e.jsxs(o.TabsList,{variant:"underline",className:"w-full justify-start",children:[e.jsx(o.TabsTrigger,{value:"display",children:"Display formats"}),e.jsx(o.TabsTrigger,{value:"calendar",children:"Calendar"})]}),e.jsx(o.TabsContent,{value:"display",children:e.jsx(J,{active:s&&a==="display",onClose:d})}),e.jsx(o.TabsContent,{value:"calendar",children:e.jsx(H,{active:s&&a==="calendar",onClose:d})})]})]})})}exports.ReportPreferencesDialog=Y;
@@ -0,0 +1 @@
1
+ "use strict";const p=require("../value-format-preferences/index.cjs"),f=require("./validators-9D4KBqKD.cjs"),g={tz:"UTC",weekStart:1,anchor:"now"},b=["tz","weekStart","anchor","fiscalCalendar"],E=["kind","yearStartMonth"],w=["calendar","valueFormat","preferenceSources"],T=["calendar","valueFormat"],y=["tz","weekStart"],F=["stored","inherited","inheritedSources","resolved","sources"],z=["locale","dateStyle","dateTime","defaultCurrency"],R=["dateStyle","timeStyle"];function o(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const a=Object.getPrototypeOf(e);return a===null||Object.getPrototypeOf(a)===null}function n(e,a,r){const t=new Set(a);return Object.keys(e).filter(s=>!t.has(s)).map(s=>({path:r==="$"?s:`${r}.${s}`,code:"unknown_property",message:`Unknown property "${s}"`}))}function _(e){return Number.isInteger(e)&&typeof e=="number"&&e>=0&&e<=6}function d(e,a,r){if(!o(e))return{ok:!1,issues:[{path:a,code:"invalid_type",message:"Calendar preferences must be an object"}]};const t=n(e,["tz","weekStart"],a);return(!r||e.tz!==void 0)&&(typeof e.tz!="string"||!f.isValidIanaTimeZone(e.tz))&&t.push({path:`${a}.tz`,code:"invalid_timezone",message:"tz must be a valid IANA timezone"}),(!r||e.weekStart!==void 0)&&!_(e.weekStart)&&t.push({path:`${a}.weekStart`,code:"invalid_week_start",message:"weekStart must be an integer from 0 to 6"}),t.length?{ok:!1,issues:t}:{ok:!0,value:{...e.tz!==void 0?{tz:e.tz}:{},...e.weekStart!==void 0?{weekStart:e.weekStart}:{}}}}function A(e){if(e==="now")return{ok:!0,value:"now"};if(!o(e))return{ok:!1,issues:[{path:"anchor",code:"invalid_anchor",message:'anchor must be "now" or an object with an ISO timestamp'}]};const a=n(e,["iso"],"anchor"),r=e.iso;return f.parseSemaphorIsoInstant(r)===null&&a.push({path:"anchor.iso",code:"invalid_anchor",message:"anchor.iso must be an ISO timestamp with an explicit offset"}),a.length?{ok:!1,issues:a}:{ok:!0,value:{iso:r}}}function O(e){if(!o(e))return{ok:!1,issues:[{path:"fiscalCalendar",code:"invalid_fiscal_calendar",message:"fiscalCalendar must be an object"}]};const a=n(e,E,"fiscalCalendar");return e.kind!=="month_aligned"&&a.push({path:"fiscalCalendar.kind",code:"invalid_fiscal_calendar",message:'fiscalCalendar.kind must be "month_aligned"'}),(!Number.isInteger(e.yearStartMonth)||typeof e.yearStartMonth!="number"||e.yearStartMonth<1||e.yearStartMonth>12)&&a.push({path:"fiscalCalendar.yearStartMonth",code:"invalid_fiscal_calendar",message:"fiscalCalendar.yearStartMonth must be an integer from 1 to 12"}),a.length?{ok:!1,issues:a}:{ok:!0,value:{kind:"month_aligned",yearStartMonth:e.yearStartMonth}}}function C(e){if(!o(e))return{ok:!1,issues:[{path:"$",code:"invalid_type",message:"Calendar context must be an object"}]};const a=n(e,b,"$");(typeof e.tz!="string"||!f.isValidIanaTimeZone(e.tz))&&a.push({path:"tz",code:"invalid_timezone",message:"tz must be a valid IANA timezone"}),_(e.weekStart)||a.push({path:"weekStart",code:"invalid_week_start",message:"weekStart must be an integer from 0 to 6"});const r=A(e.anchor);r.ok||a.push(...r.issues);let t;if(e.fiscalCalendar!==void 0){const s=O(e.fiscalCalendar);s.ok?t=s.value:a.push(...s.issues)}return a.length||!r.ok?{ok:!1,issues:a}:{ok:!0,value:{tz:e.tz,weekStart:e.weekStart,anchor:r.value,...t?{fiscalCalendar:t}:{}}}}function l(e,a,r){if(!p.isReportPreferenceSource(e)){r.push({path:a,code:"invalid_preference_source",message:"Preference source is invalid"});return}return e}function k(e,a){if(!o(e))return{ok:!1,issues:[{path:a,code:"invalid_type",message:"Calendar preference sources must be an object"}]};const r=n(e,y,a),t=l(e.tz,`${a}.tz`,r),s=l(e.weekStart,`${a}.weekStart`,r);return r.length||!t||!s?{ok:!1,issues:r}:{ok:!0,value:{tz:t,weekStart:s}}}function $(e){if(!o(e))return{ok:!1,issues:[{path:"$",code:"invalid_type",message:"Calendar preference response must be an object"}]};const a=n(e,F,"$"),r=e.stored===null?{ok:!0,value:null}:d(e.stored,"stored",!0),t=d(e.inherited,"inherited",!1),s=k(e.inheritedSources,"inheritedSources"),c=d(e.resolved,"resolved",!1),i=k(e.sources,"sources");for(const u of[r,t,s,c,i])u.ok||a.push(...u.issues);return a.length||!r.ok||!t.ok||!s.ok||!c.ok||!i.ok?{ok:!1,issues:a}:{ok:!0,value:{stored:r.value,inherited:t.value,inheritedSources:s.value,resolved:c.value,sources:i.value}}}function P(e){if(!o(e))return{ok:!1,issues:[{path:"preferenceSources",code:"invalid_type",message:"preferenceSources must be an object"}]};const a=n(e,T,"preferenceSources"),r=e.calendar,t=e.valueFormat;if(o(r)||a.push({path:"preferenceSources.calendar",code:"invalid_type",message:"Calendar preference sources must be an object"}),o(t)||a.push({path:"preferenceSources.valueFormat",code:"invalid_type",message:"Value-format preference sources must be an object"}),!o(r)||!o(t))return{ok:!1,issues:a};a.push(...n(r,y,"preferenceSources.calendar"),...n(t,z,"preferenceSources.valueFormat"));const s=t.dateTime;o(s)?a.push(...n(s,R,"preferenceSources.valueFormat.dateTime")):a.push({path:"preferenceSources.valueFormat.dateTime",code:"invalid_type",message:"Datetime preference sources must be an object"});const c=l(r.tz,"preferenceSources.calendar.tz",a),i=l(r.weekStart,"preferenceSources.calendar.weekStart",a),u=l(t.locale,"preferenceSources.valueFormat.locale",a),m=l(t.dateStyle,"preferenceSources.valueFormat.dateStyle",a),S=o(s)?l(s.dateStyle,"preferenceSources.valueFormat.dateTime.dateStyle",a):void 0,v=o(s)?l(s.timeStyle,"preferenceSources.valueFormat.dateTime.timeStyle",a):void 0,h=l(t.defaultCurrency,"preferenceSources.valueFormat.defaultCurrency",a);return a.length||!c||!i||!u||!m||!S||!v||!h?{ok:!1,issues:a}:{ok:!0,value:{calendar:{tz:c,weekStart:i},valueFormat:{locale:u,dateStyle:m,dateTime:{dateStyle:S,timeStyle:v},defaultCurrency:h}}}}function j(e){var t;const a=p.parseValueFormatPreferences(e);if(!a.ok)return{ok:!1,issues:a.issues.map(s=>({path:`valueFormat.${s.path}`,code:"invalid_value_format",message:s.message}))};const r=a.value;return r.locale===void 0||r.dateStyle===void 0||((t=r.dateTime)==null?void 0:t.dateStyle)===void 0||r.dateTime.timeStyle===void 0||r.defaultCurrency===void 0?{ok:!1,issues:[{path:"valueFormat",code:"invalid_value_format",message:"Resolved value-format preferences must be complete"}]}:{ok:!0,value:{locale:r.locale,dateStyle:r.dateStyle,dateTime:{dateStyle:r.dateTime.dateStyle,timeStyle:r.dateTime.timeStyle},defaultCurrency:r.defaultCurrency}}}function N(e){if(!o(e))return{ok:!1,issues:[{path:"$",code:"invalid_type",message:"Report runtime context must be an object"}]};const a=n(e,w,"$"),r=C(e.calendar),t=j(e.valueFormat),s=P(e.preferenceSources);return r.ok||a.push(...r.issues.map(c=>({...c,path:c.path==="$"?"calendar":`calendar.${c.path}`}))),t.ok||a.push(...t.issues),s.ok||a.push(...s.issues),a.length||!r.ok||!t.ok||!s.ok?{ok:!1,issues:a}:{ok:!0,value:{calendar:r.value,valueFormat:t.value,preferenceSources:s.value}}}exports.DEFAULT_CALENDAR_CONTEXT=g;exports.parseCalendarContext=C;exports.parseCalendarPreferencesResponse=$;exports.parseReportRuntimeContext=N;
@@ -0,0 +1,387 @@
1
+ import { parseValueFormatPreferences as _, isReportPreferenceSource as C } from "../value-format-preferences/index.js";
2
+ import { b as k, e as g } from "./validators-wZ2WlNHc.js";
3
+ const M = {
4
+ tz: "UTC",
5
+ weekStart: 1,
6
+ anchor: "now"
7
+ }, b = [
8
+ "tz",
9
+ "weekStart",
10
+ "anchor",
11
+ "fiscalCalendar"
12
+ ], w = ["kind", "yearStartMonth"], E = [
13
+ "calendar",
14
+ "valueFormat",
15
+ "preferenceSources"
16
+ ], z = ["calendar", "valueFormat"], p = ["tz", "weekStart"], F = [
17
+ "stored",
18
+ "inherited",
19
+ "inheritedSources",
20
+ "resolved",
21
+ "sources"
22
+ ], T = [
23
+ "locale",
24
+ "dateStyle",
25
+ "dateTime",
26
+ "defaultCurrency"
27
+ ], R = ["dateStyle", "timeStyle"];
28
+ function o(e) {
29
+ if (e === null || typeof e != "object" || Array.isArray(e))
30
+ return !1;
31
+ const a = Object.getPrototypeOf(e);
32
+ return a === null || Object.getPrototypeOf(a) === null;
33
+ }
34
+ function n(e, a, r) {
35
+ const t = new Set(a);
36
+ return Object.keys(e).filter((s) => !t.has(s)).map((s) => ({
37
+ path: r === "$" ? s : `${r}.${s}`,
38
+ code: "unknown_property",
39
+ message: `Unknown property "${s}"`
40
+ }));
41
+ }
42
+ function y(e) {
43
+ return Number.isInteger(e) && typeof e == "number" && e >= 0 && e <= 6;
44
+ }
45
+ function d(e, a, r) {
46
+ if (!o(e))
47
+ return {
48
+ ok: !1,
49
+ issues: [
50
+ {
51
+ path: a,
52
+ code: "invalid_type",
53
+ message: "Calendar preferences must be an object"
54
+ }
55
+ ]
56
+ };
57
+ const t = n(e, ["tz", "weekStart"], a);
58
+ return (!r || e.tz !== void 0) && (typeof e.tz != "string" || !k(e.tz)) && t.push({
59
+ path: `${a}.tz`,
60
+ code: "invalid_timezone",
61
+ message: "tz must be a valid IANA timezone"
62
+ }), (!r || e.weekStart !== void 0) && !y(e.weekStart) && t.push({
63
+ path: `${a}.weekStart`,
64
+ code: "invalid_week_start",
65
+ message: "weekStart must be an integer from 0 to 6"
66
+ }), t.length ? { ok: !1, issues: t } : {
67
+ ok: !0,
68
+ value: {
69
+ ...e.tz !== void 0 ? { tz: e.tz } : {},
70
+ ...e.weekStart !== void 0 ? { weekStart: e.weekStart } : {}
71
+ }
72
+ };
73
+ }
74
+ function A(e) {
75
+ if (e === "now") return { ok: !0, value: "now" };
76
+ if (!o(e))
77
+ return {
78
+ ok: !1,
79
+ issues: [
80
+ {
81
+ path: "anchor",
82
+ code: "invalid_anchor",
83
+ message: 'anchor must be "now" or an object with an ISO timestamp'
84
+ }
85
+ ]
86
+ };
87
+ const a = n(e, ["iso"], "anchor"), r = e.iso;
88
+ return g(r) === null && a.push({
89
+ path: "anchor.iso",
90
+ code: "invalid_anchor",
91
+ message: "anchor.iso must be an ISO timestamp with an explicit offset"
92
+ }), a.length ? { ok: !1, issues: a } : { ok: !0, value: { iso: r } };
93
+ }
94
+ function $(e) {
95
+ if (!o(e))
96
+ return {
97
+ ok: !1,
98
+ issues: [
99
+ {
100
+ path: "fiscalCalendar",
101
+ code: "invalid_fiscal_calendar",
102
+ message: "fiscalCalendar must be an object"
103
+ }
104
+ ]
105
+ };
106
+ const a = n(e, w, "fiscalCalendar");
107
+ return e.kind !== "month_aligned" && a.push({
108
+ path: "fiscalCalendar.kind",
109
+ code: "invalid_fiscal_calendar",
110
+ message: 'fiscalCalendar.kind must be "month_aligned"'
111
+ }), (!Number.isInteger(e.yearStartMonth) || typeof e.yearStartMonth != "number" || e.yearStartMonth < 1 || e.yearStartMonth > 12) && a.push({
112
+ path: "fiscalCalendar.yearStartMonth",
113
+ code: "invalid_fiscal_calendar",
114
+ message: "fiscalCalendar.yearStartMonth must be an integer from 1 to 12"
115
+ }), a.length ? { ok: !1, issues: a } : {
116
+ ok: !0,
117
+ value: {
118
+ kind: "month_aligned",
119
+ yearStartMonth: e.yearStartMonth
120
+ }
121
+ };
122
+ }
123
+ function O(e) {
124
+ if (!o(e))
125
+ return {
126
+ ok: !1,
127
+ issues: [
128
+ {
129
+ path: "$",
130
+ code: "invalid_type",
131
+ message: "Calendar context must be an object"
132
+ }
133
+ ]
134
+ };
135
+ const a = n(e, b, "$");
136
+ (typeof e.tz != "string" || !k(e.tz)) && a.push({
137
+ path: "tz",
138
+ code: "invalid_timezone",
139
+ message: "tz must be a valid IANA timezone"
140
+ }), y(e.weekStart) || a.push({
141
+ path: "weekStart",
142
+ code: "invalid_week_start",
143
+ message: "weekStart must be an integer from 0 to 6"
144
+ });
145
+ const r = A(e.anchor);
146
+ r.ok || a.push(...r.issues);
147
+ let t;
148
+ if (e.fiscalCalendar !== void 0) {
149
+ const s = $(e.fiscalCalendar);
150
+ s.ok ? t = s.value : a.push(...s.issues);
151
+ }
152
+ return a.length || !r.ok ? { ok: !1, issues: a } : {
153
+ ok: !0,
154
+ value: {
155
+ tz: e.tz,
156
+ weekStart: e.weekStart,
157
+ anchor: r.value,
158
+ ...t ? { fiscalCalendar: t } : {}
159
+ }
160
+ };
161
+ }
162
+ function l(e, a, r) {
163
+ if (!C(e)) {
164
+ r.push({
165
+ path: a,
166
+ code: "invalid_preference_source",
167
+ message: "Preference source is invalid"
168
+ });
169
+ return;
170
+ }
171
+ return e;
172
+ }
173
+ function h(e, a) {
174
+ if (!o(e))
175
+ return {
176
+ ok: !1,
177
+ issues: [
178
+ {
179
+ path: a,
180
+ code: "invalid_type",
181
+ message: "Calendar preference sources must be an object"
182
+ }
183
+ ]
184
+ };
185
+ const r = n(e, p, a), t = l(e.tz, `${a}.tz`, r), s = l(
186
+ e.weekStart,
187
+ `${a}.weekStart`,
188
+ r
189
+ );
190
+ return r.length || !t || !s ? { ok: !1, issues: r } : { ok: !0, value: { tz: t, weekStart: s } };
191
+ }
192
+ function D(e) {
193
+ if (!o(e))
194
+ return {
195
+ ok: !1,
196
+ issues: [
197
+ {
198
+ path: "$",
199
+ code: "invalid_type",
200
+ message: "Calendar preference response must be an object"
201
+ }
202
+ ]
203
+ };
204
+ const a = n(e, F, "$"), r = e.stored === null ? { ok: !0, value: null } : d(e.stored, "stored", !0), t = d(
205
+ e.inherited,
206
+ "inherited",
207
+ !1
208
+ ), s = h(
209
+ e.inheritedSources,
210
+ "inheritedSources"
211
+ ), c = d(e.resolved, "resolved", !1), i = h(e.sources, "sources");
212
+ for (const u of [r, t, s, c, i])
213
+ u.ok || a.push(...u.issues);
214
+ return a.length || !r.ok || !t.ok || !s.ok || !c.ok || !i.ok ? { ok: !1, issues: a } : {
215
+ ok: !0,
216
+ value: {
217
+ stored: r.value,
218
+ inherited: t.value,
219
+ inheritedSources: s.value,
220
+ resolved: c.value,
221
+ sources: i.value
222
+ }
223
+ };
224
+ }
225
+ function j(e) {
226
+ if (!o(e))
227
+ return {
228
+ ok: !1,
229
+ issues: [
230
+ {
231
+ path: "preferenceSources",
232
+ code: "invalid_type",
233
+ message: "preferenceSources must be an object"
234
+ }
235
+ ]
236
+ };
237
+ const a = n(e, z, "preferenceSources"), r = e.calendar, t = e.valueFormat;
238
+ if (o(r) || a.push({
239
+ path: "preferenceSources.calendar",
240
+ code: "invalid_type",
241
+ message: "Calendar preference sources must be an object"
242
+ }), o(t) || a.push({
243
+ path: "preferenceSources.valueFormat",
244
+ code: "invalid_type",
245
+ message: "Value-format preference sources must be an object"
246
+ }), !o(r) || !o(t))
247
+ return { ok: !1, issues: a };
248
+ a.push(
249
+ ...n(
250
+ r,
251
+ p,
252
+ "preferenceSources.calendar"
253
+ ),
254
+ ...n(
255
+ t,
256
+ T,
257
+ "preferenceSources.valueFormat"
258
+ )
259
+ );
260
+ const s = t.dateTime;
261
+ o(s) ? a.push(
262
+ ...n(
263
+ s,
264
+ R,
265
+ "preferenceSources.valueFormat.dateTime"
266
+ )
267
+ ) : a.push({
268
+ path: "preferenceSources.valueFormat.dateTime",
269
+ code: "invalid_type",
270
+ message: "Datetime preference sources must be an object"
271
+ });
272
+ const c = l(
273
+ r.tz,
274
+ "preferenceSources.calendar.tz",
275
+ a
276
+ ), i = l(
277
+ r.weekStart,
278
+ "preferenceSources.calendar.weekStart",
279
+ a
280
+ ), u = l(
281
+ t.locale,
282
+ "preferenceSources.valueFormat.locale",
283
+ a
284
+ ), f = l(
285
+ t.dateStyle,
286
+ "preferenceSources.valueFormat.dateStyle",
287
+ a
288
+ ), m = o(s) ? l(
289
+ s.dateStyle,
290
+ "preferenceSources.valueFormat.dateTime.dateStyle",
291
+ a
292
+ ) : void 0, S = o(s) ? l(
293
+ s.timeStyle,
294
+ "preferenceSources.valueFormat.dateTime.timeStyle",
295
+ a
296
+ ) : void 0, v = l(
297
+ t.defaultCurrency,
298
+ "preferenceSources.valueFormat.defaultCurrency",
299
+ a
300
+ );
301
+ return a.length || !c || !i || !u || !f || !m || !S || !v ? { ok: !1, issues: a } : {
302
+ ok: !0,
303
+ value: {
304
+ calendar: {
305
+ tz: c,
306
+ weekStart: i
307
+ },
308
+ valueFormat: {
309
+ locale: u,
310
+ dateStyle: f,
311
+ dateTime: {
312
+ dateStyle: m,
313
+ timeStyle: S
314
+ },
315
+ defaultCurrency: v
316
+ }
317
+ }
318
+ };
319
+ }
320
+ function P(e) {
321
+ var t;
322
+ const a = _(e);
323
+ if (!a.ok)
324
+ return {
325
+ ok: !1,
326
+ issues: a.issues.map((s) => ({
327
+ path: `valueFormat.${s.path}`,
328
+ code: "invalid_value_format",
329
+ message: s.message
330
+ }))
331
+ };
332
+ const r = a.value;
333
+ return r.locale === void 0 || r.dateStyle === void 0 || ((t = r.dateTime) == null ? void 0 : t.dateStyle) === void 0 || r.dateTime.timeStyle === void 0 || r.defaultCurrency === void 0 ? {
334
+ ok: !1,
335
+ issues: [
336
+ {
337
+ path: "valueFormat",
338
+ code: "invalid_value_format",
339
+ message: "Resolved value-format preferences must be complete"
340
+ }
341
+ ]
342
+ } : {
343
+ ok: !0,
344
+ value: {
345
+ locale: r.locale,
346
+ dateStyle: r.dateStyle,
347
+ dateTime: {
348
+ dateStyle: r.dateTime.dateStyle,
349
+ timeStyle: r.dateTime.timeStyle
350
+ },
351
+ defaultCurrency: r.defaultCurrency
352
+ }
353
+ };
354
+ }
355
+ function K(e) {
356
+ if (!o(e))
357
+ return {
358
+ ok: !1,
359
+ issues: [
360
+ {
361
+ path: "$",
362
+ code: "invalid_type",
363
+ message: "Report runtime context must be an object"
364
+ }
365
+ ]
366
+ };
367
+ const a = n(e, E, "$"), r = O(e.calendar), t = P(e.valueFormat), s = j(e.preferenceSources);
368
+ return r.ok || a.push(
369
+ ...r.issues.map((c) => ({
370
+ ...c,
371
+ path: c.path === "$" ? "calendar" : `calendar.${c.path}`
372
+ }))
373
+ ), t.ok || a.push(...t.issues), s.ok || a.push(...s.issues), a.length || !r.ok || !t.ok || !s.ok ? { ok: !1, issues: a } : {
374
+ ok: !0,
375
+ value: {
376
+ calendar: r.value,
377
+ valueFormat: t.value,
378
+ preferenceSources: s.value
379
+ }
380
+ };
381
+ }
382
+ export {
383
+ M as D,
384
+ D as a,
385
+ K as b,
386
+ O as p
387
+ };
@@ -1,4 +1,4 @@
1
- "use strict";const a=require("./index-jSrCwPQz.js");/**
1
+ "use strict";const a=require("./index-jSrCwPQz.cjs");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("./index-jSrCwPQz.js");/**
1
+ "use strict";const e=require("./index-jSrCwPQz.cjs");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.