1 line
24 KiB
JavaScript
1 line
24 KiB
JavaScript
import{o as e}from"./request-xrnk7ZJV.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,rr as C,wn as w,wt as T,yr as E,yt as D}from"./jsx-runtime-OfKoVykY.js";import{v as O,w as k}from"./tooltip-DI_m69zk.js";import{t as A}from"./CheckCircleFilled-C08zzZvv.js";import{t as ee}from"./CloseCircleFilled-DXDe2bjb.js";import{t as j}from"./ExclamationCircleFilled-Cqa4L7Rp.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,te=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 ne(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(),l.current=null,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 re(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 ie=({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:x=4.5,showProgress:S,hovering:w,pauseOnHover:T=!0,onClick:E,onMouseEnter:D,onMouseLeave:O,onClose:k}=e,[A,ee]=M.useState(0),j=`${n}-notice`,[N,P,F]=re(p),I=v(()=>{P.onClose?.(),k?.()}),[L,R]=M.useState(!1),[z,B]=ne(x,I,ee),te=100-Math.min(Math.max(A*100,0),100),H=s?.progress||ie;M.useEffect(()=>{T&&(w?B():L||z())},[w,L,B,z,T]);function U(e){R(!0),T&&B(),D?.(e)}function W(e){R(!1),T&&!w&&z(),O?.(e)}function G(e){e.preventDefault(),e.stopPropagation(),I()}let K=v(()=>{L&&W()});M.useEffect(()=>K,[K]);let q=M.useRef(m);m!==void 0&&(q.current=m);let J=M.useRef(g);g!==void 0&&(J.current=g);let Y=m??q.current,X=g??J.current??0,Z=b(c)?M.createElement(`div`,{className:h(`${j}-title`,a?.title),style:o?.title},c):null,Q=b(l)?M.createElement(`div`,{className:h(`${j}-description`,a?.description),style:o?.description},l):null,ae=Z!==null,oe=Q!==null,$;$=ae&&oe?M.createElement(`div`,{className:h(`${j}-section`,a?.section),style:o?.section},Z,Q):Z||Q,b(u)&&($=M.createElement(`div`,{className:h(`${j}-wrapper`,a?.wrapper),style:o?.wrapper},M.createElement(`div`,{className:h(`${j}-icon`,a?.icon),style:o?.icon},u),$));let se=C(d)?M.createElement(`div`,{className:h(`${j}-actions`,a?.actions),style:o?.actions},d):null,ce={"--notification-index":X,...o?.root,...i};Y!==void 0&&(ce[`--notification-y`]=`${Y}px`);let le=f??y?.role??`alert`;return M.createElement(`div`,V({},y,{ref:t,role:le,"data-notification-index":X,className:h(j,r,a?.root,{[`${j}-closable`]:N,[`${j}-stack-in-threshold`]:_}),style:ce,onClick:E,onMouseEnter:U,onMouseLeave:W}),$,se,N&&M.createElement(`button`,V({type:`button`,className:h(`${j}-close`,a?.close),"aria-label":`Close`},F,{style:o?.close,onClick:G}),P.closeIcon),S&&typeof x==`number`&&x>0&&M.createElement(H,{className:h(`${j}-progress`,a?.progress),percent:te,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 Z(e,t){let n=String(t),r=e.findIndex(e=>e.key===n);if(r!==-1)return e.length-r-1}var Q=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=E(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)}}))},ae=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}]=te(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,ee,j,N]=R(t,T,E),P=!!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)},[P]);let F=`${n}-list`;return M.createElement(`div`,{className:h(n,F,`${n}-${u}`,g?.list,d,i?.list,{[`${n}-stack`]:y,[`${n}-stack-expanded`]:w,[`${F}-hovered`]:S}),style:{...o?.list,...f}},M.createElement(K,{listPrefixCls:F,height:ee,topNoticeHeight:j,topNoticeWidth:N,className:i?.listContent,style:o?.listContent,ref:O,onMouseEnter:()=>{C(!0)},onMouseLeave:()=>{C(!1)}},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=Z(_,l),f=y&&d!==void 0&&d<x;return M.createElement(Q,{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(ae,{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)}),$=()=>document.body,se=0;function ce(...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 le(e={}){let{getContainer:t=$,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=ce(y,e);(t.key===null||t.key===void 0)&&(t.key=`rc-notification-${se}`,se+=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 ue=(e,t)=>M.useMemo(()=>{let n=e??t;return n?{...y(t)?t:{},...y(n)?n:{}}:!1},[e,t]);function de(e,t){return{...b(e)&&{"--notification-top":c(e)},...b(t)&&{"--notification-bottom":c(t)}}}function fe(e){return{motionName:`${e}-fade`}}function pe(e,t,n){return e===void 0?t?.closeIcon===void 0?n?.closeIcon:t.closeIcon:e}var me=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(`, `)}},he=(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`,...me(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}}}},ge=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{...he(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}}},_e=e=>{let{componentCls:t,width:n}=e,r=`${t}-notice`,i=`${r}-actions`,a=ge(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`}}}},ve=e=>{let{componentCls:t}=e;return{[t]:ge(e)}},ye=[`top`,`topLeft`,`topRight`,`bottom`,`bottomLeft`,`bottomRight`],be=`--notification-margin-edge`,xe=(e,t)=>({blockEnd:e===`top`?`bottom`:`top`,inlineEnd:t===`left`?`right`:`left`}),Se=e=>`translate3d(${e?.x??`0`}, ${e?.y??`0`}, 0) scale(var(--notification-scale, 1))`,Ce=(e,t)=>{let n=e.startsWith(`bottom`)?`bottom`:`top`,r=e.endsWith(`Right`)?`right`:`left`,{blockEnd:i,inlineEnd:a}=xe(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}},we=e=>e===`bottom`?`column-reverse`:`column`,Te=e=>{let t=`var(${be}, 0px)`;return`calc(var(--notification-${e}, ${t}) - ${t})`},Ee=e=>e===`bottom`?`center top`:`center bottom`,De=e=>c(e.calc(e.marginXXL).mul(-1).equal()),Oe=e=>{let t=De(e);return`inset(${t} ${t} ${t} ${t})`},ke=(e,t)=>{let n=De(e);return t===`bottom`?`inset(${n} ${n} 50% ${n})`:`inset(50% ${n} ${n} ${n})`},Ae=(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=Se(t.motionOffset),f=Se(t.baseMotionOffset),p=Ee(i);return{[`&${n}-${r}`]:{[i]:Te(i),[a]:`auto`,display:`flex`,flexDirection:we(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`]:{pointerEvents:`none`,"&-start":{opacity:1,transform:f},"&-active":{opacity:0,transform:d}},[`&${n}-stack:not(${n}-stack-expanded)`]:{[l]:{clipPath:ke(e,i)},[`${l}[data-notification-index='0']`]:{clipPath:Oe(e)}}}}},je=(e,t=ye)=>{let{notificationMotionOffset:n}=e,r=c(n);return{...t.reduce((t,n)=>({...t,...Ae(e,Ce(n,r))}),{})}},Me=e=>{let{componentCls:t}=e;return{[t]:je(e)}},Ne=3,Pe=e=>({zIndexPopup:e.zIndexPopupBase+O+50,width:384,progressBg:`linear-gradient(90deg, ${e.colorPrimaryBorderHover}, ${e.colorPrimary})`,colorSuccessBg:void 0,colorErrorBg:void 0,colorInfoBg:void 0,colorWarningBg:void 0}),Fe=e=>{let t=e.paddingMD,n=e.paddingLG;return w(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})},Ie=e=>`inset(${e} ${e} ${e} ${e})`,Le=(e,t)=>{let{componentCls:n,motionDurationMid:r,motionDurationSlow:i,motionEaseInOut:a}=e,o=`${`${n}-list`}-content`;return{[o]:{position:`relative`,display:`flex`,flexShrink:0,flexDirection:`column`,gap:e.notificationMarginBottom,width:`100%`,willChange:`height, transform`,transition:`none`,pointerEvents:t,[`&${o}-decrease`]:{transition:`height calc(${i} * 2) ${a} ${r}`}},[`${n}-fade`]:{backfaceVisibility:`hidden`,willChange:`transform, opacity`}}},Re=(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??Ne)+1})`,u=Ie(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`,[`&${o}`]:{maxHeight:`100vh`,padding:`var(${i})`,overflowX:`hidden`,overflowY:`auto`,overscrollBehavior:`contain`,scrollbarWidth:`none`,pointerEvents:`none`,"&::-webkit-scrollbar":{display:`none`,width:0,height:0}},...Le(e,t.listContentPointerEvents??`auto`),[`&${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=>_e(Fe(e)),Pe);var ze=(e,t)=>{let n=t.itemStyle??ve;return[Re(e,t),n(e),Me(e)]},Be=S(`Notification`,e=>ze(Fe(e),{listWidthKey:`width`}),Pe),Ve=e=>{let t=e.calc(e.controlHeightLG).sub(e.calc(e.fontSize).mul(e.lineHeight)).div(2).equal(),n=e.paddingSM;return w(Fe(e),{notificationBg:e.contentBg,notificationPadding:e.contentPadding,notificationPaddingVertical:t,notificationPaddingHorizontal:n})},He=e=>({zIndexPopup:e.zIndexPopupBase+O+10,contentBg:e.colorBgElevated,contentPadding:`${(e.controlHeightLG-e.fontSize*e.lineHeight)/2}px ${e.paddingSM}px`}),Ue=e=>{let{fontSize:t,fontSizeLG:n,lineHeight:r}=e;return he(e,{width:`max-content`,iconFontSize:n,titleFontSize:t,titleLineHeight:r,contentStyle:{alignItems:`center`,gap:e.marginXS},noticeStyle:{zIndex:1}})},We=e=>{let{componentCls:t}=e,n=`${t}-notice`,r=`${t}-list-content`,{"&::after":i,...a}=Ue(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)`}}}}}}},Ge=e=>{let{componentCls:t}=e,n=`${t}-notice`,r=Ue(e);return{[`${n}-pure-panel`]:{width:`max-content`,maxWidth:`100%`,...r,[n]:{...r[n],position:`relative`,width:`max-content`,maxWidth:`100%`}}}},Ke=o([`Message`,`PurePanel`],e=>Ge(Ve(e)),He),qe=e=>({[e.componentCls]:Ue(e)}),Je=S(`Message`,e=>{let t=Ve(e);return[ze(t,{stackVisibleCount:1,itemStyle:qe,listContentPointerEvents:`none`}),We(t)]},He),Ye={info:M.createElement(I,null),success:M.createElement(A,null),error:M.createElement(ee,null),warning:M.createElement(j,null),loading:M.createElement(x,null)},Xe=(e,t)=>C(t)?t:e&&Ye[e]||null,Ze=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=D(v),[x,S]=Je(v,b),[C,w]=n([g,l],[_,u],{props:e}),T=Xe(o,s),E=o?`${y}-icon-${o}`:void 0,O={wrapper:h(o&&`${v}-${o}`,C.wrapper),icon:h(E,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(Ke,{prefixCls:v}),M.createElement(H,{...d,prefixCls:v,className:p,style:{...m,...a},duration:null,icon:T,title:c,classNames:O,styles:k}))};function Qe(e,t){return{motionName:t??`${e}-fade`}}function $e(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 et=8,tt=3,nt=!1,rt=({children:e,prefixCls:t})=>{let n=D(t),[r,i]=Je(t,n);return M.createElement(W,{classNames:{list:h(r,i,n)}},e)},it=(e,{prefixCls:t,key:n})=>M.createElement(rt,{prefixCls:t,key:n},e),at=M.forwardRef((e,r)=>{let{top:a,prefixCls:o,getContainer:s,maxCount:c,duration:l=tt,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=T(x?.style),[w,E]=n([x?.classNames,d],[x?.styles,C,f],{props:e}),[D,O]=le({prefixCls:S,style:()=>de(a??et),className:()=>h({[`${S}-rtl`]:u??y===`rtl`}),motion:()=>Qe(S,p),closable:!1,duration:l,getContainer:()=>s?.()||b?.()||document.body,maxCount:c,onAllRemoved:_,classNames:w,styles:E,renderNotifications:it,pauseOnHover:m,stack:ue(g,nt)});return M.useImperativeHandle(r,()=>({...D,prefixCls:S,message:x})),O}),ot=0;function st(e){let t=M.useRef(null);return k(`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)||(ot+=1,S=`antd-message-${ot}`);let C={...e,...r},w=p(v,{props:C}),T=p(y,{props:C}),E=Xe(d,u),D=d?`${c}-icon-${d}`:void 0;return $e(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(at,{key:`message-holder`,...e,ref:t})]}function ct(e){return st(e)}var lt=M.createContext({}),ut=M.createContext({message:{},notification:{},modal:{}});export{I as _,$e as a,Je as c,fe as d,de as f,W as g,ae as h,ct as i,Be as l,le as m,ut as n,Ze as o,ue as p,st as r,Xe as s,lt as t,pe as u}; |