@codezee/sixtify-brahma 0.2.370 → 0.2.371

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.
@@ -20,5 +20,5 @@ import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import o from"@m
20
20
  opacity: 1;
21
21
  transform: translateY(0) scale(1);
22
22
  }
23
- `,AA=v(M)((({theme:e})=>{const{iron:t,butterflyBlue:i}=e.palette.app.color,{white:o}=e.palette.common;return{display:"inline-flex",alignItems:"center",gap:"2px",padding:"4px",borderRadius:"12px",background:o,border:`1px solid ${y(i[900],.14)}`,boxShadow:`\n 0 12px 32px ${y(t[900],.28)},\n 0 4px 12px ${y(t[900],.18)},\n 0 1px 3px ${y(t[900],.12)}\n `,backdropFilter:"blur(10px)",animation:`${CA} 220ms cubic-bezier(0.22, 1, 0.36, 1)`,position:"relative","&::before":{content:'""',position:"absolute",top:-5,left:"50%",width:10,height:10,background:o,border:`1px solid ${y(i[900],.14)}`,borderBottom:"none",borderRight:"none",transform:"translateX(-50%) rotate(45deg)",zIndex:0}}})),cA=v(r,{shouldForwardProp:e=>"logoSize"!==e&&"delayMs"!==e})((({theme:e,logoSize:t="large",delayMs:i=0})=>{const{butterflyBlue:o,iron:r}=e.palette.app.color,{button:n,icon:l,padding:a}=((e="large")=>"small"===e?{button:26,icon:14,padding:"4px"}:"medium"===e?{button:30,icon:16,padding:"5px"}:{button:34,icon:18,padding:"6px"})(t);return{width:n,height:n,padding:a,color:r[800],zIndex:1,animation:`${dA} 240ms cubic-bezier(0.22, 1, 0.36, 1) both`,animationDelay:`${i}ms`,transition:"background-color 0.18s ease, color 0.18s ease, transform 0.18s ease","& .MuiSvgIcon-root":{fontSize:l},"&:hover":{backgroundColor:y(o[900],.1),color:o[900],transform:"translateY(-1px)"},"&:focus-visible":{outline:`2px solid ${o[900]}`,outlineOffset:1}}})),hA=v(M,{shouldForwardProp:e=>"logoSize"!==e})((({logoSize:e="large"})=>({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"small"===e?"2px":"6px",padding:"small"===e?"2px":"4px"})));function pA({open:t,anchorEl:i,size:o,actions:r,onClose:n,onMouseEnter:l,onMouseLeave:a}){const s=J(),{slate:C}=s.palette.app.color;return e(ce,{open:t,anchorEl:i,onClose:n,disableRestoreFocus:!0,disableScrollLock:!0,marginThreshold:8,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},slotProps:{paper:{elevation:0,onMouseEnter:l,onMouseLeave:a,sx:{mt:1,overflow:"visible",background:"transparent",boxShadow:"none"}}},sx:{pointerEvents:"none","& .MuiPaper-root":{pointerEvents:"auto"}},children:e(AA,{role:"toolbar","aria-label":"Logo actions",children:r.map((({key:t,label:i,icon:r,onClick:n},l)=>e(xl,{toolTipLabel:i,placement:"top",children:e(cA,{logoSize:o,delayMs:40*l,"aria-label":i,onClick:e=>{e.stopPropagation(),n(e)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),n(e))},sx:{color:C[900]},children:r})},t)))})})}const uA=v(M)({display:"flex",flexDirection:"column",gap:"12px"}),gA=v(M)({display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:"10px"}),mA=v(M)((({theme:e})=>{const{mirage:t,butterflyBlue:i,lightBlue:o}=e.palette.app.color;return{position:"relative",width:"100%",height:280,borderRadius:"8px",overflow:"hidden",backgroundColor:t[900],border:`1px solid ${i[700]}`,[e.breakpoints.up("sm")]:{height:360},"& .reactEasyCrop_CropArea":{border:`2px solid ${i[900]} !important`,color:y(t[900],.55)},"& .reactEasyCrop_CropAreaGrid::before, & .reactEasyCrop_CropAreaGrid::after":{borderColor:y(o[50],.35)}}})),fA=v(M)({display:"flex",alignItems:"center",gap:"8px"}),kA=v(r)((({theme:e})=>{const{butterflyBlue:t,iron:i}=e.palette.app.color;return{color:t[900],"&.Mui-disabled":{color:i[700]}}})),EA=v(M)((({theme:e})=>{const{butterflyBlue:t,lightBlue:i}=e.palette.app.color;return{width:40,height:40,borderRadius:"6px",overflow:"hidden",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:i[50],border:`1px solid ${t[700]}`}})),IA=v(M)((({theme:e})=>{const{mirage:t,lightBlue:i}=e.palette.app.color;return{position:"absolute",inset:0,zIndex:5,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"10px",backgroundColor:y(t[900],.7),color:i[50]}}));function wA({imageSrc:t,aspectRatio:i,rotation:o,zoom:r,onZoomChange:n,onCropComplete:l}){const[a,s]=h({x:0,y:0});u((()=>{s({x:0,y:0})}),[i]);const C=g(((e,t)=>{l(t)}),[l]);return e(gi,{image:t,crop:a,zoom:r,rotation:o,aspect:qd[i],onCropChange:s,onZoomChange:n,onCropComplete:C,objectFit:"contain",showGrid:!0,style:{containerStyle:{width:"100%",height:"100%"}}})}function SA({open:i,imageSrc:o,originalFile:r,aspectRatios:n=Xd,enabledVariants:l,initialAspectRatio:s="1:1",onClose:C,onApply:d}){const A=J(),{iron:c,butterflyBlue:p}=A.palette.app.color,[m,f]=h(s),[k,E]=h(1),[I,w]=h(0),[S,B]=h(null),[x,Q]=h(!1),[b,v]=h(null),R=g((()=>{E(1),w(0)}),[]);u((()=>{i&&(f(s),R(),B(null),v((e=>(tA(e),null))))}),[i,s,R]),u((()=>{const e=new AbortController;return(async()=>{if(S&&o)try{const t=await nA(o,S,I,void 0,void 0,"image/png");if(e.signal.aborted)return;const i=URL.createObjectURL(t);if(e.signal.aborted)return void tA(i);v((e=>(tA(e),i)))}catch{if(e.signal.aborted)return;v((e=>(tA(e),null)))}})(),()=>{e.abort()}}),[S,o,I]);return e(gC,{open:i,onClose:C,title:"Crop Logo",maxWidth:"md",actions:t(a,{direction:"row",gap:"10px",justifyContent:"flex-end",children:[e(Ur,{actionType:"cancel",variant:"outlined",onClick:C,disableKeyboardShortcut:x,disabled:x}),e(Ur,{onClick:()=>{(async()=>{if(S){Q(!0);try{const e=await sA({imageSrc:o,original:r,pixelCrop:S,rotation:I,aspectRatio:m,enabledVariants:l});d({...e,aspectRatio:m}),C()}catch{Ns.error({title:"Failed to process cropped image. Please try again."})}finally{Q(!1)}}else Ns.error({title:"Adjust the crop area before saving."})})()},loading:x,label:"Apply"})]}),children:t(uA,{children:[t(gA,{children:[e(Lr,{renderButtons:n.map((e=>({icon:null,value:e,label:e,selected:m===e,size:"small",onClick:e=>{const t=n.find((t=>t===e));t&&f(t)}}))),sx:{textTransform:"none",fontWeight:500,boxShadow:"none","&.MuiButton-text":{color:c[800]}}}),t(a,{direction:"row",alignItems:"center",gap:"2px",children:[e(xl,{toolTipLabel:"Drag to reposition. Scroll or use zoom to refine.",children:e(kA,{size:"small","aria-label":"Crop tips",children:e(Vt,{fontSize:"small"})})}),e(xl,{toolTipLabel:"Rotate left",children:e(kA,{size:"small",onClick:()=>w((e=>e-90)),"aria-label":"Rotate left",disabled:x,children:e(Ai,{fontSize:"small"})})}),e(xl,{toolTipLabel:"Rotate right",children:e(kA,{size:"small",onClick:()=>w((e=>e+90)),"aria-label":"Rotate right",disabled:x,children:e(ci,{fontSize:"small"})})}),e(xl,{toolTipLabel:"Reset",children:e(kA,{size:"small",onClick:R,"aria-label":"Reset crop",disabled:x,children:e(di,{fontSize:"small"})})})]})]}),t(M,{sx:{position:"relative"},children:[e(mA,{children:e(wA,{imageSrc:o,aspectRatio:m,rotation:I,zoom:k,onZoomChange:E,onCropComplete:B})}),x&&t(IA,{children:[e(_,{size:28,sx:{color:p[900]}}),e(q,{variant:"body2",children:"Processing…"})]})]}),t(fA,{children:[e(xl,{toolTipLabel:"Zoom out",children:e(kA,{size:"small",onClick:()=>{E((e=>Math.max(1,Number((e-.1).toFixed(2)))))},"aria-label":"Zoom out",disabled:k<=1||x,children:e(pi,{fontSize:"small"})})}),e(ui,{value:k,min:1,max:3,step:.05,"aria-label":"Zoom",onChange:(e,t)=>{"number"==typeof t&&E(t)},size:"small",disabled:x,sx:{flex:1,color:p[900],"& .MuiSlider-rail":{backgroundColor:c[700]}}}),e(xl,{toolTipLabel:"Zoom in",children:e(kA,{size:"small",onClick:()=>{E((e=>Math.min(3,Number((e+.1).toFixed(2)))))},"aria-label":"Zoom in",disabled:k>=3||x,children:e(hi,{fontSize:"small"})})}),t(q,{variant:"caption",color:c[800],sx:{minWidth:36,textAlign:"right"},children:[Math.round(100*k),"%"]}),b&&e(EA,{children:e(M,{component:"img",src:b,alt:"Crop preview",sx:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}})})]})]})})}const BA="120px",xA="120px",QA=(e,t,i)=>i?"none":t?`1px dashed ${e}`:`1px solid ${e}`,MA=v(M,{shouldForwardProp:e=>"isDragging"!==e&&"hasImage"!==e&&"disabled"!==e&&"frameWidth"!==e&&"frameHeight"!==e&&"frameBorderRadius"!==e&&"isViewMode"!==e&&"hideBorder"!==e})((e=>(({theme:e,isDragging:t,hasImage:i,disabled:o,frameWidth:r,frameHeight:n,frameBorderRadius:l,isViewMode:a,hideBorder:s})=>{const{butterflyBlue:C,iron:d}=e.palette.app.color,A=t||i?C[900]:e.palette.grey[400],c=r??xA,h=a&&i||!a&&!o,p=!o&&!a&&!s;return{width:c,height:n??BA,minWidth:c,maxWidth:c,position:"relative",overflow:"hidden",borderRadius:l??"10px",border:QA(A,t,s),backgroundColor:t?y(C[900],.05):i?e.palette.common.white:d[50],cursor:h?"pointer":"default",opacity:o&&!a?.6:1,transition:"all 0.2s ease-in-out",outline:"none",boxSizing:"border-box","&:focus-visible":{outline:h?`2px solid ${C[900]}`:"none",outlineOffset:2},...p&&{"&:hover":{border:QA(C[900],t)}}}})(e))),bA=v(M)((({theme:e})=>({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.palette.common.white}))),JA=v(M,{shouldForwardProp:e=>"frameBorderRadius"!==e})((({theme:e,frameBorderRadius:t})=>{const{mirage:i}=e.palette.app.color;return{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",backgroundColor:y(i[600],.2),backdropFilter:"blur(3px)",borderRadius:t??"10px",zIndex:2}})),vA=v(M,{shouldForwardProp:e=>"frameBorderRadius"!==e})((({theme:e,frameBorderRadius:t})=>{const{mirage:i}=e.palette.app.color;return{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:y(i[600],.35),backdropFilter:"blur(2px)",borderRadius:t??"10px",zIndex:3}}));function RA({open:i,size:o,disabled:n,borderRadius:l,onEdit:a,onDelete:s,onHoverChange:C}){const d=J(),{lightBlue:A}=d.palette.app.color,c="small"===o?16:20,h="small"===o?"small":"medium";return e(ai,{in:i,timeout:{enter:300,exit:1e3},children:t(JA,{frameBorderRadius:l,onFocus:()=>C(!0),onBlur:e=>{eA(e.currentTarget,e.relatedTarget)&&C(!1)},children:[e(r,{tabIndex:0,disabled:n,"aria-label":"Replace logo",size:h,onClick:e=>{e.stopPropagation(),a()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),a())},children:e(ni,{sx:{color:A[50],fontSize:c}})}),e(r,{tabIndex:0,disabled:n,"aria-label":"Remove logo",size:h,onClick:s,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||s(e)},children:e(ri,{sx:{color:A[50],fontSize:c}})})]})})}function LA({size:i,disabled:o=!1,enableCaptureImage:r=!1,onAttach:n,onCapture:l}){const a=J(),{iron:s}=a.palette.app.color,C=e=>t=>{t.stopPropagation(),t.preventDefault(),o||e()};return t(hA,{logoSize:i,children:[r&&e(xl,{toolTipLabel:"Capture photo",placement:"top",children:e(cA,{logoSize:i,delayMs:0,disabled:o,"aria-label":"Capture photo",onClick:C((()=>l?.())),children:e(oi,{sx:{color:s[900]}})})}),e(xl,{toolTipLabel:"Upload logo",placement:"top",children:e(cA,{logoSize:i,delayMs:r?40:0,disabled:o,"aria-label":"Upload logo",onClick:C(n),children:e(fi,{sx:{color:s[900]}})})})]})}const yA={small:{base:60,rectShort:36,rectMaxLong:120,borderRadius:"8px",iconFontSize:20},medium:{base:80,rectShort:48,rectMaxLong:160,borderRadius:"8px",iconFontSize:24},large:{base:120,rectShort:72,rectMaxLong:240,borderRadius:"10px",iconFontSize:28}},FA=(e,t="square")=>{const{base:i,borderRadius:o}=yA[e];return{width:i,height:i,borderRadius:"circle"===t?"50%":o}},UA=e=>{const{base:t,rectMaxLong:i}=yA[e];return{maxPreviewWidth:i,maxPreviewHeight:t}},DA=(e,t)=>{if(!e||!t)return"square";const i=e/t;return Math.abs(i-1)<=.12?"square":i>1?"rectangle":"portrait"},ZA=(e,t="large",i,o)=>{const{base:r,rectShort:n,rectMaxLong:l,borderRadius:a}=yA[t];if("circle"===e)return{width:r,height:r,borderRadius:"50%"};if("square"===e)return{width:r,height:r,borderRadius:a};if("rectangle"===e)return{width:l,height:n,borderRadius:a};if(!i||!o)return{width:r,height:r,borderRadius:a};const s=DA(i,o);if("square"===s)return{width:r,height:r,borderRadius:a};const C=i/o;if("rectangle"===s){const e=n;return{width:Math.min(l,Math.round(e*C)),height:e,borderRadius:a}}const d=n;return{width:d,height:Math.min(l,Math.round(d/C)),borderRadius:a}},HA=e=>new Promise(((t,i)=>{const o=new Image;o.onload=()=>{const{naturalWidth:e,naturalHeight:i}=o;t({width:e,height:i})},o.onerror=()=>i(new Error("Failed to load image")),o.crossOrigin="anonymous",o.src=e}));function KA({size:t,disabled:i,enableCaptureImage:o,onAttach:r,onCapture:n}){const l=J(),{iron:s}=l.palette.app.color,{iconFontSize:C}=yA[t];return o?e(LA,{size:t,disabled:i,enableCaptureImage:o,onAttach:r,onCapture:n}):e(a,{justifyContent:"center",alignItems:"center",sx:{height:"100%"},children:e(mi,{sx:{color:s[700],fontSize:C}})})}function GA({open:i,imageSrc:o,title:n="Logo",onClose:l}){const a=J(),{iron:s}=a.palette.app.color;return e(Ei,{open:i,onClose:l,closeAfterTransition:!0,slots:{backdrop:ki},slotProps:{backdrop:{timeout:200,sx:{backgroundColor:y(a.palette.common.white,.45),backdropFilter:"blur(8px) saturate(1.7)",WebkitBackdropFilter:"blur(8px) saturate(9)"}}},"aria-label":n,children:e(ai,{in:i,children:t(M,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",p:{xs:2,sm:4},outline:"none",overflow:"hidden"},onClick:l,children:[e(r,{"aria-label":"Close",onClick:l,size:"small",sx:{position:"absolute",top:{xs:12,sm:16},right:{xs:12,sm:16},zIndex:2,color:s[400],bgcolor:"transparent",boxShadow:"none","&:hover":{bgcolor:"transparent",opacity:.7}},children:e(Ct,{fontSize:"small"})}),e(M,{sx:{position:"relative",maxWidth:"min(920px, 100%)",maxHeight:"100%",lineHeight:0},onClick:e=>e.stopPropagation(),children:e(M,{component:"img",src:o,alt:n,sx:{display:"block",maxWidth:"100%",maxHeight:"min(82vh, 680px)",width:"auto",height:"auto",objectFit:"contain",borderRadius:"10px",bgcolor:a.palette.common.white,boxShadow:`0 12px 40px ${y(s[400],.18)}`}})})]})})})}function YA({previewUrl:e,errorImage:t="",onError:i}){const[o,r]=h(!1),[n,l]=h(!1);u((()=>{r(!1),l(!1)}),[e,t]);const a=o&&!!t&&!n;return{displayUrl:a?t:e,hasValidImage:!!e&&(!o||a),handleImageError:()=>{if(!o)return r(!0),void i?.();l(!0)}}}function VA({previewUrl:o,errorImage:n="",label:l,required:s,hideBorder:C,variant:d,size:A,frame:c,maxPreviewWidth:p,maxPreviewHeight:u,onView:g,onError:m,enableFullImageView:f=!0,containerProps:k}){const E=J(),{iron:I,lightBlue:w}=E.palette.app.color,{iconFontSize:S}=yA[A],[B,x]=h(!1),[Q,b]=h(!1),{displayUrl:v,hasValidImage:R,handleImageError:L}=YA({previewUrl:o,errorImage:n,onError:m}),y="auto"===d,F="small"===A?16:20,U=y?{width:"fit-content",height:"fit-content",minWidth:"unset",maxWidth:"unset"}:void 0,{width:D,height:Z,borderRadius:H}=c,K=y?{display:"block",maxWidth:p,maxHeight:u,width:"auto",height:"auto",borderRadius:H}:{display:"block",width:"100%",height:"100%",objectFit:"cover",objectPosition:"center",borderRadius:H},G=e=>{e?.stopPropagation(),R&&f&&(g?g():b(!0))},Y=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),G())},V=e=>{eA(e.currentTarget,e.relatedTarget)&&x(!1)};if(!R)return t(a,{direction:"row",alignItems:"center",gap:"15px",...k,children:[e(MA,{hasImage:!1,disabled:!0,isViewMode:!0,frameWidth:D,frameHeight:Z,frameBorderRadius:H,role:"img","aria-label":l||"Logo",children:e(M,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",sx:{height:"100%"},children:e(mi,{sx:{color:I[700],fontSize:S}})})}),l&&e(Oe,{required:s,children:l})]});const T=f?{tabIndex:0,role:"button","aria-label":`View ${l||"logo"}`,onClick:()=>G(),onKeyDown:Y,onMouseEnter:()=>x(!0),onFocus:()=>x(!0),onBlur:V,onMouseLeave:()=>x(!1)}:{};return t(i,{children:[t(a,{direction:"row",alignItems:"center",gap:"15px",...k,children:[t(MA,{hasImage:!0,isViewMode:!0,hideBorder:C,frameWidth:y?"fit-content":D,frameHeight:y?"fit-content":Z,frameBorderRadius:H,sx:U,...T,children:[f&&e(ai,{in:B,timeout:{enter:300,exit:1e3},children:e(JA,{frameBorderRadius:H,onFocus:()=>x(!0),onBlur:V,children:e(r,{tabIndex:0,"aria-label":"View logo",size:"small"===A?"small":"medium",onClick:G,onKeyDown:Y,children:e(Nt,{sx:{color:w[50],fontSize:F}})})})}),e(bA,{sx:{borderRadius:H,...y?{width:"fit-content",height:"fit-content"}:void 0},children:e(M,{component:"img",src:v,alt:"Logo",onError:L,sx:K})})]}),l&&e(Oe,{required:s,children:l})]}),e(GA,{open:Q,imageSrc:v,title:l||"View Logo",onClose:()=>b(!1)})]})}const TA=({size:i="large"})=>{const{base:o,borderRadius:r}=yA[i],n="small"===i;return t(a,{direction:"row",alignItems:"center",gap:n?"10px":"15px",children:[e(we,{variant:"rectangular",sx:{width:o,height:o,minWidth:o,maxWidth:o,borderRadius:r,transform:"scale(1)"}}),t(a,{gap:"5px",children:[e(we,{width:n?90:120,height:n?18:24,sx:{transform:"scale(1)"}}),e(we,{width:n?100:140,height:n?12:16,sx:{transform:"scale(1)"}})]})]})},jA=(e,t,i)=>(t&&Ns.error({title:e}),{valid:!1,error:e,...i}),WA=async(e,t,i,o)=>{try{const{width:r,height:n}=await(e=>new Promise(((t,i)=>{const o=URL.createObjectURL(e),r=new Image;r.onload=()=>{const{naturalWidth:e,naturalHeight:i}=r;URL.revokeObjectURL(o),t({width:e,height:i})},r.onerror=()=>{URL.revokeObjectURL(o),i(new Error("Failed to load image"))},r.src=o})))(e),l=Math.min(r,n);if(l<t)return jA(`Image resolution too low. Minimum is ${t}×${t} px.`,o,{width:r,height:n});if(l<i){const e=`Image quality may be low (${r}×${n} px). Consider using a higher-resolution logo.`;return o&&Ns.warning({title:e}),{valid:!0,warning:e,width:r,height:n}}return{valid:!0,width:r,height:n}}catch{return jA("Unable to read image. Please try another file.",o)}};function qA({onChange:o,onDelete:r,onView:n,onError:l,errorImage:s="",defaultValue:C="",value:d,label:A="Logo",subTitle:m="PNG, JPEG under 5 MB",mode:f="edit",variant:k="square",size:E="large",maxPreviewWidth:I,maxPreviewHeight:w,hideBorder:S=!1,maxSizeMB:B=5,minResolution:x=256,qualityWarnResolution:Q=512,aspectRatios:M=Xd,enabledVariants:b=Nd,isUploading:v=!1,loading:R=!1,disabled:L=!1,required:y=!1,enableCaptureImage:F=!1,acceptedTypes:U=Zd,enableFullImageView:D=!0,containerProps:Z}){const H=J(),{iron:K,butterflyBlue:G}=H.palette.app.color,Y="view"===f,V=UA(E),T=I??V.maxPreviewWidth,j=w??V.maxPreviewHeight,W="circle"===k?"circle":"square",z=c((()=>FA(E,W)),[E,W]),P=p(null),O=p(null),N=p(null),X=p(null),[$,ee]=h(!1),[te,ie]=h(!1),[oe,re]=h(d??C),[ne,le]=h(null),[ae,se]=h(!1),[Ce,de]=h(!1),[Ae,ce]=h(null),[he,pe]=h(null),[ue,ge]=h(!1),[me,fe]=h(!1),[ke,Ee]=h((()=>ZA(k,E))),{inputRef:Ie,setInputRef:we,maintainFocusAfterClose:Se}=or({isOpen:ue||Ce});u((()=>{void 0!==d&&re(d)}),[d]),u((()=>{if(!Y)return void Ee(z);if("auto"!==k)return void Ee(ZA(k,E));if(!oe)return void Ee(ZA("square",E));let e=!1;return HA(oe).then((({width:t,height:i})=>{e||Ee(ZA("auto",E,t,i))})).catch((()=>{e||Ee(ZA("square",E))})),()=>{e=!0}}),[Y,k,oe,E,z]);const Be=Y?ke:z,{displayUrl:xe,hasValidImage:Qe,handleImageError:Me}=YA({previewUrl:oe,errorImage:s,onError:l}),be=g((()=>{tA(O.current),O.current=null}),[]);u((()=>()=>{be(),tA(N.current),N.current=null,X.current&&clearTimeout(X.current)}),[be]);const Je=()=>{L||Ie.current?.click()},ve=()=>{!L&&F&&(fe(!1),ge(!0))},Re=()=>{X.current&&(clearTimeout(X.current),X.current=null)},Le=()=>{!L&&Qe&&F&&(Re(),fe(!0))},ye=()=>{Re(),X.current=setTimeout((()=>{fe(!1)}),160)},Fe=e=>{F?e?Le():ye():ee(e)},Ue=async e=>{if(o){le(null),se(!0),fe(!1);try{const t=await(async(e,{maxSizeMB:t=5,minResolution:i=256,qualityWarnResolution:o=512,acceptedTypes:r=Zd,showToasts:n=!0}={})=>Yd(e,r)?zo(e,t)?$d(e)?{valid:!0}:WA(e,i,o,n):jA(`File too large. Maximum size is ${t} MB.`,n):jA("Unsupported file type. Use PNG, JPG, JPEG, SVG, or WEBP.",n))(e,{maxSizeMB:B,minResolution:x,qualityWarnResolution:Q,acceptedTypes:U});if(!t.valid)return void le(t.error??"Invalid file");if($d(e)){const t=await(async(e,t)=>{const i=URL.createObjectURL(e),o={};for(const i of t)o[i]=e;return{cropped:e,variants:o,previewUrl:i}})(e,b),{cropped:i,variants:r,previewUrl:n}=t;return be(),O.current=n,re(n),void o({original:e,cropped:i,variants:r,aspectRatio:"1:1",previewUrl:n})}const i=URL.createObjectURL(e);pe(e),ce((e=>(tA(e),N.current=i,i))),de(!0)}finally{se(!1)}}},De=e=>{const[t]=Array.from(e);t&&Ue(t)},Ze=e=>{e?.stopPropagation(),e?.preventDefault(),be(),re(""),le(null),pe(null),fe(!1),ce((e=>(tA(e),N.current=null,null))),r?.()};if(R)return e(TA,{size:E});if(Y)return e(VA,{previewUrl:oe,errorImage:s,label:A,required:y,hideBorder:S,variant:k,size:E,frame:Be,maxPreviewWidth:T,maxPreviewHeight:j,onView:n,onError:l,enableFullImageView:D,containerProps:Z});const{width:He,height:Ke,borderRadius:Ge}=Be,Ye="50%"===Ge?"50%":"8px",Ve=(({enableCaptureImage:t,onEdit:i,onCapture:o,onDelete:r})=>{const n=[{key:"edit",label:"Replace logo",icon:e(ni,{}),onClick:e=>{e.stopPropagation(),i()}}];return t&&n.push({key:"capture",label:"Capture photo",icon:e(oi,{}),onClick:e=>{e.stopPropagation(),o()}}),n.push({key:"delete",label:"Remove logo",icon:e(ri,{}),onClick:e=>{r(e)}}),n})({enableCaptureImage:F,onEdit:Je,onCapture:ve,onDelete:Ze});return t(i,{children:[t(a,{direction:"row",alignItems:"center",gap:"15px",...Z,children:[t(MA,{ref:P,isDragging:te,hasImage:Qe,disabled:L,frameWidth:He,frameHeight:Ke,frameBorderRadius:Ge,tabIndex:L?-1:0,role:"button","aria-disabled":L,"aria-label":A||"Logo",onClick:()=>!L&&!Qe&&!F&&Je(),onKeyDown:e=>{L||Qe||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Je())},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),!L&&(e=>e.dataTransfer.types.includes("Files"))(e)&&ie(!0)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),L||(e.dataTransfer.dropEffect="copy")},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),eA(e.currentTarget,e.relatedTarget)&&ie(!1)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),ie(!1),!L&&e.dataTransfer.files.length>0&&De(e.dataTransfer.files)},onMouseEnter:()=>!L&&Fe(!0),onFocus:()=>!L&&Fe(!0),onMouseLeave:()=>Fe(!1),onBlur:e=>{eA(e.currentTarget,e.relatedTarget)&&Fe(!1)},children:[e("input",{ref:we,type:"file",accept:Hd,onChange:e=>{!L&&e.target.files&&(De(e.target.files),e.target.value="")},disabled:L,style:{display:"none"},"aria-hidden":!0}),!F&&e(RA,{open:$&&!!oe&&!L,size:E,disabled:L,borderRadius:Ge,onEdit:Je,onDelete:Ze,onHoverChange:ee}),(v||ae)&&e(vA,{frameBorderRadius:Ge,children:e(_,{size:"small"===E?16:22,sx:{color:K[600]}})}),te&&e(vA,{frameBorderRadius:Ge,children:e(q,{variant:"caption",color:G[900],children:"Drop"})}),Qe?e(bA,{sx:{borderRadius:Ge},children:e("img",{src:xe,alt:"Logo",onError:Me,style:{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",display:"block",borderRadius:Ye}})}):e(KA,{size:E,disabled:L,enableCaptureImage:F,onAttach:Je,onCapture:ve})]}),t(a,{gap:"5px",justifyContent:"center",children:[A&&e(Oe,{disabled:L,required:y,children:A}),m&&e(q,{noWrap:!0,variant:"caption",color:K[800],children:m}),ne&&e(q,{variant:"caption",color:"error",children:ne})]})]}),F&&Qe&&!L&&e(pA,{open:me,anchorEl:P.current,size:E,actions:Ve,onClose:()=>fe(!1),onMouseEnter:Le,onMouseLeave:ye}),Ce&&Ae&&he&&o&&e(SA,{open:Ce,imageSrc:Ae,originalFile:he,aspectRatios:M,enabledVariants:b,onClose:()=>{de(!1),Se()},onApply:({cropped:e,variants:t,previewUrl:i,aspectRatio:r})=>{be(),O.current=i,re(i),le(null),de(!1),o({original:he,cropped:e,variants:t,aspectRatio:r,previewUrl:i}),Ns.success({title:"Logo cropped successfully"}),Se()}}),F&&ue&&e(Ld,{open:ue,isUploading:v||ae,onChange:De,onClose:()=>{ge(!1),Se()}})]})}const zA=v(le,{shouldForwardProp:e=>"selected"!==e})((({theme:e,selected:t})=>({background:e.palette.app.color.iron[600],color:e.palette.app.color.mirage[900],borderRadius:"4px",border:`1px solid ${e.palette.app.color.butterflyBlue[300]}`,...t?{background:e.palette.app.color.deepAqua[500],color:e.palette.app.color.mirage[900],borderLeft:`6px solid ${e.palette.app.color.butterflyBlue[900]}`}:{}})));function PA({label:i,selected:o,actions:r,companyName:n,href:l,target:s,...d}){const A=J(),{iron:c}=A.palette.app.color,g=p(null),[m,f]=h(!1);u((()=>{const e=g.current;if(!e)return;const t=()=>f(e.scrollWidth>e.clientWidth);return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[i,n]);return e(zA,{selected:o,alignItems:"flex-start",...l?{component:C,href:l,target:s,prefetch:!1}:{},...d,children:t(a,{width:"100%",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[t(a,{gap:"5px",direction:"column",flex:1,display:"grid",children:[e(xl,{toolTipLabel:i,checkOverflow:!m,children:e(q,{variant:"body2",fontWeight:500,ref:g,sx:{width:"auto",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:i})}),e(q,{variant:"caption",color:c[800],children:n})]}),r]})})}const OA=new Set(["+","-","e","E","*","/","=","%","^"]),NA=/[+\-eE*/=%^]/,XA={string:"Only alphabetic characters are allowed.","string-number":"Only letters and numbers are allowed.","string-number-special":"Special characters are allowed.","string-special":"Only letters, accents, apostrophes, and hyphens are allowed.","string-special-all":"Only letters and Special characters are allowed",custom:"Please enter a valid input"};function _A({control:i,name:o,defaultValue:r,label:n="",rules:l,type:s,required:C,disabled:d,readOnly:A=!1,loading:c=!1,placeholder:h="",isCapitalize:p=!1,isTrimStartDisabled:u=!1,rows:g,characterType:m="string-number-special",letterCase:f="mixed",setError:k,containerProps:E,styling:I="custom",infoMessage:w,regexExpression:S={message:null,regex:/^[\s\S]*$/},navigationKey:B,customOnChange:x,size:Q,InputProps:M,inputProps:b,...J}){const{field:{value:v,onChange:R,onBlur:L,...y},fieldState:{error:F}}=$e({name:o,control:i,defaultValue:r,rules:l}),{navigationKey:U}=Uo(),D=B??U,{inputRef:Z,maintainFocus:H,handleKeyDown:K,handleEnterNavigation:G}=or({navigationKey:D}),{inputHeight:Y,inputFontSize:V}=tC(Q),T=Boolean(g??J.multiline),j=e=>{let t=e;const i=(e=>{switch(e){case"string":return/^[A-Za-z\s]*$/;case"string-number":return/^[A-Za-z0-9\s]*$/;case"string-number-special":default:return/^[\s\S]*$/;case"string-special":return/^[\p{L}’'\-\s.]+$/u;case"string-special-all":return/^[^\d]+$/;case"custom":return S.regex}})(m);return i.test(t)||(t=t.split("").filter((e=>i.test(e))).join("")),"uppercase"===f?t=t.toUpperCase():"lowercase"===f&&(t=t.toLowerCase()),t},{message:W}=S,q=W||XA[m];return c?e(od,{label:n,multiline:T,styling:I,size:Q}):t(a,{...E,gap:"5px",children:[n&&"custom"===I&&t(a,{direction:"row",children:[e(Oe,{required:C,disabled:d,children:n}),w&&e(xl,{toolTipLabel:w,children:e(Vt,{sx:{fontSize:13}})})]}),e(Ne,{disabled:d,required:C,fullWidth:!0,inputRef:Z,onKeyDown:e=>{"number"===s&&OA.has(e.key)&&e.preventDefault();!Boolean(g??J.multiline)||"Enter"!==e.key||"enter"!==D||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?K(e,void 0,!1):G(e,!0)},onPaste:e=>{(A||"number"===s&&NA.test(e.clipboardData.getData("text")))&&e.preventDefault()},placeholder:"default"===I?h:h||n,type:s,label:"default"===I?n:void 0,sx:{...rC(I),"& .MuiInputBase-root":{...!T&&{height:`${Y}px !important`,fontSize:V}}},InputLabelProps:oC(I,Q,T),InputProps:{...M,readOnly:A||M?.readOnly},inputProps:{min:0,...b,readOnly:A||b?.readOnly},error:Boolean(F),helperText:F?.message,onChange:e=>{if(A)return;const t=e.target,{selectionStart:i,selectionEnd:r}=t;let n=e.target.value||null;"string"==typeof n&&""===n.trim()?n=null:u||"string"!=typeof n||(n=n.trimStart());const l=n&&j(n);if(n!==l&&k)return void k(o,{type:"manual",message:q});let a=l;n&&"number"===s?a=Number(n):p&&l&&(a=l?l.toUpperCase():null),R(a),x&&x(n),requestAnimationFrame((()=>{"text"==s&&t.setSelectionRange(i,r),H()}))},onBlur:()=>{if(!u&&"string"==typeof v){const e=v.trim(),t=""===e?null:e;v!==t&&R(t)}L()},value:"string"==typeof v?v.trimStart():v??"",...y,...J})]})}function $A(t){const[i,o]=h(!1);return e(_A,{type:i?"text":"password",InputProps:{startAdornment:e(Pe,{position:"start",children:e(Ii,{fontSize:"small"})}),endAdornment:e(Pe,{position:"end",children:e(r,{"aria-label":"toggle password visibility",onClick:()=>{o((e=>!e))},edge:"end",children:e(i?wi:Nt,{fontSize:"small"})})})},...t})}const ec=v(M,{shouldForwardProp:e=>"error"!==e})((({styling:e,theme:t,error:i,size:o})=>{const r={position:"relative"},{red:n,butterflyBlue:l,iron:a,slate:s,black:C}=t.palette.app.color,{fontSize:d}=iC(o);return"custom"===e?{...r,"&.custom_phone_input":{"& .phone-input-container":{"&:focus-within":{border:`2px solid ${l[900]} !important`}},"& .phone-input-field":{padding:"8.5px 50px 8.5px 30px","&:focus":{"& ~ .flag-dropdown":{borderColor:i?n[900]:l[900]}}},"& .flag-dropdown":{"&.open":{borderColor:i?n[900]:l[900]}}}}:{"&.default_phone_input":{"& .react-tel-input":{"& .form-control":{fontSize:"16px",background:a[600],border:`1px solid ${s[100]}`,borderRadius:"5px",width:"300px",outline:"none",padding:"18.5px 14px 18.5px 58px",transition:"box-shadow ease .25s, border-color ease .25s","&:focus":{borderColor:l[900],boxShadow:`0 0 0 2px ${l[900]}`},"&.invalid-number":{border:`1px solid ${n[900]}`,"&:focus":{boxShadow:`0 0 0 2px ${n[900]}`},"&+div:before":{content:"'Error'",display:"none",color:`${n[900]}`,width:"27px"}}},"& .flag-dropdown":{position:"absolute",top:"0",bottom:"0",padding:"0",backgroundColor:a[600],borderRadius:"3px 0 0 3px","&:hover, &:focus":{cursor:"pointer"}},"& input[disabled]":{"&+.flag-dropdown":{"&:hover":{cursor:"default",borderColor:s[100],"& .selected-flag":{backgroundColor:"transparent"}}}},"& .selected-flag":{outline:"none",position:"relative",height:"100%",padding:"0 0 0 8px",borderRadius:"3px 0 0 3px","&:focus":{"& .arrow":{borderLeftWidth:"4px",borderRightWidth:"4px",borderTop:`5px solid ${l[900]}`}},"& .flag":{position:"absolute",top:"50%",marginTop:"-6px"},"& .arrow":{position:"relative",top:"50%",marginTop:"-1px",width:"0",height:"0",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderTop:"4px solid #555","&.up":{borderTop:"none",borderBottom:"4px solid #555"}}},"& .country-list":{outline:"none",zIndex:1,listStyle:"none",position:"absolute",padding:"0",margin:"10px 0 10px -1px",backgroundColor:"white",width:"300px",maxHeight:"220px",overflowY:"scroll",borderRadius:"7px","& .flag":{display:"inline-block",position:"absolute",left:"13px",top:"8px",marginRight:"7px",marginTop:"2px"},"& .divider":{paddingBottom:"5px",marginBottom:"5px",borderBottom:"1px solid #ccc"},"& .country":{position:"relative",padding:"12px 9px 13px 46px","& .dial-code":{color:"#6b6b6b"},"&:hover":{backgroundColor:"hsl(0, 0.00%, 94.50%)"},"&.highlight":{backgroundColor:s[300]}},"& .country-name":{marginRight:"6px"},"& .search":{zIndex:2,position:"sticky",top:"0",backgroundColor:"#fff",padding:"10px 0 6px 10px"},"& .search-emoji":{display:"none",fontSize:"15px"},"& .search-box":{border:`1px solid ${s[100]}`,borderRadius:"3px",fontSize:"15px",lineHeight:"15px",marginLeft:"6px",padding:"3px 8px 5px",outline:"none","&:hover":{borderColor:s[50]}},"& .no-entries-message":{padding:"7px 10px 11px",opacity:".7"}},"& .invalid-number-message":{position:"absolute",zIndex:1,fontSize:"13px",left:"25px",top:"-7px",background:"#fff",padding:"0 5px",color:n[900]},"& .special-label":{position:"absolute",zIndex:5,top:"small"===o?"-8px":"-9px",left:"0px",display:"block",color:C[900],background:a[600],opacity:"1",fontSize:`${d}px`,whiteSpace:"nowrap",lineHeight:"1.1",scale:"small"===o?.83:.85}},"&.phone-input-required .react-tel-input .special-label::after":{content:"' *'",color:n[900],fontSize:"13px",fontWeight:500}}}})),tc=({rows:i,label:o,styling:r,size:n})=>{const{inputHeight:l}=tC(n),s=void 0===i?l:26.5*i;return t(a,{gap:"5px",children:[o&&"custom"===r&&e(we,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(we,{height:`${s}px`,sx:{transform:"scale(1)"}})]})};function ic({control:i,name:o,defaultValue:r,rules:n,label:l,disabled:s=!1,required:C,rows:d,loading:A=!1,placeholder:c="",error:g,helperText:m,navigationKey:f,styling:k="custom",size:E,autoFocus:I=!1,...w}){const S=J(),{iron:B,red:x,slate:Q}=S.palette.app.color,{navigationKey:M}=Uo(),b=f??M,{inputHeight:v,inputFontSize:R}=tC(E),{inputProps:L,...y}=w,F={...L??{},...I&&!s?{autoFocus:!0}:{}},{field:{value:U,onChange:D,...Z}}=$e({name:o,control:i,defaultValue:r,rules:n}),[H,K]=h(!1),{setInputRef:G,maintainFocusAfterClose:Y,handleKeyDown:V}=or({isOpen:H,navigationKey:b}),T=p(null);return u((()=>{const e=T.current;if(!e||s)return;const t=e.querySelector("input[type='tel']");t&&(G(t),Z.ref(t));const i=()=>{const t=e.querySelector(".country-list"),i=e.querySelector(".react-tel-input");if(!t)return;const o=i?.getBoundingClientRect()?.width,r=e.querySelector(".flag-dropdown")?.getBoundingClientRect();r&&(t.style.position="fixed",t.style.top=`${r.bottom}px`,t.style.left=`${r.left}px`,t.style.zIndex="99999",t.style.maxHeight="200px",t.style.overflowY="auto",t.style.width=`${o}px`)},o=()=>{i()};window.addEventListener("resize",o),window.addEventListener("scroll",o,!0);const r=()=>{const t=e.querySelector(".selected-flag");t&&(t.setAttribute("tabindex","-1"),t.addEventListener("focus",(()=>{t.blur()})));const o=!!e.querySelector(".flag-dropdown.open");K(o),o&&(i(),setTimeout((()=>{const t=e.querySelector(".country-list .search-box input");t&&t.focus()}),0))},n=new MutationObserver((e=>{r();e.some((({addedNodes:e})=>!e.length))&&i()}));n.observe(e,{attributes:!0,attributeFilter:["class"],subtree:!0,childList:!0});const l=e=>{const t=e.target;(t.closest(".flag-dropdown")||t.closest(".country-list"))&&setTimeout(r,0)},a=e=>{const t=e.target;t.closest(".flag-dropdown")||t.closest(".country-list")||setTimeout(r,0)};return e.addEventListener("click",l),document.addEventListener("click",a),r(),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0),n.disconnect(),e.removeEventListener("click",l),document.removeEventListener("click",a)}}),[G,Z,s]),A?e(tc,{label:l,rows:d,styling:k,size:E}):t(a,{gap:"4px",children:[t(a,{gap:"5px",children:[l&&"custom"===k&&e(Oe,{required:C,disabled:s,children:l}),e(ec,{ref:T,styling:k,error:g,size:E,className:`${"custom"===k?"custom_phone_input":"default_phone_input"}${C?" phone-input-required":""}`,children:e(Si,{country:"in",enableSearch:!0,disabled:s,specialLabel:l??"",placeholder:c||l,onChange:e=>{D(e)},value:String(U),onBlur:()=>{Z.onBlur(),H||Y()},onKeyDown:e=>{H||V(e,void 0,!1)},containerStyle:{width:"100%",height:`${v}px`,border:g?`1px solid ${x[900]}`:s?`1px solid ${B[700]}`:`1px solid ${B[800]}`,borderRadius:"4px",transition:"all 0.2s ease"},inputStyle:{width:"100%",padding:"8.5px 40px",fontSize:R,height:`${v}px`,border:"none",outline:"none",transition:"all 0.2s ease",color:s?B[100]:Q[900]},containerClass:"phone-input-container",inputClass:"phone-input-field",buttonStyle:{border:"none"},...y,inputProps:F})})]}),g&&e(q,{variant:"caption",sx:{color:"red",whiteSpace:"pre",textWrap:"wrap"},children:m})]})}const oc={complete:100,high:55,mid:25},rc=(e,t=oc)=>{const{complete:i,high:o,mid:r}=t;return e>=i?"complete":e>=o?"high":e>=r?"mid":"low"},nc=(e,t,i=oc)=>t[rc(e,i)],lc={small:{barHeight:4,labelMinWidth:24,spacing:.75,fontSize:"11px",skeletonLabelHeight:16},medium:{barHeight:6,labelMinWidth:28,spacing:1,fontSize:"12px",skeletonLabelHeight:20},large:{barHeight:8,labelMinWidth:32,spacing:1.25,fontSize:"13px",skeletonLabelHeight:22}},ac=({completed:i,total:o,progress:r,displayMode:n,showLabel:l=!0,hideLabel:s=!1,size:C="medium",loading:d=!1,label:A,getBarColor:c,bandColors:h,bandThresholds:p,sx:u})=>{const g=J(),{butterflyBlue:m,darkMint:f,darkOrange:k,iron:E,lipstickRed:I}=g.palette.app.color,{barHeight:w,labelMinWidth:S,spacing:B,fontSize:x,skeletonLabelHeight:Q}=lc[C],M=!s&&l,b="percentage"===n||void 0===n&&null!=r,v=i??0,R=o??0;let L=0;b?L=r??0:R>0&&(L=v/R*100);const y=Math.min(100,Math.max(0,Math.round(L))),F=b?`${y}%`:`${v}/${R}`,U={complete:h?.complete??f[900],high:h?.high??m[900],mid:h?.mid??k[900],low:h?.low??I[900]},D={...oc,...p},Z=c?.(y)??nc(y,U,D);return t(a,d?{direction:"row",alignItems:"center",spacing:B,sx:{width:"100%",height:"100%",...u},children:[M&&e(we,{variant:"text",width:S,height:Q,sx:{flexShrink:0}}),e(we,{variant:"rounded",height:w,sx:{flex:1,borderRadius:3}})]}:{direction:"row",alignItems:"center",spacing:B,sx:{width:"100%",height:"100%",...u},children:[M&&(A??e(q,{variant:"caption",fontWeight:600,sx:{minWidth:S,whiteSpace:"nowrap",fontSize:x},children:F})),e(xi,{variant:"determinate",value:y,sx:{flex:1,height:w,borderRadius:3,backgroundColor:E[700],"& .MuiLinearProgress-bar":{borderRadius:3,backgroundColor:Z}}})]})},sc={small:{railHeight:6},medium:{railHeight:8},large:{railHeight:10}},Cc=({label:i,size:o="medium"})=>{const{railHeight:r}=sc[o];return t(a,{gap:"5px",sx:{width:"100%"},children:[i&&e(we,{width:120,height:18,sx:{transform:"scale(1)"}}),e(we,{variant:"rounded",height:r,sx:{width:"96%",borderRadius:4}})]})},dc=e=>Math.round(100*(e+Number.EPSILON))/100,Ac=(e,t)=>t<=0?0:Math.min(100,Math.max(0,e/t*100)),cc=e=>e<=0?1:Math.max(.01,dc(e/100)),hc=e=>Array.isArray(e)?e[0]:e,pc={small:{railHeight:6,thumbSize:12,py:"4px"},medium:{railHeight:8,thumbSize:16,py:"6px"},large:{railHeight:10,thumbSize:20,py:"8px"}};function uc({name:i,control:o,defaultValue:r,rules:n,targetValue:l,label:s,showLabel:C=!0,hideLabel:d=!1,size:A="medium",readOnly:c=!1,required:h=!1,loading:p=!1,disabled:u=!1,getBarColor:g,bandColors:m,bandThresholds:f,containerSx:k,valueLabelDisplay:E="auto",valueLabelFormat:I,"aria-label":w="Current progress",sx:S,...B}){const x=J(),{butterflyBlue:Q,darkMint:M,darkOrange:b,iron:v,lipstickRed:R}=x.palette.app.color,{railHeight:L,thumbSize:F,py:U}=pc[A],D=!d&&(C&&!!s),{field:{value:Z,onChange:H,...K},fieldState:{error:G}}=$e({name:i,control:o,defaultValue:r,rules:n});if(p)return e(Cc,{label:D?s:void 0,size:A});const Y=l>0?l:0,V="number"==typeof Z?Z:0,T=Math.min(Y,Math.max(0,V)),j=Ac(V,l),W={complete:m?.complete??M[900],high:m?.high??Q[900],mid:m?.mid??b[900],low:m?.low??R[900]},q={...oc,...f},z=g?.(j)??nc(j,W,q);return t(a,{gap:"5px",sx:{width:"100%",...k},children:[D&&e(Oe,{required:h,disabled:u||Y<=0,children:s}),e(ui,{...K,...B,size:"large"===A?"medium":A,value:T,min:0,max:Y,step:cc(l),disabled:u||Y<=0,valueLabelDisplay:E,valueLabelFormat:I??(e=>`${Ac(e,l).toFixed(2)}%`),"aria-label":w,"aria-readonly":c||void 0,onChange:(e,t)=>{if(c)return;const i=hc(t);"number"==typeof i&&H(dc(i))},sx:{width:"96%",py:U,color:z,...c&&{pointerEvents:"none",cursor:"default"},"& .MuiSlider-rail":{height:L,borderRadius:4,bgcolor:y(v[700],.6),opacity:1},"& .MuiSlider-track":{height:L,borderRadius:4,border:"none"},"& .MuiSlider-thumb":{width:F,height:F,...c&&{display:"none"},"&:hover, &.Mui-focusVisible, &.Mui-active":{boxShadow:`0 0 0 6px ${y(z,.16)}`}},...S}}),G&&e(Bi,{error:!0,children:G.message})]})}const gc=e=>"medium"===e?26:20,mc=({isHorizontal:i,direction:o,optionsLength:r,size:n})=>{const l=gc(n);return t(a,{gap:"10px",direction:i?"row":"column",alignItems:i&&"row"===o?"center":void 0,children:[e(we,{height:"18.69px",width:"70px",sx:{transform:"scale(1)"}}),e(a,{direction:o,gap:"column"===o?"5px":"10px",children:Array.from({length:r}).map((()=>t(a,{gap:"10px",direction:"row",alignItems:"center",children:[e(we,{variant:"circular",height:l,width:l}),e(we,{height:"21px",width:"100px",sx:{transform:"scale(1)"}})]},ti())))})]})};function fc({name:i,rules:o,label:r,control:n,options:l,defaultValue:s,size:C="small",color:d="secondary",loading:A=!1,required:c=!1,direction:h="row",sx:u={},containerProps:g,isHorizontal:m=!1,navigationKey:f,customOnChange:k,...E}){const{field:{value:I,onChange:w,ref:S,...B}}=$e({name:i,control:n,defaultValue:s,rules:o}),{navigationKey:x}=Uo(),Q=f??x,{inputRef:b,handleKeyDown:J,maintainFocus:v}=or({navigationKey:Q}),R=p(null);return A?e(mc,{isHorizontal:m,direction:h,optionsLength:l.length,size:C}):t(a,{direction:m?"row":"column",alignItems:m?"center":void 0,gap:m?1:"5px",children:[r&&e(Oe,{sx:{whiteSpace:"normal",overflow:"visible",textOverflow:"unset"},required:c,disabled:E.disabled,children:r}),e(bi,{name:i,value:I,onKeyDown:e=>{J(e,void 0,!1)},onChange:(e,t)=>{let i;if("true"===t?(i=!0,w(!0)):"false"===t?(i=!1,w(!1)):(i=t,w(t)),k){const e=l.find((({values:e})=>e===i));e&&k(e)}const o=e.target;o?b.current=o:!b.current&&R.current&&(b.current=R.current),v()},children:e(a,{gap:"column"===h?"5px":"10px",direction:h,...g,children:l?.map((({label:t,values:i,disabled:o},r)=>e(M,{children:e(Qi,{value:i,control:e(Mi,{...B,...E,color:d,size:C,inputRef:e=>{if(!e)return;I===i||!b.current&&0===r?(b.current=e,R.current=e):R.current||0!==r||(R.current=e),S&&("function"==typeof S?S(e):S.current=e)},sx:{"& .MuiSvgIcon-root":{fontSize:gc(C)}}}),disabled:o,label:t,sx:u})},r)))})})]})}const kc={small:17,medium:22,large:28},Ec=({label:i,size:o="medium",direction:r="row",max:n=5})=>{const l=kc[o],s=Array.from({length:n},((e,t)=>`star-${t+1}`));return t(a,{gap:"5px",direction:r,alignItems:"row"===r?"center":"flex-start",children:[i&&e(we,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(a,{gap:"2px",direction:"row",children:s.map((t=>e(we,{variant:"rectangular",width:l,height:l,sx:{borderRadius:"5px"}},t)))})]})};function Ic({control:o,name:r,defaultValue:n,label:l="",rules:s,disabled:C,loading:d=!1,direction:A="column",required:c=!1,navigationKey:h,size:p,max:u,containerSx:g,...m}){const{field:{value:f,onChange:k,...E},fieldState:{error:I}}=$e({name:r,control:o,defaultValue:n,rules:s}),{navigationKey:w}=Uo(),S=h??w,{maintainFocus:B,handleKeyDown:x}=or({navigationKey:S});return d?e(Ec,{label:l,size:p,direction:A,max:u}):t(i,{children:[t(a,{gap:"5px",direction:A,alignItems:"row"===A?"center":"flex-start",sx:g,children:[l&&e(Oe,{required:c,disabled:C,children:l}),e("div",{onKeyDown:e=>{x(e,void 0,!1)},children:e(Ji,{disabled:C,value:f??null,onChange:(e,t)=>{k(t),B()},size:p,max:u,...E,...m})})]}),I&&e(Bi,{error:!0,children:I?.message})]})}function wc(t){return e(_A,{placeholder:"Search",InputProps:{startAdornment:e(Pe,{position:"start",children:e(vi,{fontSize:"small"})})},...t,containerProps:{width:{sm:"auto",xs:"100%"},...t.containerProps}})}const Sc=({top:t="0px",paperSx:i,boxSx:o,...r})=>e(se,{variant:"outlined",sx:{position:"sticky",top:t,zIndex:100,...i},children:e(jl,{padding:{padding:"5px"},children:e(M,{sx:{display:"flex",justifyContent:"flex-end",...o},children:e(wc,{...r})})})}),Bc=v(Ui)((({theme:e,disabled:t})=>{const{lightBlue:i,iron:o}=e.palette.app.color;return{"& .MuiInputBase-root":{backgroundColor:t?y(i[100],.3):o[600]},"& .MuiSelect-select":{display:"flex",alignItems:"center",gap:"8px",flexWrap:"nowrap",overflow:"hidden"},"& .MuiList-root":{maxHeight:300,overflowY:"auto","&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{backgroundColor:i[100]}}}})),xc=v(q)((({theme:e})=>{const{butterflyBlue:t}=e.palette.app.color;return{position:"sticky",top:0,padding:"8px 16px",fontSize:"13px",fontWeight:600,color:t[900],backgroundColor:t[500],zIndex:1}}));function Qc({control:o,defaultValue:n,name:s,required:C=!1,label:d,multiple:A=!1,disabled:u=!1,options:m=[],rules:f,loading:k=!1,helperText:E,error:I,placeholder:w="",isShowSelectAll:S=!0,isShowAvatar:B=!1,onAction:x,renderOption:Q,maxLimit:v,maxDisplayItems:R=2,disableClearable:L=!!C,setOnFinalChange:y=!1,styling:F="custom",navigationKey:U,...D}){const{field:{onChange:Z,value:H,...K}}=$e({name:s,control:o,defaultValue:n,rules:f}),{navigationKey:G}=Uo(),Y=U??G,{t:V}=ot(),T=J(),{slate:j,iron:W}=T.palette.app.color,z=u?W[900]:"revert-layer",[P,O]=h(null),N=p(!1),[X,_]=h(!1),{setInputRef:ee,maintainFocusAfterClose:te,handleKeyDown:ie,handleEnterNavigation:oe}=or({isOpen:X,navigationKey:Y}),re=c((()=>{if(!A||!S||!Array.isArray(H))return!1;const e=m.filter((e=>!e.disabled));return H.length===e.length}),[A,S,m,H]),ne=c((()=>{if(!A||!Array.isArray(H))return[];const e=new Set(H);return m.filter((t=>e.has(t.value)))}),[A,m,H]),le=c((()=>{const e={};return m.forEach((t=>{const i=t.heading??"";e[i]||(e[i]=[]),e[i].push(t)})),e}),[m]),ae=c((()=>!L&&(!!H&&(Array.isArray(H)?H.length>0:""!==H))),[H,L]),se=g((e=>{e.stopPropagation(),Z(A?[]:"")}),[A,Z]),Ce=g((e=>{"enter"===Y&&"Enter"===e.key&&(e.stopPropagation(),oe(e))}),[Y,oe]),de=g((()=>t(a,{direction:"row",alignItems:"center",gap:"5px",children:[ae&&!X&&e(r,{size:"small",onClick:se,onKeyDown:Ce,children:e(yi,{sx:{fontSize:"14px"}})}),e(r,{size:"small",onClick:e=>{e.stopPropagation(),_((e=>!e))},onKeyDown:e=>{"Enter"===e.key&&(e.stopPropagation(),_((e=>!e)))},children:e(Fi,{fontSize:"small",sx:{transform:X?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease-in-out"}})})]})),[ae,se,Ce,X,_]);if(k)return t(a,{gap:"10px",children:[d&&"custom"===F&&e(we,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(we,{height:"35.69px",sx:{transform:"scale(1)"}})]});const Ae=()=>y&&N.current?P:H;return t(a,{gap:"5px",children:[d&&"custom"===F&&e(Oe,{required:C,disabled:u,children:d}),t(a,{direction:"row",justifyContent:"space-between",gap:"10px",alignItems:"start",children:[t(Bc,{fullWidth:!0,error:I,disabled:u,required:C,sx:"default"===F?{...nC(F),"& .MuiOutlinedInput-notchedOutline":{"& legend":{maxWidth:0,"& span":{padding:"0 5px"}}},"& .MuiInputLabel-root.MuiInputLabel-shrink + .MuiInputBase-root .MuiOutlinedInput-notchedOutline legend":{maxWidth:"100%"}}:void 0,children:[d&&"default"===F&&e(Oe,{id:`${s}-label`,sx:lC(F),children:d}),e(Li,{...K,...D,multiple:A,value:Ae()??(A?[]:""),label:"default"===F?d:void 0,labelId:"default"===F&&d?`${s}-label`:void 0,inputProps:{"aria-label":"custom"===F&&d?d:void 0},onChange:e=>{const t=e.target.value;if(y)N.current=!0,A&&Array.isArray(t)&&t.includes("select-all")?O(Array.isArray(P)&&P.length===m.filter((({disabled:e})=>!e)).length?[]:m.filter((({disabled:e})=>!e)).map((({value:e})=>e))):O(t);else{if(A&&Array.isArray(t)){if(t.includes("select-all"))return void(e=>{if(e){const e=m.filter((e=>!e.disabled)).map((e=>e.value));Z(e)}else Z([])})(!re);if(v&&t.length>v)return void Ns.error({title:V("common.select.limitExceed",{maxLimit:v})})}Z(t)}},open:X,onOpen:()=>{_(!0)},onClose:()=>{_(!1),te(),y&&N.current&&(Z(P),N.current=!1,O(null))},inputRef:e=>ee(e),onKeyDown:e=>{ie(e,(()=>{_(!1)}),X)},renderValue:D.renderValue??(i=>{if(!A){const o=m.find((e=>e.value===i)),r=()=>o?o.label:"default"===F&&d?"":w;return t(M,{sx:{display:"flex",alignItems:"center",gap:1},children:[B&&o?.avatar&&e(Se,{src:o.avatar??"",sx:{width:20,height:20}}),e(q,{variant:"body2",color:z,sx:{WebkitTextFillColor:z},noWrap:!0,children:r()})]})}if(!Array.isArray(i)||0===i.length){return e(q,{sx:{WebkitTextFillColor:z},color:z,variant:"body2",noWrap:!0,children:"default"!==F||!d||w?w:""})}const o=ne.slice(0,R),r=ne.length-R;return t(M,{sx:{display:"flex",alignItems:"center",gap:.5,overflow:"hidden"},children:[o.map((t=>e(q,{variant:"body2",noWrap:!0,color:z,sx:{WebkitTextFillColor:z,backgroundColor:j[800],padding:"2px 5px",borderRadius:"12px",fontSize:"12px",maxWidth:"120px"},children:t.label},t.value))),r>0&&t(q,{variant:"body2",color:z,sx:{WebkitTextFillColor:z,backgroundColor:j[300],padding:"2px 5px",borderRadius:"12px",fontSize:"12px",fontWeight:500},children:["+",r]})]})}),IconComponent:de,displayEmpty:!0,MenuProps:{PaperProps:{sx:{width:"inherit",maxHeight:300,"& .MuiList-root":{paddingTop:0,paddingBottom:0}}},MenuListProps:{...D.MenuProps?.MenuListProps,variant:"menu"}},children:Object.entries(le).length?(()=>{const o=[],r=Ae(),n=A&&Array.isArray(r)?new Set(r):new Set;return A&&S&&m.length>0&&(o.push(t(l,{value:"select-all",children:[e(b,{icon:e($s,{size:"small"}),checkedIcon:e(eC,{size:"small"}),indeterminate:Array.isArray(r)&&r.length>0&&r.length<m.filter((({disabled:e})=>!e)).length,checked:Array.isArray(r)&&r.length===m.filter((e=>!e.disabled)).length,sx:{marginRight:1}}),e(Ri,{primary:"Select All"})]},"select-all")),o.push(e($,{sx:{margin:"0px !important"}},"divider-select-all"))),Object.entries(le).forEach((([a,s])=>{a&&o.push(e(xc,{children:a},`group-${a}`)),s.forEach((a=>{const s=A?n.has(a.value):r===a.value;o.push(e(l,{value:a.value,disabled:a.disabled,children:Q?Q(a,s):t(i,{children:[A&&e(b,{icon:e($s,{size:"small"}),checkedIcon:e(eC,{size:"small"}),checked:s,sx:{marginRight:1}}),t(M,{sx:{display:"flex",alignItems:"center",gap:1},children:[B&&a.avatar&&e(Se,{src:a.avatar,alt:a.label,sx:{width:24,height:24}}),e(Ri,{primary:a.label})]})]})},a.value))}))})),o})():e(l,{disabled:!0,children:e(Ri,{primary:"No options"})})}),E&&e(Bi,{children:E})]}),x&&e(yl,{disabled:u,onClick:x})]})]})}const Mc=()=>e(we,{width:50,height:18,sx:{borderRadius:"10px"},variant:"rectangular"});function bc({name:t,rules:i,control:o,defaultValue:r,loading:n=!1,navigationKey:l,...a}){const s=J(),{butterflyBlue:C,iron:d}=s.palette.app.color,{field:{value:A=!1,...c}}=$e({name:t,control:o,defaultValue:r,rules:i}),{navigationKey:h}=Uo(),p=l??h,{setInputRef:u,maintainFocus:g,handleKeyDown:m}=or({navigationKey:p});if(n)return e(Mc,{});return e(Di,{checked:A,...c,...a,inputRef:u,onKeyDown:e=>{m(e,void 0,!1),a.onKeyDown&&a.onKeyDown(e)},onChange:e=>{c.onChange(e),g()},sx:{padding:1,"& .MuiSwitch-track":{borderRadius:11,backgroundColor:d[900],position:"relative","&::before":{content:"unset",position:"absolute",top:"50%",transform:"translateY(-50%)",width:16,height:16,left:12},[Zi.input]:{width:"80px !important"},"&::after":{content:"unset",position:"absolute",top:"50%",transform:"translateY(-50%)",width:16,height:16,right:12}},"& .MuiSwitch-thumb":{boxShadow:"none",width:16,height:16,margin:.15,color:"white"},"& .Mui-checked + .MuiSwitch-track":{backgroundColor:`${C[900]} !important`,opacity:"1 !important"}}})}const Jc=({label:i,styling:o,size:r})=>t(a,{gap:"5px",flex:1,children:[i&&"custom"===o&&e(we,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(we,{height:`${tC(r).inputHeight}px`,width:"100%",sx:{transform:"scale(1)"}})]});function vc({control:i,defaultValue:o,disabled:r=!1,label:n,name:l,error:s,helperText:C,loading:d=!1,required:A=!1,rules:c,format:h="HH:mm",isReturnLocalTime:p=!1,isReturnDateWithTime:u=!1,styling:g="custom",navigationKey:m,size:f,...k}){const{field:{value:E,onChange:I,...w}}=$e({name:l,control:i,defaultValue:o,rules:c}),{navigationKey:S}=Uo(),B=m??S,{inputRef:x,maintainFocus:Q,handleKeyDown:M}=or({navigationKey:B}),{inputHeight:b,inputFontSize:v}=tC(f),R=J(),{butterflyBlue:L}=R.palette.app.color;s&&E&&"object"==typeof E&&(C="Invalid time");const y=E?U.fromISO(E):null;return d?e(Jc,{label:n,styling:g,size:f}):t(a,{gap:"5px",children:[n&&"custom"===g&&e(Oe,{required:A,disabled:r,children:n}),e(Hi,{...w,...k,disabled:r,value:y,onChange:e=>{if(e?.isValid){if(p)return I(e.toFormat(h)),void Q();if(u)return I(e.toUTC().toISO()),void Q();I(e.toUTC().toISOTime()),Q()}else I(e),Q()},slotProps:{textField:{disabled:r,helperText:C,error:s,label:"default"===g?n:void 0,required:"default"===g?A:void 0,inputRef:x,InputLabelProps:oC(g,f),onKeyDown:e=>{M(e,void 0,!1)},sx:{...rC(g),width:"100%","& .MuiInputBase-root":{fontSize:v,height:b},backgroundColor:"white","& .Mui-selected":{backgroundColor:L[900],borderRadius:"5px"}}}},format:h,helperText:C,sx:{backgroundColor:"white","& .Mui-selected":{backgroundColor:L[900],borderRadius:"5px"},"& .MuiOutlinedInput-input":{fontSize:v}}})]})}const Rc=({label:i,styling:o,size:r})=>{const{inputHeight:n}=tC(r);return t(a,{gap:"5px",flex:1,children:[i&&"custom"===o&&e(we,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(we,{height:`${n}px`,width:"100%",sx:{transform:"scale(1)"}})]})};function Lc({control:i,defaultValue:o,disabled:r=!1,label:n,readOnly:l=!1,name:s,error:C=!1,helperText:d,loading:A=!1,required:c=!1,rules:p,format:u="HH:mm",isReturnLocalTime:g=!1,isReturnDateWithTime:m=!1,timeStepsMinutes:f=1,helperIcon:k,toolTipText:E,containerProps:I,styling:w="custom",navigationKey:S,size:B,...x}){const{field:{value:Q,onChange:M,...b}}=$e({name:s,control:i,defaultValue:o,rules:p}),[v,R]=h(!1),{navigationKey:L}=Uo(),y=S??L,{setInputRef:F,maintainFocus:D,maintainFocusAfterClose:Z,handleKeyDown:H,handleEnterNavigation:K}=or({isOpen:v,navigationKey:y}),{inputHeight:G,inputFontSize:Y}=tC(B);C&&Q&&"object"==typeof Q&&(d="Invalid time");const V=J(),{butterflyBlue:T}=V.palette.app.color,j=Q?U.fromISO(Q):null;return A?e(Rc,{label:n,styling:w,size:B}):t(a,{gap:"5px",...I,children:[n&&"custom"===w&&t(a,{alignItems:"center",flexDirection:"row",gap:"5px",children:[e(Oe,{required:c,disabled:r,children:n}),k&&E&&e(W,{title:E,placement:"bottom",children:k})]}),e(Ki,{...b,...x,disabled:r,readOnly:l,open:v,ampm:!1,value:j,format:u,onOpen:()=>R(!0),onClose:()=>{R(!1),Z()},timeSteps:{minutes:f},slotProps:{textField:{disabled:r,helperText:d,error:C,label:"default"===w?n:void 0,required:"default"===w?c:void 0,inputRef:F,InputLabelProps:oC(w,B),sx:{...rC(w),width:"100%","& .MuiInputBase-root":{fontSize:Y,height:G},backgroundColor:"white","& .Mui-selected":{backgroundColor:T[900],borderRadius:"5px"},"& .MuiOutlinedInput-input":{fontSize:Y}},onKeyDown:e=>{if("enter"===y){if(" "===e.key&&!v&&!r&&!l)return e.preventDefault(),e.stopPropagation(),void R(!0);if("Enter"===e.key&&!v)return e.preventDefault(),e.stopPropagation(),void K(e);if("Enter"===e.key&&v)return e.preventDefault(),e.stopPropagation(),R(!1),Z(),void requestAnimationFrame((()=>{K(e)}))}H(e,(()=>R(!1)),v)}},openPickerButton:{..."enter"===y?{onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),K(e))}}:{}},popper:{sx:{"& .MuiMultiSectionDigitalClockSection-root::after":{display:"unset"},"& .MuiList-padding":{padding:"10px"},"& .MuiMultiSectionDigitalClockSection-item":{padding:"4px"},"& .MuiMultiSectionDigitalClockSection-item.Mui-selected":{backgroundColor:T[900],borderRadius:"5px"},"& .MuiMultiSectionDigitalClockSection-item.Mui-selected:hover":{backgroundColor:T[900],borderRadius:"5px"},"& .Mui-selected:hover":{backgroundColor:T[900],borderRadius:"5px"},"& .MuiMultiSectionDigitalClockSection-item.Mui-selected:focus-visible":{backgroundColor:T[900],borderRadius:"5px"},"& .Mui-selected:focus-visible":{backgroundColor:T[900],borderRadius:"5px"}},onKeyDown:e=>{"enter"===y&&"Enter"===e.key&&v&&(e.preventDefault(),e.stopPropagation(),R(!1),Z(),requestAnimationFrame((()=>{K(e)})))}}},onChange:e=>{if(e?.isValid){if(g)return M(e.toFormat(u)),void D();if(m)return M(e.toUTC().toISO()),void D();M(e.toUTC().toISOTime()),D()}else M(e),D()}})]})}function yc({field:i,control:o,index:r}){const n=J(),{iron:l}=n.palette.app.color;return e(a,{direction:"row",component:"li",children:t(a,{direction:"row",alignItems:"center",border:"1px solid",flexGrow:1,borderColor:l[700],children:[e(jl,{padding:{paddingLeft:"24px"},children:e(q,{sx:{flexGrow:1},children:i.headerName})}),e(bc,{control:o,name:`columns.${r}.hide`})]})})}function Fc({column:i}){const o=J(),{lightBlue:r,iron:n}=o.palette.app.color;return e(a,{border:"1px solid",bgcolor:r[100],borderColor:n[700],children:e(jl,{padding:{padding:"0px 24px"},children:t(a,{direction:"row",alignItems:"center",justifyContent:"space-between",minHeight:"38px",children:[e(q,{children:i.headerName}),e(Gi,{htmlColor:n[800]})]})})})}function Uc({lockedColumns:o,fields:r,control:n}){return t(i,{children:[o.map((({field:t="fid",colId:i="cid",headerName:o})=>e(Fc,{column:{field:t,colId:i,headerName:o}},t??i))),e(a,{component:"ul",sx:{m:0,p:0},children:r.map(((t,i)=>e(yc,{field:t,control:n,index:i},t.id)))})]})}function Dc({columns:t,children:i}){const o=c((()=>t.filter((e=>!("hide"in e)))),[t]),r=c((()=>t.filter((e=>"hide"in e)).map((e=>({...e,hide:!e.hide})))),[t]),n=p(r),{control:l,reset:a,getValues:s,setValue:C}=et({defaultValues:{columns:n.current}}),{fields:d}=tt({name:"columns",control:l});return c((()=>{C("columns",r)}),[t]),i({reset:e=>{a({columns:e?Array.isArray(e)?e:[e]:n.current})},getValues:s,columnList:e(Uc,{fields:d,lockedColumns:o,control:l})})}function Zc({columns:i,open:o,onClose:r,onSave:n,title:l="Column Chooser"}){const a=(e=>c((()=>e.filter((({field:e,colId:t})=>!!e||!!t)).map((({field:e,hide:t,headerName:i,colId:o})=>{const r={field:e??o,headerName:i};return null!=t&&(r.hide=t),r}))),[e]))(i);return e(Dc,{columns:a,children:({columnList:i,reset:a,getValues:s})=>e(gC,{title:l,open:o,onClose:()=>{r(),a()},maxWidth:"xs",actions:t(bC,{sx:{justifyContent:"space-between",flex:1},children:[e(Rr,{variant:"outlined",onClick:()=>a(),children:"Reset"}),e(Rr,{onClick:()=>{const e=s(),t=Yi(e.columns.map((({field:e,colId:t,hide:i})=>[e??t,i])));n(t),r()},children:"Apply"})]}),children:i})})}const Hc=()=>e(Ti,{className:"bullet-hover",sx:{fontSize:"6px",borderRadius:"50%"}}),Kc=({href:t="/",style:i,scroll:o=!1,...r})=>{const n=Wi(),l=qi(),a=ar(t),{pathname:s,query:d}=a,A=c((()=>{if("string"!=typeof t)return{pathname:t??"/",query:void 0};if(n!==s)return a;const e=Array.from(l.entries()),i={...e.length?Object.fromEntries(e):void 0,...d};return{pathname:s,query:Object.keys(i).length?i:void 0}}),[n,l,t,s,d]);return e(C,{...r,prefetch:!1,scroll:o,style:{textDecoration:"none",outline:"none",...i},href:A})},Gc=({selected:i=!1,icon:o=e(Hc,{}),title:r,endAdornment:n,sx:l,href:s,onClick:C,isShowEndAdornment:d=!1,preventRedirection:A=!1,onPreventRedirection:c,onMenuClick:h,...p})=>{const u=J(),{isMobile:g}=rr(),{butterflyBlue:m,iron:f}=u.palette.app.color;return t(ji,{...p,...d?{}:s?{component:Kc,href:s}:{},onClick:e=>{h&&h(),(!s||d||A)&&(c?.(),C(),e.preventDefault())},sx:{padding:"9.5px 16px",...l,margin:"0",cursor:g||!d?"pointer":"default",userSelect:"none",textDecoration:"none",fontSize:"13px",wordBreak:"break-word",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",flex:1,width:"100%",color:i?f[600]:u.palette.primary.light,":hover":{color:f[600],".bullet-hover":{color:i?"":m[900]}}},children:[t(a,{alignItems:"center",direction:"row",flex:1,gap:"10px",justifyContent:"center",children:[o,r&&e(Ri,{primary:r,disableTypography:!0,sx:{...l,marginTop:"6px",padding:"0",textAlign:"left"}})]}),n]})},Yc=({icon:t=e(Hc,{}),title:i,isShowEndAdornment:o=!1,selected:r=!1,onMouseEnter:n,href:l,onClick:a,onPreventRedirection:s,preventRedirection:C,onMenuClick:d})=>{const A=J(),{butterflyBlue:c,slate:h}=A.palette.app.color;return e(M,{component:"li",sx:{bgcolor:r&&!o?c[900]:"",padding:i?"0px":"2.5px 0",wordBreak:"break-word"},children:e(Gc,{onClick:a,preventRedirection:C,onPreventRedirection:s,sx:{fontSize:"13px",padding:"9.5px 16px",":focus-visible":{border:`1px solid ${c[900]}`,backgroundColor:h[900]},margin:"0"},selected:r,title:i,icon:t,onMenuClick:d,onMouseEnter:n,href:l,isShowEndAdornment:o,endAdornment:o&&e(Bt,{sx:{fontSize:"16px"}})})})},Vc=({currentPathMenuOpen:o,currentMenuItem:r,onCloseMenuPopover:n,preventRedirection:l=!1,onPreventRedirection:a,onMenuClick:s})=>{const[C,d]=h([]);if(u((()=>{if(!r)return void d([]);const{title:e,key:t,menuItems:i}=r;d([{title:e,items:i??[],parentPath:`/${t}`,currentPathMenuOpen:o[t]??{}}])}),[r,o]),!r)return e(i,{children:"Loading..."});const A=C[C.length-1];if(!A)return null;const c=C.length>1;return t(Vi,{disablePadding:!0,children:[c&&e(Yc,{title:A.title,icon:e(St,{sx:{fontSize:"16px"}}),onClick:()=>{d((e=>e.slice(0,-1)))},onPreventRedirection:a,preventRedirection:l,selected:!1}),A.items.filter((({isView:e})=>!1!==e)).map((t=>{const i=Boolean(t.menuItems?.length),{title:o,icon:r,key:C}=t,c=Boolean(A.currentPathMenuOpen[C]),h=`${A.parentPath}/${C}`;return e(Yc,{onClick:()=>{i?(e=>{const{title:t,menuItems:i,key:o}=e;d((e=>{const r=e[e.length-1];return r?[...e,{title:t,items:i??[],parentPath:`${r.parentPath}/${o}`,currentPathMenuOpen:r.currentPathMenuOpen[o]??{}}]:e}))})(t):((e,t="_self")=>{const{key:i,onClick:o}=e,r=`${A.parentPath}/${i}`;o&&(o(r,t),"_blank"!==t&&n())})(t)},onPreventRedirection:a,preventRedirection:l,title:o,icon:r,onMenuClick:i?void 0:s,isShowEndAdornment:i,selected:c,href:i?void 0:h},C)}))]})},Tc=({open:t,anchorEl:i,children:o})=>{const r=J(),{mirage:n}=r.palette.app.color,l=p(null),[a,s]=h(null),C=g((()=>{const e=l.current;if(!i||!e||i instanceof Element&&!i.isConnected)return;const t=((e,t)=>{const{top:i,left:o,right:r}=e.getBoundingClientRect(),{offsetHeight:n,offsetWidth:l}=t,a=l||203,{innerHeight:s,innerWidth:C}=window,d=n<=s-i-8?i:s-n-8;return{top:Math.max(8,Math.min(d,s-8)),left:a<=C-r-8?r:Math.max(8,o-a)}})(i,e);s((e=>{const{top:i,left:o}=t;return e?.top===i&&e?.left===o?e:t}))}),[i]),d=g((e=>{l.current=e,e&&C()}),[C]);if(E((()=>{if(!t||!i)return void s(null);C();const e=window.requestAnimationFrame((()=>{C()}));window.addEventListener("resize",C),window.addEventListener("scroll",C,!0);const o=l.current,r="undefined"!=typeof ResizeObserver&&o?new ResizeObserver((()=>C())):null;return o&&r&&r.observe(o),()=>{window.cancelAnimationFrame(e),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0),r?.disconnect()}}),[t,i,C,o]),!t)return null;const{top:A=0,left:c=0}=a??{};return e(zi,{children:e(M,{ref:d,role:"presentation",style:{position:"fixed",top:A,left:c,width:203,zIndex:1300,visibility:a?"visible":"hidden",pointerEvents:a?"auto":"none"},sx:{background:n[900]},children:o})})},jc=({item:i,parentPath:o,currentPathMenuOpen:r,onCloseMenuPopover:n,onPreventRedirection:l,preventRedirection:a,onMenuClick:s})=>{const[C,d]=h(null),A=Boolean(C),{key:c,title:p,icon:u,menuItems:g,onClick:m,isView:f}=i;if(!1===f)return;const k=()=>{d(null)},E=Boolean(r[c]),I=`${o}/${c}`;return t(M,{onMouseLeave:k,children:[e(Yc,{onClick:(e="_self")=>{m&&(m(`${o}/${c}`,e),"_blank"!==e&&(k(),n()))},onPreventRedirection:l,preventRedirection:a,title:p,icon:u,onMenuClick:s,isShowEndAdornment:Boolean(g?.length),selected:E,onMouseEnter:e=>{g?.length&&d(e.currentTarget)},href:I}),g?.length&&A&&e(Tc,{open:!0,anchorEl:C,children:e(Vi,{disablePadding:!0,children:g.map((t=>e(jc,{item:t,parentPath:I,currentPathMenuOpen:r[c]??{},onCloseMenuPopover:n,preventRedirection:a,onPreventRedirection:l,onMenuClick:s},t.key)))})})]})},Wc=t=>{const{isMobile:o}=rr();if(o)return e(Vc,{...t});const{currentPathMenuOpen:r,currentMenuItem:n,onCloseMenuPopover:l,preventRedirection:a=!1,onPreventRedirection:s,onMenuClick:C}=t;return n?e(Vi,{disablePadding:!0,children:n.menuItems?.filter((({isView:e})=>!1!==e)).map((t=>e(jc,{item:t,onMenuClick:C,parentPath:`/${n.key}`,currentPathMenuOpen:r[n.key]??{},onCloseMenuPopover:l,preventRedirection:a,onPreventRedirection:s},t.key)))}):e(i,{children:"Loading..."})},qc=({menuItems:o,currentPathname:r,anchorEl:n,setAnchorEl:l,preventRedirection:a=!1,onPreventRedirection:s,onMenuClick:C})=>{const[d,A]=h(),[p,u]=h({});c((()=>{const e=br(r);if(N(e))return u({home:!0});u(e)}),[r]);const g=()=>{l(null)};return t(i,{children:[o.filter((({isView:e})=>!1!==e)).map((t=>{const{onClick:i,key:o,icon:r,menuItems:n=[]}=t,d=""===o?"/":`/${o}`,c=!!p?.[o];return e(Yc,{onClick:e=>{if(i){if(""===o)return void i("/",e);i(`/${o}`,e)}},onMenuClick:C,onMouseEnter:e=>{n?.length?(l(e.currentTarget),A(t)):g()},href:n.length?void 0:d,icon:r,onPreventRedirection:s,preventRedirection:a,selected:c},o)})),!!n&&e(M,{onMouseLeave:g,children:e(Tc,{open:!0,anchorEl:n,children:e(Wc,{currentMenuItem:d,currentPathMenuOpen:p,onCloseMenuPopover:g,preventRedirection:a,onPreventRedirection:s,onMenuClick:C})})})]})};v(M)((({theme:e})=>({width:7,height:7,borderRadius:"50%",background:e.palette.app.color.butterflyBlue[400]})));const zc=v(Pi,{shouldForwardProp:e=>"open"!==e})((({theme:e,open:t})=>{const i=e=>({width:300,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden",backgroundColor:e.palette.app.color.mirage[900],[e.breakpoints.down("md")]:{width:"80px"}}),o=e=>({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:"0px",[e.breakpoints.up("md")]:{width:"80px"},backgroundColor:e.palette.app.color.mirage[900]});return{width:300,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",...t&&{...i(e),"& .MuiDrawer-paper":i(e)},...!t&&{...o(e),"& .MuiDrawer-paper":o(e)}}})),Pc=({children:t,...i})=>e(Oi,{timeout:"auto",unmountOnExit:!0,...i,children:t}),Oc=({icon:t=e(Hc,{}),title:i,isShowEndAdornment:o=!1,selected:r=!1,onClick:n,isExpanded:l,sx:a,preventRedirection:s=!1,href:C,onPreventRedirection:d,onMenuClick:A})=>{const c=J(),{butterflyBlue:h}=c.palette.app.color;return e(M,{sx:{bgcolor:r&&!o?h[900]:""},children:e(Gc,{sx:a,title:i,icon:t,href:C,onClick:n,onMenuClick:A,selected:r,preventRedirection:s,onPreventRedirection:d,endAdornment:o&&e(l?Ni:Xi,{})})})},Nc=(e,t)=>{if(0===t.length)return!1;if("object"!=typeof e)return!1;const[i,...o]=t;if(!i)return!1;const r=e[i];return 0===o.length?Boolean(r):Nc(r,o)},Xc=e=>!0===e||"object"==typeof e&&null!==e&&Object.values(e).every(Xc),_c=({menuItem:i,level:o=0,parentPath:r="",subMenusOpen:n,setSubMenusOpen:l,currentPathMenuOpen:a,preventRedirection:s=!1,onPreventRedirection:C,onMenuClick:d})=>{const A=J();if(3===o)return;const{butterflyBlue:c,slate:h}=A.palette.app.color,{key:p,icon:u,title:g,isView:m,onClick:f,menuItems:k=[]}=i;if(!1===m)return;const E=r?`${r}/${p}`:p,I=E.split("/"),w=((e,t)=>{const i=Nc(e,t);return Boolean(i)})(n,I),S=((e,t)=>{const i=t.reduce(((e,t)=>{if("object"==typeof e&&null!==e&&t in e)return e[t]}),e);return Xc(i)})(a,I),B=""===p?"/":`/${E}`;return t(M,{children:[e(Oc,{sx:{paddingLeft:3*o+1.5,fontSize:"13px",":focus-visible":{border:`1px solid ${c[900]}`,backgroundColor:h[900]}},onClick:e=>{if(k.length>0){if(S)return;l((e=>{const t={...e};let i=t;for(let e=0;e<I.length-1;e++){const t=I[e];t&&(i[t]="object"==typeof i[t]?i[t]:{},i=i[t])}const o=I[I.length-1];return o&&(i[o]=!w),t}))}else f&&!S&&f(B,e)},onMenuClick:d,href:0===k.length?B:"",icon:0===o?u:void 0,title:g,isShowEndAdornment:k.length>0&&o<2,selected:S,isExpanded:w,preventRedirection:s,onPreventRedirection:C}),k.length>0&&e(Pc,{in:w,children:e(Vi,{component:"div",disablePadding:!0,children:k.map((t=>e(_c,{menuItem:t,level:o+1,parentPath:E,onMenuClick:d,subMenusOpen:n,setSubMenusOpen:l,currentPathMenuOpen:a,preventRedirection:s,onPreventRedirection:C},t.key)))})})]},p)},$c=({menuItems:t,currentPathname:i,preventRedirection:o=!1,onPreventRedirection:r,onMenuClick:n})=>{const[l,a]=h({}),[s,C]=h({});return u((()=>{const e=br(i);if(N(e))return a({home:!0}),void C({home:!0});const t=JSON.parse(JSON.stringify(e)),o=JSON.parse(JSON.stringify(e));a(t),C(o)}),[i]),t.map((t=>e(_c,{menuItem:t,subMenusOpen:l,setSubMenusOpen:a,onMenuClick:n,currentPathMenuOpen:s,preventRedirection:o,onPreventRedirection:r},t.key)))},eh=({menuItems:i=[],open:o,currentPathname:r,preventRedirection:n=!1,onLogoClick:l,onPreventRedirection:a,onMenuClick:s,href:d,preventClick:A=!1,openLogoUrl:c,closedLogoUrl:p})=>{const[u,g]=h(null),[m,f]=h(null),k=()=>{g(null)},{layout:E}=rr(),I="desktop"===E,w=I&&o,S=w?c:p,B=!!S&&m===S,x=()=>S&&!B?e(M,{sx:{display:"flex",justifyContent:"center",alignItems:"center",px:w?2:1,width:"100%",boxSizing:"border-box"},children:e(qA,{mode:"view",variant:"auto",value:S,label:"",enableFullImageView:!1,hideBorder:!0,size:w?"medium":"small",maxPreviewWidth:w?220:48,maxPreviewHeight:w?48:40,onError:()=>f(S)})}):e(w?$n:el,{});return t(zc,{variant:"permanent",open:o,children:[t(M,{textAlign:"center",sx:{cursor:d||l?"pointer":"default"},component:d?C:"div",onClick:()=>{l&&!A&&l()},href:d,children:[I&&e(jl,{padding:{paddingTop:"1.5rem"},children:x()}),!I&&e(jl,{padding:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},children:x()})]}),I&&e(Vi,{component:"nav",onMouseLeave:k,children:o?e($c,{menuItems:i,onMenuClick:s,currentPathname:r,preventRedirection:n,onPreventRedirection:a}):e(qc,{menuItems:i,currentPathname:r,anchorEl:u,onMenuClick:s,setAnchorEl:g,preventRedirection:n,onPreventRedirection:a})}),!I&&e(re,{onClickAway:k,children:e(Vi,{component:"nav",onMouseLeave:k,children:e(qc,{menuItems:i,onMenuClick:s,currentPathname:r,anchorEl:u,setAnchorEl:g,preventRedirection:n,onPreventRedirection:a})})})]})},th=e=>e?Array.isArray(e)?e:[e]:[],ih=e=>e.zIndex.drawer+200,oh=({title:o,children:n,onClose:l,actions:s,headerSlot:C,isHideHeader:d=!1,isHideFooter:A=!1,isHideCloseIcon:c=!1,isHideDividers:h=!1,disableEscapeKeyDown:p=!1,anchor:u="right",sx:g,ModalProps:m,...f})=>{const k=!A&&!!s,E=th(g),I=th(m?.sx);return e(Pi,{...f,anchor:u,onClose:l,sx:[e=>({zIndex:ih(e),"& .MuiBackdrop-root":{zIndex:ih(e)},"& .MuiDrawer-paper":{display:"flex",flexDirection:"column",zIndex:ih(e)}}),...E],ModalProps:{...m,disableEscapeKeyDown:p,sx:[e=>({zIndex:ih(e)}),...I]},children:t(a,{flex:1,sx:{overflow:"hidden"},children:[!d&&t(i,{children:[e(jl,{padding:{padding:"10px"},children:t(a,{direction:"row",alignItems:"center",children:[e(M,{flex:1,children:C??e(q,{variant:"h6",fontWeight:500,children:o})}),!c&&e(r,{onClick:e=>l?.(e,"escapeKeyDown"),color:"secondary",size:"small","aria-label":"Close",onMouseDown:e=>e.preventDefault(),children:e(At,{fontSize:"medium"})})]})}),!h&&e($,{})]}),e(M,{flex:1,sx:{overflowY:"auto",overflowX:"hidden"},children:n}),k&&t(i,{children:[!h&&e($,{}),e(jl,{padding:{padding:"10px"},children:s})]})]})})},rh=({open:i=!1,anchorEl:o,onClose:n,children:l,onApply:s,showDivider:C=!1,title:d,required:A})=>{const c=J(),{slate:h}=c.palette.app.color,p=()=>{te(s)&&s(),te(n)&&n({},"backdropClick")};return t(ce,{open:i,anchorEl:o,anchorOrigin:{vertical:"bottom",horizontal:"left"},onClose:()=>{p()},onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),p())},sx:{"& .MuiPaper-root":{minWidth:"300px"}},children:[C&&t(a,{alignItems:"flex-end",children:[e(jl,{padding:{padding:"8px"},children:t(a,{direction:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:[t(a,{direction:"row",alignItems:"center",gap:"5px",children:[t(q,{variant:"h6",children:[d," "]}),A&&e(q,{variant:"h6",color:"error",children:"*"})]}),e(r,{onClick:p,children:e(yi,{})})]})}),e($,{sx:{width:"100%"}})]}),e(M,{sx:{background:h[600],borderRadius:"5px"},children:l})]})},nh=({open:i,anchorEl:o,onClose:n,children:l,onApply:s,showDivider:C=!1,showFooter:d=!0,title:A,required:c,filterItem:p,reset:g,background:m=!1,currentFilterValue:f})=>{const k=J(),{slate:E}=k.palette.app.color,[I,w]=h(null),[S,B]=h(!0);u((()=>{if(i){if(!I&&f){const e=p?.multiSelect?lo(f):f;w(e)}}else w(null);if(f&&I){const e=p?.multiSelect?JSON.stringify(lo(f))!==JSON.stringify(I):f!==I;B(!e)}}),[i,f,I,p?.multiSelect]);const x=()=>{w(null),te(g)&&g(),te(n)&&n({},"backdropClick")};return t(ce,{open:i,anchorEl:o,anchorOrigin:{vertical:"bottom",horizontal:"left"},onClose:(e,t)=>{te(n)&&(n(e,t),x())},sx:{"& .MuiPaper-root":{minWidth:"300px"}},children:[C&&t(a,{alignItems:"flex-end",children:[e(jl,{padding:{padding:"8px"},children:t(a,{direction:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:[t(a,{direction:"row",alignItems:"center",gap:"5px",children:[e(q,{variant:"h6",children:A}),c&&e(q,{variant:"h6",color:"error",children:"*"})]}),e(r,{onClick:x,children:e(Te,{})})]})}),e($,{sx:{width:"100%"}})]}),e(M,{sx:{background:m?E[600]:"transparent",borderRadius:"5px",maxWidth:"300px"},children:l}),d&&e(jl,{padding:{padding:"10px"},children:e(M,{display:"flex",justifyContent:"flex-end",children:e(Rr,{onClick:()=>{w(null),te(s)&&s()},disabled:S,variant:"text",sx:{maxWidth:"40px"},children:"Apply"})})})]})};function lh({selectedFilter:t,control:i,errors:o,setIsPopupOpen:r,autoFocus:n=!1}){const l=J(),{sapphireBlue:a,black:s}=l.palette.app.color,C=o[t.key],{placeholder:d,label:A}=t,c=d??`Select ${A}`,h=d??A;return{autoComplete:t.options&&e(uC,{disableClearable:!0,multiple:t.multiSelect??!1,placeholder:c,name:`${t.key}`,disabled:t.isDisabled,loading:t.loading,shouldCloseOnSelect:t.shouldCloseOnSelect,control:i,options:t.options??[],onOpen:()=>r?.(!0),onClose:()=>r?.(!1),autoFocus:n,sx:{maxHeight:"250px",overflowY:"auto",width:"100%","& .MuiAutocomplete-tag":{backgroundColor:a[300],color:s[900]}},...t.employeeAutocomplete&&{isShowEmployeeData:!0,isShowOptionsOnType:!0,getOptionLabel:e=>"string"==typeof e?e:`${e.label} (${e.employee_code}) - ${e.punch_code}`},error:!!C,helperText:C?.message},t.key),text:e(_A,{name:t.key,control:i,disabled:t.isDisabled,placeholder:h,error:!!C,helperText:C?.message,autoFocus:n}),date:e(YC,{name:t.key,control:i,disabled:t.isDisabled,error:!!C,helperText:C?.message,autoFocus:n,minDate:t.minDate?U.fromISO(t.minDate):void 0,maxDate:t.maxDate?U.fromISO(t.maxDate):void 0,...t.monthYearFormat&&{format:"MMM yyyy",views:["year","month"]}}),dateRange:e(PC,{name:t.key,control:i,disabled:t.isDisabled,error:!!C,helperText:C?.message})}}const ah=({open:i,anchorEl:o,filterItem:r,onClose:n,control:l,errors:s,onApply:C,currentFilterValue:d,reset:A})=>e(nh,{title:r.label,required:r.required,filterItem:r,open:i,onClose:n,anchorEl:o,onApply:C,currentFilterValue:d,reset:A,showFooter:!0,showDivider:!0,background:!0,children:t(jl,{padding:{padding:"10px"},children:[lh({selectedFilter:r,control:l,errors:s})[r.type],"switch"===r.type&&t(a,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{padding:"10px 5px 10px 20px",margin:"auto"},children:[e(q,{variant:"body2",children:r.label}),e(bc,{control:l,name:r.key})]},r.key)]})}),sh=({open:t,anchorEl:i,filterItem:o,onClose:r,control:n,errors:l,onApply:a})=>e(rh,{title:o.label,required:o.required,open:t,onClose:r,anchorEl:i,onApply:a,showDivider:!0,background:!0,children:e(jl,{padding:{padding:"10px"},children:lh({selectedFilter:o,control:n,errors:l})[o.type]})}),Ch=(e,t)=>{let i=e;if(t&&"autoComplete"===t.type&&(i=t.multiSelect&&Array.isArray(e)?t.options?.filter((t=>e.includes(t.value))).map((e=>e.label)).join(", "):t.options?.filter((t=>t.value===e)).map((e=>e.label)).join(", ")),"dateRange"===t.type&&Array.isArray(e)&&2===e.length){i=`${e[0]} <= Start Date <= ${e[1]}`}return i};function dh(e,t){const i=new Map(t.map((e=>[e.key,e])));return Object.fromEntries(Object.entries(e).flatMap((([e,t])=>{if(t){const o=i.get(e);return[[e,o?.monthYearFormat&&"string"==typeof t?U.fromISO(t).toFormat("yyyy-MM"):t]]}return[]})))}const Ah=({filterListItems:o,isDisabled:n=!1,filterListData:l,onApply:s,onClear:C,onChange:d,isSingleCompany:A=!1,defaultComponyId:m,companyKey:f="company_id"})=>{const k=m??void 0,E=J(),{iron:I,slate:w}=E.palette.app.color,{layout:S}=rr(),B="desktop"===S,Q="mobile"===S,[b,v]=h(null),R=p(null),L=p(null),[y,F]=h(!1),[D,Z]=h(!1),[H,K]=h(null),G=p(null),[Y,V]=h(!1),T=c((()=>A?o.filter((({key:e})=>e!==f)):o),[o,A,f]),j=c((()=>new Map(o.map((e=>[e.key,e])))),[o]),W=c((()=>new Map(T.map(((e,t)=>[e.key,t])))),[T]),z=g(((e,t)=>{K(e),L.current=t,Z(!0)}),[]),P=c((()=>function(e){return JSON.stringify(e.map((e=>{const{key:t,multiSelect:i,required:o,type:r,isDefaultCurrentDate:n,value:l,options:a}=e;return[t,i??!1,o??!1,r,n??!1,l??null,"autoComplete"===r&&o&&1===a?.length?a[0]?.value??null:null]})))}(o)),[o]),O=c((()=>{const e=o.reduce(((e,{key:t,multiSelect:i,options:o,required:r,type:n,value:l,isDefaultCurrentDate:a})=>(e[t]="autoComplete"===n&&r&&1===o?.length?i?[o[0]?.value]:o[0]?.value:i||"dateRange"===n?l||null:"switch"===n?l||!1:a&&"date"===n?l||U.now().toISODate():l||null,e)),{});return A&&(e[f]=k),e}),[P,A,k,f]),X=c((()=>function(e,t,i){return JSON.stringify([t,i,e.map((e=>{const{key:t,multiSelect:i,type:o,required:r,label:n}=e;return[t,i??!1,o,r??!1,n]}))])}(o,A,f)),[o,A,f]),_=c((()=>{const e={};o.forEach((({key:t,multiSelect:i,type:o})=>{e[t]=i||"dateRange"===o?no.array(no.string()).nullable().optional():"switch"===o?no.boolean().nullable().optional():no.string().nullable().optional()})),A&&(e[f]=no.string().nullable().optional());const t=o.filter((({key:e,required:t})=>t&&!(A&&e===f)));return no.object(e).superRefine(((e,i)=>{t.forEach((({key:t,required:o,label:r})=>{o&&!e[t]?.length&&i.addIssue({path:[t],message:`${r} is required`,code:no.ZodIssueCode.custom})}))}))}),[X]),ee=c((()=>_i(_)),[_]),{control:te,handleSubmit:ie,setValue:oe,reset:re,getValues:ne,formState:{errors:le,dirtyFields:ae}}=et({values:O,resolver:ee,mode:"all"});c((()=>{T&&0!==T.length&&T.forEach((({key:e,multiSelect:t,options:i,required:o})=>{if(o&&1===i?.length){ne(e)||oe(e,t?[i[0]?.value]:i[0]?.value)}}))}),[T]),u((()=>{A&&oe(f,k)}),[A,k,f]);const se=it({control:te}),Ce=se[f],de=se.business_unit_id,Ae=se.department_id,ce=()=>{v(null)},he=()=>{Ie((()=>{const e=new Set;return T.forEach((({type:t,key:i,required:o},r)=>{"switch"!==t&&(r===ke||O?.[i]||o)&&e.add(i)})),e}))},pe=()=>{const e=A?{...O,[f]:k}:O;re(e),C(),he(),ce()},ue=e=>{const t=e instanceof HTMLElement?e:e.currentTarget;v(t)},ge=e=>{F(!1),K(null);const t=A?{...e,[f]:k}:e,i={...ro(dh(t,o),(e=>oo(e)||N(e))),...A?{[f]:k}:{}};Ie((()=>{const e=new Set;return T.forEach((({type:t,key:o,required:r},n)=>{"switch"!==t&&(n===ke||i[o]||r)&&e.add(o)})),e})),s(i,y,H?.key),ce()},me=e=>j.get(e),fe=c((()=>!!l&&Object.entries(l).some((([e,t])=>(!A||e!==f)&&(!!W.has(e)&&("boolean"==typeof t?t:!oo(t)&&!N(t)))))),[l,W,A,f]),ke=c((()=>T.findIndex((({type:e})=>"switch"!==e&&"dateRange"!==e))),[T]),[Ee,Ie]=h((()=>{const e=new Set;return T.forEach((({type:t,key:i,required:o},r)=>{"switch"!==t&&(r===ke||l?.[i]||O?.[i]||o)&&e.add(i)})),e})),we=g(((e,t)=>{Ie((i=>{const o=new Set(i);return t?o.add(e):o.delete(e),o}))}),[]),Se=H?.key?"switch"===H.key?se[H.key]?"true":"false":se[H.key]:null,Be=c((()=>A?{...se,[f]:k}:se),[f,se,A,k]),xe=p(d);xe.current=d;const Qe=p(void 0),Me=p(y);Me.current=y,u((()=>{io(Qe.current,Be)||(Qe.current=Be,x((()=>{xe.current(Be,Me.current)})))}),[Be]);const be=p(O);u((()=>{io(be.current,O)||(be.current=O,io(ne(),O)||re(O))}),[O,ne,re]),u((()=>{Ie((e=>{const t=new Set;return T.forEach((({type:i,key:o,required:r},n)=>{"switch"!==i&&(n===ke||l?.[o]||O?.[o]||r||e.has(o))&&t.add(o)})),function(e,t){if(e.size!==t.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}(e,t)?e:t}))}),[T,l,O,ke]);const Je=p(o);Je.current=o;const ve=p(Ce);u((()=>{A||y?ve.current=Ce:io(ve.current,Ce)||(ve.current=Ce,Je.current.forEach((({key:e,isDefaultCurrentDate:t,type:i})=>{t&&"date"===i||e!==f&&oe(`${e}`,null)})),oe(f,Ce))}),[Ce,f,A,y]);const Re=p(de);u((()=>{y?Re.current=de:io(Re.current,de)||(Re.current=de,oe("business_unit_location_id",null))}),[de,y,oe]);const Le=p(Ae);u((()=>{y?Le.current=Ae:io(Le.current,Ae)||(Le.current=Ae,oe("sub_department_id",null))}),[Ae,y,oe]);const ye=Boolean(b),Fe=c((()=>0===Object.keys(ae).length&&Object.keys(se).every((e=>!(!A||e!==f)||(oo(se[e])||N(se[e]))))),[se,ae,A]);return nr({key:"f",modifierKeys:["ctrl","shift"],onTrigger:()=>{if(n)return;const e=G.current??document.createElement("button");ue(e)}}),t(M,{sx:{flexGrow:1},children:[t(a,{direction:"row",justifyContent:{xs:"end",md:"space-between"},spacing:1,children:[B&&e(a,{direction:"row",alignItems:"center",sx:{maxWidth:{xs:"40vw",md:"45vw",lg:"57vw"}},children:!!l&&!!fe&&t(i,{children:[e(q,{variant:"body1",sx:{minWidth:"50px",marginRight:"5px"},children:"Filters:"}),e(a,{direction:"row",gap:"5px",alignItems:"center",sx:{flexWrap:"wrap",maxWidth:"100%"},children:(Ue=l,Object.entries(Ue).map((([t,i])=>{const r=(e=>W.get(e)??-1)(t);if(-1===r)return;if("boolean"!=typeof i&&!i)return;const a=me(t),C=T[r],d=a&&Ch(i,a),c=function(e){return Array.isArray(e)?e.join(", "):sr.test(e)?U.fromFormat(e,"yyyy-MM").toFormat("MMM yyyy"):Cr.test(e)?U.fromFormat(e,"yyyy-MM-dd").toFormat("dd-MM-yyyy"):e}("object"==typeof d?JSON.stringify(d):String(d));return"boolean"==typeof i||c?e(Ks,{label:e(xl,{toolTipLabel:`${c}`,children:e(q,{noWrap:!0,variant:"subtitle2",children:`${a?.label}: ${c}`})}),onDelete:()=>(e=>{const t=me(e);if(t?.required)return Ns.error({title:"This is a required custom filter field and cannot be removed."});oe(`${e}`,null);const i={...l};delete i[e],A&&(i[f]=k),s(i,!0,e)})(t),onClick:e=>{((e,t)=>{if(A&&e===f)return;if(e===f&&o?.some((({required:e})=>e)))return;F(!0),R.current=t.currentTarget;const i=me(e);i&&K(i)})(t,e)},disabled:n,shouldDisableFocus:C?.shouldDisableFocus??!1,shouldDisableRipple:C?.shouldDisableRipple??!1},t):void 0})))})]})}),t(a,{direction:"row",alignItems:"flex-start",children:[fe&&e(Rr,{onClick:()=>pe(),variant:"text",sx:{minWidth:{xs:"60px",sm:"100px"}},children:Q?"Clear":"Clear Filter"}),!n&&e(Ul,{isFiltered:fe,onClick:ue,ref:G})]})]}),e("form",{onSubmit:e=>{e.preventDefault(),Fe||ie((e=>{ge(e)}))()},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Y||Fe||ie((e=>{ge(e)}))())},children:t(Pi,{open:ye,onClose:(e,t)=>{"backdropClick"!==t&&ce()},anchor:"right",sx:{zIndex:E.zIndex.drawer+2,"& .MuiPaper-root":{width:"100%",maxWidth:{xs:"270px",sm:"350px"}}},children:[t(a,{sx:{background:I[600]},children:[e(jl,{padding:{padding:"10px 30px"},children:t(a,{direction:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:[e(q,{variant:"h6",children:"Filter"}),e(r,{onClick:()=>{const e=A?{...O,[f]:k}:O;re(e),he(),ce()},children:e(Te,{})})]})}),e($,{sx:{width:"100%"}})]}),e(a,{flexGrow:1,sx:{overflowX:"hidden"},children:T.map(((t,i)=>e(ch,{filter:t,index:i,firstNonSwitchIndex:ke,isExpanded:Ee.has(t.key),onExpandedChange:we,control:te,fieldError:le[t.key],setIsPopupOpen:V,slate600:w[600],dateRangeValue:"dateRange"===t.type?se[t.key]:null,onDateRangeClick:z},t.key)))}),e($,{}),e(a,{children:e(jl,{padding:{padding:"10px"},children:t(bC,{children:[e(Rr,{type:"submit",disabled:Fe,variant:"contained",onClick:()=>{ie(ge)()},children:"Apply"}),e(Rr,{type:"button",onClick:()=>pe(),disabled:Object.keys(se).every((e=>!(!A||e!==f)||!se[e])),variant:"outlined",children:"Reset"})]})})})]})}),H&&e(ah,{open:y,onClose:()=>{H?.key&&oe(`${H?.key}`,l?.[H.key]),F(!1)},onApply:()=>{ie(ge)()},control:te,errors:le,reset:re,anchorEl:R.current,filterItem:H,currentFilterValue:Se}),H&&e(sh,{open:D,onClose:()=>{H?.key&&oe(`${H?.key}`,l?.[H.key]),Z(!1)},onApply:()=>{Z(!1)},control:te,errors:le,anchorEl:L.current,filterItem:H})]});var Ue};const ch=B((function({filter:i,index:o,firstNonSwitchIndex:r,isExpanded:n,onExpandedChange:l,control:s,fieldError:C,setIsPopupOpen:d,slate600:A,dateRangeValue:c,onDateRangeClick:h}){const{type:p,key:u,label:g,required:m,isDisabled:f,menuInfo:k}=i;return"switch"===p?t(a,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"80%",sx:{padding:"10px 5px 10px 20px ",margin:"auto"},children:[e(q,{variant:"body2",children:g}),e(bc,{control:s,name:u})]}):t($i,{expanded:n,onChange:(e,t)=>{l(u,t)},disabled:f,sx:{boxShadow:"none","&.MuiAccordion-root.Mui-expanded":{margin:"0 !important"},"&.MuiAccordion-root.Mui-disabled":{backgroundColor:"transparent"}},children:[e(to,{expandIcon:e(Xi,{}),"aria-controls":"panel1a-content",id:"panel1a-header",sx:{flexDirection:"row-reverse","& MuiAccordionSummary-root.Mui-expanded":{marginRight:"10px",transform:"rotate(-90deg)"},"&.Mui-expanded":{minHeight:"40px",paddingY:"5px"},"& .MuiAccordionSummary-content.Mui-expanded":{margin:"0px"}},children:t(a,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"90%",children:[t(a,{direction:"row",alignItems:"center",gap:"5px",children:[e(q,{variant:"body2",children:g}),m&&e(q,{color:"error",children:"*"})]}),e(q,{variant:"body2",children:k})]})}),e(eo,{sx:{background:A,borderRadius:"5px",padding:"0px"},children:e(jl,{padding:{paddingLeft:"15px",paddingY:"5px",paddingRight:"15px"},children:"dateRange"===p?t(a,{direction:"row",alignItems:"center",gap:"10px",onClick:e=>{h(i,e.currentTarget)},children:[e(M,{sx:{border:"1px solid black",borderRadius:"5px",width:"150px",p:1},children:e(q,{variant:"body2",children:Array.isArray(c)&&c[0]?U.fromISO(c[0]).toFormat(HC.dateWithEuropean):"Start Date"})}),e(q,{children:"~"}),e(M,{sx:{border:"1px solid black",borderRadius:"5px",width:"150px",p:1},children:e(q,{variant:"body2",children:Array.isArray(c)&&c[1]?U.fromISO(c[1]).toFormat(HC.dateWithEuropean):"End Date"})})]}):e(M,{children:lh({selectedFilter:i,control:s,errors:C?{[u]:C}:{},setIsPopupOpen:d,autoFocus:o===r})[p]})})})]})}),(function(e,t){const{index:i,firstNonSwitchIndex:o,isExpanded:r,control:n,fieldError:l,slate600:a,onExpandedChange:s,setIsPopupOpen:C,onDateRangeClick:d,filter:A,dateRangeValue:c}=e,{index:h,firstNonSwitchIndex:p,isExpanded:u,control:g,fieldError:m,slate600:f,onExpandedChange:k,setIsPopupOpen:E,onDateRangeClick:I,filter:w,dateRangeValue:S}=t;if(i!==h||o!==p||r!==u||n!==g||l!==m||a!==f||s!==k||C!==E||d!==I)return!1;const{key:B,type:x,label:Q,required:M,isDisabled:b,loading:J,multiSelect:v,menuInfo:R,options:L,placeholder:y,employeeAutocomplete:F,monthYearFormat:U,minDate:D,maxDate:Z,shouldCloseOnSelect:H}=A,{key:K,type:G,label:Y,required:V,isDisabled:T,loading:j,multiSelect:W,menuInfo:q,options:z,placeholder:P,employeeAutocomplete:O,monthYearFormat:N,minDate:X,maxDate:_,shouldCloseOnSelect:$}=w;return B===K&&x===G&&Q===Y&&M===V&&b===T&&J===j&&v===W&&R===q&&L===z&&y===P&&F===O&&U===N&&D===X&&Z===_&&H===$&&io(c,S)})),hh=({filter:i,control:o})=>{return e(le,{children:(r=i.type,t(a,{direction:"row",width:"100%",justifyContent:"space-between",alignItems:"center",children:[e(q,{variant:"body2",children:i.label}),"switch"===r?e(bc,{control:o,name:i.key}):e(q,{variant:"body2",children:i.menuInfo})]}))});var r},ph=({filterListItems:i})=>{const[o,n]=h(null),l=p(null),[s,C]=h(!1),[d,A]=h(),[c,u]=h(null),{control:g,handleSubmit:m,setValue:f,reset:k,formState:{errors:E},watch:I}=et(),w=()=>{n(null)},S=e=>{C(!1),u(null),w();const t=dh(e,i);A(t)},B=e=>{C(!0),n(null),u(e)},x=e=>i.find((t=>t.key===e)),Q=c?.key?I(c.key):null,b=Boolean(o);return t(a,{children:[t(a,{direction:"row",spacing:1,alignItems:"center",children:[d&&(J=d,Object.entries(J).map((([t,i])=>{if(!i)return;const o=x(t),r=o&&Ch(i,o);return e(Zs,{ref:l,label:e(xl,{toolTipLabel:`${r}`,children:`${o?.label}: ${r}`}),onDelete:()=>(e=>{f(`${e}`,null),A((t=>{const i={...t};return delete i[e],i}))})(t),onClick:e=>{C(!0),l.current=e.currentTarget;const i=x(t);i&&(u(i),B(i))}},t)}))),e(r,{ref:l,onClick:e=>{n(e.currentTarget)},sx:{height:"40px"},children:e(Zn,{})}),e(Rr,{onClick:()=>(k(),void A(void 0)),variant:"text",children:"Clear Filter"})]}),e(nh,{open:b,anchorEl:o,onClose:w,onApply:()=>{m(S)()},children:i.map((t=>e(M,{onClick:()=>"switch"!==t.type&&B(t),children:e(hh,{filter:t,control:g})},t.key)))}),c&&"switch"!==c.type&&e(ah,{open:s,onClose:()=>{C(!1)},onApply:()=>{m(S)()},control:g,currentFilterValue:Q,anchorEl:l.current,filterItem:c,errors:E})]});var J},uh=({text:t,highlightWords:i})=>{const o=J(),{slate:r}=o.palette.app.color;if(!i?.length)return e(M,{component:"span",children:t});const n=i.map((e=>e.replace(ur,"\\$&"))),l=new RegExp(`(${n.join("|")})`,"gi"),a=t.split(l);return e(M,{component:"span",children:a.map(((t,i)=>l.test(t)?e(M,{component:"span",sx:{padding:"2px 4px",backgroundColor:r[800],border:`1px solid ${r[700]}`,borderRadius:"5px",fontFamily:"monospace",fontSize:"0.9em"},children:t},`highlight-${i}-${t}`):e(M,{component:"span",children:t},`text-${i}-${t}`)))})},gh=({label:i,variant:o,colourCode:r})=>t(a,{gap:"10px",direction:"row",alignItems:"center",children:[e(Xn,{variant:o,colourCode:r}),i]}),mh=({color:i,label:o,isBackground:r=!1})=>e(M,{sx:{backgroundColor:`${r?y(i,.2):""}`,width:"max-content",borderRadius:"6px"},children:e(jl,{padding:{padding:r?"5px 8px":"0"},children:t(a,{flexDirection:"row",alignItems:"center",gap:"8px",children:[e(Ti,{sx:{color:i,fontSize:"12px"}}),e(q,{variant:"body2",sx:{fontWeight:500},children:o})]})})}),fh=({count:t,page:i,onPageChange:o,rowsPerPage:r,onRowsPerPageChange:n,sx:l,...a})=>{const s=J(),{grey:C}=s.palette,{layout:d}=rr(),A="mobile"===d;return e(ao,{sx:{"& .MuiInputBase-root":{height:"30px"},"& .MuiToolbar-root":{paddingLeft:0},"& .MuiTablePagination-select":{backgroundColor:"transparent !important"},"& .MuiTablePagination-input":{border:`1.5px solid ${C[400]}`,borderRadius:"5px",fontSize:"13px",padding:A?"2px 10px":"4px 8px"},...l},component:"div",count:t,page:i,onPageChange:o,rowsPerPage:r,onRowsPerPageChange:n,rowsPerPageOptions:[20,50,100,200],defaultValue:100,labelRowsPerPage:A?"":"Rows per page",...a})},kh=({items:i,disabled:o,sx:r})=>{const[n,l]=h(null);return t(M,{sx:{width:"100%",...r},children:[e(Ll,{onClick:e=>{l(e.currentTarget)},disabled:o}),!!n&&e(ql,{open:!0,anchorEl:n,onClose:()=>{l(null)},children:e(jl,{padding:{padding:"2px"},children:i.map((t=>e(M,{children:e(le,{sx:{width:"100%",textAlign:"start"},onClick:()=>{t?.onClick(),l(null)},children:e(q,{variant:"body1",children:t.title})})},t.title)))})})]})},Eh="smart-grid-field-input",Ih=e=>({...e,wrapperMinHeight:e.controlMinHeight+2*e.paddingY}),wh={sm:Ih({controlMinHeight:18,paddingY:2,padding:"2px 6px",autocompletePadding:"2px 2px 2px 6px",fontSize:"12px",borderRadius:"4px",expandIconSize:18,expandMarginLeft:"2px",multipleGap:"2px",chipFontSize:"11px",chipPadding:"1px 6px"}),md:Ih({controlMinHeight:20,paddingY:4,padding:"4px 8px",autocompletePadding:"4px 4px 4px 8px",fontSize:"13px",borderRadius:"4px",expandIconSize:20,expandMarginLeft:"4px",multipleGap:"4px",chipFontSize:"12px",chipPadding:"2px 8px"}),lg:Ih({controlMinHeight:22,paddingY:6,padding:"6px 10px",autocompletePadding:"6px 6px 6px 10px",fontSize:"15px",borderRadius:"6px",expandIconSize:22,expandMarginLeft:"6px",multipleGap:"4px",chipFontSize:"13px",chipPadding:"3px 10px"})},Sh=(e="md")=>wh[e],Bh=e=>e[800],xh=(e,t)=>t?e[800]:e[400],Qh=e=>`\n .${Eh}::placeholder {\n color: ${e};\n opacity: 1;\n }\n .${Eh}:disabled {\n color: ${e};\n -webkit-text-fill-color: ${e};\n }\n`,Mh=(e,t="md")=>{const{controlMinHeight:i,fontSize:o}=Sh(t);return{width:"100%",border:"none",background:"transparent",padding:0,margin:0,fontSize:o,lineHeight:`${i}px`,minHeight:i,outline:"none",color:e}},bh=(e="md",t="text")=>{const{borderRadius:i,autocompletePadding:o,padding:r,wrapperMinHeight:n}=Sh(e);return{alignItems:"center",borderRadius:i,padding:"autocomplete"===t?o:r,minHeight:n,boxSizing:"border-box"}},Jh=({wrapper:i,title:o,position:r})=>{const n=O(),{iron:l}=n.palette.app.color,a=i.getBoundingClientRect(),s={position:"fixed",zIndex:999999,background:l[200],color:l[600],padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",whiteSpace:"nowrap",transition:"opacity 0.2s ease, transform 0.2s ease",opacity:1},C={position:"absolute",width:0,height:0,borderStyle:"solid"};switch(r){case"top":s.top=a.top-28,s.left=a.left+a.width/2,s.transform="translateX(-50%)",Object.assign(C,{borderWidth:"6px 6px 0 6px",borderColor:`${l[200]} transparent transparent transparent`,bottom:-6,left:"50%",transform:"translateX(-50%)"});break;case"bottom":s.top=a.bottom+4,s.left=a.left+a.width/2,s.transform="translateX(-50%)",Object.assign(C,{borderWidth:"0 6px 6px 6px",borderColor:`transparent transparent ${l[200]} transparent`,top:-6,left:"50%",transform:"translateX(-50%)"});break;case"left":s.top=a.top+a.height/2,s.left=a.left-8,s.transform="translateY(-50%)",Object.assign(C,{borderWidth:"6px 0 6px 6px",borderColor:`transparent transparent transparent ${l[200]}`,right:-6,top:"50%",transform:"translateY(-50%)"});break;case"right":s.top=a.top+a.height/2,s.left=a.right+8,s.transform="translateY(-50%)",Object.assign(C,{borderWidth:"6px 6px 6px 0",borderColor:`transparent ${l[200]} transparent transparent`,left:-6,top:"50%",transform:"translateY(-50%)"})}return t("div",{style:s,children:[o,e("div",{style:C})]})},vh=({children:o,title:r,position:n="top",delay:l=50})=>{const[a,s]=h(!1),C=p(null),d=p(null);u((()=>()=>{d.current&&clearTimeout(d.current)}),[]);const A=a&&r&&C.current?Ao(e(Jh,{wrapper:C.current,title:r,position:n}),document.body):null;return t(i,{children:[e("div",{ref:C,style:{display:"inline-block",width:"100%"},onMouseEnter:()=>{d.current&&clearTimeout(d.current),d.current=setTimeout((()=>s(!0)),l)},onMouseLeave:()=>{d.current&&clearTimeout(d.current),s(!1)},children:o}),A]})},Rh={display:"flex",flexDirection:"column",gap:"4px",width:"100%"},Lh={width:"100%"},yh=k((({errorMessage:i,size:o="md",currencySymbol:r,decimalCharacter:n,digitGroupSeparator:l,decimalPlaces:a,decimalPlacesShownOnBlur:s,decimalPlacesShownOnFocus:C,minimumValue:d,maximumValue:A,outputFormat:p="number",textAlign:u,allowNegative:m,suffix:f,preDefined:k,navigationKey:E,disabled:I,name:w,value:S,onChange:B,onBlur:x,onFocus:Q,onKeyDown:M,placeholder:b="",style:v,className:R},L)=>{const y=J(),{butterflyBlue:F,iron:U,lipstickRed:D}=y.palette.app.color,{navigationKey:Z}=Uo(),H=E??Z,[K,G]=h(!1),[Y,V]=h(""),{handleEnterNavigation:T,setInputRef:j}=or({navigationKey:H}),W=c((()=>{const e=k??{},{currencySymbol:t,decimalCharacter:i,digitGroupSeparator:o,decimalPlaces:d,decimalPlacesShownOnBlur:A,decimalPlacesShownOnFocus:c,suffix:h,textAlign:p,allowNegative:g}=e;return{currencySymbol:r??t??"",decimalCharacter:n??i??".",digitGroupSeparator:l??o??",",decimalPlaces:a??d??2,decimalPlacesShownOnBlur:s??A,decimalPlacesShownOnFocus:C??c,suffix:f??h,textAlign:u??p??"right",allowNegative:m??g??!1}}),[m,r,n,a,s,C,l,k,f,u]),{currencySymbol:q,decimalCharacter:z,digitGroupSeparator:P,decimalPlaces:O,decimalPlacesShownOnBlur:N,decimalPlacesShownOnFocus:X,suffix:_,textAlign:$,allowNegative:ee}=W,te=c((()=>null!=d?Number(d):ee?void 0:0),[d,ee]),ie=c((()=>null!=A?Number(A):void 0),[A]),oe=K?X:N??O,re=c((()=>K?Y:null==S||""===S?"":String(S)),[Y,K,S]),ne=c((()=>i?D[900]:K?F[900]:U[800]),[F,i,U,K,D]),le=Bh(U),ae=xh(U,I),{fontSize:se}=Sh(o),Ce=c((()=>Qh(le)),[le]),de=c((()=>bh(o,"text")),[o]),Ae=c((()=>({...Mh(ae,o),textAlign:$,flex:1,minWidth:0,...v})),[ae,$,o,v]),ce=c((()=>({display:"flex",alignItems:"center",border:`2px solid ${ne}`,background:U[600],width:"100%",...de})),[ne,U,de]),he=c((()=>({flexShrink:0,fontSize:se,color:I?U[800]:U[400],marginRight:"4px",userSelect:"none"})),[se,I,U]),pe=c((()=>[Eh,R].filter(Boolean).join(" ")),[R]),ue=c((()=>!1!==P&&P),[P]),ge=g((e=>{j(e),"function"==typeof L?L(e):L&&(L.current=e)}),[L,j]),me=g((e=>{B?.({target:{name:w,value:e??""}})}),[w,B]),fe=g(((e,t)=>{const i=e.value;V(i),"prop"!==t?.source&&me(""!==i?"string"!==p?er(i):i:null)}),[me,p]),ke=g((e=>{e.stopPropagation(),G(!0),V(null==S||""===S?"":String(S)),Q?.(e)}),[Q,S]),Ee=g((e=>{e.stopPropagation(),G(!1),x?.(e)}),[x]),Ie=g((e=>{"enter"!==H||"Enter"!==e.key||e.ctrlKey||e.metaKey||e.altKey||T(e),M?.(e)}),[T,H,M]),we=g((e=>{const{floatValue:t,value:i}=e;return!(!ee&&i.includes("-"))&&(null==t||!(!ee&&t<0)&&((null==te||Number.isNaN(te)||t>=te)&&(null==ie||Number.isNaN(ie)||t<=ie)))}),[ee,ie,te]),Se=g((e=>{e.stopPropagation()}),[]);return t(vh,{title:i??"",position:"top",delay:50,children:[e("style",{children:Ce}),e(so.Root,{disabled:I,name:w,style:Lh,children:e("div",{style:Rh,children:t("div",{style:ce,children:[q?e("span",{style:he,children:q}):null,e(Tt,{customInput:Co,value:re,valueIsNumericString:!0,thousandSeparator:ue,decimalSeparator:z,decimalScale:oe,fixedDecimalScale:!K,allowNegative:ee,suffix:_,isAllowed:we,disabled:I,name:w,placeholder:b,className:pe,style:Ae,onValueChange:fe,onFocus:ke,onBlur:Ee,onKeyDown:Ie,onClick:Se,inputMode:"decimal",getInputRef:ge})]})})})]})}));yh.displayName="SmartCurrencyFieldComponent";const Fh=B(yh,((e,t)=>e.name===t.name&&e.value===t.value&&e.disabled===t.disabled&&e.size===t.size&&e.errorMessage===t.errorMessage&&e.placeholder===t.placeholder&&e.currencySymbol===t.currencySymbol&&e.decimalPlaces===t.decimalPlaces&&e.decimalPlacesShownOnBlur===t.decimalPlacesShownOnBlur&&e.decimalPlacesShownOnFocus===t.decimalPlacesShownOnFocus&&e.allowNegative===t.allowNegative&&e.minimumValue===t.minimumValue&&e.maximumValue===t.maximumValue&&e.digitGroupSeparator===t.digitGroupSeparator&&e.onChange===t.onChange&&e.onBlur===t.onBlur));Fh.displayName="SmartCurrencyField";const Uh=k((function({columns:o,optionsData:r,searchedByColumn:n,labelKey:l,valueKey:a="id",errorMessage:s,loading:C=!1,height:d="400px",dialogSize:A="lg",dialogTitle:u,size:m="md",placeholder:f="",onRowSelect:k,disabled:E,name:I,value:w,onChange:S,onBlur:B,onKeyDown:x,...Q},M){const b=O(),{butterflyBlue:J,iron:v,lipstickRed:R}=b.palette.app.color,{navigationKey:L}=Uo(),[y,F]=h(!1),[U,D]=h(!1),Z=p(null),H=p(null),K=p(null),G=p(null),{handleEnterNavigation:Y}=or({navigationKey:L}),V=c((()=>null==w||""===w?"":String(w)),[w]),T=c((()=>{if(!V)return"";const e=r.find((e=>String(e[a])===V));return e?String(e[l]):""}),[l,r,V,a]),j=c((()=>r.map((e=>({label:String(e[l]),value:String(e[a])})))),[l,r,a]),W=c((()=>y||U?J[900]:s?R[900]:v[800]),[J,s,v,U,y,R]),q=Bh(v),z=xh(v,E),P=c((()=>bh(m,"autocomplete")),[m]),{expandMarginLeft:N,expandIconSize:X}=c((()=>Sh(m)),[m]),_=c((()=>Qh(q)),[q]),$=c((()=>({...Mh(z,m),flex:1,minWidth:0,cursor:E?"default":"pointer"})),[E,z,m]),ee=g((e=>{K.current=e,"function"==typeof M?M(e):M&&(M.current=e)}),[M]),te=g((e=>{const t=K.current;t&&(t.value=e),S?.({target:{name:I,value:e}})}),[I,S]),ie=g((()=>{te(""),k?.(null)}),[te,k]),oe=g((()=>{H.current&&(H.current(),H.current=null),D(!1),F(!1),G.current?.focus()}),[]),re=g((()=>{E||(D(!0),setTimeout((()=>{const e=Z.current?.getTable(),t=document.querySelectorAll(".MuiDialog-root table thead input[type='text']"),i=e?.getAllColumns(),o=i?.findIndex((e=>e.id==n));if(void 0!==o&&o>=0&&t[o]){const e=t[o];e.focus();const i=e=>{const t=e;if("ArrowDown"===t.key){t.preventDefault();const e=document.querySelector(".MuiDialog-root table tbody tr");e&&(e.setAttribute("tabindex","0"),e.focus())}};e.addEventListener("keydown",i),H.current=()=>{e.removeEventListener("keydown",i)}}}),100))}),[E,n]),ne=g((({id:e})=>{const t=r.find((t=>String(t[a])===String(e)));if(!t)return;const i=String(t[a]);te(i),k?.(t),oe()}),[te,oe,k,r,a]),le=g((e=>"Backspace"===e.key&&V?(e.preventDefault(),void ie()):"enter"!==L||"Enter"!==e.key||U||e.ctrlKey||e.metaKey||e.altKey?"Enter"!==e.key&&" "!==e.key&&"ArrowDown"!==e.key||U||E?void x?.(e):(e.preventDefault(),void re()):void Y(e)),[ie,E,re,Y,U,L,x,V]),ae=g((e=>{e.preventDefault(),e.stopPropagation(),E||(U?oe():(F(!0),re()))}),[E,oe,re,U]),se=g((e=>{e.stopPropagation(),E||U||re()}),[E,re,U]),Ce=g((e=>{e.stopPropagation(),F(!0)}),[]),de=g((e=>{e.stopPropagation(),F(!1),B?.(e)}),[B]),Ae=f||"Click to select";return t(i,{children:[t(vh,{title:s??"",position:"top",delay:50,children:[e("style",{children:_}),e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:t("div",{style:{display:"flex",alignItems:"center",border:`2px solid ${W}`,background:v[600],position:"relative",width:"100%",...P},children:[e("input",{ref:G,readOnly:!0,disabled:E,value:T,placeholder:Ae,className:Eh,onClick:se,onFocus:Ce,onBlur:de,onKeyDown:le,style:$}),e("button",{type:"button",tabIndex:-1,"aria-label":U?"Close dialog":"Open dialog",disabled:E,onMouseDown:e=>{e.preventDefault()},onClick:ae,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",padding:0,marginLeft:N,cursor:E?"not-allowed":"pointer",color:E?v[800]:v[400]},children:e(Je,{sx:{fontSize:X,transform:U?"rotate(180deg)":"none",transition:"transform 0.2s ease"}})}),e("select",{...Q,ref:ee,name:I,value:V,disabled:E,tabIndex:-1,"aria-hidden":!0,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0,pointerEvents:"none"},children:0===j.length?e("option",{value:"",disabled:!0,children:"No Options"}):t(i,{children:[e("option",{value:"",children:"Select Option"}),j.map((t=>e("option",{value:t.value,children:t.label},t.value)))]})})]})})]}),e(gC,{open:U,onClose:oe,maxWidth:A,title:u??"Select Option",children:e(pt,{ref:Z,columns:o,data:r,height:d,loading:C,totalCount:r.length,onRowActivate:ne,focusableRowNavigation:!0})})]})}));Object.assign(Uh,{displayName:"SmartDialogSelectComponent"});const Dh=B(Uh,(({name:e,value:t,disabled:i,optionsData:o,columns:r,errorMessage:n,loading:l,placeholder:a,size:s,labelKey:C,valueKey:d,searchedByColumn:A},{name:c,value:h,disabled:p,optionsData:u,columns:g,errorMessage:m,loading:f,placeholder:k,size:E,labelKey:I,valueKey:w,searchedByColumn:S})=>e===c&&t===h&&i===p&&o===u&&r===g&&n===m&&l===f&&a===k&&s===E&&C===I&&d===w&&A===S));Object.assign(Dh,{displayName:"SmartDialogSelect"});const Zh=k((({errorMessage:o,options:r,onBlur:n,onKeyDown:l,...a},s)=>{const C=O(),{butterflyBlue:d,lipstickRed:A,iron:p}=C.palette.app.color,[u,g]=h(!1),{navigationKey:m}=Uo(),{handleEnterNavigation:f}=or({navigationKey:m}),k=c((()=>u?d[900]:o?A[900]:u?d[900]:p[800]),[o,u]);return e(vh,{title:o??"",position:"top",delay:50,children:e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:e("div",{style:{display:"flex",alignItems:"center",border:`2px solid ${k}`,borderRadius:"4px",padding:"4px 8px",background:"white",minHeight:"20px"},children:e("select",{ref:s,...a,style:{width:"100%",border:"none",background:"transparent",padding:"0",fontSize:"13px",outline:"none",cursor:"pointer"},onClick:e=>e.stopPropagation(),onFocus:e=>{e.stopPropagation(),g(!0)},onBlur:e=>{e.stopPropagation(),g(!1),n&&n(e)},onKeyDown:e=>{"enter"!==m||"Enter"!==e.key||e.ctrlKey||e.metaKey||e.altKey||f(e),l?.(e)},children:0===r.length?e("option",{value:"",disabled:!0,children:"No Options"}):t(i,{children:[e("option",{value:"",children:"Select Option"}),r.map((t=>e("option",{value:String(t.value),children:t.label},t.value)))]})})})})})}));Zh.displayName="SmartSelectFieldComponent";const Hh=B(Zh,((e,t)=>e.name===t.name&&e.value===t.value&&e.disabled===t.disabled&&e.options===t.options&&e.errorMessage===t.errorMessage));Hh.displayName="SmartSelectField";const Kh=28,Gh=100,Yh=200,Vh="select-all",Th=({label:e})=>e,jh=({value:e})=>String(e),Wh=e=>jh(e)===Vh,qh=e=>void 0===e||""===e?[]:Array.isArray(e)?[...new Set(e.map(String))]:[String(e)],zh=(e,t)=>t.trim()?Xo({data:e,fieldsToSearch:["label"],term:t.toLowerCase()}):e,Ph=(e,t,i)=>{if(!e.length)return null;if(i&&t.length){const i=new Set(t),o=e.findIndex((e=>!Wh(e)&&i.has(jh(e))));if(o>=0)return o}if(!i&&t[0]){const i=e.findIndex((e=>jh(e)===t[0]));if(i>=0)return i}return 0},Oh=B((function({butterflyBlue:t,checked:i,indeterminate:o=!1,iron:r}){const n=i||o;return e("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"14px",height:"14px",flexShrink:0,borderRadius:"2px",border:`1px solid ${n?t[900]:r[800]}`,background:n?t[900]:r[600],boxSizing:"border-box",pointerEvents:"none"},children:o?e(po,{sx:{fontSize:12,color:`${r[600]} !important`}}):i?e(je,{sx:{fontSize:12,color:`${r[600]} !important`}}):null})})),Nh=B((function({butterflyBlue:i,highlightedIndex:o,indeterminate:r,isSelected:n,iron:l,itemIndex:a,onHighlightIndex:s,onSelectOption:C,option:d,showCheckbox:A,style:c}){return t(ho.Item,{index:a,value:d,disabled:d.disabled,onPointerEnter:()=>{d.disabled||s(a)},onClick:e=>{"preventBaseUIHandler"in e&&e.preventBaseUIHandler(),e.preventDefault(),C(d)},style:e=>{const t=a===o||e.highlighted?l[700]:n&&!A?i[500]:"transparent";return{display:"flex",alignItems:"center",gap:"8px",padding:"0 8px",fontSize:"13px",cursor:d.disabled?"not-allowed":"pointer",boxSizing:"border-box",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",background:t,...c}},children:[A?e(Oh,{butterflyBlue:i,checked:n,indeterminate:r,iron:l}):null,Th(d)]})})),Xh=(t,i,o,r)=>{const{butterflyBlue:n,highlightedIndex:l,iron:a,isAllSelected:s,isShowSelectAll:C,isSomeSelected:d,onHighlightIndex:A,onSelectOption:c,selectedValuesSet:h,showCheckbox:p}=o,u=jh(t),g=Wh(t),m=g?s:h.has(u);return e(Nh,{itemIndex:i,butterflyBlue:n,highlightedIndex:l,indeterminate:g&&C&&d&&!s,isSelected:m,iron:a,onHighlightIndex:A,onSelectOption:c,option:t,showCheckbox:p,style:r},`${u}-${i}`)},_h=B((function({butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:r,isShowSelectAll:n,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValuesSet:C,showCheckbox:d}){const A=ho.useFilteredItems(),c=p(null),h=Re({count:A.length,estimateSize:()=>28,getScrollElement:()=>c.current,overscan:10}),g=h.getVirtualItems();if(u((()=>{null===i||i<0||h.scrollToIndex(i,{align:"auto"})}),[i,h]),!A.length)return null;const m={butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:r,isShowSelectAll:n,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValuesSet:C,showCheckbox:d};return e("div",{ref:c,style:{maxHeight:200,overflowY:"auto",paddingBottom:"4px"},children:e(ho.List,{style:{height:h.getTotalSize(),position:"relative",width:"100%"},children:g.map((({index:e,size:t,start:i})=>{const o=A[e];return o?Xh(o,e,m,{position:"absolute",top:i,left:0,width:"100%",height:t}):null}))})})})),$h=B((function({butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:r,isShowSelectAll:n,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValuesSet:C,showCheckbox:d,virtualized:A}){if(A)return e(_h,{butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:r,isShowSelectAll:n,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValuesSet:C,showCheckbox:d});const c={butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:r,isShowSelectAll:n,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValuesSet:C,showCheckbox:d};return e(ho.List,{style:{maxHeight:200,overflowY:"auto",paddingBottom:"4px"},children:(e,t)=>Xh(e,t,c)})})),ep=B((function({iron:i,label:o,onRemove:r,size:n="md"}){const{chipFontSize:l,chipPadding:a}=c((()=>Sh(n)),[n]);return t("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:a,borderRadius:"12px",background:i[700],color:i[900],fontSize:l,fontWeight:500,lineHeight:1.4,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[o,e("button",{type:"button","aria-label":`Remove ${o}`,onClick:e=>{e.preventDefault(),e.stopPropagation(),r()},style:{border:"none",background:"transparent",color:i[900],cursor:"pointer",padding:0,lineHeight:1,fontSize:l},children:"×"})]})})),tp=k((({containerStyle:o,disabled:r,errorMessage:n,freeSolo:l=!1,isShowCheckbox:a=!0,isShowSelectAll:s=!0,multiple:C=!1,name:d,label:A,onBlur:m,onChange:f,onDropdownOptionSelect:k,onKeyDown:E,options:I,placeholder:w="",required:S=!1,disableClearable:B=!!S,size:x="md",value:Q,defaultValue:M,...b},J)=>{const v=O(),{butterflyBlue:R,iron:L,lipstickRed:y}=v.palette.app.color,{navigationKey:F}=Uo(),[U,D]=h(!1),[Z,H]=h(!1),[K,G]=h(""),Y=p(null),V=p(null),T=p(null),[j,W]=h(!1),q=p(void 0),[z,P]=h(null),N=c((()=>qh(Q)),[Q]),X=C?"":N[0]??"",_=c((()=>C&&s&&I.length?[{label:"Select All",value:Vh},...I]:I),[s,C,I]),$=c((()=>zh(_,C||!Z||j?K:"")),[K,Z,j,_,C]),ee=c((()=>new Set(N)),[N]),te=c((()=>{if(!C||!I.length)return!1;const e=I.filter((e=>!e.disabled));return e.length>0&&e.every((e=>ee.has(jh(e))))}),[C,I,ee]),ie=c((()=>C&&I.some((e=>ee.has(jh(e))))),[C,I,ee]),oe=c((()=>{if(C)return"";const e=I.find((e=>jh(e)===X));return e?Th(e):l&&X?X:""}),[l,C,I,X]),{handleEnterNavigation:re,handleKeyDown:ne,inputRef:le,maintainFocusAfterClose:ae,setInputRef:se}=or({isOpen:Z,navigationKey:F}),Ce=_.length>100,de=c((()=>U||Z?R[900]:n?y[900]:L[800]),[R,n,L,U,Z,y]),Ae=g((e=>{const t=I.find((t=>jh(t)===e));return t?Th(t):e}),[I]),ce=g((e=>{f?.({target:{name:d,value:e}})}),[d,f]),he=g((e=>{const t=T.current;if(t)if(C&&Array.isArray(e)){const i=new Set(e);Array.from(t.options).forEach((e=>{e.selected=i.has(e.value)}))}else C||"string"!=typeof e||(t.value=e)}),[C]),pe=g(((e,t)=>{he(e),ce(e),t&&k(t)}),[ce,k,he]),ue=g(((e="",t)=>{const i=zh(_,e);P(Ph(i,t??N,C))}),[_,C,N]),ge=g((e=>{const t=I.filter((e=>e.disabled)).map((e=>jh(e))),i=e?I.map((e=>jh(e))):t;pe(i),co((()=>{G("")})),ue("",i)}),[pe,ue,I]),me=g((e=>{const t=jh(e);if(Wh(e))ge(!te);else{if(C){const e=N.includes(t)?N.filter((e=>e!==t)):[...N,t];return pe(e,t),co((()=>{G("")})),void ue("",e)}pe(t,t),G(Ae(t)),H(!1),ae()}}),[pe,Ae,ge,te,ae,C,ue,N]),fe=g((e=>{const t=e.trim();if(!t)return;const i=I.find((e=>Th(e).toLowerCase()===t.toLowerCase()||jh(e)===t));if(i)me(i);else{if(C){if(N.includes(t))return;const e=[...N,t];return pe(e,t),co((()=>{G("")})),void ue("",e)}pe(t,t),G(t),H(!1),ae()}}),[pe,me,ae,C,ue,I,N]),ke=g((e=>{const t=N.filter((t=>t!==e));pe(t)}),[pe,N]),Ee=c((()=>!B&&!r&&(C?N.length>0:Boolean(X))),[B,r,C,X,N.length]),Ie=g((e=>{e.preventDefault(),e.stopPropagation();pe(C?[]:""),G(""),W(!1),H(!1),P(null),ae()}),[pe,ae,C]),we=g((()=>{H(!1),W(!1),P(null),G(C?"":oe)}),[C,oe]),Se=g((()=>{H(!0),W(!1),G(C?"":oe),ue()}),[C,ue,oe]),Be=g(((e,t)=>{r||!e&&C&&"item-press"===t?.reason||(H(e),e?(W(!1),G(C?"":oe),ue()):(W(!1),G(C?"":oe),P(null),D(!1)))}),[r,C,ue,oe]),xe=g(((e,t)=>{if(C&&"item-press"===t?.reason){if(G(""),Z){const e=zh(_,"");P(e.length?Ph(e,N,C):null)}}else if(W(!0),G(e),Z){const t=zh(_,e);P(t.length?Ph(t,N,C):null)}}),[Z,_,C,N]),Qe=g((e=>{P(e)}),[]),Me=g((e=>{$.length?P((t=>null===t?"down"===e?0:$.length-1:"down"===e?Math.min(t+1,$.length-1):Math.max(t-1,0))):P(null)}),[$.length]),be=e=>{"preventBaseUIHandler"in e&&e.preventBaseUIHandler()},ve=g((e=>{e.preventDefault(),be(e),Z?Me("ArrowDown"===e.key?"down":"up"):(co((()=>{H(!0),W(!1),G(C?"":oe)})),ue())}),[Z,Me,C,ue,oe]),Re=g((e=>{const t=null!==z?$[z]:void 0;if(t)return e.preventDefault(),be(e),void me(t);l&&K.trim()&&(e.preventDefault(),be(e),fe(K))}),[fe,$,l,me,z,K]),Le=g((e=>{if(!("ArrowDown"===e.key||"ArrowUp"===e.key)||r)return"Tab"===e.key&&Z?(H(!1),void ae()):"enter"!==F||"Enter"!==e.key||Z||e.ctrlKey||e.metaKey||e.altKey?void("Enter"===e.key&&Z?Re(e):(ne(e,(()=>{H(!1),ae()}),Z),E?.(e))):(e.preventDefault(),e.stopPropagation(),void re(e));ve(e)}),[r,ve,re,ne,Re,Z,ae,F,E]),ye=g((e=>{const t=e.relatedTarget;window.setTimeout((()=>{if(t&&(Y.current?.contains(t)||V.current?.contains(t)))return;const e=document.activeElement;Y.current?.contains(e)||V.current?.contains(e)||(Z&&(l&&K.trim()&&fe(K),we()),D(!1))}),0),m?.(e)}),[we,fe,l,K,Z,m]),Fe=g((e=>{e.preventDefault(),e.stopPropagation(),r||(Z?(we(),D(!1)):(Se(),D(!0),le.current?.focus()))}),[we,r,le,Z,Se]);u((()=>{Z||(G(C?"":oe),W(!1))}),[Z,C,oe]),u((()=>{q.current=null!==z?$[z]:void 0}),[$,z]);const Ue=c((()=>{if(!I.length&&!N.length)return e("option",{value:"",disabled:!0,children:"No Options"});const o=new Set(I.map(jh)),r=N.filter((e=>!o.has(e)));return t(i,{children:[C?null:e("option",{value:"",children:"Select Option"}),I.map((t=>e("option",{value:jh(t),children:Th(t)},jh(t)))),r.map((t=>e("option",{value:t,children:t},t)))]})}),[C,I,N]),De=g((e=>{T.current=e,"function"==typeof J?J(e):J&&(J.current=e)}),[J]),Ze=g(((e,t)=>!t.trim()||Xo({data:[e],fieldsToSearch:["label"],term:t.toLowerCase()}).length>0),[]),He=L,Ke=R,Ge=C&&a,Ye={width:"var(--anchor-width)",minWidth:"var(--anchor-width)",maxWidth:"var(--anchor-width)"},Ve=Bh(L),je=xh(L,r),We=Sh(x),qe=c((()=>Qh(Ve)),[Ve]),ze=c((()=>bh(x,"autocomplete")),[x]),Pe=c((()=>({...Mh(je,x),flex:1,minWidth:C?"80px":0,cursor:r?"default":"text"})),[r,je,C,x]);return t(vh,{title:n??"",position:"top",delay:50,children:[e("style",{children:qe}),e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",...o},children:t(ho.Root,{items:_,value:K,onValueChange:xe,open:Z,onOpenChange:Be,disabled:r,name:d,autoHighlight:!1,keepHighlight:!0,virtualized:Ce,openOnInputClick:!0,filter:Ze,filteredItems:$,itemToStringValue:Th,onItemHighlighted:(e,t)=>{q.current=e,t.index>=0&&P(t.index)},children:[t("div",{ref:Y,style:{display:"flex",alignItems:"center",flexWrap:C?"wrap":"nowrap",gap:C?We.multipleGap:void 0,border:`2px solid ${de}`,background:L[600],position:"relative",width:"100%",...ze},children:[C?N.map((t=>e(ep,{iron:He,size:x,label:Ae(t),onRemove:()=>{ke(t)}},t))):null,e(ho.Input,{ref:se,disabled:r,className:Eh,placeholder:C&&X?.length?"":w||`Select ${A??"Option"}`,onClick:e=>{e.stopPropagation()},onFocus:e=>{e.stopPropagation(),D(!0),r||Z||document.activeElement!==e.currentTarget||Se()},onBlur:ye,onKeyDown:Le,style:Pe}),Ee?e("button",{type:"button",tabIndex:-1,"aria-label":"Clear selection",onMouseDown:e=>{e.preventDefault()},onClick:Ie,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",padding:0,marginLeft:We.expandMarginLeft,cursor:"pointer",color:L[400]},children:e(Te,{sx:{fontSize:We.expandIconSize-4}})}):null,e("button",{type:"button",tabIndex:-1,"aria-label":Z?"Close options":"Open options",disabled:r,onMouseDown:e=>{e.preventDefault()},onClick:Fe,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",padding:0,marginLeft:We.expandMarginLeft,cursor:r?"not-allowed":"pointer",color:r?L[800]:L[400]},children:e(Je,{sx:{fontSize:We.expandIconSize,transform:Z?"rotate(180deg)":"none",transition:"transform 0.2s ease"}})}),e("select",{...b,ref:De,name:d,value:C?void 0:X,multiple:C,disabled:r,required:S,tabIndex:-1,"aria-hidden":!0,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0,pointerEvents:"none"},children:Ue})]}),e(ho.Portal,{children:e(ho.Positioner,{anchor:Y,sideOffset:2,align:"start",style:{zIndex:999,...Ye},children:t(ho.Popup,{ref:V,style:{...Ye,background:L[600],border:`1px solid ${L[300]}`,boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",borderRadius:"4px",overflow:"hidden"},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.stopPropagation()},children:[e(ho.Empty,{children:e("div",{style:{padding:We.padding,fontSize:We.fontSize,color:L[800]},children:"No Options"})}),e($h,{butterflyBlue:Ke,highlightedIndex:z,iron:He,isAllSelected:te,isShowSelectAll:s,isSomeSelected:ie,onHighlightIndex:Qe,onSelectOption:me,selectedValuesSet:ee,showCheckbox:Ge,virtualized:Ce})]})})})]})})]})}));tp.displayName="SmartAutoCompleteFieldComponent";const ip=B(tp,(({name:e,value:t,disabled:i,options:o,errorMessage:r,freeSolo:n,multiple:l,isShowSelectAll:a,isShowCheckbox:s,placeholder:C,required:d,disableClearable:A,size:c},{name:h,value:p,disabled:u,options:g,errorMessage:m,freeSolo:f,multiple:k,isShowSelectAll:E,isShowCheckbox:I,placeholder:w,required:S,disableClearable:B,size:x})=>e===h&&t===p&&i===u&&o===g&&r===m&&n===f&&l===k&&a===E&&s===I&&C===w&&d===S&&A===B&&c===x));ip.displayName="SmartAutoCompleteField";const op=k((({errorMessage:t,onKeyDown:i,onBlur:o,onFocus:r,onClick:n,...l},a)=>{const s=O(),{type:C,disabled:d}=l,{butterflyBlue:A,lipstickRed:p,iron:u}=s.palette.app.color,[g,m]=h(!1),{navigationKey:f}=Uo(),{handleEnterNavigation:k}=or({navigationKey:f}),E=c((()=>d?u[700]:g?A[900]:t?p[900]:u[800]),[d,t,g]);return e(vh,{title:t??"",position:"top",delay:50,children:e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:e("div",{style:{display:"flex",alignItems:"center",border:"checkbox"===C?"none":`2px solid ${E}`,borderRadius:"4px",padding:"4px 8px",background:d?u[50]:"white",minHeight:"20px"},children:e("input",{ref:a,...l,style:{width:"100%",border:"none",background:"transparent",padding:"0",fontSize:"13px",outline:"none"},onClick:e=>{e.stopPropagation(),n?.(e)},onFocus:e=>{e.stopPropagation(),r?.(e),m(!0)},onBlur:e=>{e.stopPropagation(),o?.(e),m(!1)},onKeyDown:e=>{"enter"!==f||"Enter"!==e.key||"checkbox"===C||e.ctrlKey||e.metaKey||e.altKey||k(e),i?.(e)}})})})})}));op.displayName="SmartTextFieldComponent";const rp=B(op,((e,t)=>e.name===t.name&&e.value===t.value&&e.checked===t.checked&&e.disabled===t.disabled&&e.type===t.type&&e.errorMessage===t.errorMessage));rp.displayName="SmartTextField";const np=k((({errorMessage:i,onKeyDown:o,onFocus:r,onBlur:n,style:l,className:a,size:s="md",...C},d)=>{const A=O(),{type:p,disabled:u,name:m}=C,{butterflyBlue:f,lipstickRed:k,iron:E}=A.palette.app.color,I=Bh(E),w=xh(E,u),[S,B]=h(!1),{navigationKey:x}=Uo(),{handleEnterNavigation:Q,setInputRef:M}=or({navigationKey:x}),b="checkbox"===p,J=c((()=>i?k[900]:S?f[900]:E[800]),[f,i,E,S,k]),v=c((()=>Qh(I)),[I]),R=c((()=>bh(s,"text")),[s]),L=c((()=>({...Mh(w,s),...l})),[s,l,w]),y=[Eh,a].filter(Boolean).join(" "),F=g((e=>{b||M(e),"function"==typeof d?d(e):d&&(d.current=e)}),[b,d,M]),U=e=>{"enter"!==x||"Enter"!==e.key||b||e.ctrlKey||e.metaKey||e.altKey||Q(e),o?.(e)},D=e=>{e.stopPropagation(),B(!0),r?.(e)},Z=e=>{e.stopPropagation(),B(!1),n?.(e)},H=e(b?"input":Co,{ref:F,...C,disabled:u,className:y,style:L,onClick:e=>{e.stopPropagation()},onFocus:D,onBlur:Z,onKeyDown:U});return t(vh,{title:i??"",position:"top",delay:50,children:[b?null:e("style",{children:v}),e(so.Root,{disabled:u,name:m,style:{width:"100%"},children:e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:e("div",{style:{display:"flex",alignItems:"center",border:b?"none":`2px solid ${J}`,background:E[600],width:"100%",...R},children:H})})})]})}));np.displayName="SmartTextFieldV2Component";const lp=B(np,(({name:e,value:t,checked:i,disabled:o,type:r,size:n,errorMessage:l,placeholder:a},{name:s,value:C,checked:d,disabled:A,type:c,size:h,errorMessage:p,placeholder:u})=>e===s&&t===C&&i===d&&o===A&&r===c&&n===h&&l===p&&a===u));function ap({items:i,disabled:o=!1,avoidDeleteFocus:n=!1}){const[l,a]=h(null),s=!!l,d=J(),A=d.palette.app.color.red?.[900]??d.palette.error.main,g=p(null),m=p([]),f=c((()=>(i??[]).filter((({isView:e})=>!e))),[i]),k=()=>a(null),E=e=>"delete"===e.toLowerCase();u((()=>{const e=g.current;if(!e)return;const t=t=>{o||"Enter"===t.key&&(t.preventDefault(),a(e))};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[o]);const I=e=>{const t=m.current;if(!t.length)return;const i=document.activeElement,o=t.findIndex((e=>e===i)),r=-1!==o?o:1===e?-1:t.length;for(let i=1;i<=t.length;i++){const o=(r+i*e+t.length)%t.length,l=t[o],a=f[o]?.title??"";if(l&&(!n||!E(a)))return void l.focus()}};return u((()=>{s&&n&&f.length&&requestAnimationFrame((()=>I(1)))}),[n,f.length,s]),f.length?t(M,{sx:{width:"100%"},children:[e(r,{ref:g,component:"div",sx:{width:"100%",cursor:"pointer",alignItems:"center"},onClick:e=>{o||a(e.currentTarget)},disabled:o,"data-clickable":"true",children:e(Ae,{})}),l&&e(ce,{open:!0,anchorEl:l,onClose:k,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{onKeyDown:e=>{n&&("ArrowDown"===e.key&&(e.preventDefault(),I(1)),"ArrowUp"===e.key&&(e.preventDefault(),I(-1)))}}},children:e(jl,{padding:{padding:"2px"},children:f.map((({title:t,onClick:i,href:o},r)=>{const l=E(t);return e(M,{children:e(le,{...o?{component:C,href:o,prefetch:!1}:{},ref:e=>{m.current[r]=e},sx:{borderRadius:"4px",color:l?A:void 0,width:"100%",textAlign:"start",padding:"5px 16px 5px 10px"},tabIndex:l&&n?-1:0,onClick:()=>{i?.(),k()},children:e(q,{variant:"body1",children:t})})},t)}))})})]}):null}lp.displayName="SmartTextFieldV2";const sp=({orientation:t="horizontal",activeStep:i=0,stepLabelProps:o={},steps:r,errorSteps:n=[],onStepClick:l,showActiveStepIcon:a,showTooltips:s=!1,showStepLabels:C=!0,...d})=>{const A=J(),{butterflyBlue:c,red:h}=A.palette.app.color;return e(M,{children:e(mo,{activeStep:i,orientation:t,...d,children:r.map(((t,i)=>{const r=n.includes(i),a=e(go,{...o,error:r,sx:{cursor:l?"pointer":"default",".Mui-active .MuiStepIcon-root":{color:`${c[900]} !important`},".Mui-completed .MuiStepIcon-root":{color:`${c[900]} !important`},...r&&{".MuiStepIcon-root":{color:`${h[900]} !important`},".MuiStepLabel-label":{color:`${h[900]} !important`}},...o.sx},onClick:()=>(e=>{l&&l(e)})(i),children:C&&e(q,{variant:"body2",children:t})});return e(uo,{children:s?e(W,{title:t,placement:"top",children:a}):a},t)}))})})},Cp=v(fo)((({theme:e})=>({[`&.${ko.alternativeLabel}`]:{top:10,left:"calc(-50% + 16px)",right:"calc(50% + 16px)"},[`&.${ko.active}`]:{[`& .${ko.line}`]:{borderColor:"#784af4"}},[`&.${ko.completed}`]:{[`& .${ko.line}`]:{borderColor:"#784af4"}},[`& .${ko.line}`]:{borderColor:"#eaeaf0",borderTopWidth:3,borderRadius:1,...e.applyStyles("dark",{borderColor:e.palette.grey[800]})}}))),dp=v("div")((({theme:e})=>({color:"#eaeaf0",display:"flex",height:22,alignItems:"center","& .QontoStepIcon-completedIcon":{color:"#784af4",zIndex:1,fontSize:18},"& .QontoStepIcon-circle":{width:8,height:8,borderRadius:"50%",backgroundColor:"currentColor"},...e.applyStyles("dark",{color:e.palette.grey[700]}),variants:[{props:({ownerState:e})=>e.active,style:{color:"#784af4"}}]})));function Ap(t){const{active:i,completed:o,className:r}=t;return e(dp,{ownerState:{active:i},className:r,children:o?e(je,{className:"QontoStepIcon-completedIcon"}):e("div",{className:"QontoStepIcon-circle"})})}const cp=({steps:t,alternativeLabel:i=!0,stepLabelProps:o={},...r})=>e(a,{sx:{width:"100%"},spacing:4,children:e(mo,{alternativeLabel:i,activeStep:1,connector:e(Cp,{}),...r,children:t.map((t=>e(uo,{children:e(go,{StepIconComponent:Ap,...o,children:t})},t)))})}),hp=({orientation:o="horizontal",activeStep:r=0,stepLabelProps:n={},steps:l,...s})=>{const C=J(),{butterflyBlue:d}=C.palette.app.color;return e(M,{children:e(mo,{activeStep:r,orientation:o,...s,children:l.map(((o,r)=>e(uo,{children:e(go,{...n,sx:{".Mui-active .css-18pqgpd-MuiSvgIcon-root-MuiStepIcon-root":{color:`${d[900]} !important`},".Mui-completed .MuiStepIcon-root":{color:`${d[900]} !important`},".MuiStepIcon-text":{color:"transparent !important",display:"none"}},children:e(a,{children:t(i,o?.in_time?{children:[e(q,{variant:"caption",children:"In at"}),e(q,{variant:"caption",children:o?.in_time})]}:{children:[e(q,{variant:"caption",children:"Out at"}),e(q,{variant:"caption",children:o?.out_time})]})})})},r)))})})},pp=()=>e(M,{flex:1,children:e(we,{height:"30px",sx:{maxWidth:"200px",transform:"scale(1)"}})}),up={small:{minHeight:"36px !important",height:"36px !important",fontSize:"12px !important",padding:"10px 5px !important"},medium:{minHeight:"48px !important",height:"48px !important",fontSize:"13px !important",padding:"12px 16px !important"},large:{minHeight:"52px !important",height:"52px !important",fontSize:"14px !important",padding:"14px 18px !important"}},gp={small:{minHeight:"36px !important",height:"36px !important"},medium:{minHeight:"48px !important",height:"48px !important"},large:{minHeight:"52px !important",height:"52px !important"}},mp=({tabs:t,value:i,loading:o,tabProps:r,role:n,size:l="medium"})=>o?e(a,{gap:"10px",direction:"row",children:t.map((()=>e(pp,{},ti())))}):e(Io,{value:i,role:n,sx:{...gp[l],"& .MuiTabs-scroller":{minHeight:"inherit",height:"inherit"},"& .MuiTabs-flexContainer":{minHeight:"inherit",height:"inherit"},"& .MuiTab-root.MuiButtonBase-root":{...up[l]}},children:t.filter((({isView:e})=>!1!==e)).map((({iconPosition:t="end",toolTipLabel:i="",icon:n,href:l,target:a,...s},d)=>{const A=l?{component:C,href:l,target:a,prefetch:!1}:{},c=ye(s,["isView"]);return I(Eo,{...A,key:c.value??d,icon:i?e(xl,{toolTipLabel:i,placement:"bottom",children:n}):n,disabled:o,iconPosition:t,...c,...r})}))});function fp({label:i,value:o,menu:r,trimLabel:n=!0,activeTab:l,index:s,onArrowClick:d,menuAnchor:A,onAction:c,href:h,target:p,...u}){const g=J(),{butterflyBlue:m}=g.palette.app.color,f=o===l.value,k=i.toLowerCase().replaceAll(/[ _]/g,"-"),E=xo(i,{length:n?15:i.length,omission:n?"...":""}),I={title:"Edit",onClick:()=>c&&c("editTemplate",l)},w={title:"Delete",onClick:()=>c&&c("deleteTemplate",l)},S=h?{component:C,href:h,target:p,prefetch:!1}:{},B={iconPosition:"end","data-cy":k,"data-ptag":k,value:o??s,label:t(a,{direction:"row",gap:"6px",alignItems:"center",children:[e(q,{variant:"body1",sx:{whiteSpace:"nowrap"},children:f?i:E}),f&&s>0&&e(zl,{items:[I,w]})]})};return i.length>15&&!f&&(B.title=i),o===l.value&&r?.length&&(B.icon=e(oe,{onClick:d,id:`tabDropDown-${o}`,"aria-controls":null!==A?`dropDownMenu-${o}`:void 0,"aria-expanded":null!==A?"true":void 0,"aria-haspopup":"true","data-cy":`${k}-arrowicon`,"data-ptag":`${k}-arrowicon`})),e(Eo,{sx:{borderBottom:"2px solid",borderBottomColor:f?m[900]:"white",overflow:"visible",[`&.${Bo.root}`]:{minHeight:"40px",height:"40px",paddingLeft:f&&s>0?"15px":"10px"},"&:hover":{backgroundColor:m[500]}},...B,...S,...u})}function kp({tabs:t,activeTab:o,menuAnchor:r,onClose:a,onMenuItemClick:s}){return e(i,{children:t.filter((e=>!!e.menu)).map((t=>e(n,{anchorEl:r,open:t.value===o.value&&!!r,onClose:a,id:`dropDownMenu-${t.value}`,MenuListProps:{"aria-labelledby":`tabDropDown-${t.value}`},children:t.menu?.map((({label:t,disabled:i,onClick:r,href:n,target:a})=>e(l,{onClick:()=>{s(),r(o)},disabled:i,...n?{component:C,href:n,target:a,prefetch:!1}:{},children:t},t)))},t.value)))})}function Ep({tabs:i,onChange:o,addButton:r,actionButton:n,ariaLabel:l,activeIndex:s=0,onAction:C}){const d=J(),[A,c]=h(i[s]),[p,g]=h(null);u((()=>{-1===i.findIndex((e=>e.value===A.value))&&(o&&i[0]&&o(i[0]),c(i[0]))}),[i,A,o]),u((()=>{c(i[s])}),[s]);return t(M,{children:[e(kp,{activeTab:A,tabs:i,onClose:()=>g(null),onMenuItemClick:()=>g(null),menuAnchor:p}),t(a,{direction:"row",justifyContent:"space-between",sx:{borderBlockEnd:"solid 1px",borderColor:d.palette.app.color.iron[700]},children:[t(a,{direction:"row",gap:"5px",alignItems:"center",overflow:"hidden",children:[e(a,{direction:"row",overflow:"hidden",children:e(Io,{value:i.some((e=>e.value===A.value))?A.value:i[0]?.value,onChange:(e,t)=>{const r=i.find((e=>e.value===t));r&&(c(r),o&&r&&o(r))},TabIndicatorProps:{sx:{display:"none"}},sx:{[`&.${wo.root}`]:{minHeight:"40px",height:"40px"}},variant:"scrollable",scrollButtons:"auto",ScrollButtonComponent:So,"aria-label":l??"Tabs",children:i.map(((t,i)=>e(fp,{index:i,activeTab:A,onArrowClick:e=>{g(e.target)},onAction:C,menuAnchor:p,...t},t.value)))})}),r]}),e(a,{direction:"row",gap:"10px",alignItems:"center",justifyContent:"space-between",children:n})]})]})}const Ip=({variant:i,leaveColor:o,toolTipLabel:r})=>{const n=Ro(i);return t(a,{sx:{position:"relative",width:"100%",alignItems:"center"},children:[e(M,{sx:{position:"absolute",backgroundColor:"#ffffff",border:`1px solid ${o??n}`,borderRadius:"7px",padding:"0px 5px",zIndex:1,color:`${o??n}`,height:"28px",display:"flex",alignItems:"center",cursor:"pointer"},children:e(xl,{toolTipLabel:r,children:Lo(i)})}),e(ui,{valueLabelDisplay:"off",value:[0,2],max:2,step:1,sx:{"& .MuiSlider-track":{background:`${o??n}`,height:"2px",border:"none"},"& .MuiSlider-thumb":{backgroundColor:`${o??n}`,height:8,width:8},"& .MuiSlider-rail":{backgroundColor:"transparent"}}})]})},wp=({totalDots:i,intervals:o,startTimeline:r})=>e(M,{sx:{position:"relative",width:"100%",height:4},children:o?.map(((o,n)=>{const l=Go(o.in_time),s=Go(o.out_time),C=U.fromISO(o.in_time),d=U.fromISO(o.out_time).diff(C,["hours","minutes"]).toFormat("hh:mm");let A=Sp(l),c=Sp(s);const h=!isNaN(A),p=!isNaN(c);h&&A<r&&(A+=i),p&&(c<r&&(c+=i),h&&c<A&&(c+=i));let u="",g="";h&&(u=`In time : ${l} ${p?"":" / Missing punch"}`),p&&(g=`Out time : ${s} ${h?"":"/ Missing punch"}`);const m=o?.name??`In/Out: ${Go(o.in_time)} - ${Go(o.out_time)} (${d})`,f=o?.color??Ro(o.status_type),k=h?(A-r)/i*100:0,E=p?(c-r)/i*100:0,I=h&&p?Math.max(E-k,0):0;return t(a,{direction:"row",children:[h&&e(W,{arrow:!0,title:u,placement:"top",children:e(M,{sx:{height:8,width:8,position:"absolute",left:`${k}%`,boxShadow:"none",backgroundColor:f,borderRadius:"50%",top:"15px",zIndex:3,"&:focus, &:hover, &:active":{boxShadow:"none"}}})}),h&&p&&e(W,{arrow:!0,title:m,placement:"top",children:e(M,{sx:{position:"absolute",left:`${k}%`,width:`${I}%`,height:3.5,top:"17.5px",backgroundColor:f,zIndex:2}})}),p&&e(W,{arrow:!0,title:g,placement:"top",children:e(M,{sx:{height:8,width:8,position:"absolute",left:`${E}%`,boxShadow:"none",backgroundColor:f,borderRadius:"50%",top:"15px",zIndex:3,"&:focus, &:hover, &:active":{boxShadow:"none"}}})})]},n)}))}),Sp=e=>{const t=U.fromFormat(e,"HH:mm");return t.hour+t.minute/60},Bp=({totalDots:i,highlightedIntervals:o,shiftStartTime:r,shiftEndTime:n,startTimeline:l="2024-11-17T18:30:04.000Z"})=>{const s=parseFloat(Go(l)),C=(e,t,o)=>{const r=Go(e),n=Go(t);let l=Sp(r),a=Sp(n);return l=l<s?l+i:l,a=a<l?a+i:a,"END"===o?a:l},d=e=>{const t=(e+s)%i;return o.some((e=>t>=parseFloat(Go(e.in_time))&&t<=parseFloat(Go(e.out_time))))},A=Array.from({length:i},((e,t)=>({value:(t+s)%i,label:"",highlighted:d((t+s)%i)})));return t(a,{sx:{position:"relative",width:"100%"},children:[e(wp,{totalDots:i,intervals:o,startTimeline:s}),e(W,{title:`Shift Start: ${Go(r)}`,arrow:!0,placement:"top",children:e(M,{sx:{cursor:"pointer",position:"absolute",top:"12px",zIndex:2,left:(C(r,n,"START")-s)%i/i*100+"%"},children:e(Zr,{})})}),e(W,{title:`Shift End: ${Go(n)}`,arrow:!0,placement:"top",children:e(M,{sx:{cursor:"pointer",position:"absolute",top:"12px",zIndex:2,left:(C(r,n,"END")-s)%i/(i-.6)*100+"%"},children:e(Zr,{})})}),e(ui,{disabled:!0,valueLabelDisplay:"off",marks:A,max:i-1,step:1,value:[],sx:{zIndex:1,"& .MuiSlider-track":{background:"transparent",height:1,border:"none"},"& .MuiSlider-mark":{backgroundColor:"gray",height:4,width:4,borderRadius:"50%"},"& .MuiSlider-markActive":{backgroundColor:"transparent",height:5,width:5},"& .MuiSlider-rail":{height:2,backgroundColor:"#929292"},"& .MuiSlider-thumb":{display:"none"}}})]})},xp=v(se,{shouldForwardProp:e=>"isParent"!==e&&"borderColor"!==e&&"backgroundColor"!==e&&"baseColor"!==e})((({theme:e,isParent:t,borderColor:i,backgroundColor:o,baseColor:r})=>({width:"auto",minWidth:0,padding:e.spacing(1),borderRadius:12,border:`1px solid ${i}`,boxShadow:t?`0 6px 18px ${y(r,.2)}`:"none",backgroundColor:o,display:"flex",alignItems:"center",gap:e.spacing(1),minHeight:40,overflow:"hidden",flex:"1 1 auto",[e.breakpoints.down("sm")]:{flex:"1 1 100%"}}))),Qp=({node:i,innerRef:o,isParent:r=!1,themeColor:n})=>{const{id:l,title:a,subtitle:s,value:C}=i,d=J(),{butterflyBlue:A,slate:c}=d.palette.app.color,h=n??A[900],p=r?h:y(h,.7),u=r?y(h,.1):"none",g=c[900];return t(xp,{elevation:r?3:0,ref:o,isParent:r,borderColor:p,backgroundColor:u,baseColor:h,children:[t(M,{children:[e(q,{variant:"subtitle2",noWrap:!0,children:a}),e(q,{variant:"subtitle2",color:g,noWrap:!0,children:s})]}),e(jl,{padding:{paddingLeft:1},children:e(M,{sx:{ml:"auto",textAlign:"right"},children:e(q,{noWrap:!0,variant:"body2",children:C})})})]},l)},Mp=({node:i,setRef:o,themeColor:r,itemWidth:n})=>{const{id:l,children:s}=i,C=!!s?.length;return t(M,{sx:{display:"flex",gap:3,alignItems:"flex-start",flex:`1 0 ${n}`},children:[e(Qp,{node:i,isParent:C,innerRef:e=>o(l,e),themeColor:r}),C&&e(a,{spacing:1,sx:{mt:.5},children:de(s,(t=>e(Mp,{node:t,setRef:o,themeColor:r,itemWidth:n},t.id)))})]},l)},bp=({node:i,setRef:o,themeColor:r})=>{const{id:n,children:l}=i,s=!!l?.length;return t(a,{gap:1,children:[e(Qp,{node:i,isParent:s,innerRef:e=>o(n,e),themeColor:r}),s&&e(jl,{padding:{paddingLeft:3,paddingTop:1},children:e(a,{spacing:1,children:de(l,(t=>e(bp,{node:t,setRef:o,themeColor:r},t.id)))})})]},n)},Jp=({nodes:i,direction:o="horizontal",columns:r=3,color:n})=>{const{isMobile:l}=rr(),s=p({}),C=p(null),d=p(null),A=p(null),[c,g]=h([]),m=(e,t)=>{if(t)return s.current[e]=t,void(A.current&&A.current.observe(t));s.current=ye(s.current,e)},f=e=>e?e.getBoundingClientRect():null,k=(e,t,i)=>{Qo(e,(e=>{const{id:r,children:n}=e;if(!n?.length)return;const a=s.current[r];if(!a)return;const C=f(a);C&&Qo(n,(e=>{const{id:r,children:n}=e,a=s.current[r];if(!a)return;const d=f(a);if(!d)return;const A=l||"vertical"===o?((e,t,i)=>{const{left:o,width:r,bottom:n}=e,{left:l,width:a,top:s}=t,{left:C,top:d}=i,A=o+r/2-C,c=n-d,h=l+a/2-C,p=s-d,u=c+Math.max(12,(p-c)/2);return`M ${A} ${c} C ${A} ${u} ${h} ${u} ${h} ${p}`})(C,d,t):((e,t,i)=>{const{right:o,top:r,height:n}=e,{left:l,top:a,height:s}=t,{left:C,top:d}=i,A=o-C,c=r+n/2-d,h=l-C,p=a+s/2-d,u=h-A,g=Math.abs(u),m=Math.min(120,Math.max(24,g/2)),f=u>=0?1:-1;return`M ${A} ${c} C ${A+m*f} ${c} ${h-m*f} ${p} ${h} ${p}`})(C,d,t);i.push({definition:A}),n?.length&&k([e],t,i)}))}))};u((()=>{const e=()=>requestAnimationFrame((()=>{(()=>{const e=d.current,t=C.current;if(!e||!t)return;const o=t.clientWidth;e.setAttribute("width",String(o)),e.setAttribute("height","auto");const r=t.getBoundingClientRect(),n=[];k(i,r,n),g(n)})()})),t=e(),o=new ResizeObserver(e);A.current=o,C.current&&o.observe(C.current),Ze(s.current).forEach((e=>o.observe(e)));const r=e;return window.addEventListener("resize",r),()=>{cancelAnimationFrame(t),o.disconnect(),A.current=null,window.removeEventListener("resize",r)}}),[i,l,o]);const E=`calc(${100/r}% - 24px)`;return t(M,{ref:C,variant:"outlined",component:se,position:"relative",sx:{overflowX:"hidden",overflowY:"visible"},children:[e(On,{ref:d,paths:c,strokeColor:n}),e(jl,l||"vertical"===o?{padding:{padding:2},children:e(a,{spacing:3,children:de(i,(t=>e(bp,{node:t,setRef:m,themeColor:n},t.id)))})}:{padding:{padding:2},children:e(a,{direction:"row",alignItems:"flex-start",justifyContent:"flex-start",flexWrap:"wrap",gap:3,children:de(i,(t=>e(Mp,{node:t,setRef:m,themeColor:n,itemWidth:E},t.id)))})})]})},vp=v(xe)((({theme:e,color:t})=>{const i=((e,t)=>{if(!t||"default"===t)return e.palette.grey[500];const i=e.palette[t];return i&&"object"==typeof i&&"main"in i?i.main:e.palette.grey[500]})(e,t);return{"& .MuiBadge-badge":{backgroundColor:i,color:i,boxShadow:`0 0 0 2px ${e.palette.background.paper}`,"&::after":{position:"absolute",top:"-1px",left:"-1px",width:"100%",height:"100%",borderRadius:"50%",animation:"ripple 1.2s infinite ease-in-out",border:"1px solid currentColor",content:'""'}},"@keyframes ripple":{"0%":{transform:"scale(.8)",opacity:1},"100%":{transform:"scale(2.4)",opacity:0}}}}));v(n)((({theme:e})=>({[`& .${bo.paper}`]:{boxShadow:e.palette.app.paperBoxShadow,minWidth:"29rem",width:"auto",margin:"0 0.5rem",borderRadius:"8px",overflow:"visible","& .MuiList-root":{padding:"0",overflow:"visible"}}})));const Rp=v(r,{shouldForwardProp:e=>"isOpened"!==e})((({theme:e})=>({paddingInline:"0.3rem",paddingBlock:"0.2rem",borderRadius:"8px",color:e.palette.app.color.black[900]})));function Lp({userDetails:o,menuItems:r,shouldCloseOnClick:n=!0,showBadge:l=!1,badgeColor:s="success"}){const[d,A]=h(null),c=p(null),{layout:u}=rr(),g="desktop"===u,m=J(),{iron:f}=m.palette.app.color,k=Boolean(d),E=()=>A(null),{name:I,avatar:w}=o,S=e(Se,{src:w,sx:{border:`1px solid ${f[700]}`,width:28,height:28}});return t(M,{position:"relative",children:[e(M,{sx:{display:"flex",alignItems:"center"},children:e(Rp,{ref:c,onClick:e=>{A(e.currentTarget)},size:"small","aria-haspopup":"true",children:t(a,{direction:"row",alignItems:"center",gap:1,color:"black",children:[l&&e(vp,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},variant:"dot",color:s,children:S}),!l&&S,g&&t(i,{children:[e(q,{maxWidth:150,noWrap:!0,children:I}),e(k?ve:Je,{})]})]})})}),k&&e(ce,{open:!0,anchorEl:d,onClose:E,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{elevation:0,sx:{width:220,overflow:"visible",mt:1.5,px:0,py:0,filter:"drop-shadow(0px 2px 8px rgba(0,0,0,0.32))","& .MuiAvatar-root":{width:32,height:32,ml:-.5,mr:1},"&:before":{content:'""',display:"block",position:"absolute",top:0,right:14,width:10,height:10,bgcolor:"background.paper",transform:"translateY(-50%) rotate(45deg)",zIndex:0}}}},children:e(M,{sx:{padding:"4px 0"},children:r.map((({key:i,divider:o,label:r,icon:l,sx:s,onClick:d,href:A,target:c})=>{const h=A?{component:C,href:A,target:c,prefetch:!1}:{};return t(M,{children:[o&&e($,{}),e(le,{...h,onClick:()=>{te(d)&&(d(),n&&E())},children:(l||r)&&t(a,{gap:"16px",alignItems:"center",width:"100%",flexDirection:"row",sx:{...s},children:[e(Mo,{sx:{minWidth:"20px",alignItems:"center",...s},children:l}),r&&e(q,{sx:{fontSize:"13px"},children:r})]})})]},`${i}_container`)}))})})]})}export{zd as ASPECT_RATIO_LABELS,qd as ASPECT_RATIO_VALUES,vr as ActionButton,Jr as ActionButtons,Pl as ActionButtonsWrapper,zl as ActionCell,Ql as AddIconAction,ua as AgGrid,fl as AnnouncementBanner,Ga as AppBar,$n as AppLogoMedium,el as AppLogoSmall,Zr as ArrowUp,Dr as ArrowUpRight,$a as AttendanceCard,tl as AttendanceManagementDarkSvg,il as AttendanceReportDarkSvg,Ip as AttendanceStatus,uC as Autocomplete,Ya as Badge,Rs as BarChart,ml as BookMarkSvg,kC as BottomDialog,IC as BottomSheet,$s as BoxStyled,Va as BreadcrumbButtonWrapper,qa as Breadcrumbs,ol as BriefcaseSvg,rl as BulkOperationsDarkSvg,Rr as Button,bC as ButtonContainer,Lr as ButtonGroup,yr as ButtonLayoutProvider,Ml as CalendarIconAction,sl as CalendarSvg,za as Card,Pa as CardItem,Oa as CardItemValue,Js as CellSelectionTable,ll as ChartIconSvg,DC as CheckBox,eC as CheckStyled,Jo as CheckboxInput,Ds as Chip,Hs as ChipWithBorder,al as ClockSvg,Vs as CodeSnippetBox,Uc as ColumnArranger,Zc as ColumnArrangerDialog,Dc as ColumnArrangerForm,wl as ColumnArrangerSvg,bl as ColumnIconAction,El as CommentIcon,qr as CompanyBanner,Jl as ConfigureIconAction,JC as ContentBox,nd as CurrencyField,Tl as CurrentLocationAction,Za as CustomEnumFilter,Nl as DEFAULT_AG_GRID_PERSIST_STORAGE_TYPE,Xd as DEFAULT_ASPECT_RATIOS,Nd as DEFAULT_ENABLED_VARIANTS,Vd as DEFAULT_MAX_SIZE_MB,Td as DEFAULT_MIN_RESOLUTION,oc as DEFAULT_PROGRESS_BAND_THRESHOLDS,jd as DEFAULT_QUALITY_WARN_RESOLUTION,Cl as DashboardIconSvg,YC as DatePicker,PC as DateRangePicker,_C as DateRangePickerField,rh as DateRangePickerPopUp,OC as DateRangeSelector,id as DateTimePicker,ad as DecimalTextField,LC as DeleteDialog,vl as DeleteIconAction,gC as Dialog,FC as DialogSelect,ud as DownloadAction,Rl as DownloadIconAction,Ll as DownloadPrintAction,zr as DownloadSvg,eh as Drawer,yl as EditIconAction,dl as EmployeeManagementDarkSvg,Al as EmployeeReportsDarkSvg,wn as ExitIcon,Fl as ExportIconAction,aa as FacebookCircularProgress,md as FileNames,pd as FilePreview,MC as FilePreviewContainer,wd as FileUpload,Ul as FilterIconAction,ph as FilterList,Ah as FilterListV2,Zs as FilterPill,Ks as FilterPillV2,sh as FilterPopUpDateRangeWrapper,nh as FilterPopup,ah as FilterPopupWrapper,hh as FilterTypeWrapper,gn as FormAction,Ur as FormActionButton,wC as FormContainer,SC as FormGridLayout,xC as FormRow,QC as FormSection,RC as GridProvider,Il as GroupIcon,uh as HighlightedText,Dl as HistoryIconAction,nl as HolidayCalendarSvg,cl as HomePageBanner,Ud as ImageUpload,Dd as ImageUploadView,mn as ImportExcelSuccessIcon,Zl as ImportIconAction,Sn as InboxIcon,Hl as InboxIconAction,gh as Indicator,Wd as JPEG_COMPRESS_QUALITY,Vl as KeyBoardIconAction,Zd as LOGO_ACCEPTED_TYPES,Hd as LOGO_ACCEPT_ATTRIBUTE,Kd as LOGO_EXTENSION_MIME_MAP,yA as LOGO_SIZE_TOKENS,Od as LOGO_VARIANT_SIZES,fn as LeaveIcon,KC as LeftArrowIcon,kl as LikeIcon,ys as LineChart,PA as ListItemButton,Ua as LoadingCell,sa as LoadingOverlay,kn as LoanIcon,Bn as LogoIcon,qA as LogoPicker,GA as LogoViewDialog,Yh as MAX_LIST_HEIGHT,Pr as MasterIcon,vC as MasterPageLayout,hl as MiscellaneousManagementDarkSvg,Fo as NavigationKeyProvider,Zo as NavigationRouterProvider,xn as NoDataFoundSvg,Ca as NoDataOverlay,Qp as Node,Kh as OPTION_ROW_HEIGHT,En as OvertimeIcon,Pd as PRIMARY_SIZE_BY_RATIO,jl as PadBox,fh as Pagination,$A as PasswordField,pl as PayrollManagementDarkSvg,ul as PayrollReportDarkSvg,ic as PhoneInputField,Ld as PhotoCaptureDialog,Us as PieChart,kh as PrintDownloadActions,Kl as ProcessIconAction,Na as ProfileCard,Xa as ProfileCardBody,_a as ProfileCardHeader,ac as ProgressCell,uc as ProgressSliderField,fc as RadioGroupField,Ic as Rating,Da as RedirectionCell,GC as RightArrowIcon,Vh as SELECT_ALL_VALUE,Eh as SMART_FIELD_INPUT_CLASS,dd as SUPPORTED_DOC_FORMATS,Ad as SUPPORTED_EXCEL_FORMATS,qo as SUPPORTED_FILE_TYPES,sd as SUPPORTED_IMAGE_FORMATS,Cd as SUPPORTED_PDF_FORMATS,In as SalaryIcon,yC as SaveDialog,wc as SearchField,Qc as Select,Or as SettingIcon,mh as SeverityIndicator,oh as SideDrawer,ip as SmartAutoCompleteField,Fh as SmartCurrencyField,Dh as SmartDialogSelect,ap as SmartGridActionCell,Kc as SmartLink,Hh as SmartSelectField,rp as SmartTextField,lp as SmartTextFieldV2,vh as SmartTooltip,Fr as SplitButton,sp as Stepper,cp as StepperV2,hp as StepperV3,Sc as StickySearchField,Qn as SvgAccessDenied,Nr as SvgAccount,Mn as SvgAdd,bn as SvgAddRounded,Hr as SvgArrival,Xr as SvgBankConfig,On as SvgBranches,Jn as SvgCalendar,un as SvgCategory,vn as SvgColumn,_r as SvgConfiguration,Rn as SvgConfigure,gl as SvgCurrentLocation,Ln as SvgDelete,Kr as SvgDeparture,sn as SvgDevices,yn as SvgDownload,Fn as SvgDrop,Kn as SvgEdit,Nn as SvgEmail,Cn as SvgEmployeeOnboarding,$r as SvgEmployees,an as SvgEngage,en as SvgExpenses,Un as SvgExport,Zn as SvgFilterList,Dn as SvgFilteredList,cn as SvgHelpDesk,Hn as SvgHistory,Gr as SvgHoliday,Gn as SvgHome,Yn as SvgImport,Xn as SvgIndicator,Vn as SvgKeyBoard,Yr as SvgLeaveCalendar,tn as SvgLetteremplate,Tn as SvgNoLogo,jn as SvgNoSign,Bl as SvgNotification,on as SvgOrganization,Wn as SvgPageNotFound,rn as SvgPayroll,pn as SvgPerformance,_n as SvgPhone,qn as SvgProfile,zn as SvgReGenerate,nn as SvgStock,Sl as SvgSupport,hn as SvgTasks,dn as SvgTeam,ln as SvgTransaction,Vr as SvgUnverifieduser,Tr as SvgUser,jr as SvgVerifiedUser,Pn as SvgView,An as SvgVisitors,Wr as SvgWeekoffCalendar,bc as SwitchField,fp as Tab,Ep as TabBar,mp as Tabs,kp as TabsMenus,_A as TextField,Br as Theme,vc as TimeField,Lc as TimePicker,Bp as Timeline,Ws as Toaster,xl as Tooltip,Jp as Tree,Lp as UserProfileMenu,Gh as VIRTUALIZE_THRESHOLD,Gl as ViewDetailsIconAction,gd as ViewFilePreviewDialog,Yl as ViewIconAction,hr as accessorFnRegex,Mr as appTheme,ta as buildAgGridPersistedState,Ra as calculateSummaryRow,ra as clearAgGridPersistedState,kr as colorPaletteUI,HC as dateFormats,ca as defaultPageSize,DA as detectLogoShape,To as downloadFile,Wo as downloadPrintHtml,Ar as emailRegex,_o as errorMessages,Id as error_with_transaltion,Ha as extractPrefixedValue,ls as extractSortValue,Xo as filterByFields,zh as filterOptionsByQuery,xa as flattenColumns,Ko as formatDate,dh as formatFilterData,Vo as formatHours,_l as getAgGridPersistStorage,Xl as getAgGridPersistStorageKey,$l as getAgGridPersistedState,Sp as getArrowValue,Ro as getColorByVariant,UA as getDefaultPreviewLimits,Yo as getDifferenceInHHmmss,FA as getEditFrameSize,$o as getErrorProps,Ch as getFormValue,Ph as getInitialHighlightIndex,ZA as getLogoFrameSize,Gd as getLogoMimeFromFileName,ss as getNextSortDirection,Th as getOptionLabelText,jh as getOptionValueText,xr as getPaletteByTheme,nc as getProgressBandColor,rc as getProgressBandKey,Ac as getProgressPercent,cc as getSliderStep,Mh as getSmartFieldInputStyles,Bh as getSmartFieldPlaceholderColor,Qh as getSmartFieldPlaceholderCss,Sh as getSmartFieldSizeConfig,xh as getSmartFieldTextColor,bh as getSmartFieldWrapperStyles,Lo as getStatusLabel,Go as getTimeInHHmm,_d as getVariantsForAspectRatio,Oo as getZIndex,ur as highlightWordsRegex,No as hslToRgb,pr as hslaRegex,zo as isFileSizeValid,hd as isFileType,Po as isFileTypeValid,Yd as isLogoAcceptedType,Wh as isSelectAllOption,ds as isSelectionDisabled,Cs as isSortingEnabled,$d as isSvgFile,Cr as isoDateRegex,HA as loadImageNaturalSize,sr as monthYearRegex,dr as noSpecialCharacterRegex,qh as normalizeToStringArray,gr as numericRegex,ha as pageSizeOptions,tr as parseCellValue,er as parseNumericValue,ld as predefinedOptions,ia as restoreAgGridFilterState,oa as restoreAgGridPaginationState,dc as roundToTwoDecimals,vo as serverityOptions,ea as setAgGridPersistedState,Aa as showNoRowsOverlay,as as sortTableData,cr as timeRegex,hc as toSliderNumber,Ns as toasts,br as urlToNestedObject,ma as useAgGridCheckBoxSelection,fa as useAgGridFilteredData,Ia as useAgGridKeyboardShortcuts,na as useAgGridPersist,la as useAgGridPersistReset,wa as useAgGridRowSelectionConfig,Fa as useAgGridSelection,La as useAgGridSummaryRow,ya as useAgGridSummaryRowUpdate,ir as useDialogActions,or as useFormFieldFocus,rr as useGetDeviceType,nr as useGlobalKeyboardShortcut,Uo as useNavigationKeyContext,Ho as useNavigationRouter,ar as useParseHref,rs as useRowSelection,As as useSorting,lr as useZoomLevel};
23
+ `,AA=v(M)((({theme:e})=>{const{iron:t,butterflyBlue:i}=e.palette.app.color,{white:o}=e.palette.common;return{display:"inline-flex",alignItems:"center",gap:"2px",padding:"4px",borderRadius:"12px",background:o,border:`1px solid ${y(i[900],.14)}`,boxShadow:`\n 0 12px 32px ${y(t[900],.28)},\n 0 4px 12px ${y(t[900],.18)},\n 0 1px 3px ${y(t[900],.12)}\n `,backdropFilter:"blur(10px)",animation:`${CA} 220ms cubic-bezier(0.22, 1, 0.36, 1)`,position:"relative","&::before":{content:'""',position:"absolute",top:-5,left:"50%",width:10,height:10,background:o,border:`1px solid ${y(i[900],.14)}`,borderBottom:"none",borderRight:"none",transform:"translateX(-50%) rotate(45deg)",zIndex:0}}})),cA=v(r,{shouldForwardProp:e=>"logoSize"!==e&&"delayMs"!==e})((({theme:e,logoSize:t="large",delayMs:i=0})=>{const{butterflyBlue:o,iron:r}=e.palette.app.color,{button:n,icon:l,padding:a}=((e="large")=>"small"===e?{button:26,icon:14,padding:"4px"}:"medium"===e?{button:30,icon:16,padding:"5px"}:{button:34,icon:18,padding:"6px"})(t);return{width:n,height:n,padding:a,color:r[800],zIndex:1,animation:`${dA} 240ms cubic-bezier(0.22, 1, 0.36, 1) both`,animationDelay:`${i}ms`,transition:"background-color 0.18s ease, color 0.18s ease, transform 0.18s ease","& .MuiSvgIcon-root":{fontSize:l},"&:hover":{backgroundColor:y(o[900],.1),color:o[900],transform:"translateY(-1px)"},"&:focus-visible":{outline:`2px solid ${o[900]}`,outlineOffset:1}}})),hA=v(M,{shouldForwardProp:e=>"logoSize"!==e})((({logoSize:e="large"})=>({height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"small"===e?"2px":"6px",padding:"small"===e?"2px":"4px"})));function pA({open:t,anchorEl:i,size:o,actions:r,onClose:n,onMouseEnter:l,onMouseLeave:a}){const s=J(),{slate:C}=s.palette.app.color;return e(ce,{open:t,anchorEl:i,onClose:n,disableRestoreFocus:!0,disableScrollLock:!0,marginThreshold:8,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},slotProps:{paper:{elevation:0,onMouseEnter:l,onMouseLeave:a,sx:{mt:1,overflow:"visible",background:"transparent",boxShadow:"none"}}},sx:{pointerEvents:"none","& .MuiPaper-root":{pointerEvents:"auto"}},children:e(AA,{role:"toolbar","aria-label":"Logo actions",children:r.map((({key:t,label:i,icon:r,onClick:n},l)=>e(xl,{toolTipLabel:i,placement:"top",children:e(cA,{logoSize:o,delayMs:40*l,"aria-label":i,onClick:e=>{e.stopPropagation(),n(e)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),n(e))},sx:{color:C[900]},children:r})},t)))})})}const uA=v(M)({display:"flex",flexDirection:"column",gap:"12px"}),gA=v(M)({display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:"10px"}),mA=v(M)((({theme:e})=>{const{mirage:t,butterflyBlue:i,lightBlue:o}=e.palette.app.color;return{position:"relative",width:"100%",height:280,borderRadius:"8px",overflow:"hidden",backgroundColor:t[900],border:`1px solid ${i[700]}`,[e.breakpoints.up("sm")]:{height:360},"& .reactEasyCrop_CropArea":{border:`2px solid ${i[900]} !important`,color:y(t[900],.55)},"& .reactEasyCrop_CropAreaGrid::before, & .reactEasyCrop_CropAreaGrid::after":{borderColor:y(o[50],.35)}}})),fA=v(M)({display:"flex",alignItems:"center",gap:"8px"}),kA=v(r)((({theme:e})=>{const{butterflyBlue:t,iron:i}=e.palette.app.color;return{color:t[900],"&.Mui-disabled":{color:i[700]}}})),EA=v(M)((({theme:e})=>{const{butterflyBlue:t,lightBlue:i}=e.palette.app.color;return{width:40,height:40,borderRadius:"6px",overflow:"hidden",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:i[50],border:`1px solid ${t[700]}`}})),IA=v(M)((({theme:e})=>{const{mirage:t,lightBlue:i}=e.palette.app.color;return{position:"absolute",inset:0,zIndex:5,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"10px",backgroundColor:y(t[900],.7),color:i[50]}}));function wA({imageSrc:t,aspectRatio:i,rotation:o,zoom:r,onZoomChange:n,onCropComplete:l}){const[a,s]=h({x:0,y:0});u((()=>{s({x:0,y:0})}),[i]);const C=g(((e,t)=>{l(t)}),[l]);return e(gi,{image:t,crop:a,zoom:r,rotation:o,aspect:qd[i],onCropChange:s,onZoomChange:n,onCropComplete:C,objectFit:"contain",showGrid:!0,style:{containerStyle:{width:"100%",height:"100%"}}})}function SA({open:i,imageSrc:o,originalFile:r,aspectRatios:n=Xd,enabledVariants:l,initialAspectRatio:s="1:1",onClose:C,onApply:d}){const A=J(),{iron:c,butterflyBlue:p}=A.palette.app.color,[m,f]=h(s),[k,E]=h(1),[I,w]=h(0),[S,B]=h(null),[x,Q]=h(!1),[b,v]=h(null),R=g((()=>{E(1),w(0)}),[]);u((()=>{i&&(f(s),R(),B(null),v((e=>(tA(e),null))))}),[i,s,R]),u((()=>{const e=new AbortController;return(async()=>{if(S&&o)try{const t=await nA(o,S,I,void 0,void 0,"image/png");if(e.signal.aborted)return;const i=URL.createObjectURL(t);if(e.signal.aborted)return void tA(i);v((e=>(tA(e),i)))}catch{if(e.signal.aborted)return;v((e=>(tA(e),null)))}})(),()=>{e.abort()}}),[S,o,I]);return e(gC,{open:i,onClose:C,title:"Crop Logo",maxWidth:"md",actions:t(a,{direction:"row",gap:"10px",justifyContent:"flex-end",children:[e(Ur,{actionType:"cancel",variant:"outlined",onClick:C,disableKeyboardShortcut:x,disabled:x}),e(Ur,{onClick:()=>{(async()=>{if(S){Q(!0);try{const e=await sA({imageSrc:o,original:r,pixelCrop:S,rotation:I,aspectRatio:m,enabledVariants:l});d({...e,aspectRatio:m}),C()}catch{Ns.error({title:"Failed to process cropped image. Please try again."})}finally{Q(!1)}}else Ns.error({title:"Adjust the crop area before saving."})})()},loading:x,label:"Apply"})]}),children:t(uA,{children:[t(gA,{children:[e(Lr,{renderButtons:n.map((e=>({icon:null,value:e,label:e,selected:m===e,size:"small",onClick:e=>{const t=n.find((t=>t===e));t&&f(t)}}))),sx:{textTransform:"none",fontWeight:500,boxShadow:"none","&.MuiButton-text":{color:c[800]}}}),t(a,{direction:"row",alignItems:"center",gap:"2px",children:[e(xl,{toolTipLabel:"Drag to reposition. Scroll or use zoom to refine.",children:e(kA,{size:"small","aria-label":"Crop tips",children:e(Vt,{fontSize:"small"})})}),e(xl,{toolTipLabel:"Rotate left",children:e(kA,{size:"small",onClick:()=>w((e=>e-90)),"aria-label":"Rotate left",disabled:x,children:e(Ai,{fontSize:"small"})})}),e(xl,{toolTipLabel:"Rotate right",children:e(kA,{size:"small",onClick:()=>w((e=>e+90)),"aria-label":"Rotate right",disabled:x,children:e(ci,{fontSize:"small"})})}),e(xl,{toolTipLabel:"Reset",children:e(kA,{size:"small",onClick:R,"aria-label":"Reset crop",disabled:x,children:e(di,{fontSize:"small"})})})]})]}),t(M,{sx:{position:"relative"},children:[e(mA,{children:e(wA,{imageSrc:o,aspectRatio:m,rotation:I,zoom:k,onZoomChange:E,onCropComplete:B})}),x&&t(IA,{children:[e(_,{size:28,sx:{color:p[900]}}),e(q,{variant:"body2",children:"Processing…"})]})]}),t(fA,{children:[e(xl,{toolTipLabel:"Zoom out",children:e(kA,{size:"small",onClick:()=>{E((e=>Math.max(1,Number((e-.1).toFixed(2)))))},"aria-label":"Zoom out",disabled:k<=1||x,children:e(pi,{fontSize:"small"})})}),e(ui,{value:k,min:1,max:3,step:.05,"aria-label":"Zoom",onChange:(e,t)=>{"number"==typeof t&&E(t)},size:"small",disabled:x,sx:{flex:1,color:p[900],"& .MuiSlider-rail":{backgroundColor:c[700]}}}),e(xl,{toolTipLabel:"Zoom in",children:e(kA,{size:"small",onClick:()=>{E((e=>Math.min(3,Number((e+.1).toFixed(2)))))},"aria-label":"Zoom in",disabled:k>=3||x,children:e(hi,{fontSize:"small"})})}),t(q,{variant:"caption",color:c[800],sx:{minWidth:36,textAlign:"right"},children:[Math.round(100*k),"%"]}),b&&e(EA,{children:e(M,{component:"img",src:b,alt:"Crop preview",sx:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}})})]})]})})}const BA="120px",xA="120px",QA=(e,t,i)=>i?"none":t?`1px dashed ${e}`:`1px solid ${e}`,MA=v(M,{shouldForwardProp:e=>"isDragging"!==e&&"hasImage"!==e&&"disabled"!==e&&"frameWidth"!==e&&"frameHeight"!==e&&"frameBorderRadius"!==e&&"isViewMode"!==e&&"hideBorder"!==e})((e=>(({theme:e,isDragging:t,hasImage:i,disabled:o,frameWidth:r,frameHeight:n,frameBorderRadius:l,isViewMode:a,hideBorder:s})=>{const{butterflyBlue:C,iron:d}=e.palette.app.color,A=t||i?C[900]:e.palette.grey[400],c=r??xA,h=a&&i||!a&&!o,p=!o&&!a&&!s;return{width:c,height:n??BA,minWidth:c,maxWidth:c,position:"relative",overflow:"hidden",borderRadius:l??"10px",border:QA(A,t,s),backgroundColor:t?y(C[900],.05):i?e.palette.common.white:d[50],cursor:h?"pointer":"default",opacity:o&&!a?.6:1,transition:"all 0.2s ease-in-out",outline:"none",boxSizing:"border-box","&:focus-visible":{outline:h?`2px solid ${C[900]}`:"none",outlineOffset:2},...p&&{"&:hover":{border:QA(C[900],t)}}}})(e))),bA=v(M)((({theme:e})=>({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.palette.common.white}))),JA=v(M,{shouldForwardProp:e=>"frameBorderRadius"!==e})((({theme:e,frameBorderRadius:t})=>{const{mirage:i}=e.palette.app.color;return{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",backgroundColor:y(i[600],.2),backdropFilter:"blur(3px)",borderRadius:t??"10px",zIndex:2}})),vA=v(M,{shouldForwardProp:e=>"frameBorderRadius"!==e})((({theme:e,frameBorderRadius:t})=>{const{mirage:i}=e.palette.app.color;return{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:y(i[600],.35),backdropFilter:"blur(2px)",borderRadius:t??"10px",zIndex:3}}));function RA({open:i,size:o,disabled:n,borderRadius:l,onEdit:a,onDelete:s,onHoverChange:C}){const d=J(),{lightBlue:A}=d.palette.app.color,c="small"===o?16:20,h="small"===o?"small":"medium";return e(ai,{in:i,timeout:{enter:300,exit:1e3},children:t(JA,{frameBorderRadius:l,onFocus:()=>C(!0),onBlur:e=>{eA(e.currentTarget,e.relatedTarget)&&C(!1)},children:[e(r,{tabIndex:0,disabled:n,"aria-label":"Replace logo",size:h,onClick:e=>{e.stopPropagation(),a()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),a())},children:e(ni,{sx:{color:A[50],fontSize:c}})}),e(r,{tabIndex:0,disabled:n,"aria-label":"Remove logo",size:h,onClick:s,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||s(e)},children:e(ri,{sx:{color:A[50],fontSize:c}})})]})})}function LA({size:i,disabled:o=!1,enableCaptureImage:r=!1,onAttach:n,onCapture:l}){const a=J(),{iron:s}=a.palette.app.color,C=e=>t=>{t.stopPropagation(),t.preventDefault(),o||e()};return t(hA,{logoSize:i,children:[r&&e(xl,{toolTipLabel:"Capture photo",placement:"top",children:e(cA,{logoSize:i,delayMs:0,disabled:o,"aria-label":"Capture photo",onClick:C((()=>l?.())),children:e(oi,{sx:{color:s[900]}})})}),e(xl,{toolTipLabel:"Upload logo",placement:"top",children:e(cA,{logoSize:i,delayMs:r?40:0,disabled:o,"aria-label":"Upload logo",onClick:C(n),children:e(fi,{sx:{color:s[900]}})})})]})}const yA={small:{base:60,rectShort:36,rectMaxLong:120,borderRadius:"8px",iconFontSize:20},medium:{base:80,rectShort:48,rectMaxLong:160,borderRadius:"8px",iconFontSize:24},large:{base:120,rectShort:72,rectMaxLong:240,borderRadius:"10px",iconFontSize:28}},FA=(e,t="square")=>{const{base:i,borderRadius:o}=yA[e];return{width:i,height:i,borderRadius:"circle"===t?"50%":o}},UA=e=>{const{base:t,rectMaxLong:i}=yA[e];return{maxPreviewWidth:i,maxPreviewHeight:t}},DA=(e,t)=>{if(!e||!t)return"square";const i=e/t;return Math.abs(i-1)<=.12?"square":i>1?"rectangle":"portrait"},ZA=(e,t="large",i,o)=>{const{base:r,rectShort:n,rectMaxLong:l,borderRadius:a}=yA[t];if("circle"===e)return{width:r,height:r,borderRadius:"50%"};if("square"===e)return{width:r,height:r,borderRadius:a};if("rectangle"===e)return{width:l,height:n,borderRadius:a};if(!i||!o)return{width:r,height:r,borderRadius:a};const s=DA(i,o);if("square"===s)return{width:r,height:r,borderRadius:a};const C=i/o;if("rectangle"===s){const e=n;return{width:Math.min(l,Math.round(e*C)),height:e,borderRadius:a}}const d=n;return{width:d,height:Math.min(l,Math.round(d/C)),borderRadius:a}},HA=e=>new Promise(((t,i)=>{const o=new Image;o.onload=()=>{const{naturalWidth:e,naturalHeight:i}=o;t({width:e,height:i})},o.onerror=()=>i(new Error("Failed to load image")),o.crossOrigin="anonymous",o.src=e}));function KA({size:t,disabled:i,enableCaptureImage:o,onAttach:r,onCapture:n}){const l=J(),{iron:s}=l.palette.app.color,{iconFontSize:C}=yA[t];return o?e(LA,{size:t,disabled:i,enableCaptureImage:o,onAttach:r,onCapture:n}):e(a,{justifyContent:"center",alignItems:"center",sx:{height:"100%"},children:e(mi,{sx:{color:s[700],fontSize:C}})})}function GA({open:i,imageSrc:o,title:n="Logo",onClose:l}){const a=J(),{iron:s}=a.palette.app.color;return e(Ei,{open:i,onClose:l,closeAfterTransition:!0,slots:{backdrop:ki},slotProps:{backdrop:{timeout:200,sx:{backgroundColor:y(a.palette.common.white,.45),backdropFilter:"blur(8px) saturate(1.7)",WebkitBackdropFilter:"blur(8px) saturate(9)"}}},"aria-label":n,children:e(ai,{in:i,children:t(M,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",p:{xs:2,sm:4},outline:"none",overflow:"hidden"},onClick:l,children:[e(r,{"aria-label":"Close",onClick:l,size:"small",sx:{position:"absolute",top:{xs:12,sm:16},right:{xs:12,sm:16},zIndex:2,color:s[400],bgcolor:"transparent",boxShadow:"none","&:hover":{bgcolor:"transparent",opacity:.7}},children:e(Ct,{fontSize:"small"})}),e(M,{sx:{position:"relative",maxWidth:"min(920px, 100%)",maxHeight:"100%",lineHeight:0},onClick:e=>e.stopPropagation(),children:e(M,{component:"img",src:o,alt:n,sx:{display:"block",maxWidth:"100%",maxHeight:"min(82vh, 680px)",width:"auto",height:"auto",objectFit:"contain",borderRadius:"10px",bgcolor:a.palette.common.white,boxShadow:`0 12px 40px ${y(s[400],.18)}`}})})]})})})}function YA({previewUrl:e,errorImage:t="",onError:i}){const[o,r]=h(!1),[n,l]=h(!1);u((()=>{r(!1),l(!1)}),[e,t]);const a=o&&!!t&&!n;return{displayUrl:a?t:e,hasValidImage:!!e&&(!o||a),handleImageError:()=>{if(!o)return r(!0),void i?.();l(!0)}}}function VA({previewUrl:o,errorImage:n="",label:l,required:s,hideBorder:C,variant:d,size:A,frame:c,maxPreviewWidth:p,maxPreviewHeight:u,onView:g,onError:m,enableFullImageView:f=!0,containerProps:k}){const E=J(),{iron:I,lightBlue:w}=E.palette.app.color,{iconFontSize:S}=yA[A],[B,x]=h(!1),[Q,b]=h(!1),{displayUrl:v,hasValidImage:R,handleImageError:L}=YA({previewUrl:o,errorImage:n,onError:m}),y="auto"===d,F="small"===A?16:20,U=y?{width:"fit-content",height:"fit-content",minWidth:"unset",maxWidth:"unset"}:void 0,{width:D,height:Z,borderRadius:H}=c,K=y?{display:"block",maxWidth:p,maxHeight:u,width:"auto",height:"auto",borderRadius:H}:{display:"block",width:"100%",height:"100%",objectFit:"cover",objectPosition:"center",borderRadius:H},G=e=>{e?.stopPropagation(),R&&f&&(g?g():b(!0))},Y=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),G())},V=e=>{eA(e.currentTarget,e.relatedTarget)&&x(!1)};if(!R)return t(a,{direction:"row",alignItems:"center",gap:"15px",...k,children:[e(MA,{hasImage:!1,disabled:!0,isViewMode:!0,frameWidth:D,frameHeight:Z,frameBorderRadius:H,role:"img","aria-label":l||"Logo",children:e(M,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",sx:{height:"100%"},children:e(mi,{sx:{color:I[700],fontSize:S}})})}),l&&e(Oe,{required:s,children:l})]});const T=f?{tabIndex:0,role:"button","aria-label":`View ${l||"logo"}`,onClick:()=>G(),onKeyDown:Y,onMouseEnter:()=>x(!0),onFocus:()=>x(!0),onBlur:V,onMouseLeave:()=>x(!1)}:{};return t(i,{children:[t(a,{direction:"row",alignItems:"center",gap:"15px",...k,children:[t(MA,{hasImage:!0,isViewMode:!0,hideBorder:C,frameWidth:y?"fit-content":D,frameHeight:y?"fit-content":Z,frameBorderRadius:H,sx:U,...T,children:[f&&e(ai,{in:B,timeout:{enter:300,exit:1e3},children:e(JA,{frameBorderRadius:H,onFocus:()=>x(!0),onBlur:V,children:e(r,{tabIndex:0,"aria-label":"View logo",size:"small"===A?"small":"medium",onClick:G,onKeyDown:Y,children:e(Nt,{sx:{color:w[50],fontSize:F}})})})}),e(bA,{sx:{borderRadius:H,...y?{width:"fit-content",height:"fit-content"}:void 0},children:e(M,{component:"img",src:v,alt:"Logo",onError:L,sx:K})})]}),l&&e(Oe,{required:s,children:l})]}),e(GA,{open:Q,imageSrc:v,title:l||"View Logo",onClose:()=>b(!1)})]})}const TA=({size:i="large"})=>{const{base:o,borderRadius:r}=yA[i],n="small"===i;return t(a,{direction:"row",alignItems:"center",gap:n?"10px":"15px",children:[e(we,{variant:"rectangular",sx:{width:o,height:o,minWidth:o,maxWidth:o,borderRadius:r,transform:"scale(1)"}}),t(a,{gap:"5px",children:[e(we,{width:n?90:120,height:n?18:24,sx:{transform:"scale(1)"}}),e(we,{width:n?100:140,height:n?12:16,sx:{transform:"scale(1)"}})]})]})},jA=(e,t,i)=>(t&&Ns.error({title:e}),{valid:!1,error:e,...i}),WA=async(e,t,i,o)=>{try{const{width:r,height:n}=await(e=>new Promise(((t,i)=>{const o=URL.createObjectURL(e),r=new Image;r.onload=()=>{const{naturalWidth:e,naturalHeight:i}=r;URL.revokeObjectURL(o),t({width:e,height:i})},r.onerror=()=>{URL.revokeObjectURL(o),i(new Error("Failed to load image"))},r.src=o})))(e),l=Math.min(r,n);if(l<t)return jA(`Image resolution too low. Minimum is ${t}×${t} px.`,o,{width:r,height:n});if(l<i){const e=`Image quality may be low (${r}×${n} px). Consider using a higher-resolution logo.`;return o&&Ns.warning({title:e}),{valid:!0,warning:e,width:r,height:n}}return{valid:!0,width:r,height:n}}catch{return jA("Unable to read image. Please try another file.",o)}};function qA({onChange:o,onDelete:r,onView:n,onError:l,errorImage:s="",defaultValue:C="",value:d,label:A="Logo",subTitle:m="PNG, JPEG under 5 MB",mode:f="edit",variant:k="square",size:E="large",maxPreviewWidth:I,maxPreviewHeight:w,hideBorder:S=!1,maxSizeMB:B=5,minResolution:x=256,qualityWarnResolution:Q=512,aspectRatios:M=Xd,enabledVariants:b=Nd,isUploading:v=!1,loading:R=!1,disabled:L=!1,required:y=!1,enableCaptureImage:F=!1,acceptedTypes:U=Zd,enableFullImageView:D=!0,containerProps:Z}){const H=J(),{iron:K,butterflyBlue:G}=H.palette.app.color,Y="view"===f,V=UA(E),T=I??V.maxPreviewWidth,j=w??V.maxPreviewHeight,W="circle"===k?"circle":"square",z=c((()=>FA(E,W)),[E,W]),P=p(null),O=p(null),N=p(null),X=p(null),[$,ee]=h(!1),[te,ie]=h(!1),[oe,re]=h(d??C),[ne,le]=h(null),[ae,se]=h(!1),[Ce,de]=h(!1),[Ae,ce]=h(null),[he,pe]=h(null),[ue,ge]=h(!1),[me,fe]=h(!1),[ke,Ee]=h((()=>ZA(k,E))),{inputRef:Ie,setInputRef:we,maintainFocusAfterClose:Se}=or({isOpen:ue||Ce});u((()=>{void 0!==d&&re(d)}),[d]),u((()=>{if(!Y)return void Ee(z);if("auto"!==k)return void Ee(ZA(k,E));if(!oe)return void Ee(ZA("square",E));let e=!1;return HA(oe).then((({width:t,height:i})=>{e||Ee(ZA("auto",E,t,i))})).catch((()=>{e||Ee(ZA("square",E))})),()=>{e=!0}}),[Y,k,oe,E,z]);const Be=Y?ke:z,{displayUrl:xe,hasValidImage:Qe,handleImageError:Me}=YA({previewUrl:oe,errorImage:s,onError:l}),be=g((()=>{tA(O.current),O.current=null}),[]);u((()=>()=>{be(),tA(N.current),N.current=null,X.current&&clearTimeout(X.current)}),[be]);const Je=()=>{L||Ie.current?.click()},ve=()=>{!L&&F&&(fe(!1),ge(!0))},Re=()=>{X.current&&(clearTimeout(X.current),X.current=null)},Le=()=>{!L&&Qe&&F&&(Re(),fe(!0))},ye=()=>{Re(),X.current=setTimeout((()=>{fe(!1)}),160)},Fe=e=>{F?e?Le():ye():ee(e)},Ue=async e=>{if(o){le(null),se(!0),fe(!1);try{const t=await(async(e,{maxSizeMB:t=5,minResolution:i=256,qualityWarnResolution:o=512,acceptedTypes:r=Zd,showToasts:n=!0}={})=>Yd(e,r)?zo(e,t)?$d(e)?{valid:!0}:WA(e,i,o,n):jA(`File too large. Maximum size is ${t} MB.`,n):jA("Unsupported file type. Use PNG, JPG, JPEG, SVG, or WEBP.",n))(e,{maxSizeMB:B,minResolution:x,qualityWarnResolution:Q,acceptedTypes:U});if(!t.valid)return void le(t.error??"Invalid file");if($d(e)){const t=await(async(e,t)=>{const i=URL.createObjectURL(e),o={};for(const i of t)o[i]=e;return{cropped:e,variants:o,previewUrl:i}})(e,b),{cropped:i,variants:r,previewUrl:n}=t;return be(),O.current=n,re(n),void o({original:e,cropped:i,variants:r,aspectRatio:"1:1",previewUrl:n})}const i=URL.createObjectURL(e);pe(e),ce((e=>(tA(e),N.current=i,i))),de(!0)}finally{se(!1)}}},De=e=>{const[t]=Array.from(e);t&&Ue(t)},Ze=e=>{e?.stopPropagation(),e?.preventDefault(),be(),re(""),le(null),pe(null),fe(!1),ce((e=>(tA(e),N.current=null,null))),r?.()};if(R)return e(TA,{size:E});if(Y)return e(VA,{previewUrl:oe,errorImage:s,label:A,required:y,hideBorder:S,variant:k,size:E,frame:Be,maxPreviewWidth:T,maxPreviewHeight:j,onView:n,onError:l,enableFullImageView:D,containerProps:Z});const{width:He,height:Ke,borderRadius:Ge}=Be,Ye="50%"===Ge?"50%":"8px",Ve=(({enableCaptureImage:t,onEdit:i,onCapture:o,onDelete:r})=>{const n=[{key:"edit",label:"Replace logo",icon:e(ni,{}),onClick:e=>{e.stopPropagation(),i()}}];return t&&n.push({key:"capture",label:"Capture photo",icon:e(oi,{}),onClick:e=>{e.stopPropagation(),o()}}),n.push({key:"delete",label:"Remove logo",icon:e(ri,{}),onClick:e=>{r(e)}}),n})({enableCaptureImage:F,onEdit:Je,onCapture:ve,onDelete:Ze});return t(i,{children:[t(a,{direction:"row",alignItems:"center",gap:"15px",...Z,children:[t(MA,{ref:P,isDragging:te,hasImage:Qe,disabled:L,frameWidth:He,frameHeight:Ke,frameBorderRadius:Ge,tabIndex:L?-1:0,role:"button","aria-disabled":L,"aria-label":A||"Logo",onClick:()=>!L&&!Qe&&!F&&Je(),onKeyDown:e=>{L||Qe||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Je())},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),!L&&(e=>e.dataTransfer.types.includes("Files"))(e)&&ie(!0)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),L||(e.dataTransfer.dropEffect="copy")},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),eA(e.currentTarget,e.relatedTarget)&&ie(!1)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),ie(!1),!L&&e.dataTransfer.files.length>0&&De(e.dataTransfer.files)},onMouseEnter:()=>!L&&Fe(!0),onFocus:()=>!L&&Fe(!0),onMouseLeave:()=>Fe(!1),onBlur:e=>{eA(e.currentTarget,e.relatedTarget)&&Fe(!1)},children:[e("input",{ref:we,type:"file",accept:Hd,onChange:e=>{!L&&e.target.files&&(De(e.target.files),e.target.value="")},disabled:L,style:{display:"none"},"aria-hidden":!0}),!F&&e(RA,{open:$&&!!oe&&!L,size:E,disabled:L,borderRadius:Ge,onEdit:Je,onDelete:Ze,onHoverChange:ee}),(v||ae)&&e(vA,{frameBorderRadius:Ge,children:e(_,{size:"small"===E?16:22,sx:{color:K[600]}})}),te&&e(vA,{frameBorderRadius:Ge,children:e(q,{variant:"caption",color:G[900],children:"Drop"})}),Qe?e(bA,{sx:{borderRadius:Ge},children:e("img",{src:xe,alt:"Logo",onError:Me,style:{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",display:"block",borderRadius:Ye}})}):e(KA,{size:E,disabled:L,enableCaptureImage:F,onAttach:Je,onCapture:ve})]}),t(a,{gap:"5px",justifyContent:"center",children:[A&&e(Oe,{disabled:L,required:y,children:A}),m&&e(q,{noWrap:!0,variant:"caption",color:K[800],children:m}),ne&&e(q,{variant:"caption",color:"error",children:ne})]})]}),F&&Qe&&!L&&e(pA,{open:me,anchorEl:P.current,size:E,actions:Ve,onClose:()=>fe(!1),onMouseEnter:Le,onMouseLeave:ye}),Ce&&Ae&&he&&o&&e(SA,{open:Ce,imageSrc:Ae,originalFile:he,aspectRatios:M,enabledVariants:b,onClose:()=>{de(!1),Se()},onApply:({cropped:e,variants:t,previewUrl:i,aspectRatio:r})=>{be(),O.current=i,re(i),le(null),de(!1),o({original:he,cropped:e,variants:t,aspectRatio:r,previewUrl:i}),Ns.success({title:"Logo cropped successfully"}),Se()}}),F&&ue&&e(Ld,{open:ue,isUploading:v||ae,onChange:De,onClose:()=>{ge(!1),Se()}})]})}const zA=v(le,{shouldForwardProp:e=>"selected"!==e})((({theme:e,selected:t})=>({background:e.palette.app.color.iron[600],color:e.palette.app.color.mirage[900],borderRadius:"4px",border:`1px solid ${e.palette.app.color.butterflyBlue[300]}`,...t?{background:e.palette.app.color.deepAqua[500],color:e.palette.app.color.mirage[900],borderLeft:`6px solid ${e.palette.app.color.butterflyBlue[900]}`}:{}})));function PA({label:i,selected:o,actions:r,companyName:n,href:l,target:s,...d}){const A=J(),{iron:c}=A.palette.app.color,g=p(null),[m,f]=h(!1);u((()=>{const e=g.current;if(!e)return;const t=()=>f(e.scrollWidth>e.clientWidth);return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[i,n]);return e(zA,{selected:o,alignItems:"flex-start",...l?{component:C,href:l,target:s,prefetch:!1}:{},...d,children:t(a,{width:"100%",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[t(a,{gap:"5px",direction:"column",flex:1,display:"grid",children:[e(xl,{toolTipLabel:i,checkOverflow:!m,children:e(q,{variant:"body2",fontWeight:500,ref:g,sx:{width:"auto",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:i})}),e(q,{variant:"caption",color:c[800],children:n})]}),r]})})}const OA=new Set(["+","-","e","E","*","/","=","%","^"]),NA=/[+\-eE*/=%^]/,XA={string:"Only alphabetic characters are allowed.","string-number":"Only letters and numbers are allowed.","string-number-special":"Special characters are allowed.","string-special":"Only letters, accents, apostrophes, and hyphens are allowed.","string-special-all":"Only letters and Special characters are allowed",custom:"Please enter a valid input"};function _A({control:i,name:o,defaultValue:r,label:n="",rules:l,type:s,required:C,disabled:d,readOnly:A=!1,loading:c=!1,placeholder:h="",isCapitalize:p=!1,isTrimStartDisabled:u=!1,rows:g,characterType:m="string-number-special",letterCase:f="mixed",setError:k,containerProps:E,styling:I="custom",infoMessage:w,regexExpression:S={message:null,regex:/^[\s\S]*$/},navigationKey:B,customOnChange:x,size:Q,InputProps:M,inputProps:b,...J}){const{field:{value:v,onChange:R,onBlur:L,...y},fieldState:{error:F}}=$e({name:o,control:i,defaultValue:r,rules:l}),{navigationKey:U}=Uo(),D=B??U,{inputRef:Z,maintainFocus:H,handleKeyDown:K,handleEnterNavigation:G}=or({navigationKey:D}),{inputHeight:Y,inputFontSize:V}=tC(Q),T=Boolean(g??J.multiline),j=e=>{let t=e;const i=(e=>{switch(e){case"string":return/^[A-Za-z\s]*$/;case"string-number":return/^[A-Za-z0-9\s]*$/;case"string-number-special":default:return/^[\s\S]*$/;case"string-special":return/^[\p{L}’'\-\s.]+$/u;case"string-special-all":return/^[^\d]+$/;case"custom":return S.regex}})(m);return i.test(t)||(t=t.split("").filter((e=>i.test(e))).join("")),"uppercase"===f?t=t.toUpperCase():"lowercase"===f&&(t=t.toLowerCase()),t},{message:W}=S,q=W||XA[m];return c?e(od,{label:n,multiline:T,styling:I,size:Q}):t(a,{...E,gap:"5px",children:[n&&"custom"===I&&t(a,{direction:"row",children:[e(Oe,{required:C,disabled:d,children:n}),w&&e(xl,{toolTipLabel:w,children:e(Vt,{sx:{fontSize:13}})})]}),e(Ne,{disabled:d,required:C,fullWidth:!0,inputRef:Z,onKeyDown:e=>{"number"===s&&OA.has(e.key)&&e.preventDefault();!Boolean(g??J.multiline)||"Enter"!==e.key||"enter"!==D||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey?K(e,void 0,!1):G(e,!0)},onPaste:e=>{(A||"number"===s&&NA.test(e.clipboardData.getData("text")))&&e.preventDefault()},placeholder:"default"===I?h:h||n,type:s,label:"default"===I?n:void 0,sx:{...rC(I),"& .MuiInputBase-root":{...!T&&{height:`${Y}px !important`,fontSize:V}}},InputLabelProps:oC(I,Q,T),InputProps:{...M,readOnly:A||M?.readOnly},inputProps:{min:0,...b,readOnly:A||b?.readOnly},error:Boolean(F),helperText:F?.message,onChange:e=>{if(A)return;const t=e.target,{selectionStart:i,selectionEnd:r}=t;let n=e.target.value||null;"string"==typeof n&&""===n.trim()?n=null:u||"string"!=typeof n||(n=n.trimStart());const l=n&&j(n);if(n!==l&&k)return void k(o,{type:"manual",message:q});let a=l;n&&"number"===s?a=Number(n):p&&l&&(a=l?l.toUpperCase():null),R(a),x&&x(n),requestAnimationFrame((()=>{"text"==s&&t.setSelectionRange(i,r),H()}))},onBlur:()=>{if(!u&&"string"==typeof v){const e=v.trim(),t=""===e?null:e;v!==t&&R(t)}L()},value:"string"==typeof v?v.trimStart():v??"",...y,...J})]})}function $A(t){const[i,o]=h(!1);return e(_A,{type:i?"text":"password",InputProps:{startAdornment:e(Pe,{position:"start",children:e(Ii,{fontSize:"small"})}),endAdornment:e(Pe,{position:"end",children:e(r,{"aria-label":"toggle password visibility",onClick:()=>{o((e=>!e))},edge:"end",children:e(i?wi:Nt,{fontSize:"small"})})})},...t})}const ec=v(M,{shouldForwardProp:e=>"error"!==e})((({styling:e,theme:t,error:i,size:o})=>{const r={position:"relative"},{red:n,butterflyBlue:l,iron:a,slate:s,black:C}=t.palette.app.color,{fontSize:d}=iC(o);return"custom"===e?{...r,"&.custom_phone_input":{"& .phone-input-container":{"&:focus-within":{border:`2px solid ${l[900]} !important`}},"& .phone-input-field":{padding:"8.5px 50px 8.5px 30px","&:focus":{"& ~ .flag-dropdown":{borderColor:i?n[900]:l[900]}}},"& .flag-dropdown":{"&.open":{borderColor:i?n[900]:l[900]}}}}:{"&.default_phone_input":{"& .react-tel-input":{"& .form-control":{fontSize:"16px",background:a[600],border:`1px solid ${s[100]}`,borderRadius:"5px",width:"300px",outline:"none",padding:"18.5px 14px 18.5px 58px",transition:"box-shadow ease .25s, border-color ease .25s","&:focus":{borderColor:l[900],boxShadow:`0 0 0 2px ${l[900]}`},"&.invalid-number":{border:`1px solid ${n[900]}`,"&:focus":{boxShadow:`0 0 0 2px ${n[900]}`},"&+div:before":{content:"'Error'",display:"none",color:`${n[900]}`,width:"27px"}}},"& .flag-dropdown":{position:"absolute",top:"0",bottom:"0",padding:"0",backgroundColor:a[600],borderRadius:"3px 0 0 3px","&:hover, &:focus":{cursor:"pointer"}},"& input[disabled]":{"&+.flag-dropdown":{"&:hover":{cursor:"default",borderColor:s[100],"& .selected-flag":{backgroundColor:"transparent"}}}},"& .selected-flag":{outline:"none",position:"relative",height:"100%",padding:"0 0 0 8px",borderRadius:"3px 0 0 3px","&:focus":{"& .arrow":{borderLeftWidth:"4px",borderRightWidth:"4px",borderTop:`5px solid ${l[900]}`}},"& .flag":{position:"absolute",top:"50%",marginTop:"-6px"},"& .arrow":{position:"relative",top:"50%",marginTop:"-1px",width:"0",height:"0",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderTop:"4px solid #555","&.up":{borderTop:"none",borderBottom:"4px solid #555"}}},"& .country-list":{outline:"none",zIndex:1,listStyle:"none",position:"absolute",padding:"0",margin:"10px 0 10px -1px",backgroundColor:"white",width:"300px",maxHeight:"220px",overflowY:"scroll",borderRadius:"7px","& .flag":{display:"inline-block",position:"absolute",left:"13px",top:"8px",marginRight:"7px",marginTop:"2px"},"& .divider":{paddingBottom:"5px",marginBottom:"5px",borderBottom:"1px solid #ccc"},"& .country":{position:"relative",padding:"12px 9px 13px 46px","& .dial-code":{color:"#6b6b6b"},"&:hover":{backgroundColor:"hsl(0, 0.00%, 94.50%)"},"&.highlight":{backgroundColor:s[300]}},"& .country-name":{marginRight:"6px"},"& .search":{zIndex:2,position:"sticky",top:"0",backgroundColor:"#fff",padding:"10px 0 6px 10px"},"& .search-emoji":{display:"none",fontSize:"15px"},"& .search-box":{border:`1px solid ${s[100]}`,borderRadius:"3px",fontSize:"15px",lineHeight:"15px",marginLeft:"6px",padding:"3px 8px 5px",outline:"none","&:hover":{borderColor:s[50]}},"& .no-entries-message":{padding:"7px 10px 11px",opacity:".7"}},"& .invalid-number-message":{position:"absolute",zIndex:1,fontSize:"13px",left:"25px",top:"-7px",background:"#fff",padding:"0 5px",color:n[900]},"& .special-label":{position:"absolute",zIndex:5,top:"small"===o?"-8px":"-9px",left:"0px",display:"block",color:C[900],background:a[600],opacity:"1",fontSize:`${d}px`,whiteSpace:"nowrap",lineHeight:"1.1",scale:"small"===o?.83:.85}},"&.phone-input-required .react-tel-input .special-label::after":{content:"' *'",color:n[900],fontSize:"13px",fontWeight:500}}}})),tc=({rows:i,label:o,styling:r,size:n})=>{const{inputHeight:l}=tC(n),s=void 0===i?l:26.5*i;return t(a,{gap:"5px",children:[o&&"custom"===r&&e(we,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(we,{height:`${s}px`,sx:{transform:"scale(1)"}})]})};function ic({control:i,name:o,defaultValue:r,rules:n,label:l,disabled:s=!1,required:C,rows:d,loading:A=!1,placeholder:c="",error:g,helperText:m,navigationKey:f,styling:k="custom",size:E,autoFocus:I=!1,...w}){const S=J(),{iron:B,red:x,slate:Q}=S.palette.app.color,{navigationKey:M}=Uo(),b=f??M,{inputHeight:v,inputFontSize:R}=tC(E),{inputProps:L,...y}=w,F={...L??{},...I&&!s?{autoFocus:!0}:{}},{field:{value:U,onChange:D,...Z}}=$e({name:o,control:i,defaultValue:r,rules:n}),[H,K]=h(!1),{setInputRef:G,maintainFocusAfterClose:Y,handleKeyDown:V}=or({isOpen:H,navigationKey:b}),T=p(null);return u((()=>{const e=T.current;if(!e||s)return;const t=e.querySelector("input[type='tel']");t&&(G(t),Z.ref(t));const i=()=>{const t=e.querySelector(".country-list"),i=e.querySelector(".react-tel-input");if(!t)return;const o=i?.getBoundingClientRect()?.width,r=e.querySelector(".flag-dropdown")?.getBoundingClientRect();r&&(t.style.position="fixed",t.style.top=`${r.bottom}px`,t.style.left=`${r.left}px`,t.style.zIndex="99999",t.style.maxHeight="200px",t.style.overflowY="auto",t.style.width=`${o}px`)},o=()=>{i()};window.addEventListener("resize",o),window.addEventListener("scroll",o,!0);const r=()=>{const t=e.querySelector(".selected-flag");t&&(t.setAttribute("tabindex","-1"),t.addEventListener("focus",(()=>{t.blur()})));const o=!!e.querySelector(".flag-dropdown.open");K(o),o&&(i(),setTimeout((()=>{const t=e.querySelector(".country-list .search-box input");t&&t.focus()}),0))},n=new MutationObserver((e=>{r();e.some((({addedNodes:e})=>!e.length))&&i()}));n.observe(e,{attributes:!0,attributeFilter:["class"],subtree:!0,childList:!0});const l=e=>{const t=e.target;(t.closest(".flag-dropdown")||t.closest(".country-list"))&&setTimeout(r,0)},a=e=>{const t=e.target;t.closest(".flag-dropdown")||t.closest(".country-list")||setTimeout(r,0)};return e.addEventListener("click",l),document.addEventListener("click",a),r(),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0),n.disconnect(),e.removeEventListener("click",l),document.removeEventListener("click",a)}}),[G,Z,s]),A?e(tc,{label:l,rows:d,styling:k,size:E}):t(a,{gap:"4px",children:[t(a,{gap:"5px",children:[l&&"custom"===k&&e(Oe,{required:C,disabled:s,children:l}),e(ec,{ref:T,styling:k,error:g,size:E,className:`${"custom"===k?"custom_phone_input":"default_phone_input"}${C?" phone-input-required":""}`,children:e(Si,{country:"in",enableSearch:!0,disabled:s,specialLabel:l??"",placeholder:c||l,onChange:e=>{D(e)},value:String(U),onBlur:()=>{Z.onBlur(),H||Y()},onKeyDown:e=>{H||V(e,void 0,!1)},containerStyle:{width:"100%",height:`${v}px`,border:g?`1px solid ${x[900]}`:s?`1px solid ${B[700]}`:`1px solid ${B[800]}`,borderRadius:"4px",transition:"all 0.2s ease"},inputStyle:{width:"100%",padding:"8.5px 40px",fontSize:R,height:`${v}px`,border:"none",outline:"none",transition:"all 0.2s ease",color:s?B[100]:Q[900]},containerClass:"phone-input-container",inputClass:"phone-input-field",buttonStyle:{border:"none"},...y,inputProps:F})})]}),g&&e(q,{variant:"caption",sx:{color:"red",whiteSpace:"pre",textWrap:"wrap"},children:m})]})}const oc={complete:100,high:55,mid:25},rc=(e,t=oc)=>{const{complete:i,high:o,mid:r}=t;return e>=i?"complete":e>=o?"high":e>=r?"mid":"low"},nc=(e,t,i=oc)=>t[rc(e,i)],lc={small:{barHeight:4,labelMinWidth:24,spacing:.75,fontSize:"11px",skeletonLabelHeight:16},medium:{barHeight:6,labelMinWidth:28,spacing:1,fontSize:"12px",skeletonLabelHeight:20},large:{barHeight:8,labelMinWidth:32,spacing:1.25,fontSize:"13px",skeletonLabelHeight:22}},ac=({completed:i,total:o,progress:r,displayMode:n,showLabel:l=!0,hideLabel:s=!1,labelPlacement:C="right",size:d="medium",loading:A=!1,label:c,getBarColor:h,bandColors:p,bandThresholds:u,sx:g})=>{const m=J(),{butterflyBlue:f,darkMint:k,darkOrange:E,iron:I,lipstickRed:w}=m.palette.app.color,{barHeight:S,labelMinWidth:B,spacing:x,fontSize:Q,skeletonLabelHeight:M}=lc[d],b=!s&&l,v="left"===C,R=i??0,L=o??0,{isPercentageMode:y,percentage:F}=(({displayMode:e,progress:t,completed:i,total:o})=>{const r="percentage"===e||void 0===e&&null!=t;let n=0;return r?n=t??0:o>0&&(n=i/o*100),{isPercentageMode:r,percentage:Math.min(100,Math.max(0,Math.round(n)))}})({displayMode:n,progress:r,completed:R,total:L}),U=y?`${F}%`:`${R}/${L}`,D={complete:p?.complete??k[900],high:p?.high??f[900],mid:p?.mid??E[900],low:p?.low??w[900]},Z=h?.(F)??nc(F,D,{...oc,...u}),H=b?c??e(q,{variant:"caption",fontWeight:600,sx:{minWidth:B,whiteSpace:"nowrap",fontSize:Q},children:U}):null,K=b?e(we,{variant:"text",width:B,height:M,sx:{flexShrink:0}}):null,G=A?e(we,{variant:"rounded",height:S,sx:{flex:1,borderRadius:3}}):e(xi,{variant:"determinate",value:F,sx:{flex:1,height:S,borderRadius:3,backgroundColor:I[700],"& .MuiLinearProgress-bar":{borderRadius:3,backgroundColor:Z}}});return t(a,{direction:"row",alignItems:"center",spacing:x,sx:{width:"100%",height:"100%",...g},children:[v&&(A?K:H),G,!v&&(A?K:H)]})},sc={small:{railHeight:6},medium:{railHeight:8},large:{railHeight:10}},Cc=({label:i,size:o="medium"})=>{const{railHeight:r}=sc[o];return t(a,{gap:"5px",sx:{width:"100%"},children:[i&&e(we,{width:120,height:18,sx:{transform:"scale(1)"}}),e(we,{variant:"rounded",height:r,sx:{width:"96%",borderRadius:4}})]})},dc=e=>Math.round(100*(e+Number.EPSILON))/100,Ac=(e,t)=>t<=0?0:Math.min(100,Math.max(0,e/t*100)),cc=e=>e<=0?1:Math.max(.01,dc(e/100)),hc=e=>Array.isArray(e)?e[0]:e,pc={small:{railHeight:6,thumbSize:12,py:"4px"},medium:{railHeight:8,thumbSize:16,py:"6px"},large:{railHeight:10,thumbSize:20,py:"8px"}};function uc({name:i,control:o,defaultValue:r,rules:n,targetValue:l,label:s,showLabel:C=!0,hideLabel:d=!1,size:A="medium",readOnly:c=!1,required:h=!1,loading:p=!1,disabled:u=!1,getBarColor:g,bandColors:m,bandThresholds:f,containerSx:k,valueLabelDisplay:E="auto",valueLabelFormat:I,"aria-label":w="Current progress",sx:S,...B}){const x=J(),{butterflyBlue:Q,darkMint:M,darkOrange:b,iron:v,lipstickRed:R}=x.palette.app.color,{railHeight:L,thumbSize:F,py:U}=pc[A],D=!d&&(C&&!!s),{field:{value:Z,onChange:H,...K},fieldState:{error:G}}=$e({name:i,control:o,defaultValue:r,rules:n});if(p)return e(Cc,{label:D?s:void 0,size:A});const Y=l>0?l:0,V="number"==typeof Z?Z:0,T=Math.min(Y,Math.max(0,V)),j=Ac(V,l),W={complete:m?.complete??M[900],high:m?.high??Q[900],mid:m?.mid??b[900],low:m?.low??R[900]},q={...oc,...f},z=g?.(j)??nc(j,W,q);return t(a,{gap:"5px",sx:{width:"100%",...k},children:[D&&e(Oe,{required:h,disabled:u||Y<=0,children:s}),e(ui,{...K,...B,size:"large"===A?"medium":A,value:T,min:0,max:Y,step:cc(l),disabled:u||Y<=0,valueLabelDisplay:E,valueLabelFormat:I??(e=>`${Ac(e,l).toFixed(2)}%`),"aria-label":w,"aria-readonly":c||void 0,onChange:(e,t)=>{if(c)return;const i=hc(t);"number"==typeof i&&H(dc(i))},sx:{width:"96%",py:U,color:z,...c&&{pointerEvents:"none",cursor:"default"},"& .MuiSlider-rail":{height:L,borderRadius:4,bgcolor:y(v[700],.6),opacity:1},"& .MuiSlider-track":{height:L,borderRadius:4,border:"none"},"& .MuiSlider-thumb":{width:F,height:F,...c&&{display:"none"},"&:hover, &.Mui-focusVisible, &.Mui-active":{boxShadow:`0 0 0 6px ${y(z,.16)}`}},...S}}),G&&e(Bi,{error:!0,children:G.message})]})}const gc=e=>"medium"===e?26:20,mc=({isHorizontal:i,direction:o,optionsLength:r,size:n})=>{const l=gc(n);return t(a,{gap:"10px",direction:i?"row":"column",alignItems:i&&"row"===o?"center":void 0,children:[e(we,{height:"18.69px",width:"70px",sx:{transform:"scale(1)"}}),e(a,{direction:o,gap:"column"===o?"5px":"10px",children:Array.from({length:r}).map((()=>t(a,{gap:"10px",direction:"row",alignItems:"center",children:[e(we,{variant:"circular",height:l,width:l}),e(we,{height:"21px",width:"100px",sx:{transform:"scale(1)"}})]},ti())))})]})};function fc({name:i,rules:o,label:r,control:n,options:l,defaultValue:s,size:C="small",color:d="secondary",loading:A=!1,required:c=!1,direction:h="row",sx:u={},containerProps:g,isHorizontal:m=!1,navigationKey:f,customOnChange:k,...E}){const{field:{value:I,onChange:w,ref:S,...B}}=$e({name:i,control:n,defaultValue:s,rules:o}),{navigationKey:x}=Uo(),Q=f??x,{inputRef:b,handleKeyDown:J,maintainFocus:v}=or({navigationKey:Q}),R=p(null);return A?e(mc,{isHorizontal:m,direction:h,optionsLength:l.length,size:C}):t(a,{direction:m?"row":"column",alignItems:m?"center":void 0,gap:m?1:"5px",children:[r&&e(Oe,{sx:{whiteSpace:"normal",overflow:"visible",textOverflow:"unset"},required:c,disabled:E.disabled,children:r}),e(bi,{name:i,value:I,onKeyDown:e=>{J(e,void 0,!1)},onChange:(e,t)=>{let i;if("true"===t?(i=!0,w(!0)):"false"===t?(i=!1,w(!1)):(i=t,w(t)),k){const e=l.find((({values:e})=>e===i));e&&k(e)}const o=e.target;o?b.current=o:!b.current&&R.current&&(b.current=R.current),v()},children:e(a,{gap:"column"===h?"5px":"10px",direction:h,...g,children:l?.map((({label:t,values:i,disabled:o},r)=>e(M,{children:e(Qi,{value:i,control:e(Mi,{...B,...E,color:d,size:C,inputRef:e=>{if(!e)return;I===i||!b.current&&0===r?(b.current=e,R.current=e):R.current||0!==r||(R.current=e),S&&("function"==typeof S?S(e):S.current=e)},sx:{"& .MuiSvgIcon-root":{fontSize:gc(C)}}}),disabled:o,label:t,sx:u})},r)))})})]})}const kc={small:17,medium:22,large:28},Ec=({label:i,size:o="medium",direction:r="row",max:n=5})=>{const l=kc[o],s=Array.from({length:n},((e,t)=>`star-${t+1}`));return t(a,{gap:"5px",direction:r,alignItems:"row"===r?"center":"flex-start",children:[i&&e(we,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(a,{gap:"2px",direction:"row",children:s.map((t=>e(we,{variant:"rectangular",width:l,height:l,sx:{borderRadius:"5px"}},t)))})]})};function Ic({control:o,name:r,defaultValue:n,label:l="",rules:s,disabled:C,loading:d=!1,direction:A="column",required:c=!1,navigationKey:h,size:p,max:u,containerSx:g,...m}){const{field:{value:f,onChange:k,...E},fieldState:{error:I}}=$e({name:r,control:o,defaultValue:n,rules:s}),{navigationKey:w}=Uo(),S=h??w,{maintainFocus:B,handleKeyDown:x}=or({navigationKey:S});return d?e(Ec,{label:l,size:p,direction:A,max:u}):t(i,{children:[t(a,{gap:"5px",direction:A,alignItems:"row"===A?"center":"flex-start",sx:g,children:[l&&e(Oe,{required:c,disabled:C,children:l}),e("div",{onKeyDown:e=>{x(e,void 0,!1)},children:e(Ji,{disabled:C,value:f??null,onChange:(e,t)=>{k(t),B()},size:p,max:u,...E,...m})})]}),I&&e(Bi,{error:!0,children:I?.message})]})}function wc(t){return e(_A,{placeholder:"Search",InputProps:{startAdornment:e(Pe,{position:"start",children:e(vi,{fontSize:"small"})})},...t,containerProps:{width:{sm:"auto",xs:"100%"},...t.containerProps}})}const Sc=({top:t="0px",paperSx:i,boxSx:o,...r})=>e(se,{variant:"outlined",sx:{position:"sticky",top:t,zIndex:100,...i},children:e(jl,{padding:{padding:"5px"},children:e(M,{sx:{display:"flex",justifyContent:"flex-end",...o},children:e(wc,{...r})})})}),Bc=v(Ui)((({theme:e,disabled:t})=>{const{lightBlue:i,iron:o}=e.palette.app.color;return{"& .MuiInputBase-root":{backgroundColor:t?y(i[100],.3):o[600]},"& .MuiSelect-select":{display:"flex",alignItems:"center",gap:"8px",flexWrap:"nowrap",overflow:"hidden"},"& .MuiList-root":{maxHeight:300,overflowY:"auto","&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{backgroundColor:i[100]}}}})),xc=v(q)((({theme:e})=>{const{butterflyBlue:t}=e.palette.app.color;return{position:"sticky",top:0,padding:"8px 16px",fontSize:"13px",fontWeight:600,color:t[900],backgroundColor:t[500],zIndex:1}}));function Qc({control:o,defaultValue:n,name:s,required:C=!1,label:d,multiple:A=!1,disabled:u=!1,options:m=[],rules:f,loading:k=!1,helperText:E,error:I,placeholder:w="",isShowSelectAll:S=!0,isShowAvatar:B=!1,onAction:x,renderOption:Q,maxLimit:v,maxDisplayItems:R=2,disableClearable:L=!!C,setOnFinalChange:y=!1,styling:F="custom",navigationKey:U,...D}){const{field:{onChange:Z,value:H,...K}}=$e({name:s,control:o,defaultValue:n,rules:f}),{navigationKey:G}=Uo(),Y=U??G,{t:V}=ot(),T=J(),{slate:j,iron:W}=T.palette.app.color,z=u?W[900]:"revert-layer",[P,O]=h(null),N=p(!1),[X,_]=h(!1),{setInputRef:ee,maintainFocusAfterClose:te,handleKeyDown:ie,handleEnterNavigation:oe}=or({isOpen:X,navigationKey:Y}),re=c((()=>{if(!A||!S||!Array.isArray(H))return!1;const e=m.filter((e=>!e.disabled));return H.length===e.length}),[A,S,m,H]),ne=c((()=>{if(!A||!Array.isArray(H))return[];const e=new Set(H);return m.filter((t=>e.has(t.value)))}),[A,m,H]),le=c((()=>{const e={};return m.forEach((t=>{const i=t.heading??"";e[i]||(e[i]=[]),e[i].push(t)})),e}),[m]),ae=c((()=>!L&&(!!H&&(Array.isArray(H)?H.length>0:""!==H))),[H,L]),se=g((e=>{e.stopPropagation(),Z(A?[]:"")}),[A,Z]),Ce=g((e=>{"enter"===Y&&"Enter"===e.key&&(e.stopPropagation(),oe(e))}),[Y,oe]),de=g((()=>t(a,{direction:"row",alignItems:"center",gap:"5px",children:[ae&&!X&&e(r,{size:"small",onClick:se,onKeyDown:Ce,children:e(yi,{sx:{fontSize:"14px"}})}),e(r,{size:"small",onClick:e=>{e.stopPropagation(),_((e=>!e))},onKeyDown:e=>{"Enter"===e.key&&(e.stopPropagation(),_((e=>!e)))},children:e(Fi,{fontSize:"small",sx:{transform:X?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease-in-out"}})})]})),[ae,se,Ce,X,_]);if(k)return t(a,{gap:"10px",children:[d&&"custom"===F&&e(we,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(we,{height:"35.69px",sx:{transform:"scale(1)"}})]});const Ae=()=>y&&N.current?P:H;return t(a,{gap:"5px",children:[d&&"custom"===F&&e(Oe,{required:C,disabled:u,children:d}),t(a,{direction:"row",justifyContent:"space-between",gap:"10px",alignItems:"start",children:[t(Bc,{fullWidth:!0,error:I,disabled:u,required:C,sx:"default"===F?{...nC(F),"& .MuiOutlinedInput-notchedOutline":{"& legend":{maxWidth:0,"& span":{padding:"0 5px"}}},"& .MuiInputLabel-root.MuiInputLabel-shrink + .MuiInputBase-root .MuiOutlinedInput-notchedOutline legend":{maxWidth:"100%"}}:void 0,children:[d&&"default"===F&&e(Oe,{id:`${s}-label`,sx:lC(F),children:d}),e(Li,{...K,...D,multiple:A,value:Ae()??(A?[]:""),label:"default"===F?d:void 0,labelId:"default"===F&&d?`${s}-label`:void 0,inputProps:{"aria-label":"custom"===F&&d?d:void 0},onChange:e=>{const t=e.target.value;if(y)N.current=!0,A&&Array.isArray(t)&&t.includes("select-all")?O(Array.isArray(P)&&P.length===m.filter((({disabled:e})=>!e)).length?[]:m.filter((({disabled:e})=>!e)).map((({value:e})=>e))):O(t);else{if(A&&Array.isArray(t)){if(t.includes("select-all"))return void(e=>{if(e){const e=m.filter((e=>!e.disabled)).map((e=>e.value));Z(e)}else Z([])})(!re);if(v&&t.length>v)return void Ns.error({title:V("common.select.limitExceed",{maxLimit:v})})}Z(t)}},open:X,onOpen:()=>{_(!0)},onClose:()=>{_(!1),te(),y&&N.current&&(Z(P),N.current=!1,O(null))},inputRef:e=>ee(e),onKeyDown:e=>{ie(e,(()=>{_(!1)}),X)},renderValue:D.renderValue??(i=>{if(!A){const o=m.find((e=>e.value===i)),r=()=>o?o.label:"default"===F&&d?"":w;return t(M,{sx:{display:"flex",alignItems:"center",gap:1},children:[B&&o?.avatar&&e(Se,{src:o.avatar??"",sx:{width:20,height:20}}),e(q,{variant:"body2",color:z,sx:{WebkitTextFillColor:z},noWrap:!0,children:r()})]})}if(!Array.isArray(i)||0===i.length){return e(q,{sx:{WebkitTextFillColor:z},color:z,variant:"body2",noWrap:!0,children:"default"!==F||!d||w?w:""})}const o=ne.slice(0,R),r=ne.length-R;return t(M,{sx:{display:"flex",alignItems:"center",gap:.5,overflow:"hidden"},children:[o.map((t=>e(q,{variant:"body2",noWrap:!0,color:z,sx:{WebkitTextFillColor:z,backgroundColor:j[800],padding:"2px 5px",borderRadius:"12px",fontSize:"12px",maxWidth:"120px"},children:t.label},t.value))),r>0&&t(q,{variant:"body2",color:z,sx:{WebkitTextFillColor:z,backgroundColor:j[300],padding:"2px 5px",borderRadius:"12px",fontSize:"12px",fontWeight:500},children:["+",r]})]})}),IconComponent:de,displayEmpty:!0,MenuProps:{PaperProps:{sx:{width:"inherit",maxHeight:300,"& .MuiList-root":{paddingTop:0,paddingBottom:0}}},MenuListProps:{...D.MenuProps?.MenuListProps,variant:"menu"}},children:Object.entries(le).length?(()=>{const o=[],r=Ae(),n=A&&Array.isArray(r)?new Set(r):new Set;return A&&S&&m.length>0&&(o.push(t(l,{value:"select-all",children:[e(b,{icon:e($s,{size:"small"}),checkedIcon:e(eC,{size:"small"}),indeterminate:Array.isArray(r)&&r.length>0&&r.length<m.filter((({disabled:e})=>!e)).length,checked:Array.isArray(r)&&r.length===m.filter((e=>!e.disabled)).length,sx:{marginRight:1}}),e(Ri,{primary:"Select All"})]},"select-all")),o.push(e($,{sx:{margin:"0px !important"}},"divider-select-all"))),Object.entries(le).forEach((([a,s])=>{a&&o.push(e(xc,{children:a},`group-${a}`)),s.forEach((a=>{const s=A?n.has(a.value):r===a.value;o.push(e(l,{value:a.value,disabled:a.disabled,children:Q?Q(a,s):t(i,{children:[A&&e(b,{icon:e($s,{size:"small"}),checkedIcon:e(eC,{size:"small"}),checked:s,sx:{marginRight:1}}),t(M,{sx:{display:"flex",alignItems:"center",gap:1},children:[B&&a.avatar&&e(Se,{src:a.avatar,alt:a.label,sx:{width:24,height:24}}),e(Ri,{primary:a.label})]})]})},a.value))}))})),o})():e(l,{disabled:!0,children:e(Ri,{primary:"No options"})})}),E&&e(Bi,{children:E})]}),x&&e(yl,{disabled:u,onClick:x})]})]})}const Mc=()=>e(we,{width:50,height:18,sx:{borderRadius:"10px"},variant:"rectangular"});function bc({name:t,rules:i,control:o,defaultValue:r,loading:n=!1,navigationKey:l,...a}){const s=J(),{butterflyBlue:C,iron:d}=s.palette.app.color,{field:{value:A=!1,...c}}=$e({name:t,control:o,defaultValue:r,rules:i}),{navigationKey:h}=Uo(),p=l??h,{setInputRef:u,maintainFocus:g,handleKeyDown:m}=or({navigationKey:p});if(n)return e(Mc,{});return e(Di,{checked:A,...c,...a,inputRef:u,onKeyDown:e=>{m(e,void 0,!1),a.onKeyDown&&a.onKeyDown(e)},onChange:e=>{c.onChange(e),g()},sx:{padding:1,"& .MuiSwitch-track":{borderRadius:11,backgroundColor:d[900],position:"relative","&::before":{content:"unset",position:"absolute",top:"50%",transform:"translateY(-50%)",width:16,height:16,left:12},[Zi.input]:{width:"80px !important"},"&::after":{content:"unset",position:"absolute",top:"50%",transform:"translateY(-50%)",width:16,height:16,right:12}},"& .MuiSwitch-thumb":{boxShadow:"none",width:16,height:16,margin:.15,color:"white"},"& .Mui-checked + .MuiSwitch-track":{backgroundColor:`${C[900]} !important`,opacity:"1 !important"}}})}const Jc=({label:i,styling:o,size:r})=>t(a,{gap:"5px",flex:1,children:[i&&"custom"===o&&e(we,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(we,{height:`${tC(r).inputHeight}px`,width:"100%",sx:{transform:"scale(1)"}})]});function vc({control:i,defaultValue:o,disabled:r=!1,label:n,name:l,error:s,helperText:C,loading:d=!1,required:A=!1,rules:c,format:h="HH:mm",isReturnLocalTime:p=!1,isReturnDateWithTime:u=!1,styling:g="custom",navigationKey:m,size:f,...k}){const{field:{value:E,onChange:I,...w}}=$e({name:l,control:i,defaultValue:o,rules:c}),{navigationKey:S}=Uo(),B=m??S,{inputRef:x,maintainFocus:Q,handleKeyDown:M}=or({navigationKey:B}),{inputHeight:b,inputFontSize:v}=tC(f),R=J(),{butterflyBlue:L}=R.palette.app.color;s&&E&&"object"==typeof E&&(C="Invalid time");const y=E?U.fromISO(E):null;return d?e(Jc,{label:n,styling:g,size:f}):t(a,{gap:"5px",children:[n&&"custom"===g&&e(Oe,{required:A,disabled:r,children:n}),e(Hi,{...w,...k,disabled:r,value:y,onChange:e=>{if(e?.isValid){if(p)return I(e.toFormat(h)),void Q();if(u)return I(e.toUTC().toISO()),void Q();I(e.toUTC().toISOTime()),Q()}else I(e),Q()},slotProps:{textField:{disabled:r,helperText:C,error:s,label:"default"===g?n:void 0,required:"default"===g?A:void 0,inputRef:x,InputLabelProps:oC(g,f),onKeyDown:e=>{M(e,void 0,!1)},sx:{...rC(g),width:"100%","& .MuiInputBase-root":{fontSize:v,height:b},backgroundColor:"white","& .Mui-selected":{backgroundColor:L[900],borderRadius:"5px"}}}},format:h,helperText:C,sx:{backgroundColor:"white","& .Mui-selected":{backgroundColor:L[900],borderRadius:"5px"},"& .MuiOutlinedInput-input":{fontSize:v}}})]})}const Rc=({label:i,styling:o,size:r})=>{const{inputHeight:n}=tC(r);return t(a,{gap:"5px",flex:1,children:[i&&"custom"===o&&e(we,{width:120,height:"18.69px",sx:{transform:"scale(1)"}}),e(we,{height:`${n}px`,width:"100%",sx:{transform:"scale(1)"}})]})};function Lc({control:i,defaultValue:o,disabled:r=!1,label:n,readOnly:l=!1,name:s,error:C=!1,helperText:d,loading:A=!1,required:c=!1,rules:p,format:u="HH:mm",isReturnLocalTime:g=!1,isReturnDateWithTime:m=!1,timeStepsMinutes:f=1,helperIcon:k,toolTipText:E,containerProps:I,styling:w="custom",navigationKey:S,size:B,...x}){const{field:{value:Q,onChange:M,...b}}=$e({name:s,control:i,defaultValue:o,rules:p}),[v,R]=h(!1),{navigationKey:L}=Uo(),y=S??L,{setInputRef:F,maintainFocus:D,maintainFocusAfterClose:Z,handleKeyDown:H,handleEnterNavigation:K}=or({isOpen:v,navigationKey:y}),{inputHeight:G,inputFontSize:Y}=tC(B);C&&Q&&"object"==typeof Q&&(d="Invalid time");const V=J(),{butterflyBlue:T}=V.palette.app.color,j=Q?U.fromISO(Q):null;return A?e(Rc,{label:n,styling:w,size:B}):t(a,{gap:"5px",...I,children:[n&&"custom"===w&&t(a,{alignItems:"center",flexDirection:"row",gap:"5px",children:[e(Oe,{required:c,disabled:r,children:n}),k&&E&&e(W,{title:E,placement:"bottom",children:k})]}),e(Ki,{...b,...x,disabled:r,readOnly:l,open:v,ampm:!1,value:j,format:u,onOpen:()=>R(!0),onClose:()=>{R(!1),Z()},timeSteps:{minutes:f},slotProps:{textField:{disabled:r,helperText:d,error:C,label:"default"===w?n:void 0,required:"default"===w?c:void 0,inputRef:F,InputLabelProps:oC(w,B),sx:{...rC(w),width:"100%","& .MuiInputBase-root":{fontSize:Y,height:G},backgroundColor:"white","& .Mui-selected":{backgroundColor:T[900],borderRadius:"5px"},"& .MuiOutlinedInput-input":{fontSize:Y}},onKeyDown:e=>{if("enter"===y){if(" "===e.key&&!v&&!r&&!l)return e.preventDefault(),e.stopPropagation(),void R(!0);if("Enter"===e.key&&!v)return e.preventDefault(),e.stopPropagation(),void K(e);if("Enter"===e.key&&v)return e.preventDefault(),e.stopPropagation(),R(!1),Z(),void requestAnimationFrame((()=>{K(e)}))}H(e,(()=>R(!1)),v)}},openPickerButton:{..."enter"===y?{onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),K(e))}}:{}},popper:{sx:{"& .MuiMultiSectionDigitalClockSection-root::after":{display:"unset"},"& .MuiList-padding":{padding:"10px"},"& .MuiMultiSectionDigitalClockSection-item":{padding:"4px"},"& .MuiMultiSectionDigitalClockSection-item.Mui-selected":{backgroundColor:T[900],borderRadius:"5px"},"& .MuiMultiSectionDigitalClockSection-item.Mui-selected:hover":{backgroundColor:T[900],borderRadius:"5px"},"& .Mui-selected:hover":{backgroundColor:T[900],borderRadius:"5px"},"& .MuiMultiSectionDigitalClockSection-item.Mui-selected:focus-visible":{backgroundColor:T[900],borderRadius:"5px"},"& .Mui-selected:focus-visible":{backgroundColor:T[900],borderRadius:"5px"}},onKeyDown:e=>{"enter"===y&&"Enter"===e.key&&v&&(e.preventDefault(),e.stopPropagation(),R(!1),Z(),requestAnimationFrame((()=>{K(e)})))}}},onChange:e=>{if(e?.isValid){if(g)return M(e.toFormat(u)),void D();if(m)return M(e.toUTC().toISO()),void D();M(e.toUTC().toISOTime()),D()}else M(e),D()}})]})}function yc({field:i,control:o,index:r}){const n=J(),{iron:l}=n.palette.app.color;return e(a,{direction:"row",component:"li",children:t(a,{direction:"row",alignItems:"center",border:"1px solid",flexGrow:1,borderColor:l[700],children:[e(jl,{padding:{paddingLeft:"24px"},children:e(q,{sx:{flexGrow:1},children:i.headerName})}),e(bc,{control:o,name:`columns.${r}.hide`})]})})}function Fc({column:i}){const o=J(),{lightBlue:r,iron:n}=o.palette.app.color;return e(a,{border:"1px solid",bgcolor:r[100],borderColor:n[700],children:e(jl,{padding:{padding:"0px 24px"},children:t(a,{direction:"row",alignItems:"center",justifyContent:"space-between",minHeight:"38px",children:[e(q,{children:i.headerName}),e(Gi,{htmlColor:n[800]})]})})})}function Uc({lockedColumns:o,fields:r,control:n}){return t(i,{children:[o.map((({field:t="fid",colId:i="cid",headerName:o})=>e(Fc,{column:{field:t,colId:i,headerName:o}},t??i))),e(a,{component:"ul",sx:{m:0,p:0},children:r.map(((t,i)=>e(yc,{field:t,control:n,index:i},t.id)))})]})}function Dc({columns:t,children:i}){const o=c((()=>t.filter((e=>!("hide"in e)))),[t]),r=c((()=>t.filter((e=>"hide"in e)).map((e=>({...e,hide:!e.hide})))),[t]),n=p(r),{control:l,reset:a,getValues:s,setValue:C}=et({defaultValues:{columns:n.current}}),{fields:d}=tt({name:"columns",control:l});return c((()=>{C("columns",r)}),[t]),i({reset:e=>{a({columns:e?Array.isArray(e)?e:[e]:n.current})},getValues:s,columnList:e(Uc,{fields:d,lockedColumns:o,control:l})})}function Zc({columns:i,open:o,onClose:r,onSave:n,title:l="Column Chooser"}){const a=(e=>c((()=>e.filter((({field:e,colId:t})=>!!e||!!t)).map((({field:e,hide:t,headerName:i,colId:o})=>{const r={field:e??o,headerName:i};return null!=t&&(r.hide=t),r}))),[e]))(i);return e(Dc,{columns:a,children:({columnList:i,reset:a,getValues:s})=>e(gC,{title:l,open:o,onClose:()=>{r(),a()},maxWidth:"xs",actions:t(bC,{sx:{justifyContent:"space-between",flex:1},children:[e(Rr,{variant:"outlined",onClick:()=>a(),children:"Reset"}),e(Rr,{onClick:()=>{const e=s(),t=Yi(e.columns.map((({field:e,colId:t,hide:i})=>[e??t,i])));n(t),r()},children:"Apply"})]}),children:i})})}const Hc=()=>e(Ti,{className:"bullet-hover",sx:{fontSize:"6px",borderRadius:"50%"}}),Kc=({href:t="/",style:i,scroll:o=!1,...r})=>{const n=Wi(),l=qi(),a=ar(t),{pathname:s,query:d}=a,A=c((()=>{if("string"!=typeof t)return{pathname:t??"/",query:void 0};if(n!==s)return a;const e=Array.from(l.entries()),i={...e.length?Object.fromEntries(e):void 0,...d};return{pathname:s,query:Object.keys(i).length?i:void 0}}),[n,l,t,s,d]);return e(C,{...r,prefetch:!1,scroll:o,style:{textDecoration:"none",outline:"none",...i},href:A})},Gc=({selected:i=!1,icon:o=e(Hc,{}),title:r,endAdornment:n,sx:l,href:s,onClick:C,isShowEndAdornment:d=!1,preventRedirection:A=!1,onPreventRedirection:c,onMenuClick:h,...p})=>{const u=J(),{isMobile:g}=rr(),{butterflyBlue:m,iron:f}=u.palette.app.color;return t(ji,{...p,...d?{}:s?{component:Kc,href:s}:{},onClick:e=>{h&&h(),(!s||d||A)&&(c?.(),C(),e.preventDefault())},sx:{padding:"9.5px 16px",...l,margin:"0",cursor:g||!d?"pointer":"default",userSelect:"none",textDecoration:"none",fontSize:"13px",wordBreak:"break-word",display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",flex:1,width:"100%",color:i?f[600]:u.palette.primary.light,":hover":{color:f[600],".bullet-hover":{color:i?"":m[900]}}},children:[t(a,{alignItems:"center",direction:"row",flex:1,gap:"10px",justifyContent:"center",children:[o,r&&e(Ri,{primary:r,disableTypography:!0,sx:{...l,marginTop:"6px",padding:"0",textAlign:"left"}})]}),n]})},Yc=({icon:t=e(Hc,{}),title:i,isShowEndAdornment:o=!1,selected:r=!1,onMouseEnter:n,href:l,onClick:a,onPreventRedirection:s,preventRedirection:C,onMenuClick:d})=>{const A=J(),{butterflyBlue:c,slate:h}=A.palette.app.color;return e(M,{component:"li",sx:{bgcolor:r&&!o?c[900]:"",padding:i?"0px":"2.5px 0",wordBreak:"break-word"},children:e(Gc,{onClick:a,preventRedirection:C,onPreventRedirection:s,sx:{fontSize:"13px",padding:"9.5px 16px",":focus-visible":{border:`1px solid ${c[900]}`,backgroundColor:h[900]},margin:"0"},selected:r,title:i,icon:t,onMenuClick:d,onMouseEnter:n,href:l,isShowEndAdornment:o,endAdornment:o&&e(Bt,{sx:{fontSize:"16px"}})})})},Vc=({currentPathMenuOpen:o,currentMenuItem:r,onCloseMenuPopover:n,preventRedirection:l=!1,onPreventRedirection:a,onMenuClick:s})=>{const[C,d]=h([]);if(u((()=>{if(!r)return void d([]);const{title:e,key:t,menuItems:i}=r;d([{title:e,items:i??[],parentPath:`/${t}`,currentPathMenuOpen:o[t]??{}}])}),[r,o]),!r)return e(i,{children:"Loading..."});const A=C[C.length-1];if(!A)return null;const c=C.length>1;return t(Vi,{disablePadding:!0,children:[c&&e(Yc,{title:A.title,icon:e(St,{sx:{fontSize:"16px"}}),onClick:()=>{d((e=>e.slice(0,-1)))},onPreventRedirection:a,preventRedirection:l,selected:!1}),A.items.filter((({isView:e})=>!1!==e)).map((t=>{const i=Boolean(t.menuItems?.length),{title:o,icon:r,key:C}=t,c=Boolean(A.currentPathMenuOpen[C]),h=`${A.parentPath}/${C}`;return e(Yc,{onClick:()=>{i?(e=>{const{title:t,menuItems:i,key:o}=e;d((e=>{const r=e[e.length-1];return r?[...e,{title:t,items:i??[],parentPath:`${r.parentPath}/${o}`,currentPathMenuOpen:r.currentPathMenuOpen[o]??{}}]:e}))})(t):((e,t="_self")=>{const{key:i,onClick:o}=e,r=`${A.parentPath}/${i}`;o&&(o(r,t),"_blank"!==t&&n())})(t)},onPreventRedirection:a,preventRedirection:l,title:o,icon:r,onMenuClick:i?void 0:s,isShowEndAdornment:i,selected:c,href:i?void 0:h},C)}))]})},Tc=({open:t,anchorEl:i,children:o})=>{const r=J(),{mirage:n}=r.palette.app.color,l=p(null),[a,s]=h(null),C=g((()=>{const e=l.current;if(!i||!e||i instanceof Element&&!i.isConnected)return;const t=((e,t)=>{const{top:i,left:o,right:r}=e.getBoundingClientRect(),{offsetHeight:n,offsetWidth:l}=t,a=l||203,{innerHeight:s,innerWidth:C}=window,d=n<=s-i-8?i:s-n-8;return{top:Math.max(8,Math.min(d,s-8)),left:a<=C-r-8?r:Math.max(8,o-a)}})(i,e);s((e=>{const{top:i,left:o}=t;return e?.top===i&&e?.left===o?e:t}))}),[i]),d=g((e=>{l.current=e,e&&C()}),[C]);if(E((()=>{if(!t||!i)return void s(null);C();const e=window.requestAnimationFrame((()=>{C()}));window.addEventListener("resize",C),window.addEventListener("scroll",C,!0);const o=l.current,r="undefined"!=typeof ResizeObserver&&o?new ResizeObserver((()=>C())):null;return o&&r&&r.observe(o),()=>{window.cancelAnimationFrame(e),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0),r?.disconnect()}}),[t,i,C,o]),!t)return null;const{top:A=0,left:c=0}=a??{};return e(zi,{children:e(M,{ref:d,role:"presentation",style:{position:"fixed",top:A,left:c,width:203,zIndex:1300,visibility:a?"visible":"hidden",pointerEvents:a?"auto":"none"},sx:{background:n[900]},children:o})})},jc=({item:i,parentPath:o,currentPathMenuOpen:r,onCloseMenuPopover:n,onPreventRedirection:l,preventRedirection:a,onMenuClick:s})=>{const[C,d]=h(null),A=Boolean(C),{key:c,title:p,icon:u,menuItems:g,onClick:m,isView:f}=i;if(!1===f)return;const k=()=>{d(null)},E=Boolean(r[c]),I=`${o}/${c}`;return t(M,{onMouseLeave:k,children:[e(Yc,{onClick:(e="_self")=>{m&&(m(`${o}/${c}`,e),"_blank"!==e&&(k(),n()))},onPreventRedirection:l,preventRedirection:a,title:p,icon:u,onMenuClick:s,isShowEndAdornment:Boolean(g?.length),selected:E,onMouseEnter:e=>{g?.length&&d(e.currentTarget)},href:I}),g?.length&&A&&e(Tc,{open:!0,anchorEl:C,children:e(Vi,{disablePadding:!0,children:g.map((t=>e(jc,{item:t,parentPath:I,currentPathMenuOpen:r[c]??{},onCloseMenuPopover:n,preventRedirection:a,onPreventRedirection:l,onMenuClick:s},t.key)))})})]})},Wc=t=>{const{isMobile:o}=rr();if(o)return e(Vc,{...t});const{currentPathMenuOpen:r,currentMenuItem:n,onCloseMenuPopover:l,preventRedirection:a=!1,onPreventRedirection:s,onMenuClick:C}=t;return n?e(Vi,{disablePadding:!0,children:n.menuItems?.filter((({isView:e})=>!1!==e)).map((t=>e(jc,{item:t,onMenuClick:C,parentPath:`/${n.key}`,currentPathMenuOpen:r[n.key]??{},onCloseMenuPopover:l,preventRedirection:a,onPreventRedirection:s},t.key)))}):e(i,{children:"Loading..."})},qc=({menuItems:o,currentPathname:r,anchorEl:n,setAnchorEl:l,preventRedirection:a=!1,onPreventRedirection:s,onMenuClick:C})=>{const[d,A]=h(),[p,u]=h({});c((()=>{const e=br(r);if(N(e))return u({home:!0});u(e)}),[r]);const g=()=>{l(null)};return t(i,{children:[o.filter((({isView:e})=>!1!==e)).map((t=>{const{onClick:i,key:o,icon:r,menuItems:n=[]}=t,d=""===o?"/":`/${o}`,c=!!p?.[o];return e(Yc,{onClick:e=>{if(i){if(""===o)return void i("/",e);i(`/${o}`,e)}},onMenuClick:C,onMouseEnter:e=>{n?.length?(l(e.currentTarget),A(t)):g()},href:n.length?void 0:d,icon:r,onPreventRedirection:s,preventRedirection:a,selected:c},o)})),!!n&&e(M,{onMouseLeave:g,children:e(Tc,{open:!0,anchorEl:n,children:e(Wc,{currentMenuItem:d,currentPathMenuOpen:p,onCloseMenuPopover:g,preventRedirection:a,onPreventRedirection:s,onMenuClick:C})})})]})};v(M)((({theme:e})=>({width:7,height:7,borderRadius:"50%",background:e.palette.app.color.butterflyBlue[400]})));const zc=v(Pi,{shouldForwardProp:e=>"open"!==e})((({theme:e,open:t})=>{const i=e=>({width:300,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden",backgroundColor:e.palette.app.color.mirage[900],[e.breakpoints.down("md")]:{width:"80px"}}),o=e=>({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:"0px",[e.breakpoints.up("md")]:{width:"80px"},backgroundColor:e.palette.app.color.mirage[900]});return{width:300,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",...t&&{...i(e),"& .MuiDrawer-paper":i(e)},...!t&&{...o(e),"& .MuiDrawer-paper":o(e)}}})),Pc=({children:t,...i})=>e(Oi,{timeout:"auto",unmountOnExit:!0,...i,children:t}),Oc=({icon:t=e(Hc,{}),title:i,isShowEndAdornment:o=!1,selected:r=!1,onClick:n,isExpanded:l,sx:a,preventRedirection:s=!1,href:C,onPreventRedirection:d,onMenuClick:A})=>{const c=J(),{butterflyBlue:h}=c.palette.app.color;return e(M,{sx:{bgcolor:r&&!o?h[900]:""},children:e(Gc,{sx:a,title:i,icon:t,href:C,onClick:n,onMenuClick:A,selected:r,preventRedirection:s,onPreventRedirection:d,endAdornment:o&&e(l?Ni:Xi,{})})})},Nc=(e,t)=>{if(0===t.length)return!1;if("object"!=typeof e)return!1;const[i,...o]=t;if(!i)return!1;const r=e[i];return 0===o.length?Boolean(r):Nc(r,o)},Xc=e=>!0===e||"object"==typeof e&&null!==e&&Object.values(e).every(Xc),_c=({menuItem:i,level:o=0,parentPath:r="",subMenusOpen:n,setSubMenusOpen:l,currentPathMenuOpen:a,preventRedirection:s=!1,onPreventRedirection:C,onMenuClick:d})=>{const A=J();if(3===o)return;const{butterflyBlue:c,slate:h}=A.palette.app.color,{key:p,icon:u,title:g,isView:m,onClick:f,menuItems:k=[]}=i;if(!1===m)return;const E=r?`${r}/${p}`:p,I=E.split("/"),w=((e,t)=>{const i=Nc(e,t);return Boolean(i)})(n,I),S=((e,t)=>{const i=t.reduce(((e,t)=>{if("object"==typeof e&&null!==e&&t in e)return e[t]}),e);return Xc(i)})(a,I),B=""===p?"/":`/${E}`;return t(M,{children:[e(Oc,{sx:{paddingLeft:3*o+1.5,fontSize:"13px",":focus-visible":{border:`1px solid ${c[900]}`,backgroundColor:h[900]}},onClick:e=>{if(k.length>0){if(S)return;l((e=>{const t={...e};let i=t;for(let e=0;e<I.length-1;e++){const t=I[e];t&&(i[t]="object"==typeof i[t]?i[t]:{},i=i[t])}const o=I[I.length-1];return o&&(i[o]=!w),t}))}else f&&!S&&f(B,e)},onMenuClick:d,href:0===k.length?B:"",icon:0===o?u:void 0,title:g,isShowEndAdornment:k.length>0&&o<2,selected:S,isExpanded:w,preventRedirection:s,onPreventRedirection:C}),k.length>0&&e(Pc,{in:w,children:e(Vi,{component:"div",disablePadding:!0,children:k.map((t=>e(_c,{menuItem:t,level:o+1,parentPath:E,onMenuClick:d,subMenusOpen:n,setSubMenusOpen:l,currentPathMenuOpen:a,preventRedirection:s,onPreventRedirection:C},t.key)))})})]},p)},$c=({menuItems:t,currentPathname:i,preventRedirection:o=!1,onPreventRedirection:r,onMenuClick:n})=>{const[l,a]=h({}),[s,C]=h({});return u((()=>{const e=br(i);if(N(e))return a({home:!0}),void C({home:!0});const t=JSON.parse(JSON.stringify(e)),o=JSON.parse(JSON.stringify(e));a(t),C(o)}),[i]),t.map((t=>e(_c,{menuItem:t,subMenusOpen:l,setSubMenusOpen:a,onMenuClick:n,currentPathMenuOpen:s,preventRedirection:o,onPreventRedirection:r},t.key)))},eh=({menuItems:i=[],open:o,currentPathname:r,preventRedirection:n=!1,onLogoClick:l,onPreventRedirection:a,onMenuClick:s,href:d,preventClick:A=!1,openLogoUrl:c,closedLogoUrl:p})=>{const[u,g]=h(null),[m,f]=h(null),k=()=>{g(null)},{layout:E}=rr(),I="desktop"===E,w=I&&o,S=w?c:p,B=!!S&&m===S,x=()=>S&&!B?e(M,{sx:{display:"flex",justifyContent:"center",alignItems:"center",px:w?2:1,width:"100%",boxSizing:"border-box"},children:e(qA,{mode:"view",variant:"auto",value:S,label:"",enableFullImageView:!1,hideBorder:!0,size:w?"medium":"small",maxPreviewWidth:w?220:48,maxPreviewHeight:w?48:40,onError:()=>f(S)})}):e(w?$n:el,{});return t(zc,{variant:"permanent",open:o,children:[t(M,{textAlign:"center",sx:{cursor:d||l?"pointer":"default"},component:d?C:"div",onClick:()=>{l&&!A&&l()},href:d,children:[I&&e(jl,{padding:{paddingTop:"1.5rem"},children:x()}),!I&&e(jl,{padding:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},children:x()})]}),I&&e(Vi,{component:"nav",onMouseLeave:k,children:o?e($c,{menuItems:i,onMenuClick:s,currentPathname:r,preventRedirection:n,onPreventRedirection:a}):e(qc,{menuItems:i,currentPathname:r,anchorEl:u,onMenuClick:s,setAnchorEl:g,preventRedirection:n,onPreventRedirection:a})}),!I&&e(re,{onClickAway:k,children:e(Vi,{component:"nav",onMouseLeave:k,children:e(qc,{menuItems:i,onMenuClick:s,currentPathname:r,anchorEl:u,setAnchorEl:g,preventRedirection:n,onPreventRedirection:a})})})]})},th=e=>e?Array.isArray(e)?e:[e]:[],ih=e=>e.zIndex.drawer+200,oh=({title:o,children:n,onClose:l,actions:s,headerSlot:C,isHideHeader:d=!1,isHideFooter:A=!1,isHideCloseIcon:c=!1,isHideDividers:h=!1,disableEscapeKeyDown:p=!1,anchor:u="right",sx:g,ModalProps:m,...f})=>{const k=!A&&!!s,E=th(g),I=th(m?.sx);return e(Pi,{...f,anchor:u,onClose:l,sx:[e=>({zIndex:ih(e),"& .MuiBackdrop-root":{zIndex:ih(e)},"& .MuiDrawer-paper":{display:"flex",flexDirection:"column",zIndex:ih(e)}}),...E],ModalProps:{...m,disableEscapeKeyDown:p,sx:[e=>({zIndex:ih(e)}),...I]},children:t(a,{flex:1,sx:{overflow:"hidden"},children:[!d&&t(i,{children:[e(jl,{padding:{padding:"10px"},children:t(a,{direction:"row",alignItems:"center",children:[e(M,{flex:1,children:C??e(q,{variant:"h6",fontWeight:500,children:o})}),!c&&e(r,{onClick:e=>l?.(e,"escapeKeyDown"),color:"secondary",size:"small","aria-label":"Close",onMouseDown:e=>e.preventDefault(),children:e(At,{fontSize:"medium"})})]})}),!h&&e($,{})]}),e(M,{flex:1,sx:{overflowY:"auto",overflowX:"hidden"},children:n}),k&&t(i,{children:[!h&&e($,{}),e(jl,{padding:{padding:"10px"},children:s})]})]})})},rh=({open:i=!1,anchorEl:o,onClose:n,children:l,onApply:s,showDivider:C=!1,title:d,required:A})=>{const c=J(),{slate:h}=c.palette.app.color,p=()=>{te(s)&&s(),te(n)&&n({},"backdropClick")};return t(ce,{open:i,anchorEl:o,anchorOrigin:{vertical:"bottom",horizontal:"left"},onClose:()=>{p()},onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),p())},sx:{"& .MuiPaper-root":{minWidth:"300px"}},children:[C&&t(a,{alignItems:"flex-end",children:[e(jl,{padding:{padding:"8px"},children:t(a,{direction:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:[t(a,{direction:"row",alignItems:"center",gap:"5px",children:[t(q,{variant:"h6",children:[d," "]}),A&&e(q,{variant:"h6",color:"error",children:"*"})]}),e(r,{onClick:p,children:e(yi,{})})]})}),e($,{sx:{width:"100%"}})]}),e(M,{sx:{background:h[600],borderRadius:"5px"},children:l})]})},nh=({open:i,anchorEl:o,onClose:n,children:l,onApply:s,showDivider:C=!1,showFooter:d=!0,title:A,required:c,filterItem:p,reset:g,background:m=!1,currentFilterValue:f})=>{const k=J(),{slate:E}=k.palette.app.color,[I,w]=h(null),[S,B]=h(!0);u((()=>{if(i){if(!I&&f){const e=p?.multiSelect?lo(f):f;w(e)}}else w(null);if(f&&I){const e=p?.multiSelect?JSON.stringify(lo(f))!==JSON.stringify(I):f!==I;B(!e)}}),[i,f,I,p?.multiSelect]);const x=()=>{w(null),te(g)&&g(),te(n)&&n({},"backdropClick")};return t(ce,{open:i,anchorEl:o,anchorOrigin:{vertical:"bottom",horizontal:"left"},onClose:(e,t)=>{te(n)&&(n(e,t),x())},sx:{"& .MuiPaper-root":{minWidth:"300px"}},children:[C&&t(a,{alignItems:"flex-end",children:[e(jl,{padding:{padding:"8px"},children:t(a,{direction:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:[t(a,{direction:"row",alignItems:"center",gap:"5px",children:[e(q,{variant:"h6",children:A}),c&&e(q,{variant:"h6",color:"error",children:"*"})]}),e(r,{onClick:x,children:e(Te,{})})]})}),e($,{sx:{width:"100%"}})]}),e(M,{sx:{background:m?E[600]:"transparent",borderRadius:"5px",maxWidth:"300px"},children:l}),d&&e(jl,{padding:{padding:"10px"},children:e(M,{display:"flex",justifyContent:"flex-end",children:e(Rr,{onClick:()=>{w(null),te(s)&&s()},disabled:S,variant:"text",sx:{maxWidth:"40px"},children:"Apply"})})})]})};function lh({selectedFilter:t,control:i,errors:o,setIsPopupOpen:r,autoFocus:n=!1}){const l=J(),{sapphireBlue:a,black:s}=l.palette.app.color,C=o[t.key],{placeholder:d,label:A}=t,c=d??`Select ${A}`,h=d??A;return{autoComplete:t.options&&e(uC,{disableClearable:!0,multiple:t.multiSelect??!1,placeholder:c,name:`${t.key}`,disabled:t.isDisabled,loading:t.loading,shouldCloseOnSelect:t.shouldCloseOnSelect,control:i,options:t.options??[],onOpen:()=>r?.(!0),onClose:()=>r?.(!1),autoFocus:n,sx:{maxHeight:"250px",overflowY:"auto",width:"100%","& .MuiAutocomplete-tag":{backgroundColor:a[300],color:s[900]}},...t.employeeAutocomplete&&{isShowEmployeeData:!0,isShowOptionsOnType:!0,getOptionLabel:e=>"string"==typeof e?e:`${e.label} (${e.employee_code}) - ${e.punch_code}`},error:!!C,helperText:C?.message},t.key),text:e(_A,{name:t.key,control:i,disabled:t.isDisabled,placeholder:h,error:!!C,helperText:C?.message,autoFocus:n}),date:e(YC,{name:t.key,control:i,disabled:t.isDisabled,error:!!C,helperText:C?.message,autoFocus:n,minDate:t.minDate?U.fromISO(t.minDate):void 0,maxDate:t.maxDate?U.fromISO(t.maxDate):void 0,...t.monthYearFormat&&{format:"MMM yyyy",views:["year","month"]}}),dateRange:e(PC,{name:t.key,control:i,disabled:t.isDisabled,error:!!C,helperText:C?.message})}}const ah=({open:i,anchorEl:o,filterItem:r,onClose:n,control:l,errors:s,onApply:C,currentFilterValue:d,reset:A})=>e(nh,{title:r.label,required:r.required,filterItem:r,open:i,onClose:n,anchorEl:o,onApply:C,currentFilterValue:d,reset:A,showFooter:!0,showDivider:!0,background:!0,children:t(jl,{padding:{padding:"10px"},children:[lh({selectedFilter:r,control:l,errors:s})[r.type],"switch"===r.type&&t(a,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{padding:"10px 5px 10px 20px",margin:"auto"},children:[e(q,{variant:"body2",children:r.label}),e(bc,{control:l,name:r.key})]},r.key)]})}),sh=({open:t,anchorEl:i,filterItem:o,onClose:r,control:n,errors:l,onApply:a})=>e(rh,{title:o.label,required:o.required,open:t,onClose:r,anchorEl:i,onApply:a,showDivider:!0,background:!0,children:e(jl,{padding:{padding:"10px"},children:lh({selectedFilter:o,control:n,errors:l})[o.type]})}),Ch=(e,t)=>{let i=e;if(t&&"autoComplete"===t.type&&(i=t.multiSelect&&Array.isArray(e)?t.options?.filter((t=>e.includes(t.value))).map((e=>e.label)).join(", "):t.options?.filter((t=>t.value===e)).map((e=>e.label)).join(", ")),"dateRange"===t.type&&Array.isArray(e)&&2===e.length){i=`${e[0]} <= Start Date <= ${e[1]}`}return i};function dh(e,t){const i=new Map(t.map((e=>[e.key,e])));return Object.fromEntries(Object.entries(e).flatMap((([e,t])=>{if(t){const o=i.get(e);return[[e,o?.monthYearFormat&&"string"==typeof t?U.fromISO(t).toFormat("yyyy-MM"):t]]}return[]})))}const Ah=({filterListItems:o,isDisabled:n=!1,filterListData:l,onApply:s,onClear:C,onChange:d,isSingleCompany:A=!1,defaultComponyId:m,companyKey:f="company_id"})=>{const k=m??void 0,E=J(),{iron:I,slate:w}=E.palette.app.color,{layout:S}=rr(),B="desktop"===S,Q="mobile"===S,[b,v]=h(null),R=p(null),L=p(null),[y,F]=h(!1),[D,Z]=h(!1),[H,K]=h(null),G=p(null),[Y,V]=h(!1),T=c((()=>A?o.filter((({key:e})=>e!==f)):o),[o,A,f]),j=c((()=>new Map(o.map((e=>[e.key,e])))),[o]),W=c((()=>new Map(T.map(((e,t)=>[e.key,t])))),[T]),z=g(((e,t)=>{K(e),L.current=t,Z(!0)}),[]),P=c((()=>function(e){return JSON.stringify(e.map((e=>{const{key:t,multiSelect:i,required:o,type:r,isDefaultCurrentDate:n,value:l,options:a}=e;return[t,i??!1,o??!1,r,n??!1,l??null,"autoComplete"===r&&o&&1===a?.length?a[0]?.value??null:null]})))}(o)),[o]),O=c((()=>{const e=o.reduce(((e,{key:t,multiSelect:i,options:o,required:r,type:n,value:l,isDefaultCurrentDate:a})=>(e[t]="autoComplete"===n&&r&&1===o?.length?i?[o[0]?.value]:o[0]?.value:i||"dateRange"===n?l||null:"switch"===n?l||!1:a&&"date"===n?l||U.now().toISODate():l||null,e)),{});return A&&(e[f]=k),e}),[P,A,k,f]),X=c((()=>function(e,t,i){return JSON.stringify([t,i,e.map((e=>{const{key:t,multiSelect:i,type:o,required:r,label:n}=e;return[t,i??!1,o,r??!1,n]}))])}(o,A,f)),[o,A,f]),_=c((()=>{const e={};o.forEach((({key:t,multiSelect:i,type:o})=>{e[t]=i||"dateRange"===o?no.array(no.string()).nullable().optional():"switch"===o?no.boolean().nullable().optional():no.string().nullable().optional()})),A&&(e[f]=no.string().nullable().optional());const t=o.filter((({key:e,required:t})=>t&&!(A&&e===f)));return no.object(e).superRefine(((e,i)=>{t.forEach((({key:t,required:o,label:r})=>{o&&!e[t]?.length&&i.addIssue({path:[t],message:`${r} is required`,code:no.ZodIssueCode.custom})}))}))}),[X]),ee=c((()=>_i(_)),[_]),{control:te,handleSubmit:ie,setValue:oe,reset:re,getValues:ne,formState:{errors:le,dirtyFields:ae}}=et({values:O,resolver:ee,mode:"all"});c((()=>{T&&0!==T.length&&T.forEach((({key:e,multiSelect:t,options:i,required:o})=>{if(o&&1===i?.length){ne(e)||oe(e,t?[i[0]?.value]:i[0]?.value)}}))}),[T]),u((()=>{A&&oe(f,k)}),[A,k,f]);const se=it({control:te}),Ce=se[f],de=se.business_unit_id,Ae=se.department_id,ce=()=>{v(null)},he=()=>{Ie((()=>{const e=new Set;return T.forEach((({type:t,key:i,required:o},r)=>{"switch"!==t&&(r===ke||O?.[i]||o)&&e.add(i)})),e}))},pe=()=>{const e=A?{...O,[f]:k}:O;re(e),C(),he(),ce()},ue=e=>{const t=e instanceof HTMLElement?e:e.currentTarget;v(t)},ge=e=>{F(!1),K(null);const t=A?{...e,[f]:k}:e,i={...ro(dh(t,o),(e=>oo(e)||N(e))),...A?{[f]:k}:{}};Ie((()=>{const e=new Set;return T.forEach((({type:t,key:o,required:r},n)=>{"switch"!==t&&(n===ke||i[o]||r)&&e.add(o)})),e})),s(i,y,H?.key),ce()},me=e=>j.get(e),fe=c((()=>!!l&&Object.entries(l).some((([e,t])=>(!A||e!==f)&&(!!W.has(e)&&("boolean"==typeof t?t:!oo(t)&&!N(t)))))),[l,W,A,f]),ke=c((()=>T.findIndex((({type:e})=>"switch"!==e&&"dateRange"!==e))),[T]),[Ee,Ie]=h((()=>{const e=new Set;return T.forEach((({type:t,key:i,required:o},r)=>{"switch"!==t&&(r===ke||l?.[i]||O?.[i]||o)&&e.add(i)})),e})),we=g(((e,t)=>{Ie((i=>{const o=new Set(i);return t?o.add(e):o.delete(e),o}))}),[]),Se=H?.key?"switch"===H.key?se[H.key]?"true":"false":se[H.key]:null,Be=c((()=>A?{...se,[f]:k}:se),[f,se,A,k]),xe=p(d);xe.current=d;const Qe=p(void 0),Me=p(y);Me.current=y,u((()=>{io(Qe.current,Be)||(Qe.current=Be,x((()=>{xe.current(Be,Me.current)})))}),[Be]);const be=p(O);u((()=>{io(be.current,O)||(be.current=O,io(ne(),O)||re(O))}),[O,ne,re]),u((()=>{Ie((e=>{const t=new Set;return T.forEach((({type:i,key:o,required:r},n)=>{"switch"!==i&&(n===ke||l?.[o]||O?.[o]||r||e.has(o))&&t.add(o)})),function(e,t){if(e.size!==t.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}(e,t)?e:t}))}),[T,l,O,ke]);const Je=p(o);Je.current=o;const ve=p(Ce);u((()=>{A||y?ve.current=Ce:io(ve.current,Ce)||(ve.current=Ce,Je.current.forEach((({key:e,isDefaultCurrentDate:t,type:i})=>{t&&"date"===i||e!==f&&oe(`${e}`,null)})),oe(f,Ce))}),[Ce,f,A,y]);const Re=p(de);u((()=>{y?Re.current=de:io(Re.current,de)||(Re.current=de,oe("business_unit_location_id",null))}),[de,y,oe]);const Le=p(Ae);u((()=>{y?Le.current=Ae:io(Le.current,Ae)||(Le.current=Ae,oe("sub_department_id",null))}),[Ae,y,oe]);const ye=Boolean(b),Fe=c((()=>0===Object.keys(ae).length&&Object.keys(se).every((e=>!(!A||e!==f)||(oo(se[e])||N(se[e]))))),[se,ae,A]);return nr({key:"f",modifierKeys:["ctrl","shift"],onTrigger:()=>{if(n)return;const e=G.current??document.createElement("button");ue(e)}}),t(M,{sx:{flexGrow:1},children:[t(a,{direction:"row",justifyContent:{xs:"end",md:"space-between"},spacing:1,children:[B&&e(a,{direction:"row",alignItems:"center",sx:{maxWidth:{xs:"40vw",md:"45vw",lg:"57vw"}},children:!!l&&!!fe&&t(i,{children:[e(q,{variant:"body1",sx:{minWidth:"50px",marginRight:"5px"},children:"Filters:"}),e(a,{direction:"row",gap:"5px",alignItems:"center",sx:{flexWrap:"wrap",maxWidth:"100%"},children:(Ue=l,Object.entries(Ue).map((([t,i])=>{const r=(e=>W.get(e)??-1)(t);if(-1===r)return;if("boolean"!=typeof i&&!i)return;const a=me(t),C=T[r],d=a&&Ch(i,a),c=function(e){return Array.isArray(e)?e.join(", "):sr.test(e)?U.fromFormat(e,"yyyy-MM").toFormat("MMM yyyy"):Cr.test(e)?U.fromFormat(e,"yyyy-MM-dd").toFormat("dd-MM-yyyy"):e}("object"==typeof d?JSON.stringify(d):String(d));return"boolean"==typeof i||c?e(Ks,{label:e(xl,{toolTipLabel:`${c}`,children:e(q,{noWrap:!0,variant:"subtitle2",children:`${a?.label}: ${c}`})}),onDelete:()=>(e=>{const t=me(e);if(t?.required)return Ns.error({title:"This is a required custom filter field and cannot be removed."});oe(`${e}`,null);const i={...l};delete i[e],A&&(i[f]=k),s(i,!0,e)})(t),onClick:e=>{((e,t)=>{if(A&&e===f)return;if(e===f&&o?.some((({required:e})=>e)))return;F(!0),R.current=t.currentTarget;const i=me(e);i&&K(i)})(t,e)},disabled:n,shouldDisableFocus:C?.shouldDisableFocus??!1,shouldDisableRipple:C?.shouldDisableRipple??!1},t):void 0})))})]})}),t(a,{direction:"row",alignItems:"flex-start",children:[fe&&e(Rr,{onClick:()=>pe(),variant:"text",sx:{minWidth:{xs:"60px",sm:"100px"}},children:Q?"Clear":"Clear Filter"}),!n&&e(Ul,{isFiltered:fe,onClick:ue,ref:G})]})]}),e("form",{onSubmit:e=>{e.preventDefault(),Fe||ie((e=>{ge(e)}))()},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Y||Fe||ie((e=>{ge(e)}))())},children:t(Pi,{open:ye,onClose:(e,t)=>{"backdropClick"!==t&&ce()},anchor:"right",sx:{zIndex:E.zIndex.drawer+2,"& .MuiPaper-root":{width:"100%",maxWidth:{xs:"270px",sm:"350px"}}},children:[t(a,{sx:{background:I[600]},children:[e(jl,{padding:{padding:"10px 30px"},children:t(a,{direction:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:[e(q,{variant:"h6",children:"Filter"}),e(r,{onClick:()=>{const e=A?{...O,[f]:k}:O;re(e),he(),ce()},children:e(Te,{})})]})}),e($,{sx:{width:"100%"}})]}),e(a,{flexGrow:1,sx:{overflowX:"hidden"},children:T.map(((t,i)=>e(ch,{filter:t,index:i,firstNonSwitchIndex:ke,isExpanded:Ee.has(t.key),onExpandedChange:we,control:te,fieldError:le[t.key],setIsPopupOpen:V,slate600:w[600],dateRangeValue:"dateRange"===t.type?se[t.key]:null,onDateRangeClick:z},t.key)))}),e($,{}),e(a,{children:e(jl,{padding:{padding:"10px"},children:t(bC,{children:[e(Rr,{type:"submit",disabled:Fe,variant:"contained",onClick:()=>{ie(ge)()},children:"Apply"}),e(Rr,{type:"button",onClick:()=>pe(),disabled:Object.keys(se).every((e=>!(!A||e!==f)||!se[e])),variant:"outlined",children:"Reset"})]})})})]})}),H&&e(ah,{open:y,onClose:()=>{H?.key&&oe(`${H?.key}`,l?.[H.key]),F(!1)},onApply:()=>{ie(ge)()},control:te,errors:le,reset:re,anchorEl:R.current,filterItem:H,currentFilterValue:Se}),H&&e(sh,{open:D,onClose:()=>{H?.key&&oe(`${H?.key}`,l?.[H.key]),Z(!1)},onApply:()=>{Z(!1)},control:te,errors:le,anchorEl:L.current,filterItem:H})]});var Ue};const ch=B((function({filter:i,index:o,firstNonSwitchIndex:r,isExpanded:n,onExpandedChange:l,control:s,fieldError:C,setIsPopupOpen:d,slate600:A,dateRangeValue:c,onDateRangeClick:h}){const{type:p,key:u,label:g,required:m,isDisabled:f,menuInfo:k}=i;return"switch"===p?t(a,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"80%",sx:{padding:"10px 5px 10px 20px ",margin:"auto"},children:[e(q,{variant:"body2",children:g}),e(bc,{control:s,name:u})]}):t($i,{expanded:n,onChange:(e,t)=>{l(u,t)},disabled:f,sx:{boxShadow:"none","&.MuiAccordion-root.Mui-expanded":{margin:"0 !important"},"&.MuiAccordion-root.Mui-disabled":{backgroundColor:"transparent"}},children:[e(to,{expandIcon:e(Xi,{}),"aria-controls":"panel1a-content",id:"panel1a-header",sx:{flexDirection:"row-reverse","& MuiAccordionSummary-root.Mui-expanded":{marginRight:"10px",transform:"rotate(-90deg)"},"&.Mui-expanded":{minHeight:"40px",paddingY:"5px"},"& .MuiAccordionSummary-content.Mui-expanded":{margin:"0px"}},children:t(a,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"90%",children:[t(a,{direction:"row",alignItems:"center",gap:"5px",children:[e(q,{variant:"body2",children:g}),m&&e(q,{color:"error",children:"*"})]}),e(q,{variant:"body2",children:k})]})}),e(eo,{sx:{background:A,borderRadius:"5px",padding:"0px"},children:e(jl,{padding:{paddingLeft:"15px",paddingY:"5px",paddingRight:"15px"},children:"dateRange"===p?t(a,{direction:"row",alignItems:"center",gap:"10px",onClick:e=>{h(i,e.currentTarget)},children:[e(M,{sx:{border:"1px solid black",borderRadius:"5px",width:"150px",p:1},children:e(q,{variant:"body2",children:Array.isArray(c)&&c[0]?U.fromISO(c[0]).toFormat(HC.dateWithEuropean):"Start Date"})}),e(q,{children:"~"}),e(M,{sx:{border:"1px solid black",borderRadius:"5px",width:"150px",p:1},children:e(q,{variant:"body2",children:Array.isArray(c)&&c[1]?U.fromISO(c[1]).toFormat(HC.dateWithEuropean):"End Date"})})]}):e(M,{children:lh({selectedFilter:i,control:s,errors:C?{[u]:C}:{},setIsPopupOpen:d,autoFocus:o===r})[p]})})})]})}),(function(e,t){const{index:i,firstNonSwitchIndex:o,isExpanded:r,control:n,fieldError:l,slate600:a,onExpandedChange:s,setIsPopupOpen:C,onDateRangeClick:d,filter:A,dateRangeValue:c}=e,{index:h,firstNonSwitchIndex:p,isExpanded:u,control:g,fieldError:m,slate600:f,onExpandedChange:k,setIsPopupOpen:E,onDateRangeClick:I,filter:w,dateRangeValue:S}=t;if(i!==h||o!==p||r!==u||n!==g||l!==m||a!==f||s!==k||C!==E||d!==I)return!1;const{key:B,type:x,label:Q,required:M,isDisabled:b,loading:J,multiSelect:v,menuInfo:R,options:L,placeholder:y,employeeAutocomplete:F,monthYearFormat:U,minDate:D,maxDate:Z,shouldCloseOnSelect:H}=A,{key:K,type:G,label:Y,required:V,isDisabled:T,loading:j,multiSelect:W,menuInfo:q,options:z,placeholder:P,employeeAutocomplete:O,monthYearFormat:N,minDate:X,maxDate:_,shouldCloseOnSelect:$}=w;return B===K&&x===G&&Q===Y&&M===V&&b===T&&J===j&&v===W&&R===q&&L===z&&y===P&&F===O&&U===N&&D===X&&Z===_&&H===$&&io(c,S)})),hh=({filter:i,control:o})=>{return e(le,{children:(r=i.type,t(a,{direction:"row",width:"100%",justifyContent:"space-between",alignItems:"center",children:[e(q,{variant:"body2",children:i.label}),"switch"===r?e(bc,{control:o,name:i.key}):e(q,{variant:"body2",children:i.menuInfo})]}))});var r},ph=({filterListItems:i})=>{const[o,n]=h(null),l=p(null),[s,C]=h(!1),[d,A]=h(),[c,u]=h(null),{control:g,handleSubmit:m,setValue:f,reset:k,formState:{errors:E},watch:I}=et(),w=()=>{n(null)},S=e=>{C(!1),u(null),w();const t=dh(e,i);A(t)},B=e=>{C(!0),n(null),u(e)},x=e=>i.find((t=>t.key===e)),Q=c?.key?I(c.key):null,b=Boolean(o);return t(a,{children:[t(a,{direction:"row",spacing:1,alignItems:"center",children:[d&&(J=d,Object.entries(J).map((([t,i])=>{if(!i)return;const o=x(t),r=o&&Ch(i,o);return e(Zs,{ref:l,label:e(xl,{toolTipLabel:`${r}`,children:`${o?.label}: ${r}`}),onDelete:()=>(e=>{f(`${e}`,null),A((t=>{const i={...t};return delete i[e],i}))})(t),onClick:e=>{C(!0),l.current=e.currentTarget;const i=x(t);i&&(u(i),B(i))}},t)}))),e(r,{ref:l,onClick:e=>{n(e.currentTarget)},sx:{height:"40px"},children:e(Zn,{})}),e(Rr,{onClick:()=>(k(),void A(void 0)),variant:"text",children:"Clear Filter"})]}),e(nh,{open:b,anchorEl:o,onClose:w,onApply:()=>{m(S)()},children:i.map((t=>e(M,{onClick:()=>"switch"!==t.type&&B(t),children:e(hh,{filter:t,control:g})},t.key)))}),c&&"switch"!==c.type&&e(ah,{open:s,onClose:()=>{C(!1)},onApply:()=>{m(S)()},control:g,currentFilterValue:Q,anchorEl:l.current,filterItem:c,errors:E})]});var J},uh=({text:t,highlightWords:i})=>{const o=J(),{slate:r}=o.palette.app.color;if(!i?.length)return e(M,{component:"span",children:t});const n=i.map((e=>e.replace(ur,"\\$&"))),l=new RegExp(`(${n.join("|")})`,"gi"),a=t.split(l);return e(M,{component:"span",children:a.map(((t,i)=>l.test(t)?e(M,{component:"span",sx:{padding:"2px 4px",backgroundColor:r[800],border:`1px solid ${r[700]}`,borderRadius:"5px",fontFamily:"monospace",fontSize:"0.9em"},children:t},`highlight-${i}-${t}`):e(M,{component:"span",children:t},`text-${i}-${t}`)))})},gh=({label:i,variant:o,colourCode:r})=>t(a,{gap:"10px",direction:"row",alignItems:"center",children:[e(Xn,{variant:o,colourCode:r}),i]}),mh=({color:i,label:o,isBackground:r=!1})=>e(M,{sx:{backgroundColor:`${r?y(i,.2):""}`,width:"max-content",borderRadius:"6px"},children:e(jl,{padding:{padding:r?"5px 8px":"0"},children:t(a,{flexDirection:"row",alignItems:"center",gap:"8px",children:[e(Ti,{sx:{color:i,fontSize:"12px"}}),e(q,{variant:"body2",sx:{fontWeight:500},children:o})]})})}),fh=({count:t,page:i,onPageChange:o,rowsPerPage:r,onRowsPerPageChange:n,sx:l,...a})=>{const s=J(),{grey:C}=s.palette,{layout:d}=rr(),A="mobile"===d;return e(ao,{sx:{"& .MuiInputBase-root":{height:"30px"},"& .MuiToolbar-root":{paddingLeft:0},"& .MuiTablePagination-select":{backgroundColor:"transparent !important"},"& .MuiTablePagination-input":{border:`1.5px solid ${C[400]}`,borderRadius:"5px",fontSize:"13px",padding:A?"2px 10px":"4px 8px"},...l},component:"div",count:t,page:i,onPageChange:o,rowsPerPage:r,onRowsPerPageChange:n,rowsPerPageOptions:[20,50,100,200],defaultValue:100,labelRowsPerPage:A?"":"Rows per page",...a})},kh=({items:i,disabled:o,sx:r})=>{const[n,l]=h(null);return t(M,{sx:{width:"100%",...r},children:[e(Ll,{onClick:e=>{l(e.currentTarget)},disabled:o}),!!n&&e(ql,{open:!0,anchorEl:n,onClose:()=>{l(null)},children:e(jl,{padding:{padding:"2px"},children:i.map((t=>e(M,{children:e(le,{sx:{width:"100%",textAlign:"start"},onClick:()=>{t?.onClick(),l(null)},children:e(q,{variant:"body1",children:t.title})})},t.title)))})})]})},Eh="smart-grid-field-input",Ih=e=>({...e,wrapperMinHeight:e.controlMinHeight+2*e.paddingY}),wh={sm:Ih({controlMinHeight:18,paddingY:2,padding:"2px 6px",autocompletePadding:"2px 2px 2px 6px",fontSize:"12px",borderRadius:"4px",expandIconSize:18,expandMarginLeft:"2px",multipleGap:"2px",chipFontSize:"11px",chipPadding:"1px 6px"}),md:Ih({controlMinHeight:20,paddingY:4,padding:"4px 8px",autocompletePadding:"4px 4px 4px 8px",fontSize:"13px",borderRadius:"4px",expandIconSize:20,expandMarginLeft:"4px",multipleGap:"4px",chipFontSize:"12px",chipPadding:"2px 8px"}),lg:Ih({controlMinHeight:22,paddingY:6,padding:"6px 10px",autocompletePadding:"6px 6px 6px 10px",fontSize:"15px",borderRadius:"6px",expandIconSize:22,expandMarginLeft:"6px",multipleGap:"4px",chipFontSize:"13px",chipPadding:"3px 10px"})},Sh=(e="md")=>wh[e],Bh=e=>e[800],xh=(e,t)=>t?e[800]:e[400],Qh=e=>`\n .${Eh}::placeholder {\n color: ${e};\n opacity: 1;\n }\n .${Eh}:disabled {\n color: ${e};\n -webkit-text-fill-color: ${e};\n }\n`,Mh=(e,t="md")=>{const{controlMinHeight:i,fontSize:o}=Sh(t);return{width:"100%",border:"none",background:"transparent",padding:0,margin:0,fontSize:o,lineHeight:`${i}px`,minHeight:i,outline:"none",color:e}},bh=(e="md",t="text")=>{const{borderRadius:i,autocompletePadding:o,padding:r,wrapperMinHeight:n}=Sh(e);return{alignItems:"center",borderRadius:i,padding:"autocomplete"===t?o:r,minHeight:n,boxSizing:"border-box"}},Jh=({wrapper:i,title:o,position:r})=>{const n=O(),{iron:l}=n.palette.app.color,a=i.getBoundingClientRect(),s={position:"fixed",zIndex:999999,background:l[200],color:l[600],padding:"4px 8px",borderRadius:4,fontSize:12,pointerEvents:"none",whiteSpace:"nowrap",transition:"opacity 0.2s ease, transform 0.2s ease",opacity:1},C={position:"absolute",width:0,height:0,borderStyle:"solid"};switch(r){case"top":s.top=a.top-28,s.left=a.left+a.width/2,s.transform="translateX(-50%)",Object.assign(C,{borderWidth:"6px 6px 0 6px",borderColor:`${l[200]} transparent transparent transparent`,bottom:-6,left:"50%",transform:"translateX(-50%)"});break;case"bottom":s.top=a.bottom+4,s.left=a.left+a.width/2,s.transform="translateX(-50%)",Object.assign(C,{borderWidth:"0 6px 6px 6px",borderColor:`transparent transparent ${l[200]} transparent`,top:-6,left:"50%",transform:"translateX(-50%)"});break;case"left":s.top=a.top+a.height/2,s.left=a.left-8,s.transform="translateY(-50%)",Object.assign(C,{borderWidth:"6px 0 6px 6px",borderColor:`transparent transparent transparent ${l[200]}`,right:-6,top:"50%",transform:"translateY(-50%)"});break;case"right":s.top=a.top+a.height/2,s.left=a.right+8,s.transform="translateY(-50%)",Object.assign(C,{borderWidth:"6px 6px 6px 0",borderColor:`transparent ${l[200]} transparent transparent`,left:-6,top:"50%",transform:"translateY(-50%)"})}return t("div",{style:s,children:[o,e("div",{style:C})]})},vh=({children:o,title:r,position:n="top",delay:l=50})=>{const[a,s]=h(!1),C=p(null),d=p(null);u((()=>()=>{d.current&&clearTimeout(d.current)}),[]);const A=a&&r&&C.current?Ao(e(Jh,{wrapper:C.current,title:r,position:n}),document.body):null;return t(i,{children:[e("div",{ref:C,style:{display:"inline-block",width:"100%"},onMouseEnter:()=>{d.current&&clearTimeout(d.current),d.current=setTimeout((()=>s(!0)),l)},onMouseLeave:()=>{d.current&&clearTimeout(d.current),s(!1)},children:o}),A]})},Rh={display:"flex",flexDirection:"column",gap:"4px",width:"100%"},Lh={width:"100%"},yh=k((({errorMessage:i,size:o="md",currencySymbol:r,decimalCharacter:n,digitGroupSeparator:l,decimalPlaces:a,decimalPlacesShownOnBlur:s,decimalPlacesShownOnFocus:C,minimumValue:d,maximumValue:A,outputFormat:p="number",textAlign:u,allowNegative:m,suffix:f,preDefined:k,navigationKey:E,disabled:I,name:w,value:S,onChange:B,onBlur:x,onFocus:Q,onKeyDown:M,placeholder:b="",style:v,className:R},L)=>{const y=J(),{butterflyBlue:F,iron:U,lipstickRed:D}=y.palette.app.color,{navigationKey:Z}=Uo(),H=E??Z,[K,G]=h(!1),[Y,V]=h(""),{handleEnterNavigation:T,setInputRef:j}=or({navigationKey:H}),W=c((()=>{const e=k??{},{currencySymbol:t,decimalCharacter:i,digitGroupSeparator:o,decimalPlaces:d,decimalPlacesShownOnBlur:A,decimalPlacesShownOnFocus:c,suffix:h,textAlign:p,allowNegative:g}=e;return{currencySymbol:r??t??"",decimalCharacter:n??i??".",digitGroupSeparator:l??o??",",decimalPlaces:a??d??2,decimalPlacesShownOnBlur:s??A,decimalPlacesShownOnFocus:C??c,suffix:f??h,textAlign:u??p??"right",allowNegative:m??g??!1}}),[m,r,n,a,s,C,l,k,f,u]),{currencySymbol:q,decimalCharacter:z,digitGroupSeparator:P,decimalPlaces:O,decimalPlacesShownOnBlur:N,decimalPlacesShownOnFocus:X,suffix:_,textAlign:$,allowNegative:ee}=W,te=c((()=>null!=d?Number(d):ee?void 0:0),[d,ee]),ie=c((()=>null!=A?Number(A):void 0),[A]),oe=K?X:N??O,re=c((()=>K?Y:null==S||""===S?"":String(S)),[Y,K,S]),ne=c((()=>i?D[900]:K?F[900]:U[800]),[F,i,U,K,D]),le=Bh(U),ae=xh(U,I),{fontSize:se}=Sh(o),Ce=c((()=>Qh(le)),[le]),de=c((()=>bh(o,"text")),[o]),Ae=c((()=>({...Mh(ae,o),textAlign:$,flex:1,minWidth:0,...v})),[ae,$,o,v]),ce=c((()=>({display:"flex",alignItems:"center",border:`2px solid ${ne}`,background:U[600],width:"100%",...de})),[ne,U,de]),he=c((()=>({flexShrink:0,fontSize:se,color:I?U[800]:U[400],marginRight:"4px",userSelect:"none"})),[se,I,U]),pe=c((()=>[Eh,R].filter(Boolean).join(" ")),[R]),ue=c((()=>!1!==P&&P),[P]),ge=g((e=>{j(e),"function"==typeof L?L(e):L&&(L.current=e)}),[L,j]),me=g((e=>{B?.({target:{name:w,value:e??""}})}),[w,B]),fe=g(((e,t)=>{const i=e.value;V(i),"prop"!==t?.source&&me(""!==i?"string"!==p?er(i):i:null)}),[me,p]),ke=g((e=>{e.stopPropagation(),G(!0),V(null==S||""===S?"":String(S)),Q?.(e)}),[Q,S]),Ee=g((e=>{e.stopPropagation(),G(!1),x?.(e)}),[x]),Ie=g((e=>{"enter"!==H||"Enter"!==e.key||e.ctrlKey||e.metaKey||e.altKey||T(e),M?.(e)}),[T,H,M]),we=g((e=>{const{floatValue:t,value:i}=e;return!(!ee&&i.includes("-"))&&(null==t||!(!ee&&t<0)&&((null==te||Number.isNaN(te)||t>=te)&&(null==ie||Number.isNaN(ie)||t<=ie)))}),[ee,ie,te]),Se=g((e=>{e.stopPropagation()}),[]);return t(vh,{title:i??"",position:"top",delay:50,children:[e("style",{children:Ce}),e(so.Root,{disabled:I,name:w,style:Lh,children:e("div",{style:Rh,children:t("div",{style:ce,children:[q?e("span",{style:he,children:q}):null,e(Tt,{customInput:Co,value:re,valueIsNumericString:!0,thousandSeparator:ue,decimalSeparator:z,decimalScale:oe,fixedDecimalScale:!K,allowNegative:ee,suffix:_,isAllowed:we,disabled:I,name:w,placeholder:b,className:pe,style:Ae,onValueChange:fe,onFocus:ke,onBlur:Ee,onKeyDown:Ie,onClick:Se,inputMode:"decimal",getInputRef:ge})]})})})]})}));yh.displayName="SmartCurrencyFieldComponent";const Fh=B(yh,((e,t)=>e.name===t.name&&e.value===t.value&&e.disabled===t.disabled&&e.size===t.size&&e.errorMessage===t.errorMessage&&e.placeholder===t.placeholder&&e.currencySymbol===t.currencySymbol&&e.decimalPlaces===t.decimalPlaces&&e.decimalPlacesShownOnBlur===t.decimalPlacesShownOnBlur&&e.decimalPlacesShownOnFocus===t.decimalPlacesShownOnFocus&&e.allowNegative===t.allowNegative&&e.minimumValue===t.minimumValue&&e.maximumValue===t.maximumValue&&e.digitGroupSeparator===t.digitGroupSeparator&&e.onChange===t.onChange&&e.onBlur===t.onBlur));Fh.displayName="SmartCurrencyField";const Uh=k((function({columns:o,optionsData:r,searchedByColumn:n,labelKey:l,valueKey:a="id",errorMessage:s,loading:C=!1,height:d="400px",dialogSize:A="lg",dialogTitle:u,size:m="md",placeholder:f="",onRowSelect:k,disabled:E,name:I,value:w,onChange:S,onBlur:B,onKeyDown:x,...Q},M){const b=O(),{butterflyBlue:J,iron:v,lipstickRed:R}=b.palette.app.color,{navigationKey:L}=Uo(),[y,F]=h(!1),[U,D]=h(!1),Z=p(null),H=p(null),K=p(null),G=p(null),{handleEnterNavigation:Y}=or({navigationKey:L}),V=c((()=>null==w||""===w?"":String(w)),[w]),T=c((()=>{if(!V)return"";const e=r.find((e=>String(e[a])===V));return e?String(e[l]):""}),[l,r,V,a]),j=c((()=>r.map((e=>({label:String(e[l]),value:String(e[a])})))),[l,r,a]),W=c((()=>y||U?J[900]:s?R[900]:v[800]),[J,s,v,U,y,R]),q=Bh(v),z=xh(v,E),P=c((()=>bh(m,"autocomplete")),[m]),{expandMarginLeft:N,expandIconSize:X}=c((()=>Sh(m)),[m]),_=c((()=>Qh(q)),[q]),$=c((()=>({...Mh(z,m),flex:1,minWidth:0,cursor:E?"default":"pointer"})),[E,z,m]),ee=g((e=>{K.current=e,"function"==typeof M?M(e):M&&(M.current=e)}),[M]),te=g((e=>{const t=K.current;t&&(t.value=e),S?.({target:{name:I,value:e}})}),[I,S]),ie=g((()=>{te(""),k?.(null)}),[te,k]),oe=g((()=>{H.current&&(H.current(),H.current=null),D(!1),F(!1),G.current?.focus()}),[]),re=g((()=>{E||(D(!0),setTimeout((()=>{const e=Z.current?.getTable(),t=document.querySelectorAll(".MuiDialog-root table thead input[type='text']"),i=e?.getAllColumns(),o=i?.findIndex((e=>e.id==n));if(void 0!==o&&o>=0&&t[o]){const e=t[o];e.focus();const i=e=>{const t=e;if("ArrowDown"===t.key){t.preventDefault();const e=document.querySelector(".MuiDialog-root table tbody tr");e&&(e.setAttribute("tabindex","0"),e.focus())}};e.addEventListener("keydown",i),H.current=()=>{e.removeEventListener("keydown",i)}}}),100))}),[E,n]),ne=g((({id:e})=>{const t=r.find((t=>String(t[a])===String(e)));if(!t)return;const i=String(t[a]);te(i),k?.(t),oe()}),[te,oe,k,r,a]),le=g((e=>"Backspace"===e.key&&V?(e.preventDefault(),void ie()):"enter"!==L||"Enter"!==e.key||U||e.ctrlKey||e.metaKey||e.altKey?"Enter"!==e.key&&" "!==e.key&&"ArrowDown"!==e.key||U||E?void x?.(e):(e.preventDefault(),void re()):void Y(e)),[ie,E,re,Y,U,L,x,V]),ae=g((e=>{e.preventDefault(),e.stopPropagation(),E||(U?oe():(F(!0),re()))}),[E,oe,re,U]),se=g((e=>{e.stopPropagation(),E||U||re()}),[E,re,U]),Ce=g((e=>{e.stopPropagation(),F(!0)}),[]),de=g((e=>{e.stopPropagation(),F(!1),B?.(e)}),[B]),Ae=f||"Click to select";return t(i,{children:[t(vh,{title:s??"",position:"top",delay:50,children:[e("style",{children:_}),e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:t("div",{style:{display:"flex",alignItems:"center",border:`2px solid ${W}`,background:v[600],position:"relative",width:"100%",...P},children:[e("input",{ref:G,readOnly:!0,disabled:E,value:T,placeholder:Ae,className:Eh,onClick:se,onFocus:Ce,onBlur:de,onKeyDown:le,style:$}),e("button",{type:"button",tabIndex:-1,"aria-label":U?"Close dialog":"Open dialog",disabled:E,onMouseDown:e=>{e.preventDefault()},onClick:ae,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",padding:0,marginLeft:N,cursor:E?"not-allowed":"pointer",color:E?v[800]:v[400]},children:e(Je,{sx:{fontSize:X,transform:U?"rotate(180deg)":"none",transition:"transform 0.2s ease"}})}),e("select",{...Q,ref:ee,name:I,value:V,disabled:E,tabIndex:-1,"aria-hidden":!0,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0,pointerEvents:"none"},children:0===j.length?e("option",{value:"",disabled:!0,children:"No Options"}):t(i,{children:[e("option",{value:"",children:"Select Option"}),j.map((t=>e("option",{value:t.value,children:t.label},t.value)))]})})]})})]}),e(gC,{open:U,onClose:oe,maxWidth:A,title:u??"Select Option",children:e(pt,{ref:Z,columns:o,data:r,height:d,loading:C,totalCount:r.length,onRowActivate:ne,focusableRowNavigation:!0})})]})}));Object.assign(Uh,{displayName:"SmartDialogSelectComponent"});const Dh=B(Uh,(({name:e,value:t,disabled:i,optionsData:o,columns:r,errorMessage:n,loading:l,placeholder:a,size:s,labelKey:C,valueKey:d,searchedByColumn:A},{name:c,value:h,disabled:p,optionsData:u,columns:g,errorMessage:m,loading:f,placeholder:k,size:E,labelKey:I,valueKey:w,searchedByColumn:S})=>e===c&&t===h&&i===p&&o===u&&r===g&&n===m&&l===f&&a===k&&s===E&&C===I&&d===w&&A===S));Object.assign(Dh,{displayName:"SmartDialogSelect"});const Zh=k((({errorMessage:o,options:r,onBlur:n,onKeyDown:l,...a},s)=>{const C=O(),{butterflyBlue:d,lipstickRed:A,iron:p}=C.palette.app.color,[u,g]=h(!1),{navigationKey:m}=Uo(),{handleEnterNavigation:f}=or({navigationKey:m}),k=c((()=>u?d[900]:o?A[900]:u?d[900]:p[800]),[o,u]);return e(vh,{title:o??"",position:"top",delay:50,children:e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:e("div",{style:{display:"flex",alignItems:"center",border:`2px solid ${k}`,borderRadius:"4px",padding:"4px 8px",background:"white",minHeight:"20px"},children:e("select",{ref:s,...a,style:{width:"100%",border:"none",background:"transparent",padding:"0",fontSize:"13px",outline:"none",cursor:"pointer"},onClick:e=>e.stopPropagation(),onFocus:e=>{e.stopPropagation(),g(!0)},onBlur:e=>{e.stopPropagation(),g(!1),n&&n(e)},onKeyDown:e=>{"enter"!==m||"Enter"!==e.key||e.ctrlKey||e.metaKey||e.altKey||f(e),l?.(e)},children:0===r.length?e("option",{value:"",disabled:!0,children:"No Options"}):t(i,{children:[e("option",{value:"",children:"Select Option"}),r.map((t=>e("option",{value:String(t.value),children:t.label},t.value)))]})})})})})}));Zh.displayName="SmartSelectFieldComponent";const Hh=B(Zh,((e,t)=>e.name===t.name&&e.value===t.value&&e.disabled===t.disabled&&e.options===t.options&&e.errorMessage===t.errorMessage));Hh.displayName="SmartSelectField";const Kh=28,Gh=100,Yh=200,Vh="select-all",Th=({label:e})=>e,jh=({value:e})=>String(e),Wh=e=>jh(e)===Vh,qh=e=>void 0===e||""===e?[]:Array.isArray(e)?[...new Set(e.map(String))]:[String(e)],zh=(e,t)=>t.trim()?Xo({data:e,fieldsToSearch:["label"],term:t.toLowerCase()}):e,Ph=(e,t,i)=>{if(!e.length)return null;if(i&&t.length){const i=new Set(t),o=e.findIndex((e=>!Wh(e)&&i.has(jh(e))));if(o>=0)return o}if(!i&&t[0]){const i=e.findIndex((e=>jh(e)===t[0]));if(i>=0)return i}return 0},Oh=B((function({butterflyBlue:t,checked:i,indeterminate:o=!1,iron:r}){const n=i||o;return e("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"14px",height:"14px",flexShrink:0,borderRadius:"2px",border:`1px solid ${n?t[900]:r[800]}`,background:n?t[900]:r[600],boxSizing:"border-box",pointerEvents:"none"},children:o?e(po,{sx:{fontSize:12,color:`${r[600]} !important`}}):i?e(je,{sx:{fontSize:12,color:`${r[600]} !important`}}):null})})),Nh=B((function({butterflyBlue:i,highlightedIndex:o,indeterminate:r,isSelected:n,iron:l,itemIndex:a,onHighlightIndex:s,onSelectOption:C,option:d,showCheckbox:A,style:c}){return t(ho.Item,{index:a,value:d,disabled:d.disabled,onPointerEnter:()=>{d.disabled||s(a)},onClick:e=>{"preventBaseUIHandler"in e&&e.preventBaseUIHandler(),e.preventDefault(),C(d)},style:e=>{const t=a===o||e.highlighted?l[700]:n&&!A?i[500]:"transparent";return{display:"flex",alignItems:"center",gap:"8px",padding:"0 8px",fontSize:"13px",cursor:d.disabled?"not-allowed":"pointer",boxSizing:"border-box",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",background:t,...c}},children:[A?e(Oh,{butterflyBlue:i,checked:n,indeterminate:r,iron:l}):null,Th(d)]})})),Xh=(t,i,o,r)=>{const{butterflyBlue:n,highlightedIndex:l,iron:a,isAllSelected:s,isShowSelectAll:C,isSomeSelected:d,onHighlightIndex:A,onSelectOption:c,selectedValuesSet:h,showCheckbox:p}=o,u=jh(t),g=Wh(t),m=g?s:h.has(u);return e(Nh,{itemIndex:i,butterflyBlue:n,highlightedIndex:l,indeterminate:g&&C&&d&&!s,isSelected:m,iron:a,onHighlightIndex:A,onSelectOption:c,option:t,showCheckbox:p,style:r},`${u}-${i}`)},_h=B((function({butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:r,isShowSelectAll:n,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValuesSet:C,showCheckbox:d}){const A=ho.useFilteredItems(),c=p(null),h=Re({count:A.length,estimateSize:()=>28,getScrollElement:()=>c.current,overscan:10}),g=h.getVirtualItems();if(u((()=>{null===i||i<0||h.scrollToIndex(i,{align:"auto"})}),[i,h]),!A.length)return null;const m={butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:r,isShowSelectAll:n,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValuesSet:C,showCheckbox:d};return e("div",{ref:c,style:{maxHeight:200,overflowY:"auto",paddingBottom:"4px"},children:e(ho.List,{style:{height:h.getTotalSize(),position:"relative",width:"100%"},children:g.map((({index:e,size:t,start:i})=>{const o=A[e];return o?Xh(o,e,m,{position:"absolute",top:i,left:0,width:"100%",height:t}):null}))})})})),$h=B((function({butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:r,isShowSelectAll:n,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValuesSet:C,showCheckbox:d,virtualized:A}){if(A)return e(_h,{butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:r,isShowSelectAll:n,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValuesSet:C,showCheckbox:d});const c={butterflyBlue:t,highlightedIndex:i,iron:o,isAllSelected:r,isShowSelectAll:n,isSomeSelected:l,onHighlightIndex:a,onSelectOption:s,selectedValuesSet:C,showCheckbox:d};return e(ho.List,{style:{maxHeight:200,overflowY:"auto",paddingBottom:"4px"},children:(e,t)=>Xh(e,t,c)})})),ep=B((function({iron:i,label:o,onRemove:r,size:n="md"}){const{chipFontSize:l,chipPadding:a}=c((()=>Sh(n)),[n]);return t("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:a,borderRadius:"12px",background:i[700],color:i[900],fontSize:l,fontWeight:500,lineHeight:1.4,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[o,e("button",{type:"button","aria-label":`Remove ${o}`,onClick:e=>{e.preventDefault(),e.stopPropagation(),r()},style:{border:"none",background:"transparent",color:i[900],cursor:"pointer",padding:0,lineHeight:1,fontSize:l},children:"×"})]})})),tp=k((({containerStyle:o,disabled:r,errorMessage:n,freeSolo:l=!1,isShowCheckbox:a=!0,isShowSelectAll:s=!0,multiple:C=!1,name:d,label:A,onBlur:m,onChange:f,onDropdownOptionSelect:k,onKeyDown:E,options:I,placeholder:w="",required:S=!1,disableClearable:B=!!S,size:x="md",value:Q,defaultValue:M,...b},J)=>{const v=O(),{butterflyBlue:R,iron:L,lipstickRed:y}=v.palette.app.color,{navigationKey:F}=Uo(),[U,D]=h(!1),[Z,H]=h(!1),[K,G]=h(""),Y=p(null),V=p(null),T=p(null),[j,W]=h(!1),q=p(void 0),[z,P]=h(null),N=c((()=>qh(Q)),[Q]),X=C?"":N[0]??"",_=c((()=>C&&s&&I.length?[{label:"Select All",value:Vh},...I]:I),[s,C,I]),$=c((()=>zh(_,C||!Z||j?K:"")),[K,Z,j,_,C]),ee=c((()=>new Set(N)),[N]),te=c((()=>{if(!C||!I.length)return!1;const e=I.filter((e=>!e.disabled));return e.length>0&&e.every((e=>ee.has(jh(e))))}),[C,I,ee]),ie=c((()=>C&&I.some((e=>ee.has(jh(e))))),[C,I,ee]),oe=c((()=>{if(C)return"";const e=I.find((e=>jh(e)===X));return e?Th(e):l&&X?X:""}),[l,C,I,X]),{handleEnterNavigation:re,handleKeyDown:ne,inputRef:le,maintainFocusAfterClose:ae,setInputRef:se}=or({isOpen:Z,navigationKey:F}),Ce=_.length>100,de=c((()=>U||Z?R[900]:n?y[900]:L[800]),[R,n,L,U,Z,y]),Ae=g((e=>{const t=I.find((t=>jh(t)===e));return t?Th(t):e}),[I]),ce=g((e=>{f?.({target:{name:d,value:e}})}),[d,f]),he=g((e=>{const t=T.current;if(t)if(C&&Array.isArray(e)){const i=new Set(e);Array.from(t.options).forEach((e=>{e.selected=i.has(e.value)}))}else C||"string"!=typeof e||(t.value=e)}),[C]),pe=g(((e,t)=>{he(e),ce(e),t&&k(t)}),[ce,k,he]),ue=g(((e="",t)=>{const i=zh(_,e);P(Ph(i,t??N,C))}),[_,C,N]),ge=g((e=>{const t=I.filter((e=>e.disabled)).map((e=>jh(e))),i=e?I.map((e=>jh(e))):t;pe(i),co((()=>{G("")})),ue("",i)}),[pe,ue,I]),me=g((e=>{const t=jh(e);if(Wh(e))ge(!te);else{if(C){const e=N.includes(t)?N.filter((e=>e!==t)):[...N,t];return pe(e,t),co((()=>{G("")})),void ue("",e)}pe(t,t),G(Ae(t)),H(!1),ae()}}),[pe,Ae,ge,te,ae,C,ue,N]),fe=g((e=>{const t=e.trim();if(!t)return;const i=I.find((e=>Th(e).toLowerCase()===t.toLowerCase()||jh(e)===t));if(i)me(i);else{if(C){if(N.includes(t))return;const e=[...N,t];return pe(e,t),co((()=>{G("")})),void ue("",e)}pe(t,t),G(t),H(!1),ae()}}),[pe,me,ae,C,ue,I,N]),ke=g((e=>{const t=N.filter((t=>t!==e));pe(t)}),[pe,N]),Ee=c((()=>!B&&!r&&(C?N.length>0:Boolean(X))),[B,r,C,X,N.length]),Ie=g((e=>{e.preventDefault(),e.stopPropagation();pe(C?[]:""),G(""),W(!1),H(!1),P(null),ae()}),[pe,ae,C]),we=g((()=>{H(!1),W(!1),P(null),G(C?"":oe)}),[C,oe]),Se=g((()=>{H(!0),W(!1),G(C?"":oe),ue()}),[C,ue,oe]),Be=g(((e,t)=>{r||!e&&C&&"item-press"===t?.reason||(H(e),e?(W(!1),G(C?"":oe),ue()):(W(!1),G(C?"":oe),P(null),D(!1)))}),[r,C,ue,oe]),xe=g(((e,t)=>{if(C&&"item-press"===t?.reason){if(G(""),Z){const e=zh(_,"");P(e.length?Ph(e,N,C):null)}}else if(W(!0),G(e),Z){const t=zh(_,e);P(t.length?Ph(t,N,C):null)}}),[Z,_,C,N]),Qe=g((e=>{P(e)}),[]),Me=g((e=>{$.length?P((t=>null===t?"down"===e?0:$.length-1:"down"===e?Math.min(t+1,$.length-1):Math.max(t-1,0))):P(null)}),[$.length]),be=e=>{"preventBaseUIHandler"in e&&e.preventBaseUIHandler()},ve=g((e=>{e.preventDefault(),be(e),Z?Me("ArrowDown"===e.key?"down":"up"):(co((()=>{H(!0),W(!1),G(C?"":oe)})),ue())}),[Z,Me,C,ue,oe]),Re=g((e=>{const t=null!==z?$[z]:void 0;if(t)return e.preventDefault(),be(e),void me(t);l&&K.trim()&&(e.preventDefault(),be(e),fe(K))}),[fe,$,l,me,z,K]),Le=g((e=>{if(!("ArrowDown"===e.key||"ArrowUp"===e.key)||r)return"Tab"===e.key&&Z?(H(!1),void ae()):"enter"!==F||"Enter"!==e.key||Z||e.ctrlKey||e.metaKey||e.altKey?void("Enter"===e.key&&Z?Re(e):(ne(e,(()=>{H(!1),ae()}),Z),E?.(e))):(e.preventDefault(),e.stopPropagation(),void re(e));ve(e)}),[r,ve,re,ne,Re,Z,ae,F,E]),ye=g((e=>{const t=e.relatedTarget;window.setTimeout((()=>{if(t&&(Y.current?.contains(t)||V.current?.contains(t)))return;const e=document.activeElement;Y.current?.contains(e)||V.current?.contains(e)||(Z&&(l&&K.trim()&&fe(K),we()),D(!1))}),0),m?.(e)}),[we,fe,l,K,Z,m]),Fe=g((e=>{e.preventDefault(),e.stopPropagation(),r||(Z?(we(),D(!1)):(Se(),D(!0),le.current?.focus()))}),[we,r,le,Z,Se]);u((()=>{Z||(G(C?"":oe),W(!1))}),[Z,C,oe]),u((()=>{q.current=null!==z?$[z]:void 0}),[$,z]);const Ue=c((()=>{if(!I.length&&!N.length)return e("option",{value:"",disabled:!0,children:"No Options"});const o=new Set(I.map(jh)),r=N.filter((e=>!o.has(e)));return t(i,{children:[C?null:e("option",{value:"",children:"Select Option"}),I.map((t=>e("option",{value:jh(t),children:Th(t)},jh(t)))),r.map((t=>e("option",{value:t,children:t},t)))]})}),[C,I,N]),De=g((e=>{T.current=e,"function"==typeof J?J(e):J&&(J.current=e)}),[J]),Ze=g(((e,t)=>!t.trim()||Xo({data:[e],fieldsToSearch:["label"],term:t.toLowerCase()}).length>0),[]),He=L,Ke=R,Ge=C&&a,Ye={width:"var(--anchor-width)",minWidth:"var(--anchor-width)",maxWidth:"var(--anchor-width)"},Ve=Bh(L),je=xh(L,r),We=Sh(x),qe=c((()=>Qh(Ve)),[Ve]),ze=c((()=>bh(x,"autocomplete")),[x]),Pe=c((()=>({...Mh(je,x),flex:1,minWidth:C?"80px":0,cursor:r?"default":"text"})),[r,je,C,x]);return t(vh,{title:n??"",position:"top",delay:50,children:[e("style",{children:qe}),e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",...o},children:t(ho.Root,{items:_,value:K,onValueChange:xe,open:Z,onOpenChange:Be,disabled:r,name:d,autoHighlight:!1,keepHighlight:!0,virtualized:Ce,openOnInputClick:!0,filter:Ze,filteredItems:$,itemToStringValue:Th,onItemHighlighted:(e,t)=>{q.current=e,t.index>=0&&P(t.index)},children:[t("div",{ref:Y,style:{display:"flex",alignItems:"center",flexWrap:C?"wrap":"nowrap",gap:C?We.multipleGap:void 0,border:`2px solid ${de}`,background:L[600],position:"relative",width:"100%",...ze},children:[C?N.map((t=>e(ep,{iron:He,size:x,label:Ae(t),onRemove:()=>{ke(t)}},t))):null,e(ho.Input,{ref:se,disabled:r,className:Eh,placeholder:C&&X?.length?"":w||`Select ${A??"Option"}`,onClick:e=>{e.stopPropagation()},onFocus:e=>{e.stopPropagation(),D(!0),r||Z||document.activeElement!==e.currentTarget||Se()},onBlur:ye,onKeyDown:Le,style:Pe}),Ee?e("button",{type:"button",tabIndex:-1,"aria-label":"Clear selection",onMouseDown:e=>{e.preventDefault()},onClick:Ie,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",padding:0,marginLeft:We.expandMarginLeft,cursor:"pointer",color:L[400]},children:e(Te,{sx:{fontSize:We.expandIconSize-4}})}):null,e("button",{type:"button",tabIndex:-1,"aria-label":Z?"Close options":"Open options",disabled:r,onMouseDown:e=>{e.preventDefault()},onClick:Fe,style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"none",background:"transparent",padding:0,marginLeft:We.expandMarginLeft,cursor:r?"not-allowed":"pointer",color:r?L[800]:L[400]},children:e(Je,{sx:{fontSize:We.expandIconSize,transform:Z?"rotate(180deg)":"none",transition:"transform 0.2s ease"}})}),e("select",{...b,ref:De,name:d,value:C?void 0:X,multiple:C,disabled:r,required:S,tabIndex:-1,"aria-hidden":!0,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0,pointerEvents:"none"},children:Ue})]}),e(ho.Portal,{children:e(ho.Positioner,{anchor:Y,sideOffset:2,align:"start",style:{zIndex:999,...Ye},children:t(ho.Popup,{ref:V,style:{...Ye,background:L[600],border:`1px solid ${L[300]}`,boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",borderRadius:"4px",overflow:"hidden"},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.stopPropagation()},children:[e(ho.Empty,{children:e("div",{style:{padding:We.padding,fontSize:We.fontSize,color:L[800]},children:"No Options"})}),e($h,{butterflyBlue:Ke,highlightedIndex:z,iron:He,isAllSelected:te,isShowSelectAll:s,isSomeSelected:ie,onHighlightIndex:Qe,onSelectOption:me,selectedValuesSet:ee,showCheckbox:Ge,virtualized:Ce})]})})})]})})]})}));tp.displayName="SmartAutoCompleteFieldComponent";const ip=B(tp,(({name:e,value:t,disabled:i,options:o,errorMessage:r,freeSolo:n,multiple:l,isShowSelectAll:a,isShowCheckbox:s,placeholder:C,required:d,disableClearable:A,size:c},{name:h,value:p,disabled:u,options:g,errorMessage:m,freeSolo:f,multiple:k,isShowSelectAll:E,isShowCheckbox:I,placeholder:w,required:S,disableClearable:B,size:x})=>e===h&&t===p&&i===u&&o===g&&r===m&&n===f&&l===k&&a===E&&s===I&&C===w&&d===S&&A===B&&c===x));ip.displayName="SmartAutoCompleteField";const op=k((({errorMessage:t,onKeyDown:i,onBlur:o,onFocus:r,onClick:n,...l},a)=>{const s=O(),{type:C,disabled:d}=l,{butterflyBlue:A,lipstickRed:p,iron:u}=s.palette.app.color,[g,m]=h(!1),{navigationKey:f}=Uo(),{handleEnterNavigation:k}=or({navigationKey:f}),E=c((()=>d?u[700]:g?A[900]:t?p[900]:u[800]),[d,t,g]);return e(vh,{title:t??"",position:"top",delay:50,children:e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:e("div",{style:{display:"flex",alignItems:"center",border:"checkbox"===C?"none":`2px solid ${E}`,borderRadius:"4px",padding:"4px 8px",background:d?u[50]:"white",minHeight:"20px"},children:e("input",{ref:a,...l,style:{width:"100%",border:"none",background:"transparent",padding:"0",fontSize:"13px",outline:"none"},onClick:e=>{e.stopPropagation(),n?.(e)},onFocus:e=>{e.stopPropagation(),r?.(e),m(!0)},onBlur:e=>{e.stopPropagation(),o?.(e),m(!1)},onKeyDown:e=>{"enter"!==f||"Enter"!==e.key||"checkbox"===C||e.ctrlKey||e.metaKey||e.altKey||k(e),i?.(e)}})})})})}));op.displayName="SmartTextFieldComponent";const rp=B(op,((e,t)=>e.name===t.name&&e.value===t.value&&e.checked===t.checked&&e.disabled===t.disabled&&e.type===t.type&&e.errorMessage===t.errorMessage));rp.displayName="SmartTextField";const np=k((({errorMessage:i,onKeyDown:o,onFocus:r,onBlur:n,style:l,className:a,size:s="md",...C},d)=>{const A=O(),{type:p,disabled:u,name:m}=C,{butterflyBlue:f,lipstickRed:k,iron:E}=A.palette.app.color,I=Bh(E),w=xh(E,u),[S,B]=h(!1),{navigationKey:x}=Uo(),{handleEnterNavigation:Q,setInputRef:M}=or({navigationKey:x}),b="checkbox"===p,J=c((()=>i?k[900]:S?f[900]:E[800]),[f,i,E,S,k]),v=c((()=>Qh(I)),[I]),R=c((()=>bh(s,"text")),[s]),L=c((()=>({...Mh(w,s),...l})),[s,l,w]),y=[Eh,a].filter(Boolean).join(" "),F=g((e=>{b||M(e),"function"==typeof d?d(e):d&&(d.current=e)}),[b,d,M]),U=e=>{"enter"!==x||"Enter"!==e.key||b||e.ctrlKey||e.metaKey||e.altKey||Q(e),o?.(e)},D=e=>{e.stopPropagation(),B(!0),r?.(e)},Z=e=>{e.stopPropagation(),B(!1),n?.(e)},H=e(b?"input":Co,{ref:F,...C,disabled:u,className:y,style:L,onClick:e=>{e.stopPropagation()},onFocus:D,onBlur:Z,onKeyDown:U});return t(vh,{title:i??"",position:"top",delay:50,children:[b?null:e("style",{children:v}),e(so.Root,{disabled:u,name:m,style:{width:"100%"},children:e("div",{style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%"},children:e("div",{style:{display:"flex",alignItems:"center",border:b?"none":`2px solid ${J}`,background:E[600],width:"100%",...R},children:H})})})]})}));np.displayName="SmartTextFieldV2Component";const lp=B(np,(({name:e,value:t,checked:i,disabled:o,type:r,size:n,errorMessage:l,placeholder:a},{name:s,value:C,checked:d,disabled:A,type:c,size:h,errorMessage:p,placeholder:u})=>e===s&&t===C&&i===d&&o===A&&r===c&&n===h&&l===p&&a===u));function ap({items:i,disabled:o=!1,avoidDeleteFocus:n=!1}){const[l,a]=h(null),s=!!l,d=J(),A=d.palette.app.color.red?.[900]??d.palette.error.main,g=p(null),m=p([]),f=c((()=>(i??[]).filter((({isView:e})=>!e))),[i]),k=()=>a(null),E=e=>"delete"===e.toLowerCase();u((()=>{const e=g.current;if(!e)return;const t=t=>{o||"Enter"===t.key&&(t.preventDefault(),a(e))};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[o]);const I=e=>{const t=m.current;if(!t.length)return;const i=document.activeElement,o=t.findIndex((e=>e===i)),r=-1!==o?o:1===e?-1:t.length;for(let i=1;i<=t.length;i++){const o=(r+i*e+t.length)%t.length,l=t[o],a=f[o]?.title??"";if(l&&(!n||!E(a)))return void l.focus()}};return u((()=>{s&&n&&f.length&&requestAnimationFrame((()=>I(1)))}),[n,f.length,s]),f.length?t(M,{sx:{width:"100%"},children:[e(r,{ref:g,component:"div",sx:{width:"100%",cursor:"pointer",alignItems:"center"},onClick:e=>{o||a(e.currentTarget)},disabled:o,"data-clickable":"true",children:e(Ae,{})}),l&&e(ce,{open:!0,anchorEl:l,onClose:k,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{onKeyDown:e=>{n&&("ArrowDown"===e.key&&(e.preventDefault(),I(1)),"ArrowUp"===e.key&&(e.preventDefault(),I(-1)))}}},children:e(jl,{padding:{padding:"2px"},children:f.map((({title:t,onClick:i,href:o},r)=>{const l=E(t);return e(M,{children:e(le,{...o?{component:C,href:o,prefetch:!1}:{},ref:e=>{m.current[r]=e},sx:{borderRadius:"4px",color:l?A:void 0,width:"100%",textAlign:"start",padding:"5px 16px 5px 10px"},tabIndex:l&&n?-1:0,onClick:()=>{i?.(),k()},children:e(q,{variant:"body1",children:t})})},t)}))})})]}):null}lp.displayName="SmartTextFieldV2";const sp=({orientation:t="horizontal",activeStep:i=0,stepLabelProps:o={},steps:r,errorSteps:n=[],onStepClick:l,showActiveStepIcon:a,showTooltips:s=!1,showStepLabels:C=!0,...d})=>{const A=J(),{butterflyBlue:c,red:h}=A.palette.app.color;return e(M,{children:e(mo,{activeStep:i,orientation:t,...d,children:r.map(((t,i)=>{const r=n.includes(i),a=e(go,{...o,error:r,sx:{cursor:l?"pointer":"default",".Mui-active .MuiStepIcon-root":{color:`${c[900]} !important`},".Mui-completed .MuiStepIcon-root":{color:`${c[900]} !important`},...r&&{".MuiStepIcon-root":{color:`${h[900]} !important`},".MuiStepLabel-label":{color:`${h[900]} !important`}},...o.sx},onClick:()=>(e=>{l&&l(e)})(i),children:C&&e(q,{variant:"body2",children:t})});return e(uo,{children:s?e(W,{title:t,placement:"top",children:a}):a},t)}))})})},Cp=v(fo)((({theme:e})=>({[`&.${ko.alternativeLabel}`]:{top:10,left:"calc(-50% + 16px)",right:"calc(50% + 16px)"},[`&.${ko.active}`]:{[`& .${ko.line}`]:{borderColor:"#784af4"}},[`&.${ko.completed}`]:{[`& .${ko.line}`]:{borderColor:"#784af4"}},[`& .${ko.line}`]:{borderColor:"#eaeaf0",borderTopWidth:3,borderRadius:1,...e.applyStyles("dark",{borderColor:e.palette.grey[800]})}}))),dp=v("div")((({theme:e})=>({color:"#eaeaf0",display:"flex",height:22,alignItems:"center","& .QontoStepIcon-completedIcon":{color:"#784af4",zIndex:1,fontSize:18},"& .QontoStepIcon-circle":{width:8,height:8,borderRadius:"50%",backgroundColor:"currentColor"},...e.applyStyles("dark",{color:e.palette.grey[700]}),variants:[{props:({ownerState:e})=>e.active,style:{color:"#784af4"}}]})));function Ap(t){const{active:i,completed:o,className:r}=t;return e(dp,{ownerState:{active:i},className:r,children:o?e(je,{className:"QontoStepIcon-completedIcon"}):e("div",{className:"QontoStepIcon-circle"})})}const cp=({steps:t,alternativeLabel:i=!0,stepLabelProps:o={},...r})=>e(a,{sx:{width:"100%"},spacing:4,children:e(mo,{alternativeLabel:i,activeStep:1,connector:e(Cp,{}),...r,children:t.map((t=>e(uo,{children:e(go,{StepIconComponent:Ap,...o,children:t})},t)))})}),hp=({orientation:o="horizontal",activeStep:r=0,stepLabelProps:n={},steps:l,...s})=>{const C=J(),{butterflyBlue:d}=C.palette.app.color;return e(M,{children:e(mo,{activeStep:r,orientation:o,...s,children:l.map(((o,r)=>e(uo,{children:e(go,{...n,sx:{".Mui-active .css-18pqgpd-MuiSvgIcon-root-MuiStepIcon-root":{color:`${d[900]} !important`},".Mui-completed .MuiStepIcon-root":{color:`${d[900]} !important`},".MuiStepIcon-text":{color:"transparent !important",display:"none"}},children:e(a,{children:t(i,o?.in_time?{children:[e(q,{variant:"caption",children:"In at"}),e(q,{variant:"caption",children:o?.in_time})]}:{children:[e(q,{variant:"caption",children:"Out at"}),e(q,{variant:"caption",children:o?.out_time})]})})})},r)))})})},pp=()=>e(M,{flex:1,children:e(we,{height:"30px",sx:{maxWidth:"200px",transform:"scale(1)"}})}),up={small:{minHeight:"36px !important",height:"36px !important",fontSize:"12px !important",padding:"10px 5px !important"},medium:{minHeight:"48px !important",height:"48px !important",fontSize:"13px !important",padding:"12px 16px !important"},large:{minHeight:"52px !important",height:"52px !important",fontSize:"14px !important",padding:"14px 18px !important"}},gp={small:{minHeight:"36px !important",height:"36px !important"},medium:{minHeight:"48px !important",height:"48px !important"},large:{minHeight:"52px !important",height:"52px !important"}},mp=({tabs:t,value:i,loading:o,tabProps:r,role:n,size:l="medium"})=>o?e(a,{gap:"10px",direction:"row",children:t.map((()=>e(pp,{},ti())))}):e(Io,{value:i,role:n,sx:{...gp[l],"& .MuiTabs-scroller":{minHeight:"inherit",height:"inherit"},"& .MuiTabs-flexContainer":{minHeight:"inherit",height:"inherit"},"& .MuiTab-root.MuiButtonBase-root":{...up[l]}},children:t.filter((({isView:e})=>!1!==e)).map((({iconPosition:t="end",toolTipLabel:i="",icon:n,href:l,target:a,...s},d)=>{const A=l?{component:C,href:l,target:a,prefetch:!1}:{},c=ye(s,["isView"]);return I(Eo,{...A,key:c.value??d,icon:i?e(xl,{toolTipLabel:i,placement:"bottom",children:n}):n,disabled:o,iconPosition:t,...c,...r})}))});function fp({label:i,value:o,menu:r,trimLabel:n=!0,activeTab:l,index:s,onArrowClick:d,menuAnchor:A,onAction:c,href:h,target:p,...u}){const g=J(),{butterflyBlue:m}=g.palette.app.color,f=o===l.value,k=i.toLowerCase().replaceAll(/[ _]/g,"-"),E=xo(i,{length:n?15:i.length,omission:n?"...":""}),I={title:"Edit",onClick:()=>c&&c("editTemplate",l)},w={title:"Delete",onClick:()=>c&&c("deleteTemplate",l)},S=h?{component:C,href:h,target:p,prefetch:!1}:{},B={iconPosition:"end","data-cy":k,"data-ptag":k,value:o??s,label:t(a,{direction:"row",gap:"6px",alignItems:"center",children:[e(q,{variant:"body1",sx:{whiteSpace:"nowrap"},children:f?i:E}),f&&s>0&&e(zl,{items:[I,w]})]})};return i.length>15&&!f&&(B.title=i),o===l.value&&r?.length&&(B.icon=e(oe,{onClick:d,id:`tabDropDown-${o}`,"aria-controls":null!==A?`dropDownMenu-${o}`:void 0,"aria-expanded":null!==A?"true":void 0,"aria-haspopup":"true","data-cy":`${k}-arrowicon`,"data-ptag":`${k}-arrowicon`})),e(Eo,{sx:{borderBottom:"2px solid",borderBottomColor:f?m[900]:"white",overflow:"visible",[`&.${Bo.root}`]:{minHeight:"40px",height:"40px",paddingLeft:f&&s>0?"15px":"10px"},"&:hover":{backgroundColor:m[500]}},...B,...S,...u})}function kp({tabs:t,activeTab:o,menuAnchor:r,onClose:a,onMenuItemClick:s}){return e(i,{children:t.filter((e=>!!e.menu)).map((t=>e(n,{anchorEl:r,open:t.value===o.value&&!!r,onClose:a,id:`dropDownMenu-${t.value}`,MenuListProps:{"aria-labelledby":`tabDropDown-${t.value}`},children:t.menu?.map((({label:t,disabled:i,onClick:r,href:n,target:a})=>e(l,{onClick:()=>{s(),r(o)},disabled:i,...n?{component:C,href:n,target:a,prefetch:!1}:{},children:t},t)))},t.value)))})}function Ep({tabs:i,onChange:o,addButton:r,actionButton:n,ariaLabel:l,activeIndex:s=0,onAction:C}){const d=J(),[A,c]=h(i[s]),[p,g]=h(null);u((()=>{-1===i.findIndex((e=>e.value===A.value))&&(o&&i[0]&&o(i[0]),c(i[0]))}),[i,A,o]),u((()=>{c(i[s])}),[s]);return t(M,{children:[e(kp,{activeTab:A,tabs:i,onClose:()=>g(null),onMenuItemClick:()=>g(null),menuAnchor:p}),t(a,{direction:"row",justifyContent:"space-between",sx:{borderBlockEnd:"solid 1px",borderColor:d.palette.app.color.iron[700]},children:[t(a,{direction:"row",gap:"5px",alignItems:"center",overflow:"hidden",children:[e(a,{direction:"row",overflow:"hidden",children:e(Io,{value:i.some((e=>e.value===A.value))?A.value:i[0]?.value,onChange:(e,t)=>{const r=i.find((e=>e.value===t));r&&(c(r),o&&r&&o(r))},TabIndicatorProps:{sx:{display:"none"}},sx:{[`&.${wo.root}`]:{minHeight:"40px",height:"40px"}},variant:"scrollable",scrollButtons:"auto",ScrollButtonComponent:So,"aria-label":l??"Tabs",children:i.map(((t,i)=>e(fp,{index:i,activeTab:A,onArrowClick:e=>{g(e.target)},onAction:C,menuAnchor:p,...t},t.value)))})}),r]}),e(a,{direction:"row",gap:"10px",alignItems:"center",justifyContent:"space-between",children:n})]})]})}const Ip=({variant:i,leaveColor:o,toolTipLabel:r})=>{const n=Ro(i);return t(a,{sx:{position:"relative",width:"100%",alignItems:"center"},children:[e(M,{sx:{position:"absolute",backgroundColor:"#ffffff",border:`1px solid ${o??n}`,borderRadius:"7px",padding:"0px 5px",zIndex:1,color:`${o??n}`,height:"28px",display:"flex",alignItems:"center",cursor:"pointer"},children:e(xl,{toolTipLabel:r,children:Lo(i)})}),e(ui,{valueLabelDisplay:"off",value:[0,2],max:2,step:1,sx:{"& .MuiSlider-track":{background:`${o??n}`,height:"2px",border:"none"},"& .MuiSlider-thumb":{backgroundColor:`${o??n}`,height:8,width:8},"& .MuiSlider-rail":{backgroundColor:"transparent"}}})]})},wp=({totalDots:i,intervals:o,startTimeline:r})=>e(M,{sx:{position:"relative",width:"100%",height:4},children:o?.map(((o,n)=>{const l=Go(o.in_time),s=Go(o.out_time),C=U.fromISO(o.in_time),d=U.fromISO(o.out_time).diff(C,["hours","minutes"]).toFormat("hh:mm");let A=Sp(l),c=Sp(s);const h=!isNaN(A),p=!isNaN(c);h&&A<r&&(A+=i),p&&(c<r&&(c+=i),h&&c<A&&(c+=i));let u="",g="";h&&(u=`In time : ${l} ${p?"":" / Missing punch"}`),p&&(g=`Out time : ${s} ${h?"":"/ Missing punch"}`);const m=o?.name??`In/Out: ${Go(o.in_time)} - ${Go(o.out_time)} (${d})`,f=o?.color??Ro(o.status_type),k=h?(A-r)/i*100:0,E=p?(c-r)/i*100:0,I=h&&p?Math.max(E-k,0):0;return t(a,{direction:"row",children:[h&&e(W,{arrow:!0,title:u,placement:"top",children:e(M,{sx:{height:8,width:8,position:"absolute",left:`${k}%`,boxShadow:"none",backgroundColor:f,borderRadius:"50%",top:"15px",zIndex:3,"&:focus, &:hover, &:active":{boxShadow:"none"}}})}),h&&p&&e(W,{arrow:!0,title:m,placement:"top",children:e(M,{sx:{position:"absolute",left:`${k}%`,width:`${I}%`,height:3.5,top:"17.5px",backgroundColor:f,zIndex:2}})}),p&&e(W,{arrow:!0,title:g,placement:"top",children:e(M,{sx:{height:8,width:8,position:"absolute",left:`${E}%`,boxShadow:"none",backgroundColor:f,borderRadius:"50%",top:"15px",zIndex:3,"&:focus, &:hover, &:active":{boxShadow:"none"}}})})]},n)}))}),Sp=e=>{const t=U.fromFormat(e,"HH:mm");return t.hour+t.minute/60},Bp=({totalDots:i,highlightedIntervals:o,shiftStartTime:r,shiftEndTime:n,startTimeline:l="2024-11-17T18:30:04.000Z"})=>{const s=parseFloat(Go(l)),C=(e,t,o)=>{const r=Go(e),n=Go(t);let l=Sp(r),a=Sp(n);return l=l<s?l+i:l,a=a<l?a+i:a,"END"===o?a:l},d=e=>{const t=(e+s)%i;return o.some((e=>t>=parseFloat(Go(e.in_time))&&t<=parseFloat(Go(e.out_time))))},A=Array.from({length:i},((e,t)=>({value:(t+s)%i,label:"",highlighted:d((t+s)%i)})));return t(a,{sx:{position:"relative",width:"100%"},children:[e(wp,{totalDots:i,intervals:o,startTimeline:s}),e(W,{title:`Shift Start: ${Go(r)}`,arrow:!0,placement:"top",children:e(M,{sx:{cursor:"pointer",position:"absolute",top:"12px",zIndex:2,left:(C(r,n,"START")-s)%i/i*100+"%"},children:e(Zr,{})})}),e(W,{title:`Shift End: ${Go(n)}`,arrow:!0,placement:"top",children:e(M,{sx:{cursor:"pointer",position:"absolute",top:"12px",zIndex:2,left:(C(r,n,"END")-s)%i/(i-.6)*100+"%"},children:e(Zr,{})})}),e(ui,{disabled:!0,valueLabelDisplay:"off",marks:A,max:i-1,step:1,value:[],sx:{zIndex:1,"& .MuiSlider-track":{background:"transparent",height:1,border:"none"},"& .MuiSlider-mark":{backgroundColor:"gray",height:4,width:4,borderRadius:"50%"},"& .MuiSlider-markActive":{backgroundColor:"transparent",height:5,width:5},"& .MuiSlider-rail":{height:2,backgroundColor:"#929292"},"& .MuiSlider-thumb":{display:"none"}}})]})},xp=v(se,{shouldForwardProp:e=>"isParent"!==e&&"borderColor"!==e&&"backgroundColor"!==e&&"baseColor"!==e})((({theme:e,isParent:t,borderColor:i,backgroundColor:o,baseColor:r})=>({width:"auto",minWidth:0,padding:e.spacing(1),borderRadius:12,border:`1px solid ${i}`,boxShadow:t?`0 6px 18px ${y(r,.2)}`:"none",backgroundColor:o,display:"flex",alignItems:"center",gap:e.spacing(1),minHeight:40,overflow:"hidden",flex:"1 1 auto",[e.breakpoints.down("sm")]:{flex:"1 1 100%"}}))),Qp=({node:i,innerRef:o,isParent:r=!1,themeColor:n})=>{const{id:l,title:a,subtitle:s,value:C}=i,d=J(),{butterflyBlue:A,slate:c}=d.palette.app.color,h=n??A[900],p=r?h:y(h,.7),u=r?y(h,.1):"none",g=c[900];return t(xp,{elevation:r?3:0,ref:o,isParent:r,borderColor:p,backgroundColor:u,baseColor:h,children:[t(M,{children:[e(q,{variant:"subtitle2",noWrap:!0,children:a}),e(q,{variant:"subtitle2",color:g,noWrap:!0,children:s})]}),e(jl,{padding:{paddingLeft:1},children:e(M,{sx:{ml:"auto",textAlign:"right"},children:e(q,{noWrap:!0,variant:"body2",children:C})})})]},l)},Mp=({node:i,setRef:o,themeColor:r,itemWidth:n})=>{const{id:l,children:s}=i,C=!!s?.length;return t(M,{sx:{display:"flex",gap:3,alignItems:"flex-start",flex:`1 0 ${n}`},children:[e(Qp,{node:i,isParent:C,innerRef:e=>o(l,e),themeColor:r}),C&&e(a,{spacing:1,sx:{mt:.5},children:de(s,(t=>e(Mp,{node:t,setRef:o,themeColor:r,itemWidth:n},t.id)))})]},l)},bp=({node:i,setRef:o,themeColor:r})=>{const{id:n,children:l}=i,s=!!l?.length;return t(a,{gap:1,children:[e(Qp,{node:i,isParent:s,innerRef:e=>o(n,e),themeColor:r}),s&&e(jl,{padding:{paddingLeft:3,paddingTop:1},children:e(a,{spacing:1,children:de(l,(t=>e(bp,{node:t,setRef:o,themeColor:r},t.id)))})})]},n)},Jp=({nodes:i,direction:o="horizontal",columns:r=3,color:n})=>{const{isMobile:l}=rr(),s=p({}),C=p(null),d=p(null),A=p(null),[c,g]=h([]),m=(e,t)=>{if(t)return s.current[e]=t,void(A.current&&A.current.observe(t));s.current=ye(s.current,e)},f=e=>e?e.getBoundingClientRect():null,k=(e,t,i)=>{Qo(e,(e=>{const{id:r,children:n}=e;if(!n?.length)return;const a=s.current[r];if(!a)return;const C=f(a);C&&Qo(n,(e=>{const{id:r,children:n}=e,a=s.current[r];if(!a)return;const d=f(a);if(!d)return;const A=l||"vertical"===o?((e,t,i)=>{const{left:o,width:r,bottom:n}=e,{left:l,width:a,top:s}=t,{left:C,top:d}=i,A=o+r/2-C,c=n-d,h=l+a/2-C,p=s-d,u=c+Math.max(12,(p-c)/2);return`M ${A} ${c} C ${A} ${u} ${h} ${u} ${h} ${p}`})(C,d,t):((e,t,i)=>{const{right:o,top:r,height:n}=e,{left:l,top:a,height:s}=t,{left:C,top:d}=i,A=o-C,c=r+n/2-d,h=l-C,p=a+s/2-d,u=h-A,g=Math.abs(u),m=Math.min(120,Math.max(24,g/2)),f=u>=0?1:-1;return`M ${A} ${c} C ${A+m*f} ${c} ${h-m*f} ${p} ${h} ${p}`})(C,d,t);i.push({definition:A}),n?.length&&k([e],t,i)}))}))};u((()=>{const e=()=>requestAnimationFrame((()=>{(()=>{const e=d.current,t=C.current;if(!e||!t)return;const o=t.clientWidth;e.setAttribute("width",String(o)),e.setAttribute("height","auto");const r=t.getBoundingClientRect(),n=[];k(i,r,n),g(n)})()})),t=e(),o=new ResizeObserver(e);A.current=o,C.current&&o.observe(C.current),Ze(s.current).forEach((e=>o.observe(e)));const r=e;return window.addEventListener("resize",r),()=>{cancelAnimationFrame(t),o.disconnect(),A.current=null,window.removeEventListener("resize",r)}}),[i,l,o]);const E=`calc(${100/r}% - 24px)`;return t(M,{ref:C,variant:"outlined",component:se,position:"relative",sx:{overflowX:"hidden",overflowY:"visible"},children:[e(On,{ref:d,paths:c,strokeColor:n}),e(jl,l||"vertical"===o?{padding:{padding:2},children:e(a,{spacing:3,children:de(i,(t=>e(bp,{node:t,setRef:m,themeColor:n},t.id)))})}:{padding:{padding:2},children:e(a,{direction:"row",alignItems:"flex-start",justifyContent:"flex-start",flexWrap:"wrap",gap:3,children:de(i,(t=>e(Mp,{node:t,setRef:m,themeColor:n,itemWidth:E},t.id)))})})]})},vp=v(xe)((({theme:e,color:t})=>{const i=((e,t)=>{if(!t||"default"===t)return e.palette.grey[500];const i=e.palette[t];return i&&"object"==typeof i&&"main"in i?i.main:e.palette.grey[500]})(e,t);return{"& .MuiBadge-badge":{backgroundColor:i,color:i,boxShadow:`0 0 0 2px ${e.palette.background.paper}`,"&::after":{position:"absolute",top:"-1px",left:"-1px",width:"100%",height:"100%",borderRadius:"50%",animation:"ripple 1.2s infinite ease-in-out",border:"1px solid currentColor",content:'""'}},"@keyframes ripple":{"0%":{transform:"scale(.8)",opacity:1},"100%":{transform:"scale(2.4)",opacity:0}}}}));v(n)((({theme:e})=>({[`& .${bo.paper}`]:{boxShadow:e.palette.app.paperBoxShadow,minWidth:"29rem",width:"auto",margin:"0 0.5rem",borderRadius:"8px",overflow:"visible","& .MuiList-root":{padding:"0",overflow:"visible"}}})));const Rp=v(r,{shouldForwardProp:e=>"isOpened"!==e})((({theme:e})=>({paddingInline:"0.3rem",paddingBlock:"0.2rem",borderRadius:"8px",color:e.palette.app.color.black[900]})));function Lp({userDetails:o,menuItems:r,shouldCloseOnClick:n=!0,showBadge:l=!1,badgeColor:s="success"}){const[d,A]=h(null),c=p(null),{layout:u}=rr(),g="desktop"===u,m=J(),{iron:f}=m.palette.app.color,k=Boolean(d),E=()=>A(null),{name:I,avatar:w}=o,S=e(Se,{src:w,sx:{border:`1px solid ${f[700]}`,width:28,height:28}});return t(M,{position:"relative",children:[e(M,{sx:{display:"flex",alignItems:"center"},children:e(Rp,{ref:c,onClick:e=>{A(e.currentTarget)},size:"small","aria-haspopup":"true",children:t(a,{direction:"row",alignItems:"center",gap:1,color:"black",children:[l&&e(vp,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},variant:"dot",color:s,children:S}),!l&&S,g&&t(i,{children:[e(q,{maxWidth:150,noWrap:!0,children:I}),e(k?ve:Je,{})]})]})})}),k&&e(ce,{open:!0,anchorEl:d,onClose:E,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{elevation:0,sx:{width:220,overflow:"visible",mt:1.5,px:0,py:0,filter:"drop-shadow(0px 2px 8px rgba(0,0,0,0.32))","& .MuiAvatar-root":{width:32,height:32,ml:-.5,mr:1},"&:before":{content:'""',display:"block",position:"absolute",top:0,right:14,width:10,height:10,bgcolor:"background.paper",transform:"translateY(-50%) rotate(45deg)",zIndex:0}}}},children:e(M,{sx:{padding:"4px 0"},children:r.map((({key:i,divider:o,label:r,icon:l,sx:s,onClick:d,href:A,target:c})=>{const h=A?{component:C,href:A,target:c,prefetch:!1}:{};return t(M,{children:[o&&e($,{}),e(le,{...h,onClick:()=>{te(d)&&(d(),n&&E())},children:(l||r)&&t(a,{gap:"16px",alignItems:"center",width:"100%",flexDirection:"row",sx:{...s},children:[e(Mo,{sx:{minWidth:"20px",alignItems:"center",...s},children:l}),r&&e(q,{sx:{fontSize:"13px"},children:r})]})})]},`${i}_container`)}))})})]})}export{zd as ASPECT_RATIO_LABELS,qd as ASPECT_RATIO_VALUES,vr as ActionButton,Jr as ActionButtons,Pl as ActionButtonsWrapper,zl as ActionCell,Ql as AddIconAction,ua as AgGrid,fl as AnnouncementBanner,Ga as AppBar,$n as AppLogoMedium,el as AppLogoSmall,Zr as ArrowUp,Dr as ArrowUpRight,$a as AttendanceCard,tl as AttendanceManagementDarkSvg,il as AttendanceReportDarkSvg,Ip as AttendanceStatus,uC as Autocomplete,Ya as Badge,Rs as BarChart,ml as BookMarkSvg,kC as BottomDialog,IC as BottomSheet,$s as BoxStyled,Va as BreadcrumbButtonWrapper,qa as Breadcrumbs,ol as BriefcaseSvg,rl as BulkOperationsDarkSvg,Rr as Button,bC as ButtonContainer,Lr as ButtonGroup,yr as ButtonLayoutProvider,Ml as CalendarIconAction,sl as CalendarSvg,za as Card,Pa as CardItem,Oa as CardItemValue,Js as CellSelectionTable,ll as ChartIconSvg,DC as CheckBox,eC as CheckStyled,Jo as CheckboxInput,Ds as Chip,Hs as ChipWithBorder,al as ClockSvg,Vs as CodeSnippetBox,Uc as ColumnArranger,Zc as ColumnArrangerDialog,Dc as ColumnArrangerForm,wl as ColumnArrangerSvg,bl as ColumnIconAction,El as CommentIcon,qr as CompanyBanner,Jl as ConfigureIconAction,JC as ContentBox,nd as CurrencyField,Tl as CurrentLocationAction,Za as CustomEnumFilter,Nl as DEFAULT_AG_GRID_PERSIST_STORAGE_TYPE,Xd as DEFAULT_ASPECT_RATIOS,Nd as DEFAULT_ENABLED_VARIANTS,Vd as DEFAULT_MAX_SIZE_MB,Td as DEFAULT_MIN_RESOLUTION,oc as DEFAULT_PROGRESS_BAND_THRESHOLDS,jd as DEFAULT_QUALITY_WARN_RESOLUTION,Cl as DashboardIconSvg,YC as DatePicker,PC as DateRangePicker,_C as DateRangePickerField,rh as DateRangePickerPopUp,OC as DateRangeSelector,id as DateTimePicker,ad as DecimalTextField,LC as DeleteDialog,vl as DeleteIconAction,gC as Dialog,FC as DialogSelect,ud as DownloadAction,Rl as DownloadIconAction,Ll as DownloadPrintAction,zr as DownloadSvg,eh as Drawer,yl as EditIconAction,dl as EmployeeManagementDarkSvg,Al as EmployeeReportsDarkSvg,wn as ExitIcon,Fl as ExportIconAction,aa as FacebookCircularProgress,md as FileNames,pd as FilePreview,MC as FilePreviewContainer,wd as FileUpload,Ul as FilterIconAction,ph as FilterList,Ah as FilterListV2,Zs as FilterPill,Ks as FilterPillV2,sh as FilterPopUpDateRangeWrapper,nh as FilterPopup,ah as FilterPopupWrapper,hh as FilterTypeWrapper,gn as FormAction,Ur as FormActionButton,wC as FormContainer,SC as FormGridLayout,xC as FormRow,QC as FormSection,RC as GridProvider,Il as GroupIcon,uh as HighlightedText,Dl as HistoryIconAction,nl as HolidayCalendarSvg,cl as HomePageBanner,Ud as ImageUpload,Dd as ImageUploadView,mn as ImportExcelSuccessIcon,Zl as ImportIconAction,Sn as InboxIcon,Hl as InboxIconAction,gh as Indicator,Wd as JPEG_COMPRESS_QUALITY,Vl as KeyBoardIconAction,Zd as LOGO_ACCEPTED_TYPES,Hd as LOGO_ACCEPT_ATTRIBUTE,Kd as LOGO_EXTENSION_MIME_MAP,yA as LOGO_SIZE_TOKENS,Od as LOGO_VARIANT_SIZES,fn as LeaveIcon,KC as LeftArrowIcon,kl as LikeIcon,ys as LineChart,PA as ListItemButton,Ua as LoadingCell,sa as LoadingOverlay,kn as LoanIcon,Bn as LogoIcon,qA as LogoPicker,GA as LogoViewDialog,Yh as MAX_LIST_HEIGHT,Pr as MasterIcon,vC as MasterPageLayout,hl as MiscellaneousManagementDarkSvg,Fo as NavigationKeyProvider,Zo as NavigationRouterProvider,xn as NoDataFoundSvg,Ca as NoDataOverlay,Qp as Node,Kh as OPTION_ROW_HEIGHT,En as OvertimeIcon,Pd as PRIMARY_SIZE_BY_RATIO,jl as PadBox,fh as Pagination,$A as PasswordField,pl as PayrollManagementDarkSvg,ul as PayrollReportDarkSvg,ic as PhoneInputField,Ld as PhotoCaptureDialog,Us as PieChart,kh as PrintDownloadActions,Kl as ProcessIconAction,Na as ProfileCard,Xa as ProfileCardBody,_a as ProfileCardHeader,ac as ProgressCell,uc as ProgressSliderField,fc as RadioGroupField,Ic as Rating,Da as RedirectionCell,GC as RightArrowIcon,Vh as SELECT_ALL_VALUE,Eh as SMART_FIELD_INPUT_CLASS,dd as SUPPORTED_DOC_FORMATS,Ad as SUPPORTED_EXCEL_FORMATS,qo as SUPPORTED_FILE_TYPES,sd as SUPPORTED_IMAGE_FORMATS,Cd as SUPPORTED_PDF_FORMATS,In as SalaryIcon,yC as SaveDialog,wc as SearchField,Qc as Select,Or as SettingIcon,mh as SeverityIndicator,oh as SideDrawer,ip as SmartAutoCompleteField,Fh as SmartCurrencyField,Dh as SmartDialogSelect,ap as SmartGridActionCell,Kc as SmartLink,Hh as SmartSelectField,rp as SmartTextField,lp as SmartTextFieldV2,vh as SmartTooltip,Fr as SplitButton,sp as Stepper,cp as StepperV2,hp as StepperV3,Sc as StickySearchField,Qn as SvgAccessDenied,Nr as SvgAccount,Mn as SvgAdd,bn as SvgAddRounded,Hr as SvgArrival,Xr as SvgBankConfig,On as SvgBranches,Jn as SvgCalendar,un as SvgCategory,vn as SvgColumn,_r as SvgConfiguration,Rn as SvgConfigure,gl as SvgCurrentLocation,Ln as SvgDelete,Kr as SvgDeparture,sn as SvgDevices,yn as SvgDownload,Fn as SvgDrop,Kn as SvgEdit,Nn as SvgEmail,Cn as SvgEmployeeOnboarding,$r as SvgEmployees,an as SvgEngage,en as SvgExpenses,Un as SvgExport,Zn as SvgFilterList,Dn as SvgFilteredList,cn as SvgHelpDesk,Hn as SvgHistory,Gr as SvgHoliday,Gn as SvgHome,Yn as SvgImport,Xn as SvgIndicator,Vn as SvgKeyBoard,Yr as SvgLeaveCalendar,tn as SvgLetteremplate,Tn as SvgNoLogo,jn as SvgNoSign,Bl as SvgNotification,on as SvgOrganization,Wn as SvgPageNotFound,rn as SvgPayroll,pn as SvgPerformance,_n as SvgPhone,qn as SvgProfile,zn as SvgReGenerate,nn as SvgStock,Sl as SvgSupport,hn as SvgTasks,dn as SvgTeam,ln as SvgTransaction,Vr as SvgUnverifieduser,Tr as SvgUser,jr as SvgVerifiedUser,Pn as SvgView,An as SvgVisitors,Wr as SvgWeekoffCalendar,bc as SwitchField,fp as Tab,Ep as TabBar,mp as Tabs,kp as TabsMenus,_A as TextField,Br as Theme,vc as TimeField,Lc as TimePicker,Bp as Timeline,Ws as Toaster,xl as Tooltip,Jp as Tree,Lp as UserProfileMenu,Gh as VIRTUALIZE_THRESHOLD,Gl as ViewDetailsIconAction,gd as ViewFilePreviewDialog,Yl as ViewIconAction,hr as accessorFnRegex,Mr as appTheme,ta as buildAgGridPersistedState,Ra as calculateSummaryRow,ra as clearAgGridPersistedState,kr as colorPaletteUI,HC as dateFormats,ca as defaultPageSize,DA as detectLogoShape,To as downloadFile,Wo as downloadPrintHtml,Ar as emailRegex,_o as errorMessages,Id as error_with_transaltion,Ha as extractPrefixedValue,ls as extractSortValue,Xo as filterByFields,zh as filterOptionsByQuery,xa as flattenColumns,Ko as formatDate,dh as formatFilterData,Vo as formatHours,_l as getAgGridPersistStorage,Xl as getAgGridPersistStorageKey,$l as getAgGridPersistedState,Sp as getArrowValue,Ro as getColorByVariant,UA as getDefaultPreviewLimits,Yo as getDifferenceInHHmmss,FA as getEditFrameSize,$o as getErrorProps,Ch as getFormValue,Ph as getInitialHighlightIndex,ZA as getLogoFrameSize,Gd as getLogoMimeFromFileName,ss as getNextSortDirection,Th as getOptionLabelText,jh as getOptionValueText,xr as getPaletteByTheme,nc as getProgressBandColor,rc as getProgressBandKey,Ac as getProgressPercent,cc as getSliderStep,Mh as getSmartFieldInputStyles,Bh as getSmartFieldPlaceholderColor,Qh as getSmartFieldPlaceholderCss,Sh as getSmartFieldSizeConfig,xh as getSmartFieldTextColor,bh as getSmartFieldWrapperStyles,Lo as getStatusLabel,Go as getTimeInHHmm,_d as getVariantsForAspectRatio,Oo as getZIndex,ur as highlightWordsRegex,No as hslToRgb,pr as hslaRegex,zo as isFileSizeValid,hd as isFileType,Po as isFileTypeValid,Yd as isLogoAcceptedType,Wh as isSelectAllOption,ds as isSelectionDisabled,Cs as isSortingEnabled,$d as isSvgFile,Cr as isoDateRegex,HA as loadImageNaturalSize,sr as monthYearRegex,dr as noSpecialCharacterRegex,qh as normalizeToStringArray,gr as numericRegex,ha as pageSizeOptions,tr as parseCellValue,er as parseNumericValue,ld as predefinedOptions,ia as restoreAgGridFilterState,oa as restoreAgGridPaginationState,dc as roundToTwoDecimals,vo as serverityOptions,ea as setAgGridPersistedState,Aa as showNoRowsOverlay,as as sortTableData,cr as timeRegex,hc as toSliderNumber,Ns as toasts,br as urlToNestedObject,ma as useAgGridCheckBoxSelection,fa as useAgGridFilteredData,Ia as useAgGridKeyboardShortcuts,na as useAgGridPersist,la as useAgGridPersistReset,wa as useAgGridRowSelectionConfig,Fa as useAgGridSelection,La as useAgGridSummaryRow,ya as useAgGridSummaryRowUpdate,ir as useDialogActions,or as useFormFieldFocus,rr as useGetDeviceType,nr as useGlobalKeyboardShortcut,Uo as useNavigationKeyContext,Ho as useNavigationRouter,ar as useParseHref,rs as useRowSelection,As as useSorting,lr as useZoomLevel};
24
24
  //# sourceMappingURL=index.esm.js.map