Files
aso/public/client-portal/assets/Tabs.f2658dfd.js
Linksehat Staging Server ae8925be0a merge
2023-07-04 10:05:05 +07:00

2 lines
15 KiB
JavaScript

import{g as ht,a as St,s as F,a4 as zt,b as Lt,_ as p,r as d,u as xt,e as nt,h as P,f as J,i as mt,aj as bt,am as Nt,j as M,w as $t,aw as rt,ap as pt,al as qt}from"./index.aa47ddf4.js";import{a as Gt,K as Jt}from"./KeyboardArrowRight.54c5bca2.js";let V;function kt(){if(V)return V;const t=document.createElement("div"),e=document.createElement("div");return e.style.width="10px",e.style.height="1px",t.appendChild(e),t.dir="rtl",t.style.fontSize="14px",t.style.width="4px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.overflow="scroll",document.body.appendChild(t),V="reverse",t.scrollLeft>0?V="default":(t.scrollLeft=1,t.scrollLeft===0&&(V="negative")),document.body.removeChild(t),V}function Et(t,e){const r=t.scrollLeft;if(e!=="rtl")return r;switch(kt()){case"negative":return t.scrollWidth-t.clientWidth+r;case"reverse":return t.scrollWidth-t.clientWidth-r;default:return r}}function Qt(t){return St("MuiTab",t)}const Zt=ht("MuiTab",["root","labelIcon","textColorInherit","textColorPrimary","textColorSecondary","selected","disabled","fullWidth","wrapped","iconWrapper"]),k=Zt,te=["className","disabled","disableFocusRipple","fullWidth","icon","iconPosition","indicator","label","onChange","onClick","onFocus","selected","selectionFollowsFocus","textColor","value","wrapped"],ee=t=>{const{classes:e,textColor:r,fullWidth:i,wrapped:n,icon:c,label:b,selected:f,disabled:u}=t,S={root:["root",c&&b&&"labelIcon",`textColor${Lt(r)}`,i&&"fullWidth",n&&"wrapped",f&&"selected",u&&"disabled"],iconWrapper:["iconWrapper"]};return mt(S,Qt,e)},oe=F(zt,{name:"MuiTab",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:r}=t;return[e.root,r.label&&r.icon&&e.labelIcon,e[`textColor${Lt(r.textColor)}`],r.fullWidth&&e.fullWidth,r.wrapped&&e.wrapped]}})(({theme:t,ownerState:e})=>p({},t.typography.button,{maxWidth:360,minWidth:90,position:"relative",minHeight:48,flexShrink:0,padding:"12px 16px",overflow:"hidden",whiteSpace:"normal",textAlign:"center"},e.label&&{flexDirection:e.iconPosition==="top"||e.iconPosition==="bottom"?"column":"row"},{lineHeight:1.25},e.icon&&e.label&&{minHeight:72,paddingTop:9,paddingBottom:9,[`& > .${k.iconWrapper}`]:p({},e.iconPosition==="top"&&{marginBottom:6},e.iconPosition==="bottom"&&{marginTop:6},e.iconPosition==="start"&&{marginRight:t.spacing(1)},e.iconPosition==="end"&&{marginLeft:t.spacing(1)})},e.textColor==="inherit"&&{color:"inherit",opacity:.6,[`&.${k.selected}`]:{opacity:1},[`&.${k.disabled}`]:{opacity:(t.vars||t).palette.action.disabledOpacity}},e.textColor==="primary"&&{color:(t.vars||t).palette.text.secondary,[`&.${k.selected}`]:{color:(t.vars||t).palette.primary.main},[`&.${k.disabled}`]:{color:(t.vars||t).palette.text.disabled}},e.textColor==="secondary"&&{color:(t.vars||t).palette.text.secondary,[`&.${k.selected}`]:{color:(t.vars||t).palette.secondary.main},[`&.${k.disabled}`]:{color:(t.vars||t).palette.text.disabled}},e.fullWidth&&{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:"none"},e.wrapped&&{fontSize:t.typography.pxToRem(12)})),le=d.exports.forwardRef(function(e,r){const i=xt({props:e,name:"MuiTab"}),{className:n,disabled:c=!1,disableFocusRipple:b=!1,fullWidth:f,icon:u,iconPosition:S="top",indicator:E,label:w,onChange:v,onClick:x,onFocus:H,selected:B,selectionFollowsFocus:m,textColor:A="inherit",value:T,wrapped:st=!1}=i,X=nt(i,te),K=p({},i,{disabled:c,disableFocusRipple:b,selected:B,icon:!!u,iconPosition:S,label:!!w,fullWidth:f,textColor:A,wrapped:st}),D=ee(K),z=u&&w&&d.exports.isValidElement(u)?d.exports.cloneElement(u,{className:P(D.iconWrapper,u.props.className)}):u,Q=I=>{!B&&v&&v(I,T),x&&x(I)},Y=I=>{m&&!B&&v&&v(I,T),H&&H(I)};return J(oe,p({focusRipple:!b,className:P(D.root,n),ref:r,role:"tab","aria-selected":B,disabled:c,onClick:Q,onFocus:Y,ownerState:K,tabIndex:B?0:-1},X,{children:[S==="top"||S==="start"?J(d.exports.Fragment,{children:[z,w]}):J(d.exports.Fragment,{children:[w,z]}),E]}))}),Re=le;function re(t){return(1+Math.sin(Math.PI*t-Math.PI/2))/2}function ne(t,e,r,i={},n=()=>{}){const{ease:c=re,duration:b=300}=i;let f=null;const u=e[t];let S=!1;const E=()=>{S=!0},w=v=>{if(S){n(new Error("Animation cancelled"));return}f===null&&(f=v);const x=Math.min(1,(v-f)/b);if(e[t]=c(x)*(r-u)+u,x>=1){requestAnimationFrame(()=>{n(null)});return}requestAnimationFrame(w)};return u===r?(n(new Error("Element already at target position")),E):(requestAnimationFrame(w),E)}const se=["onChange"],ae={width:99,height:99,position:"absolute",top:-9999,overflow:"scroll"};function ie(t){const{onChange:e}=t,r=nt(t,se),i=d.exports.useRef(),n=d.exports.useRef(null),c=()=>{i.current=n.current.offsetHeight-n.current.clientHeight};return d.exports.useEffect(()=>{const b=bt(()=>{const u=i.current;c(),u!==i.current&&e(i.current)}),f=Nt(n.current);return f.addEventListener("resize",b),()=>{b.clear(),f.removeEventListener("resize",b)}},[e]),d.exports.useEffect(()=>{c(),e(i.current)},[e]),M("div",p({style:ae,ref:n},r))}function ce(t){return St("MuiTabScrollButton",t)}const de=ht("MuiTabScrollButton",["root","vertical","horizontal","disabled"]),ue=de,pe=["className","slots","slotProps","direction","orientation","disabled"],fe=t=>{const{classes:e,orientation:r,disabled:i}=t;return mt({root:["root",r,i&&"disabled"]},ce,e)},be=F(zt,{name:"MuiTabScrollButton",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:r}=t;return[e.root,r.orientation&&e[r.orientation]]}})(({ownerState:t})=>p({width:40,flexShrink:0,opacity:.8,[`&.${ue.disabled}`]:{opacity:0}},t.orientation==="vertical"&&{width:"100%",height:40,"& svg":{transform:`rotate(${t.isRtl?-90:90}deg)`}})),he=d.exports.forwardRef(function(e,r){var i,n;const c=xt({props:e,name:"MuiTabScrollButton"}),{className:b,slots:f={},slotProps:u={},direction:S}=c,E=nt(c,pe),v=$t().direction==="rtl",x=p({isRtl:v},c),H=fe(x),B=(i=f.StartScrollButtonIcon)!=null?i:Gt,m=(n=f.EndScrollButtonIcon)!=null?n:Jt,A=rt({elementType:B,externalSlotProps:u.startScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:x}),T=rt({elementType:m,externalSlotProps:u.endScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:x});return M(be,p({component:"div",className:P(H.root,b),ref:r,role:null,ownerState:x,tabIndex:null},E,{children:S==="left"?M(B,p({},A)):M(m,p({},T))}))}),Se=he;function xe(t){return St("MuiTabs",t)}const me=ht("MuiTabs",["root","vertical","flexContainer","flexContainerVertical","centered","scroller","fixed","scrollableX","scrollableY","hideScrollbar","scrollButtons","scrollButtonsHideMobile","indicator"]),ft=me,ve=["aria-label","aria-labelledby","action","centered","children","className","component","allowScrollButtonsMobile","indicatorColor","onChange","orientation","ScrollButtonComponent","scrollButtons","selectionFollowsFocus","slots","slotProps","TabIndicatorProps","TabScrollButtonProps","textColor","value","variant","visibleScrollbar"],Rt=(t,e)=>t===e?t.firstChild:e&&e.nextElementSibling?e.nextElementSibling:t.firstChild,Wt=(t,e)=>t===e?t.lastChild:e&&e.previousElementSibling?e.previousElementSibling:t.lastChild,lt=(t,e,r)=>{let i=!1,n=r(t,e);for(;n;){if(n===t.firstChild){if(i)return;i=!0}const c=n.disabled||n.getAttribute("aria-disabled")==="true";if(!n.hasAttribute("tabindex")||c)n=r(t,n);else{n.focus();return}}},ge=t=>{const{vertical:e,fixed:r,hideScrollbar:i,scrollableX:n,scrollableY:c,centered:b,scrollButtonsHideMobile:f,classes:u}=t;return mt({root:["root",e&&"vertical"],scroller:["scroller",r&&"fixed",i&&"hideScrollbar",n&&"scrollableX",c&&"scrollableY"],flexContainer:["flexContainer",e&&"flexContainerVertical",b&&"centered"],indicator:["indicator"],scrollButtons:["scrollButtons",f&&"scrollButtonsHideMobile"],scrollableX:[n&&"scrollableX"],hideScrollbar:[i&&"hideScrollbar"]},xe,u)},Ce=F("div",{name:"MuiTabs",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:r}=t;return[{[`& .${ft.scrollButtons}`]:e.scrollButtons},{[`& .${ft.scrollButtons}`]:r.scrollButtonsHideMobile&&e.scrollButtonsHideMobile},e.root,r.vertical&&e.vertical]}})(({ownerState:t,theme:e})=>p({overflow:"hidden",minHeight:48,WebkitOverflowScrolling:"touch",display:"flex"},t.vertical&&{flexDirection:"column"},t.scrollButtonsHideMobile&&{[`& .${ft.scrollButtons}`]:{[e.breakpoints.down("sm")]:{display:"none"}}})),we=F("div",{name:"MuiTabs",slot:"Scroller",overridesResolver:(t,e)=>{const{ownerState:r}=t;return[e.scroller,r.fixed&&e.fixed,r.hideScrollbar&&e.hideScrollbar,r.scrollableX&&e.scrollableX,r.scrollableY&&e.scrollableY]}})(({ownerState:t})=>p({position:"relative",display:"inline-block",flex:"1 1 auto",whiteSpace:"nowrap"},t.fixed&&{overflowX:"hidden",width:"100%"},t.hideScrollbar&&{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},t.scrollableX&&{overflowX:"auto",overflowY:"hidden"},t.scrollableY&&{overflowY:"auto",overflowX:"hidden"})),Be=F("div",{name:"MuiTabs",slot:"FlexContainer",overridesResolver:(t,e)=>{const{ownerState:r}=t;return[e.flexContainer,r.vertical&&e.flexContainerVertical,r.centered&&e.centered]}})(({ownerState:t})=>p({display:"flex"},t.vertical&&{flexDirection:"column"},t.centered&&{justifyContent:"center"})),ye=F("span",{name:"MuiTabs",slot:"Indicator",overridesResolver:(t,e)=>e.indicator})(({ownerState:t,theme:e})=>p({position:"absolute",height:2,bottom:0,width:"100%",transition:e.transitions.create()},t.indicatorColor==="primary"&&{backgroundColor:(e.vars||e).palette.primary.main},t.indicatorColor==="secondary"&&{backgroundColor:(e.vars||e).palette.secondary.main},t.vertical&&{height:"100%",width:2,right:0})),Te=F(ie,{name:"MuiTabs",slot:"ScrollbarSize"})({overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}),Pt={},Ie=d.exports.forwardRef(function(e,r){const i=xt({props:e,name:"MuiTabs"}),n=$t(),c=n.direction==="rtl",{"aria-label":b,"aria-labelledby":f,action:u,centered:S=!1,children:E,className:w,component:v="div",allowScrollButtonsMobile:x=!1,indicatorColor:H="primary",onChange:B,orientation:m="horizontal",ScrollButtonComponent:A=Se,scrollButtons:T="auto",selectionFollowsFocus:st,slots:X={},slotProps:K={},TabIndicatorProps:D={},TabScrollButtonProps:z={},textColor:Q="primary",value:Y,variant:I="standard",visibleScrollbar:at=!1}=i,Ft=nt(i,ve),R=I==="scrollable",g=m==="vertical",O=g?"scrollTop":"scrollLeft",Z=g?"top":"left",tt=g?"bottom":"right",it=g?"clientHeight":"clientWidth",j=g?"height":"width",L=p({},i,{component:v,allowScrollButtonsMobile:x,indicatorColor:H,orientation:m,vertical:g,scrollButtons:T,textColor:Q,variant:I,visibleScrollbar:at,fixed:!R,hideScrollbar:R&&!at,scrollableX:R&&!g,scrollableY:R&&g,centered:S&&!R,scrollButtonsHideMobile:!x}),W=ge(L),Ht=rt({elementType:X.StartScrollButtonIcon,externalSlotProps:K.startScrollButtonIcon,ownerState:L}),At=rt({elementType:X.EndScrollButtonIcon,externalSlotProps:K.endScrollButtonIcon,ownerState:L}),[vt,Xt]=d.exports.useState(!1),[N,gt]=d.exports.useState(Pt),[U,Dt]=d.exports.useState({start:!1,end:!1}),[Ct,Yt]=d.exports.useState({overflow:"hidden",scrollbarWidth:0}),wt=new Map,y=d.exports.useRef(null),q=d.exports.useRef(null),Bt=()=>{const o=y.current;let l;if(o){const a=o.getBoundingClientRect();l={clientWidth:o.clientWidth,scrollLeft:o.scrollLeft,scrollTop:o.scrollTop,scrollLeftNormalized:Et(o,n.direction),scrollWidth:o.scrollWidth,top:a.top,bottom:a.bottom,left:a.left,right:a.right}}let s;if(o&&Y!==!1){const a=q.current.children;if(a.length>0){const h=a[wt.get(Y)];s=h?h.getBoundingClientRect():null}}return{tabsMeta:l,tabMeta:s}},G=pt(()=>{const{tabsMeta:o,tabMeta:l}=Bt();let s=0,a;if(g)a="top",l&&o&&(s=l.top-o.top+o.scrollTop);else if(a=c?"right":"left",l&&o){const C=c?o.scrollLeftNormalized+o.clientWidth-o.scrollWidth:o.scrollLeft;s=(c?-1:1)*(l[a]-o[a]+C)}const h={[a]:s,[j]:l?l[j]:0};if(isNaN(N[a])||isNaN(N[j]))gt(h);else{const C=Math.abs(N[a]-h[a]),_=Math.abs(N[j]-h[j]);(C>=1||_>=1)&&gt(h)}}),ct=(o,{animation:l=!0}={})=>{l?ne(O,y.current,o,{duration:n.transitions.duration.standard}):y.current[O]=o},yt=o=>{let l=y.current[O];g?l+=o:(l+=o*(c?-1:1),l*=c&&kt()==="reverse"?-1:1),ct(l)},Tt=()=>{const o=y.current[it];let l=0;const s=Array.from(q.current.children);for(let a=0;a<s.length;a+=1){const h=s[a];if(l+h[it]>o){a===0&&(l=o);break}l+=h[it]}return l},Ut=()=>{yt(-1*Tt())},_t=()=>{yt(Tt())},Vt=d.exports.useCallback(o=>{Yt({overflow:null,scrollbarWidth:o})},[]),Kt=()=>{const o={};o.scrollbarSizeListener=R?M(Te,{onChange:Vt,className:P(W.scrollableX,W.hideScrollbar)}):null;const l=U.start||U.end,s=R&&(T==="auto"&&l||T===!0);return o.scrollButtonStart=s?M(A,p({slots:{StartScrollButtonIcon:X.StartScrollButtonIcon},slotProps:{startScrollButtonIcon:Ht},orientation:m,direction:c?"right":"left",onClick:Ut,disabled:!U.start},z,{className:P(W.scrollButtons,z.className)})):null,o.scrollButtonEnd=s?M(A,p({slots:{EndScrollButtonIcon:X.EndScrollButtonIcon},slotProps:{endScrollButtonIcon:At},orientation:m,direction:c?"left":"right",onClick:_t,disabled:!U.end},z,{className:P(W.scrollButtons,z.className)})):null,o},It=pt(o=>{const{tabsMeta:l,tabMeta:s}=Bt();if(!(!s||!l)){if(s[Z]<l[Z]){const a=l[O]+(s[Z]-l[Z]);ct(a,{animation:o})}else if(s[tt]>l[tt]){const a=l[O]+(s[tt]-l[tt]);ct(a,{animation:o})}}}),$=pt(()=>{if(R&&T!==!1){const{scrollTop:o,scrollHeight:l,clientHeight:s,scrollWidth:a,clientWidth:h}=y.current;let C,_;if(g)C=o>1,_=o<l-s-1;else{const ot=Et(y.current,n.direction);C=c?ot<a-h-1:ot>1,_=c?ot>1:ot<a-h-1}(C!==U.start||_!==U.end)&&Dt({start:C,end:_})}});d.exports.useEffect(()=>{const o=bt(()=>{y.current&&(G(),$())}),l=Nt(y.current);l.addEventListener("resize",o);let s;return typeof ResizeObserver<"u"&&(s=new ResizeObserver(o),Array.from(q.current.children).forEach(a=>{s.observe(a)})),()=>{o.clear(),l.removeEventListener("resize",o),s&&s.disconnect()}},[G,$]);const dt=d.exports.useMemo(()=>bt(()=>{$()}),[$]);d.exports.useEffect(()=>()=>{dt.clear()},[dt]),d.exports.useEffect(()=>{Xt(!0)},[]),d.exports.useEffect(()=>{G(),$()}),d.exports.useEffect(()=>{It(Pt!==N)},[It,N]),d.exports.useImperativeHandle(u,()=>({updateIndicator:G,updateScrollButtons:$}),[G,$]);const Mt=M(ye,p({},D,{className:P(W.indicator,D.className),ownerState:L,style:p({},N,D.style)}));let et=0;const Ot=d.exports.Children.map(E,o=>{if(!d.exports.isValidElement(o))return null;const l=o.props.value===void 0?et:o.props.value;wt.set(l,et);const s=l===Y;return et+=1,d.exports.cloneElement(o,p({fullWidth:I==="fullWidth",indicator:s&&!vt&&Mt,selected:s,selectionFollowsFocus:st,onChange:B,textColor:Q,value:l},et===1&&Y===!1&&!o.props.tabIndex?{tabIndex:0}:{}))}),jt=o=>{const l=q.current,s=qt(l).activeElement;if(s.getAttribute("role")!=="tab")return;let h=m==="horizontal"?"ArrowLeft":"ArrowUp",C=m==="horizontal"?"ArrowRight":"ArrowDown";switch(m==="horizontal"&&c&&(h="ArrowRight",C="ArrowLeft"),o.key){case h:o.preventDefault(),lt(l,s,Wt);break;case C:o.preventDefault(),lt(l,s,Rt);break;case"Home":o.preventDefault(),lt(l,null,Rt);break;case"End":o.preventDefault(),lt(l,null,Wt);break}},ut=Kt();return J(Ce,p({className:P(W.root,w),ownerState:L,ref:r,as:v},Ft,{children:[ut.scrollButtonStart,ut.scrollbarSizeListener,J(we,{className:W.scroller,ownerState:L,style:{overflow:Ct.overflow,[g?`margin${c?"Left":"Right"}`:"marginBottom"]:at?void 0:-Ct.scrollbarWidth},ref:y,onScroll:dt,children:[M(Be,{"aria-label":b,"aria-labelledby":f,"aria-orientation":m==="vertical"?"vertical":null,className:W.flexContainer,ownerState:L,onKeyDown:jt,ref:q,role:"tablist",children:Ot}),vt&&Mt]}),ut.scrollButtonEnd]}))}),We=Ie;export{We as T,Re as a};