sevago-library 1.6.7 → 1.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # sevago-library
2
2
 
3
+ ## 1.6.8
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: enhance BrowserSerialPort with getInfo method and add filtering for authorized ports
8
+
3
9
  ## 1.6.7
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -261,4 +261,4 @@ To suppress this warning, you need to explicitly provide the \`palette.${e}Chann
261
261
  }
262
262
  `,da={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo",infiniteGrid:"transform-component-module_infiniteGrid__Z-aP3"};ZB(_B);var $B=function(A){var e=A.children,t=A.wrapperClass,o=t===void 0?"":t,r=A.contentClass,i=r===void 0?"":r,a=A.wrapperStyle,s=A.contentStyle,l=A.wrapperProps,d=l===void 0?{}:l,u=A.contentProps,p=u===void 0?{}:u,g=A.infinite,m=g===void 0?!1:g,h=V.useContext(Ui),f=h.init,C=h.cleanupWindowEvents,b=V.useRef(null),q=V.useRef(null),x=V.useRef(null);return V.useEffect(function(){var v=b.current,w=q.current;return v!==null&&w!==null&&f&&(f==null||f(v,w)),function(){C==null||C()}},[]),V.useEffect(function(){if(m){var v=x.current;if(v){var w=function(){var E=h.state,I=E.positionX,k=E.positionY;v.style.backgroundPosition="".concat(I,"px ").concat(k,"px")};return w(),h.onChange(w)}}},[m,h]),c.jsxs("div",Ot({},d,{ref:b,className:"".concat(za.wrapperClass," ").concat(da.wrapper," ").concat(o),style:a},{children:[m&&c.jsx("div",{ref:x,className:da.infiniteGrid,"aria-hidden":!0}),c.jsx("div",Ot({},p,{ref:q,className:"".concat(za.contentClass," ").concat(da.content," ").concat(i),style:Ot(Ot({},s),{transform:Cf(h.state.positionX,h.state.positionY,h.state.scale)})},{children:e}))]}))};function AI(A,e){var t=Math.max(0,Math.min(A.x+A.width,e.x+e.width)-Math.max(A.x,e.x)),o=Math.max(0,Math.min(A.y+A.height,e.y+e.height)-Math.max(A.y,e.y));return t*o}function eI(A){var e=A.elementX,t=A.elementY,o=A.elementWidth,r=A.elementHeight,i=A.scale,a=A.positionX,s=A.positionY,l=A.viewportWidth,d=A.viewportHeight,u=A.margin,p=u===void 0?0:u,g=A.threshold,m=g===void 0?0:g,h={x:-p,y:-p,width:l+2*p,height:d+2*p},f={x:e*i+a,y:t*i+s,width:o*i,height:r*i};if(m<=0){var C=f.x<h.x+h.width&&f.x+f.width>h.x,b=f.y<h.y+h.height&&f.y+f.height>h.y;return C&&b}var q=f.width*f.height;if(q<=0)return!1;var x=AI(h,f);return x/q>=m}V.forwardRef(function(A,e){var t=A.x,o=A.y,r=A.width,i=A.height,a=A.margin,s=a===void 0?0:a,l=A.threshold,d=l===void 0?0:l,u=A.placeholder,p=u===void 0?null:u,g=A.onShow,m=A.onHide,h=A.children,f=A.className,C=A.style,b=V.useContext(Ui),q=V.useState(!1),x=q[0],v=q[1],w=V.useRef(!1),E=V.useRef(g),I=V.useRef(m);return E.current=g,I.current=m,V.useEffect(function(){var k=function(){var P,y,B=b.wrapperComponent;if(B){var O=eI({elementX:t,elementY:o,elementWidth:r,elementHeight:i,scale:b.state.scale,positionX:b.state.positionX,positionY:b.state.positionY,viewportWidth:B.offsetWidth,viewportHeight:B.offsetHeight,margin:s,threshold:d});O!==w.current&&(w.current=O,v(O),O?(P=E.current)===null||P===void 0||P.call(E):(y=I.current)===null||y===void 0||y.call(I))}};k();var T=b.onChange(k),M;return b.wrapperComponent||(M=b.onInit(function(){return k()})),function(){T(),M==null||M()}},[b,t,o,r,i,s,d]),x?c.jsx("div",Ot({ref:e,className:f,style:C},{children:h})):p?c.jsx(c.Fragment,{children:p}):null});const gd=({open:A,selectedImage:e,selectedIndex:t,imageCount:o,hasMultipleImages:r,showViewerCounter:i,canGoPrevious:a,canGoNext:s,labels:l,viewerPaperSx:d,viewerImageSx:u,onImageError:p,onClose:g,onPrevious:m,onNext:h})=>c.jsx(D.Dialog,{open:A,onClose:g,maxWidth:!1,disableScrollLock:!0,PaperProps:{sx:yt({width:"min(1120px, calc(100vw - 32px))",maxWidth:"none",overflow:"visible",backgroundColor:"transparent",boxShadow:"none"},d)},children:c.jsx(D.DialogContent,{sx:{position:"relative",padding:0,overflow:"visible",display:"grid",placeItems:"center"},children:c.jsxs(D.Box,{sx:{position:"relative",width:"100%"},children:[c.jsx(JB,{centerOnInit:!0,centerZoomedOut:!0,limitToBounds:!0,panning:{allowLeftClickPan:!0,velocityDisabled:!0},doubleClick:{mode:"reset"},children:c.jsx($B,{wrapperStyle:{width:"100%",maxHeight:"calc(100vh - 96px)",overflow:"hidden",borderRadius:Be,cursor:"grab"},contentStyle:{width:"100%",display:"flex",justifyContent:"center"},children:c.jsx(D.Box,{component:"img",src:e.src,alt:e.alt,draggable:!1,onError:p,sx:yt({display:"block",width:"100%",maxHeight:"calc(100vh - 96px)",objectFit:"contain",borderRadius:Be,backgroundColor:Ze[50]},u)})})},e.src),c.jsx(Wo,{icon:"close",label:l.close,onClick:g,sx:{top:RA,right:RA}}),r&&c.jsxs(c.Fragment,{children:[c.jsx(Wo,{icon:"chevron_left",label:l.previous,disabled:!a,onClick:m,sx:{left:De,top:"50%",transform:"translateY(-50%)"}}),c.jsx(Wo,{icon:"chevron_right",label:l.next,disabled:!s,onClick:h,sx:{right:De,top:"50%",transform:"translateY(-50%)"}})]}),i&&r&&c.jsx(Dn,{content:l.counter(t+1,o),sx:BD})]})})});var L2=(A=>(A.GALLERY="gallery",A.SUMMARY="summary",A))(L2||{});const Df=({images:A,variant:e=L2.GALLERY,activeIndex:t,initialIndex:o=0,mainAspectRatio:r="16 / 9",objectFit:i="cover",thumbnailObjectFit:a="cover",thumbnailSize:s=72,summaryMaxVisible:l=4,summaryThumbnailSize:d=Zn.extra_large.width,showThumbnails:u=!0,showPreviewNavigation:p=!0,showViewerCounter:g=!0,openOnMainClick:m=!0,loop:h=!0,fallbackSrc:f,activeColor:C=a0[500],borderRadius:b=Xt,emptyContent:q,labels:x,mainSx:v,mainImageSx:w,summarySx:E,summaryItemSx:I,summaryCountSx:k,thumbnailListSx:T,thumbnailSx:M,viewerPaperSx:P,viewerImageSx:y,onActiveIndexChange:B,onOpenViewer:O,onCloseViewer:R,sx:N,...L})=>{const[X,H]=V.useState(()=>Un(o,A.length)),[U,F]=V.useState(!1),W=V.useMemo(()=>ID(x),[x]),eA=V.useMemo(()=>A.map((oA,J)=>TD(oA,J,W)),[W,A]),_=eA.length,G=Un(t??X,_),z=eA[G],$=_>1,cA=e===L2.SUMMARY,nA=!cA&&$&&u;V.useEffect(()=>{H(oA=>Un(oA,_))},[_]);const Z=V.useCallback(oA=>{if(!f)return;const J=oA.currentTarget;J.dataset.galleryFallback!=="true"&&(J.dataset.galleryFallback="true",J.src=f)},[f]),AA=V.useCallback(oA=>{const J=Un(oA,_),sA=eA[J];sA&&(t==null&&H(J),B==null||B(J,sA))},[t,_,eA,B]),Y=$&&(h||G>0),lA=$&&(h||G<_-1),aA=V.useCallback(()=>{Y&&AA(id(G,-1,_,h))},[Y,AA,_,h,G]),rA=V.useCallback(()=>{lA&&AA(id(G,1,_,h))},[lA,AA,_,h,G]),tA=V.useCallback(()=>{!z||!m||(F(!0),O==null||O(G,z))},[O,m,z,G]),pA=V.useCallback(oA=>{if(!m)return;const J=Un(oA,_),sA=eA[J];sA&&(J!==G&&(t==null&&H(J),B==null||B(J,sA)),F(!0),O==null||O(J,sA))},[t,_,eA,B,O,m,G]),K=V.useCallback(()=>{F(!1),R==null||R()},[R]);return V.useEffect(()=>{if(!U||!$)return;const oA=J=>{J.key==="ArrowLeft"&&(J.preventDefault(),aA()),J.key==="ArrowRight"&&(J.preventDefault(),rA())};return window.addEventListener("keydown",oA),()=>window.removeEventListener("keydown",oA)},[rA,aA,$,U]),!_||!z?c.jsx(D.Box,{...L,sx:yt({width:"100%",minHeight:180,display:"grid",placeItems:"center",borderRadius:b,border:`1px solid ${de[300]}`,backgroundColor:pr[50]},N),children:q}):cA?c.jsxs(D.Box,{...L,sx:yt({width:"fit-content"},N),children:[c.jsx(jD,{images:eA,maxVisible:l,thumbnailSize:d,thumbnailObjectFit:a,labels:W,summarySx:E,summaryItemSx:I,summaryCountSx:k,onOpenIndex:pA,onImageError:Z}),c.jsx(gd,{open:U,selectedImage:z,selectedIndex:G,imageCount:_,hasMultipleImages:$,showViewerCounter:g,canGoPrevious:Y,canGoNext:lA,labels:W,viewerPaperSx:P,viewerImageSx:y,onImageError:Z,onClose:K,onPrevious:aA,onNext:rA})]}):c.jsxs(D.Box,{...L,sx:yt({width:"100%",overflow:"hidden",borderRadius:b,border:`1px solid ${de[300]}`,backgroundColor:Ze[50]},N),children:[c.jsx(kD,{selectedImage:z,hasMultipleImages:$,showPreviewNavigation:p,openOnMainClick:m,mainAspectRatio:r,objectFit:i,activeColor:C,canGoPrevious:Y,canGoNext:lA,labels:W,mainSx:v,mainImageSx:w,onImageError:Z,onOpenViewer:tA,onPrevious:aA,onNext:rA}),nA&&c.jsx(LD,{images:eA,selectedIndex:G,thumbnailSize:s,thumbnailObjectFit:a,activeColor:C,labels:W,thumbnailListSx:T,thumbnailSx:M,onSelectIndex:AA,onImageError:Z}),c.jsx(gd,{open:U,selectedImage:z,selectedIndex:G,imageCount:_,hasMultipleImages:$,showViewerCounter:g,canGoPrevious:Y,canGoNext:lA,labels:W,viewerPaperSx:P,viewerImageSx:y,onImageError:Z,onClose:K,onPrevious:aA,onNext:rA})]})},Pl=(A,e,t)=>Math.min(Math.max(A,e),t),Rl=A=>Math.max(fr,A-Xn-Mo),md=(A,e)=>A==="left"?Mo:Math.max(Mo,e-Xn-Mo),tI=(A,e)=>({side:A.x<e.width/2?"left":"right",top:Pl(A.y-Xn/2,fr,Rl(e.height))}),hd=A=>{const e=A.split("?")[0].split("#")[0].trim();return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e},nI=(A,e=[])=>{const t=hd(A);return e.some(o=>{const r=hd(o);if(r.includes("*")){const i=r.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replaceAll("\\*",".*");return new RegExp(`^${i}$`).test(t)}return t===r||t.startsWith(`${r}/`)})},oI=A=>{if(!A)return[];if(Array.isArray(A))return A;const e=[],t=A;return t.imageUrl&&e.push({id:`${t.itemNoCode}-image`,src:t.imageUrl,alt:`${t.itemNoCode} 3D`,title:"3D"}),t.renderImageUrl&&e.push({id:`${t.itemNoCode}-render`,src:t.renderImageUrl,alt:`${t.itemNoCode} Render`,title:"Render"}),e},rI=()=>{const[A,e]=V.useState("");return V.useEffect(()=>{if(typeof window>"u")return;const t=()=>e(window.location.pathname),o=()=>{window.setTimeout(()=>{window.dispatchEvent(new Event(r2))},0)},r=window.history.pushState,i=window.history.replaceState;return window.history.pushState=function(...s){const l=r.apply(this,s);return o(),l},window.history.replaceState=function(...s){const l=i.apply(this,s);return o(),l},t(),window.addEventListener("popstate",t),window.addEventListener(r2,t),()=>{window.history.pushState=r,window.history.replaceState=i,window.removeEventListener("popstate",t),window.removeEventListener(r2,t)}},[]),A},iI=()=>{const[A,e]=V.useState({width:0,height:0});return V.useEffect(()=>{if(typeof window>"u")return;const t=()=>e({width:window.innerWidth,height:window.innerHeight});return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]),A},aI=A=>{const[e,t]=V.useState({side:"right",top:160});return V.useEffect(()=>{A.height&&t(o=>({...o,top:Pl(o.top,fr,Rl(A.height))}))},[A.height]),{launcherPosition:e,setLauncherPosition:t}},sI=({label:A,position:e,viewportSize:t,onPositionChange:o,onOpen:r})=>{const i=Ye.useAnimationControls(),a=V.useRef(!1),s=Rl(t.height),l=md(e.side,t.width),d=Pl(e.top,fr,s);return V.useEffect(()=>{t.width&&i.start({x:l,y:d,transition:ga})},[i,d,l,t.width]),c.jsx(Er,{preset:!1,drag:!0,dragMomentum:!1,dragElastic:Qd,"aria-label":A,title:A,onDragStart:()=>{a.current=!0},onDragEnd:(u,p)=>{const g=tI(p.point,t);o(g),i.start({x:md(g.side,t.width),y:g.top,transition:ga}),window.setTimeout(()=>{a.current=!1},Ud)},initial:{x:l,y:d},animate:i,whileHover:{scale:1.05},whileTap:{scale:.96},onClick:()=>{a.current||r()},sx:{position:"fixed",left:0,top:0,width:Xn,height:Xn,zIndex:Nd,borderRadius:"50%",cursor:"grab",touchAction:"none",userSelect:"none",display:"grid",placeItems:"center",background:`linear-gradient(145deg, ${Kn[600]}, ${Kn[900]})`},children:c.jsx(D.Box,{sx:{width:fa,height:fa,borderRadius:"50%",display:"grid",placeItems:"center",backgroundColor:Hd,border:zd},children:c.jsx(vA,{icon:"image_search",fill:1,sx:{color:Ze[50],fontSize:Rd}})})})},lI=({defaultEmptyContent:A,displayLoading:e,galleryImages:t,galleryProps:o,loadingContent:r,open:i,panelTitle:a,searchContent:s,searchDebounceMs:l,searchLabel:d,searchName:u,searchPlaceholder:p,searchText:g,onClose:m,onSearchTextChange:h})=>c.jsx(ds,{open:i,onClose:m,label:a,maxWidth:!1,sx:{width:Fd,maxWidth:jd},sxContent:{maxHeight:Ld},nodeContent:c.jsxs(D.Stack,{gap:RA,children:[s,c.jsx(ef,{label:d,name:u,value:g,placeholder:p,disabled:e,debounceMs:l,onChange:f=>h(f.target.value??""),searchIcon:"search"}),c.jsx(Df,{...o,images:e&&!t.length?[]:t,emptyContent:e&&!t.length?r??c.jsx(qt,{}):A})]})}),cI=({images:A,isLoading:e=!1,searchLabel:t="Mã sản phẩm",searchPlaceholder:o="Nhập hoặc quét mã sản phẩm...",searchName:r="finishGoodItemNoCode",searchContent:i,searchDebounceMs:a=300,emptyContent:s,loadingContent:l,axiosProductManagement:d,blacklist:u,launcherLabel:p="Tra cứu hình ảnh sản phẩm",panelTitle:g="Hình ảnh thành phẩm",onSearch:m,textEmpty:h="Không có hình ảnh 3D/render",...f})=>{const C=s??c.jsx(po,{content:h}),[b,q]=V.useState(""),[x,v]=V.useState(),[w,E]=V.useState(!1),[I,k]=V.useState(!1),T=V.useRef(m),M=V.useRef(0),P=rI(),y=iI(),{launcherPosition:B,setLauncherPosition:O}=aI(y),R=d?x:A,N=e||w,L=V.useMemo(()=>oI(R),[R]),X=P?nI(P,u):!1;T.current=m,V.useEffect(()=>{X&&k(!1)},[X]);const H=async(F=b)=>{var _;const W=F.trim();if(hr(W))return;if(!d){(_=T.current)==null||_.call(T,W);return}const eA=M.current+1;M.current=eA;try{E(!0);const G=await Bd(d,W);if(M.current!==eA)return;v(G.data)}catch(G){if(M.current!==eA)return;v(void 0),console.error(G)}finally{M.current===eA&&E(!1)}},U=F=>{q(F),H(F)};return X||!y.width?null:c.jsxs(c.Fragment,{children:[!I&&c.jsx(sI,{label:p,position:B,viewportSize:y,onPositionChange:O,onOpen:()=>k(!0)}),c.jsx(lI,{defaultEmptyContent:C,displayLoading:N,galleryImages:L,loadingContent:l,open:I,panelTitle:g,galleryProps:f,searchContent:i,searchDebounceMs:a,searchLabel:t,searchName:r,searchPlaceholder:o,searchText:b,onClose:()=>k(!1),onSearchTextChange:U})]})},dI=({url:A,content:e,caption:t,sizeType:o=Kt.MEDIUM,sx:r,sxContent:i,sxCaption:a,alt:s="",userTitleName:l})=>c.jsxs(Ne,{alignItems:"center",sx:{...r,gap:RA},children:[c.jsx(rt,{alt:s,url:A,size:o}),c.jsx(af,{userTitleName:l,content:e,caption:t,sxContent:i,sxCaption:a})]}),Bf=({time:A,hasText:e})=>c.jsx(D.Typography,{variant:"caption",sx:{...Qe(1),color:"text.disabled"},children:(e?"Cập nhật lúc ":"")+iu(A)}),If=({time:A,content:e,height:t=Gd})=>c.jsxs(_A.Stack,{sx:{height:t,gap:0,justifyContent:"space-between",alignItems:"flex-start"},children:[c.jsx(Dn,{content:e}),c.jsx(Bf,{time:A})]}),uI=({url:A,content:e,time:t,sizeType:o=Kt.MEDIUM})=>c.jsxs(Ne,{alignItems:"center",children:[c.jsx(rt,{url:A,size:o}),c.jsx(If,{content:e,time:t})]}),pI=({loading:A,content:e,startIcon:t,endIcon:o,sx:r,permission:i,...a})=>i===!1?null:c.jsx(D.Button,{...a,startIcon:t&&!A&&c.jsx(B0,{url:t,sx:{width:U0.small,height:U0.small,borderRadius:ha,opacity:a.disabled?.6:1}}),endIcon:o&&!A&&c.jsx(B0,{url:o,sx:{width:U0.medium,height:U0.medium,borderRadius:ha,opacity:a.disabled?.6:1}}),sx:{textTransform:"none",borderRadius:Oe,minWidth:"unset","& > .MuiButton-endIcon":{margin:0},...r},children:A?c.jsx(qt,{size:"small",sx:{minHeight:"24.5px"}}):c.jsx(D.Typography,{sx:{transform:"translateY(0.5px)",whiteSpace:"nowrap"},children:e})}),Nl=({multiple:A=!1,onChange:e,accept:t="image/*",permission:o,loading:r=!1,...i})=>{if(o===!1)return null;const[a,s]=V.useState([]),l=V.useRef(null),d=u=>{if(u.target.files){const g=Array.from(u.target.files).map(m=>Object.assign(m,{preview:URL.createObjectURL(m)}));s(g),e(g)}};return V.useEffect(()=>()=>a==null?void 0:a.forEach(u=>{URL.revokeObjectURL(u.preview)}),[a]),c.jsxs(V.Fragment,{children:[c.jsx(D.Stack,{sx:{width:"fit-content",height:"fit-content"},children:c.jsx(cs,{...i,loading:r,icon:"attach_file",onClick:()=>l.current&&l.current.click()})}),c.jsx("input",{type:"file",accept:t,hidden:!0,multiple:A,ref:l,onChange:d})]})},fI=(...A)=>A.flatMap(e=>e?Array.isArray(e)?e:[e]:[]),gI={minWidth:100,textTransform:"none",borderRadius:Oe,width:"fit-content"},mI={...QA.textSm.regular,whiteSpace:"nowrap"},Ge=({content:A,loading:e=!1,startIcon:t,endIcon:o,variant:r="contained",sx:i,disabled:a=!1,...s})=>{const{palette:l}=D.useTheme();return c.jsx(D.Button,{...s,variant:r,startIcon:!e&&t?typeof t=="string"?c.jsx(vA,{icon:t,sx:{cursor:"pointer"}}):t:void 0,endIcon:!e&&o?typeof o=="string"?c.jsx(vA,{icon:o,sx:{cursor:"pointer"}}):o:void 0,sx:fI(gI,i),disabled:a,children:e?c.jsx(qt,{color:r==="contained"?l.primary.contrastText:s.color,size:"small",sx:{minHeight:"24.5px"}}):c.jsx(D.Typography,{sx:mI,children:A})})},Wa=({label:A,name:e,size:t="small",sx:o,...r})=>c.jsx(D.FormControlLabel,{sx:{marginRight:0},name:e,control:c.jsx(D.Checkbox,{size:t,...r,sx:{paddingTop:0,paddingBottom:0,paddingRight:RA,borderRadius:10,"&:hover":{backgroundColor:"unset"},...o}}),label:A}),hI=({open:A,anchorEl:e,title:t="Tùy chỉnh trường",items:o,onClose:r,onToggle:i})=>c.jsx(D.Popover,{open:A,anchorEl:e,onClose:r,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{mt:"8px",minWidth:320,maxHeight:520,borderRadius:s0,border:`1px solid ${de[200]}`,boxShadow:"0 1px 2px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.1)",overflow:"hidden"}}},children:c.jsxs(D.Box,{sx:{backgroundColor:Ze[50]},children:[c.jsxs(ve,{sx:{justifyContent:"space-between",padding:"12px 12px 10px 12px",borderBottom:`1px solid ${de[200]}`},children:[c.jsx(D.Typography,{sx:{...QA.textMd.semiBold},children:t}),c.jsx(D.IconButton,{onClick:r,sx:{padding:.5},children:c.jsx(vA,{icon:"close"})})]}),c.jsx(J0,{sx:{alignItems:"stretch",gap:.5,padding:"10px 8px",maxHeight:460,overflowY:"auto"},children:o.map(a=>c.jsxs(ve,{sx:{justifyContent:"space-between",gap:1,padding:"8px 8px",borderRadius:Oe,opacity:a.disabled?.6:1},children:[c.jsxs(ve,{sx:{gap:1,minWidth:0},children:[c.jsx(vA,{icon:"drag_indicator",sx:{color:de[400]}}),c.jsx(D.Typography,{sx:{...QA.textSm.regular,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a.label})]}),c.jsx(D.Checkbox,{checked:a.checked,disabled:a.disabled,onChange:s=>i(a.key,s.target.checked),sx:{padding:0}})]},a.key))})]})}),CI=({headerAction:A,children:e,isCollapsible:t=!0,title:o,description:r,defaultExpanded:i=!0,sx:a,titleSx:s})=>{const[l,d]=V.useState(i),u=!!o&&t;return c.jsxs(D.Stack,{sx:{bgcolor:Ze[50],borderRadius:Oe,overflow:"hidden",gap:RA,boxShadow:2,p:De,...a},children:[o&&c.jsxs(it,{onClick:()=>d(p=>!p),sx:{"&:hover":{cursor:"pointer"}},children:[c.jsxs(Ne,{gap:RA,children:[c.jsx(Dn,{content:o,sx:{...QA.textMd.semiBold,color:a0[500],...s}}),r]}),c.jsxs(ve,{gap:0,children:[A,u&&c.jsx(cs,{icon:l?"expand_less":"expand_more"})]})]}),c.jsx(D.Collapse,{in:!u||l,unmountOnExit:u,children:c.jsx(D.Stack,{sx:{gap:RA},children:e})})]})},bI=({orientation:A="horizontal",color:e=te.gray2,thickness:t=1,length:o="100%",sx:r,dashed:i=!0})=>A==="vertical"?c.jsx(_A.Box,{sx:{height:o,display:"flex",justifyContent:"center",alignSelf:"center","&::before":{content:'""',width:`${t}px`,height:"100%",borderLeft:`${t}px ${i?"dashed":"solid"} ${e}`,...r}}}):c.jsx(_A.Box,{sx:{borderBottom:`${t}px ${i?"dashed":"solid"} ${e}`,width:typeof o=="number"?`${o}px`:o,alignSelf:"stretch",display:"block",...r}}),Tf="180px",Ga="140px",Of="250px";var A0=(A=>(A.Equals="Equals",A.NotEquals="NotEquals",A.Contains="Contains",A.NotContains="NotContains",A.IsNull="IsNull",A.IsNotNull="IsNotNull",A.GreaterThan="GreaterThan",A.LessThan="LessThan",A.GreaterThanOrEqual="GreaterThanOrEqual",A.LessThanOrEqual="LessThanOrEqual",A))(A0||{}),ye=(A=>(A.EXACT="EXACT",A.DATE_RANGE="DATE_RANGE",A.TODAY="TODAY",A.TOMORROW="TOMORROW",A.YESTERDAY="YESTERDAY",A.THIS_WEEK="THIS_WEEK",A.LAST_WEEK="LAST_WEEK",A.THIS_MONTH="THIS_MONTH",A.LAST_MONTH="LAST_MONTH",A.LAST_7_DAYS="LAST_7_DAYS",A.NEXT_7_DAYS="NEXT_7_DAYS",A.LAST_30_DAYS="LAST_30_DAYS",A.NEXT_30_DAYS="NEXT_30_DAYS",A))(ye||{});const kf=[{label:"Là",value:"Equals"},{label:"Không là",value:"NotEquals"},{label:"Chứa",value:"Contains"},{label:"Không chứa",value:"NotContains"},{label:"Lớn hơn",value:"GreaterThan"},{label:"Lớn hơn hoặc bằng",value:"GreaterThanOrEqual"},{label:"Nhỏ hơn",value:"LessThan"},{label:"Nhỏ hơn hoặc bằng",value:"LessThanOrEqual"},{label:"Trống",value:"IsNull"},{label:"Không trống",value:"IsNotNull"}],Mf=[{label:"Là",value:"Equals"},{label:"Không là",value:"NotEquals"},{label:"Chứa",value:"Contains"},{label:"Không chứa",value:"NotContains"},{label:"Trống",value:"IsNull"},{label:"Không trống",value:"IsNotNull"}],Pf=[{label:"Là",value:"Equals"},{label:"Trống",value:"IsNull"},{label:"Không trống",value:"IsNotNull"}],Rf=[{label:"ngày chính xác",value:"EXACT"},{label:"khoảng ngày",value:"DATE_RANGE"},{label:"hôm nay",value:"TODAY"},{label:"ngày mai",value:"TOMORROW"},{label:"hôm qua",value:"YESTERDAY"},{label:"tuần này",value:"THIS_WEEK"},{label:"tuần trước",value:"LAST_WEEK"},{label:"tháng này",value:"THIS_MONTH"},{label:"tháng trước",value:"LAST_MONTH"},{label:"trong 7 ngày qua",value:"LAST_7_DAYS"},{label:"trong 7 ngày tiếp theo",value:"NEXT_7_DAYS"},{label:"trong 30 ngày qua",value:"LAST_30_DAYS"},{label:"trong 30 ngày tiếp theo",value:"NEXT_30_DAYS"}],S0=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2,9),Nf=A=>{if(!A)return{};const e=DA().startOf("day"),t=A.split("|"),o=t[0];let r=e,i=e;if(o===ye.EXACT){const a=t[1];if(a){const s=DA(a).startOf("day"),l=DA(a).endOf("day");return{fromDate:s.unix(),toDate:l.unix()}}return{}}if(o===ye.DATE_RANGE){const a=t[1],s=t[2],l=a?DA(a).startOf("day").unix():void 0,d=s?DA(s).endOf("day").unix():void 0;return{fromDate:l,toDate:d}}switch(o){case ye.TODAY:r=e.startOf("day"),i=e.endOf("day");break;case ye.TOMORROW:r=e.add(1,"day").startOf("day"),i=e.add(1,"day").endOf("day");break;case ye.YESTERDAY:r=e.subtract(1,"day").startOf("day"),i=e.subtract(1,"day").endOf("day");break;case ye.THIS_WEEK:{const a=(7+(e.day()-1))%7;r=e.subtract(a,"day"),i=r.add(6,"day").endOf("day");break}case ye.LAST_WEEK:{const a=(7+(e.day()-1))%7;r=e.subtract(a,"day").subtract(7,"day"),i=r.add(6,"day").endOf("day");break}case ye.THIS_MONTH:r=e.startOf("month"),i=e.endOf("month");break;case ye.LAST_MONTH:r=e.subtract(1,"month").startOf("month"),i=e.subtract(1,"month").endOf("month");break;case ye.LAST_7_DAYS:r=e.subtract(7,"day"),i=e.endOf("day");break;case ye.NEXT_7_DAYS:r=e,i=e.add(7,"day").endOf("day");break;case ye.LAST_30_DAYS:r=e.subtract(30,"day"),i=e.endOf("day");break;case ye.NEXT_30_DAYS:r=e,i=e.add(30,"day").endOf("day");break;default:return{}}return{fromDate:r.unix(),toDate:i.unix()}},yI=A=>A.reduce((e,t)=>(e[t.key]=t.defaultValue,e),{}),Cd=(A,e)=>{const t=A.filter(r=>((e==null?void 0:e[r.key])??r.defaultValue)!==r.defaultValue).map(r=>({id:S0(),fieldKey:r.key,value:(e==null?void 0:e[r.key])??r.defaultValue}));if(t.length>0)return t;const o=A[0];return o?[{id:S0(),fieldKey:o.key,value:(e==null?void 0:e[o.key])??o.defaultValue}]:[]},vI=({open:A,title:e="Tùy chỉnh bộ lọc",fields:t,value:o,anchorEl:r,offset:i,onClose:a,onApply:s})=>{const l=V.useMemo(()=>yI(t),[t]),d=V.useMemo(()=>t.map(v=>({label:v.label,value:v.key})),[t]),[u,p]=V.useState(()=>Cd(t,o)),[g,m]=V.useState(null);V.useEffect(()=>{A&&(p(Cd(t,o)),m(null))},[t,A,o]);const h=()=>{const v=t[0];if(!v){p([]);return}p([{id:S0(),fieldKey:v.key,value:v.defaultValue}])},f=v=>{p(w=>{const E=w.filter((k,T)=>T!==v);if(E.length>0)return E;const I=t[0];return I?[{id:S0(),fieldKey:I.key,value:I.defaultValue}]:[]})},C=()=>{p(v=>{const w=new Set(v.map(I=>I.fieldKey)),E=t.find(I=>!w.has(I.key));return E?[...v,{id:S0(),fieldKey:E.key,value:E.defaultValue}]:v})},b=v=>{g===null||v===g||(p(w=>{const E=[...w],[I]=E.splice(g,1);return E.splice(v,0,I),E}),m(null))},q=()=>{const v={...l};u.forEach(w=>{w.fieldKey&&(v[w.fieldKey]=w.value)}),s(v),a()},x=u.length<t.length;return c.jsx(D.Popover,{open:A,anchorEl:r,onClose:a,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{mt:`${(i==null?void 0:i.y)??8}px`,ml:`${(i==null?void 0:i.x)??0}px`,minWidth:320,maxWidth:"calc(100vw - 48px)",borderRadius:s0,border:`1px solid ${de[300]}`,boxShadow:"0 8px 24px rgba(15, 23, 42, 0.12)",overflow:"hidden"}}},children:c.jsx(D.Box,{sx:{backgroundColor:Ze[50],padding:2},children:c.jsxs(J0,{sx:{alignItems:"stretch",gap:2},children:[c.jsxs(it,{sx:{gap:1},children:[c.jsx(D.Typography,{sx:{...QA.textMd.semiBold},children:e}),c.jsx(D.IconButton,{onClick:a,sx:{padding:vt},children:c.jsx(vA,{icon:"close"})})]}),c.jsx(J0,{sx:{alignItems:"stretch",gap:1.25},children:u.map((v,w)=>{const E=t.find(T=>T.key===v.fieldKey);if(!E)return null;const I=new Set(u.map(T=>T.fieldKey)),k=d.filter(T=>T.value===v.fieldKey||!I.has(T.value));return c.jsxs(ve,{onDragOver:T=>T.preventDefault(),onDrop:()=>b(w),sx:{gap:1,alignItems:"flex-end"},children:[c.jsx(D.Box,{draggable:!0,onDragStart:()=>m(w),onDragEnd:()=>m(null),sx:{paddingBottom:"10px",cursor:"grab"},children:c.jsx(vA,{icon:"drag_indicator",sx:{color:de[500]}})}),c.jsx(D.Box,{sx:{flex:1,minWidth:220},children:c.jsx(w0,{label:"",value:v.fieldKey,options:k,placeholder:"",onChange:T=>{const M=T.target.value,P=t.find(y=>y.key===M);P&&p(y=>y.map((B,O)=>O===w?{...B,fieldKey:M,value:P.defaultValue}:B))}})}),c.jsx(D.Box,{sx:{flex:1,minWidth:220},children:c.jsx(w0,{label:"",value:v.value??E.defaultValue,options:E.options,placeholder:"Tất cả",onChange:T=>{const M=T.target.value;p(P=>P.map((y,B)=>B===w?{...y,value:M}:y))}})}),c.jsx(D.IconButton,{onClick:()=>f(w),children:c.jsx(vA,{icon:"delete_outline"})})]},v.id)})}),x&&c.jsx(Ge,{content:"Thêm điều kiện",onClick:C,startIcon:"add",variant:"text",sx:{color:a0[500],minWidth:0,paddingX:0}}),c.jsxs(it,{sx:{marginTop:1},children:[c.jsx(Ge,{content:"Mặc định",onClick:h,variant:"text",sx:{color:a0[500],minWidth:0,paddingX:0}}),c.jsxs(ve,{sx:{gap:1},children:[c.jsx(Ge,{onClick:a,variant:"outlined",content:"Hủy"}),c.jsx(Ge,{onClick:q,variant:"contained",content:"Áp dụng"})]})]})]})})})},xI=({field:A,rowValue:e,onChange:t})=>{switch(A.type){case"select":return c.jsx(w0,{label:"",value:e??A.defaultValue,options:A.options||[],placeholder:"Tất cả",onChange:o=>t(o.target.value)});case"date":{const o=e?e.split("|"):"",r=o[0],i=r===ye.EXACT?o[1]:"",a=r===ye.DATE_RANGE?o[1]:"",s=r===ye.DATE_RANGE?o[2]:"",l=r===ye.EXACT||r===ye.DATE_RANGE;return c.jsxs(D.Box,{sx:{display:"flex",gap:RA,width:"100%"},children:[c.jsx(D.Box,{sx:{width:l?"140px":"100%",flexShrink:0},children:c.jsx(w0,{label:"",value:r,options:Rf,placeholder:"",onChange:d=>{const u=d.target.value;let p=u;u===ye.EXACT&&(p=`${ye.EXACT}|`),u===ye.DATE_RANGE&&(p=`${ye.DATE_RANGE}||`),t(p)}})}),r===ye.EXACT&&c.jsx(D.Box,{sx:{flex:1},children:c.jsx(Af,{name:`exact-date-${S0()}`,label:"",value:i||null,onChange:d=>{const u=d.target.value,p=u?DA(u).format("YYYY-MM-DD"):"";t(`${ye.EXACT}|${p}`)}})}),r===ye.DATE_RANGE&&c.jsx(D.Box,{sx:{flex:1},children:c.jsx(Lp,{format:"DD/MM/YYYY",placeholder:"Ngày bắt đầu — Ngày kết thúc",label:"",fromDate:a,toDate:s,onFromDateChange:d=>{const u=d?DA(d).format("YYYY-MM-DD"):"";t(`${ye.DATE_RANGE}|${u}|${s}`)},onToDateChange:d=>{const u=d?DA(d).format("YYYY-MM-DD"):"";t(`${ye.DATE_RANGE}|${a}|${u}`)}})})]})}}},qI=({open:A,title:e="Tùy chỉnh bộ lọc nâng cao",fields:t,value:o,operatorOptions:r=Mf,fullOperator:i=!1,anchorEl:a,offset:s,onClose:l,onApply:d})=>{const[u,p]=V.useState([]),[g,m]=V.useState(null);V.useEffect(()=>{A&&(o&&o.length>0?p(o.map(E=>({id:S0(),fieldKey:E.field,operator:E.operator,value:E.value}))):p([]),m(null))},[A,o]);const h=(E,I)=>{p(k=>k.map((T,M)=>M===E?{...T,...I}:T))},f=()=>p([]),C=E=>p(I=>I.filter((k,T)=>T!==E)),b=()=>{p(E=>{if(E.length>=t.length)return E;const I=new Set(E.map(T=>T.fieldKey)),k=t.find(T=>!I.has(T.key))||t[0];return k?[...E,{id:S0(),fieldKey:k.key,operator:A0.Equals,value:k.defaultValue}]:E})},q=E=>{g===null||E===g||(p(I=>{const k=[...I],[T]=k.splice(g,1);return k.splice(E,0,T),k}),m(null))},x=()=>{const E=u.filter(I=>I.fieldKey).map(I=>{const k=t.find(y=>y.key===I.fieldKey);let T,M;if((k==null?void 0:k.type)==="date"&&I.operator!==A0.IsNull&&I.operator!==A0.IsNotNull){const y=Nf(I.value);T=y.fromDate,M=y.toDate}return{field:I.fieldKey,operator:I.operator,value:I.operator===A0.IsNull||I.operator===A0.IsNotNull?"":I.value,fromDate:T,toDate:M}});d(E),l()},v=t.map(E=>({label:E.label,value:E.key})),w=u.map(E=>E.fieldKey);return c.jsx(D.Popover,{open:A,anchorEl:a,onClose:l,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{mt:`${(s==null?void 0:s.y)??8}px`,ml:`${(s==null?void 0:s.x)??0}px`,width:"max-content",minWidth:"800px",maxWidth:"calc(100vw - 48px)",boxShadow:4,overflow:"hidden"}}},children:c.jsx(_A.Stack,{sx:{backgroundColor:de[50],padding:Yd},children:c.jsxs(_A.Stack,{children:[c.jsxs(it,{children:[c.jsx(D.Typography,{sx:{...QA.textMd.semiBold},children:e}),c.jsx(D.IconButton,{onClick:l,sx:{padding:vt},children:c.jsx(vA,{icon:"close"})})]}),c.jsxs(_A.Stack,{children:[u.length===0&&c.jsx(D.Typography,{sx:{color:de[400],fontStyle:"italic"},children:"Chưa có điều kiện lọc nào được áp dụng."}),u.map((E,I)=>{const k=t.find(B=>B.key===E.fieldKey);if(!k)return null;const T=k.type==="date";i&&(r=kf);const M=T?Pf:r,P=E.operator===A0.IsNull||E.operator===A0.IsNotNull,y=v.filter(B=>!w.includes(B.value)||B.value===E.fieldKey);return c.jsxs(ve,{onDragOver:B=>B.preventDefault(),onDrop:()=>q(I),sx:{gap:RA},children:[c.jsx(_A.Stack,{draggable:!0,onDragStart:()=>m(I),onDragEnd:()=>m(null),sx:{cursor:"grab"},children:c.jsx(vA,{icon:"drag_indicator",sx:{color:de[400]}})}),c.jsx(_A.Stack,{sx:{width:Tf},children:c.jsx(w0,{label:"",value:E.fieldKey,options:y,placeholder:"",onChange:B=>{const O=B.target.value,R=t.find(N=>N.key===O);R&&h(I,{fieldKey:O,value:R.defaultValue,operator:A0.Equals})}})}),c.jsx(_A.Stack,{sx:{width:Ga},children:c.jsx(w0,{label:"",value:E.operator,options:M,placeholder:"",onChange:B=>{const O=B.target.value,R=E.value;h(I,{operator:O,value:R})},sx:{width:Ga}})}),c.jsx(_A.Stack,{sx:{flex:1,minWidth:Of},children:P?c.jsx(w0,{label:"",value:"",options:[],placeholder:"---",disabled:!0}):c.jsx(xI,{field:k,rowValue:E.value,onChange:B=>h(I,{value:B})})}),c.jsx(D.IconButton,{onClick:()=>C(I),children:c.jsx(vA,{icon:"delete_outline"})})]},E.id)})]}),u.length<t.length&&c.jsx(Ge,{content:"Thêm điều kiện",onClick:b,startIcon:"add",variant:"text"}),c.jsxs(it,{sx:{marginTop:Ka},children:[c.jsx(_A.Stack,{onClick:f,sx:{cursor:"pointer",color:a0[500]},children:"Mặc định"}),c.jsxs(ve,{sx:{gap:1},children:[c.jsx(Ge,{onClick:l,variant:"outlined",content:"Hủy",sx:{borderRadius:Oe}}),c.jsx(Ge,{onClick:x,variant:"contained",content:"Áp dụng",sx:{borderRadius:Oe}})]})]})]})})})},wI=({children:A,onApply:e,onReset:t,initialFilters:o={},sx:r={},ignoredKeysInCount:i=[]})=>{const[a,s]=V.useState(!1),[l,d]=V.useState(o),[u,p]=V.useState(o),g=Object.entries(l).filter(([C,b])=>i.includes(C)?!1:Array.isArray(b)?b.length>0:b!=null&&b!=="").length;V.useEffect(()=>{a&&p({...l})},[l,a]);const m=(C,b)=>{p(q=>({...q,[C]:b}))},h=()=>{d(u),e==null||e(u),s(!1)},f=()=>{p({}),d({}),t==null||t(),s(!1)};return c.jsxs(V.Fragment,{children:[c.jsx(Ge,{sx:{...r,color:(g>0,a0[500]),minWidth:"auto",p:Po},startIcon:"filter_list_alt",variant:"outlined",onClick:()=>s(!0),content:`Bộ lọc${g>0?` (${g})`:""}`}),c.jsx(D.Drawer,{anchor:"right",open:a,onClose:()=>s(!1),sx:{"& .MuiDrawer-paper":{width:320,padding:De}},children:c.jsxs(_A.Stack,{sx:{height:"100%"},children:[c.jsxs(it,{sx:{gap:0},children:[c.jsx(Dn,{content:"Bộ lọc",sx:{...QA.textLg.semiBold}}),c.jsx(D.IconButton,{onClick:()=>s(!1),children:c.jsx(vA,{icon:"close"})})]}),c.jsx(_A.Stack,{sx:{flex:1,gap:RA,overflowY:"auto",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:A({filters:l,tempFilters:u,setFilter:m,setTempFilters:p})}),c.jsxs(Bu,{sx:{gap:RA},children:[c.jsx(Ge,{variant:"outlined",onClick:f,content:"Đặt lại"}),c.jsx(Ge,{variant:"contained",onClick:h,content:"Cập nhật"})]})]})})]})},Ff=({titleNode:A,list:e,sxList:t={},sxListItem:o={},sxIconContent:r={},sxTitleNode:i={}})=>{const{palette:a}=D.useTheme();return c.jsxs(D.List,{sx:{display:"flex",flexDirection:"column",padding:0,...t},children:[A&&c.jsx(D.ListItem,{sx:{padding:RA,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"8px","&:hover":{cursor:"default",backgroundColor:"unset",color:"unset"},...i},children:A}),e.map(s=>c.jsx(D.ListItem,{onClick:s.onClick,sx:{borderRadius:Be,padding:RA,transition:ht,"&:hover":{cursor:"pointer",backgroundColor:a.action.hover},...o},children:c.jsx(c0,{content:s.content,icon:s.icon,sx:r})},s.content))]})},SI=({total:A=0,page:e=ma.page,take:t=ma.take,openRowsPerPage:o=!0,onChange:r,sx:i={}})=>{const a=Math.ceil(A/t),s=[10,20,30,50],l=s.includes(Number(t))?Number(t):10,{palette:d}=D.useTheme(),u=g=>{const m=Number(g.target.value);r({page:1,take:m})},p=(g,m)=>{r({page:m,take:t})};return c.jsxs(ve,{gap:.5,sx:{ml:"auto",...i},children:[c.jsx(D.Pagination,{count:a,page:e,showFirstButton:!0,showLastButton:!0,onChange:p,size:"medium",variant:"outlined",shape:"rounded",sx:{"& .MuiPagination-ul":{gap:.5},"& .MuiPaginationItem-root":{borderRadius:Oe,m:0},"& .MuiPaginationItem-root.Mui-disabled":{opacity:.5,pointerEvents:"none"},"& .MuiPaginationItem-root.Mui-selected":{background:d.primary.main,color:"white"}}}),o&&c.jsx(ve,{children:c.jsx(D.FormControl,{size:"small",children:c.jsx(w0,{value:l,onChange:g=>u(g),options:s.map(g=>({value:g,label:`${g} / trang`})),sx:{"& .MuiOutlinedInput-root":{borderRadius:"0px !important"}}})})})]})},EI=({name:A,direction:e="row",label:t,disabled:o,iconLabel:r="event_list",defaultValue:i,value:a,onChange:s,children:l,required:d=!1,sx:u={}})=>{const p=g=>{s&&s({target:{name:A,value:g.target.value||void 0}})};return c.jsxs(D.FormControl,{disabled:o,sx:{gap:RA},onChange:p,children:[t&&c.jsx(D.InputLabel,{shrink:!0,required:d,sx:{transform:"translate(0px , -9px) scale(0.75)",zIndex:2,display:"flex"},children:c.jsxs(Mu,{children:[c.jsx(vA,{icon:r,sx:{fontSize:Za.FONT_SIZE_LABEL}}),t]})}),c.jsx(D.RadioGroup,{name:A,defaultValue:i,value:a,sx:{flexDirection:e,paddingTop:t?"calc(8.5px + 1.5px)":0,gap:De,...u},children:l})]})},DI=({name:A,label:e,...t})=>c.jsx(D.FormControlLabel,{name:A,label:e,sx:{alignItems:"center",mr:0},control:c.jsx(D.Radio,{...t,sx:{paddingTop:0,paddingBottom:0,paddingRight:RA,marginLeft:"2px","&:hover":{backgroundColor:"unset"},"& .MuiSvgIcon-root":{fontSize:"18px"}}})}),BI=({label:A,value:e,children:t,sx:o,textTransform:r="uppercase"})=>{const{palette:i}=D.useTheme();return c.jsxs(ve,{sx:{gap:1,...o},children:[c.jsx(D.Typography,{variant:"subtitle2",sx:{...QA.textMd.semiBold,textTransform:r,color:i.primary.main},children:A||t}),e!==void 0&&c.jsx(D.Typography,{variant:"subtitle2",sx:{...QA.textMd.semiBold,textTransform:r,color:i.primary.main},children:e})]})},jf=({name:A,value:e=!1,onChange:t})=>{const{palette:o}=D.useTheme(),r=()=>{t&&t({target:{name:A,value:!e}})};return c.jsx(Ye.MotionConfig,{transition:{duration:.2,ease:"easeOut"},children:c.jsx(Ye.motion.div,{className:"switch",initial:!1,animate:{backgroundColor:e?o.primary.main:o.text.disabled},onClick:r,style:{display:"flex",justifyContent:e?"flex-end":"flex-start",alignItems:"center",width:"30px",height:"14px",padding:"3px",borderRadius:"10px",boxSizing:"content-box",cursor:"pointer"},children:c.jsx(Ye.motion.div,{layout:!0,className:"handle",style:{background:"#fdfdfd",aspectRatio:1,height:"100%",borderRadius:"50%"}})})})},II=({name:A,content:e,value:t=!1,onChange:o,sx:r={}})=>c.jsxs(ve,{sx:{gap:RA,...r},children:[c.jsx(D.Typography,{children:e}),c.jsx(jf,{name:A,value:t,onChange:o})]});var Fl=(A=>(A.DISABLED_GET_ROW_MENU="DISABLED_GET_ROW_MENU",A.HISTORY_GET_ROW_MENU="HISTORY_GET_ROW_MENU",A.INFO="INFO",A.COPY="COPY",A.DELETE="DELETE",A.UPDATE="UPDATE",A.SELECT="SELECT",A.COLLAPSE="COLLAPSE",A.DISABLED_ALL_ACTIONS="DISABLED_ALL_ACTIONS",A.DISABLED_ROW="DISABLED_ROW",A.DISABLED_CHECKBOX="DISABLED_CHECKBOX",A))(Fl||{}),co=(A=>(A.TOTAL="TOTAL",A.TOTAL_INCOME="TOTAL_INCOME",A))(co||{});const Cn=`1px solid ${te.gray8}`,cr=Object.keys(Fl).reduce((A,e)=>(A[e]=!1,A),{}),Lf=A=>A?Array.isArray(A)?[...A]:[A]:[],qn=(...A)=>A.flatMap(e=>Lf(e)),Qf=(A,e,t)=>qn({width:`${A.width}px !important`,minWidth:`${A.width}px !important`,maxWidth:`${A.width}px !important`,padding:RA,borderRadius:"0 !important",color:t?e.divider:"none",...A.stickyCss?{position:"sticky",backgroundColor:e.background.default,...A.stickyCss}:{}},A.sx,A.cellSx),Uf=(A,e,t,o,r)=>({cursor:A?"pointer":"default","&:hover .MuiTableCell-root":{backgroundColor:"inherit !important"},...o[t]?o[t]:{},...r===t?{background:`linear-gradient(270deg, ${e.primary.light+r0[90]}, ${e.action.hover}, ${e.background.paper})`,backgroundSize:"600% 600%",animation:"loading-gradient-row-table 1.5s ease infinite"}:{}});function TI({columns:A,row:e,indexRow:t,indexLoadingRow:o,rowSx:r={},getRowId:i,onClickRow:a,onDisabled:s,onClickSelectRow:l=!1,onSelectRowById:d,enableTree:u=!1,rowLevels:p={}}){const{palette:g}=D.useTheme(),m=i(e),h=s?s(e,t):{...cr},f=V.useCallback((q,x)=>{const v=x||"";return c.jsxs(it,{sx:{color:Kn[950]},children:[q,c.jsx(vA,{icon:"content_copy",sx:{color:Kn[950],fontSize:U0.medium},onClick:w=>{w.stopPropagation(),v&&navigator.clipboard.writeText(v)}})]})},[]),C=!!(l&&d),b=!!(a||C);return c.jsx(D.Fade,{in:!0,timeout:t*120,children:c.jsx(D.TableRow,{hover:!0,tabIndex:-1,onClick:()=>{a==null||a(e,t),C&&(d==null||d(m))},sx:{...Uf(b,g,t,r,o),...m===co.TOTAL?{backgroundColor:te.green2,"& .MuiTableCell-root":{backgroundColor:te.green2},"& *":{fontWeight:"bold"}}:{},...m===co.TOTAL_INCOME?{backgroundColor:te.gray7,"& .MuiTableCell-root":{backgroundColor:te.gray7},"& *":{fontWeight:"bold"}}:{}},children:A.map((q,x)=>{const v=u?p[m]??0:0,w=u?A.findIndex(I=>I.id!=="treeToggle"):-1,E=u&&x===w&&q.id!=="treeToggle";return c.jsx(D.TableCell,{align:q.align,sx:qn(Qf(q,g,h.DISABLED_ROW),E?{pl:I=>`calc(${I.spacing(1)} + ${v*16}px)`}:void 0),onClick:q.id==="actions"||q.id==="selectCheckbox"?I=>{I.stopPropagation()}:void 0,children:(()=>{const I=e[q.id],k=U2(q.render?q.render(e,t):I);if(!q.copyable)return k;const T=typeof q.copyable=="object"&&q.copyable.getValue?String(q.copyable.getValue(e,t)||""):String(I||"");return f(k,T)})()},q.id)})})})}const OI={visibleRows:[],rowLevels:{},hasChildrenById:{}},kI=({rows:A,enableTree:e,expandedRowIds:t,getRowId:o,getChildren:r})=>{if(!e)return{...OI,visibleRows:A};const i={},a={},s=[],l=(d,u)=>{d.forEach(p=>{const g=o(p),m=r(p);i[g]=u,a[g]=m.length>0,s.push(p),m.length>0&&t.has(g)&&l(m,u+1)})};return l(A,0),{visibleRows:s,rowLevels:i,hasChildrenById:a}},MI=({row:A,getRowId:e,rowLevels:t,hasChildrenById:o,expandedRowIds:r,onToggle:i,palette:a})=>{const s=e(A),l=t[s]??0,d=o[s],u=r.has(s),p=16,g=Math.max(l*p+14,14),m=l*p+7;return c.jsxs(D.Box,{sx:{display:"flex",alignItems:"stretch",cursor:d?"pointer":"default",minHeight:"100%"},onClick:h=>{d&&(h.stopPropagation(),i(s))},children:[c.jsx(D.Box,{sx:{position:"relative",width:g,flexShrink:0,alignSelf:"stretch",minHeight:"100%"},children:l>0&&c.jsxs(c.Fragment,{children:[c.jsx(D.Box,{sx:{position:"absolute",left:`${m}px`,top:"-1px",bottom:"50%",borderLeft:`1px solid ${a.divider}`}}),c.jsx(D.Box,{sx:{position:"absolute",left:`${m}px`,top:"50%",width:`${p/2}px`,borderBottom:`1px solid ${a.divider}`,transform:"translateY(-50%)"}})]})}),c.jsx(D.Box,{sx:{display:"flex",alignItems:"center",minHeight:"100%"},children:d?c.jsx(vA,{icon:u?"expand_more":"chevron_right"}):c.jsx(D.Box,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:a.text.disabled}})})]})},PI=({children:A})=>c.jsx(D.Box,{sx:{overflowY:"auto",flex:1},children:c.jsx(D.TableContainer,{sx:{maxHeight:"100%",overflow:"auto"},children:A})}),bd=44,n2=(A,e)=>({id:A.id,label:A.label,width:A.width,align:A.align,alignHead:A.alignHead,sx:qn(A.sx,A.headSx),stickyCss:A.stickyCss,rowSpan:e});function RI({columns:A,headerGroups:e}){const{palette:t}=D.useTheme(),o=V.useMemo(()=>{var d;if(!(e!=null&&e.length))return[A.map(u=>n2(u))];const i=new Map;e.forEach(u=>{u.columnIds.forEach(p=>{i.set(p,u)})});const a=[],s=[];let l=0;for(;l<A.length;){const u=A[l],p=i.get(u.id);if(!p){a.push(n2(u,2)),l+=1;continue}let g=1;for(;l+g<A.length&&((d=i.get(A[l+g].id))==null?void 0:d.id)===p.id;)g+=1;a.push({id:`${p.id}-${l}`,label:p.label,alignHead:p.align??"center",sx:p.sx,colSpan:g});for(let m=0;m<g;m+=1)s.push(n2(A[l+m]));l+=g}return s.length?[a,s]:[A.map(u=>n2(u))]},[A,e]),r=o.length>1;return c.jsx(D.TableHead,{children:o.map((i,a)=>c.jsx(D.TableRow,{children:i.map(s=>{var l;return c.jsx(D.TableCell,{align:s.align,colSpan:s.colSpan,rowSpan:s.rowSpan,sx:qn({...s.width!=null?{width:`${s.width}px !important`,minWidth:`${s.width}px !important`,maxWidth:`${s.width}px !important`}:{},height:r?bd:void 0,fontWeight:550,padding:RA,borderRadius:"0 !important",backgroundColor:"#F9FAFB",verticalAlign:r&&s.rowSpan?"middle":"top",textAlign:s.alignHead?s.alignHead:"center",borderTop:a===0?Cn:"none",top:r?a*bd:0},s.stickyCss?{...s.stickyCss,position:"sticky",backgroundColor:t.background.paper,zIndex:4,borderRight:((l=s.stickyCss)==null?void 0:l.left)!=null?Cn:""}:{},s.sx),children:c.jsx(D.Typography,{variant:"subtitle1",children:s.label})},s.id)})},a))})}const NI=({columns:A,headerGroups:e,rows:t=[],loading:o=!1,stickyHeader:r=!0,tableSx:i,tableRef:a,renderRow:s,renderLoading:l,renderEmpty:d})=>c.jsx(PI,{children:c.jsxs(D.Table,{ref:a,stickyHeader:r,sx:[{height:o||t.length===0?"100%":"none",borderCollapse:"separate !important","& .MuiTableCell-root":{borderRight:Cn,borderBottom:Cn,"&:first-of-type":{borderLeft:Cn}}},...Array.isArray(i)?i:[i]],children:[c.jsx(RI,{columns:A,headerGroups:e}),c.jsx(D.TableBody,{children:o?c.jsx(D.TableRow,{children:c.jsx(D.TableCell,{colSpan:A.length,children:l()})}):t.length?t.map((u,p)=>c.jsx(V.Fragment,{children:s(u,p)},p)):c.jsx(D.TableRow,{children:c.jsx(D.TableCell,{colSpan:A.length,children:d()})})})]})}),FI=[];function jl({loading:A=!1,rows:e,columns:t,headerGroups:o,indexLoadingRow:r,isStickyActions:i=!1,rowSx:a={},rowKey:s,onClickSelectRow:l=!1,enableTree:d=!1,getChildren:u,onClickRow:p,onDisabled:g,selectedRows:m,onSelectRows:h,onSelectRow:f,onDeleteRow:C,onInfoRow:b,onCopyRow:q,onHistoryRow:x,onUpdateRow:v,getActionIcon:w,getRowMenu:E,extraActionCount:I=0,stickyHeader:k=!0,tableSx:T,tableRef:M,renderRow:P}){const y=V.useMemo(()=>e??FI,[e]),[B,O]=V.useState({}),[R,N]=V.useState(new Set),{palette:L}=D.useTheme(),H=[f,C,b,q,x,v,E].filter(Boolean).length+I,U=H>0?H*19+Math.max(H-1,0)*16:0,F=V.useCallback(rA=>s?s(rA):String(rA.id),[s]),W=V.useCallback(rA=>d?u?u(rA):rA&&rA.children||[]:[],[d,u]);V.useEffect(()=>{if(!d){N(new Set);return}const rA=new Set,tA=pA=>{pA.forEach(K=>{const oA=F(K),J=W(K);J&&J.length>0&&(rA.add(oA),tA(J))})};tA(y),N(rA)},[d,F,W,y]);const{visibleRows:eA,rowLevels:_,hasChildrenById:G}=V.useMemo(()=>kI({rows:y,enableTree:d,expandedRowIds:R,getRowId:F,getChildren:W}),[y,d,R,F,W]),z=V.useMemo(()=>eA.map(F),[eA,F]),$=m?z.every(rA=>m.includes(rA)):!1,cA=m?m.length>0&&!$:!1,nA=V.useCallback(()=>{$?h==null||h([]):h==null||h(z)},[$,h,z]),Z=V.useCallback(rA=>{m&&(m.includes(rA)?h==null||h(m.filter(tA=>tA!==rA)):h==null||h([...m,rA]))},[m,h]),AA=V.useCallback(rA=>{N(tA=>{const pA=new Set(tA);return pA.has(rA)?pA.delete(rA):pA.add(rA),pA})},[]),Y=V.useCallback((rA,tA)=>{const pA=F(rA);if(pA===co.TOTAL||pA===co.TOTAL_INCOME)return null;const K=g?g(rA,tA):{...cr},oA=K.DISABLED_ROW||K.DISABLED_ALL_ACTIONS,J=String(s?s(rA):rA.id||tA),sA=()=>E?E(rA,tA).map(iA=>({...iA,onClick:()=>{iA.onClick(),O(IA=>({...IA,[J]:!1}))}})):[];return c.jsxs(c.Fragment,{children:[f&&c.jsx(vA,{icon:"remove_red_eye",onClick:iA=>{iA.stopPropagation(),f(rA,tA)},disabled:oA||K.SELECT}),C&&c.jsx(vA,{icon:"delete",onClick:iA=>{iA.stopPropagation(),C(rA,tA)},color:"error",disabled:oA||K.DELETE}),b&&c.jsx(vA,{icon:"view_cozy",onClick:iA=>{iA.stopPropagation(),b(rA,tA)},disabled:oA||K.INFO}),q&&c.jsx(vA,{icon:w&&w(rA,tA,"COPY")||"content_copy",onClick:iA=>{iA.stopPropagation(),q(rA,tA),window.scrollTo({top:0,behavior:"smooth"})},disabled:oA||K.COPY}),x&&c.jsx(vA,{icon:"history",onClick:iA=>{iA.stopPropagation(),x(rA,tA)},disabled:oA||K.HISTORY_GET_ROW_MENU}),v&&c.jsx(vA,{icon:w&&w(rA,tA,"UPDATE")||"settings",onClick:iA=>{iA.stopPropagation(),v(rA,tA),window.scrollTo({top:0,behavior:"smooth"})},disabled:oA||K.UPDATE}),E&&(K.DISABLED_GET_ROW_MENU?c.jsx(vA,{icon:"open_in_browser",disabled:oA||K.DISABLED_GET_ROW_MENU,onClick:iA=>iA.stopPropagation()}):c.jsx(W0,{style:{cursor:"pointer",display:"flex",alignItems:"center"},placement:"bottom-end",open:!!B[J],onOpen:()=>O(iA=>({...iA,[J]:!0})),onClose:()=>O(iA=>({...iA,[J]:!1})),content:c.jsx(Ff,{list:sA()}),children:c.jsx(vA,{icon:"open_in_browser",onClick:iA=>iA.stopPropagation()})}))]})},[w,F,E,q,C,g,x,b,f,v,s,B]),lA=V.useMemo(()=>{const rA=[...t];if(d&&rA.unshift({id:"treeToggle",label:"",width:32,alignHead:"center",render:pA=>c.jsx(MI,{row:pA,getRowId:F,rowLevels:_,hasChildrenById:G,expandedRowIds:R,onToggle:AA,palette:L})}),h&&rA.unshift({id:"selectCheckbox",label:c.jsx(D.Box,{onClick:pA=>{pA.stopPropagation(),nA()},sx:{display:"flex",justifyContent:"center",cursor:"pointer"},children:c.jsx(Wa,{checked:$,indeterminate:cA})}),width:35,alignHead:"center",stickyCss:{left:0,zIndex:1.5},render:(pA,K)=>{const oA=g?g(pA,K):{...cr},J=oA.DISABLED_ROW||oA.DISABLED_CHECKBOX;return c.jsx(D.Box,{children:c.jsx(Wa,{checked:m==null?void 0:m.includes(F(pA)),disabled:J,onClick:sA=>{sA.stopPropagation(),!J&&Z(F(pA))}})})}}),H>0&&rA.push({id:"actions",label:"Actions",width:U>70?U:70,align:"center",alignHead:"center",stickyCss:i?{right:0,borderLeft:Cn,zIndex:1.5}:void 0,render:(pA,K)=>c.jsx(wn,{gap:1,onClick:oA=>oA.stopPropagation(),children:Y(pA,K)})}),!(o!=null&&o.length))return rA;const tA=new Map;return o.forEach(pA=>{pA.columnIds.forEach(K=>{tA.set(K,pA)})}),rA.map(pA=>{const K=tA.get(pA.id);return!K||!K.childrenHeadSx&&!K.childrenCellSx?pA:{...pA,...K.childrenHeadSx?{headSx:qn(K.childrenHeadSx,pA.headSx)}:{},...K.childrenCellSx?{cellSx:qn(K.childrenCellSx,pA.cellSx)}:{}}})},[t,o,d,h,H,F,_,G,R,AA,L,nA,$,cA,g,m,Z,U,i,Y]),aA=V.useCallback((rA,tA,pA)=>c.jsx(TI,{columns:pA??lA,row:rA,indexRow:tA,indexLoadingRow:r,rowSx:a,getRowId:F,onClickRow:p,onDisabled:g,onClickSelectRow:l,onSelectRowById:Z,enableTree:d,rowLevels:_}),[lA,d,F,Z,r,p,l,g,_,a]);return c.jsx(NI,{columns:lA,headerGroups:o,rows:eA,loading:A,indexLoadingRow:r,stickyHeader:k,tableRef:M,tableSx:T,renderLoading:()=>c.jsx(qt,{}),renderEmpty:()=>c.jsx(po,{}),renderRow:(rA,tA)=>P?P({row:rA,index:tA,columns:lA,renderDefaultRow:pA=>aA(rA,tA,pA),renderActionsContent:Y}):aA(rA,tA)})}function jI({columns:A,row:e,collapse:t,collapseTableWidth:o,renderDefaultRow:r,renderActionsContent:i,onDisabled:a}){const{palette:s}=D.useTheme(),[l,d]=V.useState(!1),[u,p]=V.useState(),[g,m]=V.useState(!1),h=V.useCallback(async(E,I)=>{const k=!l;if(d(k),!(!k||!t.onOpenCollapse||u!==void 0)){m(!0);try{const T=await t.onOpenCollapse(E,I),M=t.property?T==null?void 0:T[t.property]:T;p(M)}catch(T){console.error(T)}finally{m(!1)}}},[t,l,u]),f=V.useMemo(()=>A.map(E=>E.id!=="actions"?E:{...E,render:(I,k)=>{const T=a?a(I,k):{...cr},M=T.DISABLED_ROW||T.DISABLED_ALL_ACTIONS;return c.jsxs(wn,{gap:1,onClick:P=>P.stopPropagation(),children:[i(I,k),c.jsx(vA,{onClick:P=>{P.stopPropagation(),h(I,k)},icon:l?"keyboard_arrow_down":"keyboard_arrow_up",disabled:M||T.COLLAPSE})]})}}),[A,a,l,i,h]),{iconTitle:C,title:b,property:q,onOpenCollapse:x,...v}=t,w=x?u:q?e[q]:void 0;return c.jsxs(V.Fragment,{children:[r(f),c.jsx(D.TableRow,{children:c.jsx(D.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:A.length+2,children:c.jsx(D.Stack,{sx:{display:"flex",overflowX:"auto",maxWidth:"100%",width:(o||0)-parseInt(De,10)*2||"auto"},children:c.jsx(D.Collapse,{in:l,timeout:"auto",unmountOnExit:!0,children:c.jsxs(D.Stack,{sx:{padding:De,borderRadius:Be,backgroundColor:s.background.default},children:[c.jsx(c0,{icon:C||"filter_list",content:b,size:"medium"}),c.jsx(jl,{...v,loading:g,rows:w})]})})})})})]})}function LI({loading:A=!1,rows:e,columns:t,collapse:o,...r}){const i=V.useMemo(()=>e||[],[e]),a=V.useRef(null),[s,l]=V.useState(0);return V.useEffect(()=>{a.current&&l(a.current.clientWidth)},[]),c.jsx(jl,{...r,columns:t,rows:i,loading:A,extraActionCount:1,stickyHeader:!1,tableRef:a,tableSx:{height:A||i.length===0?"100%":"none"},renderRow:({row:d,index:u,columns:p,renderDefaultRow:g,renderActionsContent:m})=>c.jsx(jI,{...r,columns:p,row:d,indexRow:u,collapse:o,collapseTableWidth:s,renderDefaultRow:g,renderActionsContent:m})})}const QI={loading:{control:"boolean",table:{type:{summary:"boolean"},defaultValue:{summary:"false"}}},columns:{control:!1,table:{type:{summary:"Column<R>[]"}}},headerGroups:{control:!1,table:{type:{summary:"TableHeaderGroup[]"}}},rows:{control:!1,table:{type:{summary:"R[]"}}},indexLoadingRow:{control:"number",table:{type:{summary:"number | undefined"}}},isStickyActions:{control:"boolean",table:{type:{summary:"boolean"},defaultValue:{summary:"false"}}},onClickSelectRow:{control:"boolean",table:{type:{summary:"boolean"},defaultValue:{summary:"false"}}},selectedRows:{control:!1},rowSx:{control:!1},rowKey:{control:!1},requiredPermissions:{control:!1},onClickRow:{action:"rowClicked"},onSelectRows:{action:"rowsSelected"},onSelectRow:{action:"selectAction"},onDeleteRow:{action:"deleteAction"},onInfoRow:{action:"infoAction"},onCopyRow:{action:"copyAction"},onHistoryRow:{action:"historyAction"},onUpdateRow:{action:"updateAction"},getActionIcon:{control:!1},getRowMenu:{control:!1},onDisabled:{control:!1}};function UI(A){return c.jsx(jl,{...A})}const HI=({name:A="Hệ thống",department:e="Hệ thống",icon:t="person",sx:o})=>c.jsxs(D.Stack,{sx:o,children:[c.jsxs(D.Stack,{direction:"row",alignItems:"center",gap:1,children:[c.jsx(vA,{icon:t,sx:{fontSize:"16px",color:"#6B7280"}}),c.jsx(D.Typography,{variant:"body2",sx:{fontWeight:500},children:A})]}),e&&c.jsxs(D.Typography,{variant:"caption",sx:{color:"#6B7280",ml:2.5},children:["(",e,")"]})]}),zI=({name:A,loading:e,chart:t,sx:o})=>c.jsx(D.Fade,{in:!0,timeout:mr,children:c.jsxs(ku,{children:[c.jsx(D.Typography,{variant:"subtitle1",sx:{lineHeight:1,textAlign:"center"},children:A}),c.jsx(D.Stack,{sx:{height:`calc(100% - 14px - ${RA})`,...o},children:e?c.jsx(qt,{}):t})]})}),VI=({iconLabel:A,label:e,nodeLabel:t,labelSize:o="medium",flex:r=1,height:i="fit-content",width:a,direction:s="column",directionNodeLabel:l="column",sx:d={},loading:u=!1,children:p,sxChildren:g={}})=>c.jsx(D.Fade,{in:!0,timeout:mr,children:c.jsxs(D.Stack,{sx:{...a?{width:a}:{flex:r},overflow:"hidden",height:i,...d},children:[(e||t)&&c.jsxs(ti,{sx:{position:"sticky",alignItems:"stretch",top:0,zIndex:1,overflow:"hidden"},children:[e&&c.jsx(c0,{icon:A,content:e,size:o}),t&&c.jsx(D.Stack,{sx:{flexDirection:l},children:t})]}),c.jsx(D.Stack,{sx:{flex:1,flexDirection:s,paddingTop:e||t?0:De,...g},children:u?c.jsx(qt,{}):p})]})}),WI=({iconLabel:A,label:e,nodeAction:t,nodeLabel:o,labelSize:r="large",flex:i=1,height:a="fit-content",width:s,direction:l="column",directionNodeLabel:d="column",sx:u={},loading:p=!1,children:g,sxChildren:m={},sxLabel:h={},divider:f,labelId:C,isTopLabel:b=!1})=>{const q=!!(e||t),x={large:QA.textSm.semiBold,medium:QA.textXs.semiBold,small:QA.textSmall.semiBold}[r];return c.jsx(D.Fade,{in:!0,timeout:mr,children:c.jsx(D.Stack,{sx:{...s?{width:s}:{flex:i},overflowY:"auto",overflowX:"hidden",height:a,boxShadow:1,borderRadius:Be,backgroundColor:Ze[50],...u},children:c.jsxs(D.Stack,{sx:{flex:1,minHeight:0,overflow:"hidden",gap:0},children:[q&&c.jsxs(ti,{sx:{position:"sticky",top:0,zIndex:1,gap:RA,minHeight:Ct.large,padding:Po,backgroundColor:Ze[50],...h},children:[e&&c.jsx(c0,{id:C,icon:A,content:e,size:r,isNowrap:!0,sx:{minWidth:0},sxText:{...x}}),t&&c.jsx(Iu,{sx:{flexDirection:d,flexShrink:0,marginLeft:"auto"},children:t})]}),o&&c.jsx(Du,{sx:{minHeight:Ct.large,overflowX:"auto",padding:Po,borderTop:q?`1px solid ${ot[300]}`:"none"},children:o}),c.jsx(D.Stack,{sx:{flex:1,minHeight:0,flexDirection:l,padding:Po,marginTop:b?De:0,borderTop:q||o?`1px solid ${ot[300]}`:"none",backgroundColor:Ze[50],...m},divider:f,children:p?c.jsx(wn,{height:100,width:"100%",children:c.jsx(qt,{})}):g})]})})})},GI=({isWrap:A=!1,children:e})=>A?c.jsx(wn,{children:e}):c.jsx(c.Fragment,{children:e}),Ll=({app:A,iconSize:e,iconRadius:t,titleColor:o,showNameApps:r=!0,showIconApps:i=!0,direction:a="column"})=>c.jsxs(Tu,{sx:{flexDirection:a,gap:RA},children:[i&&c.jsx(B0,{sx:{width:e,height:e,borderRadius:t},url:A.icon,sizeType:"SQUARE"}),r&&c.jsx(D.Typography,{sx:{color:o,textAlign:"center",...QA.textMd.semiBold},children:A.content})]}),Ql=({apps:A,columns:e=5,rows:t=3,iconSize:o=120,iconRadius:r=7,titleColor:i,showPagination:a=!0,onClickApp:s,isShowAppHidden:l=!1})=>{const d=P0(),u=Math.max(1,e*Math.max(1,t)),p=Math.max(1,Math.ceil(A.length/u)),[g,m]=V.useState(0);V.useEffect(()=>{m(x=>x>=p?p-1:x)},[p,e,t,A.length]);const h=g*u,f=h+u,C=p>1?A.slice(h,f):A,b=l?Math.max(0,u-C.length):0,q=l?o+36.5:0;return c.jsxs(J0,{sx:{width:"100%",gap:3},children:[c.jsxs(ve,{sx:{width:"100%",gap:3},children:[c.jsx(c.Fragment,{}),c.jsxs(D.Stack,{sx:{display:"grid",gridTemplateColumns:`repeat(${e}, 1fr)`,width:"100%"},children:[C.map((x,v)=>c.jsx(J0,{component:Er,preset:"staggerItem",index:v,hover:!0,sx:{cursor:"pointer",flex:1},onClick:()=>s(x),children:c.jsx(Ll,{app:x,titleColor:i??d.palette.common.white,iconSize:o,iconRadius:r})},v)),b>0&&Array.from({length:b}).map((x,v)=>c.jsx(D.Box,{sx:{visibility:"hidden",width:1,minHeight:q}},`placeholder-${v}`))]})]}),a&&p>1&&c.jsx(ve,{sx:{px:E0,py:vt,borderRadius:Xt,backgroundColor:"rgba(255,255,255,0.15)",width:"fit-content"},children:Array.from({length:p}).map((x,v)=>c.jsx(D.Box,{onClick:()=>m(v),sx:{height:10,borderRadius:Xt,cursor:"pointer",transition:"width 0.3s ease",width:v===g?"40px":"10px",backgroundColor:v===g?d.palette.common.white:"rgba(255,255,255,0.35)"}},v))})]})},YI=({children:A})=>c.jsx(D.Stack,{sx:{backgroundColor:"background.default",minHeight:"100vh",width:"100%",overflowY:"auto"},children:c.jsx(D.Stack,{sx:{flex:1,alignItems:"center",py:De,justifyContent:"center"},children:A})});var Hf=(A=>(A.MAIN="logoMain",A.SUB1="logoSub1",A.SUB2="logoSub2",A.SUB3="logoSub3",A.SUB4="logoSub4",A.SUB5="logoSub5",A))(Hf||{});const KI=({env:A,logoName:e="logoMain",height:t=Wd,sx:o={},isLongSubDomain:r=!1})=>c.jsx(An,{href:r?Go[A].replace("dev.","develop.").replace("sta.","staging."):Go[A],children:c.jsx(B0,{url:JA[e],sx:{height:t,borderRadius:"unset",width:"auto",...o}})}),XI=({content:A,contentHref:e,href:t,type:o="info"})=>{const{palette:r}=D.useTheme(),i={info:{icon:"error",title:"Info",color:r.success.dark},recommend:{icon:"gpp_maybe",title:"Recommend",color:r.info.dark},warning:{icon:"report",title:"Warning",color:r.warning.dark},error:{icon:"emergency_home",title:"Error",color:r.error.dark}};return c.jsxs(D.Stack,{sx:{gap:1,borderRadius:Be,borderColor:i[o].color,borderStyle:"solid",borderWidth:"1px 1px 1px 3px",padding:1.5},children:[c.jsxs(ve,{sx:{gap:vt},children:[c.jsx(vA,{icon:i[o].icon,sx:{color:i[o].color}}),c.jsx(D.Typography,{sx:{color:i[o].color},variant:"body2",children:i[o].title})]}),c.jsxs(D.Typography,{sx:{color:i[o].color},children:[A,t&&e&&c.jsxs(V.Fragment,{children:[" ",c.jsx(An,{href:t,children:e})]})]})]})},JI=({isLineHeight1:A,price:e,originalPrice:t,discountPercent:o,onClick:r,color:i,size:a="small",sameSize:s=!1,sx:l={}})=>{const{palette:d}=D.useTheme(),u={small:"subtitle1",medium:"h6",large:"h5"};return r&&(l={...l,cursor:"pointer"}),c.jsxs(D.Stack,{sx:l,children:[c.jsxs(ve,{sx:{color:i||d.error.main,gap:RA},children:[c.jsx(vA,{icon:"attach_money",size:a,sx:{marginRight:"-5px",marginLeft:"-4px"}}),c.jsx(D.Typography,{lineHeight:A?1:void 0,variant:u[a],children:+e.toFixed(1)})]}),t&&e!==t&&c.jsxs(ve,{sx:{gap:RA},children:[c.jsxs(ve,{sx:{color:d.text.disabled,gap:RA,position:"relative","&:after":{position:"absolute",content:"''",borderTop:`1px solid ${d.text.disabled}`,width:"100%"}},children:[c.jsx(vA,{icon:"attach_money",size:s?a:"small",sx:{marginRight:"-5px",marginLeft:"-4px"}}),c.jsx(D.Typography,{lineHeight:A?1:void 0,variant:s?u[a]:"body1",children:t})]}),o&&c.jsx(D.Typography,{lineHeight:A?1:void 0,color:o<0?"success.main":"error",variant:s?u[a]:"body1",children:(o<0?"+":"-")+Math.abs(o)+"%"})]})]})};var h2={exports:{}},ZI=h2.exports,yd;function _I(){return yd||(yd=1,(function(A,e){(function(t,o){A.exports=o()})(ZI,(function(){var t="week",o="year";return function(r,i,a){var s=i.prototype;s.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var d=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=a(this).startOf(o).add(1,o).date(d),p=a(this).endOf(t);if(u.isBefore(p))return 1}var g=a(this).startOf(o).date(d).startOf(t).subtract(1,"millisecond"),m=this.diff(g,t,!0);return m<0?a(this).startOf("week").week():Math.ceil(m)},s.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(h2)),h2.exports}var $I=_I();const AT=M0($I);var C2={exports:{}},eT=C2.exports,vd;function tT(){return vd||(vd=1,(function(A,e){(function(t,o){A.exports=o()})(eT,(function(){return function(t,o,r){o.prototype.isBetween=function(i,a,s,l){var d=r(i),u=r(a),p=(l=l||"()")[0]==="(",g=l[1]===")";return(p?this.isAfter(d,s):!this.isBefore(d,s))&&(g?this.isBefore(u,s):!this.isAfter(u,s))||(p?this.isBefore(d,s):!this.isAfter(d,s))&&(g?this.isAfter(u,s):!this.isBefore(u,s))}}}))})(C2)),C2.exports}var nT=tT();const oT=M0(nT);var b2={exports:{}},rT=b2.exports,xd;function iT(){return xd||(xd=1,(function(A,e){(function(t,o){A.exports=o()})(rT,(function(){return function(t,o){var r=o.prototype,i=r.format;r.format=function(a){var s=this,l=this.$locale();if(!this.isValid())return i.bind(this)(a);var d=this.$utils(),u=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(p){switch(p){case"Q":return Math.ceil((s.$M+1)/3);case"Do":return l.ordinal(s.$D);case"gggg":return s.weekYear();case"GGGG":return s.isoWeekYear();case"wo":return l.ordinal(s.week(),"W");case"w":case"ww":return d.s(s.week(),p==="w"?1:2,"0");case"W":case"WW":return d.s(s.isoWeek(),p==="W"?1:2,"0");case"k":case"kk":return d.s(String(s.$H===0?24:s.$H),p==="k"?1:2,"0");case"X":return Math.floor(s.$d.getTime()/1e3);case"x":return s.$d.getTime();case"z":return"["+s.offsetName()+"]";case"zzz":return"["+s.offsetName("long")+"]";default:return p}}));return i.bind(this)(u)}}}))})(b2)),b2.exports}var aT=iT();const sT=M0(aT);DA.extend(ru);DA.extend(AT);DA.extend(oT);DA.extend(sT);const lT={YY:"year",YYYY:{sectionType:"year",contentType:"digit",maxLength:4},M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMM:{sectionType:"month",contentType:"letter"},MMMM:{sectionType:"month",contentType:"letter"},D:{sectionType:"day",contentType:"digit",maxLength:2},DD:"day",Do:{sectionType:"day",contentType:"digit-with-letter"},d:{sectionType:"weekDay",contentType:"digit",maxLength:2},dd:{sectionType:"weekDay",contentType:"letter"},ddd:{sectionType:"weekDay",contentType:"letter"},dddd:{sectionType:"weekDay",contentType:"letter"},A:"meridiem",a:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},cT={year:"YYYY",month:"MMMM",monthShort:"MMM",dayOfMonth:"D",dayOfMonthFull:"Do",weekday:"dddd",weekdayShort:"dd",hours24h:"HH",hours12h:"hh",meridiem:"A",minutes:"mm",seconds:"ss",fullDate:"ll",keyboardDate:"L",shortDate:"MMM D",normalDate:"D MMMM",normalDateWithWeekday:"ddd, MMM D",fullTime12h:"hh:mm A",fullTime24h:"HH:mm",keyboardDateTime12h:"L hh:mm A",keyboardDateTime24h:"L HH:mm"},ua=["Missing UTC plugin","To be able to use UTC or timezones, you have to enable the `utc` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-utc"].join(`
263
263
  `),qd=["Missing timezone plugin","To be able to use timezones, you have to enable both the `utc` and the `timezone` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-timezone"].join(`
264
- `);class dT{constructor({locale:e,formats:t}={}){yA(this,"isMUIAdapter",!0);yA(this,"isTimezoneCompatible",!0);yA(this,"lib","dayjs");yA(this,"escapedCharacters",{start:"[",end:"]"});yA(this,"formatTokenMap",lT);yA(this,"setLocaleToValue",e=>{const t=this.getCurrentLocaleCode();return t===e.locale()?e:e.locale(t)});yA(this,"hasUTCPlugin",()=>typeof DA.utc<"u");yA(this,"hasTimezonePlugin",()=>typeof DA.tz<"u");yA(this,"isSame",(e,t,o)=>{const r=this.setTimezone(t,this.getTimezone(e));return e.format(o)===r.format(o)});yA(this,"cleanTimezone",e=>{switch(e){case"default":return;case"system":return DA.tz.guess();default:return e}});yA(this,"createSystemDate",e=>{let t;if(this.hasUTCPlugin()&&this.hasTimezonePlugin()){const o=DA.tz.guess();o==="UTC"?t=DA(e):t=DA.tz(e,o)}else t=DA(e);return this.setLocaleToValue(t)});yA(this,"createUTCDate",e=>{if(!this.hasUTCPlugin())throw new Error(ua);return this.setLocaleToValue(DA.utc(e))});yA(this,"createTZDate",(e,t)=>{if(!this.hasUTCPlugin())throw new Error(ua);if(!this.hasTimezonePlugin())throw new Error(qd);const o=e!==void 0&&!e.endsWith("Z");return this.setLocaleToValue(DA(e).tz(this.cleanTimezone(t),o))});yA(this,"getLocaleFormats",()=>{const e=DA.Ls,t=this.locale||"en";let o=e[t];return o===void 0&&(process.env.NODE_ENV!=="production"&&M3(["MUI X: Your locale has not been found.","Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale.","Or you forget to import the locale from 'dayjs/locale/{localeUsed}'","fallback on English locale."]),o=e.en),o.formats});yA(this,"adjustOffset",e=>{if(!this.hasTimezonePlugin())return e;const t=this.getTimezone(e);if(t!=="UTC"){const o=e.tz(this.cleanTimezone(t),!0);if(o.$offset===(e.$offset??0))return e;e.$offset=o.$offset}return e});yA(this,"date",(e,t="default")=>e===null?null:t==="UTC"?this.createUTCDate(e):t==="system"||t==="default"&&!this.hasTimezonePlugin()?this.createSystemDate(e):this.createTZDate(e,t));yA(this,"getInvalidDate",()=>DA(new Date("Invalid date")));yA(this,"getTimezone",e=>{var t;if(this.hasTimezonePlugin()){const o=(t=e.$x)==null?void 0:t.$timezone;if(o)return o}return this.hasUTCPlugin()&&e.isUTC()?"UTC":"system"});yA(this,"setTimezone",(e,t)=>{if(this.getTimezone(e)===t)return e;if(t==="UTC"){if(!this.hasUTCPlugin())throw new Error(ua);return e.utc()}if(t==="system")return e.local();if(!this.hasTimezonePlugin()){if(t==="default")return e;throw new Error(qd)}return this.setLocaleToValue(DA.tz(e,this.cleanTimezone(t)))});yA(this,"toJsDate",e=>e.toDate());yA(this,"parse",(e,t)=>e===""?null:DA(e,t,this.locale,!0));yA(this,"getCurrentLocaleCode",()=>this.locale||"en");yA(this,"is12HourCycleInCurrentLocale",()=>/A|a/.test(this.getLocaleFormats().LT||""));yA(this,"expandFormat",e=>{const t=this.getLocaleFormats(),o=r=>r.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(i,a,s)=>a||s.slice(1));return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(r,i,a)=>{const s=a&&a.toUpperCase();return i||t[a]||o(t[s])})});yA(this,"isValid",e=>e==null?!1:e.isValid());yA(this,"format",(e,t)=>this.formatByString(e,this.formats[t]));yA(this,"formatByString",(e,t)=>this.setLocaleToValue(e).format(t));yA(this,"formatNumber",e=>e);yA(this,"isEqual",(e,t)=>e===null&&t===null?!0:e===null||t===null?!1:e.toDate().getTime()===t.toDate().getTime());yA(this,"isSameYear",(e,t)=>this.isSame(e,t,"YYYY"));yA(this,"isSameMonth",(e,t)=>this.isSame(e,t,"YYYY-MM"));yA(this,"isSameDay",(e,t)=>this.isSame(e,t,"YYYY-MM-DD"));yA(this,"isSameHour",(e,t)=>e.isSame(t,"hour"));yA(this,"isAfter",(e,t)=>e>t);yA(this,"isAfterYear",(e,t)=>this.hasUTCPlugin()?!this.isSameYear(e,t)&&e.utc()>t.utc():e.isAfter(t,"year"));yA(this,"isAfterDay",(e,t)=>this.hasUTCPlugin()?!this.isSameDay(e,t)&&e.utc()>t.utc():e.isAfter(t,"day"));yA(this,"isBefore",(e,t)=>e<t);yA(this,"isBeforeYear",(e,t)=>this.hasUTCPlugin()?!this.isSameYear(e,t)&&e.utc()<t.utc():e.isBefore(t,"year"));yA(this,"isBeforeDay",(e,t)=>this.hasUTCPlugin()?!this.isSameDay(e,t)&&e.utc()<t.utc():e.isBefore(t,"day"));yA(this,"isWithinRange",(e,[t,o])=>e>=t&&e<=o);yA(this,"startOfYear",e=>this.adjustOffset(e.startOf("year")));yA(this,"startOfMonth",e=>this.adjustOffset(e.startOf("month")));yA(this,"startOfWeek",e=>this.adjustOffset(this.setLocaleToValue(e).startOf("week")));yA(this,"startOfDay",e=>this.adjustOffset(e.startOf("day")));yA(this,"endOfYear",e=>this.adjustOffset(e.endOf("year")));yA(this,"endOfMonth",e=>this.adjustOffset(e.endOf("month")));yA(this,"endOfWeek",e=>this.adjustOffset(this.setLocaleToValue(e).endOf("week")));yA(this,"endOfDay",e=>this.adjustOffset(e.endOf("day")));yA(this,"addYears",(e,t)=>this.adjustOffset(e.add(t,"year")));yA(this,"addMonths",(e,t)=>this.adjustOffset(e.add(t,"month")));yA(this,"addWeeks",(e,t)=>this.adjustOffset(e.add(t,"week")));yA(this,"addDays",(e,t)=>this.adjustOffset(e.add(t,"day")));yA(this,"addHours",(e,t)=>this.adjustOffset(e.add(t,"hour")));yA(this,"addMinutes",(e,t)=>this.adjustOffset(e.add(t,"minute")));yA(this,"addSeconds",(e,t)=>this.adjustOffset(e.add(t,"second")));yA(this,"getYear",e=>e.year());yA(this,"getMonth",e=>e.month());yA(this,"getDate",e=>e.date());yA(this,"getHours",e=>e.hour());yA(this,"getMinutes",e=>e.minute());yA(this,"getSeconds",e=>e.second());yA(this,"getMilliseconds",e=>e.millisecond());yA(this,"setYear",(e,t)=>this.adjustOffset(e.set("year",t)));yA(this,"setMonth",(e,t)=>this.adjustOffset(e.set("month",t)));yA(this,"setDate",(e,t)=>this.adjustOffset(e.set("date",t)));yA(this,"setHours",(e,t)=>this.adjustOffset(e.set("hour",t)));yA(this,"setMinutes",(e,t)=>this.adjustOffset(e.set("minute",t)));yA(this,"setSeconds",(e,t)=>this.adjustOffset(e.set("second",t)));yA(this,"setMilliseconds",(e,t)=>this.adjustOffset(e.set("millisecond",t)));yA(this,"getDaysInMonth",e=>e.daysInMonth());yA(this,"getWeekArray",e=>{const t=this.startOfWeek(this.startOfMonth(e)),o=this.endOfWeek(this.endOfMonth(e));let r=0,i=t;const a=[];for(;i<o;){const s=Math.floor(r/7);a[s]=a[s]||[],a[s].push(i),i=this.addDays(i,1),r+=1}return a});yA(this,"getWeekNumber",e=>e.week());yA(this,"getYearRange",([e,t])=>{const o=this.startOfYear(e),r=this.endOfYear(t),i=[];let a=o;for(;this.isBefore(a,r);)i.push(a),a=this.addYears(a,1);return i});this.locale=e,this.formats=j({},cT,t),DA.extend(of)}getDayOfWeek(e){return e.day()+1}}function uT({children:A}){return c.jsx(ri,{dateAdapter:dT,children:A})}const pT=({averageRating:A,reviewCount:e,onClick:t,sx:o={}})=>(t&&(o={...o,cursor:"pointer"}),c.jsxs(ve,{sx:{gap:RA,cursor:"inherit",...o},onClick:t,children:[c.jsx(vA,{icon:"star",size:"large",fill:1,color:"warning",sx:{margin:"-5px"}}),c.jsxs(Ne,{sx:{gap:RA},children:[c.jsx(D.Typography,{lineHeight:1,children:A}),c.jsx(D.Typography,{lineHeight:1,children:`(${e})`})]})]})),zf=({isOpen:A,onClose:e,position:t="left",blacklist:o=[],env:r,onClickApp:i,isLongSubDomain:a=!1})=>{if(!A)return null;const s=Object.keys(Yn).reduce((l,d)=>{if(o.includes(d))return l;const u=Yn[d];return a&&(u.path.develop=u.path.develop.replace("dev.","develop."),u.path.staging=u.path.staging.replace("sta.","staging.")),l[u.group]?l[u.group].push(u):l[u.group]=[u],l},{});return c.jsxs(c.Fragment,{children:[c.jsx(D.Stack,{onClick:e,sx:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:100}}),c.jsxs(D.Stack,{preset:"fadeInLeft",component:Er,sx:{position:"fixed",top:0,left:t==="left"?0:"auto",right:t==="right"?0:"auto",height:"100%",backgroundColor:pr[50],zIndex:100,padding:De,overflowY:"auto"},children:[c.jsxs(it,{children:[c.jsx(vA,{icon:"close",onClick:e}),c.jsx(vA,{icon:"home",onClick:()=>window.location.href=a?Go[r].replace("dev.","develop.").replace("sta.","staging."):Go[r]})]}),Object.keys(s).map(l=>c.jsxs(D.Stack,{children:[c.jsx(D.Typography,{variant:"subtitle2",children:l===bA.PLATFORM_AND_INFO?"Platform & Info":l}),c.jsx(Ql,{apps:s[l],iconSize:60,iconRadius:5.5,titleVariant:"body1",captionVariant:"caption",titleColor:ot[500],captionColor:ot[500],onClickApp:i,showPagination:!1})]},l))]})]})},fT="Ẩn điều hướng",o0={background:Kn[900],hoverBackground:"rgba(255, 255, 255, 0.08)",selectedBackground:"rgba(255, 255, 255, 0.16)",divider:"rgba(255, 255, 255, 0.18)",text:Ze[50],textMuted:pr[50]},gT=A=>({borderRight:0,width:A?ba:"max-content",minWidth:A?ba:Zd,padding:RA,gap:RA,backgroundColor:o0.background,justifyContent:"space-between",transition:`width ${ht}, min-width ${ht}`}),mT={overflowY:"auto",overflowX:"hidden",gap:0},hT={borderColor:o0.divider},CT={padding:RA,color:o0.text,borderRadius:s0,"&:hover":{backgroundColor:o0.hoverBackground}},bT=(A,e)=>({minHeight:A?34:36,gap:RA,padding:A?"6px 10px 6px 36px":"6px 10px",borderRadius:s0,color:o0.text,backgroundColor:e?o0.selectedBackground:"transparent",cursor:"pointer",transition:`background-color ${ht}`,"&:hover":{backgroundColor:e?o0.selectedBackground:o0.hoverBackground}}),yT={minWidth:0,flex:1,gap:RA},vT={},xT={},qT=A=>({color:o0.text,transform:A?"rotate(0deg)":"rotate(180deg)",transition:`transform ${ht}`}),wT=({tab:A,tabIdSelect:e,hiddenContent:t,isOpen:o,onClickTab:r,renderSubTabs:i})=>{var d;const a=A.id===e,s=!!((d=A.subs)!=null&&d.length),l=A.level>1;return c.jsxs(D.Stack,{gap:0,children:[c.jsx(W0,{placement:"right-end",content:A.name,disableHoverListener:!t,disableFocusListener:!t,disableTouchListener:!t,children:c.jsx(An,{component:A.href?"a":"span",href:A.href,onClick:()=>r(A),children:c.jsxs(it,{sx:bT(l,a),children:[c.jsxs(ve,{sx:yT,children:[!l&&A.icon&&c.jsx(vA,{icon:A.icon,sx:{color:o0.text}}),!t&&c.jsx(Dn,{content:A.name,sx:l?xT:vT})]}),!t&&s&&c.jsx(vA,{icon:"arrow_drop_up",sx:qT(o)})]})})}),!t&&s&&o&&c.jsx(D.Stack,{gap:0,children:i(A.subs)})]},A.id)},Vf=(A,e,t,o,r)=>{!A.children||!Object.keys(A.children).length||(Object.keys(A.children).forEach(i=>{const a=A.children[i],s=a.children&&Object.keys(a.children).length;let l=!1;(!a.isSidebar||!a.allowUserTypes.some(d=>e.includes(d))&&!e.includes(t))&&(delete A.children[i],l=!0),!l&&s&&Vf(a,e,t,i,A)}),!Object.keys(A.children).length&&o&&r&&delete r.children[o])},Wf=(A,e,t,o,r=1,i="/")=>A.children?Object.values(A.children).map(a=>{const l=`${i==="/"?"":i}/${a.path}`,d=a.children&&Object.keys(a.children).length,u={id:l,level:r,name:a.content,icon:a.icon,badgeCount:0,onClick:()=>{e(l),o(l),d||t(l)}};return d?u.subs=Wf(a,e,t,o,r+1,l):u.href=l,u}):[],Gf=(A,e,t="",o=[])=>{const r=decodeURIComponent(e.split("?")[0]),i=Object.values(A);if(i.length===0)return;const a=(d,u,p)=>{let g=d,m=u;const h=[...p];for(;g.children&&Object.keys(g.children).length>0;){const C=`${m}${g.path}`.replace(/\/+$/,"");C&&h.push(C);const b=Object.values(g.children);m=`${C}/`,g=b[0]}const f=`${m}${g.path}`.replace(/\/+$/,"");return{route:g,fullPath:f,parentPaths:h}};if(r==="/"||r==="")return a(i[0],t,o);const[s,l]=i.reduce((d,u)=>(d[u.path.includes(":")?1:0].push(u),d),[[],[]]);for(const d of[...s,...l]){const u=`${t}${d.path}`.replace(/\/+$/,"");if(!Vl.matchPath({path:u,end:!1},r))continue;const p=u?[...o,u]:[...o];if(d.children){const g=Gf(d.children,r,`${u}/`,p);if(g)return g}if(Vl.matchPath({path:u,end:!0},r)){if(d.children){const g=Object.values(d.children)[0];return g?a(g,`${u}/`,p):void 0}return{route:d,fullPath:d.path.includes(":")?r:u,parentPaths:o}}}},y2=(A,e)=>e?[A,...Array.isArray(e)?e:[e]]:A,Ul=(A,e)=>{var t;return!!((t=A.subs)!=null&&t.some(o=>o.id===e||Ul(o,e)))},Yf=({tabs:A,tabIdSelect:e,memoryOpen:t,hiddenContentDefault:o=!1,hiddenContentLabel:r=fT,onEmptyTabs:i,onHiddenContentChange:a,mainSx:s,tabsSx:l,footerSx:d,toggleSx:u})=>{const[p,g]=V.useState(o),[m,h]=V.useState({});V.useEffect(()=>{A.length||i==null||i()},[i,A.length]);const f=()=>{g(x=>{const v=!x;return a==null||a(v),v})},C=x=>{var v,w;(v=x.subs)!=null&&v.length&&!t&&h(E=>({...E,[x.id]:!E[x.id]})),(w=x.onClick)==null||w.call(x)},b=x=>!!((t==null?void 0:t[x.id])??m[x.id]??Ul(x,e)),q=x=>x.map(v=>c.jsx(wT,{tab:v,tabIdSelect:e,hiddenContent:p,isOpen:b(v),onClickTab:C,renderSubTabs:q},v.id));return c.jsxs(D.Stack,{sx:y2(gT(p),s),children:[A.length>0&&c.jsx(D.Stack,{sx:y2(mT,l),children:q(A)}),c.jsxs(D.Stack,{gap:1,sx:d,children:[c.jsx(D.Divider,{orientation:"horizontal",flexItem:!0,sx:hT}),c.jsx(c0,{onClick:f,icon:"menu_open",content:p?"":r,color:"inherit",hiddenContent:p,sx:y2(CT,u)})]})]})},ST=Yf,ET=({position:A,blacklist:e,env:t,onClickApp:o,showNameApps:r,showIconApps:i,showTitleApps:a,direction:s="row",isLongSubDomain:l=!1})=>{const[d,u]=V.useState(!1),p=Object.values(Yn).find(g=>Object.values(g.path).some(m=>{const h=m==null?void 0:m.trim();return h&&window.location.href.startsWith(h)}))??Yn.MASTER_DATA;return c.jsxs(ve,{children:[c.jsx(B0,{url:JA.iconApps,onClick:()=>u(!0),sizeType:"SQUARE"}),c.jsx(Ll,{app:p,iconSize:45,iconRadius:3,showNameApps:r,showIconApps:i,showTitleApps:a,direction:s}),c.jsx(zf,{isOpen:d,onClose:()=>u(!1),position:A,blacklist:e,env:t,onClickApp:o,isLongSubDomain:l})]})},DT={[bA.ALL]:"TẤT CẢ"},BT=({blacklist:A,onClickApp:e,sx:t={},sxTabs:o={},sxApps:r={},sxNotification:i={},gridTemplateColumns:a={xs:"72px minmax(0, 1fr) 72px",sm:"180px minmax(0, 1fr) 180px",md:"240px minmax(0, 1fr) 240px"},isLongSubDomain:s=!1,searchText:l="",notificationSlot:d,iconSize:u=80})=>{const p=P0(),[g,m]=V.useState(bA.ALL),h=D.useMediaQuery(p.breakpoints.down("sm")),f=D.useMediaQuery(p.breakpoints.down("md")),C=D.useMediaQuery(p.breakpoints.down("lg")),b=h?2:f?3:C?4:5,q=V.useMemo(()=>Object.entries(Yn).filter(([w])=>!(A!=null&&A.includes(w))).map(([,w])=>{const E=w;return s?{...E,path:{...E.path,develop:E.path.develop.replace("dev.","develop."),staging:E.path.staging.replace("sta.","staging.")}}:E}),[A,s]),x=V.useMemo(()=>q.filter(w=>g!==bA.ALL&&w.group!==g?!1:l?`${w.title??""} ${w.content}`.toLocaleLowerCase().includes(l.toLocaleLowerCase()):!0),[q,l,g]),v=V.useMemo(()=>Object.values(bA).filter(w=>w===bA.ALL||q.some(E=>E.group===w)),[q]);return c.jsxs(J0,{component:Er,preset:"fadeInUp",sx:[{display:"grid",gridTemplateColumns:a,columnGap:{xs:1,md:2},alignItems:"stretch",width:"100%",minHeight:"100%"},...Array.isArray(t)?t:[t]],children:[c.jsx(D.Stack,{sx:[{width:"100%",minWidth:0,gap:.5},...Array.isArray(o)?o:[o]],children:v.map(w=>{const E=g===w;return c.jsxs(ve,{onClick:()=>m(w),"aria-pressed":E,sx:{minHeight:40,p:RA,justifyContent:{xs:"center",sm:"flex-start"},border:0,borderRadius:Oe,color:E?p.palette.common.white:"rgba(255, 255, 255, 0.82)",backgroundColor:E?"rgba(255, 255, 255, 0.1)":"transparent",cursor:"pointer",transition:"background-color 160ms ease, color 160ms ease","&:hover":{color:p.palette.common.white,backgroundColor:E?"rgba(0, 138, 119, 0.3)":"rgba(255, 255, 255, 0.07)"}},children:[c.jsx(vA,{icon:Od[w]}),c.jsx(D.Typography,{sx:{display:{xs:"none",sm:"block"},...QA.textMd.regular},children:DT[w]??w})]},w)})}),c.jsx(D.Stack,{sx:[{flex:1,minWidth:0,gap:3},...Array.isArray(r)?r:[r]],children:x.length>0?c.jsx(Ql,{apps:x,columns:b,rows:3,iconSize:u,iconRadius:7,onClickApp:e,isShowAppHidden:!0},`${g}-${l}`):c.jsx(po,{content:"Không tìm thấy ứng dụng phù hợp"})}),c.jsx(D.Stack,{sx:[{width:"100%",minWidth:0},...Array.isArray(i)?i:[i]],children:d})]})},Kf=9600,Xf=20;var Le=(A=>(A.Idle="idle",A.Connecting="connecting",A.Connected="connected",A.Disconnecting="disconnecting",A.Error="error",A))(Le||{}),Hl=(A=>(A.None="none",A.Even="even",A.Odd="odd",A))(Hl||{}),Jf=(A=>(A.None="none",A.Hardware="hardware",A))(Jf||{});const pa=()=>{if(!(typeof navigator>"u"))return navigator.serial},wd=()=>typeof window>"u"?!1:window.isSecureContext,Sd=A=>{const e=A instanceof DOMException?A.name:A instanceof Error?A.constructor.name:"Unknown",t=A instanceof Error?A.message:String(A);return`[${e}] ${t}`},IT=A=>A.map((e,t)=>({index:t,label:`Cân ${t+1}`})),Zf=A=>{const e=A.match(/[-+]?\d+(?:[.,]\d+)?/);if(!e)return;const t=e[0].replace(",","."),o=Number(t);return{rawLine:A,value:t,numericValue:Number.isFinite(o)?o:void 0,receivedAt:Date.now()}},_f=({serialOptions:A,requestOptions:e,lineLimit:t=Xf,autoConnectAuthorized:o=!1,parseReading:r=Zf,onReading:i,onStatusChange:a,onError:s})=>{const[l,d]=V.useState(Le.Idle),[u,p]=V.useState("Chưa kiểm tra"),[g,m]=V.useState(""),[h,f]=V.useState([]),[C,b]=V.useState(),[q,x]=V.useState([]),[v,w]=V.useState(!1),[E,I]=V.useState(!1),k=V.useRef(void 0),T=V.useRef(void 0),M=V.useRef(void 0),P=V.useRef(void 0),y=V.useRef(!0),B=V.useRef(0),O=V.useRef(Le.Idle),R=V.useRef(!1),N=V.useCallback(z=>{O.current=z,d(z),a==null||a(z)},[a]),L=V.useCallback(z=>{m(z),s==null||s(z)},[s]),X=V.useCallback(z=>{if(!z.trim())return;f(Z=>[...Z.slice(-(Math.max(t,1)-1)),z]);const $=r(z);if(!($!=null&&$.value))return;const cA=$.receivedAt??Date.now(),nA={...$,rawLine:$.rawLine??z,receivedAt:cA};b(nA),i==null||i(nA)},[t,i,r]),H=V.useCallback(async(z,$)=>{if(!z.readable)return;const cA=new TextDecoderStream;M.current=z.readable.pipeTo(cA.writable).catch(()=>{});const nA=cA.readable.getReader();T.current=nA;let Z="";try{for(;!y.current&&B.current===$;){const{value:AA,done:Y}=await nA.read();if(Y)break;if(!AA)continue;Z+=AA;const lA=Z.split(/\r?\n/);Z=lA.pop()??"",lA.forEach(X)}}catch(AA){if(!y.current&&B.current===$){const Y=Sd(AA);L(Y),N(Le.Error)}}finally{try{nA.releaseLock()}catch{}T.current===nA&&(T.current=void 0)}},[X,L,N]),U=V.useCallback(async()=>{y.current=!0,B.current+=1;const z=T.current;if(z)try{await z.cancel()}catch{}if(P.current)try{await P.current}catch{}if(M.current)try{await M.current}catch{}const $=k.current;if($)try{await $.close()}catch{}T.current=void 0,M.current=void 0,P.current=void 0,k.current=void 0},[]),F=V.useCallback(async z=>{try{await z.open(A);return}catch($){if(!($ instanceof DOMException)||$.name!=="InvalidStateError")throw $;k.current=z,await U(),await z.open(A)}},[U,A]),W=V.useCallback(async()=>{const z=pa();if(!z)return x([]),[];const $=await z.getPorts();return x(IT($)),$},[]),eA=V.useCallback(async z=>{if(O.current===Le.Connecting||O.current===Le.Disconnecting)return;const $=pa(),cA=wd();if(w(!!$),I(cA),p($?"navigator.serial: có":"navigator.serial: không"),!cA){L("Web Serial API cần HTTPS hoặc localhost để trình duyệt cho phép truy cập cổng COM."),N(Le.Error);return}if(!$){L("Trình duyệt không hỗ trợ Web Serial API. Hãy dùng Chrome hoặc Edge."),N(Le.Error);return}b(void 0),N(Le.Connecting),m("");try{await U();const nA=z!=null&&z.useAuthorizedPort?await W():[],Z=nA[(z==null?void 0:z.authorizedPortIndex)??0]??nA[0];if(z!=null&&z.useAuthorizedPort&&nA.length===0){if(!z.silentNoAuthorizedPort){L("Chưa có cổng cân nào được trình duyệt cấp quyền. Hãy bấm Kết nối cân trước."),N(Le.Error);return}N(Le.Idle);return}const AA=Z??await $.requestPort(e);Z||await W(),await F(AA),k.current=AA,y.current=!1,B.current+=1,N(Le.Connected),P.current=H(AA,B.current)}catch(nA){await U(),L(Sd(nA)),N(Le.Error)}},[U,F,H,W,e,L,N]),_=V.useCallback(async()=>{if(!k.current&&O.current!==Le.Error){N(Le.Idle);return}N(Le.Disconnecting),b(void 0),await U(),N(Le.Idle)},[U,N]),G=V.useCallback(()=>{f([])},[]);return V.useEffect(()=>{const z=pa(),$=wd();w(!!z),I($),p(z?"navigator.serial: có":"navigator.serial: không"),W()},[W]),V.useEffect(()=>{if(!o){R.current=!1;return}if(R.current)return;R.current=!0,(async()=>{(await W()).length===1&&eA({useAuthorizedPort:!0,authorizedPortIndex:0,silentNoAuthorizedPort:!0})})()},[o,eA,W]),V.useEffect(()=>()=>{U()},[U]),{status:l,supportInfo:u,error:g,lines:h,reading:C,authorizedPorts:q,isSupported:v,isSecureContext:E,connect:eA,disconnect:_,clearLines:G}},TT=({targets:A=[],defaultTargetName:e,selectedTargetName:t,defaultBaudRate:o=Kf,defaultAutoApply:r=!0,applyLatestOnTargetChange:i=!0,autoApplyIntervalMs:a=0,autoConnectAuthorized:s=!0,allowRequestPort:l=!0,lineLimit:d,requestOptions:u,onReading:p,onApply:g,sx:m})=>{const[h,f]=V.useState(e??""),C=V.useRef(void 0),b=V.useRef(void 0),q=V.useRef(void 0),x=V.useMemo(()=>Array.isArray(m)?m:m?[m]:[],[m]),v=t??h,w=V.useMemo(()=>A.find(N=>N.name===v),[v,A]),E=V.useMemo(()=>({baudRate:o,dataBits:8,stopBits:1,parity:Hl.None}),[o]),{status:I,reading:k,authorizedPorts:T,connect:M,disconnect:P}=_f({serialOptions:E,requestOptions:u,lineLimit:d,autoConnectAuthorized:s,onReading:p}),y=I===Le.Connected,B=I===Le.Connecting||I===Le.Disconnecting,O=V.useCallback(N=>{t===void 0&&f(N)},[t]),R=V.useCallback(async()=>{var L;if(!y||!w||!(k!=null&&k.value)||w.disabled)return;const N=Date.now();if(b.current!==k.value&&!(C.current&&N-C.current<a))try{C.current=N,b.current=k.value,await((L=w.onApply)==null?void 0:L.call(w,k)),g==null||g(k,w)}catch{}},[w,a,y,g,k]);return V.useEffect(()=>{if(!A.length){O("");return}if(w||!e)return;const N=A.find(L=>L.name===e);N&&O(N.name)},[w,e,O,A]),V.useEffect(()=>{!r||!(k!=null&&k.receivedAt)||C.current===k.receivedAt||R()},[R,r,k==null?void 0:k.receivedAt]),V.useEffect(()=>{q.current!==v&&(q.current=v,!(!r||!i||!(k!=null&&k.value))&&R())},[v,i,R,r,k==null?void 0:k.value]),c.jsxs(ve,{sx:[{gap:RA,flexWrap:"wrap"},...x],children:[y?c.jsx(Ge,{content:"Ngắt kết nối",startIcon:"link_off",variant:"outlined",color:"error",loading:B,disabled:B,onClick:()=>P()}):null,!y&&T.length===1?c.jsx(W0,{content:`Kết nối ${T[0].label} đã được trình duyệt cấp quyền.`,children:c.jsx(Ge,{content:T[0].label,startIcon:"scale",variant:"outlined",loading:B,disabled:B,onClick:()=>M({useAuthorizedPort:!0,authorizedPortIndex:T[0].index})})}):null,!y&&T.length>1?T.map(N=>c.jsx(W0,{content:`Kết nối ${N.label}`,children:c.jsx(Ge,{content:N.label,startIcon:"scale",variant:"outlined",loading:B,disabled:B,onClick:()=>M({useAuthorizedPort:!0,authorizedPortIndex:N.index})})},N.index)):null,!y&&l?c.jsx(W0,{content:"Kết nối cân mới trong danh sách cân đã được cấp quyền truy cập.",children:c.jsx(Ge,{content:I===Le.Connecting?"Đang kết nối...":T.length?"Kết nối cân khác":"Kết nối cân",startIcon:"usb",loading:B,disabled:B,onClick:()=>M()})}):null]})},OT=({label:A,count:e=0,color:t,icon:o,info:r,bgColor:i})=>c.jsxs(D.Card,{sx:{minHeight:116,borderRadius:Xt},children:[c.jsx(D.CardHeader,{action:c.jsx(D.IconButton,{"aria-label":"settings",children:c.jsx(vA,{icon:"more_vert"})}),title:c.jsx(D.Typography,{variant:"h6",sx:{fontSize:"16px"},color:"#737373",children:A})}),c.jsx(D.CardContent,{sx:{paddingTop:0},children:c.jsxs(D.Stack,{gap:.5,children:[c.jsxs(it,{width:"100%",children:[c.jsx(D.Typography,{variant:"h2",sx:{color:t,fontSize:"32px"},children:e}),c.jsx(wn,{sx:{bgcolor:gn(i,.85),borderRadius:Xt,width:48,height:48},children:c.jsx("img",{src:o})})]}),r]})})]}),kT=({label:A="",placeholder:e="Select option",value:t=null,disabled:o=!1,error:r=!1,success:i=!1,errorMessage:a,successMessage:s,borderRadius:l=6,onChange:d,helperText:u="",options:p=[],checkIconColor:g=$t[900],required:m=!1,sx:h,labelSx:f})=>{const C=V.useMemo(()=>l==="max"?"100px":`${l}px`,[l]),b=V.useMemo(()=>p.find(E=>E.value===t),[p,t]),q=V.useCallback(()=>r&&a?a:i&&s?s:u||"",[r,a,i,s,u]),x=V.useCallback(()=>r?x0[500]:i?Yo[500]:de[400],[r,i]),v=V.useCallback(()=>r?x0[500]:i?Yo[500]:de[300],[r,i]),w=V.useMemo(()=>({"& .MuiOutlinedInput-root":{borderRadius:`${C} !important`,backgroundColor:o?de[100]:"white",transition:"all 0.2s ease","& fieldset":{borderRadius:`${C} !important`,borderColor:v()},"&:hover fieldset":{borderColor:o?v():r?x0[500]:de[400]},"&.Mui-focused fieldset":{borderColor:r?x0[500]:de[400],borderWidth:"1px"}},"& .MuiOutlinedInput-input":{padding:"8px 10px",color:ot[900],"&::placeholder":{color:de[400],opacity:1}}}),[C,o,r,v]);return c.jsxs(D.Box,{sx:{...h},children:[A&&c.jsxs(D.Box,{sx:{display:"flex",alignItems:"baseline",gap:"2px",marginBottom:"4px"},children:[c.jsx(D.Typography,{sx:{...QA.textMd,color:ot[800],...f},children:A}),m&&c.jsx(D.Typography,{sx:{color:x0[500],...QA.textMd},children:"*"})]}),c.jsx(D.Select,{fullWidth:!0,value:t||"",onChange:E=>{const I=E.target.value,k=p.find(T=>String(T.value)===String(I));k&&(d==null||d(k.value))},disabled:o,displayEmpty:!0,MenuProps:{disableScrollLock:!0},slotProps:{root:{sx:{borderRadius:C}}},renderValue:()=>t?c.jsxs(D.Box,{sx:{display:"flex",alignItems:"center",gap:"8px"},children:[(b==null?void 0:b.statusIndicator)&&c.jsx(D.Box,{sx:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:"#4CAF50"}}),(b==null?void 0:b.avatar)&&c.jsx(D.Avatar,{src:b.avatar,sx:{width:"24px",height:"24px",fontSize:"12px"}}),(b==null?void 0:b.icon)&&c.jsx(vA,{icon:b.icon}),c.jsx(D.Typography,{sx:{color:ot[900],...QA.textMd,lineHeight:"1.4375em"},children:b==null?void 0:b.label})]}):c.jsx(D.Typography,{sx:{color:de[400],...QA.textMd,lineHeight:"1.4375em"},children:e}),sx:w,children:p.map(E=>c.jsx(D.MenuItem,{value:E.value,children:c.jsxs(D.Box,{sx:{display:"flex",alignItems:"center",gap:"8px",width:"100%"},children:[E.statusIndicator&&c.jsx(D.Box,{sx:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:"#4CAF50"}}),E.avatar&&c.jsx(D.Avatar,{src:E.avatar,sx:{width:"24px",height:"24px",fontSize:"12px"}}),E.icon&&c.jsx(vA,{icon:E.icon}),c.jsx(D.Typography,{sx:{color:ot[900],...QA.textMd,lineHeight:"1.4375em"},children:E.label}),t===E.value&&c.jsx(D.Box,{sx:{marginLeft:"auto",display:"flex",alignItems:"center"},children:c.jsx(vA,{icon:"check",sx:{color:g}})})]})},E.value))}),q()&&c.jsx(D.Box,{sx:{color:x(),marginTop:"4px",...QA.textMd,lineHeight:"1.4375em"},children:q()})]})},MT=D.styled(D.Autocomplete)(()=>({"& .MuiOutlinedInput-root":{padding:"4px 10px !important",display:"flex",alignItems:"center",gap:"4px","& fieldset":{borderColor:de[300]},"&:hover fieldset":{borderColor:de[400]},"&.Mui-focused fieldset":{borderColor:de[300]+" !important",borderWidth:"1.5px"},"&.Mui-disabled":{backgroundColor:de[100],"& fieldset":{borderColor:de[200]}},"&.Mui-error fieldset":{borderColor:x0[500]},"&.Mui-success fieldset":{borderColor:Yo[500]}},"& .MuiInputBase-input":{padding:"4px 4px !important",fontSize:"14px",flex:1,minWidth:"60px","&::placeholder":{color:de[400],opacity:1},"&.Mui-disabled":{color:de[400],WebkitTextFillColor:de[400]}},"& .MuiAutocomplete-endAdornment":{paddingRight:"4px"},"& .MuiAutocomplete-tag":{backgroundColor:$t[50],border:`1px solid ${$t[200]}`,color:$t[900],fontSize:"12px",margin:"2px","& .MuiChip-deleteIcon":{color:$t[400],"&:hover":{color:$t[600]}}},"& .search-dropdown-limit-badge":{backgroundColor:$t[50],border:`1px solid ${$t[200]}`,color:$t[700],...QA.textSmall.semiBold,margin:"2px"}})),PT=({value:A,onChange:e,onClear:t,onInputChange:o,onSearch:r,borderRadius:i=4,disabled:a=!1,multiple:s=!1,limitTags:l=2,label:d="",placeholder:u="Search...",error:p=!1,errorMessage:g,success:m=!1,successMessage:h,helperText:f="",options:C=[],loading:b=!1,iconBefore:q,required:x=!1,sx:v})=>{const[E,I]=V.useState(""),[k,T]=V.useState(C),[M,P]=V.useState(!1),y=V.useRef(null),B=V.useRef(r),O=V.useRef(o),R=V.useRef(C);V.useEffect(()=>{B.current=r,O.current=o,R.current=C},[r,o,C]);const N=V.useMemo(()=>A?(Array.isArray(A)?A:[A]).map(F=>typeof F=="object"?F:{label:String(F),value:F}):[],[A]);V.useEffect(()=>{if(y.current&&clearTimeout(y.current),!E.trim()){T(R.current);return}return y.current=setTimeout(async()=>{var F;const U=B.current;if(U){P(!0);try{const W=await U(E);T(W)}catch(W){console.error("Search error:",W),T([])}finally{P(!1)}}else{const W=R.current.filter(eA=>eA.label.toLowerCase().includes(E.toLowerCase()));T(W)}(F=O.current)==null||F.call(O,E)},500),()=>{y.current&&clearTimeout(y.current)}},[E]);const L=(U,F)=>{I(F)},X=(U,F)=>{if(s){const W=Array.isArray(F)?F:F?[F]:[];e==null||e(W.length>0?W:null),I("")}else e==null||e(F||null)},H=()=>{I(""),T(R.current),e==null||e(null),t==null||t()};return c.jsxs(D.Box,{sx:{width:"100%",...v},children:[d&&c.jsxs(D.Box,{sx:{display:"flex",alignItems:"baseline",gap:"2px",marginBottom:"6px"},children:[c.jsx(D.Typography,{sx:{...QA.textMd,color:ot[900],display:"block"},children:d}),x&&c.jsx(D.Typography,{sx:{color:x0[500],...QA.textMd},children:"*"})]}),c.jsx(MT,{multiple:s,freeSolo:!1,options:k,getOptionLabel:U=>U?typeof U=="object"&&"label"in U?U.label:String(U):"",isOptionEqualToValue:(U,F)=>!U||!F?!1:typeof U=="object"&&typeof F=="object"&&"value"in U&&"value"in F?U.value===F.value:!1,value:s?N:N[0]||null,inputValue:E,onInputChange:L,onChange:X,disabled:a||b,loading:M||b,noOptionsText:E?"No results found":"Type to search",slotProps:{paper:{sx:{"& .MuiAutocomplete-listbox":{borderRadius:i==="max"?"0 0 100px 100px":`0 0 ${i}px ${i}px`}}}},renderInput:U=>c.jsx(D.TextField,{...U,placeholder:N&&(N==null?void 0:N.length)>0?"":u,variant:"outlined",size:"small",error:p,sx:{"& .MuiOutlinedInput-root":{borderRadius:i==="max"?"100px !important":`${i}px !important`,"& fieldset":{borderRadius:i==="max"?"100px !important":`${i}px !important`}}},InputProps:{...U.InputProps,startAdornment:c.jsxs(c.Fragment,{children:[c.jsx(D.InputAdornment,{position:"start",sx:{marginLeft:"4px",marginRight:"0px"},children:q||c.jsx(vA,{icon:"search",sx:{color:"#999",fontSize:"18px"}})}),U.InputProps.startAdornment]})}}),renderTags:(U,F)=>{const W=Array.isArray(U)?U:[],eA=s?W.slice(0,l):W,_=W.length-eA.length;return c.jsxs(c.Fragment,{children:[eA.map((G,z)=>{const $=typeof G=="object"&&G&&"label"in G?G.label:String(G);return V.createElement(D.Chip,{...F({index:z}),key:z,label:$,size:"small"})}),_>0&&c.jsx(D.Chip,{className:"search-dropdown-limit-badge",label:`+${_}`,size:"small"})]})},renderOption:(U,F)=>{const{key:W,...eA}=U,_=(F==null?void 0:F.label)||"";return c.jsx(D.Box,{...eA,component:"li",children:_},W)},componentsProps:{clearIndicator:{onClick:H}}}),p&&g&&c.jsx(D.Box,{sx:{fontSize:"12px",color:x0[500],marginTop:"4px"},children:g}),m&&h&&c.jsx(D.Box,{sx:{fontSize:"12px",color:Yo[500],marginTop:"4px"},children:h}),f&&!p&&!m&&c.jsx(D.Box,{sx:{fontSize:"12px",color:de[500],marginTop:"4px"},children:f})]})};exports.APPS=Y5;exports.AdvancedFilterDialog=vI;exports.AdvancedOperatorFilterDialog=qI;exports.AppGrid=Ql;exports.AppGridItem=Ll;exports.AppGroup=bA;exports.AppsSidebar=zf;exports.AvatarElement=rt;exports.AvatarGroupElement=Vu;exports.AvatarOnlineStatusElement=Tg;exports.AvatarUserInfo=Mg;exports.AvatarUserInfoDetail=Og;exports.AvatarUserInfoUpdate=kg;exports.BORDER_TABLE=Cn;exports.BorderLinearProgress=yg;exports.BreadcrumbElement=Pg;exports.ButtonElement=Ge;exports.ButtonIconContentOpacityElement=Rg;exports.ButtonIconElement=cs;exports.ButtonImageElement=pI;exports.ButtonUploadFileElement=Nl;exports.COLOR=n4;exports.CardStatisticsComponent=OT;exports.CheckboxElement=Wa;exports.CollapsibleSection=CI;exports.ColumnSettingsPopover=hI;exports.DATE_OPERATOR_OPTIONS=Pf;exports.DATE_OPTIONS=Rf;exports.DISABLED_DEFAULT=cr;exports.DashedDividerElement=bI;exports.DateFilterMacro=ye;exports.DefaultLayout=YI;exports.DialogConfirmActionElement=Hg;exports.DialogElement=ds;exports.DirectionProps=dr;exports.DropdownFieldComponent=kT;exports.EmptyComponent=po;exports.Environment=n0;exports.FIELD_WIDTH=Tf;exports.FINISH_GOOD_IMAGE_GALLERY=o4;exports.FULL_OPERATOR_OPTIONS=kf;exports.FilterOperator=A0;exports.FilterSlider=wI;exports.FinishGoodImageGalleryElement=cI;exports.FlowControlWebSerialScaleEvent=Jf;exports.GROUP_ICONS=Od;exports.HttpStatusSpecial=Id;exports.ICONS=JA;exports.IconContentBadgeElement=uo;exports.IconContentBadgeSubsElement=zu;exports.IconContentBadgeSubsVerticalElement=Nu;exports.IconContentElement=c0;exports.IconElement=vA;exports.ImageBorderDashboard=qg;exports.ImageBrand=xg;exports.ImageContentCaptionComponent=dI;exports.ImageContentTimeComponent=uI;exports.ImageElement=B0;exports.ImageEmpty=is;exports.ImageGalleryElement=Df;exports.ImageGalleryVariant=L2;exports.InputLabelCustom=wg;exports.LinkElement=An;exports.LinkWrapProductRow=Sg;exports.ListIconContentElement=Ff;exports.LoadingComponent=qt;exports.LogoComponent=KI;exports.LogoName=Hf;exports.MODE=y0;exports.Mode=ur;exports.MotionBox=Er;exports.NoteComponent=XI;exports.OPERATOR_OPTIONS=Mf;exports.OPERATOR_WIDTH=Ga;exports.OTHER=a4;exports.OnlineBadge=Wu;exports.OrderType=Td;exports.PaginationElement=SI;exports.PaperSelect=as;exports.ParityWebSerialScaleSerial=Hl;exports.PriceComponent=JI;exports.RadioElement=DI;exports.RadioGroupElement=EI;exports.ReviewComponent=pT;exports.STYLE=v4;exports.SearchDropdownComponent=PT;exports.SectionTitle=BI;exports.SevagoProvider=uT;exports.SidebarLeftComponent=ST;exports.SidebarLeftLibraryComponent=Yf;exports.SizeProps=Kt;exports.SmallIcon=u2;exports.SnackbarType=v2;exports.StackAlignCenter=J0;exports.StackAlignCenterJustAround=P8;exports.StackAlignCenterJustBetween=M8;exports.StackAlignCenterJustCenter=Iu;exports.StackAlignCenterJustEnd=k8;exports.StackAlignCenterJustEvenly=R8;exports.StackAlignEnd=u8;exports.StackAlignEndJustAround=H8;exports.StackAlignEndJustBetween=U8;exports.StackAlignEndJustCenter=L8;exports.StackAlignEndJustEnd=Q8;exports.StackAlignEndJustEvenly=z8;exports.StackAlignJustCenter=xr;exports.StackAlignStart=d8;exports.StackAlignStartJustAround=S8;exports.StackAlignStartJustBetween=w8;exports.StackAlignStartJustCenter=x8;exports.StackAlignStartJustEnd=q8;exports.StackAlignStartJustEvenly=E8;exports.StackBgDefaultBorRadLayCol=ku;exports.StackBgPaperBorRadLayCol=Cg;exports.StackJustAround=h8;exports.StackJustBetween=m8;exports.StackJustCenter=Du;exports.StackJustEnd=g8;exports.StackJustEvenly=C8;exports.StackLabel=Mu;exports.StackRow=Ne;exports.StackRowAlignCenter=ve;exports.StackRowAlignCenterJustAround=F8;exports.StackRowAlignCenterJustBetween=it;exports.StackRowAlignCenterJustCenter=Tu;exports.StackRowAlignCenterJustEnd=N8;exports.StackRowAlignCenterJustEvenly=j8;exports.StackRowAlignEnd=f8;exports.StackRowAlignEndJustAround=Y8;exports.StackRowAlignEndJustBetween=G8;exports.StackRowAlignEndJustCenter=V8;exports.StackRowAlignEndJustEnd=W8;exports.StackRowAlignEndJustEvenly=K8;exports.StackRowAlignJustCenter=wn;exports.StackRowAlignStart=p8;exports.StackRowAlignStartJustAround=T8;exports.StackRowAlignStartJustBetween=I8;exports.StackRowAlignStartJustCenter=D8;exports.StackRowAlignStartJustEnd=B8;exports.StackRowAlignStartJustEvenly=O8;exports.StackRowJustAround=y8;exports.StackRowJustBetween=ti;exports.StackRowJustCenter=b8;exports.StackRowJustEnd=Bu;exports.StackRowJustEvenly=v8;exports.StackRowWrap=l8;exports.StackRowWrapAlignCenter=J8;exports.StackRowWrapAlignCenterJustAround=dg;exports.StackRowWrapAlignCenterJustBetween=cg;exports.StackRowWrapAlignCenterJustCenter=sg;exports.StackRowWrapAlignCenterJustEnd=lg;exports.StackRowWrapAlignCenterJustEvenly=ug;exports.StackRowWrapAlignEnd=Z8;exports.StackRowWrapAlignEndJustAround=mg;exports.StackRowWrapAlignEndJustBetween=gg;exports.StackRowWrapAlignEndJustCenter=pg;exports.StackRowWrapAlignEndJustEnd=fg;exports.StackRowWrapAlignEndJustEvenly=hg;exports.StackRowWrapAlignJustCenter=Ou;exports.StackRowWrapAlignStart=X8;exports.StackRowWrapAlignStartJustAround=ig;exports.StackRowWrapAlignStartJustBetween=rg;exports.StackRowWrapAlignStartJustCenter=ng;exports.StackRowWrapAlignStartJustEnd=og;exports.StackRowWrapAlignStartJustEvenly=ag;exports.StackRowWrapJustAround=eg;exports.StackRowWrapJustBetween=Ag;exports.StackRowWrapJustCenter=_8;exports.StackRowWrapJustEnd=$8;exports.StackRowWrapJustEvenly=tg;exports.StackTabs=Pu;exports.StackWrap=c8;exports.Status=Md;exports.StyledTab=ju;exports.StyledTableCell=bg;exports.StyledTabs=Fu;exports.SwitchContentElement=II;exports.SwitchElement=jf;exports.SystemMonitorScreen=BT;exports.SystemMonitorSidebarPart=ET;exports.TAB_BACKGROUND_STYLES=ls;exports.TAB_STYLES=ss;exports.TAB_WRAPPER_STYLES=Lu;exports.TabSizeProps=kd;exports.TableActions=Fl;exports.TableCollapseComponent=LI;exports.TableComponent=UI;exports.TableRowKey=co;exports.TabsBadgeComponent=Bg;exports.TabsBadgeSubsVerticalComponent=Ru;exports.TabsComponent=Hu;exports.TabsMotionBase=Uu;exports.TagElement=sf;exports.TextFieldDateElement=Af;exports.TextFieldDateRangeElement=Lp;exports.TextFieldDateTimeElement=IE;exports.TextFieldElement=wD;exports.TextFieldEmailAutocomplete=$E;exports.TextFieldHourMinuteElement=AD;exports.TextFieldLabelElement=nt;exports.TextFieldMonthYearElement=eD;exports.TextFieldNumberElement=tD;exports.TextFieldSearchCustomElement=nD;exports.TextFieldSearchElement=ef;exports.TextFieldSelectElement=w0;exports.TextFieldSelectSearchObjectElement=oD;exports.TextFieldTimeElement=gD;exports.TextFieldTimeRangeElement=vD;exports.TextFieldUploadImageElement=xD;exports.TextFieldUploadImagesElement=qD;exports.TimeAgoComponent=Bf;exports.TimeAgoContentComponent=If;exports.TooltipOnClickElement=Dg;exports.TooltipOnHoverElement=W0;exports.TypographyAnimatedIconImage=PD;exports.TypographyContentCaption=af;exports.TypographyFilter=Eg;exports.TypographyGridInfoRow=RD;exports.TypographyInfoRow=ND;exports.TypographyInfoUser=FD;exports.TypographyOneLine=Dn;exports.UserInfo=HI;exports.VALUE_WIDTH=Of;exports.VariantProps=x2;exports.WEB_SERIAL_SCALE_DEFAULT_BAUD_RATE=Kf;exports.WEB_SERIAL_SCALE_DEFAULT_LINE_LIMIT=Xf;exports.WebSerialScaleControllerElement=TT;exports.WebSerialScaleStatus=Le;exports.WrapperCenterElement=GI;exports.WrapperChartElement=zI;exports.WrapperContentElement=VI;exports.WrapperElement=WI;exports.animationPresets=Gu;exports.arrayUtil=L4;exports.clearSidebarRouteByPermission=Vf;exports.delayUtil=H4;exports.fileUtil=X4;exports.findSidebarRouteFromPathName=Gf;exports.genSidebarTabsFromRoute=Wf;exports.generateId=S0;exports.getActionBarSx=Sr;exports.getPickerSx=qr;exports.getPopperProps=wr;exports.getStyleCell=Qf;exports.getStyleRow=Uf;exports.getSxArray=Lf;exports.hasSelectedSidebarChild=Ul;exports.highlightText=SD;exports.highlightYellow=Ha;exports.mergeSidebarLeftSx=y2;exports.mergeSxProps=qn;exports.numberUtil=_4;exports.objectUtil=k4;exports.otherUtil=i9;exports.parseDateMacroToTimestamp=Nf;exports.parseWebSerialScaleReading=Zf;exports.productManagementApi=l5;exports.stringUtil=D4;exports.tableArgTypes=QI;exports.timeUtil=k9;exports.useTabsSelected=Qu;exports.useWebSerialScale=_f;
264
+ `);class dT{constructor({locale:e,formats:t}={}){yA(this,"isMUIAdapter",!0);yA(this,"isTimezoneCompatible",!0);yA(this,"lib","dayjs");yA(this,"escapedCharacters",{start:"[",end:"]"});yA(this,"formatTokenMap",lT);yA(this,"setLocaleToValue",e=>{const t=this.getCurrentLocaleCode();return t===e.locale()?e:e.locale(t)});yA(this,"hasUTCPlugin",()=>typeof DA.utc<"u");yA(this,"hasTimezonePlugin",()=>typeof DA.tz<"u");yA(this,"isSame",(e,t,o)=>{const r=this.setTimezone(t,this.getTimezone(e));return e.format(o)===r.format(o)});yA(this,"cleanTimezone",e=>{switch(e){case"default":return;case"system":return DA.tz.guess();default:return e}});yA(this,"createSystemDate",e=>{let t;if(this.hasUTCPlugin()&&this.hasTimezonePlugin()){const o=DA.tz.guess();o==="UTC"?t=DA(e):t=DA.tz(e,o)}else t=DA(e);return this.setLocaleToValue(t)});yA(this,"createUTCDate",e=>{if(!this.hasUTCPlugin())throw new Error(ua);return this.setLocaleToValue(DA.utc(e))});yA(this,"createTZDate",(e,t)=>{if(!this.hasUTCPlugin())throw new Error(ua);if(!this.hasTimezonePlugin())throw new Error(qd);const o=e!==void 0&&!e.endsWith("Z");return this.setLocaleToValue(DA(e).tz(this.cleanTimezone(t),o))});yA(this,"getLocaleFormats",()=>{const e=DA.Ls,t=this.locale||"en";let o=e[t];return o===void 0&&(process.env.NODE_ENV!=="production"&&M3(["MUI X: Your locale has not been found.","Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale.","Or you forget to import the locale from 'dayjs/locale/{localeUsed}'","fallback on English locale."]),o=e.en),o.formats});yA(this,"adjustOffset",e=>{if(!this.hasTimezonePlugin())return e;const t=this.getTimezone(e);if(t!=="UTC"){const o=e.tz(this.cleanTimezone(t),!0);if(o.$offset===(e.$offset??0))return e;e.$offset=o.$offset}return e});yA(this,"date",(e,t="default")=>e===null?null:t==="UTC"?this.createUTCDate(e):t==="system"||t==="default"&&!this.hasTimezonePlugin()?this.createSystemDate(e):this.createTZDate(e,t));yA(this,"getInvalidDate",()=>DA(new Date("Invalid date")));yA(this,"getTimezone",e=>{var t;if(this.hasTimezonePlugin()){const o=(t=e.$x)==null?void 0:t.$timezone;if(o)return o}return this.hasUTCPlugin()&&e.isUTC()?"UTC":"system"});yA(this,"setTimezone",(e,t)=>{if(this.getTimezone(e)===t)return e;if(t==="UTC"){if(!this.hasUTCPlugin())throw new Error(ua);return e.utc()}if(t==="system")return e.local();if(!this.hasTimezonePlugin()){if(t==="default")return e;throw new Error(qd)}return this.setLocaleToValue(DA.tz(e,this.cleanTimezone(t)))});yA(this,"toJsDate",e=>e.toDate());yA(this,"parse",(e,t)=>e===""?null:DA(e,t,this.locale,!0));yA(this,"getCurrentLocaleCode",()=>this.locale||"en");yA(this,"is12HourCycleInCurrentLocale",()=>/A|a/.test(this.getLocaleFormats().LT||""));yA(this,"expandFormat",e=>{const t=this.getLocaleFormats(),o=r=>r.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(i,a,s)=>a||s.slice(1));return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(r,i,a)=>{const s=a&&a.toUpperCase();return i||t[a]||o(t[s])})});yA(this,"isValid",e=>e==null?!1:e.isValid());yA(this,"format",(e,t)=>this.formatByString(e,this.formats[t]));yA(this,"formatByString",(e,t)=>this.setLocaleToValue(e).format(t));yA(this,"formatNumber",e=>e);yA(this,"isEqual",(e,t)=>e===null&&t===null?!0:e===null||t===null?!1:e.toDate().getTime()===t.toDate().getTime());yA(this,"isSameYear",(e,t)=>this.isSame(e,t,"YYYY"));yA(this,"isSameMonth",(e,t)=>this.isSame(e,t,"YYYY-MM"));yA(this,"isSameDay",(e,t)=>this.isSame(e,t,"YYYY-MM-DD"));yA(this,"isSameHour",(e,t)=>e.isSame(t,"hour"));yA(this,"isAfter",(e,t)=>e>t);yA(this,"isAfterYear",(e,t)=>this.hasUTCPlugin()?!this.isSameYear(e,t)&&e.utc()>t.utc():e.isAfter(t,"year"));yA(this,"isAfterDay",(e,t)=>this.hasUTCPlugin()?!this.isSameDay(e,t)&&e.utc()>t.utc():e.isAfter(t,"day"));yA(this,"isBefore",(e,t)=>e<t);yA(this,"isBeforeYear",(e,t)=>this.hasUTCPlugin()?!this.isSameYear(e,t)&&e.utc()<t.utc():e.isBefore(t,"year"));yA(this,"isBeforeDay",(e,t)=>this.hasUTCPlugin()?!this.isSameDay(e,t)&&e.utc()<t.utc():e.isBefore(t,"day"));yA(this,"isWithinRange",(e,[t,o])=>e>=t&&e<=o);yA(this,"startOfYear",e=>this.adjustOffset(e.startOf("year")));yA(this,"startOfMonth",e=>this.adjustOffset(e.startOf("month")));yA(this,"startOfWeek",e=>this.adjustOffset(this.setLocaleToValue(e).startOf("week")));yA(this,"startOfDay",e=>this.adjustOffset(e.startOf("day")));yA(this,"endOfYear",e=>this.adjustOffset(e.endOf("year")));yA(this,"endOfMonth",e=>this.adjustOffset(e.endOf("month")));yA(this,"endOfWeek",e=>this.adjustOffset(this.setLocaleToValue(e).endOf("week")));yA(this,"endOfDay",e=>this.adjustOffset(e.endOf("day")));yA(this,"addYears",(e,t)=>this.adjustOffset(e.add(t,"year")));yA(this,"addMonths",(e,t)=>this.adjustOffset(e.add(t,"month")));yA(this,"addWeeks",(e,t)=>this.adjustOffset(e.add(t,"week")));yA(this,"addDays",(e,t)=>this.adjustOffset(e.add(t,"day")));yA(this,"addHours",(e,t)=>this.adjustOffset(e.add(t,"hour")));yA(this,"addMinutes",(e,t)=>this.adjustOffset(e.add(t,"minute")));yA(this,"addSeconds",(e,t)=>this.adjustOffset(e.add(t,"second")));yA(this,"getYear",e=>e.year());yA(this,"getMonth",e=>e.month());yA(this,"getDate",e=>e.date());yA(this,"getHours",e=>e.hour());yA(this,"getMinutes",e=>e.minute());yA(this,"getSeconds",e=>e.second());yA(this,"getMilliseconds",e=>e.millisecond());yA(this,"setYear",(e,t)=>this.adjustOffset(e.set("year",t)));yA(this,"setMonth",(e,t)=>this.adjustOffset(e.set("month",t)));yA(this,"setDate",(e,t)=>this.adjustOffset(e.set("date",t)));yA(this,"setHours",(e,t)=>this.adjustOffset(e.set("hour",t)));yA(this,"setMinutes",(e,t)=>this.adjustOffset(e.set("minute",t)));yA(this,"setSeconds",(e,t)=>this.adjustOffset(e.set("second",t)));yA(this,"setMilliseconds",(e,t)=>this.adjustOffset(e.set("millisecond",t)));yA(this,"getDaysInMonth",e=>e.daysInMonth());yA(this,"getWeekArray",e=>{const t=this.startOfWeek(this.startOfMonth(e)),o=this.endOfWeek(this.endOfMonth(e));let r=0,i=t;const a=[];for(;i<o;){const s=Math.floor(r/7);a[s]=a[s]||[],a[s].push(i),i=this.addDays(i,1),r+=1}return a});yA(this,"getWeekNumber",e=>e.week());yA(this,"getYearRange",([e,t])=>{const o=this.startOfYear(e),r=this.endOfYear(t),i=[];let a=o;for(;this.isBefore(a,r);)i.push(a),a=this.addYears(a,1);return i});this.locale=e,this.formats=j({},cT,t),DA.extend(of)}getDayOfWeek(e){return e.day()+1}}function uT({children:A}){return c.jsx(ri,{dateAdapter:dT,children:A})}const pT=({averageRating:A,reviewCount:e,onClick:t,sx:o={}})=>(t&&(o={...o,cursor:"pointer"}),c.jsxs(ve,{sx:{gap:RA,cursor:"inherit",...o},onClick:t,children:[c.jsx(vA,{icon:"star",size:"large",fill:1,color:"warning",sx:{margin:"-5px"}}),c.jsxs(Ne,{sx:{gap:RA},children:[c.jsx(D.Typography,{lineHeight:1,children:A}),c.jsx(D.Typography,{lineHeight:1,children:`(${e})`})]})]})),zf=({isOpen:A,onClose:e,position:t="left",blacklist:o=[],env:r,onClickApp:i,isLongSubDomain:a=!1})=>{if(!A)return null;const s=Object.keys(Yn).reduce((l,d)=>{if(o.includes(d))return l;const u=Yn[d];return a&&(u.path.develop=u.path.develop.replace("dev.","develop."),u.path.staging=u.path.staging.replace("sta.","staging.")),l[u.group]?l[u.group].push(u):l[u.group]=[u],l},{});return c.jsxs(c.Fragment,{children:[c.jsx(D.Stack,{onClick:e,sx:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:100}}),c.jsxs(D.Stack,{preset:"fadeInLeft",component:Er,sx:{position:"fixed",top:0,left:t==="left"?0:"auto",right:t==="right"?0:"auto",height:"100%",backgroundColor:pr[50],zIndex:100,padding:De,overflowY:"auto"},children:[c.jsxs(it,{children:[c.jsx(vA,{icon:"close",onClick:e}),c.jsx(vA,{icon:"home",onClick:()=>window.location.href=a?Go[r].replace("dev.","develop.").replace("sta.","staging."):Go[r]})]}),Object.keys(s).map(l=>c.jsxs(D.Stack,{children:[c.jsx(D.Typography,{variant:"subtitle2",children:l===bA.PLATFORM_AND_INFO?"Platform & Info":l}),c.jsx(Ql,{apps:s[l],iconSize:60,iconRadius:5.5,titleVariant:"body1",captionVariant:"caption",titleColor:ot[500],captionColor:ot[500],onClickApp:i,showPagination:!1})]},l))]})]})},fT="Ẩn điều hướng",o0={background:Kn[900],hoverBackground:"rgba(255, 255, 255, 0.08)",selectedBackground:"rgba(255, 255, 255, 0.16)",divider:"rgba(255, 255, 255, 0.18)",text:Ze[50],textMuted:pr[50]},gT=A=>({borderRight:0,width:A?ba:"max-content",minWidth:A?ba:Zd,padding:RA,gap:RA,backgroundColor:o0.background,justifyContent:"space-between",transition:`width ${ht}, min-width ${ht}`}),mT={overflowY:"auto",overflowX:"hidden",gap:0},hT={borderColor:o0.divider},CT={padding:RA,color:o0.text,borderRadius:s0,"&:hover":{backgroundColor:o0.hoverBackground}},bT=(A,e)=>({minHeight:A?34:36,gap:RA,padding:A?"6px 10px 6px 36px":"6px 10px",borderRadius:s0,color:o0.text,backgroundColor:e?o0.selectedBackground:"transparent",cursor:"pointer",transition:`background-color ${ht}`,"&:hover":{backgroundColor:e?o0.selectedBackground:o0.hoverBackground}}),yT={minWidth:0,flex:1,gap:RA},vT={},xT={},qT=A=>({color:o0.text,transform:A?"rotate(0deg)":"rotate(180deg)",transition:`transform ${ht}`}),wT=({tab:A,tabIdSelect:e,hiddenContent:t,isOpen:o,onClickTab:r,renderSubTabs:i})=>{var d;const a=A.id===e,s=!!((d=A.subs)!=null&&d.length),l=A.level>1;return c.jsxs(D.Stack,{gap:0,children:[c.jsx(W0,{placement:"right-end",content:A.name,disableHoverListener:!t,disableFocusListener:!t,disableTouchListener:!t,children:c.jsx(An,{component:A.href?"a":"span",href:A.href,onClick:()=>r(A),children:c.jsxs(it,{sx:bT(l,a),children:[c.jsxs(ve,{sx:yT,children:[!l&&A.icon&&c.jsx(vA,{icon:A.icon,sx:{color:o0.text}}),!t&&c.jsx(Dn,{content:A.name,sx:l?xT:vT})]}),!t&&s&&c.jsx(vA,{icon:"arrow_drop_up",sx:qT(o)})]})})}),!t&&s&&o&&c.jsx(D.Stack,{gap:0,children:i(A.subs)})]},A.id)},Vf=(A,e,t,o,r)=>{!A.children||!Object.keys(A.children).length||(Object.keys(A.children).forEach(i=>{const a=A.children[i],s=a.children&&Object.keys(a.children).length;let l=!1;(!a.isSidebar||!a.allowUserTypes.some(d=>e.includes(d))&&!e.includes(t))&&(delete A.children[i],l=!0),!l&&s&&Vf(a,e,t,i,A)}),!Object.keys(A.children).length&&o&&r&&delete r.children[o])},Wf=(A,e,t,o,r=1,i="/")=>A.children?Object.values(A.children).map(a=>{const l=`${i==="/"?"":i}/${a.path}`,d=a.children&&Object.keys(a.children).length,u={id:l,level:r,name:a.content,icon:a.icon,badgeCount:0,onClick:()=>{e(l),o(l),d||t(l)}};return d?u.subs=Wf(a,e,t,o,r+1,l):u.href=l,u}):[],Gf=(A,e,t="",o=[])=>{const r=decodeURIComponent(e.split("?")[0]),i=Object.values(A);if(i.length===0)return;const a=(d,u,p)=>{let g=d,m=u;const h=[...p];for(;g.children&&Object.keys(g.children).length>0;){const C=`${m}${g.path}`.replace(/\/+$/,"");C&&h.push(C);const b=Object.values(g.children);m=`${C}/`,g=b[0]}const f=`${m}${g.path}`.replace(/\/+$/,"");return{route:g,fullPath:f,parentPaths:h}};if(r==="/"||r==="")return a(i[0],t,o);const[s,l]=i.reduce((d,u)=>(d[u.path.includes(":")?1:0].push(u),d),[[],[]]);for(const d of[...s,...l]){const u=`${t}${d.path}`.replace(/\/+$/,"");if(!Vl.matchPath({path:u,end:!1},r))continue;const p=u?[...o,u]:[...o];if(d.children){const g=Gf(d.children,r,`${u}/`,p);if(g)return g}if(Vl.matchPath({path:u,end:!0},r)){if(d.children){const g=Object.values(d.children)[0];return g?a(g,`${u}/`,p):void 0}return{route:d,fullPath:d.path.includes(":")?r:u,parentPaths:o}}}},y2=(A,e)=>e?[A,...Array.isArray(e)?e:[e]]:A,Ul=(A,e)=>{var t;return!!((t=A.subs)!=null&&t.some(o=>o.id===e||Ul(o,e)))},Yf=({tabs:A,tabIdSelect:e,memoryOpen:t,hiddenContentDefault:o=!1,hiddenContentLabel:r=fT,onEmptyTabs:i,onHiddenContentChange:a,mainSx:s,tabsSx:l,footerSx:d,toggleSx:u})=>{const[p,g]=V.useState(o),[m,h]=V.useState({});V.useEffect(()=>{A.length||i==null||i()},[i,A.length]);const f=()=>{g(x=>{const v=!x;return a==null||a(v),v})},C=x=>{var v,w;(v=x.subs)!=null&&v.length&&!t&&h(E=>({...E,[x.id]:!E[x.id]})),(w=x.onClick)==null||w.call(x)},b=x=>!!((t==null?void 0:t[x.id])??m[x.id]??Ul(x,e)),q=x=>x.map(v=>c.jsx(wT,{tab:v,tabIdSelect:e,hiddenContent:p,isOpen:b(v),onClickTab:C,renderSubTabs:q},v.id));return c.jsxs(D.Stack,{sx:y2(gT(p),s),children:[A.length>0&&c.jsx(D.Stack,{sx:y2(mT,l),children:q(A)}),c.jsxs(D.Stack,{gap:1,sx:d,children:[c.jsx(D.Divider,{orientation:"horizontal",flexItem:!0,sx:hT}),c.jsx(c0,{onClick:f,icon:"menu_open",content:p?"":r,color:"inherit",hiddenContent:p,sx:y2(CT,u)})]})]})},ST=Yf,ET=({position:A,blacklist:e,env:t,onClickApp:o,showNameApps:r,showIconApps:i,showTitleApps:a,direction:s="row",isLongSubDomain:l=!1})=>{const[d,u]=V.useState(!1),p=Object.values(Yn).find(g=>Object.values(g.path).some(m=>{const h=m==null?void 0:m.trim();return h&&window.location.href.startsWith(h)}))??Yn.MASTER_DATA;return c.jsxs(ve,{children:[c.jsx(B0,{url:JA.iconApps,onClick:()=>u(!0),sizeType:"SQUARE"}),c.jsx(Ll,{app:p,iconSize:45,iconRadius:3,showNameApps:r,showIconApps:i,showTitleApps:a,direction:s}),c.jsx(zf,{isOpen:d,onClose:()=>u(!1),position:A,blacklist:e,env:t,onClickApp:o,isLongSubDomain:l})]})},DT={[bA.ALL]:"TẤT CẢ"},BT=({blacklist:A,onClickApp:e,sx:t={},sxTabs:o={},sxApps:r={},sxNotification:i={},gridTemplateColumns:a={xs:"72px minmax(0, 1fr) 72px",sm:"180px minmax(0, 1fr) 180px",md:"240px minmax(0, 1fr) 240px"},isLongSubDomain:s=!1,searchText:l="",notificationSlot:d,iconSize:u=80})=>{const p=P0(),[g,m]=V.useState(bA.ALL),h=D.useMediaQuery(p.breakpoints.down("sm")),f=D.useMediaQuery(p.breakpoints.down("md")),C=D.useMediaQuery(p.breakpoints.down("lg")),b=h?2:f?3:C?4:5,q=V.useMemo(()=>Object.entries(Yn).filter(([w])=>!(A!=null&&A.includes(w))).map(([,w])=>{const E=w;return s?{...E,path:{...E.path,develop:E.path.develop.replace("dev.","develop."),staging:E.path.staging.replace("sta.","staging.")}}:E}),[A,s]),x=V.useMemo(()=>q.filter(w=>g!==bA.ALL&&w.group!==g?!1:l?`${w.title??""} ${w.content}`.toLocaleLowerCase().includes(l.toLocaleLowerCase()):!0),[q,l,g]),v=V.useMemo(()=>Object.values(bA).filter(w=>w===bA.ALL||q.some(E=>E.group===w)),[q]);return c.jsxs(J0,{component:Er,preset:"fadeInUp",sx:[{display:"grid",gridTemplateColumns:a,columnGap:{xs:1,md:2},alignItems:"stretch",width:"100%",minHeight:"100%"},...Array.isArray(t)?t:[t]],children:[c.jsx(D.Stack,{sx:[{width:"100%",minWidth:0,gap:.5},...Array.isArray(o)?o:[o]],children:v.map(w=>{const E=g===w;return c.jsxs(ve,{onClick:()=>m(w),"aria-pressed":E,sx:{minHeight:40,p:RA,justifyContent:{xs:"center",sm:"flex-start"},border:0,borderRadius:Oe,color:E?p.palette.common.white:"rgba(255, 255, 255, 0.82)",backgroundColor:E?"rgba(255, 255, 255, 0.1)":"transparent",cursor:"pointer",transition:"background-color 160ms ease, color 160ms ease","&:hover":{color:p.palette.common.white,backgroundColor:E?"rgba(0, 138, 119, 0.3)":"rgba(255, 255, 255, 0.07)"}},children:[c.jsx(vA,{icon:Od[w]}),c.jsx(D.Typography,{sx:{display:{xs:"none",sm:"block"},...QA.textMd.regular},children:DT[w]??w})]},w)})}),c.jsx(D.Stack,{sx:[{flex:1,minWidth:0,gap:3},...Array.isArray(r)?r:[r]],children:x.length>0?c.jsx(Ql,{apps:x,columns:b,rows:3,iconSize:u,iconRadius:7,onClickApp:e,isShowAppHidden:!0},`${g}-${l}`):c.jsx(po,{content:"Không tìm thấy ứng dụng phù hợp"})}),c.jsx(D.Stack,{sx:[{width:"100%",minWidth:0},...Array.isArray(i)?i:[i]],children:d})]})},Kf=9600,Xf=20;var Le=(A=>(A.Idle="idle",A.Connecting="connecting",A.Connected="connected",A.Disconnecting="disconnecting",A.Error="error",A))(Le||{}),Hl=(A=>(A.None="none",A.Even="even",A.Odd="odd",A))(Hl||{}),Jf=(A=>(A.None="none",A.Hardware="hardware",A))(Jf||{});const pa=()=>{if(!(typeof navigator>"u"))return navigator.serial},wd=()=>typeof window>"u"?!1:window.isSecureContext,Sd=A=>{const e=A instanceof DOMException?A.name:A instanceof Error?A.constructor.name:"Unknown",t=A instanceof Error?A.message:String(A);return`[${e}] ${t}`},IT=A=>A.map((e,t)=>({index:t,label:`Cân ${t+1}`})),TT=(A,e)=>{var o;const t=(o=A.getInfo)==null?void 0:o.call(A);return!(!t||e.usbVendorId!=null&&t.usbVendorId!==e.usbVendorId||e.usbProductId!=null&&t.usbProductId!==e.usbProductId)},OT=(A,e)=>{const t=e==null?void 0:e.filters;return t!=null&&t.length?A.filter(o=>t.some(r=>TT(o,r))):A},Zf=A=>{const e=A.match(/[-+]?\d+(?:[.,]\d+)?/);if(!e)return;const t=e[0].replace(",","."),o=Number(t);return{rawLine:A,value:t,numericValue:Number.isFinite(o)?o:void 0,receivedAt:Date.now()}},_f=({serialOptions:A,requestOptions:e,lineLimit:t=Xf,autoConnectAuthorized:o=!1,parseReading:r=Zf,onReading:i,onStatusChange:a,onError:s})=>{const[l,d]=V.useState(Le.Idle),[u,p]=V.useState("Chưa kiểm tra"),[g,m]=V.useState(""),[h,f]=V.useState([]),[C,b]=V.useState(),[q,x]=V.useState([]),[v,w]=V.useState(!1),[E,I]=V.useState(!1),k=V.useRef(void 0),T=V.useRef(void 0),M=V.useRef(void 0),P=V.useRef(void 0),y=V.useRef(!0),B=V.useRef(0),O=V.useRef(Le.Idle),R=V.useRef(!1),N=V.useCallback(z=>{O.current=z,d(z),a==null||a(z)},[a]),L=V.useCallback(z=>{m(z),s==null||s(z)},[s]),X=V.useCallback(z=>{if(!z.trim())return;f(Z=>[...Z.slice(-(Math.max(t,1)-1)),z]);const $=r(z);if(!($!=null&&$.value))return;const cA=$.receivedAt??Date.now(),nA={...$,rawLine:$.rawLine??z,receivedAt:cA};b(nA),i==null||i(nA)},[t,i,r]),H=V.useCallback(async(z,$)=>{if(!z.readable)return;const cA=new TextDecoderStream;M.current=z.readable.pipeTo(cA.writable).catch(()=>{});const nA=cA.readable.getReader();T.current=nA;let Z="";try{for(;!y.current&&B.current===$;){const{value:AA,done:Y}=await nA.read();if(Y)break;if(!AA)continue;Z+=AA;const lA=Z.split(/\r?\n/);Z=lA.pop()??"",lA.forEach(X)}}catch(AA){if(!y.current&&B.current===$){const Y=Sd(AA);L(Y),N(Le.Error)}}finally{try{nA.releaseLock()}catch{}T.current===nA&&(T.current=void 0)}},[X,L,N]),U=V.useCallback(async()=>{y.current=!0,B.current+=1;const z=T.current;if(z)try{await z.cancel()}catch{}if(P.current)try{await P.current}catch{}if(M.current)try{await M.current}catch{}const $=k.current;if($)try{await $.close()}catch{}T.current=void 0,M.current=void 0,P.current=void 0,k.current=void 0},[]),F=V.useCallback(async z=>{try{await z.open(A);return}catch($){if(!($ instanceof DOMException)||$.name!=="InvalidStateError")throw $;k.current=z,await U(),await z.open(A)}},[U,A]),W=V.useCallback(async()=>{const z=pa();if(!z)return x([]),[];const $=OT(await z.getPorts(),e);return x(IT($)),$},[e]),eA=V.useCallback(async z=>{if(O.current===Le.Connecting||O.current===Le.Disconnecting)return;const $=pa(),cA=wd();if(w(!!$),I(cA),p($?"navigator.serial: có":"navigator.serial: không"),!cA){L("Web Serial API cần HTTPS hoặc localhost để trình duyệt cho phép truy cập cổng COM."),N(Le.Error);return}if(!$){L("Trình duyệt không hỗ trợ Web Serial API. Hãy dùng Chrome hoặc Edge."),N(Le.Error);return}b(void 0),N(Le.Connecting),m("");try{await U();const nA=z!=null&&z.useAuthorizedPort?await W():[],Z=nA[(z==null?void 0:z.authorizedPortIndex)??0]??nA[0];if(z!=null&&z.useAuthorizedPort&&nA.length===0){if(!z.silentNoAuthorizedPort){L("Chưa có cổng cân nào được trình duyệt cấp quyền. Hãy bấm Kết nối cân trước."),N(Le.Error);return}N(Le.Idle);return}const AA=Z??await $.requestPort(e);Z||await W(),await F(AA),k.current=AA,y.current=!1,B.current+=1,N(Le.Connected),P.current=H(AA,B.current)}catch(nA){await U(),L(Sd(nA)),N(Le.Error)}},[U,F,H,W,e,L,N]),_=V.useCallback(async()=>{if(!k.current&&O.current!==Le.Error){N(Le.Idle);return}N(Le.Disconnecting),b(void 0),await U(),N(Le.Idle)},[U,N]),G=V.useCallback(()=>{f([])},[]);return V.useEffect(()=>{const z=pa(),$=wd();w(!!z),I($),p(z?"navigator.serial: có":"navigator.serial: không"),W()},[W]),V.useEffect(()=>{if(!o){R.current=!1;return}if(R.current)return;R.current=!0,(async()=>{(await W()).length===1&&eA({useAuthorizedPort:!0,authorizedPortIndex:0,silentNoAuthorizedPort:!0})})()},[o,eA,W]),V.useEffect(()=>()=>{U()},[U]),{status:l,supportInfo:u,error:g,lines:h,reading:C,authorizedPorts:q,isSupported:v,isSecureContext:E,connect:eA,disconnect:_,clearLines:G}},kT=({targets:A=[],defaultTargetName:e,selectedTargetName:t,defaultBaudRate:o=Kf,defaultAutoApply:r=!0,applyLatestOnTargetChange:i=!0,autoApplyIntervalMs:a=0,autoConnectAuthorized:s=!0,allowRequestPort:l=!0,lineLimit:d,requestOptions:u,onReading:p,onApply:g,sx:m})=>{const[h,f]=V.useState(e??""),C=V.useRef(void 0),b=V.useRef(void 0),q=V.useRef(void 0),x=V.useMemo(()=>Array.isArray(m)?m:m?[m]:[],[m]),v=t??h,w=V.useMemo(()=>A.find(N=>N.name===v),[v,A]),E=V.useMemo(()=>({baudRate:o,dataBits:8,stopBits:1,parity:Hl.None}),[o]),{status:I,reading:k,authorizedPorts:T,connect:M,disconnect:P}=_f({serialOptions:E,requestOptions:u,lineLimit:d,autoConnectAuthorized:s,onReading:p}),y=I===Le.Connected,B=I===Le.Connecting||I===Le.Disconnecting,O=V.useCallback(N=>{t===void 0&&f(N)},[t]),R=V.useCallback(async()=>{var L;if(!y||!w||!(k!=null&&k.value)||w.disabled)return;const N=Date.now();if(b.current!==k.value&&!(C.current&&N-C.current<a))try{C.current=N,b.current=k.value,await((L=w.onApply)==null?void 0:L.call(w,k)),g==null||g(k,w)}catch{}},[w,a,y,g,k]);return V.useEffect(()=>{if(!A.length){O("");return}if(w||!e)return;const N=A.find(L=>L.name===e);N&&O(N.name)},[w,e,O,A]),V.useEffect(()=>{!r||!(k!=null&&k.receivedAt)||C.current===k.receivedAt||R()},[R,r,k==null?void 0:k.receivedAt]),V.useEffect(()=>{q.current!==v&&(q.current=v,!(!r||!i||!(k!=null&&k.value))&&R())},[v,i,R,r,k==null?void 0:k.value]),c.jsxs(ve,{sx:[{gap:RA,flexWrap:"wrap"},...x],children:[y?c.jsx(Ge,{content:"Ngắt kết nối",startIcon:"link_off",variant:"outlined",color:"error",loading:B,disabled:B,onClick:()=>P()}):null,!y&&T.length===1?c.jsx(W0,{content:`Kết nối ${T[0].label} đã được trình duyệt cấp quyền.`,children:c.jsx(Ge,{content:T[0].label,startIcon:"scale",variant:"outlined",loading:B,disabled:B,onClick:()=>M({useAuthorizedPort:!0,authorizedPortIndex:T[0].index})})}):null,!y&&T.length>1?T.map(N=>c.jsx(W0,{content:`Kết nối ${N.label}`,children:c.jsx(Ge,{content:N.label,startIcon:"scale",variant:"outlined",loading:B,disabled:B,onClick:()=>M({useAuthorizedPort:!0,authorizedPortIndex:N.index})})},N.index)):null,!y&&l?c.jsx(W0,{content:"Kết nối cân mới trong danh sách cân đã được cấp quyền truy cập.",children:c.jsx(Ge,{content:I===Le.Connecting?"Đang kết nối...":T.length?"Kết nối cân khác":"Kết nối cân",startIcon:"usb",loading:B,disabled:B,onClick:()=>M()})}):null]})},MT=({label:A,count:e=0,color:t,icon:o,info:r,bgColor:i})=>c.jsxs(D.Card,{sx:{minHeight:116,borderRadius:Xt},children:[c.jsx(D.CardHeader,{action:c.jsx(D.IconButton,{"aria-label":"settings",children:c.jsx(vA,{icon:"more_vert"})}),title:c.jsx(D.Typography,{variant:"h6",sx:{fontSize:"16px"},color:"#737373",children:A})}),c.jsx(D.CardContent,{sx:{paddingTop:0},children:c.jsxs(D.Stack,{gap:.5,children:[c.jsxs(it,{width:"100%",children:[c.jsx(D.Typography,{variant:"h2",sx:{color:t,fontSize:"32px"},children:e}),c.jsx(wn,{sx:{bgcolor:gn(i,.85),borderRadius:Xt,width:48,height:48},children:c.jsx("img",{src:o})})]}),r]})})]}),PT=({label:A="",placeholder:e="Select option",value:t=null,disabled:o=!1,error:r=!1,success:i=!1,errorMessage:a,successMessage:s,borderRadius:l=6,onChange:d,helperText:u="",options:p=[],checkIconColor:g=$t[900],required:m=!1,sx:h,labelSx:f})=>{const C=V.useMemo(()=>l==="max"?"100px":`${l}px`,[l]),b=V.useMemo(()=>p.find(E=>E.value===t),[p,t]),q=V.useCallback(()=>r&&a?a:i&&s?s:u||"",[r,a,i,s,u]),x=V.useCallback(()=>r?x0[500]:i?Yo[500]:de[400],[r,i]),v=V.useCallback(()=>r?x0[500]:i?Yo[500]:de[300],[r,i]),w=V.useMemo(()=>({"& .MuiOutlinedInput-root":{borderRadius:`${C} !important`,backgroundColor:o?de[100]:"white",transition:"all 0.2s ease","& fieldset":{borderRadius:`${C} !important`,borderColor:v()},"&:hover fieldset":{borderColor:o?v():r?x0[500]:de[400]},"&.Mui-focused fieldset":{borderColor:r?x0[500]:de[400],borderWidth:"1px"}},"& .MuiOutlinedInput-input":{padding:"8px 10px",color:ot[900],"&::placeholder":{color:de[400],opacity:1}}}),[C,o,r,v]);return c.jsxs(D.Box,{sx:{...h},children:[A&&c.jsxs(D.Box,{sx:{display:"flex",alignItems:"baseline",gap:"2px",marginBottom:"4px"},children:[c.jsx(D.Typography,{sx:{...QA.textMd,color:ot[800],...f},children:A}),m&&c.jsx(D.Typography,{sx:{color:x0[500],...QA.textMd},children:"*"})]}),c.jsx(D.Select,{fullWidth:!0,value:t||"",onChange:E=>{const I=E.target.value,k=p.find(T=>String(T.value)===String(I));k&&(d==null||d(k.value))},disabled:o,displayEmpty:!0,MenuProps:{disableScrollLock:!0},slotProps:{root:{sx:{borderRadius:C}}},renderValue:()=>t?c.jsxs(D.Box,{sx:{display:"flex",alignItems:"center",gap:"8px"},children:[(b==null?void 0:b.statusIndicator)&&c.jsx(D.Box,{sx:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:"#4CAF50"}}),(b==null?void 0:b.avatar)&&c.jsx(D.Avatar,{src:b.avatar,sx:{width:"24px",height:"24px",fontSize:"12px"}}),(b==null?void 0:b.icon)&&c.jsx(vA,{icon:b.icon}),c.jsx(D.Typography,{sx:{color:ot[900],...QA.textMd,lineHeight:"1.4375em"},children:b==null?void 0:b.label})]}):c.jsx(D.Typography,{sx:{color:de[400],...QA.textMd,lineHeight:"1.4375em"},children:e}),sx:w,children:p.map(E=>c.jsx(D.MenuItem,{value:E.value,children:c.jsxs(D.Box,{sx:{display:"flex",alignItems:"center",gap:"8px",width:"100%"},children:[E.statusIndicator&&c.jsx(D.Box,{sx:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:"#4CAF50"}}),E.avatar&&c.jsx(D.Avatar,{src:E.avatar,sx:{width:"24px",height:"24px",fontSize:"12px"}}),E.icon&&c.jsx(vA,{icon:E.icon}),c.jsx(D.Typography,{sx:{color:ot[900],...QA.textMd,lineHeight:"1.4375em"},children:E.label}),t===E.value&&c.jsx(D.Box,{sx:{marginLeft:"auto",display:"flex",alignItems:"center"},children:c.jsx(vA,{icon:"check",sx:{color:g}})})]})},E.value))}),q()&&c.jsx(D.Box,{sx:{color:x(),marginTop:"4px",...QA.textMd,lineHeight:"1.4375em"},children:q()})]})},RT=D.styled(D.Autocomplete)(()=>({"& .MuiOutlinedInput-root":{padding:"4px 10px !important",display:"flex",alignItems:"center",gap:"4px","& fieldset":{borderColor:de[300]},"&:hover fieldset":{borderColor:de[400]},"&.Mui-focused fieldset":{borderColor:de[300]+" !important",borderWidth:"1.5px"},"&.Mui-disabled":{backgroundColor:de[100],"& fieldset":{borderColor:de[200]}},"&.Mui-error fieldset":{borderColor:x0[500]},"&.Mui-success fieldset":{borderColor:Yo[500]}},"& .MuiInputBase-input":{padding:"4px 4px !important",fontSize:"14px",flex:1,minWidth:"60px","&::placeholder":{color:de[400],opacity:1},"&.Mui-disabled":{color:de[400],WebkitTextFillColor:de[400]}},"& .MuiAutocomplete-endAdornment":{paddingRight:"4px"},"& .MuiAutocomplete-tag":{backgroundColor:$t[50],border:`1px solid ${$t[200]}`,color:$t[900],fontSize:"12px",margin:"2px","& .MuiChip-deleteIcon":{color:$t[400],"&:hover":{color:$t[600]}}},"& .search-dropdown-limit-badge":{backgroundColor:$t[50],border:`1px solid ${$t[200]}`,color:$t[700],...QA.textSmall.semiBold,margin:"2px"}})),NT=({value:A,onChange:e,onClear:t,onInputChange:o,onSearch:r,borderRadius:i=4,disabled:a=!1,multiple:s=!1,limitTags:l=2,label:d="",placeholder:u="Search...",error:p=!1,errorMessage:g,success:m=!1,successMessage:h,helperText:f="",options:C=[],loading:b=!1,iconBefore:q,required:x=!1,sx:v})=>{const[E,I]=V.useState(""),[k,T]=V.useState(C),[M,P]=V.useState(!1),y=V.useRef(null),B=V.useRef(r),O=V.useRef(o),R=V.useRef(C);V.useEffect(()=>{B.current=r,O.current=o,R.current=C},[r,o,C]);const N=V.useMemo(()=>A?(Array.isArray(A)?A:[A]).map(F=>typeof F=="object"?F:{label:String(F),value:F}):[],[A]);V.useEffect(()=>{if(y.current&&clearTimeout(y.current),!E.trim()){T(R.current);return}return y.current=setTimeout(async()=>{var F;const U=B.current;if(U){P(!0);try{const W=await U(E);T(W)}catch(W){console.error("Search error:",W),T([])}finally{P(!1)}}else{const W=R.current.filter(eA=>eA.label.toLowerCase().includes(E.toLowerCase()));T(W)}(F=O.current)==null||F.call(O,E)},500),()=>{y.current&&clearTimeout(y.current)}},[E]);const L=(U,F)=>{I(F)},X=(U,F)=>{if(s){const W=Array.isArray(F)?F:F?[F]:[];e==null||e(W.length>0?W:null),I("")}else e==null||e(F||null)},H=()=>{I(""),T(R.current),e==null||e(null),t==null||t()};return c.jsxs(D.Box,{sx:{width:"100%",...v},children:[d&&c.jsxs(D.Box,{sx:{display:"flex",alignItems:"baseline",gap:"2px",marginBottom:"6px"},children:[c.jsx(D.Typography,{sx:{...QA.textMd,color:ot[900],display:"block"},children:d}),x&&c.jsx(D.Typography,{sx:{color:x0[500],...QA.textMd},children:"*"})]}),c.jsx(RT,{multiple:s,freeSolo:!1,options:k,getOptionLabel:U=>U?typeof U=="object"&&"label"in U?U.label:String(U):"",isOptionEqualToValue:(U,F)=>!U||!F?!1:typeof U=="object"&&typeof F=="object"&&"value"in U&&"value"in F?U.value===F.value:!1,value:s?N:N[0]||null,inputValue:E,onInputChange:L,onChange:X,disabled:a||b,loading:M||b,noOptionsText:E?"No results found":"Type to search",slotProps:{paper:{sx:{"& .MuiAutocomplete-listbox":{borderRadius:i==="max"?"0 0 100px 100px":`0 0 ${i}px ${i}px`}}}},renderInput:U=>c.jsx(D.TextField,{...U,placeholder:N&&(N==null?void 0:N.length)>0?"":u,variant:"outlined",size:"small",error:p,sx:{"& .MuiOutlinedInput-root":{borderRadius:i==="max"?"100px !important":`${i}px !important`,"& fieldset":{borderRadius:i==="max"?"100px !important":`${i}px !important`}}},InputProps:{...U.InputProps,startAdornment:c.jsxs(c.Fragment,{children:[c.jsx(D.InputAdornment,{position:"start",sx:{marginLeft:"4px",marginRight:"0px"},children:q||c.jsx(vA,{icon:"search",sx:{color:"#999",fontSize:"18px"}})}),U.InputProps.startAdornment]})}}),renderTags:(U,F)=>{const W=Array.isArray(U)?U:[],eA=s?W.slice(0,l):W,_=W.length-eA.length;return c.jsxs(c.Fragment,{children:[eA.map((G,z)=>{const $=typeof G=="object"&&G&&"label"in G?G.label:String(G);return V.createElement(D.Chip,{...F({index:z}),key:z,label:$,size:"small"})}),_>0&&c.jsx(D.Chip,{className:"search-dropdown-limit-badge",label:`+${_}`,size:"small"})]})},renderOption:(U,F)=>{const{key:W,...eA}=U,_=(F==null?void 0:F.label)||"";return c.jsx(D.Box,{...eA,component:"li",children:_},W)},componentsProps:{clearIndicator:{onClick:H}}}),p&&g&&c.jsx(D.Box,{sx:{fontSize:"12px",color:x0[500],marginTop:"4px"},children:g}),m&&h&&c.jsx(D.Box,{sx:{fontSize:"12px",color:Yo[500],marginTop:"4px"},children:h}),f&&!p&&!m&&c.jsx(D.Box,{sx:{fontSize:"12px",color:de[500],marginTop:"4px"},children:f})]})};exports.APPS=Y5;exports.AdvancedFilterDialog=vI;exports.AdvancedOperatorFilterDialog=qI;exports.AppGrid=Ql;exports.AppGridItem=Ll;exports.AppGroup=bA;exports.AppsSidebar=zf;exports.AvatarElement=rt;exports.AvatarGroupElement=Vu;exports.AvatarOnlineStatusElement=Tg;exports.AvatarUserInfo=Mg;exports.AvatarUserInfoDetail=Og;exports.AvatarUserInfoUpdate=kg;exports.BORDER_TABLE=Cn;exports.BorderLinearProgress=yg;exports.BreadcrumbElement=Pg;exports.ButtonElement=Ge;exports.ButtonIconContentOpacityElement=Rg;exports.ButtonIconElement=cs;exports.ButtonImageElement=pI;exports.ButtonUploadFileElement=Nl;exports.COLOR=n4;exports.CardStatisticsComponent=MT;exports.CheckboxElement=Wa;exports.CollapsibleSection=CI;exports.ColumnSettingsPopover=hI;exports.DATE_OPERATOR_OPTIONS=Pf;exports.DATE_OPTIONS=Rf;exports.DISABLED_DEFAULT=cr;exports.DashedDividerElement=bI;exports.DateFilterMacro=ye;exports.DefaultLayout=YI;exports.DialogConfirmActionElement=Hg;exports.DialogElement=ds;exports.DirectionProps=dr;exports.DropdownFieldComponent=PT;exports.EmptyComponent=po;exports.Environment=n0;exports.FIELD_WIDTH=Tf;exports.FINISH_GOOD_IMAGE_GALLERY=o4;exports.FULL_OPERATOR_OPTIONS=kf;exports.FilterOperator=A0;exports.FilterSlider=wI;exports.FinishGoodImageGalleryElement=cI;exports.FlowControlWebSerialScaleEvent=Jf;exports.GROUP_ICONS=Od;exports.HttpStatusSpecial=Id;exports.ICONS=JA;exports.IconContentBadgeElement=uo;exports.IconContentBadgeSubsElement=zu;exports.IconContentBadgeSubsVerticalElement=Nu;exports.IconContentElement=c0;exports.IconElement=vA;exports.ImageBorderDashboard=qg;exports.ImageBrand=xg;exports.ImageContentCaptionComponent=dI;exports.ImageContentTimeComponent=uI;exports.ImageElement=B0;exports.ImageEmpty=is;exports.ImageGalleryElement=Df;exports.ImageGalleryVariant=L2;exports.InputLabelCustom=wg;exports.LinkElement=An;exports.LinkWrapProductRow=Sg;exports.ListIconContentElement=Ff;exports.LoadingComponent=qt;exports.LogoComponent=KI;exports.LogoName=Hf;exports.MODE=y0;exports.Mode=ur;exports.MotionBox=Er;exports.NoteComponent=XI;exports.OPERATOR_OPTIONS=Mf;exports.OPERATOR_WIDTH=Ga;exports.OTHER=a4;exports.OnlineBadge=Wu;exports.OrderType=Td;exports.PaginationElement=SI;exports.PaperSelect=as;exports.ParityWebSerialScaleSerial=Hl;exports.PriceComponent=JI;exports.RadioElement=DI;exports.RadioGroupElement=EI;exports.ReviewComponent=pT;exports.STYLE=v4;exports.SearchDropdownComponent=NT;exports.SectionTitle=BI;exports.SevagoProvider=uT;exports.SidebarLeftComponent=ST;exports.SidebarLeftLibraryComponent=Yf;exports.SizeProps=Kt;exports.SmallIcon=u2;exports.SnackbarType=v2;exports.StackAlignCenter=J0;exports.StackAlignCenterJustAround=P8;exports.StackAlignCenterJustBetween=M8;exports.StackAlignCenterJustCenter=Iu;exports.StackAlignCenterJustEnd=k8;exports.StackAlignCenterJustEvenly=R8;exports.StackAlignEnd=u8;exports.StackAlignEndJustAround=H8;exports.StackAlignEndJustBetween=U8;exports.StackAlignEndJustCenter=L8;exports.StackAlignEndJustEnd=Q8;exports.StackAlignEndJustEvenly=z8;exports.StackAlignJustCenter=xr;exports.StackAlignStart=d8;exports.StackAlignStartJustAround=S8;exports.StackAlignStartJustBetween=w8;exports.StackAlignStartJustCenter=x8;exports.StackAlignStartJustEnd=q8;exports.StackAlignStartJustEvenly=E8;exports.StackBgDefaultBorRadLayCol=ku;exports.StackBgPaperBorRadLayCol=Cg;exports.StackJustAround=h8;exports.StackJustBetween=m8;exports.StackJustCenter=Du;exports.StackJustEnd=g8;exports.StackJustEvenly=C8;exports.StackLabel=Mu;exports.StackRow=Ne;exports.StackRowAlignCenter=ve;exports.StackRowAlignCenterJustAround=F8;exports.StackRowAlignCenterJustBetween=it;exports.StackRowAlignCenterJustCenter=Tu;exports.StackRowAlignCenterJustEnd=N8;exports.StackRowAlignCenterJustEvenly=j8;exports.StackRowAlignEnd=f8;exports.StackRowAlignEndJustAround=Y8;exports.StackRowAlignEndJustBetween=G8;exports.StackRowAlignEndJustCenter=V8;exports.StackRowAlignEndJustEnd=W8;exports.StackRowAlignEndJustEvenly=K8;exports.StackRowAlignJustCenter=wn;exports.StackRowAlignStart=p8;exports.StackRowAlignStartJustAround=T8;exports.StackRowAlignStartJustBetween=I8;exports.StackRowAlignStartJustCenter=D8;exports.StackRowAlignStartJustEnd=B8;exports.StackRowAlignStartJustEvenly=O8;exports.StackRowJustAround=y8;exports.StackRowJustBetween=ti;exports.StackRowJustCenter=b8;exports.StackRowJustEnd=Bu;exports.StackRowJustEvenly=v8;exports.StackRowWrap=l8;exports.StackRowWrapAlignCenter=J8;exports.StackRowWrapAlignCenterJustAround=dg;exports.StackRowWrapAlignCenterJustBetween=cg;exports.StackRowWrapAlignCenterJustCenter=sg;exports.StackRowWrapAlignCenterJustEnd=lg;exports.StackRowWrapAlignCenterJustEvenly=ug;exports.StackRowWrapAlignEnd=Z8;exports.StackRowWrapAlignEndJustAround=mg;exports.StackRowWrapAlignEndJustBetween=gg;exports.StackRowWrapAlignEndJustCenter=pg;exports.StackRowWrapAlignEndJustEnd=fg;exports.StackRowWrapAlignEndJustEvenly=hg;exports.StackRowWrapAlignJustCenter=Ou;exports.StackRowWrapAlignStart=X8;exports.StackRowWrapAlignStartJustAround=ig;exports.StackRowWrapAlignStartJustBetween=rg;exports.StackRowWrapAlignStartJustCenter=ng;exports.StackRowWrapAlignStartJustEnd=og;exports.StackRowWrapAlignStartJustEvenly=ag;exports.StackRowWrapJustAround=eg;exports.StackRowWrapJustBetween=Ag;exports.StackRowWrapJustCenter=_8;exports.StackRowWrapJustEnd=$8;exports.StackRowWrapJustEvenly=tg;exports.StackTabs=Pu;exports.StackWrap=c8;exports.Status=Md;exports.StyledTab=ju;exports.StyledTableCell=bg;exports.StyledTabs=Fu;exports.SwitchContentElement=II;exports.SwitchElement=jf;exports.SystemMonitorScreen=BT;exports.SystemMonitorSidebarPart=ET;exports.TAB_BACKGROUND_STYLES=ls;exports.TAB_STYLES=ss;exports.TAB_WRAPPER_STYLES=Lu;exports.TabSizeProps=kd;exports.TableActions=Fl;exports.TableCollapseComponent=LI;exports.TableComponent=UI;exports.TableRowKey=co;exports.TabsBadgeComponent=Bg;exports.TabsBadgeSubsVerticalComponent=Ru;exports.TabsComponent=Hu;exports.TabsMotionBase=Uu;exports.TagElement=sf;exports.TextFieldDateElement=Af;exports.TextFieldDateRangeElement=Lp;exports.TextFieldDateTimeElement=IE;exports.TextFieldElement=wD;exports.TextFieldEmailAutocomplete=$E;exports.TextFieldHourMinuteElement=AD;exports.TextFieldLabelElement=nt;exports.TextFieldMonthYearElement=eD;exports.TextFieldNumberElement=tD;exports.TextFieldSearchCustomElement=nD;exports.TextFieldSearchElement=ef;exports.TextFieldSelectElement=w0;exports.TextFieldSelectSearchObjectElement=oD;exports.TextFieldTimeElement=gD;exports.TextFieldTimeRangeElement=vD;exports.TextFieldUploadImageElement=xD;exports.TextFieldUploadImagesElement=qD;exports.TimeAgoComponent=Bf;exports.TimeAgoContentComponent=If;exports.TooltipOnClickElement=Dg;exports.TooltipOnHoverElement=W0;exports.TypographyAnimatedIconImage=PD;exports.TypographyContentCaption=af;exports.TypographyFilter=Eg;exports.TypographyGridInfoRow=RD;exports.TypographyInfoRow=ND;exports.TypographyInfoUser=FD;exports.TypographyOneLine=Dn;exports.UserInfo=HI;exports.VALUE_WIDTH=Of;exports.VariantProps=x2;exports.WEB_SERIAL_SCALE_DEFAULT_BAUD_RATE=Kf;exports.WEB_SERIAL_SCALE_DEFAULT_LINE_LIMIT=Xf;exports.WebSerialScaleControllerElement=kT;exports.WebSerialScaleStatus=Le;exports.WrapperCenterElement=GI;exports.WrapperChartElement=zI;exports.WrapperContentElement=VI;exports.WrapperElement=WI;exports.animationPresets=Gu;exports.arrayUtil=L4;exports.clearSidebarRouteByPermission=Vf;exports.delayUtil=H4;exports.fileUtil=X4;exports.findSidebarRouteFromPathName=Gf;exports.genSidebarTabsFromRoute=Wf;exports.generateId=S0;exports.getActionBarSx=Sr;exports.getPickerSx=qr;exports.getPopperProps=wr;exports.getStyleCell=Qf;exports.getStyleRow=Uf;exports.getSxArray=Lf;exports.hasSelectedSidebarChild=Ul;exports.highlightText=SD;exports.highlightYellow=Ha;exports.mergeSidebarLeftSx=y2;exports.mergeSxProps=qn;exports.numberUtil=_4;exports.objectUtil=k4;exports.otherUtil=i9;exports.parseDateMacroToTimestamp=Nf;exports.parseWebSerialScaleReading=Zf;exports.productManagementApi=l5;exports.stringUtil=D4;exports.tableArgTypes=QI;exports.timeUtil=k9;exports.useTabsSelected=Qu;exports.useWebSerialScale=_f;