@tap-payments/os-micro-frontend-shared 0.3.268 → 0.3.270

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.
@@ -0,0 +1 @@
1
+ import Z from'dayjs';import ne from'dayjs/plugin/calendar.js';import oe from'dayjs/plugin/customParseFormat.js';import re from'dayjs/plugin/utc.js';import {getTimezone,getCountry}from'countries-and-timezones';var T=/(?:Z|[+-]\d{2}:?\d{2})$/i,c=e=>{if(e==null||e==="")return;if(e instanceof Date)return Number.isNaN(e.getTime())?void 0:e;if(typeof e=="number"){if(!Number.isFinite(e))return;let o=new Date(e);return Number.isNaN(o.getTime())?void 0:o}let t=e.trim();if(!T.test(t))return;let n=new Date(t);return Number.isNaN(n.getTime())?void 0:n},C=e=>{let t=new Date(Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.ms));return t.setUTCFullYear(e.year),t.getTime()};var w=(e,t=2)=>String(e).padStart(t,"0"),_=new Map,V=e=>{let t=_.get(e);if(t)return t;try{let n=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",era:"short",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"});return _.set(e,n),n}catch{return}},q=e=>{let t=r=>Number(e.find(s=>s.type===r)?.value??0),n=t("year");return {year:e.find(r=>r.type==="era")?.value==="BC"?1-n:n,month:t("month"),day:t("day"),hour:t("hour"),minute:t("minute"),second:t("second"),ms:0}},Q=new Set(["Africa/Cairo","Egypt"]),v=2023,R=new Map,ee=(e,t)=>{let n=R.get(e);if(n)return n;let o=t.resolvedOptions().timeZone;return R.set(e,o),o},O=(e,t,n)=>{let o=new Date(Date.UTC(e,t+1,0));return o.getUTCDate()-(o.getUTCDay()-n+7)%7},te=e=>{let t=new Date(e).getUTCFullYear();if(t<v)return;let n=Date.UTC(t,3,O(t,3,5))-2*36e5,o=Date.UTC(t,9,O(t,9,4)+1)-3*36e5;return e>=n&&e<o?180:120},i=(e,t=Date.now())=>{let n=c(t),o=V(e);if(!n||!o)return;if(Q.has(ee(e,o))){let s=te(n.getTime());if(s!==void 0)return s}let r=Math.floor(n.getTime()/1e3)*1e3;return Math.round((C(q(o.formatToParts(n)))-r)/6e4)},Fe=(e,t,n=Date.now())=>{let o=i(e,n),r=i(t,n);return o!==void 0&&r!==void 0&&o!==r},Y=(e,t=Date.now())=>{let n=i(e,t);if(n===void 0)return "";let o=Math.abs(n);return `UTC${n<0?"-":"+"}${w(Math.floor(o/60))}:${w(o%60)}`};Z.extend(re);Z.extend(oe);Z.extend(ne);var E=Z;var L=e=>`${String(e.year).padStart(4,"0")}-${String(e.month).padStart(2,"0")}-${String(e.day).padStart(2,"0")} ${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}.${String(e.ms).padStart(3,"0")}`,l=e=>({year:e.year(),month:e.month()+1,day:e.date(),hour:e.hour(),minute:e.minute(),second:e.second(),ms:e.millisecond()}),B=e=>Number.isNaN(e.getTime())?void 0:{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),ms:e.getMilliseconds()},se=[31,28,31,30,31,30,31,31,30,31,30,31],ie=e=>e%4===0&&(e%100!==0||e%400===0),ae=68,de=e=>e>=48&&e<=57,M=e=>e.length>0&&[...e].every(t=>t>="0"&&t<="9"),$=e=>{let t=e.month===2&&ie(e.year)?29:se[e.month-1];return e.month<1||e.month>12||e.day<1||e.day>(t??0)||e.hour>23||e.minute>59||e.second>59?void 0:e},ue=e=>{let t=0;for(;t<e.length&&(de(e.charCodeAt(t))||e[t]==="-"||e[t]==="/");)t++;return t},ce=e=>{let t=e.split("-"),n=[4,2,2];return t.length===3&&t.every((o,r)=>o.length===n[r]&&M(o))?t.map(Number):void 0},me=e=>{let t=e.split("/");if(t.length!==3||!t.every(M))return;let[n,o,r]=t;if(n.length>2||o.length>2||r.length<2||r.length>4)return;let s=Number(r);return [s<100?(s>ae?1900:2e3)+s:s,Number(o),Number(n)]},le=e=>{let[t,n,o="0"]=e.split(":"),[r,s="0"]=o.split(".");if(!(t===void 0||n===void 0)&&!(s.length>3||![t,n,r,s].every(M)))return {hour:Number(t),minute:Number(n),second:Number(r),ms:Number(s.padEnd(3,"0"))}},F=e=>{let t=e.trim(),n=t.slice(0,ue(t)),o=n.includes("/"),r=o?me(n):ce(n);if(!r)return;let[s,u,f]=r,a=t.slice(n.length).trim(),[g="",K=""]=(a[0]==="T"||a[0]==="t"?a.slice(1):a).trim().split(" ").filter(Boolean),y=K.toUpperCase();if(y&&(!o||y!=="AM"&&y!=="PM"))return;if(!g)return $({year:s,month:u,day:f,hour:0,minute:0,second:0,ms:0});let D=le(g);if(!D||y&&(D.hour<1||D.hour>12))return;let J=y?D.hour%12+(y==="PM"?12:0):D.hour;return $({year:s,month:u,day:f,...D,hour:J})},Oe=e=>{let t=F(e);return t&&H(t)},H=e=>{let t=new Date(0);return t.setFullYear(e.year,e.month-1,e.day),t.setHours(e.hour,e.minute,e.second,e.ms),t},d=(e,t)=>{let n=c(e);if(!n)return;let o=i(t,n);if(o!==void 0)return E.utc(n.getTime()+o*6e4)},Ye=(e,t)=>{let n=d(e,t);if(n)return H(l(n))},k=(e,t,n)=>{let o=d(e,n),r=d(t,n);return o&&r?[l(o),l(r)]:void 0},fe=(e,t)=>e.year===t.year&&e.month===t.month&&e.day===t.day,Ee=(e,t,n)=>{let o=k(e,t,n);return !!o&&fe(o[0],o[1])},$e=(e,t,n)=>{let o=k(e,t,n);return !!o&&o[0].year===o[1].year},P=e=>Date.UTC(e.year,e.month-1,e.day),Pe=(e,t,n)=>{let o=k(e,t,n);if(o)return Math.abs(P(o[1])-P(o[0]))/864e5};var pe=(e,t)=>{let n=C(e),o=i(t,n-864e5),r=i(t,n+864e5);if(o===void 0||r===void 0)return;let u=(o===r?[o]:[o,r]).map(a=>n-a*6e4),f=u.filter(a=>a+(i(t,a)??NaN)*6e4===n);return new Date(f.length?Math.min(...f):Math.max(...u))},p=(e,t)=>{if(e==null||e==="")return;if(!(e instanceof Date)){if(typeof e=="number"){if(!Number.isFinite(e))return;let o=new Date(e);return Number.isNaN(o.getTime())?void 0:o}if(T.test(e.trim()))return c(e)}let n=typeof e=="string"?F(e):B(e);if(n)return pe(n,t)};var Ve=(e,t)=>{if(!(typeof e!="number"||!Number.isFinite(e))&&!(Math.abs(e)>864e13))return p(new Date(e).toISOString().replace(/Z$/,""),t)},S=(e,t)=>{let n=c(e);if(!n)return;let o=i(t,n);if(o!==void 0)return n.getTime()+o*6e4};var ye=e=>{let t=", h:mma",n=e?"MMM DD":"MMM DD, YYYY";return {sameDay:`[Today]${t}`,nextDay:`[Tomorrow]${t}`,lastDay:`[Yesterday]${t}`,sameElse:`${n}${t}`,lastWeek:`${n}${t}`,nextWeek:`${n}${t}`}},ve=e=>({sameDay:e,nextDay:e,lastDay:e,sameElse:e,lastWeek:e,nextWeek:e}),et=(e,t,n)=>{let o=d(e,t),r=d(Date.now(),t);return !o||!r?"":o.calendar(r,n??ye(o.isSame(r,"year")))};var De=(e,t)=>{let n=p(e?.[0],t),o=p(e?.[1],t);return n&&o?[n,o]:void 0},z=(e,t)=>{let n=De(e,t);if(!n)return;let o=d(n[0],t),r=d(n[1],t);if(!(!o||!r))return [{fields:l(o),instant:n[0]},{fields:l(r),instant:n[1]}]},X=(e,t=0)=>{let n=new Date(Date.UTC(e.year,e.month-1,e.day+t));return L({year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:0,minute:0,second:0,ms:0})},b=(e,t,n=0)=>p(X(e,n),t),N=(e,t)=>{let n=p(X(e,1),t);return n&&new Date(n.getTime()-1)},ge=(e,t)=>{let n=b(e.fields,t);return !!n&&n.getTime()===e.instant.getTime()||e.fields.hour===23&&e.fields.minute===59},st=(e,t)=>{let n=z(e,t);if(!n)return false;let[o,r]=n;return o.fields.year!==r.fields.year||o.fields.month!==r.fields.month||o.fields.day!==r.fields.day||ge(r,t)},it=(e,t)=>{let n=z(e,t);if(!n)return;let o=b(n[0].fields,t),r=N(n[1].fields,t);return o&&r?[o,r]:void 0},at=(e,t)=>{let n=d(Date.now(),t);if(!n)return;let o=l(n),r=Number.isFinite(e)&&e>=1?Math.floor(e):1,s=N(o,t),u=b(o,t,-(r-1));return u&&s?[u,s]:void 0},dt=(e,t)=>{let n=d(Date.now(),t);if(!n)return;let o=l(n),r=Number.isFinite(e)&&e>=1?Math.floor(e):1,s=new Date(Date.UTC(o.year,o.month-1-r,1)),u=new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth()+1,0)).getUTCDate(),f={...o,year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:Math.min(o.day,u)},a=b(f,t),g=N(o,t);return a&&g?[a,g]:void 0},ut=(e,t)=>({from:S(e[0],t),to:S(e[1],t)});var he=new Intl.DisplayNames(["en"],{type:"region"}),W=e=>{try{return he.of(e)}catch{return}},Te={US:"America/New_York",CA:"America/Toronto",BR:"America/Sao_Paulo",MX:"America/Mexico_City",AR:"America/Argentina/Buenos_Aires",CL:"America/Santiago",AU:"Australia/Sydney",NZ:"Pacific/Auckland",RU:"Europe/Moscow",UA:"Europe/Kyiv",ES:"Europe/Madrid",PT:"Europe/Lisbon",ID:"Asia/Jakarta",KZ:"Asia/Almaty",UZ:"Asia/Tashkent",MN:"Asia/Ulaanbaatar"},h="UTC",j={id:h,countryCode:h,countryName:h},U=e=>{if(!e)return false;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return false}},G=e=>{if(!e)return;if(e===h)return j;let t=getTimezone(e);if(t){let[n]=t.countries;return {id:e,countryCode:n??"",countryName:W(n)??n??e}}return U(e)?{id:e,countryCode:"",countryName:e}:void 0},Ze=e=>{let t=e?.trim().toUpperCase();if(!t)return;if(t===h)return j;let n=getCountry(t),o=Te[t]??n?.timezones[0];if(o)return {id:o,countryCode:t,countryName:W(t)??n?.name??t}},ft=()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||void 0}catch{return}},A=(e,t)=>({zone:e,countryCode:t?.trim().toUpperCase()||G(e)?.countryCode||""}),pt=e=>{if(e){if(typeof e=="string")return U(e)?A(e):void 0;if(!(!e.timezone||!U(e.timezone)))return A(e.timezone,e.countryCode)}},yt=e=>{let t=Ze(e);return t?A(t.id,t.countryCode):void 0},Dt=(e,t)=>!!e&&!!t&&e.zone===t.zone&&e.countryCode===t.countryCode,be=(e,t=Date.now())=>{let n=Y(e.zone,t).replace("UTC","GMT");return n?`(${n}) ${W(e.countryCode)??G(e.zone)?.countryName??e.zone}`:""},gt=e=>({timezone:e.zone,countryCode:e.countryCode,label:be(e),offset:(i(e.zone)??0)/60});export{yt as A,Dt as B,be as C,gt as D,i as a,Fe as b,Y as c,Oe as d,Ye as e,Ee as f,$e as g,Pe as h,p as i,Ve as j,S as k,ve as l,et as m,De as n,st as o,it as p,at as q,dt as r,ut as s,h as t,U as u,G as v,Ze as w,ft as x,A as y,pt as z};
@@ -1 +1 @@
1
- import {a}from'../../_chunks/chunk-ROKMSXYO.js';import'../../_chunks/chunk-J43HMZGL.js';import'../../_chunks/chunk-Q4FLSRWN.js';import'../../_chunks/chunk-G3QDXDRW.js';import'../../_chunks/chunk-XB7FBOZY.js';import'../../_chunks/chunk-TKQTJ4MH.js';import'../../_chunks/chunk-BXVLLRHG.js';import'../../_chunks/chunk-IBHWDBBJ.js';import'../../_chunks/chunk-XRUOTYCI.js';import'../../_chunks/chunk-GFOWTME6.js';import'../../_chunks/chunk-LON6X4MJ.js';import'../../_chunks/chunk-2JYBMD4I.js';import'../../_chunks/chunk-UC5FMNUV.js';import'../../_chunks/chunk-FTRMTWS4.js';import'../../_chunks/chunk-64ZDTAAW.js';import'../../_chunks/chunk-DFEQ23C7.js';import'../../_chunks/chunk-REZFP4CA.js';import'../../_chunks/chunk-GBGW63EG.js';import'../../_chunks/chunk-TX3XM6XL.js';import'../../_chunks/chunk-LDCBWAC4.js';import'../../_chunks/chunk-OOLWSYGD.js';import'../../_chunks/chunk-DOZLA7RE.js';import'../../_chunks/chunk-ZRABDQRJ.js';import'../../_chunks/chunk-7NMMD6VJ.js';import'../../_chunks/chunk-XXCH74F3.js';import'../../_chunks/chunk-MF5ATA3Y.js';import'../../_chunks/chunk-SMJCH23I.js';import'../../_chunks/chunk-UCJQFE45.js';import'../../_chunks/chunk-BNM6FJCR.js';import'../../_chunks/chunk-2RPPZGV7.js';import'../../_chunks/chunk-ABVY4O2O.js';import'../../_chunks/chunk-AJS7K55Q.js';import'../../_chunks/chunk-H4FZYTL7.js';import'../../_chunks/chunk-WC2MF35C.js';import'../../_chunks/chunk-PUJ762TG.js';import'../../_chunks/chunk-ONANHXZA.js';import'../../_chunks/chunk-IPEPXEL5.js';import'../../_chunks/chunk-FNUU2KSZ.js';import'../../_chunks/chunk-YIZKLFYJ.js';import'../../_chunks/chunk-DRRME7J2.js';import'../../_chunks/chunk-X5HRCMTE.js';import'../../_chunks/chunk-FMUJQ45L.js';import'../../_chunks/chunk-K6LOVRKX.js';import'../../_chunks/chunk-RNJI3YXH.js';import'../../_chunks/chunk-DEEC67P7.js';import'../../_chunks/chunk-OPDVYLZK.js';import'../../_chunks/chunk-LVQ2UFZT.js';import'../../_chunks/chunk-TN55SPRQ.js';import'../../_chunks/chunk-KCIFOOFA.js';import'../../_chunks/chunk-4JUVQWRF.js';import'../../_chunks/chunk-ZUK5FRG5.js';import'../../_chunks/chunk-ZCULKYWE.js';import'../../_chunks/chunk-DJRPY3A2.js';import'../../_chunks/chunk-EUMG4QKT.js';import'../../_chunks/chunk-F3U4ZIAP.js';import {b}from'../../_chunks/chunk-TZOMS57X.js';import'../../_chunks/chunk-MI3EC2ZF.js';import {b as b$1}from'../../_chunks/chunk-HOHQMC2O.js';import'../../_chunks/chunk-7VJMQ6ZC.js';import'../../_chunks/chunk-LXG5YXOJ.js';import'../../_chunks/chunk-EG32DA46.js';import'../../_chunks/chunk-NUCUSAD2.js';import'../../_chunks/chunk-N5KO2TC3.js';import'../../_chunks/chunk-5V3PUIXN.js';import'../../_chunks/chunk-ZGWS7XFH.js';import'../../_chunks/chunk-BRFCMPF5.js';import {j,L,B as B$1,x,p,R as R$1,h}from'../../_chunks/chunk-AXNWVU3K.js';import {A,y as y$1,C,D,B,n,i,p as p$1,c,q as q$1,o}from'../../_chunks/chunk-MVJ6SYHK.js';import'../../_chunks/chunk-EOBVIUIS.js';import {Bc,Ya,Ma}from'../../_chunks/chunk-RUFO5P34.js';import {Vj,Wj,Xj,Yj,H,Xc,ec,gc,fc,dl,el}from'../../_chunks/chunk-IQAHULGQ.js';import'../../_chunks/chunk-37JEPAIM.js';import {memo,createContext,useState,useMemo,useId,useRef,useEffect,useContext}from'react';import y from'@mui/material/Box';import ut from'@mui/material/Popper';import {useTranslation}from'react-i18next';import yt from'@mui/material/ClickAwayListener';import {styled,alpha}from'@mui/material/styles';import {jsx,jsxs}from'react/jsx-runtime';import q from'@mui/material/Button';import {Calendar,DateObject}from'react-multi-date-picker';import Ee from'react-date-object';import ht from'react-date-object/calendars/arabic';import Tt from'react-date-object/calendars/gregorian';import kt from'react-date-object/locales/arabic_en';import wt from'react-date-object/locales/gregorian_en';var co=styled(y)(()=>({'[class$="-IndicatorsContainer2"]':{display:"none"},"#react-select-2-listbox":{width:300}})),fe=styled(y)(({theme:e})=>({borderRadius:e.spacing(.5),border:`1px solid ${e.palette.divider}`,background:e.palette.common.white,boxShadow:e.shadows[10],minWidth:200,width:"max-content",overflow:"auto"})),mo=styled(y,{shouldForwardProp:e=>e!=="open"})(({theme:e,open:o})=>({width:156,fontSize:"11px",color:e.palette.text.primary,border:"1px solid",borderColor:e.palette.divider,minHeight:32,borderRadius:"4px",padding:e.spacing(1),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",cursor:"pointer",display:"flex",alignItems:"center",gap:e.spacing(1),fontWeight:500,...o&&{borderRadius:"4px",boxShadow:e.shadows[7],border:"1px solid",borderColor:e.palette.info.dark,background:e.palette.common.white},span:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}})),$=styled(y)(({theme:e})=>({padding:e.spacing(1),color:e.palette.text.primary,fontSize:"11px",display:"flex",alignItems:"center",gap:e.spacing(1),height:33,cursor:"pointer","&:hover":{boxShadow:"0px 0px 16px 0px #00000021"},"&+&":{borderTop:"1px solid",borderColor:e.palette.divider},"&.active span":{fontWeight:500},span:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}})),_=styled(y)(()=>({width:12,height:12})),K=styled(y)(({theme:e})=>({fontSize:"11px",color:e.palette.text.secondary,lineHeight:"15.03px","&.selected":{color:e.palette.info.dark}}));function Re({zone:e,onChange:o,defaultCountryZone:t,countryCodes:n}){let[i,p]=useState(null),a=m=>{i||p(m.currentTarget);},l=()=>{i&&p(null);},r=(m,T)=>{m.stopPropagation(),o(T);},g=useMemo(()=>n.map(B).filter(m=>!!m),[n]),c=g.some(m=>C(m,e)),x=c?e:t;return jsxs($,{onMouseEnter:a,onMouseLeave:l,onClick:()=>{o(x);},children:[c?jsx("img",{src:Yj,alt:"icon"}):jsx(_,{}),jsx("img",{src:Wj,alt:"entity-timezone"}),jsx(b,{countryCode:x.countryCode}),jsx(K,{className:c?"selected":"",children:D(x)}),jsx(ut,{open:!!i,anchorEl:i,placement:"right-start",sx:{zIndex:3},disablePortal:true,children:jsx(fe,{sx:{maxHeight:300},children:g.map(m=>{let T=C(m,e);return jsxs($,{onClick:G=>{r(G,m);},sx:{gap:"4px"},children:[T?jsx("img",{src:Yj,alt:"icon"}):jsx(_,{}),jsx(b,{countryCode:m.countryCode}),jsx(K,{className:T?"selected":"",children:D(m)})]},m.countryCode)})})})]})}function ve({zone:e,onChange:o}){let t=A(y$1());if(!t)return null;let n=C(t,e);return jsxs($,{onClick:()=>o(t),children:[n?jsx("img",{src:Yj,alt:"icon"}):jsx(_,{}),jsx("img",{src:Vj,alt:"user-timezone"}),jsx(b,{countryCode:t.countryCode}),jsx(K,{className:n?"selected":"",children:D(t)})]})}function Ct({zone:e,onChange:o,defaultCountryZone:t,countryCodes:n}){let[i,p]=useState(null),a=!!i,l=A(y$1()),r=()=>{p(null);},g=m=>{o(m),r();},c=m=>{p(m.currentTarget);},x=C(e,l)?Vj:C(e,t)?Wj:Xj;return jsx(yt,{onClickAway:r,children:jsxs(co,{"data-testid":"ZonePicker",children:[jsxs(mo,{open:a,onClick:c,children:[jsx("img",{src:x,alt:"zone-icon"}),jsx(b,{countryCode:e.countryCode}),jsx("span",{children:D(e)})]}),jsx(ut,{open:a,anchorEl:i,placement:"top-start",sx:{zIndex:1400},children:jsxs(fe,{"data-testid":"ZonePicker_dropdown",children:[jsx(Re,{zone:e,onChange:g,defaultCountryZone:t,countryCodes:n}),jsx(ve,{zone:e,onChange:g})]})})]})})}var Se=memo(Ct);var fo=styled(y)(({theme:e})=>({display:"flex",marginTop:"8px",background:e.palette.common.white,boxShadow:e.shadows[9],borderRadius:e.spacing(1),color:e.palette.text.primary,fontSize:"11px",".rmdp-calendar":{padding:"8px 16px 16px"},".rmdp-rtl *":{fontFamily:"Tajawal"},".rmdp-rtl .sd":{paddingTop:"4px"},".rmdp-wrapper":{position:"relative",borderRadius:"8px",boxShadow:"none"},".rmdp-day span":{fontSize:"11px",fontWeight:500},".rmdp-day, .rmdp-week-day":{width:40,height:40,marginBottom:"2px",padding:"4px",fontSize:"11px",color:e.palette.grey[900]},".rmdp-day-picker":{padding:0},".rmdp-day.rmdp-today span":{backgroundColor:"transparent !important",color:e.palette.info.dark},".rmdp-day.rmdp-today.end span, .rmdp-day.rmdp-today.end span":{color:e.palette.common.white},".rmdp-range, .rmdp-day:not(.rmdp-disabled):not(.rmdp-day-hidden) span:hover":{background:e.palette.info.light,boxShadow:"none",color:e.palette.grey[900]},".rmdp-range-hover.start, .rmdp-range.start, .rmdp-range-hover.end, .rmdp-range.end, .rmdp-rtl .rmdp-range-hover.start, .rmdp-rtl .rmdp-range.start, .rmdp-rtl .rmdp-range-hover.end, .rmdp-rtl .rmdp-range.end":{borderRadius:"50%",background:e.palette.background.gradient.darkShadedBlue,color:e.palette.common.white},".rmdp-range.start:after":{content:'""',position:"absolute",background:e.palette.info.light,height:"100%",width:"50%",right:0,top:0,zIndex:-1},".rmdp-rtl .rmdp-range.start:after":{right:"unset",left:0},".rmdp-range.end:after":{content:'""',position:"absolute",background:e.palette.info.light,height:"100%",width:"50%",left:0,top:0,zIndex:-1},".rmdp-rtl .rmdp-range.end:after":{left:"unset",right:0},".rmdp-week-day":{color:e.palette.grey[700],marginBottom:"4px",fontSize:"11px",padding:"4px"},".rmdp-header-values":{color:e.palette.grey[900],fontSize:"12px",fontWeight:500,lineHeight:"20px",letterSpacing:"0.1px"},".rmdp-header-values span:nth-of-type(2)":{display:"none"},".rmdp-header":{padding:"4px 0",margin:0,fontSize:"12px"},".rmdp-top-class":{display:"block !important"},".rmdp-day.rmdp-selected span:not(.highlight)":{background:e.palette.info.dark},".rmdp-day.start.end":{overflow:"hidden"},".rmdp-day.rmdp-disabled":{color:"#ccc",cursor:"not-allowed"}})),go=styled(q)(({theme:e})=>({textTransform:"capitalize",padding:"8px 24px",width:75,height:32,fontSize:"11px",background:"transparent",color:e.palette.text.primary,border:"1px solid",borderColor:e.palette.divider,fontWeight:500,borderRadius:"4px","&:hover":{background:"transparent",color:e.palette.text.primary}})),xo=styled(q)(({theme:e})=>({textTransform:"capitalize",padding:"8px 24px",width:75,height:32,fontSize:"11px",borderRadius:"4px",fontWeight:700,background:e.palette.info.dark,"&:hover":{background:e.palette.info.dark}})),yo=styled(y)(()=>({display:"flex",gap:8,marginLeft:"auto",flexShrink:0})),bo=styled(q,{shouldForwardProp:e=>e!=="open"})(({open:e,theme:o})=>({color:o.palette.text.primary,fontSize:"11px",fontWeight:500,padding:o.spacing(1),borderRadius:"4px",border:"1px solid",borderColor:o.palette.divider,background:o.palette.common.white,textTransform:"none",height:32,...e&&{border:"1px solid",borderColor:o.palette.info.dark,boxShadow:o.shadows[7]}})),Co=styled(y)(({theme:e})=>({background:e.palette.common.white,display:"flex",justifyContent:"space-between",alignItems:"center",gap:10,padding:"16px",borderTop:"1px solid",borderColor:e.palette.divider,borderBottomRightRadius:"8px"})),Do=styled(y)(({theme:e})=>({padding:16,paddingInlineEnd:"23px",borderRight:"1px solid",borderColor:e.palette.divider,background:e.palette.common.white,width:"max-content",borderTopLeftRadius:"8px",borderBottomLeftRadius:"8px",display:"flex",flexDirection:"column",gap:10,justifyContent:"space-between"})),ho=styled(y)(()=>({display:"flex",alignItems:"center",gap:"10px"})),To=styled(y)(()=>({position:"relative"})),ko=styled(y)(()=>({display:"flex",flexDirection:"column",gap:"24px"})),wo=styled(y)(({theme:e})=>({color:e.palette.grey[700],fontSize:"9px",fontWeight:500,marginBottom:"6px"})),Mo=styled(y,{shouldForwardProp:e=>e!=="open"})(({theme:e,open:o})=>({borderRadius:"4px",border:`1px solid ${e.palette.divider}`,background:e.palette.common.white,height:32,padding:"8px",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",...o&&{border:`1px solid ${e.palette.info.dark}`,background:e.palette.common.white,boxShadow:e.shadows[7]}})),Po=styled(y)(({theme:e})=>({borderRadius:"8px",background:e.palette.common.white,boxShadow:"0px 8px 36px 0px rgba(0, 0, 0, 0.15)",textAlign:"center",color:e.palette.grey[900],fontSize:"12px",fontWeight:500,lineHeight:"20px",letterSpacing:"0.1px",padding:"16px",display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",flexDirection:"column"})),Ro=styled(y)(({theme:e})=>({width:71,padding:"4px 0",cursor:"pointer","&:hover, &.active":{borderRadius:"100px",background:e.palette.info.light}})),vo=styled(y)(({theme:e})=>({border:"1px solid",borderColor:e.palette.divider,borderRadius:"50px",paddingInline:"6px 12px",color:e.palette.text.primary,fontSize:"11px",display:"flex",gap:"8px",alignItems:"center",justifyContent:"space-between",height:32,marginTop:"8px",img:{width:16,height:16},"& > div":{display:"flex",alignItems:"center",gap:"2px"}})),Bo=styled(q)(()=>({minWidth:"auto",padding:0,"& > img":{cursor:"pointer"}})),So=styled(q)(({theme:e})=>({cursor:"pointer",borderRadius:"50px",border:"1px solid",borderColor:e.palette.divider,background:e.palette.common.white,color:e.palette.text.primary,fontSize:"11px",fontWeight:e.typography.fontWeightRegular,paddingInline:"12px",height:32,width:"max-content",textTransform:"unset","&:hover":{boxShadow:e.shadows[7],border:"1px solid",borderColor:e.palette.info.dark}})),Oo=styled(y)(()=>({display:"flex",flexDirection:"column",gap:"8px"})),Eo=styled(y,{shouldForwardProp:e=>e!=="isAllDay"})(({theme:e,isAllDay:o})=>({display:"flex",alignItems:"center",gap:e.spacing(1),position:"relative",paddingInline:"5px",".label":{width:"max-content"},...!o&&{paddingRight:e.spacing(1),"&:after":{content:'""',position:"absolute",width:"1px",background:e.palette.divider,right:0,height:17}}})),Zo=styled(y)(()=>({width:235})),Io=styled(y)(()=>({display:"flex",gap:"4px"})),Ao=styled(y)(({theme:e})=>({display:"flex",gap:"8px",alignItems:"center",borderRadius:"50px",border:"1px solid",borderColor:e.palette.divider,paddingInline:"5px",width:"fit-content",height:32}));function Oe({calendarMode:e,onCalendarModeChange:o}){let{t}=useTranslation();return jsx(y,{children:jsxs(vo,{children:[jsxs(y,{children:[jsx("img",{src:ec,alt:"hijri"}),jsx("span",{children:t("hijri")})]}),jsx(h,{checked:e==="hijri",onChange:()=>o?.(e==="hijri"?"gregorian":"hijri")})]})})}var P=e=>e==="hijri"?kt:wt,R=e=>e==="hijri"?ht:Tt,jo=(e,o)=>!e||Number.isNaN(e.getTime())?void 0:new Ee({date:e,calendar:R(o),locale:P(o)}),Ze=(e,o,t)=>{let n=jo(c(e?.[0],t),o),i=jo(c(e?.[1],t),o);if(n&&i)return [n,i];let p=R(o),a=P(o),l=c(Date.now(),t)??new Date;return [new Ee({date:new Date(l.getFullYear(),l.getMonth(),l.getDate()-6),calendar:p,locale:a}),new Ee({date:l,calendar:p,locale:a})]},Ho=(e,o)=>Math.round((Date.UTC(o.getFullYear(),o.getMonth(),o.getDate())-Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()))/864e5),xe=e=>e.setHour(0).setMinute(0).setSecond(0).setMillisecond(0),ye=e=>e.setHour(23).setMinute(59).setSecond(59).setMillisecond(999),Ie=e=>!!e[1]&&e[0].format("YYYYMMDD")===e[1].format("YYYYMMDD");var Bt=31,ze=createContext(null);function v(){let e=useContext(ze);if(!e)throw new Error("useDateRangeCalendar must be used inside a DateRangeCalendar");return e}function Wo({zone:e,range:o$1,onApply:t,calendarMode:n="gregorian",maxRangeDays:i,groupBy:p,onGroupByChange:a}){let[l,r]=useState(()=>Ze(o$1,n,e.zone)),[g,c$1]=useState(l),[x,m]=useState(e),[T,G]=useState(p??"day"),[te,D]=useState(()=>p$1(o$1,e.zone)),[re,V]=useState(null),[ne,ae]=useState(false),S=useRef(null),L=!!re,s=i===void 0?Bt:i;useEffect(()=>{if(L)return;let d=Ze(o$1,n,e.zone);r(d),c$1(d),D(p$1(o$1,e.zone)),S.current&&S.current.set("date",d[0]);},[o$1,e.zone,e.countryCode,n,L]),useEffect(()=>{let d=u=>new DateObject({date:u.toDate(),calendar:R(n),locale:P(n)});r(u=>[d(u[0]),d(u[1])]),c$1(u=>[d(u[0]),d(u[1])]);},[n]),useEffect(()=>{m(d=>d.zone===e.zone&&d.countryCode===e.countryCode?d:e);},[e.zone,e.countryCode,L]);let k=d=>{let u=d;if(d.length<2||s===0)return u;let j=Ho(xe(d[0]).toDate(),ye(d[1]).toDate());return j<=s?u:(ae(true),setTimeout(()=>{ae(false);},3e3),[d[0],d[1].subtract(j-s,"d")])},rt=d=>{let u=k(d);r(u),D(!Ie(u));},nt=d=>{let u=k(d);r([xe(u[0]),ye(u[1])]),D(true),S.current&&S.current.set("date",u[0]);},at=d=>r(d),it=d=>{D(d),d&&l[1]&&r([xe(l[0]),ye(l[1])]);},_e=()=>V(null),pt=d=>V(d.currentTarget),lt=()=>{let d=[l[0].toDate(),l[1].toDate()];return {range:(te?q$1(d,x.zone):o(d,x.zone))??d,zone:x}},dt=()=>{t(lt())!==false&&(c$1(l),a?.(T),_e());},st=d=>{let u=d[0]?.format("MMM D"),j=d[1]?.format("MMM D")??u;return u?u===j?u:`${u} - ${j}`:j};return {draft:l,isAllDay:te,isSameDay:Ie(l),isError:ne,maxRangeDays:s,open:L,anchorEl:re,pickedZone:x,selectedGroupBy:T,calendarRef:S,maxDate:c(Date.now(),x.zone),rangeLabel:st(g),pickRange:rt,pickPreset:nt,setTimes:at,setAllDay:it,pickZone:m,setGroupBy:G,openPicker:pt,closePicker:_e,apply:dt}}var Go={day:"Day",month:"Month",quarter:"Quarter",year:"Year"};function Zt(){let{selectedGroupBy:e,setGroupBy:o,open:t}=v(),[n,i]=useState(null),p=!!n&&t,{t:a}=useTranslation();return jsx(yt,{onClickAway:()=>i(null),children:jsxs(y,{children:[jsx(wo,{children:a("groupedBy")}),jsxs(Mo,{onClick:l=>i(l.currentTarget),open:p,children:[jsx("span",{children:Go[e]}),jsx(y,{component:"img",src:Xc,alt:"arrow",sx:{...p&&{transform:"rotate(180deg)"}}})]}),jsx(R$1,{open:p,anchorEl:n,children:jsx(Po,{sx:{width:n?.clientWidth},children:Object.entries(Go).map(([l,r])=>jsx(Ro,{onClick:()=>{o(l),i(null);},className:e===l?"active":"",children:r},l))})})]})})}var Yo=Zt;var At=["Su","Mo","Tu","We","Th","Fr","Sa"];function zt({calendarMode:e}){let{draft:o,maxDate:t,calendarRef:n,pickRange:i}=v();return jsx(Calendar,{ref:n,numberOfMonths:2,value:o,onChange:i,calendar:R(e),locale:P(e),range:true,format:"MMM DD",monthYearSeparator:" ",renderButton:(p,a)=>jsx(Bo,{onClick:a,children:jsx("img",{src:p==="right"?gc:fc,alt:"arrow"})}),weekDays:At,maxDate:t})}var No=zt;function He({calendarMode:e}){let{t:o}=useTranslation(),{pickedZone:t,pickPreset:n}=v(),i=useMemo(()=>{let p=c(Date.now(),t.zone)??new Date,a=()=>new DateObject({date:p,calendar:R(e),locale:P(e)}),l=r=>a().subtract(r,"month");return [{id:"today",value:[a(),a()]},{id:"lastWeek",value:[a().subtract(6,"day"),a()]},{id:"lastMonth",value:[a().subtract(30,"day"),a()]},...[1,2,3].map(r=>({id:l(r).toFirstOfMonth().format("MMMM YYYY"),value:[l(r).toFirstOfMonth(),l(r).toLastOfMonth()]}))]},[e,t.zone]);return jsx(y,{"data-testid":"RangePresets",children:jsx(Oo,{children:i.map(p=>jsx(So,{onClick:a=>{a.preventDefault(),n(p.value);},children:o(p.id)},p.id))})})}var Q=e=>e===0?12:e<=12?e:e-12,be=e=>e>=12?"PM":"AM",Ce=(e,o)=>o==="AM"&&e===12?0:o==="PM"&&e!==12?e+12:e,$o=()=>new Date().getMinutes(),_o=()=>Q(new Date().getHours());var Ko=styled(y)(()=>({width:157,padding:"16px",display:"flex",alignItems:"center",justifyContent:"center",gap:"16px"})),Uo=styled(j,{shouldForwardProp:e=>e!=="open"&&e!=="size"})(({theme:e,open:o,size:t})=>{let{base:n,grey:i,brand:p}=e.v2.palette;return {fontSize:"11px",fontWeight:500,background:n.white,border:`1px solid ${i[100]}`,borderRadius:"19px",height:t==="large"?32:24,width:t==="large"?74:58,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",...o&&{boxShadow:"0px 0px 4px 0px #1F88D080",borderColor:p[500]}}}),J=styled(y)(()=>({textAlign:"center",cursor:"pointer",userSelect:"none"})),qo=styled(j,{shouldForwardProp:e=>e!=="selected"})(({theme:e,selected:o})=>{let{base:t,grey:n,brand:i}=e.v2.palette;return {fontSize:"11px",fontWeight:500,background:t.white,border:`1px solid ${n[100]}`,borderRadius:"4px",height:24,width:33,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",...o&&{borderColor:"transparent",color:i[500],backgroundColor:alpha(i[500],.1)}}}),Qo=styled(y)(()=>({display:"flex",flexDirection:"column",gap:"4px"})),Xo=styled(y)(()=>({display:"flex",alignItems:"center",justifyContent:"center",gap:"4px"})),We=styled(y)(()=>({display:"flex",flexDirection:"column",justifyContent:"center",gap:"6px"})),Fe=styled(L)(()=>({flexGrow:1,maxWidth:"100%",".MuiInput-input":{fontWeight:"500",fontSize:"11px",textAlign:"center"},".MuiInput-root":{paddingInline:"8px"},height:32,width:32}));var $t=["AM","PM"],he=12,Ge=59;function Te({onChange:e,defaultTime:o,enableRealTimeChange:t,size:n="large"}){let i=Bc(useId(),"time-picker"),[p,a]=useState(null),[l,r]=useState(o?.period??(new Date().getHours()>=he?"PM":"AM")),[g,c]=useState(o?.hour??_o()),[x,m]=useState(o?.minute??$o()),T=!!p;useEffect(()=>{t&&e?.({hour:g,minute:x,period:l});},[g,x,l,t]);let G=s=>{a(s.currentTarget);},te=()=>{a(null),e?.({hour:g,minute:x,period:l});},D=s=>s<10?`0${s}`:s.toString(),re=s=>{let k=Ma(D(Number(s.target.value)));if(k>he){s.preventDefault();return}c(k);},V=()=>{c(s=>s===he?1:s+1);},ne=()=>{c(s=>s===1?he:s-1);},ae=s=>{let k=Ma(D(Number(s.target.value)));if(k>Ge){s.preventDefault();return}m(k);},S=()=>{m(s=>s===Ge?(V(),0):s+1);},L=()=>{m(s=>s===0?(ne(),Ge):s-1);};return jsx(yt,{onClickAway:te,children:jsxs(y,{id:i,"data-testid":"TimePicker",children:[jsx(Uo,{size:n,open:T,onClick:G,children:`${D(g)}:${D(x)}${l.toLowerCase()}`}),jsx(R$1,{open:T,anchorEl:p,placement:"top-start",sx:{marginTop:"8px",marginBottom:"8px"},children:jsxs(Ko,{children:[jsxs(Xo,{children:[jsxs(We,{children:[jsx(J,{onClick:V,children:jsx("img",{src:dl,alt:"arrow"})}),jsx(Fe,{type:"number",hideArrows:true,disableFocusRing:true,value:D(g),onChange:re}),jsx(J,{onClick:ne,children:jsx("img",{src:el,alt:"arrow"})})]}),jsx(j,{children:":"}),jsxs(We,{children:[jsx(J,{onClick:S,children:jsx("img",{src:dl,alt:"arrow"})}),jsx(Fe,{type:"number",hideArrows:true,disableFocusRing:true,value:D(x),onChange:ae}),jsx(J,{onClick:L,children:jsx("img",{src:el,alt:"arrow"})})]})]}),jsx(Qo,{children:$t.map(s=>jsx(qo,{onClick:()=>r(s),selected:l===s,children:s},s))})]})})]})})}function Kt(){let{t:e}=useTranslation(),{draft:o,isAllDay:t,setTimes:n,setAllDay:i}=v(),p=new DateObject(o[0]),a=new DateObject(o[1]),l=({hour:g,minute:c,period:x})=>{n([p.setHour(Ce(g,x??"AM")).setMinute(c).setSecond(0),a]);},r=({hour:g,minute:c,period:x})=>{n([p,a.setHour(Ce(g,x??"AM")).setMinute(c).setSecond(59)]);};return jsx(Zo,{children:jsxs(Ao,{children:[jsxs(Eo,{isAllDay:t,children:[jsx("span",{className:"label",children:e("allDay")}),jsx(h,{checked:t,onChange:g=>i(g.target.checked)})]}),!t&&jsxs(Io,{children:[jsx(Te,{defaultTime:{hour:Q(p.hour),minute:p.minute,period:be(p.hour)},size:"small",onChange:l,enableRealTimeChange:true},`${o[0]?.toString()}-start`),jsx(Te,{defaultTime:{hour:Q(a.hour),minute:a.minute,period:be(a.hour)},size:"small",onChange:r,enableRealTimeChange:true},`${o[1]?.toString()}-end`)]})]})})}var et=Kt;function Jt(e){let{calendarMode:o="gregorian",onCalendarModeChange:t,defaultCountryZone:n,countryCodes:i,groupBy:p}=e,{t:a}=useTranslation(),l=Bc(useId(),"date-range-calendar"),r=Wo(e),g=c=>{c.key==="Enter"&&r.draft[1]&&!r.isError?(c.stopPropagation(),r.apply()):c.key==="Escape"&&(c.stopPropagation(),r.closePicker());};return jsx(ze.Provider,{value:r,children:jsxs(To,{id:l,"data-testid":"DateRangeCalendar",children:[jsx(bo,{onClick:r.openPicker,open:r.open,children:r.rangeLabel}),r.open&&jsx(B$1,{onClick:c=>{c.stopPropagation(),r.closePicker();}}),jsx(ut,{open:r.open,anchorEl:r.anchorEl,placement:"bottom-end",children:jsxs(fo,{onKeyDown:g,children:[jsxs(Do,{children:[jsx(He,{calendarMode:o}),jsxs(ko,{children:[p&&jsx(Yo,{}),jsx(Oe,{calendarMode:o,onCalendarModeChange:t})]})]}),jsxs(y,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[jsx(No,{calendarMode:o}),jsx(x,{in:r.isError&&r.maxRangeDays>0,children:jsx(b$1,{severity:"error",message:a("dateRangeError",{number:r.maxRangeDays}),sx:{marginInline:"16px",marginBottom:"16px"}})}),jsxs(Co,{sx:{borderBottomLeftRadius:"8px"},children:[n&&i&&jsx(ho,{children:jsx(Se,{zone:r.pickedZone,onChange:r.pickZone,defaultCountryZone:n,countryCodes:i},String(r.open))}),r.isSameDay&&jsx(et,{}),jsxs(yo,{children:[jsx(go,{variant:"contained",onClick:r.closePicker,children:a("cancel")}),jsx(xo,{variant:"contained",onClick:r.apply,disabled:!r.draft[1],children:a("okay")})]})]})]})]})})]})})}var ot=Jt;function or({value:e,zone:o,format:t,...n$1}){let i=useMemo(()=>n(e,o,t),[e,o,t]);return jsx(a,{...n$1,children:i})}var tr=or;var tt=styled(y)({display:"flex",alignItems:"center",gap:"12px"});function lr({value:e,zone:o,format:t,rendered:n$1,tableMode:i,...p}){let a$1=useMemo(()=>n$1??n(e,o,t),[n$1,e,o,t]);return jsx(a,{...p,children:jsx(tt,{children:jsx(y,{sx:{...Ya(i)&&{fontSize:"11px"}},children:a$1})})})}var Ne=lr;function cr({value:e,zone:o,hintZone:t,format:n$1,tableMode:i$1,...p$1}){let a=useMemo(()=>{if(!(!t||e==null||e===""))return i(o,t,e)?n(e,t):void 0},[e,o,t]);return jsxs(y,{sx:{display:"flex",gap:"8px"},children:[jsx(Ne,{value:e,zone:o,format:n$1,tableMode:i$1,...p$1}),a!==void 0&&jsx(p,{title:a,children:jsx("img",{src:H,width:14,alt:"timezone"})})]})}var mr=cr;export{ot as DateRangeCalendar,Se as ZonePicker,tr as ZonedDateCell,mr as ZonedDateHintViewer,Ne as ZonedDateViewer};
1
+ import {a}from'../../_chunks/chunk-ROKMSXYO.js';import'../../_chunks/chunk-J43HMZGL.js';import'../../_chunks/chunk-Q4FLSRWN.js';import'../../_chunks/chunk-G3QDXDRW.js';import'../../_chunks/chunk-XB7FBOZY.js';import'../../_chunks/chunk-TKQTJ4MH.js';import'../../_chunks/chunk-BXVLLRHG.js';import'../../_chunks/chunk-IBHWDBBJ.js';import'../../_chunks/chunk-XRUOTYCI.js';import'../../_chunks/chunk-GFOWTME6.js';import'../../_chunks/chunk-LON6X4MJ.js';import'../../_chunks/chunk-2JYBMD4I.js';import'../../_chunks/chunk-UC5FMNUV.js';import'../../_chunks/chunk-FTRMTWS4.js';import'../../_chunks/chunk-64ZDTAAW.js';import'../../_chunks/chunk-DFEQ23C7.js';import'../../_chunks/chunk-REZFP4CA.js';import'../../_chunks/chunk-GBGW63EG.js';import'../../_chunks/chunk-TX3XM6XL.js';import'../../_chunks/chunk-LDCBWAC4.js';import'../../_chunks/chunk-OOLWSYGD.js';import'../../_chunks/chunk-DOZLA7RE.js';import'../../_chunks/chunk-ZRABDQRJ.js';import'../../_chunks/chunk-7NMMD6VJ.js';import'../../_chunks/chunk-XXCH74F3.js';import'../../_chunks/chunk-MF5ATA3Y.js';import'../../_chunks/chunk-SMJCH23I.js';import'../../_chunks/chunk-UCJQFE45.js';import'../../_chunks/chunk-BNM6FJCR.js';import'../../_chunks/chunk-2RPPZGV7.js';import'../../_chunks/chunk-ABVY4O2O.js';import'../../_chunks/chunk-AJS7K55Q.js';import'../../_chunks/chunk-H4FZYTL7.js';import'../../_chunks/chunk-WC2MF35C.js';import'../../_chunks/chunk-PUJ762TG.js';import'../../_chunks/chunk-ONANHXZA.js';import'../../_chunks/chunk-IPEPXEL5.js';import'../../_chunks/chunk-FNUU2KSZ.js';import'../../_chunks/chunk-YIZKLFYJ.js';import'../../_chunks/chunk-DRRME7J2.js';import'../../_chunks/chunk-X5HRCMTE.js';import'../../_chunks/chunk-FMUJQ45L.js';import'../../_chunks/chunk-K6LOVRKX.js';import'../../_chunks/chunk-RNJI3YXH.js';import'../../_chunks/chunk-DEEC67P7.js';import'../../_chunks/chunk-OPDVYLZK.js';import'../../_chunks/chunk-LVQ2UFZT.js';import'../../_chunks/chunk-TN55SPRQ.js';import'../../_chunks/chunk-KCIFOOFA.js';import'../../_chunks/chunk-4JUVQWRF.js';import'../../_chunks/chunk-ZUK5FRG5.js';import'../../_chunks/chunk-ZCULKYWE.js';import'../../_chunks/chunk-DJRPY3A2.js';import'../../_chunks/chunk-EUMG4QKT.js';import'../../_chunks/chunk-F3U4ZIAP.js';import {b}from'../../_chunks/chunk-TZOMS57X.js';import'../../_chunks/chunk-MI3EC2ZF.js';import {b as b$1}from'../../_chunks/chunk-HOHQMC2O.js';import'../../_chunks/chunk-7VJMQ6ZC.js';import'../../_chunks/chunk-LXG5YXOJ.js';import'../../_chunks/chunk-EG32DA46.js';import'../../_chunks/chunk-NUCUSAD2.js';import'../../_chunks/chunk-N5KO2TC3.js';import'../../_chunks/chunk-5V3PUIXN.js';import'../../_chunks/chunk-ZGWS7XFH.js';import'../../_chunks/chunk-BRFCMPF5.js';import {j,L,B as B$1,x as x$1,p,R as R$1,h}from'../../_chunks/chunk-AXNWVU3K.js';import {z,x,B,C,A,m,b as b$2,o,e,p as p$1,n}from'../../_chunks/chunk-BE2RKFQJ.js';import'../../_chunks/chunk-EOBVIUIS.js';import {Bc,Ya,Ma}from'../../_chunks/chunk-RUFO5P34.js';import {Vj,Wj,Xj,Yj,H,Xc,ec,gc,fc,dl,el}from'../../_chunks/chunk-IQAHULGQ.js';import'../../_chunks/chunk-37JEPAIM.js';import {memo,createContext,useState,useMemo,useId,useRef,useEffect,useContext}from'react';import y from'@mui/material/Box';import ut from'@mui/material/Popper';import {useTranslation}from'react-i18next';import yt from'@mui/material/ClickAwayListener';import {styled,alpha}from'@mui/material/styles';import {jsx,jsxs}from'react/jsx-runtime';import q from'@mui/material/Button';import {Calendar,DateObject}from'react-multi-date-picker';import Ee from'react-date-object';import ht from'react-date-object/calendars/arabic';import Tt from'react-date-object/calendars/gregorian';import kt from'react-date-object/locales/arabic_en';import wt from'react-date-object/locales/gregorian_en';var co=styled(y)(()=>({'[class$="-IndicatorsContainer2"]':{display:"none"},"#react-select-2-listbox":{width:300}})),fe=styled(y)(({theme:e})=>({borderRadius:e.spacing(.5),border:`1px solid ${e.palette.divider}`,background:e.palette.common.white,boxShadow:e.shadows[10],minWidth:200,width:"max-content",overflow:"auto"})),mo=styled(y,{shouldForwardProp:e=>e!=="open"})(({theme:e,open:o})=>({width:156,fontSize:"11px",color:e.palette.text.primary,border:"1px solid",borderColor:e.palette.divider,minHeight:32,borderRadius:"4px",padding:e.spacing(1),whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",cursor:"pointer",display:"flex",alignItems:"center",gap:e.spacing(1),fontWeight:500,...o&&{borderRadius:"4px",boxShadow:e.shadows[7],border:"1px solid",borderColor:e.palette.info.dark,background:e.palette.common.white},span:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}})),$=styled(y)(({theme:e})=>({padding:e.spacing(1),color:e.palette.text.primary,fontSize:"11px",display:"flex",alignItems:"center",gap:e.spacing(1),height:33,cursor:"pointer","&:hover":{boxShadow:"0px 0px 16px 0px #00000021"},"&+&":{borderTop:"1px solid",borderColor:e.palette.divider},"&.active span":{fontWeight:500},span:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}})),_=styled(y)(()=>({width:12,height:12})),K=styled(y)(({theme:e})=>({fontSize:"11px",color:e.palette.text.secondary,lineHeight:"15.03px","&.selected":{color:e.palette.info.dark}}));function Re({zone:e,onChange:o,defaultCountryZone:t,countryCodes:n}){let[i,p]=useState(null),a=m=>{i||p(m.currentTarget);},l=()=>{i&&p(null);},r=(m,T)=>{m.stopPropagation(),o(T);},g=useMemo(()=>n.map(A).filter(m=>!!m),[n]),c=g.some(m=>B(m,e)),x=c?e:t;return jsxs($,{onMouseEnter:a,onMouseLeave:l,onClick:()=>{o(x);},children:[c?jsx("img",{src:Yj,alt:"icon"}):jsx(_,{}),jsx("img",{src:Wj,alt:"entity-timezone"}),jsx(b,{countryCode:x.countryCode}),jsx(K,{className:c?"selected":"",children:C(x)}),jsx(ut,{open:!!i,anchorEl:i,placement:"right-start",sx:{zIndex:3},disablePortal:true,children:jsx(fe,{sx:{maxHeight:300},children:g.map(m=>{let T=B(m,e);return jsxs($,{onClick:G=>{r(G,m);},sx:{gap:"4px"},children:[T?jsx("img",{src:Yj,alt:"icon"}):jsx(_,{}),jsx(b,{countryCode:m.countryCode}),jsx(K,{className:T?"selected":"",children:C(m)})]},m.countryCode)})})})]})}function ve({zone:e,onChange:o}){let t=z(x());if(!t)return null;let n=B(t,e);return jsxs($,{onClick:()=>o(t),children:[n?jsx("img",{src:Yj,alt:"icon"}):jsx(_,{}),jsx("img",{src:Vj,alt:"user-timezone"}),jsx(b,{countryCode:t.countryCode}),jsx(K,{className:n?"selected":"",children:C(t)})]})}function Ct({zone:e,onChange:o,defaultCountryZone:t,countryCodes:n}){let[i,p]=useState(null),a=!!i,l=z(x()),r=()=>{p(null);},g=m=>{o(m),r();},c=m=>{p(m.currentTarget);},x$1=B(e,l)?Vj:B(e,t)?Wj:Xj;return jsx(yt,{onClickAway:r,children:jsxs(co,{"data-testid":"ZonePicker",children:[jsxs(mo,{open:a,onClick:c,children:[jsx("img",{src:x$1,alt:"zone-icon"}),jsx(b,{countryCode:e.countryCode}),jsx("span",{children:C(e)})]}),jsx(ut,{open:a,anchorEl:i,placement:"top-start",sx:{zIndex:1400},children:jsxs(fe,{"data-testid":"ZonePicker_dropdown",children:[jsx(Re,{zone:e,onChange:g,defaultCountryZone:t,countryCodes:n}),jsx(ve,{zone:e,onChange:g})]})})]})})}var Se=memo(Ct);var fo=styled(y)(({theme:e})=>({display:"flex",marginTop:"8px",background:e.palette.common.white,boxShadow:e.shadows[9],borderRadius:e.spacing(1),color:e.palette.text.primary,fontSize:"11px",".rmdp-calendar":{padding:"8px 16px 16px"},".rmdp-rtl *":{fontFamily:"Tajawal"},".rmdp-rtl .sd":{paddingTop:"4px"},".rmdp-wrapper":{position:"relative",borderRadius:"8px",boxShadow:"none"},".rmdp-day span":{fontSize:"11px",fontWeight:500},".rmdp-day, .rmdp-week-day":{width:40,height:40,marginBottom:"2px",padding:"4px",fontSize:"11px",color:e.palette.grey[900]},".rmdp-day-picker":{padding:0},".rmdp-day.rmdp-today span":{backgroundColor:"transparent !important",color:e.palette.info.dark},".rmdp-day.rmdp-today.end span, .rmdp-day.rmdp-today.end span":{color:e.palette.common.white},".rmdp-range, .rmdp-day:not(.rmdp-disabled):not(.rmdp-day-hidden) span:hover":{background:e.palette.info.light,boxShadow:"none",color:e.palette.grey[900]},".rmdp-range-hover.start, .rmdp-range.start, .rmdp-range-hover.end, .rmdp-range.end, .rmdp-rtl .rmdp-range-hover.start, .rmdp-rtl .rmdp-range.start, .rmdp-rtl .rmdp-range-hover.end, .rmdp-rtl .rmdp-range.end":{borderRadius:"50%",background:e.palette.background.gradient.darkShadedBlue,color:e.palette.common.white},".rmdp-range.start:after":{content:'""',position:"absolute",background:e.palette.info.light,height:"100%",width:"50%",right:0,top:0,zIndex:-1},".rmdp-rtl .rmdp-range.start:after":{right:"unset",left:0},".rmdp-range.end:after":{content:'""',position:"absolute",background:e.palette.info.light,height:"100%",width:"50%",left:0,top:0,zIndex:-1},".rmdp-rtl .rmdp-range.end:after":{left:"unset",right:0},".rmdp-week-day":{color:e.palette.grey[700],marginBottom:"4px",fontSize:"11px",padding:"4px"},".rmdp-header-values":{color:e.palette.grey[900],fontSize:"12px",fontWeight:500,lineHeight:"20px",letterSpacing:"0.1px"},".rmdp-header-values span:nth-of-type(2)":{display:"none"},".rmdp-header":{padding:"4px 0",margin:0,fontSize:"12px"},".rmdp-top-class":{display:"block !important"},".rmdp-day.rmdp-selected span:not(.highlight)":{background:e.palette.info.dark},".rmdp-day.start.end":{overflow:"hidden"},".rmdp-day.rmdp-disabled":{color:"#ccc",cursor:"not-allowed"}})),go=styled(q)(({theme:e})=>({textTransform:"capitalize",padding:"8px 24px",width:75,height:32,fontSize:"11px",background:"transparent",color:e.palette.text.primary,border:"1px solid",borderColor:e.palette.divider,fontWeight:500,borderRadius:"4px","&:hover":{background:"transparent",color:e.palette.text.primary}})),xo=styled(q)(({theme:e})=>({textTransform:"capitalize",padding:"8px 24px",width:75,height:32,fontSize:"11px",borderRadius:"4px",fontWeight:700,background:e.palette.info.dark,"&:hover":{background:e.palette.info.dark}})),yo=styled(y)(()=>({display:"flex",gap:8,marginLeft:"auto",flexShrink:0})),bo=styled(q,{shouldForwardProp:e=>e!=="open"})(({open:e,theme:o})=>({color:o.palette.text.primary,fontSize:"11px",fontWeight:500,padding:o.spacing(1),borderRadius:"4px",border:"1px solid",borderColor:o.palette.divider,background:o.palette.common.white,textTransform:"none",height:32,...e&&{border:"1px solid",borderColor:o.palette.info.dark,boxShadow:o.shadows[7]}})),Co=styled(y)(({theme:e})=>({background:e.palette.common.white,display:"flex",justifyContent:"space-between",alignItems:"center",gap:10,padding:"16px",borderTop:"1px solid",borderColor:e.palette.divider,borderBottomRightRadius:"8px"})),Do=styled(y)(({theme:e})=>({padding:16,paddingInlineEnd:"23px",borderRight:"1px solid",borderColor:e.palette.divider,background:e.palette.common.white,width:"max-content",borderTopLeftRadius:"8px",borderBottomLeftRadius:"8px",display:"flex",flexDirection:"column",gap:10,justifyContent:"space-between"})),ho=styled(y)(()=>({display:"flex",alignItems:"center",gap:"10px"})),To=styled(y)(()=>({position:"relative"})),ko=styled(y)(()=>({display:"flex",flexDirection:"column",gap:"24px"})),wo=styled(y)(({theme:e})=>({color:e.palette.grey[700],fontSize:"9px",fontWeight:500,marginBottom:"6px"})),Mo=styled(y,{shouldForwardProp:e=>e!=="open"})(({theme:e,open:o})=>({borderRadius:"4px",border:`1px solid ${e.palette.divider}`,background:e.palette.common.white,height:32,padding:"8px",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",...o&&{border:`1px solid ${e.palette.info.dark}`,background:e.palette.common.white,boxShadow:e.shadows[7]}})),Po=styled(y)(({theme:e})=>({borderRadius:"8px",background:e.palette.common.white,boxShadow:"0px 8px 36px 0px rgba(0, 0, 0, 0.15)",textAlign:"center",color:e.palette.grey[900],fontSize:"12px",fontWeight:500,lineHeight:"20px",letterSpacing:"0.1px",padding:"16px",display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",flexDirection:"column"})),Ro=styled(y)(({theme:e})=>({width:71,padding:"4px 0",cursor:"pointer","&:hover, &.active":{borderRadius:"100px",background:e.palette.info.light}})),vo=styled(y)(({theme:e})=>({border:"1px solid",borderColor:e.palette.divider,borderRadius:"50px",paddingInline:"6px 12px",color:e.palette.text.primary,fontSize:"11px",display:"flex",gap:"8px",alignItems:"center",justifyContent:"space-between",height:32,marginTop:"8px",img:{width:16,height:16},"& > div":{display:"flex",alignItems:"center",gap:"2px"}})),Bo=styled(q)(()=>({minWidth:"auto",padding:0,"& > img":{cursor:"pointer"}})),So=styled(q)(({theme:e})=>({cursor:"pointer",borderRadius:"50px",border:"1px solid",borderColor:e.palette.divider,background:e.palette.common.white,color:e.palette.text.primary,fontSize:"11px",fontWeight:e.typography.fontWeightRegular,paddingInline:"12px",height:32,width:"max-content",textTransform:"unset","&:hover":{boxShadow:e.shadows[7],border:"1px solid",borderColor:e.palette.info.dark}})),Oo=styled(y)(()=>({display:"flex",flexDirection:"column",gap:"8px"})),Eo=styled(y,{shouldForwardProp:e=>e!=="isAllDay"})(({theme:e,isAllDay:o})=>({display:"flex",alignItems:"center",gap:e.spacing(1),position:"relative",paddingInline:"5px",".label":{width:"max-content"},...!o&&{paddingRight:e.spacing(1),"&:after":{content:'""',position:"absolute",width:"1px",background:e.palette.divider,right:0,height:17}}})),Zo=styled(y)(()=>({width:235})),Io=styled(y)(()=>({display:"flex",gap:"4px"})),Ao=styled(y)(({theme:e})=>({display:"flex",gap:"8px",alignItems:"center",borderRadius:"50px",border:"1px solid",borderColor:e.palette.divider,paddingInline:"5px",width:"fit-content",height:32}));function Oe({calendarMode:e,onCalendarModeChange:o}){let{t}=useTranslation();return jsx(y,{children:jsxs(vo,{children:[jsxs(y,{children:[jsx("img",{src:ec,alt:"hijri"}),jsx("span",{children:t("hijri")})]}),jsx(h,{checked:e==="hijri",onChange:()=>o?.(e==="hijri"?"gregorian":"hijri")})]})})}var P=e=>e==="hijri"?kt:wt,R=e=>e==="hijri"?ht:Tt,jo=(e,o)=>!e||Number.isNaN(e.getTime())?void 0:new Ee({date:e,calendar:R(o),locale:P(o)}),Ze=(e$1,o,t)=>{let n=jo(e(e$1?.[0],t),o),i=jo(e(e$1?.[1],t),o);if(n&&i)return [n,i];let p=R(o),a=P(o),l=e(Date.now(),t)??new Date;return [new Ee({date:new Date(l.getFullYear(),l.getMonth(),l.getDate()-6),calendar:p,locale:a}),new Ee({date:l,calendar:p,locale:a})]},Ho=(e,o)=>Math.round((Date.UTC(o.getFullYear(),o.getMonth(),o.getDate())-Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()))/864e5),xe=e=>e.setHour(0).setMinute(0).setSecond(0).setMillisecond(0),ye=e=>e.setHour(23).setMinute(59).setSecond(59).setMillisecond(999),Ie=e=>!!e[1]&&e[0].format("YYYYMMDD")===e[1].format("YYYYMMDD");var Bt=31,ze=createContext(null);function v(){let e=useContext(ze);if(!e)throw new Error("useDateRangeCalendar must be used inside a DateRangeCalendar");return e}function Wo({zone:e$1,range:o$1,onApply:t,calendarMode:n$1="gregorian",maxRangeDays:i,groupBy:p,onGroupByChange:a}){let[l,r]=useState(()=>Ze(o$1,n$1,e$1.zone)),[g,c]=useState(l),[x,m]=useState(e$1),[T,G]=useState(p??"day"),[te,D]=useState(()=>o(o$1,e$1.zone)),[re,V]=useState(null),[ne,ae]=useState(false),S=useRef(null),L=!!re,s=i===void 0?Bt:i;useEffect(()=>{if(L)return;let d=Ze(o$1,n$1,e$1.zone);r(d),c(d),D(o(o$1,e$1.zone)),S.current&&S.current.set("date",d[0]);},[o$1,e$1.zone,e$1.countryCode,n$1,L]),useEffect(()=>{let d=u=>new DateObject({date:u.toDate(),calendar:R(n$1),locale:P(n$1)});r(u=>[d(u[0]),d(u[1])]),c(u=>[d(u[0]),d(u[1])]);},[n$1]),useEffect(()=>{m(d=>d.zone===e$1.zone&&d.countryCode===e$1.countryCode?d:e$1);},[e$1.zone,e$1.countryCode,L]);let k=d=>{let u=d;if(d.length<2||s===0)return u;let j=Ho(xe(d[0]).toDate(),ye(d[1]).toDate());return j<=s?u:(ae(true),setTimeout(()=>{ae(false);},3e3),[d[0],d[1].subtract(j-s,"d")])},rt=d=>{let u=k(d);r(u),D(!Ie(u));},nt=d=>{let u=k(d);r([xe(u[0]),ye(u[1])]),D(true),S.current&&S.current.set("date",u[0]);},at=d=>r(d),it=d=>{D(d),d&&l[1]&&r([xe(l[0]),ye(l[1])]);},_e=()=>V(null),pt=d=>V(d.currentTarget),lt=()=>{let d=[l[0].toDate(),l[1].toDate()];return {range:(te?p$1(d,x.zone):n(d,x.zone))??d,zone:x}},dt=()=>{t(lt())!==false&&(c(l),a?.(T),_e());},st=d=>{let u=d[0]?.format("MMM D"),j=d[1]?.format("MMM D")??u;return u?u===j?u:`${u} - ${j}`:j};return {draft:l,isAllDay:te,isSameDay:Ie(l),isError:ne,maxRangeDays:s,open:L,anchorEl:re,pickedZone:x,selectedGroupBy:T,calendarRef:S,maxDate:e(Date.now(),x.zone),rangeLabel:st(g),pickRange:rt,pickPreset:nt,setTimes:at,setAllDay:it,pickZone:m,setGroupBy:G,openPicker:pt,closePicker:_e,apply:dt}}var Go={day:"Day",month:"Month",quarter:"Quarter",year:"Year"};function Zt(){let{selectedGroupBy:e,setGroupBy:o,open:t}=v(),[n,i]=useState(null),p=!!n&&t,{t:a}=useTranslation();return jsx(yt,{onClickAway:()=>i(null),children:jsxs(y,{children:[jsx(wo,{children:a("groupedBy")}),jsxs(Mo,{onClick:l=>i(l.currentTarget),open:p,children:[jsx("span",{children:Go[e]}),jsx(y,{component:"img",src:Xc,alt:"arrow",sx:{...p&&{transform:"rotate(180deg)"}}})]}),jsx(R$1,{open:p,anchorEl:n,children:jsx(Po,{sx:{width:n?.clientWidth},children:Object.entries(Go).map(([l,r])=>jsx(Ro,{onClick:()=>{o(l),i(null);},className:e===l?"active":"",children:r},l))})})]})})}var Yo=Zt;var At=["Su","Mo","Tu","We","Th","Fr","Sa"];function zt({calendarMode:e}){let{draft:o,maxDate:t,calendarRef:n,pickRange:i}=v();return jsx(Calendar,{ref:n,numberOfMonths:2,value:o,onChange:i,calendar:R(e),locale:P(e),range:true,format:"MMM DD",monthYearSeparator:" ",renderButton:(p,a)=>jsx(Bo,{onClick:a,children:jsx("img",{src:p==="right"?gc:fc,alt:"arrow"})}),weekDays:At,maxDate:t})}var No=zt;function He({calendarMode:e$1}){let{t:o}=useTranslation(),{pickedZone:t,pickPreset:n}=v(),i=useMemo(()=>{let p=e(Date.now(),t.zone)??new Date,a=()=>new DateObject({date:p,calendar:R(e$1),locale:P(e$1)}),l=r=>a().subtract(r,"month");return [{id:"today",value:[a(),a()]},{id:"lastWeek",value:[a().subtract(6,"day"),a()]},{id:"lastMonth",value:[a().subtract(30,"day"),a()]},...[1,2,3].map(r=>({id:l(r).toFirstOfMonth().format("MMMM YYYY"),value:[l(r).toFirstOfMonth(),l(r).toLastOfMonth()]}))]},[e$1,t.zone]);return jsx(y,{"data-testid":"RangePresets",children:jsx(Oo,{children:i.map(p=>jsx(So,{onClick:a=>{a.preventDefault(),n(p.value);},children:o(p.id)},p.id))})})}var Q=e=>e===0?12:e<=12?e:e-12,be=e=>e>=12?"PM":"AM",Ce=(e,o)=>o==="AM"&&e===12?0:o==="PM"&&e!==12?e+12:e,$o=()=>new Date().getMinutes(),_o=()=>Q(new Date().getHours());var Ko=styled(y)(()=>({width:157,padding:"16px",display:"flex",alignItems:"center",justifyContent:"center",gap:"16px"})),Uo=styled(j,{shouldForwardProp:e=>e!=="open"&&e!=="size"})(({theme:e,open:o,size:t})=>{let{base:n,grey:i,brand:p}=e.v2.palette;return {fontSize:"11px",fontWeight:500,background:n.white,border:`1px solid ${i[100]}`,borderRadius:"19px",height:t==="large"?32:24,width:t==="large"?74:58,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",...o&&{boxShadow:"0px 0px 4px 0px #1F88D080",borderColor:p[500]}}}),J=styled(y)(()=>({textAlign:"center",cursor:"pointer",userSelect:"none"})),qo=styled(j,{shouldForwardProp:e=>e!=="selected"})(({theme:e,selected:o})=>{let{base:t,grey:n,brand:i}=e.v2.palette;return {fontSize:"11px",fontWeight:500,background:t.white,border:`1px solid ${n[100]}`,borderRadius:"4px",height:24,width:33,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",...o&&{borderColor:"transparent",color:i[500],backgroundColor:alpha(i[500],.1)}}}),Qo=styled(y)(()=>({display:"flex",flexDirection:"column",gap:"4px"})),Xo=styled(y)(()=>({display:"flex",alignItems:"center",justifyContent:"center",gap:"4px"})),We=styled(y)(()=>({display:"flex",flexDirection:"column",justifyContent:"center",gap:"6px"})),Fe=styled(L)(()=>({flexGrow:1,maxWidth:"100%",".MuiInput-input":{fontWeight:"500",fontSize:"11px",textAlign:"center"},".MuiInput-root":{paddingInline:"8px"},height:32,width:32}));var $t=["AM","PM"],he=12,Ge=59;function Te({onChange:e,defaultTime:o,enableRealTimeChange:t,size:n="large"}){let i=Bc(useId(),"time-picker"),[p,a]=useState(null),[l,r]=useState(o?.period??(new Date().getHours()>=he?"PM":"AM")),[g,c]=useState(o?.hour??_o()),[x,m]=useState(o?.minute??$o()),T=!!p;useEffect(()=>{t&&e?.({hour:g,minute:x,period:l});},[g,x,l,t]);let G=s=>{a(s.currentTarget);},te=()=>{a(null),e?.({hour:g,minute:x,period:l});},D=s=>s<10?`0${s}`:s.toString(),re=s=>{let k=Ma(D(Number(s.target.value)));if(k>he){s.preventDefault();return}c(k);},V=()=>{c(s=>s===he?1:s+1);},ne=()=>{c(s=>s===1?he:s-1);},ae=s=>{let k=Ma(D(Number(s.target.value)));if(k>Ge){s.preventDefault();return}m(k);},S=()=>{m(s=>s===Ge?(V(),0):s+1);},L=()=>{m(s=>s===0?(ne(),Ge):s-1);};return jsx(yt,{onClickAway:te,children:jsxs(y,{id:i,"data-testid":"TimePicker",children:[jsx(Uo,{size:n,open:T,onClick:G,children:`${D(g)}:${D(x)}${l.toLowerCase()}`}),jsx(R$1,{open:T,anchorEl:p,placement:"top-start",sx:{marginTop:"8px",marginBottom:"8px"},children:jsxs(Ko,{children:[jsxs(Xo,{children:[jsxs(We,{children:[jsx(J,{onClick:V,children:jsx("img",{src:dl,alt:"arrow"})}),jsx(Fe,{type:"number",hideArrows:true,disableFocusRing:true,value:D(g),onChange:re}),jsx(J,{onClick:ne,children:jsx("img",{src:el,alt:"arrow"})})]}),jsx(j,{children:":"}),jsxs(We,{children:[jsx(J,{onClick:S,children:jsx("img",{src:dl,alt:"arrow"})}),jsx(Fe,{type:"number",hideArrows:true,disableFocusRing:true,value:D(x),onChange:ae}),jsx(J,{onClick:L,children:jsx("img",{src:el,alt:"arrow"})})]})]}),jsx(Qo,{children:$t.map(s=>jsx(qo,{onClick:()=>r(s),selected:l===s,children:s},s))})]})})]})})}function Kt(){let{t:e}=useTranslation(),{draft:o,isAllDay:t,setTimes:n,setAllDay:i}=v(),p=new DateObject(o[0]),a=new DateObject(o[1]),l=({hour:g,minute:c,period:x})=>{n([p.setHour(Ce(g,x??"AM")).setMinute(c).setSecond(0),a]);},r=({hour:g,minute:c,period:x})=>{n([p,a.setHour(Ce(g,x??"AM")).setMinute(c).setSecond(59)]);};return jsx(Zo,{children:jsxs(Ao,{children:[jsxs(Eo,{isAllDay:t,children:[jsx("span",{className:"label",children:e("allDay")}),jsx(h,{checked:t,onChange:g=>i(g.target.checked)})]}),!t&&jsxs(Io,{children:[jsx(Te,{defaultTime:{hour:Q(p.hour),minute:p.minute,period:be(p.hour)},size:"small",onChange:l,enableRealTimeChange:true},`${o[0]?.toString()}-start`),jsx(Te,{defaultTime:{hour:Q(a.hour),minute:a.minute,period:be(a.hour)},size:"small",onChange:r,enableRealTimeChange:true},`${o[1]?.toString()}-end`)]})]})})}var et=Kt;function Jt(e){let{calendarMode:o="gregorian",onCalendarModeChange:t,defaultCountryZone:n,countryCodes:i,groupBy:p}=e,{t:a}=useTranslation(),l=Bc(useId(),"date-range-calendar"),r=Wo(e),g=c=>{c.key==="Enter"&&r.draft[1]&&!r.isError?(c.stopPropagation(),r.apply()):c.key==="Escape"&&(c.stopPropagation(),r.closePicker());};return jsx(ze.Provider,{value:r,children:jsxs(To,{id:l,"data-testid":"DateRangeCalendar",children:[jsx(bo,{onClick:r.openPicker,open:r.open,children:r.rangeLabel}),r.open&&jsx(B$1,{onClick:c=>{c.stopPropagation(),r.closePicker();}}),jsx(ut,{open:r.open,anchorEl:r.anchorEl,placement:"bottom-end",children:jsxs(fo,{onKeyDown:g,children:[jsxs(Do,{children:[jsx(He,{calendarMode:o}),jsxs(ko,{children:[p&&jsx(Yo,{}),jsx(Oe,{calendarMode:o,onCalendarModeChange:t})]})]}),jsxs(y,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[jsx(No,{calendarMode:o}),jsx(x$1,{in:r.isError&&r.maxRangeDays>0,children:jsx(b$1,{severity:"error",message:a("dateRangeError",{number:r.maxRangeDays}),sx:{marginInline:"16px",marginBottom:"16px"}})}),jsxs(Co,{sx:{borderBottomLeftRadius:"8px"},children:[n&&i&&jsx(ho,{children:jsx(Se,{zone:r.pickedZone,onChange:r.pickZone,defaultCountryZone:n,countryCodes:i},String(r.open))}),r.isSameDay&&jsx(et,{}),jsxs(yo,{children:[jsx(go,{variant:"contained",onClick:r.closePicker,children:a("cancel")}),jsx(xo,{variant:"contained",onClick:r.apply,disabled:!r.draft[1],children:a("okay")})]})]})]})]})})]})})}var ot=Jt;function or({value:e,zone:o,format:t,...n}){let i=useMemo(()=>m(e,o,t),[e,o,t]);return jsx(a,{...n,children:i})}var tr=or;var tt=styled(y)({display:"flex",alignItems:"center",gap:"12px"});function lr({value:e,zone:o,format:t,rendered:n,tableMode:i,...p}){let a$1=useMemo(()=>n??m(e,o,t),[n,e,o,t]);return jsx(a,{...p,children:jsx(tt,{children:jsx(y,{sx:{...Ya(i)&&{fontSize:"11px"}},children:a$1})})})}var Ne=lr;function cr({value:e,zone:o,hintZone:t,format:n,tableMode:i,...p$1}){let a=useMemo(()=>{if(!(!t||e==null||e===""))return b$2(o,t,e)?m(e,t):void 0},[e,o,t]);return jsxs(y,{sx:{display:"flex",gap:"8px"},children:[jsx(Ne,{value:e,zone:o,format:n,tableMode:i,...p$1}),a!==void 0&&jsx(p,{title:a,children:jsx("img",{src:H,width:14,alt:"timezone"})})]})}var mr=cr;export{ot as DateRangeCalendar,Se as ZonePicker,tr as ZonedDateCell,mr as ZonedDateHintViewer,Ne as ZonedDateViewer};
@@ -1 +1 @@
1
- import {h,j,a}from'../_chunks/chunk-MVJ6SYHK.js';export{u as UTC,E as asHostTimezone,A as asZoneRef,f as calendarDaysBetween,k as epochToInstant,n as formatInZone,l as instantToEpoch,d as isSameDayInZone,e as isSameYearInZone,C as isSameZone,p as isWholeDayRange,v as isZoneId,r as lastNDays,s as lastNMonths,y as localZone,j as offsetLabelAt,h as offsetMinutesAt,i as offsetsDifferAt,b as parseWallClock,m as plainFormats,g as toInstant,o as toInstantRange,c as toWallClock,q as toWholeDayRange,t as toWireRange,x as zoneByCountry,w as zoneById,D as zoneLabelAt,z as zoneRef,B as zoneRefByCountry}from'../_chunks/chunk-MVJ6SYHK.js';var k=(e,a$1,f=e[1])=>{let o=h(a$1,f);if(o!==void 0)return {from:e[0].getTime()+o*a,to:e[1].getTime()+o*a,offset:j(a$1,f)}};export{k as toWirePeriod};
1
+ import {a,c}from'../_chunks/chunk-BE2RKFQJ.js';export{t as UTC,D as asHostTimezone,z as asZoneRef,h as calendarDaysBetween,j as epochToInstant,m as formatInZone,k as instantToEpoch,f as isSameDayInZone,g as isSameYearInZone,B as isSameZone,o as isWholeDayRange,u as isZoneId,q as lastNDays,r as lastNMonths,x as localZone,c as offsetLabelAt,a as offsetMinutesAt,b as offsetsDifferAt,d as parseWallClock,l as plainFormats,i as toInstant,n as toInstantRange,e as toWallClock,p as toWholeDayRange,s as toWireRange,w as zoneByCountry,v as zoneById,C as zoneLabelAt,y as zoneRef,A as zoneRefByCountry}from'../_chunks/chunk-BE2RKFQJ.js';var k=(e,n,a$1=e[1])=>{let o=a(n,a$1);if(o!==void 0)return {from:e[0].getTime()+o*6e4,to:e[1].getTime()+o*6e4,offset:c(n,a$1)}};export{k as toWirePeriod};
@@ -0,0 +1,23 @@
1
+ import type { DateInput } from './types';
2
+ export declare const MINUTE_MS = 60000;
3
+ export declare const HOUR_MS = 3600000;
4
+ export declare const DAY_MS = 86400000;
5
+ /** The one thing that makes a string an instant rather than a wall clock. */
6
+ export declare const ABSOLUTE_SUFFIX: RegExp;
7
+ /** The wall-clock fields a zone renders an instant as — or a picker hands over. */
8
+ export interface WallClockFields {
9
+ year: number;
10
+ month: number;
11
+ day: number;
12
+ hour: number;
13
+ minute: number;
14
+ second: number;
15
+ ms: number;
16
+ }
17
+ /** Coerces any accepted input to a valid `Date`, or `undefined` — never an invalid one. */
18
+ export declare const toAbsolute: (value: DateInput) => Date | undefined;
19
+ /**
20
+ * Wall-clock fields as **UTC millis**, the absolute reading the offset arithmetic works from —
21
+ * `Date.UTC` maps years 0–99 onto 1900–1999, so the literal year is set back.
22
+ */
23
+ export declare const wallClockMillis: (fields: WallClockFields) => number;
@@ -1,22 +1,10 @@
1
1
  import dayjs from './dayjsSetup';
2
+ import { type WallClockFields } from './units';
2
3
  import type { DateInput } from './types';
3
4
  import type { ZoneId } from './zone';
4
- export declare const MINUTE_MS = 60000;
5
- export declare const DAY_MS = 86400000;
6
- /** The one thing that makes a string an instant rather than a wall clock. */
7
- export declare const ABSOLUTE_SUFFIX: RegExp;
5
+ export { ABSOLUTE_SUFFIX, DAY_MS, HOUR_MS, MINUTE_MS, toAbsolute, wallClockMillis, type WallClockFields } from './units';
8
6
  /** The module's single wall-clock grammar, canonical for both parsing and emitting. */
9
7
  export declare const WALL_CLOCK_FORMAT = "YYYY-MM-DD HH:mm:ss.SSS";
10
- /** The wall-clock fields a zone renders an instant as — or a picker hands over. */
11
- export interface WallClockFields {
12
- year: number;
13
- month: number;
14
- day: number;
15
- hour: number;
16
- minute: number;
17
- second: number;
18
- ms: number;
19
- }
20
8
  type Zoned = ReturnType<typeof dayjs>;
21
9
  /** The canonical padded text of a wall clock — the module's one wire spelling. */
22
10
  export declare const wallClockText: (fields: WallClockFields) => string;
@@ -34,21 +22,19 @@ export declare const parseWallClock: (value: string) => Date | undefined;
34
22
  * thing it cannot represent is a clock inside the *host's* own DST gap, so it rolls forward past it.
35
23
  */
36
24
  export declare const wallClockOf: (fields: WallClockFields) => Date;
37
- /** Coerces any accepted input to a valid `Date`, or `undefined` — never an invalid one. */
38
- export declare const toAbsolute: (value: DateInput) => Date | undefined;
39
25
  /**
40
26
  * An absolute moment read on a zone's clock, in the zone's own terms; `undefined` for an unknown
41
27
  * zone. Preferred over a carrier wherever a value only has to be formatted or compared — a carrier
42
28
  * is a host `Date` and so cannot hold a wall clock inside the *host's* own DST gap.
29
+ *
30
+ * Built as a UTC-mode dayjs shifted by `offsetMinutesAt`, so the clock comes from the module's own
31
+ * offset rather than the device's tz data — the same source the wire encoding reads.
43
32
  */
44
33
  export declare const toZoned: (value: DateInput, zone: ZoneId) => Zoned | undefined;
45
34
  /** An absolute moment as a wall-clock carrier: a `Date` whose local fields read the zone's clock. */
46
35
  export declare const toWallClock: (value: DateInput, zone: ZoneId) => Date | undefined;
47
- /** Carriers, not instants: a carrier's epoch is not the moment it reads, so this stays on its fields. */
48
- export declare const sameWallClockDay: (first: Date, last: Date) => boolean;
49
36
  /** On `zone`'s calendar, so a day spanning a DST change counts once. */
50
37
  export declare const isSameDayInZone: (first: DateInput, last: DateInput, zone: ZoneId) => boolean;
51
38
  export declare const isSameYearInZone: (first: DateInput, last: DateInput, zone: ZoneId) => boolean;
52
39
  /** Absolute whole days on `zone`'s calendar — order does not matter. */
53
40
  export declare const calendarDaysBetween: (first: DateInput, last: DateInput, zone: ZoneId) => number | undefined;
54
- export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.3.268",
4
+ "version": "0.3.270",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "main": "build/index.js",
@@ -1 +0,0 @@
1
- import y from'dayjs';import G from'dayjs/plugin/calendar.js';import X from'dayjs/plugin/customParseFormat.js';import J from'dayjs/plugin/timezone.js';import V from'dayjs/plugin/utc.js';import {getTimezone,getCountry}from'countries-and-timezones';y.extend(V);y.extend(J);y.extend(X);y.extend(G);var g=y;var I=6e4,q=864e5,C=/(?:Z|[+-]\d{2}:?\d{2})$/i,R="YYYY-MM-DD HH:mm:ss.SSS",U=e=>`${String(e.year).padStart(4,"0")}-${String(e.month).padStart(2,"0")}-${String(e.day).padStart(2,"0")} ${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}.${String(e.ms).padStart(3,"0")}`,Q=e=>({year:e.year(),month:e.month()+1,day:e.date(),hour:e.hour(),minute:e.minute(),second:e.second(),ms:e.millisecond()}),W=e=>Number.isNaN(e.getTime())?void 0:{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),ms:e.getMilliseconds()},v=[31,28,31,30,31,30,31,31,30,31,30,31],ee=e=>e%4===0&&(e%100!==0||e%400===0),te=68,ne=e=>e>=48&&e<=57,T=e=>e.length>0&&[...e].every(t=>t>="0"&&t<="9"),Y=e=>{let t=e.month===2&&ee(e.year)?29:v[e.month-1];return e.month<1||e.month>12||e.day<1||e.day>(t??0)||e.hour>23||e.minute>59||e.second>59?void 0:e},oe=e=>{let t=0;for(;t<e.length&&(ne(e.charCodeAt(t))||e[t]==="-"||e[t]==="/");)t++;return t},re=e=>{let t=e.split("-"),n=[4,2,2];return t.length===3&&t.every((o,r)=>o.length===n[r]&&T(o))?t.map(Number):void 0},ae=e=>{let t=e.split("/");if(t.length!==3||!t.every(T))return;let[n,o,r]=t;if(n.length>2||o.length>2||r.length<2||r.length>4)return;let a=Number(r);return [a<100?(a>te?1900:2e3)+a:a,Number(o),Number(n)]},se=e=>{let[t,n,o="0"]=e.split(":"),[r,a="0"]=o.split(".");if(!(t===void 0||n===void 0)&&!(a.length>3||![t,n,r,a].every(T)))return {hour:Number(t),minute:Number(n),second:Number(r),ms:Number(a.padEnd(3,"0"))}},Z=e=>{let t=e.trim(),n=t.slice(0,oe(t)),o=n.includes("/"),r=o?ae(n):re(n);if(!r)return;let[a,i,p]=r,u=t.slice(n.length).trim(),[k="",j=""]=(u[0]==="T"||u[0]==="t"?u.slice(1):u).trim().split(" ").filter(Boolean),f=j.toUpperCase();if(f&&(!o||f!=="AM"&&f!=="PM"))return;if(!k)return Y({year:a,month:i,day:p,hour:0,minute:0,second:0,ms:0});let l=se(k);if(!l||f&&(l.hour<1||l.hour>12))return;let K=f?l.hour%12+(f==="PM"?12:0):l.hour;return Y({year:a,month:i,day:p,...l,hour:K})},Ye=e=>{let t=Z(e);return t&&O(t)},O=e=>{let t=new Date(0);return t.setFullYear(e.year,e.month-1,e.day),t.setHours(e.hour,e.minute,e.second,e.ms),t},d=e=>{if(e==null||e==="")return;if(e instanceof Date)return Number.isNaN(e.getTime())?void 0:e;if(typeof e=="number"){if(!Number.isFinite(e))return;let o=new Date(e);return Number.isNaN(o.getTime())?void 0:o}let t=e.trim();if(!C.test(t))return;let n=new Date(t);return Number.isNaN(n.getTime())?void 0:n},h=(e,t)=>{let n=d(e);if(n)try{return g(n).tz(t)}catch{return}},s=(e,t)=>{let n=h(e,t);if(n)return O(Q(n))},b=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),ie=(e,t)=>e.getFullYear()===t.getFullYear(),we=(e,t,n)=>{let o=s(e,n),r=s(t,n);return !!o&&!!r&&b(o,r)},Re=(e,t,n)=>{let o=s(e,n),r=s(t,n);return !!o&&!!r&&ie(o,r)},w=e=>Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),Ue=(e,t,n)=>{let o=s(e,n),r=s(t,n);if(!(!o||!r))return Math.abs(w(r)-w(o))/q};var ue=(e,t)=>{try{let n=g.tz(U(e),R,t);return (e.year<100?n.year(e.year):n).toDate()}catch{return}},c=(e,t)=>{if(e==null||e==="")return;if(!(e instanceof Date)){if(typeof e=="number"){if(!Number.isFinite(e))return;let o=new Date(e);return Number.isNaN(o.getTime())?void 0:o}if(C.test(e.trim()))return d(e)}let n=typeof e=="string"?Z(e):W(e);if(n)return ue(n,t)};var _=(e,t=2)=>String(e).padStart(t,"0"),E=new Map,de=e=>{let t=E.get(e);if(t)return t;try{let n=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",era:"short",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"});return E.set(e,n),n}catch{return}},ce=e=>{let t=r=>Number(e.find(a=>a.type===r)?.value??0),n=t("year");return {year:e.find(r=>r.type==="era")?.value==="BC"?1-n:n,month:t("month"),day:t("day"),hour:t("hour"),minute:t("minute"),second:t("second"),ms:0}},me=e=>{let t=new Date(Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.ms));return t.setUTCFullYear(e.year),t.getTime()},fe=new Set(["Africa/Cairo","Egypt"]),le=2023,$=36e5,P=(e,t,n)=>{let o=new Date(Date.UTC(e,t+1,0));return o.getUTCDate()-(o.getUTCDay()-n+7)%7},pe=e=>{let t=new Date(e).getUTCFullYear();if(t<le)return;let n=Date.UTC(t,3,P(t,3,5))-2*$,o=Date.UTC(t,9,P(t,9,4)+1)-3*$;return e>=n&&e<o?180:120},m=(e,t=Date.now())=>{let n=d(t);if(!n)return;if(fe.has(e)){let a=pe(n.getTime());if(a!==void 0)return a}let o=de(e);if(!o)return;let r=Math.floor(n.getTime()/1e3)*1e3;return Math.round((me(ce(o.formatToParts(n)))-r)/I)},Pe=(e,t,n=Date.now())=>{let o=m(e,n),r=m(t,n);return o!==void 0&&r!==void 0&&o!==r},L=(e,t=Date.now())=>{let n=m(e,t);if(n===void 0)return "";let o=Math.abs(n);return `UTC${n<0?"-":"+"}${_(Math.floor(o/60))}:${_(o%60)}`};var je=(e,t)=>{if(!(typeof e!="number"||!Number.isFinite(e))&&!(Math.abs(e)>864e13))return c(new Date(e).toISOString().replace(/Z$/,""),t)},x=(e,t)=>{let n=d(e);if(!n)return;let o=m(t,n);if(o!==void 0)return n.getTime()+o*I};var ye=e=>{let t=", h:mma",n=e?"MMM DD":"MMM DD, YYYY";return {sameDay:`[Today]${t}`,nextDay:`[Tomorrow]${t}`,lastDay:`[Yesterday]${t}`,sameElse:`${n}${t}`,lastWeek:`${n}${t}`,nextWeek:`${n}${t}`}},Xe=e=>({sameDay:e,nextDay:e,lastDay:e,sameElse:e,lastWeek:e,nextWeek:e}),Je=(e,t,n)=>{let o=h(e,t),r=h(Date.now(),t);return !o||!r?"":o.calendar(r,n??ye(o.isSame(r,"year")))};var De=(e,t)=>{let n=c(e?.[0],t),o=c(e?.[1],t);return n&&o?[n,o]:void 0},B=(e,t)=>{let n=De(e,t),o=n&&s(n[0],t),r=n&&s(n[1],t);return o&&r?[o,r]:void 0},ge=e=>e.getHours()===0&&e.getMinutes()===0||e.getHours()===23&&e.getMinutes()===59,M=(e,t)=>c(new Date(e.getFullYear(),e.getMonth(),e.getDate()),t),F=(e,t)=>{let n=c(new Date(e.getFullYear(),e.getMonth(),e.getDate()+1),t);return n&&new Date(n.getTime()-1)},et=(e,t)=>{let n=B(e,t);return n?!b(n[0],n[1])||ge(n[1]):false},tt=(e,t)=>{let n=B(e,t);if(!n)return;let o=M(n[0],t),r=F(n[1],t);return o&&r?[o,r]:void 0},nt=(e,t)=>{let n=s(Date.now(),t);if(!n)return;let o=Number.isFinite(e)&&e>=1?Math.floor(e):1,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()-(o-1)),a=F(n,t),i=M(r,t);return i&&a?[i,a]:void 0},ot=(e,t)=>{let n=s(Date.now(),t);if(!n)return;let o=Number.isFinite(e)&&e>=1?Math.floor(e):1,r=new Date(n.getFullYear(),n.getMonth()-o,1),a=new Date(r.getFullYear(),r.getMonth()+1,0).getDate(),i=new Date(r.getFullYear(),r.getMonth(),Math.min(n.getDate(),a)),p=M(i,t),u=F(n,t);return p&&u?[p,u]:void 0},rt=(e,t)=>({from:x(e[0],t),to:x(e[1],t)});var Ce=new Intl.DisplayNames(["en"],{type:"region"}),A=e=>{try{return Ce.of(e)}catch{return}},Te={US:"America/New_York",CA:"America/Toronto",BR:"America/Sao_Paulo",MX:"America/Mexico_City",AR:"America/Argentina/Buenos_Aires",CL:"America/Santiago",AU:"Australia/Sydney",NZ:"Pacific/Auckland",RU:"Europe/Moscow",UA:"Europe/Kyiv",ES:"Europe/Madrid",PT:"Europe/Lisbon",ID:"Asia/Jakarta",KZ:"Asia/Almaty",UZ:"Asia/Tashkent",MN:"Asia/Ulaanbaatar"},D="UTC",z={id:D,countryCode:D,countryName:D},N=e=>{if(!e)return false;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return false}},H=e=>{if(!e)return;if(e===D)return z;let t=getTimezone(e);if(t){let[n]=t.countries;return {id:e,countryCode:n??"",countryName:A(n)??n??e}}return N(e)?{id:e,countryCode:"",countryName:e}:void 0},Ze=e=>{let t=e?.trim().toUpperCase();if(!t)return;if(t===D)return z;let n=getCountry(t),o=Te[t]??n?.timezones[0];if(o)return {id:o,countryCode:t,countryName:A(t)??n?.name??t}},ut=()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||void 0}catch{return}},S=(e,t)=>({zone:e,countryCode:t?.trim().toUpperCase()||H(e)?.countryCode||""}),dt=e=>{if(e){if(typeof e=="string")return N(e)?S(e):void 0;if(!(!e.timezone||!N(e.timezone)))return S(e.timezone,e.countryCode)}},ct=e=>{let t=Ze(e);return t?S(t.id,t.countryCode):void 0},mt=(e,t)=>!!e&&!!t&&e.zone===t.zone&&e.countryCode===t.countryCode,be=(e,t=Date.now())=>{let n=L(e.zone,t).replace("UTC","GMT");return n?`(${n}) ${A(e.countryCode)??H(e.zone)?.countryName??e.zone}`:""},ft=e=>({timezone:e.zone,countryCode:e.countryCode,label:be(e),offset:(m(e.zone)??0)/60});export{dt as A,ct as B,mt as C,be as D,ft as E,I as a,Ye as b,s as c,we as d,Re as e,Ue as f,c as g,m as h,Pe as i,L as j,je as k,x as l,Xe as m,Je as n,De as o,et as p,tt as q,nt as r,ot as s,rt as t,D as u,N as v,H as w,Ze as x,ut as y,S as z};