import{c as w,f as ct,g as gr,e as q,h as Ht,_ as It,a as Tt,b as de}from"./@babel-Dv-xQaqJ.js";import{r as i}from"./react-Ph8KmUpc.js";import{r as _t}from"./react-dom-Bv_et8d-.js";import{c as qr,a as V,e as Vt,u as qt,r as yt,s as Gr,d as $t,f as Gt,h as Ut,i as _e,j as vt,k as jt,l as St,g as ft,m as Qt,n as Jt,o as Kt}from"./rc-util-BDKLzca1.js";import{c as tr}from"./classnames-BexLmjtK.js";import{R as Lt}from"./rc-resize-observer-BSz1LNuQ.js";import{C as xt}from"./rc-motion-B6ouyUg3.js";var At=i.createContext(null),bt=[];function Zt(e,t){var r=i.useState(function(){if(!qr())return null;var y=document.createElement("div");return y}),n=w(r,1),a=n[0],u=i.useRef(!1),l=i.useContext(At),s=i.useState(bt),m=w(s,2),c=m[0],g=m[1],v=l||(u.current?void 0:function(y){g(function(E){var P=[y].concat(ct(E));return P})});function S(){a.parentElement||document.body.appendChild(a),u.current=!0}function d(){var y;(y=a.parentElement)===null||y===void 0||y.removeChild(a),u.current=!1}return V(function(){return e?l?l(S):S():d(),d},[e]),V(function(){c.length&&(c.forEach(function(y){return y()}),g(bt))},[c]),[a,v]}function Xt(){return document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth}var Yt="rc-util-locker-".concat(Date.now()),Nt=0;function Ot(e){var t=!!e,r=i.useState(function(){return Nt+=1,"".concat(Yt,"_").concat(Nt)}),n=w(r,1),a=n[0];V(function(){if(t){var u=Vt(document.body).width,l=Xt();qt(`
html body {
  overflow-y: hidden;
  `.concat(l?"width: calc(100% - ".concat(u,"px);"):"",`
}`),a)}else yt(a);return function(){yt(a)}},[t,a])}var pt=!1;function en(e){return pt}var Ct=function(t){return t===!1?!1:!qr()||!t?null:typeof t=="string"?document.querySelector(t):typeof t=="function"?t():t},Bt=i.forwardRef(function(e,t){var r=e.open,n=e.autoLock,a=e.getContainer;e.debug;var u=e.autoDestroy,l=u===void 0?!0:u,s=e.children,m=i.useState(r),c=w(m,2),g=c[0],v=c[1],S=g||r;i.useEffect(function(){(l||r)&&v(r)},[r,l]);var d=i.useState(function(){return Ct(a)}),y=w(d,2),E=y[0],P=y[1];i.useEffect(function(){var H=Ct(a);P(H??null)});var _=Zt(S&&!E),k=w(_,2),b=k[0],f=k[1],x=E??b;Ot(n&&r&&qr()&&(x===b||x===document.body));var G=null;if(s&&Gr(s)&&t){var j=s;G=j.ref}var Z=$t(G,t);if(!S||!qr()||E===void 0)return null;var re=x===!1||en(),F=s;return t&&(F=i.cloneElement(s,{ref:Z})),i.createElement(At.Provider,{value:f},re?F:_t.createPortal(F,x))});function rn(e){var t=e.prefixCls,r=e.align,n=e.arrow,a=e.arrowPos,u=n||{},l=u.className,s=u.content,m=a.x,c=m===void 0?0:m,g=a.y,v=g===void 0?0:g,S=i.useRef();if(!r||!r.points)return null;var d={position:"absolute"};if(r.autoArrow!==!1){var y=r.points[0],E=r.points[1],P=y[0],_=y[1],k=E[0],b=E[1];P===k||!["t","b"].includes(P)?d.top=v:P==="t"?d.top=0:d.bottom=0,_===b||!["l","r"].includes(_)?d.left=c:_==="l"?d.left=0:d.right=0}return i.createElement("div",{ref:S,className:tr("".concat(t,"-arrow"),l),style:d},s)}function tn(e){var t=e.prefixCls,r=e.open,n=e.zIndex,a=e.mask,u=e.motion;return a?i.createElement(xt,gr({},u,{motionAppear:!0,visible:r,removeOnLeave:!0}),function(l){var s=l.className;return i.createElement("div",{style:{zIndex:n},className:tr("".concat(t,"-mask"),s)})}):null}var nn=i.memo(function(e){var t=e.children;return t},function(e,t){return t.cache}),an=i.forwardRef(function(e,t){var r=e.popup,n=e.className,a=e.prefixCls,u=e.style,l=e.target,s=e.onVisibleChanged,m=e.open,c=e.keepDom,g=e.fresh,v=e.onClick,S=e.mask,d=e.arrow,y=e.arrowPos,E=e.align,P=e.motion,_=e.maskMotion,k=e.forceRender,b=e.getPopupContainer,f=e.autoDestroy,x=e.portal,G=e.zIndex,j=e.onMouseEnter,Z=e.onMouseLeave,re=e.onPointerEnter,F=e.ready,H=e.offsetX,me=e.offsetY,he=e.offsetR,ue=e.offsetB,ge=e.onAlign,$=e.onPrepare,A=e.stretch,C=e.targetWidth,X=e.targetHeight,D=typeof r=="function"?r():r,oe=m||c,te=(b==null?void 0:b.length)>0,nr=i.useState(!b||!te),Ge=w(nr,2),ye=Ge[0],Ue=Ge[1];if(V(function(){!ye&&te&&l&&Ue(!0)},[ye,te,l]),!ye)return null;var ne="auto",B={left:"-1000vw",top:"-1000vh",right:ne,bottom:ne};if(F||!m){var Y,le=E.points,se=E.dynamicInset||((Y=E._experimental)===null||Y===void 0?void 0:Y.dynamicInset),je=se&&le[0][1]==="r",ar=se&&le[0][0]==="b";je?(B.right=he,B.left=ne):(B.left=H,B.right=ne),ar?(B.bottom=ue,B.top=ne):(B.top=me,B.bottom=ne)}var z={};return A&&(A.includes("height")&&X?z.height=X:A.includes("minHeight")&&X&&(z.minHeight=X),A.includes("width")&&C?z.width=C:A.includes("minWidth")&&C&&(z.minWidth=C)),m||(z.pointerEvents="none"),i.createElement(x,{open:k||oe,getContainer:b&&function(){return b(l)},autoDestroy:f},i.createElement(tn,{prefixCls:a,open:m,zIndex:G,mask:S,motion:_}),i.createElement(Lt,{onResize:ge,disabled:!m},function(Qe){return i.createElement(xt,gr({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:k,leavedClassName:"".concat(a,"-hidden")},P,{onAppearPrepare:$,onEnterPrepare:$,visible:m,onVisibleChanged:function(Q){var Se;P==null||(Se=P.onVisibleChanged)===null||Se===void 0||Se.call(P,Q),s(Q)}}),function(we,Q){var Se=we.className,M=we.style,$e=tr(a,Se,n);return i.createElement("div",{ref:Gt(Qe,t,Q),className:$e,style:q(q(q(q({"--arrow-x":"".concat(y.x||0,"px"),"--arrow-y":"".concat(y.y||0,"px")},B),z),M),{},{boxSizing:"border-box",zIndex:G},u),onMouseEnter:j,onMouseLeave:Z,onPointerEnter:re,onClick:v},d&&i.createElement(rn,{prefixCls:a,arrow:d,arrowPos:y,align:E}),i.createElement(nn,{cache:!m&&!g},D))})}))}),un=i.forwardRef(function(e,t){var r=e.children,n=e.getTriggerDOMNode,a=Gr(r),u=i.useCallback(function(s){Ut(t,n?n(s):s)},[n]),l=$t(u,r.ref);return a?i.cloneElement(r,{ref:l}):r}),Mt=i.createContext(null);function wt(e){return e?Array.isArray(e)?e:[e]:[]}function on(e,t,r,n){return i.useMemo(function(){var a=wt(r??t),u=wt(n??t),l=new Set(a),s=new Set(u);return e&&(l.has("hover")&&(l.delete("hover"),l.add("click")),s.has("hover")&&(s.delete("hover"),s.add("click"))),[l,s]},[e,t,r,n])}function ln(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;return r?e[0]===t[0]:e[0]===t[0]&&e[1]===t[1]}function sn(e,t,r,n){for(var a=r.points,u=Object.keys(e),l=0;l<u.length;l+=1){var s,m=u[l];if(ln((s=e[m])===null||s===void 0?void 0:s.points,a,n))return"".concat(t,"-placement-").concat(m)}return""}function Et(e,t,r,n){return t||(r?{motionName:"".concat(e,"-").concat(r)}:n?{motionName:n}:null)}function br(e){return e.ownerDocument.defaultView}function dt(e){for(var t=[],r=e==null?void 0:e.parentElement,n=["hidden","scroll","clip","auto"];r;){var a=br(r).getComputedStyle(r),u=a.overflowX,l=a.overflowY,s=a.overflow;[u,l,s].some(function(m){return n.includes(m)})&&t.push(r),r=r.parentElement}return t}function Sr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(e)?t:e}function mr(e){return Sr(parseFloat(e),0)}function Pt(e,t){var r=q({},e);return(t||[]).forEach(function(n){if(!(n instanceof HTMLBodyElement||n instanceof HTMLHtmlElement)){var a=br(n).getComputedStyle(n),u=a.overflow,l=a.overflowClipMargin,s=a.borderTopWidth,m=a.borderBottomWidth,c=a.borderLeftWidth,g=a.borderRightWidth,v=n.getBoundingClientRect(),S=n.offsetHeight,d=n.clientHeight,y=n.offsetWidth,E=n.clientWidth,P=mr(s),_=mr(m),k=mr(c),b=mr(g),f=Sr(Math.round(v.width/y*1e3)/1e3),x=Sr(Math.round(v.height/S*1e3)/1e3),G=(y-E-k-b)*f,j=(S-d-P-_)*x,Z=P*x,re=_*x,F=k*f,H=b*f,me=0,he=0;if(u==="clip"){var ue=mr(l);me=ue*f,he=ue*x}var ge=v.x+F-me,$=v.y+Z-he,A=ge+v.width+2*me-F-H-G,C=$+v.height+2*he-Z-re-j;r.left=Math.max(r.left,ge),r.top=Math.max(r.top,$),r.right=Math.min(r.right,A),r.bottom=Math.min(r.bottom,C)}}),r}function kt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r="".concat(t),n=r.match(/^(.*)\%$/);return n?e*(parseFloat(n[1])/100):parseFloat(r)}function Dt(e,t){var r=t||[],n=w(r,2),a=n[0],u=n[1];return[kt(e.width,a),kt(e.height,u)]}function Rt(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[e[0],e[1]]}function rr(e,t){var r=t[0],n=t[1],a,u;return r==="t"?u=e.y:r==="b"?u=e.y+e.height:u=e.y+e.height/2,n==="l"?a=e.x:n==="r"?a=e.x+e.width:a=e.x+e.width/2,{x:a,y:u}}function Te(e,t){var r={t:"b",b:"t",l:"r",r:"l"};return e.map(function(n,a){return a===t?r[n]||"c":n}).join("")}function cn(e,t,r,n,a,u,l){var s=i.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:a[n]||{}}),m=w(s,2),c=m[0],g=m[1],v=i.useRef(0),S=i.useMemo(function(){return t?dt(t):[]},[t]),d=i.useRef({}),y=function(){d.current={}};e||y();var E=_e(function(){if(t&&r&&e){let ee=function(Me,qe){var pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$e,er=D.x+Me,fr=D.y+qe,dr=er+Y,zr=fr+B,it=Math.max(er,pe.left),ut=Math.max(fr,pe.top),ot=Math.min(dr,pe.right),lt=Math.min(zr,pe.bottom);return Math.max(0,(ot-it)*(lt-ut))},Fr=function(){ke=D.y+N,De=ke+B,Re=D.x+T,Ze=Re+Y};var k,b,f=t,x=f.ownerDocument,G=br(f),j=G.getComputedStyle(f),Z=j.width,re=j.height,F=j.position,H=f.style.left,me=f.style.top,he=f.style.right,ue=f.style.bottom,ge=f.style.overflow,$=q(q({},a[n]),u),A=x.createElement("div");(k=f.parentElement)===null||k===void 0||k.appendChild(A),A.style.left="".concat(f.offsetLeft,"px"),A.style.top="".concat(f.offsetTop,"px"),A.style.position=F,A.style.height="".concat(f.offsetHeight,"px"),A.style.width="".concat(f.offsetWidth,"px"),f.style.left="0",f.style.top="0",f.style.right="auto",f.style.bottom="auto",f.style.overflow="hidden";var C;if(Array.isArray(r))C={x:r[0],y:r[1],width:0,height:0};else{var X=r.getBoundingClientRect();C={x:X.x,y:X.y,width:X.width,height:X.height}}var D=f.getBoundingClientRect(),oe=x.documentElement,te=oe.clientWidth,nr=oe.clientHeight,Ge=oe.scrollWidth,ye=oe.scrollHeight,Ue=oe.scrollTop,ne=oe.scrollLeft,B=D.height,Y=D.width,le=C.height,se=C.width,je={left:0,top:0,right:te,bottom:nr},ar={left:-ne,top:-Ue,right:Ge-ne,bottom:ye-Ue},z=$.htmlRegion,Qe="visible",we="visibleFirst";z!=="scroll"&&z!==we&&(z=Qe);var Q=z===we,Se=Pt(ar,S),M=Pt(je,S),$e=z===Qe?M:Se,O=Q?M:$e;f.style.left="auto",f.style.top="auto",f.style.right="0",f.style.bottom="0";var Nr=f.getBoundingClientRect();f.style.left=H,f.style.top=me,f.style.right=he,f.style.bottom=ue,f.style.overflow=ge,(b=f.parentElement)===null||b===void 0||b.removeChild(A);var Le=Sr(Math.round(Y/parseFloat(Z)*1e3)/1e3),xe=Sr(Math.round(B/parseFloat(re)*1e3)/1e3);if(Le===0||xe===0||vt(r)&&!jt(r))return;var Cr=$.offset,ae=$.targetOffset,Ur=Dt(D,Cr),Mr=w(Ur,2),ie=Mr[0],p=Mr[1],ce=Dt(C,ae),wr=w(ce,2),Er=wr[0],jr=wr[1];C.x-=Er,C.y-=jr;var Je=$.points||[],J=w(Je,2),Ee=J[0],Qr=J[1],be=Rt(Qr),K=Rt(Ee),Pr=rr(C,be),ir=rr(D,K),Pe=q({},$),T=Pr.x-ir.x+ie,N=Pr.y-ir.y+p,ve=ee(T,N),fe=ee(T,N,M),Ae=rr(C,["t","l"]),ur=rr(D,["t","l"]),or=rr(C,["b","r"]),lr=rr(D,["b","r"]),U=$.overflow||{},Jr=U.adjustX,kr=U.adjustY,Ke=U.shiftX,sr=U.shiftY,Dr=function(qe){return typeof qe=="boolean"?qe:qe>=0},ke,De,Re,Ze;Fr();var cr=Dr(kr),vr=K[0]===be[0];if(cr&&K[0]==="t"&&(De>O.bottom||d.current.bt)){var Be=N;vr?Be-=B-le:Be=Ae.y-lr.y-p;var We=ee(T,Be),Kr=ee(T,Be,M);We>ve||We===ve&&(!Q||Kr>=fe)?(d.current.bt=!0,N=Be,p=-p,Pe.points=[Te(K,0),Te(be,0)]):d.current.bt=!1}if(cr&&K[0]==="b"&&(ke<O.top||d.current.tb)){var W=N;vr?W+=B-le:W=or.y-ur.y-p;var Rr=ee(T,W),Zr=ee(T,W,M);Rr>ve||Rr===ve&&(!Q||Zr>=fe)?(d.current.tb=!0,N=W,p=-p,Pe.points=[Te(K,0),Te(be,0)]):d.current.tb=!1}var Ir=Dr(Jr),Tr=K[1]===be[1];if(Ir&&K[1]==="l"&&(Ze>O.right||d.current.rl)){var Fe=T;Tr?Fe-=Y-se:Fe=Ae.x-lr.x-ie;var _r=ee(Fe,N),Xr=ee(Fe,N,M);_r>ve||_r===ve&&(!Q||Xr>=fe)?(d.current.rl=!0,T=Fe,ie=-ie,Pe.points=[Te(K,1),Te(be,1)]):d.current.rl=!1}if(Ir&&K[1]==="r"&&(Re<O.left||d.current.lr)){var ze=T;Tr?ze+=Y-se:ze=or.x-ur.x-ie;var $r=ee(ze,N),Xe=ee(ze,N,M);$r>ve||$r===ve&&(!Q||Xe>=fe)?(d.current.lr=!0,T=ze,ie=-ie,Pe.points=[Te(K,1),Te(be,1)]):d.current.lr=!1}Fr();var Ne=Ke===!0?0:Ke;typeof Ne=="number"&&(Re<M.left&&(T-=Re-M.left-ie,C.x+se<M.left+Ne&&(T+=C.x-M.left+se-Ne)),Ze>M.right&&(T-=Ze-M.right-ie,C.x>M.right-Ne&&(T+=C.x-M.right+Ne)));var He=sr===!0?0:sr;typeof He=="number"&&(ke<M.top&&(N-=ke-M.top-p,C.y+le<M.top+He&&(N+=C.y-M.top+le-He)),De>M.bottom&&(N-=De-M.bottom-p,C.y>M.bottom-He&&(N+=C.y-M.bottom+He)));var Ye=D.x+T,Oe=Ye+Y,Ce=D.y+N,Lr=Ce+B,Ve=C.x,Ie=Ve+se,xr=C.y,Yr=xr+le,Or=Math.max(Ye,Ve),Ar=Math.min(Oe,Ie),pr=(Or+Ar)/2,et=pr-Ye,rt=Math.max(Ce,xr),Br=Math.min(Lr,Yr),tt=(rt+Br)/2,nt=tt-Ce;l==null||l(t,Pe);var Wr=Nr.right-D.x-(T+D.width),at=Nr.bottom-D.y-(N+D.height);g({ready:!0,offsetX:T/Le,offsetY:N/xe,offsetR:Wr/Le,offsetB:at/xe,arrowX:et/Le,arrowY:nt/xe,scaleX:Le,scaleY:xe,align:Pe})}}),P=function(){v.current+=1;var b=v.current;Promise.resolve().then(function(){v.current===b&&E()})},_=function(){g(function(b){return q(q({},b),{},{ready:!1})})};return V(_,[n]),V(function(){e||_()},[e]),[c.ready,c.offsetX,c.offsetY,c.offsetR,c.offsetB,c.arrowX,c.arrowY,c.scaleX,c.scaleY,c.align,P]}function vn(e,t,r,n,a){V(function(){if(e&&t&&r){let v=function(){n(),a()};var u=t,l=r,s=dt(u),m=dt(l),c=br(l),g=new Set([c].concat(ct(s),ct(m)));return g.forEach(function(S){S.addEventListener("scroll",v,{passive:!0})}),c.addEventListener("resize",v,{passive:!0}),n(),function(){g.forEach(function(S){S.removeEventListener("scroll",v),c.removeEventListener("resize",v)})}}},[e,t,r])}function fn(e,t,r,n,a,u,l,s){var m=i.useRef(e),c=i.useRef(!1);m.current!==e&&(c.current=!0,m.current=e),i.useEffect(function(){var g=St(function(){c.current=!1});return function(){St.cancel(g)}},[e]),i.useEffect(function(){if(t&&n&&(!a||u)){var g=function(){var G=!1,j=function(F){var H=F.target;G=l(H)},Z=function(F){var H=F.target;!c.current&&m.current&&!G&&!l(H)&&s(!1)};return[j,Z]},v=g(),S=w(v,2),d=S[0],y=S[1],E=g(),P=w(E,2),_=P[0],k=P[1],b=br(n);b.addEventListener("mousedown",d,!0),b.addEventListener("click",y,!0),b.addEventListener("contextmenu",y,!0);var f=ft(r);return f&&(f.addEventListener("mousedown",_,!0),f.addEventListener("click",k,!0),f.addEventListener("contextmenu",k,!0)),function(){b.removeEventListener("mousedown",d,!0),b.removeEventListener("click",y,!0),b.removeEventListener("contextmenu",y,!0),f&&(f.removeEventListener("mousedown",_,!0),f.removeEventListener("click",k,!0),f.removeEventListener("contextmenu",k,!0))}}},[t,r,n,a,u])}var dn=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function mn(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bt,t=i.forwardRef(function(r,n){var a=r.prefixCls,u=a===void 0?"rc-trigger-popup":a,l=r.children,s=r.action,m=s===void 0?"hover":s,c=r.showAction,g=r.hideAction,v=r.popupVisible,S=r.defaultPopupVisible,d=r.onPopupVisibleChange,y=r.afterPopupVisibleChange,E=r.mouseEnterDelay,P=r.mouseLeaveDelay,_=P===void 0?.1:P,k=r.focusDelay,b=r.blurDelay,f=r.mask,x=r.maskClosable,G=x===void 0?!0:x,j=r.getPopupContainer,Z=r.forceRender,re=r.autoDestroy,F=r.destroyPopupOnHide,H=r.popup,me=r.popupClassName,he=r.popupStyle,ue=r.popupPlacement,ge=r.builtinPlacements,$=ge===void 0?{}:ge,A=r.popupAlign,C=r.zIndex,X=r.stretch,D=r.getPopupClassNameFromAlign,oe=r.fresh,te=r.alignPoint,nr=r.onPopupClick,Ge=r.onPopupAlign,ye=r.arrow,Ue=r.popupMotion,ne=r.maskMotion,B=r.popupTransitionName,Y=r.popupAnimation,le=r.maskTransitionName,se=r.maskAnimation,je=r.className,ar=r.getTriggerDOMNode,z=Ht(r,dn),Qe=re||F||!1,we=i.useState(!1),Q=w(we,2),Se=Q[0],M=Q[1];V(function(){M(Qt())},[]);var $e=i.useRef({}),O=i.useContext(Mt),Nr=i.useMemo(function(){return{registerSubPopup:function(h,R){$e.current[h]=R,O==null||O.registerSubPopup(h,R)}}},[O]),Le=Jt(),xe=i.useState(null),Cr=w(xe,2),ae=Cr[0],Ur=Cr[1],Mr=_e(function(o){vt(o)&&ae!==o&&Ur(o),O==null||O.registerSubPopup(Le,o)}),ie=i.useState(null),p=w(ie,2),ce=p[0],wr=p[1],Er=i.useRef(null),jr=_e(function(o){vt(o)&&ce!==o&&(wr(o),Er.current=o)}),Je=i.Children.only(l),J=(Je==null?void 0:Je.props)||{},Ee={},Qr=_e(function(o){var h,R,L=ce;return(L==null?void 0:L.contains(o))||((h=ft(L))===null||h===void 0?void 0:h.host)===o||o===L||(ae==null?void 0:ae.contains(o))||((R=ft(ae))===null||R===void 0?void 0:R.host)===o||o===ae||Object.values($e.current).some(function(I){return(I==null?void 0:I.contains(o))||o===I})}),be=Et(u,Ue,Y,B),K=Et(u,ne,se,le),Pr=i.useState(S||!1),ir=w(Pr,2),Pe=ir[0],T=ir[1],N=v??Pe,ve=_e(function(o){v===void 0&&T(o)});V(function(){T(v||!1)},[v]);var fe=i.useRef(N);fe.current=N;var Ae=i.useRef([]);Ae.current=[];var ur=_e(function(o){var h;ve(o),((h=Ae.current[Ae.current.length-1])!==null&&h!==void 0?h:N)!==o&&(Ae.current.push(o),d==null||d(o))}),or=i.useRef(),lr=function(){clearTimeout(or.current)},U=function(h){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;lr(),R===0?ur(h):or.current=setTimeout(function(){ur(h)},R*1e3)};i.useEffect(function(){return lr},[]);var Jr=i.useState(!1),kr=w(Jr,2),Ke=kr[0],sr=kr[1];V(function(o){(!o||N)&&sr(!0)},[N]);var Dr=i.useState(null),ke=w(Dr,2),De=ke[0],Re=ke[1],Ze=i.useState([0,0]),cr=w(Ze,2),vr=cr[0],Be=cr[1],We=function(h){Be([h.clientX,h.clientY])},Kr=cn(N,ae,te?vr:ce,ue,$,A,Ge),W=w(Kr,11),Rr=W[0],Zr=W[1],Ir=W[2],Tr=W[3],Fe=W[4],_r=W[5],Xr=W[6],ze=W[7],$r=W[8],Xe=W[9],Ne=W[10],He=on(Se,m,c,g),Ye=w(He,2),Oe=Ye[0],Ce=Ye[1],Lr=Oe.has("click"),Ve=Ce.has("click")||Ce.has("contextMenu"),Ie=_e(function(){Ke||Ne()}),xr=function(){fe.current&&te&&Ve&&U(!1)};vn(N,ce,ae,Ie,xr),V(function(){Ie()},[vr,ue]),V(function(){N&&!($!=null&&$[ue])&&Ie()},[JSON.stringify(A)]);var Yr=i.useMemo(function(){var o=sn($,u,Xe,te);return tr(o,D==null?void 0:D(Xe))},[Xe,D,$,u,te]);i.useImperativeHandle(n,function(){return{nativeElement:Er.current,forceAlign:Ie}});var Or=i.useState(0),Ar=w(Or,2),pr=Ar[0],et=Ar[1],rt=i.useState(0),Br=w(rt,2),tt=Br[0],nt=Br[1],Wr=function(){if(X&&ce){var h=ce.getBoundingClientRect();et(h.width),nt(h.height)}},at=function(){Wr(),Ie()},ee=function(h){sr(!1),Ne(),y==null||y(h)},Fr=function(){return new Promise(function(h){Wr(),Re(function(){return h})})};V(function(){De&&(Ne(),De(),Re(null))},[De]);function Me(o,h,R,L){Ee[o]=function(I){var Hr;L==null||L(I),U(h,R);for(var st=arguments.length,gt=new Array(st>1?st-1:0),Vr=1;Vr<st;Vr++)gt[Vr-1]=arguments[Vr];(Hr=J[o])===null||Hr===void 0||Hr.call.apply(Hr,[J,I].concat(gt))}}(Lr||Ve)&&(Ee.onClick=function(o){var h;fe.current&&Ve?U(!1):!fe.current&&Lr&&(We(o),U(!0));for(var R=arguments.length,L=new Array(R>1?R-1:0),I=1;I<R;I++)L[I-1]=arguments[I];(h=J.onClick)===null||h===void 0||h.call.apply(h,[J,o].concat(L))}),fn(N,Ve,ce,ae,f,G,Qr,U);var qe=Oe.has("hover"),pe=Ce.has("hover"),er,fr;qe&&(Me("onMouseEnter",!0,E,function(o){We(o)}),Me("onPointerEnter",!0,E,function(o){We(o)}),er=function(){(N||Ke)&&U(!0,E)},te&&(Ee.onMouseMove=function(o){var h;(h=J.onMouseMove)===null||h===void 0||h.call(J,o)})),pe&&(Me("onMouseLeave",!1,_),Me("onPointerLeave",!1,_),fr=function(){U(!1,_)}),Oe.has("focus")&&Me("onFocus",!0,k),Ce.has("focus")&&Me("onBlur",!1,b),Oe.has("contextMenu")&&(Ee.onContextMenu=function(o){var h;fe.current&&Ce.has("contextMenu")?U(!1):(We(o),U(!0)),o.preventDefault();for(var R=arguments.length,L=new Array(R>1?R-1:0),I=1;I<R;I++)L[I-1]=arguments[I];(h=J.onContextMenu)===null||h===void 0||h.call.apply(h,[J,o].concat(L))}),je&&(Ee.className=tr(J.className,je));var dr=q(q({},J),Ee),zr={},it=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];it.forEach(function(o){z[o]&&(zr[o]=function(){for(var h,R=arguments.length,L=new Array(R),I=0;I<R;I++)L[I]=arguments[I];(h=dr[o])===null||h===void 0||h.call.apply(h,[dr].concat(L)),z[o].apply(z,L)})});var ut=i.cloneElement(Je,q(q({},dr),zr)),ot={x:_r,y:Xr},lt=ye?q({},ye!==!0?ye:{}):null;return i.createElement(i.Fragment,null,i.createElement(Lt,{disabled:!N,ref:jr,onResize:at},i.createElement(un,{getTriggerDOMNode:ar},ut)),i.createElement(Mt.Provider,{value:Nr},i.createElement(an,{portal:e,ref:Mr,prefixCls:u,popup:H,className:tr(me,Yr),style:he,target:ce,onMouseEnter:er,onMouseLeave:fr,onPointerEnter:er,zIndex:C,open:N,keepDom:Ke,fresh:oe,onClick:nr,mask:f,motion:be,maskMotion:K,onVisibleChanged:ee,onPrepare:Fr,forceRender:Z,autoDestroy:Qe,getPopupContainer:j,align:Xe,arrow:lt,arrowPos:ot,ready:Rr,offsetX:Zr,offsetY:Ir,offsetR:Tr,offsetB:Fe,onAlign:Ie,stretch:X,targetWidth:pr/ze,targetHeight:tt/$r})))});return t}const kn=mn(Bt);function mt(){return typeof BigInt=="function"}function Wt(e){return!e&&e!==0&&!Number.isNaN(e)||!String(e).trim()}function yr(e){var t=e.trim(),r=t.startsWith("-");r&&(t=t.slice(1)),t=t.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),t.startsWith(".")&&(t="0".concat(t));var n=t||"0",a=n.split("."),u=a[0]||"0",l=a[1]||"0";u==="0"&&l==="0"&&(r=!1);var s=r?"-":"";return{negative:r,negativeStr:s,trimStr:n,integerStr:u,decimalStr:l,fullStr:"".concat(s).concat(n)}}function ht(e){var t=String(e);return!Number.isNaN(Number(t))&&t.includes("e")}function hr(e){var t=String(e);if(ht(e)){var r=Number(t.slice(t.indexOf("e-")+2)),n=t.match(/\.(\d+)/);return n!=null&&n[1]&&(r+=n[1].length),r}return t.includes(".")&&zt(t)?t.length-t.indexOf(".")-1:0}function Ft(e){var t=String(e);if(ht(e)){if(e>Number.MAX_SAFE_INTEGER)return String(mt()?BigInt(e).toString():Number.MAX_SAFE_INTEGER);if(e<Number.MIN_SAFE_INTEGER)return String(mt()?BigInt(e).toString():Number.MIN_SAFE_INTEGER);t=e.toFixed(hr(t))}return yr(t).fullStr}function zt(e){return typeof e=="number"?!Number.isNaN(e):e?/^\s*-?\d+(\.\d+)?\s*$/.test(e)||/^\s*-?\d+\.\s*$/.test(e)||/^\s*-?\.\d+\s*$/.test(e):!1}var hn=function(){function e(t){if(Tt(this,e),de(this,"origin",""),de(this,"negative",void 0),de(this,"integer",void 0),de(this,"decimal",void 0),de(this,"decimalLen",void 0),de(this,"empty",void 0),de(this,"nan",void 0),Wt(t)){this.empty=!0;return}if(this.origin=String(t),t==="-"||Number.isNaN(t)){this.nan=!0;return}var r=t;if(ht(r)&&(r=Number(r)),r=typeof r=="string"?r:Ft(r),zt(r)){var n=yr(r);this.negative=n.negative;var a=n.trimStr.split(".");this.integer=BigInt(a[0]);var u=a[1]||"0";this.decimal=BigInt(u),this.decimalLen=u.length}else this.nan=!0}return It(e,[{key:"getMark",value:function(){return this.negative?"-":""}},{key:"getIntegerStr",value:function(){return this.integer.toString()}},{key:"getDecimalStr",value:function(){return this.decimal.toString().padStart(this.decimalLen,"0")}},{key:"alignDecimal",value:function(r){var n="".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(r,"0"));return BigInt(n)}},{key:"negate",value:function(){var r=new e(this.toString());return r.negative=!r.negative,r}},{key:"cal",value:function(r,n,a){var u=Math.max(this.getDecimalStr().length,r.getDecimalStr().length),l=this.alignDecimal(u),s=r.alignDecimal(u),m=n(l,s).toString(),c=a(u),g=yr(m),v=g.negativeStr,S=g.trimStr,d="".concat(v).concat(S.padStart(c+1,"0"));return new e("".concat(d.slice(0,-c),".").concat(d.slice(-c)))}},{key:"add",value:function(r){if(this.isInvalidate())return new e(r);var n=new e(r);return n.isInvalidate()?this:this.cal(n,function(a,u){return a+u},function(a){return a})}},{key:"multi",value:function(r){var n=new e(r);return this.isInvalidate()||n.isInvalidate()?new e(NaN):this.cal(n,function(a,u){return a*u},function(a){return a*2})}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return this.nan}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(r){return this.toString()===(r==null?void 0:r.toString())}},{key:"lessEquals",value:function(r){return this.add(r.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return r?this.isInvalidate()?"":yr("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),e}(),gn=function(){function e(t){if(Tt(this,e),de(this,"origin",""),de(this,"number",void 0),de(this,"empty",void 0),Wt(t)){this.empty=!0;return}this.origin=String(t),this.number=Number(t)}return It(e,[{key:"negate",value:function(){return new e(-this.toNumber())}},{key:"add",value:function(r){if(this.isInvalidate())return new e(r);var n=Number(r);if(Number.isNaN(n))return this;var a=this.number+n;if(a>Number.MAX_SAFE_INTEGER)return new e(Number.MAX_SAFE_INTEGER);if(a<Number.MIN_SAFE_INTEGER)return new e(Number.MIN_SAFE_INTEGER);var u=Math.max(hr(this.number),hr(n));return new e(a.toFixed(u))}},{key:"multi",value:function(r){var n=Number(r);if(this.isInvalidate()||Number.isNaN(n))return new e(NaN);var a=this.number*n;if(a>Number.MAX_SAFE_INTEGER)return new e(Number.MAX_SAFE_INTEGER);if(a<Number.MIN_SAFE_INTEGER)return new e(Number.MIN_SAFE_INTEGER);var u=Math.max(hr(this.number),hr(n));return new e(a.toFixed(u))}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return Number.isNaN(this.number)}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(r){return this.toNumber()===(r==null?void 0:r.toNumber())}},{key:"lessEquals",value:function(r){return this.add(r.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return r?this.isInvalidate()?"":Ft(this.number):this.origin}}]),e}();function yn(e){return mt()?new hn(e):new gn(e)}function Sn(e,t,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e==="")return"";var a=yr(e),u=a.negativeStr,l=a.integerStr,s=a.decimalStr,m="".concat(t).concat(s),c="".concat(u).concat(l);if(r>=0){var g=Number(s[r]);if(g>=5&&!n){var v=yn(e).add("".concat(u,"0.").concat("0".repeat(r)).concat(10-g));return Sn(v.toString(),t,r,n)}return r===0?c:"".concat(c).concat(t).concat(s.padEnd(r,"0").slice(0,r))}return m===".0"?c:"".concat(c).concat(m)}function Dn(e){var t=i.createContext(void 0),r=function(a){var u=a.value,l=a.children,s=i.useRef(u);s.current=u;var m=i.useState(function(){return{getValue:function(){return s.current},listeners:new Set}}),c=w(m,1),g=c[0];return V(function(){_t.unstable_batchedUpdates(function(){g.listeners.forEach(function(v){v(u)})})},[u]),i.createElement(t.Provider,{value:g},l)};return{Context:t,Provider:r,defaultValue:e}}function Rn(e,t){var r=_e(typeof t=="function"?t:function(v){if(t===void 0)return v;if(!Array.isArray(t))return v[t];var S={};return t.forEach(function(d){S[d]=v[d]}),S}),n=i.useContext(e==null?void 0:e.Context),a=n||{},u=a.listeners,l=a.getValue,s=i.useRef();s.current=r(n?l():e==null?void 0:e.defaultValue);var m=i.useState({}),c=w(m,2),g=c[1];return V(function(){if(!n)return;function v(S){var d=r(S);Kt(s.current,d,!0)||g({})}return u.add(v),function(){u.delete(v)}},[n]),s.current}function In(){var e=i.createContext(null);function t(){return i.useContext(e)}function r(a,u){var l=Gr(a),s=function(c,g){var v=l?{ref:g}:{},S=i.useRef(0),d=i.useRef(c),y=t();return y!==null?i.createElement(a,gr({},c,v)):((!u||u(d.current,c))&&(S.current+=1),d.current=c,i.createElement(e.Provider,{value:S.current},i.createElement(a,gr({},c,v))))};return l?i.forwardRef(s):s}function n(a,u){var l=Gr(a),s=function(c,g){var v=l?{ref:g}:{};return t(),i.createElement(a,gr({},c,v))};return l?i.memo(i.forwardRef(s),u):i.memo(s,u)}return{makeImmutable:r,responseImmutable:n,useImmutableMark:t}}export{Bt as P,kn as T,hr as a,Sn as b,In as c,Dn as d,yn as g,Ft as n,yr as t,Rn as u,zt as v};
