1 line
24 KiB
JavaScript
1 line
24 KiB
JavaScript
import{o as e}from"./request-DWqS4XYU.js";import{Bn as t,Ct as n,Et as r,Hn as i,It as a,Jt as o,Kt as s,Ln as c,Nr as l,Pr as u,Qn as d,Rt as f,St as p,Tr as m,Wn as h,Zt as g,en as _,jr as v,kt as y,nr as b,nt as x,qt as S,wn as C,wt as w,yr as T,yt as E}from"./jsx-runtime-Dk2XcqH2.js";import{v as D,w as O}from"./tooltip-Up9y7xD6.js";import{t as k}from"./CheckCircleFilled-DlIVY69t.js";import{t as A}from"./CloseCircleFilled-CDRAZ4fZ.js";import{t as j}from"./ExclamationCircleFilled-Nabz_GYY.js";var M=e(u()),N=e(l()),P={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z`}}]},name:`info-circle`,theme:`filled`};function F(){return F=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},F.apply(this,arguments)}var I=M.forwardRef((e,t)=>M.createElement(f,F({},e,{ref:t,icon:P})));function L(){let[e,t]=M.useState({});return[e,M.useCallback((e,n)=>{if(!n){t(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n});return}let r={width:n.offsetWidth,height:n.offsetHeight};t(t=>{let n=t[e];return n&&n.width===r.width&&n.height===r.height?t:{...t,[e]:r}})},[])]}function R(e,t,n=0){let[r,i]=L(),[a,o,s,c]=M.useMemo(()=>{let i=0,a=0,o=t?.threshold??0,s=new Map,c,l;return e.slice().reverse().forEach((e,u)=>{let d=String(e.key),f=r[d]?.height??0,p=t&&u>0?i+(t.offset??0)-f:i;s.set(d,p),u===0&&(c=f,l=r[d]?.width??0),(!t||u<o)&&(a=Math.max(a,p+f)),t?i=p+f:i+=f+n}),[s,a,c,l]},[e,n,r,t]);return[a,i,o,s,c]}var z=8,B=3,ee=e=>{let t={offset:z,threshold:B};return e&&typeof e==`object`&&(t.offset=e.offset??z,t.threshold=e.threshold??B),[!!e,t]};function te(e,t,n){let r=Math.max(typeof e==`number`?e:0,0)*1e3,i=v(t),a=v(n),[o,s]=M.useState(r>0),c=M.useRef(0),l=M.useRef(null);function u(){let e=Date.now(),t=l.current;t!==null&&(c.current+=e-t),l.current=e}let d=M.useCallback(()=>{u(),s(!1)},[]),f=M.useCallback(()=>{r>0?(l.current=Date.now(),s(!0)):a(0)},[r]);return M.useEffect(()=>{c.current=0,s(r>0)},[r]),M.useEffect(()=>{if(!o)return;let e=null;function t(){u(),c.current>=r?(a(1),i()):(a(Math.min(c.current/r,1)),e=m(t))}return t(),()=>{m.cancel(e)}},[r,o]),[f,d]}function ne(e){let t=M.useMemo(()=>e===!1?{closeIcon:null,disabled:!0}:typeof e==`object`&&e?e:{},[e]),n=M.useMemo(()=>({...t,closeIcon:`closeIcon`in t?t.closeIcon:`×`,disabled:t.disabled??!1}),[t]),r=M.useMemo(()=>d(n,!0),[n]);return[!!e,n,r]}var re=({className:e,style:t,percent:n})=>M.createElement(`progress`,{className:e,max:`100`,value:n,style:t});function V(){return V=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},V.apply(this,arguments)}var H=M.forwardRef((e,t)=>{let{prefixCls:n,className:r,style:i,classNames:a,styles:o,components:s,title:c,description:l,icon:u,actions:d,role:f,closable:p,offset:m,notificationIndex:g,stackInThreshold:_,props:y,duration:b=4.5,showProgress:x,hovering:S,pauseOnHover:C=!0,onClick:w,onMouseEnter:T,onMouseLeave:E,onClose:D}=e,[O,k]=M.useState(0),A=`${n}-notice`,[j,N,P]=ne(p),F=v(()=>{N.onClose?.(),D?.()}),[I,L]=M.useState(!1),[R,z]=te(b,F,k),B=100-Math.min(Math.max(O*100,0),100),ee=s?.progress||re;M.useEffect(()=>{C&&(S?z():I||R())},[S,I,z,R,C]);function H(e){L(!0),C&&z(),T?.(e)}function U(e){L(!1),C&&!S&&R(),E?.(e)}function W(e){e.preventDefault(),e.stopPropagation(),F()}let G=M.useRef(m);m!==void 0&&(G.current=m);let K=M.useRef(g);g!==void 0&&(K.current=g);let q=m??G.current,J=g??K.current??0,Y=c==null?null:M.createElement(`div`,{className:h(`${A}-title`,a?.title),style:o?.title},c),X=l==null?null:M.createElement(`div`,{className:h(`${A}-description`,a?.description),style:o?.description},l),ie=Y!==null,ae=X!==null,Z;Z=ie&&ae?M.createElement(`div`,{className:h(`${A}-section`,a?.section),style:o?.section},Y,X):Y||X,u!=null&&(Z=M.createElement(`div`,{className:h(`${A}-wrapper`,a?.wrapper),style:o?.wrapper},M.createElement(`div`,{className:h(`${A}-icon`,a?.icon),style:o?.icon},u),Z));let oe=d?M.createElement(`div`,{className:h(`${A}-actions`,a?.actions),style:o?.actions},d):null,Q={"--notification-index":J,...o?.root,...i};q!==void 0&&(Q[`--notification-y`]=`${q}px`);let $=f??y?.role??`alert`;return M.createElement(`div`,V({},y,{ref:t,role:$,"data-notification-index":J,className:h(A,r,a?.root,{[`${A}-closable`]:j,[`${A}-stack-in-threshold`]:_}),style:Q,onClick:w,onMouseEnter:H,onMouseLeave:U}),Z,oe,j&&M.createElement(`button`,V({type:`button`,className:h(`${A}-close`,a?.close),"aria-label":`Close`},P,{style:o?.close,onClick:W}),N.closeIcon),x&&typeof b==`number`&&b>0&&M.createElement(ee,{className:h(`${A}-progress`,a?.progress),percent:B,style:o?.progress}))}),U=M.createContext({}),W=({children:e,classNames:t})=>{let n=M.useMemo(()=>({classNames:t}),[t]);return M.createElement(U.Provider,{value:n},e)};function G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},G.apply(this,arguments)}var K=M.forwardRef((e,t)=>{let{listPrefixCls:n,height:r,topNoticeHeight:i=0,topNoticeWidth:a=0,className:o,style:s,...c}=e,l=`${n}-content`,u=M.useRef(r),d=r<u.current?`decrease`:`increase`;u.current=r;let f={...s,height:r,"--top-notificiation-height":`${i}px`,"--top-notificiation-width":`${a}px`};return M.createElement(`div`,G({},c,{className:h(l,`${l}-${d}`,o),style:f,ref:t}))});function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},q.apply(this,arguments)}var J=[`wrapper`,`root`,`icon`,`section`,`title`,`description`,`actions`,`close`,`progress`];function Y(e){return J.reduce((t,n)=>(t[n]=h(...e.map(e=>e?.[n])),t),{})}function X(e){return J.reduce((t,n)=>(t[n]=Object.assign({},...e.map(e=>e?.[n])),t),{})}function ie(e,t){let n=String(t),r=e.findIndex(e=>e.key===n);if(r!==-1)return e.length-r-1}var ae=e=>{let{config:t,components:n,contextClassNames:r,classNames:i,styles:a,className:o,style:s,nodeRef:c,listHovering:l,stackEnabled:u,pauseOnHover:d,setNodeSize:f,onNoticeClose:p,...m}=e,{key:g,placement:_,...v}=t,y=String(g),b=M.useCallback(e=>{f(y,e)},[f,y]),x=T(c,b);return M.createElement(H,q({},v,m,{ref:x,className:h(r?.notice,t.className,o),style:{...s,...t.style},classNames:Y([i,t.classNames]),styles:X([a,t.styles]),components:{...n,...t.components},hovering:u&&l,pauseOnHover:t.pauseOnHover??d,onClose:()=>{t.onClose?.(),p?.(g)}}))},Z=e=>{let{configList:t=[],prefixCls:n=`rc-notification`,pauseOnHover:r,classNames:i,styles:o,components:s,stack:c,motion:l,placement:u,className:d,style:f,onNoticeClose:p,onAllRemoved:m}=e,{classNames:g}=M.useContext(U),_=M.useMemo(()=>t.map(e=>({config:e,key:String(e.key)})),[t]),v=typeof l==`function`?l(u):l,[y,{offset:b,threshold:x}]=ee(c),[S,C]=M.useState(!1),w=y&&(S||_.length<=x),T=M.useMemo(()=>{if(y&&!w)return{offset:b,threshold:x}},[w,b,y,x]),[E,D]=M.useState(0),O=M.useRef(null),[k,A,j,N,P]=R(t,T,E),F=!!t.length;M.useEffect(()=>{let e=O.current;if(!e)return;let{gap:t,rowGap:n}=window.getComputedStyle(e),r=parseFloat(n||t)||0;D(e=>e===r?e:r)},[F]);let I=`${n}-list`;return M.createElement(`div`,{className:h(n,I,`${n}-${u}`,g?.list,d,i?.list,{[`${n}-stack`]:y,[`${n}-stack-expanded`]:w,[`${I}-hovered`]:S}),onMouseEnter:()=>{C(!0)},onMouseLeave:()=>{C(!1)},style:{...o?.list,...f}},M.createElement(K,{listPrefixCls:I,height:j,topNoticeHeight:N,topNoticeWidth:P,className:i?.listContent,style:o?.listContent,ref:O},M.createElement(a,q({component:!1,keys:_,motionAppear:!0},v,{onAllRemoved:()=>{u&&m?.(u)}}),({config:e,className:t,style:a},c)=>{let{key:l}=e,u=String(l),d=ie(_,l),f=y&&d!==void 0&&d<x;return M.createElement(ae,{key:l,config:e,components:s,contextClassNames:g,classNames:i,styles:o,className:t,style:a,nodeRef:c,prefixCls:n,offset:k.get(u),notificationIndex:d,stackInThreshold:f,listHovering:S,stackEnabled:y,pauseOnHover:r,setNodeSize:A,onNoticeClose:p})})))},oe=M.forwardRef((e,t)=>{let{prefixCls:n=`rc-notification`,container:r,motion:i,maxCount:a,pauseOnHover:o,classNames:s,styles:c,components:l,className:u,style:d,onAllRemoved:f,stack:p,renderNotifications:m}=e,[h,g]=M.useState([]),[_,y]=M.useState({}),b=M.useRef(!1);M.useImperativeHandle(t,()=>({open:e=>{g(t=>{let n=[...t],r=n.findIndex(t=>t.key===e.key),i={...e};return r>=0?(i.times=(t[r]?.times??0)+1,n[r]=i):(i.times=0,n.push(i)),a&&a>0&&n.length>a&&(n=n.slice(-a)),n})},close:e=>{g(t=>t.filter(t=>t.key!==e))},destroy:()=>{g([])}})),M.useEffect(()=>{let e={};h.forEach(t=>{let n=t.placement??`topRight`;e[n]=e[n]||[],e[n].push(t)}),Object.keys(_).forEach(t=>{e[t]=e[t]||[]}),y(e)},[h]);let x=v(e=>{y(t=>{let n={...t};return(n[e]||[]).length||delete n[e],n})});if(M.useEffect(()=>{Object.keys(_).length>0?b.current=!0:b.current&&=(f?.(),!1)},[_,f]),!r)return null;let S=Object.keys(_);return(0,N.createPortal)(M.createElement(M.Fragment,null,S.map(e=>{let t=M.createElement(Z,{key:e,configList:_[e],placement:e,prefixCls:n,pauseOnHover:o,classNames:s,styles:c,components:l,className:u?.(e),style:d?.(e),motion:i,stack:p,onNoticeClose:e=>{g(t=>t.filter(t=>t.key!==e))},onAllRemoved:x});return m?M.cloneElement(m(t,{prefixCls:n,key:e}),{key:e}):t})),r)}),Q=()=>document.body,$=0;function se(...e){let t={};return e.forEach(e=>{e&&Object.keys(e).forEach(n=>{let r=e[n];r!==void 0&&(t[n]=r)})}),t}function ce(e={}){let{getContainer:t=Q,motion:n,prefixCls:r,placement:i,closable:a,duration:o,showProgress:s,pauseOnHover:c,classNames:l,styles:u,components:d,maxCount:f,className:p,style:m,onAllRemoved:h,stack:g,renderNotifications:_}=e,y={placement:i,closable:a,duration:o,showProgress:s},[b,x]=M.useState(),S=M.useRef(null),[C,w]=M.useState([]),T=M.createElement(oe,{container:b,ref:S,prefixCls:r,motion:n,maxCount:f,pauseOnHover:c,classNames:l,styles:u,components:d,className:p,style:m,onAllRemoved:h,stack:g,renderNotifications:_}),E=v(e=>{let t=se(y,e);(t.key===null||t.key===void 0)&&(t.key=`rc-notification-${$}`,$+=1),w(e=>[...e,{type:`open`,config:t}])}),D=M.useMemo(()=>({open:E,close:e=>{w(t=>[...t,{type:`close`,key:e}])},destroy:()=>{w(e=>[...e,{type:`destroy`}])}}),[]);return M.useEffect(()=>{x(t())}),M.useEffect(()=>{S.current&&C.length&&(C.forEach(e=>{switch(e.type){case`open`:S.current?.open(e.config);break;case`close`:S.current?.close(e.key);break;case`destroy`:S.current?.destroy()}}),w(e=>{let t=e.filter(e=>!C.includes(e));return t.length===e.length?e:t}))},[C]),[D,T]}var le=(e,t)=>M.useMemo(()=>{let n=e??t;return n?{...y(t)?t:{},...y(n)?n:{}}:!1},[e,t]);function ue(e,t){return{...b(e)&&{"--notification-top":c(e)},...b(t)&&{"--notification-bottom":c(t)}}}function de(e){return{motionName:`${e}-fade`}}function fe(e,t,n){return e===void 0?t?.closeIcon===void 0?n?.closeIcon:t.closeIcon:e}var pe=e=>{let{motionDurationMid:t,motionEaseInOut:n}=e,r=`${t} ${n}`;return{transform:`scale(var(--notification-scale, 1))`,transition:[`transform`,`inset`,`clip-path`,`opacity`].map(e=>`${e} ${r}`).join(`, `)}},me=(e,t)=>{let{componentCls:n,antCls:r,colorSuccess:i,colorInfo:a,colorWarning:o,colorError:l,colorTextHeading:u,colorText:d,boxShadow:f,borderRadiusLG:p,fontSize:m,lineHeight:h,notificationBg:g,notificationPadding:_,notificationMarginEdge:v,margin:y,calc:b}=e,x=`${n}-notice`,[S,C]=s(r,`notification`);return{[x]:{position:`absolute`,width:t.width,maxWidth:`calc(100vw - ${c(b(v).mul(2).equal())})`,padding:_,pointerEvents:`auto`,[S(`icon-font-size`)]:t.iconFontSize,[S(`title-font-size`)]:t.titleFontSize,[S(`title-line-height`)]:t.titleLineHeight,boxSizing:`border-box`,color:d,background:g,borderRadius:p,boxShadow:f,fontSize:m,lineHeight:h,wordWrap:`break-word`,overflow:`visible`,...pe(e),...t.noticeStyle,"&::after":{position:`absolute`,insetInline:0,top:b(y).mul(-1).equal(),height:y,content:`""`},...t.typeStyle&&{"&-success":{background:C(`color-success-bg`,g)},"&-error":{background:C(`color-error-bg`,g)},"&-info":{background:C(`color-info-bg`,g)},"&-warning":{background:C(`color-warning-bg`,g)}}},[`${x}-wrapper`]:{display:`flex`,...t.contentStyle},[`${x}-title`]:{color:u,fontSize:C(`title-font-size`),lineHeight:C(`title-line-height`)},[`${x}-icon`]:{flex:`none`,fontSize:C(`icon-font-size`),lineHeight:1,[`&${x}-icon-success`]:{color:i},[`&${x}-icon-info, &${x}-icon-loading`]:{color:a},[`&${x}-icon-warning`]:{color:o},[`&${x}-icon-error`]:{color:l}}}},he=e=>{let{componentCls:t,progressBg:n,notificationProgressHeight:r,fontSize:i,borderRadiusLG:a,width:o,notificationIconSize:s,colorText:l,motionDurationMid:u,fontSizeLG:d,lineHeightLG:f,marginSM:p,marginXS:m,paddingLG:h,notificationPaddingVertical:_,notificationPaddingHorizontal:v,notificationCloseButtonSize:y,colorIcon:b,borderRadiusSM:x,colorIconHover:S,colorBgTextHover:C,colorBgTextActive:w}=e,T=`${t}-notice`;return{...me(e,{width:o,iconFontSize:s,titleFontSize:d,titleLineHeight:f,contentStyle:{alignItems:`flex-start`,gap:p},typeStyle:!0}),[`${T}-section`]:{display:`flex`,flexDirection:`column`,flex:`auto`,gap:m,minWidth:0},[`${T}-description`]:{color:l,fontSize:i},[`${T}-closable`]:{[`${T}-title, ${T}-description`]:{paddingInlineEnd:h},[`${T}-title + ${T}-description`]:{paddingInlineEnd:0}},[`${T}-close`]:{position:`absolute`,top:_,insetInlineEnd:v,display:`flex`,alignItems:`center`,justifyContent:`center`,width:y,height:y,color:b,background:`none`,border:`none`,borderRadius:x,outline:`none`,transition:[`color`,`background-color`].map(e=>`${e} ${u}`).join(`, `),"&:hover":{color:S,backgroundColor:C},"&:active":{backgroundColor:w},...g(e)},[`${T}-progress`]:{position:`absolute`,bottom:0,display:`block`,appearance:`none`,inlineSize:`calc(100% - ${c(a)} * 2)`,blockSize:r,border:0,left:{_skip_check_:!0,value:a},right:{_skip_check_:!0,value:a},"&, &::-webkit-progress-bar":{borderRadius:a,backgroundColor:`rgba(0, 0, 0, 0.04)`},"&::-moz-progress-bar":{background:n},"&::-webkit-progress-value":{borderRadius:a,background:n}},[`${T}-actions`]:{float:`right`,marginTop:p}}},ge=e=>{let{componentCls:t,width:n}=e,r=`${t}-notice`,i=`${r}-actions`,a=he(e);return{[`${r}-pure-panel`]:{width:n,maxWidth:`100%`,...a,[r]:{...a[r],position:`relative`,width:`100%`,maxWidth:`100%`},[i]:{...a[i],float:`none`,textAlign:`end`}}}},_e=e=>{let{componentCls:t}=e;return{[t]:he(e)}},ve=[`top`,`topLeft`,`topRight`,`bottom`,`bottomLeft`,`bottomRight`],ye=`--notification-margin-edge`,be=(e,t)=>({blockEnd:e===`top`?`bottom`:`top`,inlineEnd:t===`left`?`right`:`left`}),xe=e=>`translate3d(${e?.x??`0`}, ${e?.y??`0`}, 0) scale(var(--notification-scale, 1))`,Se=(e,t)=>{let n=e.startsWith(`bottom`)?`bottom`:`top`,r=e.endsWith(`Right`)?`right`:`left`,{blockEnd:i,inlineEnd:a}=be(n,r),o=e===`top`||e===`bottom`,s=e===`top`||e.endsWith(`Left`)?`-${t}`:t;return{placement:e,vertical:n,blockEnd:i,horizontal:r,inlineEnd:a,motionOffset:o?{x:`-50%`,y:s}:{x:s},baseMotionOffset:o?{x:`-50%`}:void 0,isCenterPlacement:o}},Ce=e=>e===`bottom`?`column-reverse`:`column`,we=e=>{let t=`var(${ye}, 0px)`;return`calc(var(--notification-${e}, ${t}) - ${t})`},Te=e=>e===`bottom`?`center top`:`center bottom`,Ee=e=>c(e.calc(e.marginXXL).mul(-1).equal()),De=e=>{let t=Ee(e);return`inset(${t} ${t} ${t} ${t})`},Oe=(e,t)=>{let n=Ee(e);return t===`bottom`?`inset(${n} ${n} 50% ${n})`:`inset(50% ${n} ${n} ${n})`},ke=(e,t)=>{let{componentCls:n}=e,{placement:r,vertical:i,blockEnd:a,horizontal:o,inlineEnd:s,isCenterPlacement:c}=t,l=`${n}-notice`,u=`${l}${n}-fade`,d=xe(t.motionOffset),f=xe(t.baseMotionOffset),p=Te(i);return{[`&${n}-${r}`]:{[i]:we(i),[a]:`auto`,display:`flex`,flexDirection:Ce(i),...c?{marginInline:0,left:`50%`,right:`auto`,transform:`translateX(-50%)`}:{[o]:0,[s]:`auto`},[l]:{[i]:`var(--notification-y, 0)`,...c?{left:`50%`,transform:f}:{[o]:`var(--notification-x, 0)`},transformOrigin:p},[`${u}-appear-prepare, ${u}-enter-prepare`]:{opacity:0,transform:d,transition:`none`},[`${u}-appear-start, ${u}-enter-start`]:{opacity:0,transform:d},[`${u}-appear-active, ${u}-enter-active`]:{opacity:1,transform:f},[`${u}-leave-start`]:{opacity:1,transform:f},[`${u}-leave-active`]:{opacity:0,transform:d},[`&${n}-stack:not(${n}-stack-expanded)`]:{[l]:{clipPath:Oe(e,i)},[`${l}[data-notification-index='0']`]:{clipPath:De(e)}}}}},Ae=(e,t=ve)=>{let{notificationMotionOffset:n}=e,r=c(n);return{...t.reduce((t,n)=>({...t,...ke(e,Se(n,r))}),{})}},je=e=>{let{componentCls:t}=e;return{[t]:Ae(e)}},Me=3,Ne=e=>({zIndexPopup:e.zIndexPopupBase+D+50,width:384,progressBg:`linear-gradient(90deg, ${e.colorPrimaryBorderHover}, ${e.colorPrimary})`,colorSuccessBg:void 0,colorErrorBg:void 0,colorInfoBg:void 0,colorWarningBg:void 0}),Pe=e=>{let t=e.paddingMD,n=e.paddingLG;return C(e,{notificationBg:e.colorBgElevated,notificationPaddingVertical:t,notificationPaddingHorizontal:n,notificationIconSize:e.calc(e.fontSizeLG).mul(e.lineHeightLG).equal(),notificationCloseButtonSize:e.calc(e.controlHeightLG).mul(.55).equal(),notificationMarginBottom:e.margin,notificationPadding:`${c(e.paddingMD)} ${c(e.paddingContentHorizontalLG)}`,notificationMarginEdge:e.marginLG,notificationProgressHeight:2,notificationMotionOffset:64})},Fe=e=>`inset(${e} ${e} ${e} ${e})`,Ie=e=>{let{componentCls:t,motionDurationMid:n,motionDurationSlow:r,motionEaseInOut:i}=e,a=`${`${t}-list`}-content`;return{[a]:{position:`relative`,display:`flex`,flexShrink:0,flexDirection:`column`,gap:e.notificationMarginBottom,width:`100%`,willChange:`height, transform`,transition:`none`,[`&${a}-decrease`]:{transition:`height calc(${r} * 2) ${i} ${n}`}},[`${t}-fade`]:{backfaceVisibility:`hidden`,willChange:`transform, opacity`}}},Le=(e,t)=>{let{componentCls:n,notificationMarginEdge:r}=e,i=`--notification-margin-edge`,a=`${n}-notice`,o=`${n}-list`,s=t.listWidthKey?e.calc(e[t.listWidthKey]).add(e.calc(r).mul(2)).equal():`100%`,l=`${a}:nth-last-child(n + ${(t.stackVisibleCount??Me)+1})`,u=Fe(c(e.calc(e.marginXXL).mul(-1).equal()));return{[n]:{..._(e),[i]:c(r),position:`fixed`,zIndex:e.zIndexPopup,width:s,maxWidth:`100vw`,height:`100vh`,overflow:`hidden`,overscrollBehavior:`contain`,[`${n}-hook-holder`]:{position:`relative`},[`&${o}`]:{maxHeight:`100vh`,padding:`var(${i})`,overflowX:`hidden`,overflowY:`auto`,overscrollBehavior:`contain`,scrollbarWidth:`none`,msOverflowStyle:`none`,pointerEvents:`none`,"&::-webkit-scrollbar":{display:`none`,width:0,height:0}},...Ie(e),[`&${n}-stack`]:{[a]:{clipPath:u},[`&:not(${n}-stack-expanded)`]:{[a]:{"--notification-scale":`calc(1 - min(var(--notification-index, 0), 2) * 0.06)`},[`${a}:not(${a}-stack-in-threshold)`]:{opacity:0,pointerEvents:`none`},[l]:{opacity:0,pointerEvents:`none`}}},"&-rtl":{direction:`rtl`,[`${a}-actions`]:{float:`left`}}}}};o([`Notification`,`PurePanel`],e=>ge(Pe(e)),Ne);var Re=(e,t)=>{let n=t.itemStyle??_e;return[Le(e,t),n(e),je(e)]},ze=S(`Notification`,e=>Re(Pe(e),{listWidthKey:`width`}),Ne),Be=e=>{let t=e.calc(e.controlHeightLG).sub(e.calc(e.fontSize).mul(e.lineHeight)).div(2).equal(),n=e.paddingSM;return C(Pe(e),{notificationBg:e.contentBg,notificationPadding:e.contentPadding,notificationPaddingVertical:t,notificationPaddingHorizontal:n})},Ve=e=>({zIndexPopup:e.zIndexPopupBase+D+10,contentBg:e.colorBgElevated,contentPadding:`${(e.controlHeightLG-e.fontSize*e.lineHeight)/2}px ${e.paddingSM}px`}),He=e=>{let{fontSize:t,fontSizeLG:n,lineHeight:r}=e;return me(e,{width:`max-content`,iconFontSize:n,titleFontSize:t,titleLineHeight:r,contentStyle:{alignItems:`center`,gap:e.marginXS},noticeStyle:{zIndex:1}})},Ue=e=>{let{componentCls:t}=e,n=`${t}-notice`,r=`${t}-list-content`,{"&::after":i,...a}=He(e)[n],o={...a,position:`absolute`,zIndex:-1,left:`50%`,height:e.calc(e.marginXS).mul(2).equal(),padding:0,boxShadow:e.boxShadowTertiary,opacity:0,pointerEvents:`none`,transform:`translateX(-50%) translateY(100%)`,transition:[`opacity ${e.motionDurationFast} ${e.motionEaseInOut}`,`transform ${e.motionDurationFast} ${e.motionEaseInOut}`,`width ${e.motionDurationSlow} ${e.motionEaseInOut}`].join(`, `),content:`""`};return{[t]:{[`&${t}-stack`]:{[r]:{isolation:`isolate`,"&::before":{...o,top:`calc(var(--top-notificiation-height) - ${c(e.marginXS)})`,width:`calc(var(--top-notificiation-width) - ${c(e.margin)})`},"&::after":{...o,zIndex:-2,top:`var(--top-notificiation-height)`,width:`calc(var(--top-notificiation-width) - ${c(e.calc(e.margin).mul(2).equal())})`}},[`&:not(${t}-stack-expanded)`]:{[r]:{"&::before, &::after":{opacity:1,transform:`translateX(-50%) translateY(0)`}}}}}}},We=e=>{let{componentCls:t}=e,n=`${t}-notice`,r=He(e);return{[`${n}-pure-panel`]:{width:`max-content`,maxWidth:`100%`,...r,[n]:{...r[n],position:`relative`,width:`max-content`,maxWidth:`100%`}}}},Ge=o([`Message`,`PurePanel`],e=>We(Be(e)),Ve),Ke=e=>({[e.componentCls]:He(e)}),qe=S(`Message`,e=>{let t=Be(e);return[Re(t,{stackVisibleCount:1,itemStyle:Ke}),Ue(t)]},Ve),Je={info:M.createElement(I,null),success:M.createElement(k,null),error:M.createElement(A,null),warning:M.createElement(j,null),loading:M.createElement(x,null)},Ye=(e,t)=>t||e&&Je[e]||null,Xe=e=>{let{prefixCls:t,className:r,style:a,type:o,icon:s,content:c,classNames:l,styles:u,...d}=e,{getPrefixCls:f,className:p,style:m,classNames:g,styles:_}=i(`message`),v=t||f(`message`),y=`${v}-notice`,b=E(v),[x,S]=qe(v,b),[C,w]=n([g,l],[_,u],{props:e}),T=Ye(o,s),D=o?`${y}-icon-${o}`:void 0,O={wrapper:h(o&&`${v}-${o}`,C.wrapper),icon:h(D,C.icon),title:C.title},k={wrapper:w.wrapper,icon:w.icon,title:w.title};return M.createElement(`div`,{className:h(`${y}-pure-panel`,x,r,S,b,C.root),style:w.root},M.createElement(Ge,{prefixCls:v}),M.createElement(H,{...d,prefixCls:v,className:p,style:{...m,...a},duration:null,icon:T,title:c,classNames:O,styles:k}))};function Ze(e,t){return{motionName:t??`${e}-fade`}}function Qe(e){let t,n=new Promise(n=>{t=e(()=>{n(!0)})}),r=()=>{t?.()};return r.then=(e,t)=>n.then(e,t),r.promise=n,r}var $e=8,et=3,tt=!1,nt=({children:e,prefixCls:t})=>{let n=E(t),[r,i]=qe(t,n);return M.createElement(W,{classNames:{list:h(r,i,n)}},e)},rt=(e,{prefixCls:t,key:n})=>M.createElement(nt,{prefixCls:t,key:n},e),it=M.forwardRef((e,r)=>{let{top:a,prefixCls:o,getContainer:s,maxCount:c,duration:l=et,rtl:u,classNames:d,styles:f,transitionName:p,pauseOnHover:m=!0,stack:g,onAllRemoved:_}=e,{getPrefixCls:v,direction:y,getPopupContainer:b}=i(`message`),{message:x}=M.useContext(t),S=o||v(`message`),C=w(x?.style),[T,E]=n([x?.classNames,d],[x?.styles,C,f],{props:e}),[D,O]=ce({prefixCls:S,style:()=>ue(a??$e),className:()=>h({[`${S}-rtl`]:u??y===`rtl`}),motion:()=>Ze(S,p),closable:!1,duration:l,getContainer:()=>s?.()||b?.()||document.body,maxCount:c,onAllRemoved:_,classNames:T,styles:E,renderNotifications:rt,pauseOnHover:m,stack:le(g,tt)});return M.useImperativeHandle(r,()=>({...D,prefixCls:S,message:x})),O}),at=0;function ot(e){let t=M.useRef(null);return O(`Message`),[M.useMemo(()=>{let n=e=>{t.current?.close(e)},i=r=>{if(!t.current){let e=()=>{};return e.then=()=>{},e}let{open:i,prefixCls:a,message:o}=t.current,s=o?.className||{},c=`${a}-notice`,{content:l,icon:u,type:d,key:f,className:m,style:g,onClose:_,classNames:v={},styles:y={},...x}=r,S=f;b(S)||(at+=1,S=`antd-message-${at}`);let C={...e,...r},w=p(v,{props:C}),T=p(y,{props:C}),E=Ye(d,u),D=d?`${c}-icon-${d}`:void 0;return Qe(e=>(i({...x,key:S,icon:E,title:l,classNames:{...w,wrapper:h(d&&`${a}-${d}`,w?.wrapper),icon:h(D,w?.icon)},styles:T,placement:`top`,className:h({[`${c}-${d}`]:d},m,s),style:g,onClose:()=>{_?.(),e()}}),()=>{n(S)}))},a={open:i,destroy:e=>{e===void 0?t.current?.destroy():n(e)}};return[`info`,`success`,`warning`,`error`,`loading`].forEach(e=>{a[e]=(t,n,a)=>{let o;o=y(t)&&`content`in t?t:{content:t};let s,c;r(n)?c=n:(s=n,c=a);let l={onClose:c,duration:s,...o,type:e};return i(l)}}),a},[]),M.createElement(it,{key:`message-holder`,...e,ref:t})]}function st(e){return ot(e)}var ct=M.createContext({}),lt=M.createContext({message:{},notification:{},modal:{}});export{I as _,Qe as a,qe as c,de as d,ue as f,W as g,Z as h,st as i,ze as l,ce as m,lt as n,Xe as o,le as p,ot as r,Ye as s,ct as t,fe as u}; |