码桶

发现社区成员的开源项目

geekssl /

wstats

公开
main
wstats/public/assets/Sites-BQNkeczd.js
Sites-BQNkeczd.js359.5 KB
import{R as p,U as Po,V as Oo,E as In,r as C,W as Bi,X as Io,Y as be,Z as Ye,_ as tt,$ as _e,a0 as zn,a1 as me,a2 as ht,a3 as Gt,a4 as pa,a5 as T,a6 as ut,a7 as fa,a8 as c,a9 as kt,aa as M,ab as Ls,ac as Be,ad as To,ae as pt,af as Ns,F as Qt,M as vn,D as Cn,ag as Fo,ah as Do,ai as Ro,aj as ko,ak as Ao,al as Lo,am as No,an as se,ao as Wn,ap as ga,aq as Me,ar as Ht,as as Le,at as Mo,au as ma,av as en,aw as ya,ax as fn,o as Pt,ay as $o,az as Ms,aA as Sn,aB as ba,aC as jo,aD as _i,aE as Pi,aF as Vo,aG as Ko,aH as Ho,aI as ct,h as Ot,aJ as Js,aK as Ge,aL as Jt,aM as va,aN as Bo,aO as Ca,aP as Uo,aQ as zo,aR as Wo,aS as Sa,aT as Xo,I as Go,aU as Es,B as Ie,aV as qo,T as xs,aW as Yo,aX as Zo,C as Ui,aY as Jo,u as Qo,c as el,a as tl,b as Nt,j as R,aZ as nl,S as ms}from"./index-GWuvg2UH.js";import{B as on}from"./index-DihvOmSo.js";import{E as sl}from"./index-VbOLTMR0.js";import{i as zi,M as Mn}from"./Modal-08QhW3n9.js";import{f as _s,n as Ct,a as Vn,_ as wa,c as $s,b as Ea,d as xa,C as pr,e as _a,g as Qs,I as il,h as Pa,i as Oi,j as qt,k as rl,l as fr,m as Oa,o as al,p as ei,q as gr,r as mr,s as Mt,t as ol,u as ln,v as yr,T as ll}from"./index-mZVFvfKe.js";import{T as et}from"./index-BW_2QB9V.js";import{h as ti,g as Ke,r as ni,_ as br,s as si,e as cl}from"./object-DkPZvw8u.js";import{I as Ii,a as dl}from"./IconTickCircle-BYgwCdAe.js";import{F as ul}from"./textarea-BIzdQNE8.js";import{I as hl}from"./index-BMbdBPA2.js";import{R as pl,b as fl}from"./index-DIHsQVbu.js";import{p as gl,s as He,f as Ti,u as vr,z as ii,i as Cr,I as ml,C as Sr,c as Fi,D as yl}from"./index-DWKYNnDc.js";import{S as bl}from"./index-CfWZ9ycl.js";import{_ as vl}from"./slice-B6jKCnyX.js";import{P as wr}from"./index-WdvJbv7c.js";import{I as Cl}from"./IconRefresh-BRkV1NtY.js";import"./_baseDifference-DopHgqVv.js";import"./Animation-CU6YFe7Y.js";function Er(r){return typeof r=="object"&&r!=null&&r.nodeType===1}function xr(r,e){return(!e||r!=="hidden")&&r!=="visible"&&r!=="clip"}function ri(r,e){if(r.clientHeight<r.scrollHeight||r.clientWidth<r.scrollWidth){var t=getComputedStyle(r,null);return xr(t.overflowY,e)||xr(t.overflowX,e)||function(n){var s=function(i){if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}}(n);return!!s&&(s.clientHeight<n.scrollHeight||s.clientWidth<n.scrollWidth)}(r)}return!1}function ys(r,e,t,n,s,i,a,o){return i<r&&a>e||i>r&&a<e?0:i<=r&&o<=t||a>=e&&o>=t?i-r-n:a>e&&o<t||i<r&&o>t?a-e+s:0}var _r=function(r,e){var t=window,n=e.scrollMode,s=e.block,i=e.inline,a=e.boundary,o=e.skipOverflowHiddenElements,l=typeof a=="function"?a:function(Se){return Se!==a};if(!Er(r))throw new TypeError("Invalid target");for(var d,u,h=document.scrollingElement||document.documentElement,f=[],g=r;Er(g)&&l(g);){if((g=(u=(d=g).parentElement)==null?d.getRootNode().host||null:u)===h){f.push(g);break}g!=null&&g===document.body&&ri(g)&&!ri(document.documentElement)||g!=null&&ri(g,o)&&f.push(g)}for(var b=t.visualViewport?t.visualViewport.width:innerWidth,m=t.visualViewport?t.visualViewport.height:innerHeight,v=window.scrollX||pageXOffset,y=window.scrollY||pageYOffset,w=r.getBoundingClientRect(),E=w.height,S=w.width,x=w.top,_=w.right,P=w.bottom,I=w.left,O=s==="start"||s==="nearest"?x:s==="end"?P:x+E/2,F=i==="center"?I+S/2:i==="end"?_:I,D=[],$=0;$<f.length;$++){var L=f[$],N=L.getBoundingClientRect(),J=N.height,z=N.width,V=N.top,G=N.right,H=N.bottom,j=N.left;if(n==="if-needed"&&x>=0&&I>=0&&P<=m&&_<=b&&x>=V&&P<=H&&I>=j&&_<=G)return D;var q=getComputedStyle(L),A=parseInt(q.borderLeftWidth,10),K=parseInt(q.borderTopWidth,10),oe=parseInt(q.borderRightWidth,10),fe=parseInt(q.borderBottomWidth,10),ce=0,ve=0,Ce="offsetWidth"in L?L.offsetWidth-L.clientWidth-A-oe:0,de="offsetHeight"in L?L.offsetHeight-L.clientHeight-K-fe:0,B="offsetWidth"in L?L.offsetWidth===0?0:z/L.offsetWidth:0,ft="offsetHeight"in L?L.offsetHeight===0?0:J/L.offsetHeight:0;if(h===L)ce=s==="start"?O:s==="end"?O-m:s==="nearest"?ys(y,y+m,m,K,fe,y+O,y+O+E,E):O-m/2,ve=i==="start"?F:i==="center"?F-b/2:i==="end"?F-b:ys(v,v+b,b,A,oe,v+F,v+F+S,S),ce=Math.max(0,ce+y),ve=Math.max(0,ve+v);else{ce=s==="start"?O-V-K:s==="end"?O-H+fe+de:s==="nearest"?ys(V,H,J,K,fe+de,O,O+E,E):O-(V+J/2)+de/2,ve=i==="start"?F-j-A:i==="center"?F-(j+z/2)+Ce/2:i==="end"?F-G+oe+Ce:ys(j,G,z,A,oe+Ce,F,F+S,S);var we=L.scrollLeft,Pe=L.scrollTop;O+=Pe-(ce=Math.max(0,Math.min(Pe+ce/ft,L.scrollHeight-J/ft+de))),F+=we-(ve=Math.max(0,Math.min(we+ve/B,L.scrollWidth-z/B+Ce)))}D.push({el:L,top:ce,left:ve})}return D};function Ia(r){return r===Object(r)&&Object.keys(r).length!==0}function Sl(r,e){e===void 0&&(e="auto");var t="scrollBehavior"in document.body.style;r.forEach(function(n){var s=n.el,i=n.top,a=n.left;s.scroll&&t?s.scroll({top:i,left:a,behavior:e}):(s.scrollTop=i,s.scrollLeft=a)})}function wl(r){return r===!1?{block:"end",inline:"nearest"}:Ia(r)?r:{block:"start",inline:"nearest"}}function ai(r,e){var t=r.isConnected||r.ownerDocument.documentElement.contains(r);if(Ia(e)&&typeof e.behavior=="function")return e.behavior(t?_r(r,e):[]);if(t){var n=wl(e);return Sl(_r(r,n),n.behavior)}}function Di(r){return p.isValidElement(r)}function Pr(r){return p.Children.count(r)===0}function El(r){Po(1,arguments);var e=Oo(r),t=e.getHours();return t}function xl(r){return C.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},r),C.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2a1 1 0 0 0-1-1H6a2 2 0 0 0-2 2v18c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V10a1 1 0 0 0-1-1h-5a2 2 0 0 1-2-2V2ZM7 8a1 1 0 0 1 1-1h1a1 1 0 0 1 0 2H8a1 1 0 0 1-1-1Zm0 5a1 1 0 0 1 1-1h8a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1Zm1 4a1 1 0 1 0 0 2h8a1 1 0 1 0 0-2H8Zm11.07-9.5H14.5a1 1 0 0 1-1-1V1.93a.8.8 0 0 1 1.37-.56l4.76 4.76a.8.8 0 0 1-.56 1.37Z",fill:"currentColor"}))}const Ri=In(xl,"file");function _l(r){return C.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},r),C.createElement("path",{d:"M5 2a3 3 0 0 0-3 3v3h20c0-2-1-4-3-4h-6.45a3 3 0 0 1-1.87-.66l-1.13-.9A2 2 0 0 0 8.3 2H5Z",fill:"currentColor"}),C.createElement("path",{d:"M22 10H2v9a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-9Z",fill:"currentColor"}))}const Pl=In(_l,"folder");function Ol(r){return C.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},r),C.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 5a3 3 0 0 1 3-3h3.3a2 2 0 0 1 1.25.44l1.13.9a3 3 0 0 0 1.87.66H18c2 0 3 2 3 4H7.53A2 2 0 0 0 5.6 9.48L2.57 20.76C2.21 20.26 2 19.66 2 19V5Zm20.17 5H9.5a2 2 0 0 0-1.92 1.44l-2.7 9.28A1 1 0 0 0 5.82 22H18.5a2 2 0 0 0 1.92-1.44l2.7-9.28a1 1 0 0 0-.95-1.28Z",fill:"currentColor"}))}const Il=In(Ol,"folder_open");function Tl(r){return C.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},r),C.createElement("path",{d:"M9 7a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",fill:"currentColor"}),C.createElement("path",{d:"M9 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",fill:"currentColor"}),C.createElement("path",{d:"M11 19a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",fill:"currentColor"}),C.createElement("path",{d:"M15 7a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",fill:"currentColor"}),C.createElement("path",{d:"M17 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",fill:"currentColor"}),C.createElement("path",{d:"M15 21a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",fill:"currentColor"}))}const Fl=In(Tl,"handle");function Dl(r){return C.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},r),C.createElement("path",{d:"M10.75 1.9c.4-1.2 2.1-1.2 2.5 0l1.99 6.12h6.45a1.3 1.3 0 0 1 .77 2.37l-5.22 3.78 2 6.11c.39 1.2-1 2.2-2.02 1.46L12 17.96l-5.22 3.78c-1.02.75-2.4-.25-2.01-1.46l1.99-6.11-5.22-3.78a1.3 1.3 0 0 1 .77-2.37h6.45l2-6.12Z",fill:"currentColor"}))}const Rl=In(Dl,"star");function kl(r){return C.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},r),C.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.84 8.06A6.5 6.5 0 1 0 5.18 11 4.5 4.5 0 0 0 5.5 20H17a6 6 0 0 0 .84-11.94Zm-5.52.2a.5.5 0 0 0-.64 0l-5.15 4.3a.25.25 0 0 0 .16.44H10v4.5c0 .28.22.5.5.5h3a.5.5 0 0 0 .5-.5V13h3.31c.23 0 .34-.3.16-.44l-5.15-4.3Z",fill:"currentColor"}))}const Al=In(kl,"upload"),Ta={PREFIX:`${be}-autocomplete`,PREFIX_OPTION:`${be}-autocomplete-option`},Wi={SIZE:["small","large","default"],POSITION:Io.POSITION_SET,STATUS:Bi};class Ll extends Ye{constructor(e){super(Object.assign({},e)),this.isPanelOpen=!1}init(){this._setDropdownWidth();const{defaultOpen:e,data:t,defaultValue:n,value:s}=this.getProps();if(t&&t.length){const a=this._generateList(t);this._adapter.updateOptionList(a)}e&&this.openDropdown();let i;typeof n<"u"&&(i=n),typeof s<"u"&&(i=s),typeof i<"u"&&this.handleValueChange(i)}destroy(){this._adapter.unregisterClickOutsideHandler()}_setDropdownWidth(){const{style:e,dropdownMatchSelectWidth:t}=this.getProps();let n;t&&(e&&tt(e.width)||e&&_e(e.width)&&!e.width.includes("%")?n=e.width:n=this._adapter.getTriggerWidth(),this._adapter.setOptionWrapperWidth(n))}handleInputClick(e){const{options:t}=this.getStates(),{disabled:n}=this.getProps();n||(this.isPanelOpen?this.closeDropdown():this.openDropdown())}openDropdown(){this.isPanelOpen=!0,this._adapter.toggleListVisible(!0),this._setDropdownWidth(),this._adapter.registerClickOutsideHandler(e=>this.closeDropdown(e)),this._adapter.notifyDropdownVisibleChange(!0),this._modifyFocusIndexOnPanelOpen()}closeDropdown(e){this.isPanelOpen=!1,this._adapter.toggleListVisible(!1),this._adapter.unregisterClickOutsideHandler(),this._adapter.notifyDropdownVisibleChange(!1)}_generateList(e){const{renderItem:t}=this.getProps(),n=[];return e&&e.length&&e.forEach((s,i)=>{const a=String(new Date().getTime())+i;let o={};_e(s)||tt(s)?o={value:s,key:a,label:s,show:!0}:zn(s)&&!me(s.value)&&(o=Object.assign({show:!0},s)),t&&typeof t=="function"&&(o._renderedLabel=t(s)),n.push(o)}),n}handleSearch(e){this._adapter.updateInputValue(e),this._adapter.notifySearch(e),this._adapter.notifyChange(e),this._modifyFocusIndex(e),this.isPanelOpen||this.openDropdown()}handleSelect(e,t){const{renderSelectedItem:n}=this.getProps();let s="";n&&typeof n=="function"?(s=n(e),ht(typeof s!="string","Warning: [Semi AutoComplete] renderSelectedItem must return string, please check your function return")):s=e.value,this._isControlledComponent()?(this.closeDropdown(),this.notifySelect(e)):(this._adapter.updateInputValue(s),this.updateSelection(e),this.notifySelect(e),this.closeDropdown()),this._adapter.notifyChange(s),this._adapter.updateFocusIndex(t)}updateSelection(e){const t=new Map;e&&t.set(e.label,e),this._adapter.updateSelection(t)}notifySelect(e){this._backwardLabelInValue()?this._adapter.notifySelect(e):this._adapter.notifySelect(e.value)}_backwardLabelInValue(){const e=this.getProps();let{onSelectWithObject:t}=e;return t}handleDataChange(e){const t=this._generateList(e);this._adapter.updateOptionList(t),this._adapter.rePositionDropdown();let{inputValue:n}=this.getStates();this._modifyFocusIndex(n)}handleValueChange(e){let{data:t,defaultActiveFirstOption:n}=this.getProps(),s="";this._backwardLabelInValue()&&Object.prototype.toString.call(e)==="[object Object]"?s=e.value:s=e;let i=this._getRenderSelectedItem();const a=this._generateList(t);let o=a.length?a.filter(h=>i(h)===s):[];const l=o.length,d=a.findIndex(h=>i(h)===s);let u="";if(l)o=o[0],u=i(o);else{const h=this._backwardLabelInValue()?e:{label:s,value:s};u=i(h)}this._adapter.updateInputValue(u),this.updateSelection(l?o:null),d===-1&&n?this._adapter.updateFocusIndex(0):this._adapter.updateFocusIndex(d)}_modifyFocusIndex(e){let{focusIndex:t}=this.getStates(),{data:n,defaultActiveFirstOption:s}=this.getProps(),i=-1;if(e){let a=this._getRenderSelectedItem();i=this._generateList(n).findIndex(l=>a(l)===e)}i===-1&&s?t!==0&&this._adapter.updateFocusIndex(0):i!==t&&this._adapter.updateFocusIndex(i)}_modifyFocusIndexOnPanelOpen(){let{inputValue:e}=this.getStates();this._modifyFocusIndex(e)}_getRenderSelectedItem(){let{renderSelectedItem:e}=this.getProps();return typeof e>"u"&&(e=t=>t==null?void 0:t.value),e}handleClear(){this._adapter.notifyClear()}bindKeyBoardEvent(){this._keydownHandler=e=>{this._handleKeyDown(e)},this._adapter.registerKeyDown(this._keydownHandler)}_handleKeyDown(e){const t=e.keyCode,{visible:n}=this.getStates();switch(t){case Gt.UP:e.preventDefault(),this._handleArrowKeyDown(-1);break;case Gt.DOWN:e.preventDefault(),this._handleArrowKeyDown(1);break;case Gt.ENTER:e.preventDefault(),this._handleEnterKeyDown();break;case Gt.ESC:this.closeDropdown();break;case Gt.TAB:this.closeDropdown();break}this._adapter.notifyKeyDown(e)}_getEnableFocusIndex(e){const{focusIndex:t,options:n}=this.getStates(),s=n.filter(o=>o.show),i=s.length;let a=t+e;if(a<0&&(a=i-1),a>=i&&(a=0),e>0){let o=-1;for(let l=0;l<s.length&&(!s[l].disabled&&(o=l),!(o>=a));l++);a=o}else{let o=s.length;for(let l=i-1;l>=0&&(!s[l].disabled&&(o=l),!(o<=a));l--);a=o}this._adapter.updateFocusIndex(a),this._adapter.updateScrollTop(a)}_handleArrowKeyDown(e){const{visible:t}=this.getStates();t?this._getEnableFocusIndex(e):this.openDropdown()}_handleEnterKeyDown(){const{visible:e,options:t,focusIndex:n}=this.getStates();if(!e)this.openDropdown();else if(n!==void 0&&n!==-1&&t.length!==0){const i=t.filter(a=>a.show)[n];i&&this.handleSelect(i,n)}else this.closeDropdown()}handleOptionMouseEnter(e){this._adapter.updateFocusIndex(e)}handleFocus(e){this.bindKeyBoardEvent(),this._adapter.notifyFocus(e)}handleBlur(e){this._persistEvent(e),this._adapter.notifyBlur(e)}}var Or=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};class ns extends C.PureComponent{onClick(e,t){var{value:n,label:s,children:i}=e,a=Or(e,["value","label","children"]);const{props:o}=this;o.disabled||o.onSelect(Object.assign(Object.assign({},a),{value:n,label:s||i}),t)}renderOptionContent(e){let{children:t,inputValue:n,prefixCls:s}=e;return _e(t)&&n?p.createElement(pa,{searchWords:[n],sourceString:t,highlightClassName:`${s}-keyword`}):t}render(){const e=this.props,{children:t,disabled:n,value:s,selected:i,label:a,empty:o,emptyContent:l,onSelect:d,focused:u,showTick:h,className:f,style:g,onMouseEnter:b,prefixCls:m,renderOptionItem:v,inputValue:y}=e,w=Or(e,["children","disabled","value","selected","label","empty","emptyContent","onSelect","focused","showTick","className","style","onMouseEnter","prefixCls","renderOptionItem","inputValue"]),E=T(m,{[`${m}-disabled`]:n,[`${m}-selected`]:i,[`${m}-focused`]:u,[`${m}-empty`]:o,[f]:f}),S=T([`${m}-icon`]);return o?l===null?null:p.createElement(ut,{componentName:"Select"},x=>p.createElement("div",{className:E,"x-semi-prop":"emptyContent"},l||x.emptyText)):typeof v=="function"?v(Object.assign({disabled:n,focused:u,selected:i,style:g,label:a,value:s,inputValue:y,onMouseEnter:x=>b(x),onClick:x=>this.onClick(Object.assign({value:s,label:a,children:t},w),x)},w)):p.createElement("div",{className:E,onClick:x=>{this.onClick(Object.assign({value:s,label:a,children:t},w),x)},onMouseEnter:x=>b&&b(x),role:"option","aria-selected":i?"true":"false","aria-disabled":n?"true":"false",style:g},h?p.createElement("div",{className:S},p.createElement(fa,null)):null,_e(t)?p.createElement("div",{className:`${m}-text`},this.renderOptionContent({children:t,inputValue:y,prefixCls:m})):t)}}ns.isSelectOption=!0;ns.propTypes={children:c.node,disabled:c.bool,value:c.oneOfType([c.string,c.number]),selected:c.bool,label:c.node,empty:c.bool,emptyContent:c.node,onSelect:c.func,focused:c.bool,showTick:c.bool,className:c.string,style:c.object,onMouseEnter:c.func,prefixCls:c.string,renderOptionItem:c.func,inputValue:c.string};ns.defaultProps={prefixCls:Ta.PREFIX_OPTION};const $t=Ta.PREFIX,Nl=Wi.SIZE,Ml=Wi.POSITION,$l=Wi.STATUS;class wn extends Be{constructor(e){super(e),this.onSelect=(n,s,i)=>{this.foundation.handleSelect(n,s)},this.onSearch=n=>{this.foundation.handleSearch(n)},this.onBlur=n=>this.foundation.handleBlur(n),this.onFocus=n=>this.foundation.handleFocus(n),this.onInputClear=()=>this.foundation.handleClear(),this.handleInputClick=n=>this.foundation.handleInputClick(n),this.foundation=new Ll(this.adapter);const t=1;this.state={dropdownMinWidth:null,inputValue:"",options:[],visible:!1,focusIndex:e.defaultActiveFirstOption?0:-1,selection:new Map,rePosKey:t},this.triggerRef=p.createRef(),this.optionsRef=p.createRef(),this.optionContainerEl=p.createRef(),this.clickOutsideHandler=null,this.optionListId="",ht("triggerRender"in this.props&&typeof this.props.triggerRender=="function",`[Semi AutoComplete]
            - If you are using the following props: 'suffix', 'prefix', 'showClear', 'validateStatus', and 'size',
            please notice that they will be removed in the next major version.
            Please use 'componentProps' to retrieve these props instead.
            - If you are using 'onBlur', 'onFocus', please try to avoid using them and look for changes in the future.`)}get adapter(){const e={registerKeyDown:t=>{const n={onKeyDown:t};this.setState({keyboardEventSet:n})},unregisterKeyDown:t=>{this.setState({keyboardEventSet:{}})},updateFocusIndex:t=>{this.setState({focusIndex:t})},updateScrollTop:t=>{let n;n=`.${$t}-option-selected`,t!==void 0&&(n=`.${$t}-option:nth-child(${t+1})`);let s=document.querySelector(`#${$t}-${this.optionListId} ${n}`);if(Array.isArray(s)&&(s=s[0]),s){const i=s.parentNode;i.scrollTop=s.offsetTop-i.offsetTop-i.clientHeight/2+s.clientHeight/2}}};return Object.assign(Object.assign(Object.assign({},super.adapter),e),{getTriggerWidth:()=>{const t=this.triggerRef.current;return t&&t.getBoundingClientRect().width},setOptionWrapperWidth:t=>{this.setState({dropdownMinWidth:t})},updateInputValue:t=>{this.setState({inputValue:t})},toggleListVisible:t=>{this.setState({visible:t})},updateOptionList:t=>{this.setState({options:t})},updateSelection:t=>{this.setState({selection:t})},notifySearch:t=>{this.props.onSearch(t)},notifyChange:t=>{this.props.onChange(t)},notifySelect:t=>{this.props.onSelect(t)},notifyDropdownVisibleChange:t=>{this.props.onDropdownVisibleChange(t)},notifyClear:()=>{this.props.onClear()},notifyFocus:t=>{this.props.onFocus(t)},notifyBlur:t=>{this.props.onBlur(t)},notifyKeyDown:t=>{this.props.onKeyDown(t)},rePositionDropdown:()=>{let{rePosKey:t}=this.state;t=t+1,this.setState({rePosKey:t})},registerClickOutsideHandler:t=>{const n=s=>{const i=this.triggerRef&&this.triggerRef.current,a=this.optionContainerEl&&this.optionContainerEl.current,o=s.target,l=s.composedPath&&s.composedPath()||[o];a&&(!a.contains(o)||!a.contains(o.parentNode))&&i&&!i.contains(o)&&!(l.includes(i)||l.includes(a))&&t(s)};this.clickOutsideHandler=n,document.addEventListener("mousedown",n,!1)},unregisterClickOutsideHandler:()=>{this.clickOutsideHandler&&document.removeEventListener("mousedown",this.clickOutsideHandler,!1)}})}componentDidMount(){this.foundation.init(),this.optionListId=To()}componentWillUnmount(){this.foundation.destroy()}componentDidUpdate(e,t){pt(this.props.data,e.data)||this.foundation.handleDataChange(this.props.data),this.props.value!==e.value&&this.foundation.handleValueChange(this.props.value)}renderInput(){const{size:e,prefix:t,insetLabel:n,insetLabelId:s,suffix:i,placeholder:a,style:o,className:l,showClear:d,disabled:u,triggerRender:h,validateStatus:f,autoFocus:g,value:b,id:m,clearIcon:v}=this.props,{inputValue:y,keyboardEventSet:w,selection:E}=this.state,x=Object.assign(Object.assign(Object.assign({style:o,className:typeof h=="function"?T(l):T({[$t]:!0,[`${$t}-disabled`]:u},l),onClick:this.handleInputClick,ref:this.triggerRef,id:m},w),{tabIndex:-1}),this.getDataAttr(this.props)),_={disabled:u,placeholder:a,autoFocus:g,onChange:this.onSearch,onClear:this.onInputClear,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-invalid":this.props["aria-invalid"],"aria-errormessage":this.props["aria-errormessage"],"aria-describedby":this.props["aria-describedby"],"aria-required":this.props["aria-required"],suffix:i,prefix:t||n,insetLabelId:s,showClear:d,validateStatus:f,size:e,onBlur:this.onBlur,onFocus:this.onFocus,clearIcon:v};return p.createElement("div",Object.assign({},x),typeof h=="function"?p.createElement(Ns,Object.assign({},_,{inputValue:typeof b<"u"?b:y,value:Array.from(E.values()),triggerRender:h,componentName:"AutoComplete",componentProps:Object.assign({},this.props)})):p.createElement(Qt,Object.assign({},_,{value:typeof b<"u"?b:y})))}renderLoading(){const e=`${$t}-loading-wrapper`;return p.createElement("div",{className:e},p.createElement(vn,null))}renderOption(e,t){var n;const{focusIndex:s}=this.state,i=t===s;return p.createElement(ns,Object.assign({showTick:!1,onSelect:(a,o)=>this.onSelect(a,t,o),focused:i,onMouseEnter:()=>this.foundation.handleOptionMouseEnter(t),key:e.key||e.label+e.value+t},e),(n=e._renderedLabel)!==null&&n!==void 0?n:e.label)}renderOptionList(){const{maxHeight:e,dropdownStyle:t,dropdownClassName:n,loading:s,emptyContent:i}=this.props,{options:a,dropdownMinWidth:o}=this.state,l=T({[`${$t}-option-list`]:!0},n);let d;a.length===0?d=i:d=a.filter(h=>h.show).map((h,f)=>this.renderOption(h,f));const u=Object.assign({maxHeight:e,minWidth:o},t);return p.createElement("div",{ref:this.optionContainerEl,className:l,role:"listbox",style:u,id:`${$t}-${this.optionListId}`},s?this.renderLoading():d)}render(){const{position:e,motion:t,zIndex:n,mouseEnterDelay:s,mouseLeaveDelay:i,autoAdjustOverflow:a,stopPropagation:o,getPopupContainer:l}=this.props,{visible:d,rePosKey:u}=this.state,h=this.renderInput(),f=this.renderOptionList();return p.createElement(Cn,{mouseEnterDelay:s,mouseLeaveDelay:i,autoAdjustOverflow:a,trigger:"custom",motion:t,visible:d,content:f,position:e,ref:this.optionsRef,zIndex:n,stopPropagation:o,getPopupContainer:l,rePosKey:u},h)}}wn.propTypes={"aria-label":c.string,"aria-labelledby":c.string,"aria-invalid":c.bool,"aria-errormessage":c.string,"aria-describedby":c.string,"aria-required":c.bool,autoFocus:c.bool,autoAdjustOverflow:c.bool,className:c.string,clearIcon:c.node,children:c.node,data:c.array,defaultOpen:c.bool,defaultValue:c.oneOfType([c.string,c.number]),defaultActiveFirstOption:c.bool,disabled:c.bool,dropdownMatchSelectWidth:c.bool,dropdownClassName:c.string,dropdownStyle:c.object,emptyContent:c.node,id:c.string,insetLabel:c.node,insetLabelId:c.string,onSearch:c.func,onSelect:c.func,onClear:c.func,onBlur:c.func,onFocus:c.func,onChange:c.func,onKeyDown:c.func,position:c.oneOf(Ml),placeholder:c.string,prefix:c.node,onChangeWithObject:c.bool,onSelectWithObject:c.bool,renderItem:c.func,renderSelectedItem:c.func,suffix:c.node,showClear:c.bool,size:c.oneOf(Nl),style:c.object,stopPropagation:c.oneOfType([c.bool,c.string]),maxHeight:c.oneOfType([c.string,c.number]),mouseEnterDelay:c.number,mouseLeaveDelay:c.number,motion:c.oneOfType([c.bool,c.func,c.object]),getPopupContainer:c.func,triggerRender:c.func,value:c.oneOfType([c.string,c.number]),validateStatus:c.oneOf($l),zIndex:c.number};wn.Option=ns;wn.__SemiComponentName__="AutoComplete";wn.defaultProps=kt(wn.__SemiComponentName__,{stopPropagation:!0,motion:!0,zIndex:Ls.DEFAULT_Z_INDEX,position:"bottomLeft",data:[],showClear:!1,size:"default",onFocus:M,onSearch:M,onClear:M,onBlur:M,onSelect:M,onChange:M,onSelectWithObject:!1,onDropdownVisibleChange:M,defaultActiveFirstOption:!1,dropdownMatchSelectWidth:!0,loading:!1,maxHeight:300,validateStatus:"default",autoFocus:!1,emptyContent:null,onKeyDown:M});var jl=No,Vl=Ao,Kl=Do,Hl=ko,Bl=Ro,Ul=Lo,zl=Object.prototype,Wl=zl.hasOwnProperty,Xl=Kl(function(r,e){if(Bl(e)||Hl(e)){Vl(e,Ul(e),r);return}for(var t in e)Wl.call(e,t)&&jl(r,t,e[t])}),Gl=Xl;const ql=Fo(Gl),Fa={PREFIX:`${be}-tree`,PREFIX_OPTION:`${be}-tree-option`},Da={PREFIX:`${be}-cascader`,PREFIX_OPTION:`${be}-cascader-option`},ge={SIZE_SET:["small","large","default"],VALIDATE_STATUS:["success","default","error","warning"],SHOW_NEXT_BY_CLICK:"click",SHOW_NEXT_BY_HOVER:"hover",LEAF_ONLY_MERGE_TYPE:"leafOnly",AUTO_MERGE_VALUE_MERGE_TYPE:"autoMergeValue",NONE_MERGE_TYPE:"none",SEARCH_POSITION_TRIGGER:"trigger",RELATED:"related",UN_RELATED:"unRelated"},Ra="_SEMI_CASCADER_SPLIT_";function Yl(r,e){return`${r}-${e}`}function Zl(r){return!Wn(r)&&!me(r)}function Jl(r){return Array.isArray(r)?r:[r]}function Ql(r,e,t,n){if(!t)return!0;let s=t,i;return typeof t=="boolean"?(s=(a,o)=>{const l=a.toLowerCase();return o.toLowerCase().includes(l)},i=n.join("")):i=n.join(),s(r,i,e)}function ec(r,e,t){const n=se(t,"value","value"),s=se(t,"children","children"),i=(a,o,l)=>{const d=a?a[s]:r;let u=null;if(a){const h=a[n],f=l?`${l.key}${Ra}${h}`:`${h}`,g=l?Yl(l.pos,o):`${o}`,b=Object.assign({},a);t&&Object.entries(t).forEach(m=>{let[v,y]=m;const w=a[y];me(w)||(b[v]=w)}),u={data:b,ind:o,key:f,pos:g,level:l?l.level+1:0,parentKey:l?l.key:null,path:l?[...l.path,f]:[f],valuePath:l?[...l.valuePath,h]:[h]},e(u)}d&&d.forEach((h,f)=>{i(h,f,u)})};i(null)}function tc(r){return r!=null&&r.length?Array.isArray(r[0])?r.map(e=>Ts(e)):[Ts(r)]:[]}function Ts(r){return r.join(Ra)}function nc(r,e,t){const n=se(t,"value","value"),s=se(t,"children","children"),i=r.split("-").map(l=>Number(l));let a=e;const o=[];return i.forEach((l,d)=>{var u;a=d===0?a[l]:(u=a==null?void 0:a[s])===null||u===void 0?void 0:u[l],o.push(a==null?void 0:a[n])}),Ts(o)}function ka(r,e){const t={};return ec(r,n=>{const{key:s,parentKey:i}=n,a=Object.assign({},n);t[s]=a,a.parent=t[i],a.parent&&(a.parent.children=a.parent.children||[],a.parent.children.push(a))},e),t}function Aa(r,e){const t=se(e,"value","value");return Array.isArray(r)?r.map(n=>se(n,t)):se(r,t)}function ki(r,e){let t;return e?t=ge.LEAF_ONLY_MERGE_TYPE:r?t=ge.AUTO_MERGE_VALUE_MERGE_TYPE:t=ge.NONE_MERGE_TYPE,t}class sc extends Ye{constructor(e){super(Object.assign({},e)),this.handleKeyDown=t=>{t.key===ga&&this.getState("isOpen")&&this.close(t)},this.updateSearching=t=>{this._adapter.updateStates({isSearching:!1})},this.handleTagRemoveByKey=t=>{var n,s;const{keyEntities:i}=this.getStates(),{disabled:a}=this.getProps();if(a)return;const o=(n=i[t])!==null&&n!==void 0?n:{};!(!((s=o==null?void 0:o.data)===null||s===void 0)&&s.disable)&&this._handleMultipleSelect(o),this._adapter.rePositionDropdown()},this.handleTagRemoveInTrigger=t=>{const{treeData:n}=this.getStates(),{keyMaps:s}=this.getProps(),i=nc(t,n,s);this.handleTagRemoveByKey(i)}}init(){const e=this.getProp("open")||this.getProp("defaultOpen");this.collectOptions(!0),this._adapter.updateLoadingKeyRefValue(new Set),this._adapter.updateLoadedKeyRefValue(new Set),e&&!this._isDisabled()&&this.open()}_setEmptyContentMinWidth(){const{style:e}=this.getProps();let t;e&&tt(e.width)||e&&_e(e.width)&&!e.width.includes("%")?t=e.width:t=this._adapter.getTriggerWidth(),this._adapter.setEmptyContentMinWidth(t)}destroy(){this._adapter.unregisterClickOutsideHandler()}_isDisabled(){return this.getProp("disabled")}_isFilterable(){return!!this.getProp("filterTreeNode")}_notifyChange(e){const{onChangeWithObject:t,multiple:n}=this.getProps(),s=t?[]:"value";if(n){const i=[];e.forEach(a=>{const o=this.getItemPropPath(a,s);i.push(o)}),this._adapter.notifyChange(i)}else{const i=me(e)||!("key"in e)?[]:this.getItemPropPath(e.key,s);this._adapter.notifyChange(i)}}_isLeaf(e){return this.getProp("loadData")?!!e.isLeaf:!e.children||!e.children.length}_clearInput(){this._adapter.updateInputValue("")}_notifyBlur(e){this._adapter.notifyBlur(e)}_notifyFocus(e){this._adapter.notifyFocus(e)}_isOptionDisabled(e,t){return _s([e],t,!0).some(s=>t[s].data.disabled)}getItemPropPath(e,t,n){const s=n||this.getState("keyEntities"),i=s[e];let a=[];if(i)if(i._notExist)a=i.path;else{const o=i.path;a=Array.isArray(t)?o.map(l=>s[l].data):o.map(l=>s[l].data[t])}return a}_getCacheValue(e){const{selectedKeys:t}=this.getStates(),n=Array.from(t)[0];let s;if(Me(e[n]))if(vl(n,"not-exist-")){const i=n.match(/not-exist-(\S*)/)[1];Me(e[i])?s=i:s=e[i].valuePath}else s=n;else s=e[n].valuePath;return s}collectOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;const{treeData:t,value:n,defaultValue:s,keyMaps:i}=this.getProps(),a=ka(t,i);this._adapter.rePositionDropdown();let o;e?o=s:Me(a)||(o=this._getCacheValue(a));const l=this._isControlledComponent()?me(n)?[]:n:o;Zl(l)?this.updateSelectedKey(l,a):this._adapter.updateStates({keyEntities:a}),this.recalculateFilteredKeys(void 0,a)}_calcFilteredKeys(e,t){if(!e)return[];const{treeNodeFilterProp:n,filterTreeNode:s,filterLeafOnly:i,remote:a,keyMaps:o}=this.getProps(),l=n!=="label"?n:se(o,"label","label"),d=Object.values(t??this.getState("keyEntities"));return a?d.filter(u=>!u._notExist).filter(u=>s&&!i||this._isLeaf(u.data)).map(u=>u.key):d.filter(u=>{const{key:h,_notExist:f,data:g}=u;if(f)return!1;const b=this.getItemPropPath(h,l,t);return Ql(e,g,s,b)}).filter(u=>s&&!i||this._isLeaf(u.data)).map(u=>u.key)}recalculateFilteredKeys(e,t){if(!this._isFilterable())return;const s=this.getState("isSearching");if(me(e)&&!s)return;const i=me(e)?this.getState("inputValue"):e,a=this._calcFilteredKeys(i,t),o={isSearching:!!i,filteredKeys:new Set(a)};t&&(o.keyEntities=t),this._adapter.updateStates(o),this._adapter.rePositionDropdown()}handleValueChange(e){const{keyEntities:t}=this.getStates();this.updateSelectedKey(e,t)}_getClearSelectedKey(e){const t={},{searchPlaceholder:n,placeholder:s,multiple:i}=this.getProps();return t.selectedKeys=new Set([]),t.activeKeys=new Set([]),t.filteredKeys=new Set([]),e&&!i&&(t.inputPlaceHolder=n||s||"",t.inputValue=""),t}updateSelectedKey(e,t){const{changeOnSelect:n,onChangeWithObject:s,multiple:i}=this.getProps(),{activeKeys:a,loading:o,keyEntities:l,selectedKeys:d}=this.getStates(),u=this._adapter.getLoadingKeyRefValue(),h=this._isFilterable(),f=[...a].filter(S=>u.has(S)),g=Jl(e),b=this.getProp("keyMaps"),m=s&&zn(g[0])?Aa(g,b):g,v=tc(m);let y={};const w=v.length>0?v[0]:void 0,E=w?t[w]:void 0;if(E)if(n||this._isLeaf(E.data)){if(y.selectedKeys=new Set([w]),f.length||(y.activeKeys=new Set(E.path)),h&&!i){const S=this.renderDisplayText(w,t);y.inputPlaceHolder=S}}else pt(v,Array.from(d))&&(y=this._getClearSelectedKey(h));else if(e&&e.length){const S=m[m.length-1],x=`not-exist-${S}`,_={data:{label:S,value:S},key:x,path:m,_notExist:!0};if(y.selectedKeys=new Set([x]),h&&!i){const P=this._defaultRenderText(m);y.inputPlaceHolder=P}t[x]=_}else if(o||u!=null&&u.size){y.keyEntities=ql(l,t),this._adapter.updateStates(y);return}else y=this._getClearSelectedKey(h);y.keyEntities=t,this._adapter.updateStates(y)}open(){const e=this._isFilterable(),{multiple:t}=this.getProps();this._adapter.openMenu(),e&&(this._clearInput(),!t&&this.toggle2SearchInput(!0)),this._isControlledComponent()&&this.reCalcActiveKeys(),this._adapter.notifyDropdownVisibleChange(!0),this._adapter.registerClickOutsideHandler(n=>this.close(n)),this._setEmptyContentMinWidth()}reCalcActiveKeys(){const{selectedKeys:e,activeKeys:t,keyEntities:n}=this.getStates(),s=[...e][0],i=n[s];if(!i)return;const a=new Set(i.path);pt(a,t)||this._adapter.updateStates({activeKeys:a})}close(e,t){const{multiple:n}=this.getProps();if(this._adapter.closeMenu(),this._adapter.notifyDropdownVisibleChange(!1),this._adapter.unregisterClickOutsideHandler(),this._isFilterable()){const{selectedKeys:s,isSearching:i}=this.getStates();let a="";t&&!n?a=this.renderDisplayText(t):s.size&&!n&&(a=this.renderDisplayText([...s][0])),this._adapter.updateStates({inputValue:a,isSearching:!1}),!n&&this.toggle2SearchInput(!1),!n&&this._adapter.updateFocusState(!1)}this._notifyBlur(e)}focus(){const{filterTreeNode:e}=this.getProps();e&&this._adapter.focusInput(),this._adapter.updateFocusState(!0)}blur(){const{filterTreeNode:e}=this.getProps();e&&this._adapter.blurInput(),this._adapter.updateFocusState(!1)}toggle2SearchInput(e){e?this._adapter.toggleInputShow(e,()=>this.focus()):this._adapter.toggleInputShow(e,()=>{})}handleItemClick(e,t){this._isDisabled()||(this.handleSingleSelect(e,t),this._adapter.rePositionDropdown())}handleItemHover(e,t){this._isDisabled()||this.handleShowNextByHover(t)}handleShowNextByHover(e){const{keyEntities:t}=this.getStates(),{data:n,key:s}=e,i=this._isLeaf(n),a=t[s].path;this._adapter.updateStates({activeKeys:new Set(a)}),i||this.notifyIfLoadData(e)}onItemCheckboxClick(e){this._isDisabled()||(this._handleMultipleSelect(e),this._adapter.rePositionDropdown())}handleClick(e){const t=this._isDisabled(),n=this._isFilterable(),{isOpen:s}=this.getStates();t||(s?s&&!n&&this.close(e):(this.open(),this._notifyFocus(e)))}handleSelectionEnterPress(e){Ht(e)&&this.handleClick(e)}toggleHoverState(e){this._adapter.toggleHovering(e)}_defaultRenderText(e,t){const n=this.getProp("separator");return t&&typeof t=="function"?t(e):e.join(n)}renderDisplayText(e,t){const n=this.getProp("displayRender"),s=this.getProp("displayProp"),i=this.getItemPropPath(e,s,t);return this._defaultRenderText(i,n)}handleNodeLoad(e){const{data:t,key:n}=e,s=new Set(this._adapter.getLoadingKeyRefValue()),a=new Set(this._adapter.getLoadedKeyRefValue()).add(n),o=new Set([...s]);o.delete(n),this._adapter.notifyOnLoad(a,t),this._adapter.updateLoadingKeyRefValue(o),this._adapter.updateLoadedKeyRefValue(a),this._adapter.updateStates({loadingKeys:o,loadedKeys:a})}notifyIfLoadData(e){const{data:t,key:n}=e;if(this._adapter.updateStates({loading:!1}),!t.isLeaf&&!t.children&&this.getProp("loadData")){const s=this._adapter.getLoadedKeyRefValue(),i=new Set(this._adapter.getLoadingKeyRefValue());if(s.has(n)||i.has(n))return;this._adapter.updateStates({loading:!0});const{keyEntities:a}=this.getStates(),o=this.getItemPropPath(n,[],a),l=i.add(n);this._adapter.updateLoadingKeyRefValue(l),this._adapter.updateStates({loadingKeys:l}),this._adapter.notifyLoadData(o,this.handleNodeLoad.bind(this,e))}}handleSingleSelect(e,t){const{changeOnSelect:n,filterLeafOnly:s,multiple:i,enableLeafClick:a,clickToSelect:o}=this.getProps(),{keyEntities:l,selectedKeys:d,isSearching:u}=this.getStates(),h=this._isFilterable(),{data:f,key:g}=t,b=this._isLeaf(f),m=l[g].path,v=[g],y=g!==[...d][0];if(!b&&!n&&!u&&!(i&&o)){this._adapter.updateStates({activeKeys:new Set(m)}),this.notifyIfLoadData(t);return}if(i)this._adapter.updateStates({activeKeys:new Set(m)}),(o||b&&a)&&this.onItemCheckboxClick(t);else if(this._adapter.notifySelect(f.value),y){if(this._notifyChange(t),this.notifyIfLoadData(t),this._isControlledComponent()){this._adapter.updateStates({activeKeys:new Set(m)}),b&&this.close(e);return}this._adapter.updateStates({activeKeys:new Set(m),selectedKeys:new Set(v)});const w=this.renderDisplayText(g);h&&this._adapter.updateInputPlaceHolder(w),b?this.close(e,g):!s&&u&&this.close(e,g)}else this.close(e)}_handleMultipleSelect(e){const{checkRelation:t}=this.getProps();t===ge.RELATED?this._handleRelatedMultipleSelect(e):t==="unRelated"&&this._handleUnRelatedMultipleSelect(e),this._adapter.updateStates({inputValue:""})}_handleRelatedMultipleSelect(e){const{key:t}=e,{checkedKeys:n,keyEntities:s,resolvedCheckedKeys:i}=this.getStates(),{autoMergeValue:a,max:o,disableStrictly:l,leafOnly:d}=this.getProps(),u=n.has(t),h=l?this.calcCheckedStatus(!u,t):!u,{checkedKeys:f,halfCheckedKeys:g}=l?this.calcNonDisabledCheckedKeys(t,h):this.calcCheckedKeys(t,h),b=ki(a,d),m=b===ge.LEAF_ONLY_MERGE_TYPE,v=b===ge.NONE_MERGE_TYPE,y=new Set(Ct(f,s,m)),w=v?f:y;if(tt(o)){if(v){if(n.size<f.size&&f.size>o){const E=[];f.forEach(S=>{E.push(s[S])}),this._adapter.notifyOnExceed(E);return}}else if(i.size<y.size&&y.size>o){const E=[];y.forEach(S=>{E.push(s[S])}),this._adapter.notifyOnExceed(E);return}}this._isControlledComponent()||this._adapter.updateStates({checkedKeys:f,halfCheckedKeys:g,resolvedCheckedKeys:y}),this._notifyChange(w),h&&this._notifySelect(w)}_handleUnRelatedMultipleSelect(e){const{key:t}=e,{checkedKeys:n,keyEntities:s}=this.getStates(),{max:i}=this.getProps(),a=new Set(n);let o;if(n.has(t))a.delete(t),o=!1;else{if(tt(i)&&n.size>=i){const d=[];n.forEach(u=>{d.push(s[u])}),this._adapter.notifyOnExceed(d);return}a.add(t),o=!0}this._isControlledComponent()||this._adapter.updateStates({checkedKeys:a}),this._notifyChange(a),o&&this._notifySelect(a)}calcNonDisabledCheckedKeys(e,t){const{keyEntities:n,disabledKeys:s}=this.getStates(),i=new Set(this.getState("checkedKeys")),a=Ct(Vn([e],n,!1),n,!0);if(!a.some(u=>s.has(u)))return this.calcCheckedKeys(e,t);const l=a.filter(u=>!s.has(u)),d=t?[...l,...i]:wa(Ct([...i],n,!0),l);return $s(d,n)}calcCheckedStatus(e,t){if(!e)return e;const{checkedKeys:n,keyEntities:s,disabledKeys:i}=this.getStates(),a=Ct(Vn([t],s,!1),s,!0);return a.some(u=>i.has(u))?!a.filter(u=>!i.has(u)).every(u=>n.has(u)):e}_notifySelect(e){const{keyEntities:t}=this.getStates(),n=[];e.forEach(i=>{var a,o;const l=(o=(a=t[i])===null||a===void 0?void 0:a.data)===null||o===void 0?void 0:o.value;l!==void 0&&n.push(l)});const s=n.length===1?n[0]:n;this._adapter.notifySelect(s)}calcCheckedKeys(e,t){const{keyEntities:n}=this.getStates(),s=new Set(this.getState("checkedKeys")),i=new Set(this.getState("halfCheckedKeys"));return t?Ea(e,n,s,i):xa(e,n,s,i)}handleInputChange(e){this._adapter.updateInputValue(e);const t=this._calcFilteredKeys(e);this._adapter.updateStates({isSearching:!!e,filteredKeys:new Set(t)}),this._adapter.notifyOnSearch(e),this._adapter.rePositionDropdown()}handleClear(){const{isSearching:e}=this.getStates(),{searchPlaceholder:t,placeholder:n,multiple:s}=this.getProps(),i=this._isFilterable(),a=this._isControlledComponent(),o={};s?(o.isSearching=!1,this._adapter.updateInputValue(""),this._adapter.notifyOnSearch(""),o.checkedKeys=new Set([]),o.halfCheckedKeys=new Set([]),o.selectedKeys=new Set([]),o.activeKeys=new Set([]),o.resolvedCheckedKeys=new Set([]),this._adapter.notifyChange([])):i&&e?(o.isSearching=!1,this._adapter.updateInputValue(""),this._adapter.notifyOnSearch("")):(i&&(o.inputValue="",o.inputPlaceHolder=t||n||"",this._adapter.updateInputValue(""),this._adapter.notifyOnSearch("")),a||(o.selectedKeys=new Set([])),o.activeKeys=new Set([]),o.filteredKeys=new Set([]),this._adapter.notifyChange([])),this._adapter.updateStates(o),this._adapter.notifyClear(),this._adapter.rePositionDropdown()}handleClearEnterPress(e){Ht(e)&&this.handleClear()}getRenderData(){const{keyEntities:e,isSearching:t}=this.getStates(),n=this._isFilterable();return t&&n?this.getFilteredData():Object.values(e).filter(s=>s.parentKey===null&&!s._notExist).sort((s,i)=>parseInt(s.ind,10)-parseInt(i.ind,10))}getFilteredData(){const{treeNodeFilterProp:e,filterSorter:t,keyMaps:n}=this.getProps(),s=e!=="label"?e:se(n,"label","label"),{filteredKeys:i,keyEntities:a,inputValue:o}=this.getStates(),l=[];return[...i].forEach(u=>{const h=a[u];if(!h)return;const f=this.getItemPropPath(u,[]),g=f.map(m=>m[s]),b=this._isOptionDisabled(u,a);l.push({data:h.data,pathData:f,key:u,disabled:b,searchText:g})}),Le(t)&&l.sort((u,h)=>t(u.pathData,h.pathData,o)),l}handleListScroll(e,t){const{activeKeys:n,keyEntities:s}=this.getStates(),i=[...n][n.size-1],a=i?se(s,[i,"data"],null):null;this._adapter.notifyListScroll(e,{panelIndex:t,activeNode:a})}}const ic=r=>{let{index:e,data:t,style:n}=r;const{visibleOptions:s,renderOption:i}=t,a=s[e];return i(a,e,n)},ue=Da.PREFIX_OPTION;let js=class extends C.PureComponent{constructor(){var e;super(...arguments),e=this,this.onClick=(t,n)=>{const{onItemClick:s}=this.props;n.data.disabled||"disabled"in n&&n.disabled||s(t,n)},this.handleItemEnterPress=(t,n)=>{Ht(t)&&this.onClick(t,n)},this.onHover=(t,n)=>{const{showNext:s,onItemHover:i}=this.props;n.data.disabled||s===ge.SHOW_NEXT_BY_HOVER&&i(t,n)},this.onCheckboxChange=(t,n)=>{const{onItemCheckboxClick:s}=this.props;t.stopPropagation(),t.nativeEvent&&typeof t.nativeEvent.stopImmediatePropagation=="function"&&t.nativeEvent.stopImmediatePropagation(),s(n)},this.getItemStatus=t=>{const{activeKeys:n,selectedKeys:s,loadedKeys:i,loadingKeys:a}=this.props,o={active:!1,selected:!1,loading:!1};return n.has(t)&&(o.active=!0),s.has(t)&&(o.selected=!0),a.has(t)&&!i.has(t)&&(o.loading=!0),o},this.renderIcon=function(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const s=i=>i+(n?` ${ue}-icon-left`:"");switch(t){case"child":const{expandIcon:i}=e.props;return i||p.createElement(Mo,{className:s(`${ue}-icon ${ue}-icon-expand`)});case"tick":return p.createElement(fa,{className:s(`${ue}-icon ${ue}-icon-active`)});case"loading":return p.createElement(vn,{wrapperClassName:s(`${ue}-spin-icon`)});case"empty":return p.createElement("span",{"aria-hidden":!0,className:s(`${ue}-icon ${ue}-icon-empty`)});default:return null}},this.highlight=t=>{const n=[],{keyword:s,separator:i}=this.props;return t.forEach((a,o)=>{if(typeof a=="string"&&s){const l=a.toLowerCase(),d=s.toLowerCase();let u=0,h=0;for(;;){const f=l.indexOf(d,u);if(f===-1){const b=a.slice(u);b&&n.push(b);break}const g=a.slice(u,f);g&&n.push(g),n.push(p.createElement("span",{className:`${ue}-label-highlight`,key:`${o}-${f}-${h}`},a.slice(f,f+s.length))),u=f+s.length,h++}}else n.push(a);o!==t.length-1&&n.push(i)}),n},this.renderFlattenOptionItem=(t,n,s)=>{var i;const{multiple:a,selectedKeys:o,checkedKeys:l,halfCheckedKeys:d,keyword:u,filterRender:h,virtualize:f}=this.props,{searchText:g,key:b,disabled:m,pathData:v}=t,y=o.has(b),w=T(ue,{[`${ue}-flatten`]:!h,[`${ue}-disabled`]:m,[`${ue}-select`]:y&&!a}),E=_=>{this.onClick(_,t)},S=_=>this.handleItemEnterPress(_,t),x=_=>this.onCheckboxChange(_,t);if(h){const _={className:w,inputValue:u,disabled:m,data:v,checkStatus:{checked:l.has(t.key),halfChecked:d.has(t.key)},selected:y,onClick:E,onCheck:x},P=h(_),I=f?{key:b,style:Object.assign(Object.assign({},(i=P.props.style)!==null&&i!==void 0?i:{}),s)}:{key:b};return p.cloneElement(P,I)}return p.createElement("li",{role:"menuitem",className:w,style:s,key:b,onClick:E,onKeyPress:S},p.createElement("span",{className:`${ue}-label`},!a&&this.renderIcon("empty"),a&&p.createElement(pr,{onChange:x,disabled:m,indeterminate:d.has(t.key),checked:l.has(t.key),className:`${ue}-label-checkbox`}),this.highlight(g)))},this.renderFlattenOption=t=>{const{virtualize:n}=this.props;return p.createElement("ul",{className:`${ue}-list`,key:"flatten-list"},n?this.renderVirtualizeList(t):t.map(i=>this.renderFlattenOptionItem(i)))},this.renderVirtualizeList=t=>{var n;const{direction:s}=this.context,{virtualize:i}=this.props;return p.createElement(ma,{height:i.height,itemCount:t.length,itemSize:i.itemSize,itemData:{visibleOptions:t,renderOption:this.renderFlattenOptionItem},width:(n=i.width)!==null&&n!==void 0?n:"100%",style:{direction:s}},ic)}}renderItem(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const{multiple:n,checkedKeys:s,halfCheckedKeys:i}=this.props;let a;const o=t.length;return t.push(p.createElement("ul",{role:"menu",className:`${ue}-list`,key:e[0].key,onScroll:l=>this.props.onListScroll(l,o)},e.map(l=>{const{data:d,key:u,parentKey:h}=l,{children:f,label:g,disabled:b,isLeaf:m}=d,{active:v,selected:y,loading:w}=this.getItemStatus(u),E=!!f&&f.length,S=E||this.props.loadData&&!m;v&&E&&(a=l);const x=T(ue,{[`${ue}-active`]:v&&!y,[`${ue}-select`]:y&&!n,[`${ue}-disabled`]:b}),_=h?{"aria-owns":`cascaderItem-${h}`}:{};return p.createElement("li",Object.assign({role:"menuitem",id:`cascaderItem-${u}`,"aria-expanded":v,"aria-haspopup":!!S,"aria-disabled":b},_,{className:x,key:u,onClick:P=>{this.onClick(P,l)},onKeyPress:P=>this.handleItemEnterPress(P,l),onMouseEnter:P=>{this.onHover(P,l)}}),p.createElement("span",{className:`${ue}-label`},y&&!n&&this.renderIcon("tick"),!y&&!n&&this.renderIcon("empty"),n&&p.createElement(pr,{onChange:P=>this.onCheckboxChange(P,l),disabled:b,indeterminate:i.has(l.key),checked:s.has(l.key),className:`${ue}-label-checkbox`}),p.createElement("span",null,g)),S?this.renderIcon(w?"loading":"child",!0):null)}))),a&&t.concat(this.renderItem(a.children,t)),t}renderEmpty(){const{emptyContent:e}=this.props;return e===null?null:p.createElement(ut,{componentName:"Cascader"},t=>p.createElement("ul",{className:`${ue} ${ue}-empty`,key:"empty-list"},p.createElement("span",{className:`${ue}-label`,"x-semi-prop":"emptyContent"},e||t.emptyText)))}render(){const{data:e,searchable:t}=this.props,{direction:n}=this.context,s=!e||!e.length;let i;const a=T({[`${ue}-lists`]:!0,[`${ue}-lists-rtl`]:n==="rtl",[`${ue}-lists-empty`]:s});return s?i=this.renderEmpty():i=t?this.renderFlattenOption(e):this.renderItem(e),p.createElement("div",{className:a},i)}};js.contextType=en;js.propTypes={data:c.array,emptyContent:c.node,searchable:c.bool,onItemClick:c.func,onItemHover:c.func,multiple:c.bool,showNext:c.oneOf([ge.SHOW_NEXT_BY_CLICK,ge.SHOW_NEXT_BY_HOVER]),checkedKeys:c.object,halfCheckedKeys:c.object,onItemCheckboxClick:c.func,separator:c.string,keyword:c.string,virtualize:c.object,expandIcon:c.node};js.defaultProps={empty:!1};const rc={PREFIX:`${be}-tagInput`},Ir={SIZE_SET:["large","default","small"],STATUS:["success","default","error","warning"]},ac=(r,e)=>{let t=[];if(_e(e)||tt(e))t=r.split(e);else if(ya(e)){const n=e[0];t=r;for(let s=1;s<e.length;s++)t=t.split(e[s]).join(n);t=t.split(n)}else t.push(r);return t};function oc(r,e,t){const n=r.slice();return n.splice(t<0?n.length+t:t,0,n.splice(e,1)[0]),n}class lc extends Ye{constructor(e){super(Object.assign({},e)),this.handleInputChange=t=>{const{value:n}=t.target,{entering:s}=this.getStates();s?this._onInputChange(n,t):this._checkInputChangeValid(n)&&this._onInputChange(n,t)},this.handleInputCompositionStart=t=>{const{maxLength:n}=this.getProps();tt(n)&&this._adapter.setEntering(!0)},this._splitArray=(t,n)=>{const{split:s}=this.getProps();return Le(s)?s(t,n):ac(t,n)},this.handleInputCompositionEnd=t=>{const{value:n}=t.target,{maxLength:s,onInputExceed:i,separator:a}=this.getProps();if(!tt(s))return;this._adapter.setEntering(!1);let o=!0;const l=this._splitArray(n,a);let d=0;for(;d<l.length;d++)if(l[d].length>s){o=!1,Le(i)&&i(n);break}if(o)this._adapter.setInputValue(n);else{const u=l.slice(0,d);d<l.length&&u.push(l[d].slice(0,s)),this._adapter.setInputValue(u.join(a))}},this._checkInputChangeValid=t=>{const{maxLength:n,onInputExceed:s,separator:i}=this._adapter.getProps(),{inputValue:a}=this._adapter.getStates();let o=!0;if(tt(n)){const l=this._splitArray(t,i),d=this._splitArray(a,i),u=Math.max(l.length,d.length);for(let h=0;h<u;h++)if(!me(l[h])&&(me(d[h])||l[h].length>d[h].length)&&l[h].length>n){o=!1,Le(s)&&s(t);break}}return o},this.handleKeyDown=t=>{const{inputValue:n,tagsArray:s}=this._adapter.getStates(),i=t.keyCode;i===Gt.ENTER&&(t.preventDefault(),n!==""&&this._handleAddTags(t));const{length:a}=s;if(i===Gt.BACKSPACE&&n===""&&a>0){const o=s.slice(0,a-1),l=s[a-1];this._onRemove(o,l,a-1)}this._adapter.notifyKeyDown(t)}}_handleAddTags(e){const{separator:t,max:n,onExceed:s,allowDuplicates:i}=this._adapter.getProps(),{inputValue:a,tagsArray:o}=this._adapter.getStates();let l=this._splitArray(a,t);l=l.filter((u,h)=>!i&&(o.includes(u)||l.indexOf(u)!==h)?!1:_e(u)&&u.trim()!=="");let d=o.concat(l);tt(n)&&d.length>n&&(Le(s)&&s(d),d=d.slice(0,n),l=l.slice(0,n-o.length)),l.length>0&&this._onAdd(d,l),this._onInputChange("",e)}handleInputBlur(e){const{addOnBlur:t}=this._adapter.getProps();t===!0&&this._handleAddTags(e),this._adapter.setFocusing(!1),this._adapter.notifyBlur(e)}handleInputFocus(e){this._adapter.setFocusing(!0),this._adapter.notifyFocus(e)}handleClearEnterPress(e){Ht(e)&&this.handleClearBtn(e)}handleClearBtn(e){const{inputValue:t,tagsArray:n}=this._adapter.getStates();n.length>0&&(this._adapter.setTagsArray([]),this._adapter.notifyTagChange([])),t.length>0&&this._onInputChange("",e),e.stopPropagation()}handleTagClose(e){const{tagsArray:t}=this._adapter.getStates(),n=[...t];n.splice(e,1);const s=t[e];this._onRemove(n,s,e)}handleInputMouseEnter(){this._adapter.setHovering(!0)}handleInputMouseLeave(){this._adapter.setHovering(!1)}handleClick(e){const{disabled:t}=this.getProps();if(t)return;this._adapter.getClickOutsideHandler()||(this._adapter.setActive(!0),this._adapter.registerClickOutsideHandler(s=>this.clickOutsideCallBack()))}clickOutsideCallBack(){this._adapter.unregisterClickOutsideHandler(),this._adapter.setActive(!1)}handleClickPrefixOrSuffix(e){const{disabled:t}=this._adapter.getProps(),{isFocus:n}=this._adapter.getStates();!t&&!n&&this._adapter.toggleFocusing(!0)}handlePreventMouseDown(e){e&&Le(e.preventDefault)&&e.preventDefault()}_onRemove(e,t,n){this._isControlledComponent()||this._adapter.setTagsArray(e),this._adapter.notifyTagChange(e),this._adapter.notifyTagRemove(t,n)}_onAdd(e,t){this._isControlledComponent()||this._adapter.setTagsArray(e),this._adapter.notifyTagChange(e),this._adapter.notifyTagAdd(t)}_onInputChange(e,t){this._adapter.setInputValue(e),this._adapter.notifyInputChange(e,t)}handleSortEnd(e){const{oldIndex:t,newIndex:n}=e,{tagsArray:s}=this.getStates(),i=oc(s,t,n);this._isControlledComponent()||this._adapter.setTagsArray(i),this._adapter.notifyTagChange(i)}}function cc(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return C.useMemo(()=>n=>{e.forEach(s=>s(n))},e)}const Vs=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Tn(r){const e=Object.prototype.toString.call(r);return e==="[object Window]"||e==="[object global]"}function Xi(r){return"nodeType"in r}function Ze(r){var e,t;return r?Tn(r)?r:Xi(r)&&(e=(t=r.ownerDocument)==null?void 0:t.defaultView)!=null?e:window:window}function Gi(r){const{Document:e}=Ze(r);return r instanceof e}function ss(r){return Tn(r)?!1:r instanceof Ze(r).HTMLElement}function La(r){return r instanceof Ze(r).SVGElement}function Fn(r){return r?Tn(r)?r.document:Xi(r)?Gi(r)?r:ss(r)||La(r)?r.ownerDocument:document:document:document}const wt=Vs?C.useLayoutEffect:C.useEffect;function Ks(r){const e=C.useRef(r);return wt(()=>{e.current=r}),C.useCallback(function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e.current==null?void 0:e.current(...n)},[])}function dc(){const r=C.useRef(null),e=C.useCallback((n,s)=>{r.current=setInterval(n,s)},[]),t=C.useCallback(()=>{r.current!==null&&(clearInterval(r.current),r.current=null)},[]);return[e,t]}function Xn(r,e){e===void 0&&(e=[r]);const t=C.useRef(r);return wt(()=>{t.current!==r&&(t.current=r)},e),t}function is(r,e){const t=C.useRef();return C.useMemo(()=>{const n=r(t.current);return t.current=n,n},[...e])}function Fs(r){const e=Ks(r),t=C.useRef(null),n=C.useCallback(s=>{s!==t.current&&(e==null||e(s,t.current)),t.current=s},[]);return[t,n]}function Ds(r){const e=C.useRef();return C.useEffect(()=>{e.current=r},[r]),e.current}let oi={};function rs(r,e){return C.useMemo(()=>{if(e)return e;const t=oi[r]==null?0:oi[r]+1;return oi[r]=t,r+"-"+t},[r,e])}function Na(r){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return n.reduce((i,a)=>{const o=Object.entries(a);for(const[l,d]of o){const u=i[l];u!=null&&(i[l]=u+r*d)}return i},{...e})}}const mn=Na(1),Gn=Na(-1);function uc(r){return"clientX"in r&&"clientY"in r}function Hs(r){if(!r)return!1;const{KeyboardEvent:e}=Ze(r.target);return e&&r instanceof e}function hc(r){if(!r)return!1;const{TouchEvent:e}=Ze(r.target);return e&&r instanceof e}function Rs(r){if(hc(r)){if(r.touches&&r.touches.length){const{clientX:e,clientY:t}=r.touches[0];return{x:e,y:t}}else if(r.changedTouches&&r.changedTouches.length){const{clientX:e,clientY:t}=r.changedTouches[0];return{x:e,y:t}}}return uc(r)?{x:r.clientX,y:r.clientY}:null}const Bt=Object.freeze({Translate:{toString(r){if(!r)return;const{x:e,y:t}=r;return"translate3d("+(e?Math.round(e):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(r){if(!r)return;const{scaleX:e,scaleY:t}=r;return"scaleX("+e+") scaleY("+t+")"}},Transform:{toString(r){if(r)return[Bt.Translate.toString(r),Bt.Scale.toString(r)].join(" ")}},Transition:{toString(r){let{property:e,duration:t,easing:n}=r;return e+" "+t+"ms "+n}}}),Tr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function pc(r){return r.matches(Tr)?r:r.querySelector(Tr)}const fc={display:"none"};function gc(r){let{id:e,value:t}=r;return p.createElement("div",{id:e,style:fc},t)}function mc(r){let{id:e,announcement:t,ariaLiveType:n="assertive"}=r;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return p.createElement("div",{id:e,style:s,role:"status","aria-live":n,"aria-atomic":!0},t)}function yc(){const[r,e]=C.useState("");return{announce:C.useCallback(n=>{n!=null&&e(n)},[]),announcement:r}}const Ma=C.createContext(null);function bc(r){const e=C.useContext(Ma);C.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(r)},[r,e])}function vc(){const[r]=C.useState(()=>new Set),e=C.useCallback(n=>(r.add(n),()=>r.delete(n)),[r]);return[C.useCallback(n=>{let{type:s,event:i}=n;r.forEach(a=>{var o;return(o=a[s])==null?void 0:o.call(a,i)})},[r]),e]}const Cc={draggable:`
    To pick up a draggable item, press the space bar.
    While dragging, use the arrow keys to move the item.
    Press space again to drop the item in its new position, or press escape to cancel.
  `},Sc={onDragStart(r){let{active:e}=r;return"Picked up draggable item "+e.id+"."},onDragOver(r){let{active:e,over:t}=r;return t?"Draggable item "+e.id+" was moved over droppable area "+t.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(r){let{active:e,over:t}=r;return t?"Draggable item "+e.id+" was dropped over droppable area "+t.id:"Draggable item "+e.id+" was dropped."},onDragCancel(r){let{active:e}=r;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function wc(r){let{announcements:e=Sc,container:t,hiddenTextDescribedById:n,screenReaderInstructions:s=Cc}=r;const{announce:i,announcement:a}=yc(),o=rs("DndLiveRegion"),[l,d]=C.useState(!1);if(C.useEffect(()=>{d(!0)},[]),bc(C.useMemo(()=>({onDragStart(h){let{active:f}=h;i(e.onDragStart({active:f}))},onDragMove(h){let{active:f,over:g}=h;e.onDragMove&&i(e.onDragMove({active:f,over:g}))},onDragOver(h){let{active:f,over:g}=h;i(e.onDragOver({active:f,over:g}))},onDragEnd(h){let{active:f,over:g}=h;i(e.onDragEnd({active:f,over:g}))},onDragCancel(h){let{active:f,over:g}=h;i(e.onDragCancel({active:f,over:g}))}}),[i,e])),!l)return null;const u=p.createElement(p.Fragment,null,p.createElement(gc,{id:n,value:s.draggable}),p.createElement(mc,{id:o,announcement:a}));return t?fn.createPortal(u,t):u}var Te;(function(r){r.DragStart="dragStart",r.DragMove="dragMove",r.DragEnd="dragEnd",r.DragCancel="dragCancel",r.DragOver="dragOver",r.RegisterDroppable="registerDroppable",r.SetDroppableDisabled="setDroppableDisabled",r.UnregisterDroppable="unregisterDroppable"})(Te||(Te={}));function ks(){}function li(r,e){return C.useMemo(()=>({sensor:r,options:e??{}}),[r,e])}function Ec(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return C.useMemo(()=>[...e].filter(n=>n!=null),[...e])}const Et=Object.freeze({x:0,y:0});function $a(r,e){return Math.sqrt(Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2))}function xc(r,e){const t=Rs(r);if(!t)return"0 0";const n={x:(t.x-e.left)/e.width*100,y:(t.y-e.top)/e.height*100};return n.x+"% "+n.y+"%"}function ja(r,e){let{data:{value:t}}=r,{data:{value:n}}=e;return t-n}function _c(r,e){let{data:{value:t}}=r,{data:{value:n}}=e;return n-t}function Fr(r){let{left:e,top:t,height:n,width:s}=r;return[{x:e,y:t},{x:e+s,y:t},{x:e,y:t+n},{x:e+s,y:t+n}]}function Va(r,e){if(!r||r.length===0)return null;const[t]=r;return t[e]}function Dr(r,e,t){return e===void 0&&(e=r.left),t===void 0&&(t=r.top),{x:e+r.width*.5,y:t+r.height*.5}}const Pc=r=>{let{collisionRect:e,droppableRects:t,droppableContainers:n}=r;const s=Dr(e,e.left,e.top),i=[];for(const a of n){const{id:o}=a,l=t.get(o);if(l){const d=$a(Dr(l),s);i.push({id:o,data:{droppableContainer:a,value:d}})}}return i.sort(ja)},Oc=r=>{let{collisionRect:e,droppableRects:t,droppableContainers:n}=r;const s=Fr(e),i=[];for(const a of n){const{id:o}=a,l=t.get(o);if(l){const d=Fr(l),u=s.reduce((f,g,b)=>f+$a(d[b],g),0),h=Number((u/4).toFixed(4));i.push({id:o,data:{droppableContainer:a,value:h}})}}return i.sort(ja)};function Ic(r,e){const t=Math.max(e.top,r.top),n=Math.max(e.left,r.left),s=Math.min(e.left+e.width,r.left+r.width),i=Math.min(e.top+e.height,r.top+r.height),a=s-n,o=i-t;if(n<s&&t<i){const l=e.width*e.height,d=r.width*r.height,u=a*o,h=u/(l+d-u);return Number(h.toFixed(4))}return 0}const Tc=r=>{let{collisionRect:e,droppableRects:t,droppableContainers:n}=r;const s=[];for(const i of n){const{id:a}=i,o=t.get(a);if(o){const l=Ic(o,e);l>0&&s.push({id:a,data:{droppableContainer:i,value:l}})}}return s.sort(_c)};function Fc(r,e,t){return{...r,scaleX:e&&t?e.width/t.width:1,scaleY:e&&t?e.height/t.height:1}}function Ka(r,e){return r&&e?{x:r.left-e.left,y:r.top-e.top}:Et}function Dc(r){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return s.reduce((a,o)=>({...a,top:a.top+r*o.y,bottom:a.bottom+r*o.y,left:a.left+r*o.x,right:a.right+r*o.x}),{...t})}}const Rc=Dc(1);function Ha(r){if(r.startsWith("matrix3d(")){const e=r.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(r.startsWith("matrix(")){const e=r.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function kc(r,e,t){const n=Ha(e);if(!n)return r;const{scaleX:s,scaleY:i,x:a,y:o}=n,l=r.left-a-(1-s)*parseFloat(t),d=r.top-o-(1-i)*parseFloat(t.slice(t.indexOf(" ")+1)),u=s?r.width/s:r.width,h=i?r.height/i:r.height;return{width:u,height:h,top:d,right:l+u,bottom:d+h,left:l}}const Ac={ignoreTransform:!1};function Dn(r,e){e===void 0&&(e=Ac);let t=r.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:u}=Ze(r).getComputedStyle(r);d&&(t=kc(t,d,u))}const{top:n,left:s,width:i,height:a,bottom:o,right:l}=t;return{top:n,left:s,width:i,height:a,bottom:o,right:l}}function Rr(r){return Dn(r,{ignoreTransform:!0})}function Lc(r){const e=r.innerWidth,t=r.innerHeight;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}function Nc(r,e){return e===void 0&&(e=Ze(r).getComputedStyle(r)),e.position==="fixed"}function Mc(r,e){e===void 0&&(e=Ze(r).getComputedStyle(r));const t=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=e[s];return typeof i=="string"?t.test(i):!1})}function Bs(r,e){const t=[];function n(s){if(e!=null&&t.length>=e||!s)return t;if(Gi(s)&&s.scrollingElement!=null&&!t.includes(s.scrollingElement))return t.push(s.scrollingElement),t;if(!ss(s)||La(s)||t.includes(s))return t;const i=Ze(r).getComputedStyle(s);return s!==r&&Mc(s,i)&&t.push(s),Nc(s,i)?t:n(s.parentNode)}return r?n(r):t}function Ba(r){const[e]=Bs(r,1);return e??null}function ci(r){return!Vs||!r?null:Tn(r)?r:Xi(r)?Gi(r)||r===Fn(r).scrollingElement?window:ss(r)?r:null:null}function Ua(r){return Tn(r)?r.scrollX:r.scrollLeft}function za(r){return Tn(r)?r.scrollY:r.scrollTop}function Ai(r){return{x:Ua(r),y:za(r)}}var Ae;(function(r){r[r.Forward=1]="Forward",r[r.Backward=-1]="Backward"})(Ae||(Ae={}));function Wa(r){return!Vs||!r?!1:r===document.scrollingElement}function Xa(r){const e={x:0,y:0},t=Wa(r)?{height:window.innerHeight,width:window.innerWidth}:{height:r.clientHeight,width:r.clientWidth},n={x:r.scrollWidth-t.width,y:r.scrollHeight-t.height},s=r.scrollTop<=e.y,i=r.scrollLeft<=e.x,a=r.scrollTop>=n.y,o=r.scrollLeft>=n.x;return{isTop:s,isLeft:i,isBottom:a,isRight:o,maxScroll:n,minScroll:e}}const $c={x:.2,y:.2};function jc(r,e,t,n,s){let{top:i,left:a,right:o,bottom:l}=t;n===void 0&&(n=10),s===void 0&&(s=$c);const{isTop:d,isBottom:u,isLeft:h,isRight:f}=Xa(r),g={x:0,y:0},b={x:0,y:0},m={height:e.height*s.y,width:e.width*s.x};return!d&&i<=e.top+m.height?(g.y=Ae.Backward,b.y=n*Math.abs((e.top+m.height-i)/m.height)):!u&&l>=e.bottom-m.height&&(g.y=Ae.Forward,b.y=n*Math.abs((e.bottom-m.height-l)/m.height)),!f&&o>=e.right-m.width?(g.x=Ae.Forward,b.x=n*Math.abs((e.right-m.width-o)/m.width)):!h&&a<=e.left+m.width&&(g.x=Ae.Backward,b.x=n*Math.abs((e.left+m.width-a)/m.width)),{direction:g,speed:b}}function Vc(r){if(r===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:e,left:t,right:n,bottom:s}=r.getBoundingClientRect();return{top:e,left:t,right:n,bottom:s,width:r.clientWidth,height:r.clientHeight}}function Ga(r){return r.reduce((e,t)=>mn(e,Ai(t)),Et)}function Kc(r){return r.reduce((e,t)=>e+Ua(t),0)}function Hc(r){return r.reduce((e,t)=>e+za(t),0)}function qa(r,e){if(e===void 0&&(e=Dn),!r)return;const{top:t,left:n,bottom:s,right:i}=e(r);Ba(r)&&(s<=0||i<=0||t>=window.innerHeight||n>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}const Bc=[["x",["left","right"],Kc],["y",["top","bottom"],Hc]];class qi{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Bs(t),s=Ga(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,a,o]of Bc)for(const l of a)Object.defineProperty(this,l,{get:()=>{const d=o(n),u=s[i]-d;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Kn{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(t=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...t)})},this.target=e}add(e,t,n){var s;(s=this.target)==null||s.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Uc(r){const{EventTarget:e}=Ze(r);return r instanceof e?r:Fn(r)}function di(r,e){const t=Math.abs(r.x),n=Math.abs(r.y);return typeof e=="number"?Math.sqrt(t**2+n**2)>e:"x"in e&&"y"in e?t>e.x&&n>e.y:"x"in e?t>e.x:"y"in e?n>e.y:!1}var dt;(function(r){r.Click="click",r.DragStart="dragstart",r.Keydown="keydown",r.ContextMenu="contextmenu",r.Resize="resize",r.SelectionChange="selectionchange",r.VisibilityChange="visibilitychange"})(dt||(dt={}));function kr(r){r.preventDefault()}function zc(r){r.stopPropagation()}var ne;(function(r){r.Space="Space",r.Down="ArrowDown",r.Right="ArrowRight",r.Left="ArrowLeft",r.Up="ArrowUp",r.Esc="Escape",r.Enter="Enter",r.Tab="Tab"})(ne||(ne={}));const Ya={start:[ne.Space,ne.Enter],cancel:[ne.Esc],end:[ne.Space,ne.Enter,ne.Tab]},Wc=(r,e)=>{let{currentCoordinates:t}=e;switch(r.code){case ne.Right:return{...t,x:t.x+25};case ne.Left:return{...t,x:t.x-25};case ne.Down:return{...t,y:t.y+25};case ne.Up:return{...t,y:t.y-25}}};class Yi{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Kn(Fn(t)),this.windowListeners=new Kn(Ze(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(dt.Resize,this.handleCancel),this.windowListeners.add(dt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(dt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&qa(n),t(Et)}handleKeyDown(e){if(Hs(e)){const{active:t,context:n,options:s}=this.props,{keyboardCodes:i=Ya,coordinateGetter:a=Wc,scrollBehavior:o="smooth"}=s,{code:l}=e;if(i.end.includes(l)){this.handleEnd(e);return}if(i.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:d}=n.current,u=d?{x:d.left,y:d.top}:Et;this.referenceCoordinates||(this.referenceCoordinates=u);const h=a(e,{active:t,context:n.current,currentCoordinates:u});if(h){const f=Gn(h,u),g={x:0,y:0},{scrollableAncestors:b}=n.current;for(const m of b){const v=e.code,{isTop:y,isRight:w,isLeft:E,isBottom:S,maxScroll:x,minScroll:_}=Xa(m),P=Vc(m),I={x:Math.min(v===ne.Right?P.right-P.width/2:P.right,Math.max(v===ne.Right?P.left:P.left+P.width/2,h.x)),y:Math.min(v===ne.Down?P.bottom-P.height/2:P.bottom,Math.max(v===ne.Down?P.top:P.top+P.height/2,h.y))},O=v===ne.Right&&!w||v===ne.Left&&!E,F=v===ne.Down&&!S||v===ne.Up&&!y;if(O&&I.x!==h.x){const D=m.scrollLeft+f.x,$=v===ne.Right&&D<=x.x||v===ne.Left&&D>=_.x;if($&&!f.y){m.scrollTo({left:D,behavior:o});return}$?g.x=m.scrollLeft-D:g.x=v===ne.Right?m.scrollLeft-x.x:m.scrollLeft-_.x,g.x&&m.scrollBy({left:-g.x,behavior:o});break}else if(F&&I.y!==h.y){const D=m.scrollTop+f.y,$=v===ne.Down&&D<=x.y||v===ne.Up&&D>=_.y;if($&&!f.x){m.scrollTo({top:D,behavior:o});return}$?g.y=m.scrollTop-D:g.y=v===ne.Down?m.scrollTop-x.y:m.scrollTop-_.y,g.y&&m.scrollBy({top:-g.y,behavior:o});break}}this.handleMove(e,mn(Gn(h,this.referenceCoordinates),g))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Yi.activators=[{eventName:"onKeyDown",handler:(r,e,t)=>{let{keyboardCodes:n=Ya,onActivation:s}=e,{active:i}=t;const{code:a}=r.nativeEvent;if(n.start.includes(a)){const o=i.activatorNode.current;return o&&r.target!==o?!1:(r.preventDefault(),s==null||s({event:r.nativeEvent}),!0)}return!1}}];function Ar(r){return!!(r&&"distance"in r)}function Lr(r){return!!(r&&"delay"in r)}class Zi{constructor(e,t,n){var s;n===void 0&&(n=Uc(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:i}=e,{target:a}=i;this.props=e,this.events=t,this.document=Fn(a),this.documentListeners=new Kn(this.document),this.listeners=new Kn(n),this.windowListeners=new Kn(Ze(a)),this.initialCoordinates=(s=Rs(i))!=null?s:Et,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(dt.Resize,this.handleCancel),this.windowListeners.add(dt.DragStart,kr),this.windowListeners.add(dt.VisibilityChange,this.handleCancel),this.windowListeners.add(dt.ContextMenu,kr),this.documentListeners.add(dt.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Lr(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Ar(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:s}=this.props;s(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(dt.Click,zc,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(dt.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:a,options:{activationConstraint:o}}=i;if(!s)return;const l=(t=Rs(e))!=null?t:Et,d=Gn(s,l);if(!n&&o){if(Ar(o)){if(o.tolerance!=null&&di(d,o.tolerance))return this.handleCancel();if(di(d,o.distance))return this.handleStart()}if(Lr(o)&&di(d,o.tolerance))return this.handleCancel();this.handlePending(o,d);return}e.cancelable&&e.preventDefault(),a(l)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===ne.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const Xc={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Za extends Zi{constructor(e){const{event:t}=e,n=Fn(t.target);super(e,Xc,n)}}Za.activators=[{eventName:"onPointerDown",handler:(r,e)=>{let{nativeEvent:t}=r,{onActivation:n}=e;return!t.isPrimary||t.button!==0?!1:(n==null||n({event:t}),!0)}}];const Gc={move:{name:"mousemove"},end:{name:"mouseup"}};var Li;(function(r){r[r.RightClick=2]="RightClick"})(Li||(Li={}));class Ja extends Zi{constructor(e){super(e,Gc,Fn(e.event.target))}}Ja.activators=[{eventName:"onMouseDown",handler:(r,e)=>{let{nativeEvent:t}=r,{onActivation:n}=e;return t.button===Li.RightClick?!1:(n==null||n({event:t}),!0)}}];const ui={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Qa extends Zi{constructor(e){super(e,ui)}static setup(){return window.addEventListener(ui.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(ui.move.name,e)};function e(){}}}Qa.activators=[{eventName:"onTouchStart",handler:(r,e)=>{let{nativeEvent:t}=r,{onActivation:n}=e;const{touches:s}=t;return s.length>1?!1:(n==null||n({event:t}),!0)}}];var Hn;(function(r){r[r.Pointer=0]="Pointer",r[r.DraggableRect=1]="DraggableRect"})(Hn||(Hn={}));var qn;(function(r){r[r.TreeOrder=0]="TreeOrder",r[r.ReversedTreeOrder=1]="ReversedTreeOrder"})(qn||(qn={}));function qc(r){let{acceleration:e,activator:t=Hn.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:a=5,order:o=qn.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:f}=r;const g=Zc({delta:h,disabled:!i}),[b,m]=dc(),v=C.useRef({x:0,y:0}),y=C.useRef({x:0,y:0}),w=C.useMemo(()=>{switch(t){case Hn.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Hn.DraggableRect:return s}},[t,s,l]),E=C.useRef(null),S=C.useCallback(()=>{const _=E.current;if(!_)return;const P=v.current.x*y.current.x,I=v.current.y*y.current.y;_.scrollBy(P,I)},[]),x=C.useMemo(()=>o===qn.TreeOrder?[...d].reverse():d,[o,d]);C.useEffect(()=>{if(!i||!d.length||!w){m();return}for(const _ of x){if((n==null?void 0:n(_))===!1)continue;const P=d.indexOf(_),I=u[P];if(!I)continue;const{direction:O,speed:F}=jc(_,I,w,e,f);for(const D of["x","y"])g[D][O[D]]||(F[D]=0,O[D]=0);if(F.x>0||F.y>0){m(),E.current=_,b(S,a),v.current=F,y.current=O;return}}v.current={x:0,y:0},y.current={x:0,y:0},m()},[e,S,n,m,i,a,JSON.stringify(w),JSON.stringify(g),b,d,x,u,JSON.stringify(f)])}const Yc={x:{[Ae.Backward]:!1,[Ae.Forward]:!1},y:{[Ae.Backward]:!1,[Ae.Forward]:!1}};function Zc(r){let{delta:e,disabled:t}=r;const n=Ds(e);return is(s=>{if(t||!n||!s)return Yc;const i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[Ae.Backward]:s.x[Ae.Backward]||i.x===-1,[Ae.Forward]:s.x[Ae.Forward]||i.x===1},y:{[Ae.Backward]:s.y[Ae.Backward]||i.y===-1,[Ae.Forward]:s.y[Ae.Forward]||i.y===1}}},[t,e,n])}function Jc(r,e){const t=e!=null?r.get(e):void 0,n=t?t.node.current:null;return is(s=>{var i;return e==null?null:(i=n??s)!=null?i:null},[n,e])}function Qc(r,e){return C.useMemo(()=>r.reduce((t,n)=>{const{sensor:s}=n,i=s.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,n)}));return[...t,...i]},[]),[r,e])}var Yn;(function(r){r[r.Always=0]="Always",r[r.BeforeDragging=1]="BeforeDragging",r[r.WhileDragging=2]="WhileDragging"})(Yn||(Yn={}));var Ni;(function(r){r.Optimized="optimized"})(Ni||(Ni={}));const Nr=new Map;function ed(r,e){let{dragging:t,dependencies:n,config:s}=e;const[i,a]=C.useState(null),{frequency:o,measure:l,strategy:d}=s,u=C.useRef(r),h=v(),f=Xn(h),g=C.useCallback(function(y){y===void 0&&(y=[]),!f.current&&a(w=>w===null?y:w.concat(y.filter(E=>!w.includes(E))))},[f]),b=C.useRef(null),m=is(y=>{if(h&&!t)return Nr;if(!y||y===Nr||u.current!==r||i!=null){const w=new Map;for(let E of r){if(!E)continue;if(i&&i.length>0&&!i.includes(E.id)&&E.rect.current){w.set(E.id,E.rect.current);continue}const S=E.node.current,x=S?new qi(l(S),S):null;E.rect.current=x,x&&w.set(E.id,x)}return w}return y},[r,i,t,h,l]);return C.useEffect(()=>{u.current=r},[r]),C.useEffect(()=>{h||g()},[t,h]),C.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),C.useEffect(()=>{h||typeof o!="number"||b.current!==null||(b.current=setTimeout(()=>{g(),b.current=null},o))},[o,h,g,...n]),{droppableRects:m,measureDroppableContainers:g,measuringScheduled:i!=null};function v(){switch(d){case Yn.Always:return!1;case Yn.BeforeDragging:return t;default:return!t}}}function Ji(r,e){return is(t=>r?t||(typeof e=="function"?e(r):r):null,[e,r])}function td(r,e){return Ji(r,e)}function nd(r){let{callback:e,disabled:t}=r;const n=Ks(e),s=C.useMemo(()=>{if(t||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,t]);return C.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Us(r){let{callback:e,disabled:t}=r;const n=Ks(e),s=C.useMemo(()=>{if(t||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[t]);return C.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function sd(r){return new qi(Dn(r),r)}function Mr(r,e,t){e===void 0&&(e=sd);const[n,s]=C.useState(null);function i(){s(l=>{if(!r)return null;if(r.isConnected===!1){var d;return(d=l??t)!=null?d:null}const u=e(r);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const a=nd({callback(l){if(r)for(const d of l){const{type:u,target:h}=d;if(u==="childList"&&h instanceof HTMLElement&&h.contains(r)){i();break}}}}),o=Us({callback:i});return wt(()=>{i(),r?(o==null||o.observe(r),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(o==null||o.disconnect(),a==null||a.disconnect())},[r]),n}function id(r){const e=Ji(r);return Ka(r,e)}const $r=[];function rd(r){const e=C.useRef(r),t=is(n=>r?n&&n!==$r&&r&&e.current&&r.parentNode===e.current.parentNode?n:Bs(r):$r,[r]);return C.useEffect(()=>{e.current=r},[r]),t}function ad(r){const[e,t]=C.useState(null),n=C.useRef(r),s=C.useCallback(i=>{const a=ci(i.target);a&&t(o=>o?(o.set(a,Ai(a)),new Map(o)):null)},[]);return C.useEffect(()=>{const i=n.current;if(r!==i){a(i);const o=r.map(l=>{const d=ci(l);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,Ai(d)]):null}).filter(l=>l!=null);t(o.length?new Map(o):null),n.current=r}return()=>{a(r),a(i)};function a(o){o.forEach(l=>{const d=ci(l);d==null||d.removeEventListener("scroll",s)})}},[s,r]),C.useMemo(()=>r.length?e?Array.from(e.values()).reduce((i,a)=>mn(i,a),Et):Ga(r):Et,[r,e])}function jr(r,e){e===void 0&&(e=[]);const t=C.useRef(null);return C.useEffect(()=>{t.current=null},e),C.useEffect(()=>{const n=r!==Et;n&&!t.current&&(t.current=r),!n&&t.current&&(t.current=null)},[r]),t.current?Gn(r,t.current):Et}function od(r){C.useEffect(()=>{if(!Vs)return;const e=r.map(t=>{let{sensor:n}=t;return n.setup==null?void 0:n.setup()});return()=>{for(const t of e)t==null||t()}},r.map(e=>{let{sensor:t}=e;return t}))}function ld(r,e){return C.useMemo(()=>r.reduce((t,n)=>{let{eventName:s,handler:i}=n;return t[s]=a=>{i(a,e)},t},{}),[r,e])}function eo(r){return C.useMemo(()=>r?Lc(r):null,[r])}const Vr=[];function cd(r,e){e===void 0&&(e=Dn);const[t]=r,n=eo(t?Ze(t):null),[s,i]=C.useState(Vr);function a(){i(()=>r.length?r.map(l=>Wa(l)?n:new qi(e(l),l)):Vr)}const o=Us({callback:a});return wt(()=>{o==null||o.disconnect(),a(),r.forEach(l=>o==null?void 0:o.observe(l))},[r]),s}function to(r){if(!r)return null;if(r.children.length>1)return r;const e=r.children[0];return ss(e)?e:r}function dd(r){let{measure:e}=r;const[t,n]=C.useState(null),s=C.useCallback(d=>{for(const{target:u}of d)if(ss(u)){n(h=>{const f=e(u);return h?{...h,width:f.width,height:f.height}:f});break}},[e]),i=Us({callback:s}),a=C.useCallback(d=>{const u=to(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),n(u?e(u):null)},[e,i]),[o,l]=Fs(a);return C.useMemo(()=>({nodeRef:o,rect:t,setRef:l}),[t,o,l])}const ud=[{sensor:Za,options:{}},{sensor:Yi,options:{}}],hd={current:{}},Ps={draggable:{measure:Rr},droppable:{measure:Rr,strategy:Yn.WhileDragging,frequency:Ni.Optimized},dragOverlay:{measure:Dn}};class Bn extends Map{get(e){var t;return e!=null&&(t=super.get(e))!=null?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return(t=(n=this.get(e))==null?void 0:n.node.current)!=null?t:void 0}}const pd={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Bn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ks},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ps,measureDroppableContainers:ks,windowRect:null,measuringScheduled:!1},no={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ks,draggableNodes:new Map,over:null,measureDroppableContainers:ks},as=C.createContext(no),so=C.createContext(pd);function fd(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Bn}}}function gd(r,e){switch(e.type){case Te.DragStart:return{...r,draggable:{...r.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Te.DragMove:return r.draggable.active==null?r:{...r,draggable:{...r.draggable,translate:{x:e.coordinates.x-r.draggable.initialCoordinates.x,y:e.coordinates.y-r.draggable.initialCoordinates.y}}};case Te.DragEnd:case Te.DragCancel:return{...r,draggable:{...r.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Te.RegisterDroppable:{const{element:t}=e,{id:n}=t,s=new Bn(r.droppable.containers);return s.set(n,t),{...r,droppable:{...r.droppable,containers:s}}}case Te.SetDroppableDisabled:{const{id:t,key:n,disabled:s}=e,i=r.droppable.containers.get(t);if(!i||n!==i.key)return r;const a=new Bn(r.droppable.containers);return a.set(t,{...i,disabled:s}),{...r,droppable:{...r.droppable,containers:a}}}case Te.UnregisterDroppable:{const{id:t,key:n}=e,s=r.droppable.containers.get(t);if(!s||n!==s.key)return r;const i=new Bn(r.droppable.containers);return i.delete(t),{...r,droppable:{...r.droppable,containers:i}}}default:return r}}function md(r){let{disabled:e}=r;const{active:t,activatorEvent:n,draggableNodes:s}=C.useContext(as),i=Ds(n),a=Ds(t==null?void 0:t.id);return C.useEffect(()=>{if(!e&&!n&&i&&a!=null){if(!Hs(i)||document.activeElement===i.target)return;const o=s.get(a);if(!o)return;const{activatorNode:l,node:d}=o;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[l.current,d.current]){if(!u)continue;const h=pc(u);if(h){h.focus();break}}})}},[n,e,s,a,i]),null}function io(r,e){let{transform:t,...n}=e;return r!=null&&r.length?r.reduce((s,i)=>i({transform:s,...n}),t):t}function yd(r){return C.useMemo(()=>({draggable:{...Ps.draggable,...r==null?void 0:r.draggable},droppable:{...Ps.droppable,...r==null?void 0:r.droppable},dragOverlay:{...Ps.dragOverlay,...r==null?void 0:r.dragOverlay}}),[r==null?void 0:r.draggable,r==null?void 0:r.droppable,r==null?void 0:r.dragOverlay])}function bd(r){let{activeNode:e,measure:t,initialRect:n,config:s=!0}=r;const i=C.useRef(!1),{x:a,y:o}=typeof s=="boolean"?{x:s,y:s}:s;wt(()=>{if(!a&&!o||!e){i.current=!1;return}if(i.current||!n)return;const d=e==null?void 0:e.node.current;if(!d||d.isConnected===!1)return;const u=t(d),h=Ka(u,n);if(a||(h.x=0),o||(h.y=0),i.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const f=Ba(d);f&&f.scrollBy({top:h.y,left:h.x})}},[e,a,o,n,t])}const zs=C.createContext({...Et,scaleX:1,scaleY:1});var Vt;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Initializing=1]="Initializing",r[r.Initialized=2]="Initialized"})(Vt||(Vt={}));const vd=C.memo(function(e){var t,n,s,i;let{id:a,accessibility:o,autoScroll:l=!0,children:d,sensors:u=ud,collisionDetection:h=Tc,measuring:f,modifiers:g,...b}=e;const m=C.useReducer(gd,void 0,fd),[v,y]=m,[w,E]=vc(),[S,x]=C.useState(Vt.Uninitialized),_=S===Vt.Initialized,{draggable:{active:P,nodes:I,translate:O},droppable:{containers:F}}=v,D=P!=null?I.get(P):null,$=C.useRef({initial:null,translated:null}),L=C.useMemo(()=>{var Re;return P!=null?{id:P,data:(Re=D==null?void 0:D.data)!=null?Re:hd,rect:$}:null},[P,D]),N=C.useRef(null),[J,z]=C.useState(null),[V,G]=C.useState(null),H=Xn(b,Object.values(b)),j=rs("DndDescribedBy",a),q=C.useMemo(()=>F.getEnabled(),[F]),A=yd(f),{droppableRects:K,measureDroppableContainers:oe,measuringScheduled:fe}=ed(q,{dragging:_,dependencies:[O.x,O.y],config:A.droppable}),ce=Jc(I,P),ve=C.useMemo(()=>V?Rs(V):null,[V]),Ce=Zs(),de=td(ce,A.draggable.measure);bd({activeNode:P!=null?I.get(P):null,config:Ce.layoutShiftCompensation,initialRect:de,measure:A.draggable.measure});const B=Mr(ce,A.draggable.measure,de),ft=Mr(ce?ce.parentElement:null),we=C.useRef({activatorEvent:null,active:null,activeNode:ce,collisionRect:null,collisions:null,droppableRects:K,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Pe=F.getNodeFor((t=we.current.over)==null?void 0:t.id),Se=dd({measure:A.dragOverlay.measure}),st=(n=Se.nodeRef.current)!=null?n:ce,gt=_?(s=Se.rect)!=null?s:B:null,k=!!(Se.nodeRef.current&&Se.rect),U=id(k?null:B),he=eo(st?Ze(st):null),Ee=rd(_?Pe??ce:null),At=cd(Ee),tn=io(g,{transform:{x:O.x-U.x,y:O.y-U.y,scaleX:1,scaleY:1},activatorEvent:V,active:L,activeNodeRect:B,containerNodeRect:ft,draggingNodeRect:gt,over:we.current.over,overlayNodeRect:Se.rect,scrollableAncestors:Ee,scrollableAncestorRects:At,windowRect:he}),us=ve?mn(ve,O):null,nn=ad(Ee),hs=jr(nn),hr=jr(nn,[B]),Lt=mn(tn,hs),mt=gt?Rc(gt,tn):null,at=L&&mt?h({active:L,collisionRect:mt,droppableRects:K,droppableContainers:q,pointerCoordinates:us}):null,Tt=Va(at,"id"),[ot,sn]=C.useState(null),Ut=k?tn:mn(tn,hr),kn=Fc(Ut,(i=ot==null?void 0:ot.rect)!=null?i:null,B),Je=C.useRef(null),An=C.useCallback((Re,Ue)=>{let{sensor:ze,options:We}=Ue;if(N.current==null)return;const Ne=I.get(N.current);if(!Ne)return;const ke=Re.nativeEvent,Xe=new ze({active:N.current,activeNode:Ne,event:ke,options:We,context:we,onAbort(xe){if(!I.get(xe))return;const{onDragAbort:it}=H.current,yt={id:xe};it==null||it(yt),w({type:"onDragAbort",event:yt})},onPending(xe,xt,it,yt){if(!I.get(xe))return;const{onDragPending:W}=H.current,X={id:xe,constraint:xt,initialCoordinates:it,offset:yt};W==null||W(X),w({type:"onDragPending",event:X})},onStart(xe){const xt=N.current;if(xt==null)return;const it=I.get(xt);if(!it)return;const{onDragStart:yt}=H.current,zt={activatorEvent:ke,active:{id:xt,data:it.data,rect:$}};fn.unstable_batchedUpdates(()=>{yt==null||yt(zt),x(Vt.Initializing),y({type:Te.DragStart,initialCoordinates:xe,active:xt}),w({type:"onDragStart",event:zt}),z(Je.current),G(ke)})},onMove(xe){y({type:Te.DragMove,coordinates:xe})},onEnd:Ft(Te.DragEnd),onCancel:Ft(Te.DragCancel)});Je.current=Xe;function Ft(xe){return async function(){const{active:it,collisions:yt,over:zt,scrollAdjustedTranslate:W}=we.current;let X=null;if(it&&W){const{cancelDrop:ie}=H.current;X={activatorEvent:ke,active:it,collisions:yt,delta:W,over:zt},xe===Te.DragEnd&&typeof ie=="function"&&await Promise.resolve(ie(X))&&(xe=Te.DragCancel)}N.current=null,fn.unstable_batchedUpdates(()=>{y({type:xe}),x(Vt.Uninitialized),sn(null),z(null),G(null),Je.current=null;const ie=xe===Te.DragEnd?"onDragEnd":"onDragCancel";if(X){const pe=H.current[ie];pe==null||pe(X),w({type:ie,event:X})}})}}},[I]),qs=C.useCallback((Re,Ue)=>(ze,We)=>{const Ne=ze.nativeEvent,ke=I.get(We);if(N.current!==null||!ke||Ne.dndKit||Ne.defaultPrevented)return;const Xe={active:ke};Re(ze,Ue.options,Xe)===!0&&(Ne.dndKit={capturedBy:Ue.sensor},N.current=We,An(ze,Ue))},[I,An]),ps=Qc(u,qs);od(u),wt(()=>{B&&S===Vt.Initializing&&x(Vt.Initialized)},[B,S]),C.useEffect(()=>{const{onDragMove:Re}=H.current,{active:Ue,activatorEvent:ze,collisions:We,over:Ne}=we.current;if(!Ue||!ze)return;const ke={active:Ue,activatorEvent:ze,collisions:We,delta:{x:Lt.x,y:Lt.y},over:Ne};fn.unstable_batchedUpdates(()=>{Re==null||Re(ke),w({type:"onDragMove",event:ke})})},[Lt.x,Lt.y]),C.useEffect(()=>{const{active:Re,activatorEvent:Ue,collisions:ze,droppableContainers:We,scrollAdjustedTranslate:Ne}=we.current;if(!Re||N.current==null||!Ue||!Ne)return;const{onDragOver:ke}=H.current,Xe=We.get(Tt),Ft=Xe&&Xe.rect.current?{id:Xe.id,rect:Xe.rect.current,data:Xe.data,disabled:Xe.disabled}:null,xe={active:Re,activatorEvent:Ue,collisions:ze,delta:{x:Ne.x,y:Ne.y},over:Ft};fn.unstable_batchedUpdates(()=>{sn(Ft),ke==null||ke(xe),w({type:"onDragOver",event:xe})})},[Tt]),wt(()=>{we.current={activatorEvent:V,active:L,activeNode:ce,collisionRect:mt,collisions:at,droppableRects:K,draggableNodes:I,draggingNode:st,draggingNodeRect:gt,droppableContainers:F,over:ot,scrollableAncestors:Ee,scrollAdjustedTranslate:Lt},$.current={initial:gt,translated:mt}},[L,ce,at,mt,I,st,gt,K,F,ot,Ee,Lt]),qc({...Ce,delta:O,draggingRect:mt,pointerCoordinates:us,scrollableAncestors:Ee,scrollableAncestorRects:At});const Ys=C.useMemo(()=>({active:L,activeNode:ce,activeNodeRect:B,activatorEvent:V,collisions:at,containerNodeRect:ft,dragOverlay:Se,draggableNodes:I,droppableContainers:F,droppableRects:K,over:ot,measureDroppableContainers:oe,scrollableAncestors:Ee,scrollableAncestorRects:At,measuringConfiguration:A,measuringScheduled:fe,windowRect:he}),[L,ce,B,V,at,ft,Se,I,F,K,ot,oe,Ee,At,A,fe,he]),rn=C.useMemo(()=>({activatorEvent:V,activators:ps,active:L,activeNodeRect:B,ariaDescribedById:{draggable:j},dispatch:y,draggableNodes:I,over:ot,measureDroppableContainers:oe}),[V,ps,L,B,y,j,I,ot,oe]);return p.createElement(Ma.Provider,{value:E},p.createElement(as.Provider,{value:rn},p.createElement(so.Provider,{value:Ys},p.createElement(zs.Provider,{value:kn},d)),p.createElement(md,{disabled:(o==null?void 0:o.restoreFocus)===!1})),p.createElement(wc,{...o,hiddenTextDescribedById:j}));function Zs(){const Re=(J==null?void 0:J.autoScrollEnabled)===!1,Ue=typeof l=="object"?l.enabled===!1:l===!1,ze=_&&!Re&&!Ue;return typeof l=="object"?{...l,enabled:ze}:{enabled:ze}}}),Cd=C.createContext(null),Kr="button",Sd="Draggable";function wd(r){let{id:e,data:t,disabled:n=!1,attributes:s}=r;const i=rs(Sd),{activators:a,activatorEvent:o,active:l,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:f}=C.useContext(as),{role:g=Kr,roleDescription:b="draggable",tabIndex:m=0}=s??{},v=(l==null?void 0:l.id)===e,y=C.useContext(v?zs:Cd),[w,E]=Fs(),[S,x]=Fs(),_=ld(a,e),P=Xn(t);wt(()=>(h.set(e,{id:e,key:i,node:w,activatorNode:S,data:P}),()=>{const O=h.get(e);O&&O.key===i&&h.delete(e)}),[h,e]);const I=C.useMemo(()=>({role:g,tabIndex:m,"aria-disabled":n,"aria-pressed":v&&g===Kr?!0:void 0,"aria-roledescription":b,"aria-describedby":u.draggable}),[n,g,m,v,b,u.draggable]);return{active:l,activatorEvent:o,activeNodeRect:d,attributes:I,isDragging:v,listeners:n?void 0:_,node:w,over:f,setNodeRef:E,setActivatorNodeRef:x,transform:y}}function ro(){return C.useContext(so)}const Ed="Droppable",xd={timeout:25};function _d(r){let{data:e,disabled:t=!1,id:n,resizeObserverConfig:s}=r;const i=rs(Ed),{active:a,dispatch:o,over:l,measureDroppableContainers:d}=C.useContext(as),u=C.useRef({disabled:t}),h=C.useRef(!1),f=C.useRef(null),g=C.useRef(null),{disabled:b,updateMeasurementsFor:m,timeout:v}={...xd,...s},y=Xn(m??n),w=C.useCallback(()=>{if(!h.current){h.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{d(Array.isArray(y.current)?y.current:[y.current]),g.current=null},v)},[v]),E=Us({callback:w,disabled:b||!a}),S=C.useCallback((I,O)=>{E&&(O&&(E.unobserve(O),h.current=!1),I&&E.observe(I))},[E]),[x,_]=Fs(S),P=Xn(e);return C.useEffect(()=>{!E||!x.current||(E.disconnect(),h.current=!1,E.observe(x.current))},[x,E]),C.useEffect(()=>(o({type:Te.RegisterDroppable,element:{id:n,key:i,disabled:t,node:x,rect:f,data:P}}),()=>o({type:Te.UnregisterDroppable,key:i,id:n})),[n]),C.useEffect(()=>{t!==u.current.disabled&&(o({type:Te.SetDroppableDisabled,id:n,key:i,disabled:t}),u.current.disabled=t)},[n,i,t,o]),{active:a,rect:f,isOver:(l==null?void 0:l.id)===n,node:x,over:l,setNodeRef:_}}function Pd(r){let{animation:e,children:t}=r;const[n,s]=C.useState(null),[i,a]=C.useState(null),o=Ds(t);return!t&&!n&&o&&s(o),wt(()=>{if(!i)return;const l=n==null?void 0:n.key,d=n==null?void 0:n.props.id;if(l==null||d==null){s(null);return}Promise.resolve(e(d,i)).then(()=>{s(null)})},[e,n,i]),p.createElement(p.Fragment,null,t,n?C.cloneElement(n,{ref:a}):null)}const Od={x:0,y:0,scaleX:1,scaleY:1};function Id(r){let{children:e}=r;return p.createElement(as.Provider,{value:no},p.createElement(zs.Provider,{value:Od},e))}const Td={position:"fixed",touchAction:"none"},Fd=r=>Hs(r)?"transform 250ms ease":void 0,Dd=C.forwardRef((r,e)=>{let{as:t,activatorEvent:n,adjustScale:s,children:i,className:a,rect:o,style:l,transform:d,transition:u=Fd}=r;if(!o)return null;const h=s?d:{...d,scaleX:1,scaleY:1},f={...Td,width:o.width,height:o.height,top:o.top,left:o.left,transform:Bt.Transform.toString(h),transformOrigin:s&&n?xc(n,o):void 0,transition:typeof u=="function"?u(n):u,...l};return p.createElement(t,{className:a,style:f,ref:e},i)}),Rd=r=>e=>{let{active:t,dragOverlay:n}=e;const s={},{styles:i,className:a}=r;if(i!=null&&i.active)for(const[o,l]of Object.entries(i.active))l!==void 0&&(s[o]=t.node.style.getPropertyValue(o),t.node.style.setProperty(o,l));if(i!=null&&i.dragOverlay)for(const[o,l]of Object.entries(i.dragOverlay))l!==void 0&&n.node.style.setProperty(o,l);return a!=null&&a.active&&t.node.classList.add(a.active),a!=null&&a.dragOverlay&&n.node.classList.add(a.dragOverlay),function(){for(const[l,d]of Object.entries(s))t.node.style.setProperty(l,d);a!=null&&a.active&&t.node.classList.remove(a.active)}},kd=r=>{let{transform:{initial:e,final:t}}=r;return[{transform:Bt.Transform.toString(e)},{transform:Bt.Transform.toString(t)}]},Ad={duration:250,easing:"ease",keyframes:kd,sideEffects:Rd({styles:{active:{opacity:"0"}}})};function Ld(r){let{config:e,draggableNodes:t,droppableContainers:n,measuringConfiguration:s}=r;return Ks((i,a)=>{if(e===null)return;const o=t.get(i);if(!o)return;const l=o.node.current;if(!l)return;const d=to(a);if(!d)return;const{transform:u}=Ze(a).getComputedStyle(a),h=Ha(u);if(!h)return;const f=typeof e=="function"?e:Nd(e);return qa(l,s.draggable.measure),f({active:{id:i,data:o.data,node:l,rect:s.draggable.measure(l)},draggableNodes:t,dragOverlay:{node:a,rect:s.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:s,transform:h})})}function Nd(r){const{duration:e,easing:t,sideEffects:n,keyframes:s}={...Ad,...r};return i=>{let{active:a,dragOverlay:o,transform:l,...d}=i;if(!e)return;const u={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},h={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/o.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/o.rect.height:1},f={x:l.x-u.x,y:l.y-u.y,...h},g=s({...d,active:a,dragOverlay:o,transform:{initial:l,final:f}}),[b]=g,m=g[g.length-1];if(JSON.stringify(b)===JSON.stringify(m))return;const v=n==null?void 0:n({active:a,dragOverlay:o,...d}),y=o.node.animate(g,{duration:e,easing:t,fill:"forwards"});return new Promise(w=>{y.onfinish=()=>{v==null||v(),w()}})}}let Hr=0;function Md(r){return C.useMemo(()=>{if(r!=null)return Hr++,Hr},[r])}const $d=p.memo(r=>{let{adjustScale:e=!1,children:t,dropAnimation:n,style:s,transition:i,modifiers:a,wrapperElement:o="div",className:l,zIndex:d=999}=r;const{activatorEvent:u,active:h,activeNodeRect:f,containerNodeRect:g,draggableNodes:b,droppableContainers:m,dragOverlay:v,over:y,measuringConfiguration:w,scrollableAncestors:E,scrollableAncestorRects:S,windowRect:x}=ro(),_=C.useContext(zs),P=Md(h==null?void 0:h.id),I=io(a,{activatorEvent:u,active:h,activeNodeRect:f,containerNodeRect:g,draggingNodeRect:v.rect,over:y,overlayNodeRect:v.rect,scrollableAncestors:E,scrollableAncestorRects:S,transform:_,windowRect:x}),O=Ji(f),F=Ld({config:n,draggableNodes:b,droppableContainers:m,measuringConfiguration:w}),D=O?v.setRef:void 0;return p.createElement(Id,null,p.createElement(Pd,{animation:F},h&&P?p.createElement(Dd,{key:P,id:h.id,ref:D,as:o,activatorEvent:u,adjustScale:e,className:l,transition:i,rect:O,style:{zIndex:d,...s},transform:I},t):null))});function ao(r,e,t){const n=r.slice();return n.splice(t<0?n.length+t:t,0,n.splice(e,1)[0]),n}function jd(r,e){return r.reduce((t,n,s)=>{const i=e.get(n);return i&&(t[s]=i),t},Array(r.length))}function bs(r){return r!==null&&r>=0}function Vd(r,e){if(r===e)return!0;if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function Kd(r){return typeof r=="boolean"?{draggable:r,droppable:r}:r}const Qi=r=>{let{rects:e,activeIndex:t,overIndex:n,index:s}=r;const i=ao(e,n,t),a=e[s],o=i[s];return!o||!a?null:{x:o.left-a.left,y:o.top-a.top,scaleX:o.width/a.width,scaleY:o.height/a.height}},oo="Sortable",lo=p.createContext({activeIndex:-1,containerId:oo,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Qi,disabled:{draggable:!1,droppable:!1}});function Hd(r){let{children:e,id:t,items:n,strategy:s=Qi,disabled:i=!1}=r;const{active:a,dragOverlay:o,droppableRects:l,over:d,measureDroppableContainers:u}=ro(),h=rs(oo,t),f=o.rect!==null,g=C.useMemo(()=>n.map(_=>typeof _=="object"&&"id"in _?_.id:_),[n]),b=a!=null,m=a?g.indexOf(a.id):-1,v=d?g.indexOf(d.id):-1,y=C.useRef(g),w=!Vd(g,y.current),E=v!==-1&&m===-1||w,S=Kd(i);wt(()=>{w&&b&&u(g)},[w,g,b,u]),C.useEffect(()=>{y.current=g},[g]);const x=C.useMemo(()=>({activeIndex:m,containerId:h,disabled:S,disableTransforms:E,items:g,overIndex:v,useDragOverlay:f,sortedRects:jd(g,l),strategy:s}),[m,h,S.draggable,S.droppable,E,g,v,l,f,s]);return p.createElement(lo.Provider,{value:x},e)}const Bd=r=>{let{id:e,items:t,activeIndex:n,overIndex:s}=r;return ao(t,n,s).indexOf(e)},Ud=r=>{let{containerId:e,isSorting:t,wasDragging:n,index:s,items:i,newIndex:a,previousItems:o,previousContainerId:l,transition:d}=r;return!d||!n||o!==i&&s===a?!1:t?!0:a!==s&&e===l},zd={duration:200,easing:"ease"},co="transform",Wd=Bt.Transition.toString({property:co,duration:0,easing:"linear"}),Xd={roleDescription:"sortable"};function Gd(r){let{disabled:e,index:t,node:n,rect:s}=r;const[i,a]=C.useState(null),o=C.useRef(t);return wt(()=>{if(!e&&t!==o.current&&n.current){const l=s.current;if(l){const d=Dn(n.current,{ignoreTransform:!0}),u={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(u.x||u.y)&&a(u)}}t!==o.current&&(o.current=t)},[e,t,n,s]),C.useEffect(()=>{i&&a(null)},[i]),i}function qd(r){let{animateLayoutChanges:e=Ud,attributes:t,disabled:n,data:s,getNewIndex:i=Bd,id:a,strategy:o,resizeObserverConfig:l,transition:d=zd}=r;const{items:u,containerId:h,activeIndex:f,disabled:g,disableTransforms:b,sortedRects:m,overIndex:v,useDragOverlay:y,strategy:w}=C.useContext(lo),E=Yd(n,g),S=u.indexOf(a),x=C.useMemo(()=>({sortable:{containerId:h,index:S,items:u},...s}),[h,s,S,u]),_=C.useMemo(()=>u.slice(u.indexOf(a)),[u,a]),{rect:P,node:I,isOver:O,setNodeRef:F}=_d({id:a,data:x,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...l}}),{active:D,activatorEvent:$,activeNodeRect:L,attributes:N,setNodeRef:J,listeners:z,isDragging:V,over:G,setActivatorNodeRef:H,transform:j}=wd({id:a,data:x,attributes:{...Xd,...t},disabled:E.draggable}),q=cc(F,J),A=!!D,K=A&&!b&&bs(f)&&bs(v),oe=!y&&V,fe=oe&&K?j:null,ve=K?fe??(o??w)({rects:m,activeNodeRect:L,activeIndex:f,overIndex:v,index:S}):null,Ce=bs(f)&&bs(v)?i({id:a,items:u,activeIndex:f,overIndex:v}):S,de=D==null?void 0:D.id,B=C.useRef({activeId:de,items:u,newIndex:Ce,containerId:h}),ft=u!==B.current.items,we=e({active:D,containerId:h,isDragging:V,isSorting:A,id:a,index:S,items:u,newIndex:B.current.newIndex,previousItems:B.current.items,previousContainerId:B.current.containerId,transition:d,wasDragging:B.current.activeId!=null}),Pe=Gd({disabled:!we,index:S,node:I,rect:P});return C.useEffect(()=>{A&&B.current.newIndex!==Ce&&(B.current.newIndex=Ce),h!==B.current.containerId&&(B.current.containerId=h),u!==B.current.items&&(B.current.items=u)},[A,Ce,h,u]),C.useEffect(()=>{if(de===B.current.activeId)return;if(de&&!B.current.activeId){B.current.activeId=de;return}const st=setTimeout(()=>{B.current.activeId=de},50);return()=>clearTimeout(st)},[de]),{active:D,activeIndex:f,attributes:N,data:x,rect:P,index:S,newIndex:Ce,items:u,isOver:O,isSorting:A,isDragging:V,listeners:z,node:I,overIndex:v,over:G,setNodeRef:q,setActivatorNodeRef:H,setDroppableNodeRef:F,setDraggableNodeRef:J,transform:Pe??ve,transition:Se()};function Se(){if(Pe||ft&&B.current.newIndex===S)return Wd;if(!(oe&&!Hs($)||!d)&&(A||we))return Bt.Transition.toString({...d,property:co})}}function Yd(r,e){var t,n;return typeof r=="boolean"?{draggable:r,droppable:!1}:{draggable:(t=r==null?void 0:r.draggable)!=null?t:e.draggable,droppable:(n=r==null?void 0:r.droppable)!=null?n:e.droppable}}function As(r){if(!r)return!1;const e=r.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Zd=[ne.Down,ne.Right,ne.Up,ne.Left],Jd=(r,e)=>{let{context:{active:t,collisionRect:n,droppableRects:s,droppableContainers:i,over:a,scrollableAncestors:o}}=e;if(Zd.includes(r.code)){if(r.preventDefault(),!t||!n)return;const l=[];i.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const f=s.get(h.id);if(f)switch(r.code){case ne.Down:n.top<f.top&&l.push(h);break;case ne.Up:n.top>f.top&&l.push(h);break;case ne.Left:n.left>f.left&&l.push(h);break;case ne.Right:n.left<f.left&&l.push(h);break}});const d=Oc({collisionRect:n,droppableRects:s,droppableContainers:l});let u=Va(d,"id");if(u===(a==null?void 0:a.id)&&d.length>1&&(u=d[1].id),u!=null){const h=i.get(t.id),f=i.get(u),g=f?s.get(f.id):null,b=f==null?void 0:f.node.current;if(b&&g&&h&&f){const v=Bs(b).some((_,P)=>o[P]!==_),y=uo(h,f),w=Qd(h,f),E=v||!y?{x:0,y:0}:{x:w?n.width-g.width:0,y:w?n.height-g.height:0},S={x:g.left,y:g.top};return E.x&&E.y?S:Gn(S,E)}}}};function uo(r,e){return!As(r)||!As(e)?!1:r.data.current.sortable.containerId===e.data.current.sortable.containerId}function Qd(r,e){return!As(r)||!As(e)||!uo(r,e)?!1:r.data.current.sortable.index<e.data.current.sortable.index}const eu="semi-sortable";function tu(r){return p.createElement("div",Object.assign({style:{overflow:"auto"}},r))}const nu={coordinateGetter:Jd};function su(r){let{items:e,onSortEnd:t,adjustScale:n,renderItem:s,transition:i,collisionDetection:a=Pc,strategy:o=Qi,useDragOverlay:l=!0,dragOverlayCls:d,container:u=tu,prefix:h=eu}=r;const[f,g]=C.useState(null),b=Ec(li(Ja),li(Qa),li(Yi,nu)),m=C.useCallback(S=>e.indexOf(S),[e]),v=C.useMemo(()=>f?m(f):-1,[m,f]),y=C.useCallback(S=>{let{active:x}=S;x&&g(x.id)},[]),w=C.useCallback(S=>{let{over:x}=S;if(g(null),x){const _=m(x.id);v!==_&&t({oldIndex:v,newIndex:_})}},[v,m,t]),E=C.useCallback(()=>{g(null)},[]);return p.createElement(vd,{sensors:b,collisionDetection:a,onDragStart:y,onDragEnd:w,onDragCancel:E,autoScroll:{order:qn.ReversedTreeOrder}},p.createElement(Hd,{items:e,strategy:o},p.createElement(u,null,e.map((S,x)=>p.createElement(iu,{key:S,id:S,index:x,renderItem:s,useDragOverlay:l,prefix:h,transition:i})))),l?fn.createPortal(p.createElement($d,{adjustScale:n,style:{zIndex:void 0},className:d},f?s({id:f,sortableHandle:S=>S}):null),document.body):null)}function iu(r){let{animateLayoutChanges:e,id:t,renderItem:n,prefix:s,transition:i}=r;const{listeners:a,setNodeRef:o,transform:l,transition:d,active:u,isOver:h,attributes:f}=qd({id:t,animateLayoutChanges:e,transition:i}),g=C.useCallback(v=>()=>p.createElement("span",Object.assign({},a,{style:{lineHeight:0},onMouseDown:y=>{a.onMouseDown(y),y.preventDefault(),y.stopPropagation()}}),p.createElement(v,null)),[a]),b=T(`${s}-sortable-item`,{[`${s}-sortable-item-over`]:h,[`${s}-sortable-item-active`]:(u==null?void 0:u.id)===t}),m=C.useMemo(()=>Wn(i)?void 0:{transform:Bt.Transform.toString(Object.assign(Object.assign({},l),{scaleX:1,scaleY:1})),transition:d},[i,l,d]);return p.createElement("div",Object.assign({ref:o,style:m,className:b},f),n({id:t,sortableHandle:g}))}var ru=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const Q=rc.PREFIX;function au(r){return p.createElement("div",Object.assign({className:`${Q}-sortable-list`},r))}class os extends Be{constructor(e){var t;super(e),t=this,this.updateInputWidth=()=>{const n=this.inputRef&&this.inputRef.current,s=this.inputMirrorRef&&this.inputMirrorRef.current,{inputValue:i,tagsArray:a}=this.state,{placeholder:o}=this.props;if(!n||!s)return;if(!i){this.state.inputWidth!==void 0&&this.setState({inputWidth:void 0});return}try{const u=window.getComputedStyle(n);s.style.font=u.font,s.style.letterSpacing=u.letterSpacing,s.style.textTransform=u.textTransform,s.style.paddingLeft=u.paddingLeft,s.style.paddingRight=u.paddingRight,s.style.borderLeftWidth=u.borderLeftWidth,s.style.borderRightWidth=u.borderRightWidth,s.style.boxSizing=u.boxSizing}catch{}const l=i||((a==null?void 0:a.length)===0?o:"")||" ";s.textContent!==String(l)&&(s.textContent=String(l));const d=Math.ceil(s.scrollWidth+2);Number.isFinite(d)&&d>0&&d!==this.state.inputWidth&&this.setState({inputWidth:d})},this.handleInputChange=n=>{this.foundation.handleInputChange(n)},this.handleKeyDown=n=>{this.foundation.handleKeyDown(n)},this.handleInputFocus=n=>{this.foundation.handleInputFocus(n)},this.handleInputBlur=n=>{this.foundation.handleInputBlur(n)},this.handleClearBtn=n=>{this.foundation.handleClearBtn(n)},this.handleClearEnterPress=n=>{this.foundation.handleClearEnterPress(n)},this.handleTagClose=n=>{this.foundation.handleTagClose(n)},this.handleInputMouseLeave=n=>{this.foundation.handleInputMouseLeave()},this.handleClick=n=>{this.foundation.handleClick(n)},this.handleInputMouseEnter=n=>{this.foundation.handleInputMouseEnter()},this.handleClickPrefixOrSuffix=n=>{this.foundation.handleClickPrefixOrSuffix(n)},this.handlePreventMouseDown=n=>{this.foundation.handlePreventMouseDown(n)},this.getAllTags=()=>{const{tagsArray:n}=this.state;return n.map((s,i)=>this.renderTag(s,i))},this.renderTag=(n,s,i)=>{const{size:a,disabled:o,renderTagItem:l,showContentTooltip:d,draggable:u}=this.props,{active:h}=this.state,f=h&&u,g=T(`${Q}-wrapper-tag`,{[`${Q}-wrapper-tag-size-${a}`]:a,[`${Q}-wrapper-tag-icon`]:f}),b=T(`${Q}-wrapper-typo`,{[`${Q}-wrapper-typo-disabled`]:o}),m=T({[`${Q}-drag-item`]:f,[`${Q}-wrapper-tag-icon`]:f}),v=i&&i(()=>p.createElement(Fl,{className:`${Q}-drag-handler`})),y=f?n:`${s}${n}`,w=function(){for(var E=arguments.length,S=new Array(E),x=0;x<E;x++)S[x]=arguments[x];S[1]&&typeof S[1].preventDefault=="function"&&S[1].preventDefault(),!o&&t.handleTagClose(s)};return Le(l)?f&&i?p.createElement("div",{className:m,key:y},p.createElement(v,null),l(n,s,w)):l(n,s,w):p.createElement(Pt,{className:g,color:"white",size:a==="small"?"small":"large",type:"light",onClose:w,closable:!o,key:y,visible:!0,"aria-label":`${o?"":"Closable "}Tag: ${n}`},f&&i?p.createElement(v,null):null,p.createElement($o,{className:b,ellipsis:{showTooltip:d,rows:1}},n))},this.renderSortTag=n=>{const{id:s,sortableHandle:i}=n,{tagsArray:a}=this.state,o=a.indexOf(s);return this.renderTag(s,o,i)},this.onSortEnd=n=>{this.foundation.handleSortEnd(n)},this.handleInputCompositionStart=n=>{this.foundation.handleInputCompositionStart(n)},this.handleInputCompositionEnd=n=>{this.foundation.handleInputCompositionEnd(n)},this.foundation=new lc(this.adapter),this.state={tagsArray:e.defaultValue||[],inputValue:"",inputWidth:void 0,focusing:!1,hovering:!1,active:!1,entering:!1},this.inputRef=p.createRef(),this.tagInputRef=p.createRef(),this.inputMirrorRef=p.createRef(),this.clickOutsideHandler=null}static getDerivedStateFromProps(e,t){const{value:n,inputValue:s}=e,{tagsArray:i}=t;let a;return ya(n)?a=n:"value"in e&&!n?a=[]:a=i,{tagsArray:a,inputValue:_e(s)?s:t.inputValue}}get adapter(){return Object.assign(Object.assign({},super.adapter),{setInputValue:e=>{this.setState({inputValue:e})},setTagsArray:e=>{this.setState({tagsArray:e})},setFocusing:e=>{this.setState({focusing:e})},toggleFocusing:e=>{const{preventScroll:t}=this.props,n=this.inputRef&&this.inputRef.current;e?n&&n.focus({preventScroll:t}):n&&n.blur(),this.setState({focusing:e})},setHovering:e=>{this.setState({hovering:e})},setActive:e=>{this.setState({active:e})},setEntering:e=>{this.setState({entering:e})},getClickOutsideHandler:()=>this.clickOutsideHandler,notifyBlur:e=>{this.props.onBlur(e)},notifyFocus:e=>{this.props.onFocus(e)},notifyInputChange:(e,t)=>{this.props.onInputChange(e,t)},notifyTagChange:e=>{this.props.onChange(e)},notifyTagAdd:e=>{this.props.onAdd(e)},notifyTagRemove:(e,t)=>{this.props.onRemove(e,t)},notifyKeyDown:e=>{this.props.onKeyDown(e)},registerClickOutsideHandler:e=>{const t=n=>{const s=this.tagInputRef&&this.tagInputRef.current,i=n.target,a=n.composedPath&&n.composedPath()||[i];s&&!s.contains(i)&&!a.includes(s)&&e(n)};this.clickOutsideHandler=t,document.addEventListener("click",t,!1)},unregisterClickOutsideHandler:()=>{document.removeEventListener("click",this.clickOutsideHandler,!1),this.clickOutsideHandler=null}})}componentDidMount(){const{disabled:e,autoFocus:t,preventScroll:n}=this.props;!e&&t&&(this.inputRef.current.focus({preventScroll:n}),this.foundation.handleClick()),this.foundation.init(),this.updateInputWidth()}componentDidUpdate(e,t){var n,s;(t.inputValue!==this.state.inputValue||e.size!==this.props.size||e.placeholder!==this.props.placeholder||((n=t.tagsArray)===null||n===void 0?void 0:n.length)!==((s=this.state.tagsArray)===null||s===void 0?void 0:s.length))&&this.updateInputWidth()}renderClearBtn(){const{hovering:e,tagsArray:t,inputValue:n}=this.state,{showClear:s,disabled:i,clearIcon:a}=this.props,o=T(`${Q}-clearBtn`,{[`${Q}-clearBtn-invisible`]:!e||n===""&&t.length===0||i});return s?p.createElement("div",{role:"button",tabIndex:0,"aria-label":"Clear TagInput value",className:o,onClick:l=>this.handleClearBtn(l),onKeyPress:l=>this.handleClearEnterPress(l)},a||p.createElement(Ms,null)):null}renderPrefix(){const{prefix:e,insetLabel:t,insetLabelId:n}=this.props,s=e||t;if(Wn(s)||me(s))return null;const i=T(`${Q}-prefix`,{[`${Q}-inset-label`]:t,[`${Q}-prefix-text`]:s&&_e(s),[`${Q}-prefix-icon`]:Sn(s)});return p.createElement("div",{className:i,onMouseDown:this.handlePreventMouseDown,onClick:this.handleClickPrefixOrSuffix,id:n,"x-semi-prop":"prefix"},s)}renderSuffix(){const{suffix:e}=this.props;if(Wn(e)||me(e))return null;const t=T(`${Q}-suffix`,{[`${Q}-suffix-text`]:e&&_e(e),[`${Q}-suffix-icon`]:Sn(e)});return p.createElement("div",{className:t,onMouseDown:this.handlePreventMouseDown,onClick:this.handleClickPrefixOrSuffix,"x-semi-prop":"suffix"},e)}renderTags(){const{disabled:e,maxTagCount:t,showRestTagsPopover:n,restTagsPopoverProps:s={},draggable:i,expandRestTagsOnClick:a}=this.props,{tagsArray:o,active:l}=this.state,d=T(`${Q}-wrapper-n`,{[`${Q}-wrapper-n-disabled`]:e}),u=this.getAllTags();let h=[],f=[...u];(!l||!a)&&t&&t<u.length&&(f=u.slice(0,t),h=u.slice(t));const g=p.createElement("span",{className:d},"+",o.length-t),b=u.map((m,v)=>({item:m,key:o[v]}));return l&&i&&b.length>0?p.createElement(su,{items:o,onSortEnd:this.onSortEnd,renderItem:this.renderSortTag,container:au,prefix:Q,transition:null,dragOverlayCls:`${Q}-right-item-drag-item-move`}):p.createElement(p.Fragment,null,f,h.length>0&&(n?p.createElement(Cn,Object.assign({content:h,showArrow:!0,trigger:"hover",position:"top",autoAdjustOverflow:!0},s),g):g))}blur(){this.inputRef.current.blur(),this.foundation.clickOutsideCallBack()}focus(){const{preventScroll:e,disabled:t}=this.props;this.inputRef.current.focus({preventScroll:e}),t||this.foundation.handleClick()}render(){const e=this.props,{size:t,style:n,className:s,disabled:i,placeholder:a,validateStatus:o,prefix:l,insetLabel:d,suffix:u}=e,h=ru(e,["size","style","className","disabled","placeholder","validateStatus","prefix","insetLabel","suffix"]),{focusing:f,hovering:g,tagsArray:b,inputValue:m,active:v,inputWidth:y}=this.state,w=T(Q,s,{[`${Q}-focus`]:f||v,[`${Q}-disabled`]:i,[`${Q}-hover`]:g&&!i,[`${Q}-error`]:o==="error",[`${Q}-warning`]:o==="warning",[`${Q}-small`]:t==="small",[`${Q}-large`]:t==="large",[`${Q}-with-prefix`]:!!l||!!d,[`${Q}-with-suffix`]:!!u}),E=T(`${Q}-wrapper-input`,`${Q}-wrapper-input-${t}`),S=T(`${Q}-wrapper`),x={};return typeof y=="number"&&(x.width=y),p.createElement("div",Object.assign({ref:this.tagInputRef,style:n,className:w,"aria-disabled":i,"aria-label":this.props["aria-label"],"aria-invalid":o==="error",onMouseEnter:_=>{this.handleInputMouseEnter(_)},onMouseLeave:_=>{this.handleInputMouseLeave(_)},onClick:_=>{this.handleClick(_)}},this.getDataAttr(h)),this.renderPrefix(),p.createElement("div",{className:S},this.renderTags(),p.createElement("span",{ref:this.inputMirrorRef,className:`${Q}-wrapper-inputMirror`}),p.createElement(Qt,{"aria-label":"input value",ref:this.inputRef,className:E,style:x,disabled:i,value:m,size:t,placeholder:b.length===0?a:"",onKeyDown:_=>{this.handleKeyDown(_)},onChange:(_,P)=>{this.handleInputChange(P)},onBlur:_=>{this.handleInputBlur(_)},onFocus:_=>{this.handleInputFocus(_)},onCompositionStart:this.handleInputCompositionStart,onCompositionEnd:this.handleInputCompositionEnd})),this.renderClearBtn(),this.renderSuffix())}}os.propTypes={children:c.node,clearIcon:c.node,style:c.object,className:c.string,disabled:c.bool,allowDuplicates:c.bool,max:c.number,maxTagCount:c.number,maxLength:c.number,showRestTagsPopover:c.bool,restTagsPopoverProps:c.object,showContentTooltip:c.oneOfType([c.shape({type:c.string,opts:c.object}),c.bool]),defaultValue:c.array,value:c.array,inputValue:c.string,placeholder:c.string,separator:c.oneOfType([c.string,c.array]),showClear:c.bool,addOnBlur:c.bool,draggable:c.bool,expandRestTagsOnClick:c.bool,autoFocus:c.bool,renderTagItem:c.func,onBlur:c.func,onFocus:c.func,onChange:c.func,onInputChange:c.func,onExceed:c.func,onInputExceed:c.func,onAdd:c.func,onRemove:c.func,onKeyDown:c.func,size:c.oneOf(Ir.SIZE_SET),validateStatus:c.oneOf(Ir.STATUS),prefix:c.oneOfType([c.string,c.node]),suffix:c.oneOfType([c.string,c.node]),"aria-label":c.string,preventScroll:c.bool};os.defaultProps={showClear:!1,addOnBlur:!1,allowDuplicates:!0,showRestTagsPopover:!0,autoFocus:!1,draggable:!1,expandRestTagsOnClick:!0,showContentTooltip:!0,separator:",",size:"default",validateStatus:"default",onBlur:M,onFocus:M,onChange:M,onInputChange:M,onExceed:M,onInputExceed:M,onAdd:M,onRemove:M,onKeyDown:M};const Z=Da.PREFIX,ou=0;class En extends Be{constructor(e){super(e),this.search=t=>{this.handleInputChange(t)},this.handleInputChange=t=>{this.foundation.handleInputChange(t)},this.handleTagRemoveInTrigger=t=>{this.foundation.handleTagRemoveInTrigger(t)},this.handleTagClose=(t,n,s)=>{n.preventDefault(),this.foundation.handleTagRemoveByKey(s)},this.renderTagItem=(t,n)=>{const{keyEntities:s,disabledKeys:i}=this.state,{size:a,disabled:o,displayProp:l,displayRender:d,disableStrictly:u}=this.props;if(s[t]){const h=o||s[t].data.disabled||u&&i.has(t),f=T(`${Z}-selection-tag`,{[`${Z}-selection-tag-disabled`]:h});return Le(d)?d(s[t],n):p.createElement(Pt,{size:a==="default"?"large":a,key:`tag-${t}-${n}`,color:"white",tagKey:t,className:f,closable:!0,onClose:this.handleTagClose},s[t].data[l])}return null},this.onRemoveInTagInput=t=>{this.foundation.handleTagRemoveByKey(t)},this.handleItemClick=(t,n)=>{this.foundation.handleItemClick(t,n)},this.handleItemHover=(t,n)=>{this.foundation.handleItemHover(t,n)},this.onItemCheckboxClick=t=>{this.foundation.onItemCheckboxClick(t)},this.handleListScroll=(t,n)=>{this.foundation.handleListScroll(t,n)},this.renderContent=()=>{const{inputValue:t,isSearching:n,activeKeys:s,selectedKeys:i,checkedKeys:a,halfCheckedKeys:o,loadedKeys:l,loadingKeys:d}=this.state,{filterTreeNode:u,dropdownClassName:h,dropdownStyle:f,loadData:g,emptyContent:b,separator:m,topSlot:v,bottomSlot:y,showNext:w,multiple:E,filterRender:S,virtualizeInSearch:x,expandIcon:_}=this.props,P=!!u&&n,I=T(h,`${Z}-popover`),O=this.foundation.getRenderData(),D=!O||!O.length?Object.assign(Object.assign({},f),{minWidth:this.state.emptyContentMinWidth}):f;return p.createElement("div",{className:I,role:"listbox",style:D,onKeyDown:this.foundation.handleKeyDown,ref:this.optionContainerEl},v,p.createElement(js,{activeKeys:s,selectedKeys:i,separator:m,loadedKeys:l,loadingKeys:d,onItemClick:this.handleItemClick,onItemHover:this.handleItemHover,showNext:w,onItemCheckboxClick:this.onItemCheckboxClick,onListScroll:this.handleListScroll,searchable:P,keyword:t,emptyContent:b,loadData:g,data:O,multiple:E,checkedKeys:a,halfCheckedKeys:o,filterRender:S,virtualize:x,expandIcon:_}),y)},this.renderPlusN=t=>{const{disabled:n,showRestTagsPopover:s,restTagsPopoverProps:i}=this.props,a=T(`${Z}-selection-n`,{[`${Z}-selection-n-disabled`]:n}),o=p.createElement("span",{className:a},"+",t.length);return s?p.createElement(Cn,Object.assign({content:t,showArrow:!0,trigger:"hover",position:"top",autoAdjustOverflow:!0},i),o):o},this.renderMultipleTags=()=>{const{autoMergeValue:t,maxTagCount:n,checkRelation:s}=this.props,{checkedKeys:i,resolvedCheckedKeys:a}=this.state,o=this.mergeType===ge.NONE_MERGE_TYPE||s===ge.UN_RELATED?i:a,l=[],d=[];return[...o].forEach((u,h)=>{const f=!tt(n)||n>=h+1,g=this.renderTagItem(u,h);f?l.push(g):d.push(g)}),p.createElement(p.Fragment,null,l,!Me(d)&&this.renderPlusN(d))},this.renderDisplayText=()=>{const{displayProp:t,separator:n,displayRender:s}=this.props,{selectedKeys:i}=this.state;let a="";if(i.size){const o=this.foundation.getItemPropPath([...i][0],t);s&&typeof s=="function"?a=s(o):a=o.map((l,d)=>p.createElement(C.Fragment,{key:`${l}-${d}`},d<o.length-1?p.createElement(p.Fragment,null,l,n):l))}return a},this.renderSelectContent=()=>{const{placeholder:t,filterTreeNode:n,multiple:s,searchPosition:i}=this.props,{checkedKeys:a}=this.state;if(!(!!n&&i===ge.SEARCH_POSITION_TRIGGER)){if(s)return a.size===0?p.createElement("span",{className:`${Z}-selection-placeholder`},t):this.renderMultipleTags();{const d=this.renderDisplayText(),u=T({[`${Z}-selection-placeholder`]:!d});return p.createElement("span",{className:u},d||t)}}return s?this.renderTagInput():this.renderInput()},this.renderSuffix=()=>{const{suffix:t}=this.props,n=T({[`${Z}-suffix`]:!0,[`${Z}-suffix-text`]:t&&_e(t),[`${Z}-suffix-icon`]:Sn(t)});return p.createElement("div",{className:n,"x-semi-prop":"suffix"},t)},this.renderPrefix=()=>{const{prefix:t,insetLabel:n,insetLabelId:s}=this.props,i=t||n,a=T({[`${Z}-prefix`]:!0,[`${Z}-inset-label`]:n,[`${Z}-prefix-text`]:i&&_e(i),[`${Z}-prefix-icon`]:Sn(i)});return p.createElement("div",{className:a,id:s,"x-semi-prop":"prefix,insetLabel"},i)},this.renderCustomTrigger=()=>{var t;const{disabled:n,triggerRender:s,multiple:i}=this.props,{selectedKeys:a,inputValue:o,inputPlaceHolder:l,resolvedCheckedKeys:d,checkedKeys:u,keyEntities:h}=this.state;let f;return i?this.mergeType===ge.NONE_MERGE_TYPE?(f=new Set,u.forEach(g=>{var b;f.add((b=h[g])===null||b===void 0?void 0:b.pos)})):(f=new Set,d.forEach(g=>{var b;f.add((b=h[g])===null||b===void 0?void 0:b.pos)})):f=(t=h[[...a][0]])===null||t===void 0?void 0:t.pos,p.createElement(Ns,{value:f,inputValue:o,onChange:this.handleInputChange,onClear:this.handleClear,placeholder:l,disabled:n,triggerRender:s,componentName:"Cascader",componentProps:Object.assign({},this.props),onSearch:this.handleInputChange,onRemove:this.handleTagRemoveInTrigger})},this.handleMouseOver=()=>{this.foundation.toggleHoverState(!0)},this.handleMouseLeave=()=>{this.foundation.toggleHoverState(!1)},this.handleClear=t=>{t&&t.stopPropagation(),this.foundation.handleClear()},this.handleClearEnterPress=t=>{t&&t.stopPropagation(),this.foundation.handleClearEnterPress(t)},this.showClearBtn=()=>{const{showClear:t,disabled:n,multiple:s}=this.props,{selectedKeys:i,isOpen:a,isHovering:o,checkedKeys:l,inputValue:d}=this.state,u=i.size,h=s&&l.size;return t&&(d||u||h)&&!n&&(a||o)},this.renderClearBtn=()=>{const t=T(`${Z}-clearbtn`),{clearIcon:n}=this.props;return this.showClearBtn()?p.createElement("div",{className:t,onClick:this.handleClear,onKeyPress:this.handleClearEnterPress,role:"button",tabIndex:0},n||p.createElement(Ms,null)):null},this.renderArrow=()=>{const{arrowIcon:t}=this.props;return this.showClearBtn()?null:t?p.createElement("div",{className:T(`${Z}-arrow`),"x-semi-prop":"arrowIcon"},t):null},this.renderSelection=()=>{const{disabled:t,multiple:n,filterTreeNode:s,style:i,size:a,className:o,validateStatus:l,prefix:d,suffix:u,insetLabel:h,triggerRender:f,showClear:g,id:b,borderless:m}=this.props,{isOpen:v,isFocus:y,isInput:w,checkedKeys:E}=this.state,S=!!s,x=typeof f=="function",_=x?T(o):T(Z,o,{[`${Z}-borderless`]:m,[`${Z}-focus`]:y||v&&!w,[`${Z}-disabled`]:t,[`${Z}-single`]:!0,[`${Z}-filterable`]:S,[`${Z}-error`]:l==="error",[`${Z}-warning`]:l==="warning",[`${Z}-small`]:a==="small",[`${Z}-large`]:a==="large",[`${Z}-with-prefix`]:d||h,[`${Z}-with-suffix`]:u}),P=g?{onMouseEnter:()=>this.handleMouseOver(),onMouseLeave:()=>this.handleMouseLeave()}:{},I=T(`${Z}-selection`,{[`${Z}-selection-multiple`]:n&&!Me(E)}),O=x?this.renderCustomTrigger():[p.createElement(C.Fragment,{key:"prefix"},d||h?this.renderPrefix():null),p.createElement(C.Fragment,{key:"selection"},p.createElement("div",{className:I},this.renderSelectContent())),p.createElement(C.Fragment,{key:"suffix"},u?this.renderSuffix():null),p.createElement(C.Fragment,{key:"clearbtn"},this.renderClearBtn()),p.createElement(C.Fragment,{key:"arrow"},this.renderArrow())];return p.createElement("div",Object.assign({className:_,style:i,ref:this.triggerRef,onClick:F=>this.foundation.handleClick(F),onKeyPress:F=>this.foundation.handleSelectionEnterPress(F),"aria-invalid":this.props["aria-invalid"],"aria-errormessage":this.props["aria-errormessage"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-describedby":this.props["aria-describedby"],"aria-required":this.props["aria-required"],id:b,onKeyDown:this.foundation.handleKeyDown},P,{role:"combobox",tabIndex:0},this.getDataAttr(this.props)),O)},this.state={emptyContentMinWidth:null,disabledKeys:new Set,isOpen:e.defaultOpen,rePosKey:ou,keyEntities:{},selectedKeys:new Set([]),activeKeys:new Set([]),filteredKeys:new Set([]),inputValue:"",isSearching:!1,inputPlaceHolder:e.searchPlaceholder||e.placeholder,prevProps:{},isHovering:!1,checkedKeys:new Set([]),halfCheckedKeys:new Set([]),resolvedCheckedKeys:new Set([]),loadedKeys:new Set,loadingKeys:new Set,loading:!1,showInput:!1},this.options={},this.isEmpty=!1,this.mergeType=ki(e.autoMergeValue,e.leafOnly),this.inputRef=p.createRef(),this.triggerRef=p.createRef(),this.optionsRef=p.createRef(),this.optionContainerEl=p.createRef(),this.clickOutsideHandler=null,this.foundation=new sc(this.adapter),this.loadingKeysRef=p.createRef(),this.loadedKeysRef=p.createRef()}get adapter(){var e=this;const t={updateInputValue:s=>{this.setState({inputValue:s})},updateInputPlaceHolder:s=>{this.setState({inputPlaceHolder:s})},focusInput:()=>{const{preventScroll:s}=this.props;this.inputRef&&this.inputRef.current&&this.inputRef.current.focus({preventScroll:s})},blurInput:()=>{this.inputRef&&this.inputRef.current&&this.inputRef.current.blur()}},n={registerClickOutsideHandler:s=>{const i=a=>{const o=this.triggerRef&&this.triggerRef.current,l=this.optionContainerEl&&this.optionContainerEl.current,d=a.target,u=a.composedPath&&a.composedPath()||[d];l&&(!l.contains(d)||!l.contains(d.parentNode))&&o&&!o.contains(d)&&!(u.includes(o)||u.includes(l))&&s(a)};this.clickOutsideHandler=i,document.addEventListener("mousedown",i,!1)},unregisterClickOutsideHandler:()=>{document.removeEventListener("mousedown",this.clickOutsideHandler,!1)},rePositionDropdown:()=>{let{rePosKey:s}=this.state;s=s+1,this.setState({rePosKey:s})}};return Object.assign(Object.assign(Object.assign(Object.assign({},super.adapter),t),n),{setEmptyContentMinWidth:s=>{this.setState({emptyContentMinWidth:s})},getTriggerWidth:()=>{const s=this.triggerRef.current;return s&&s.getBoundingClientRect().width},updateStates:s=>{this.setState(Object.assign({},s))},openMenu:()=>{this.setState({isOpen:!0})},closeMenu:s=>{this.setState({isOpen:!1},()=>{s&&s()})},updateSelection:s=>this.setState({selectedKeys:s}),notifyChange:s=>{this.props.onChange&&this.props.onChange(s)},notifySelect:s=>{this.props.onSelect&&this.props.onSelect(s)},notifyOnSearch:s=>{this.props.onSearch&&this.props.onSearch(s)},notifyFocus:function(){e.props.onFocus&&e.props.onFocus(...arguments)},notifyBlur:function(){e.props.onBlur&&e.props.onBlur(...arguments)},notifyDropdownVisibleChange:s=>{this.props.onDropdownVisibleChange(s)},toggleHovering:s=>{this.setState({isHovering:s})},notifyLoadData:(s,i)=>{const{loadData:a}=this.props;a&&new Promise(o=>{a(s).then(()=>{setTimeout(()=>{i(),this.setState({loading:!1}),o()})})})},notifyOnLoad:(s,i)=>{const{onLoad:a}=this.props;a&&a(s,i)},notifyListScroll:(s,i)=>{let{panelIndex:a,activeNode:o}=i;this.props.onListScroll(s,{panelIndex:a,activeNode:o})},notifyOnExceed:s=>this.props.onExceed(s),notifyClear:()=>this.props.onClear(),toggleInputShow:(s,i)=>{this.setState({showInput:s},()=>{i()})},updateFocusState:s=>{this.setState({isFocus:s})},updateLoadingKeyRefValue:s=>{this.loadingKeysRef.current=s},getLoadingKeyRefValue:()=>this.loadingKeysRef.current,updateLoadedKeyRefValue:s=>{this.loadedKeysRef.current=s},getLoadedKeyRefValue:()=>this.loadedKeysRef.current})}static getDerivedStateFromProps(e,t){const{multiple:n,value:s,defaultValue:i,onChangeWithObject:a,leafOnly:o,autoMergeValue:l,checkRelation:d,searchPlaceholder:u,placeholder:h,keyMaps:f}=e,{prevProps:g}=t;let b=t.keyEntities||{};const m={},v=u||h;v!==t.inputPlaceHolder&&(m.inputPlaceHolder=v);const y=S=>{const x=Me(g)&&S in e,_=g&&!pt(g[S],e[S]);return x||_},w=()=>{const S=!g&&"treeData"in e,x=g&&g.treeData!==e.treeData;return S||x},E=(S,x)=>{let _=[];Array.isArray(S)?_=Array.isArray(S[0])?S:[S]:S!==void 0&&(_=[[S]]);const P=[];return _.forEach(O=>{const F=a&&zn(O[0])?Aa(O,f):O;F.length>0&&P.push(F)}),P.reduce((O,F)=>{const D=Ts(F);return x[D]&&O.push(D),O},[])};if(n){const S=y("treeData")||w()||y("keyMaps"),x=y("value")||Me(g)&&i;if(S||x){S&&(m.treeData=e.treeData,b=ka(e.treeData,f),m.keyEntities=b);let _=t.checkedKeys;if(x){const P=y("value")?s:i;_=E(P,b)}else S&&"value"in e&&(_=E(s,b));if(jo(_)&&(_=[..._]),d===ge.RELATED){const P=$s(_,b),I=new Set(P.checkedKeys),O=new Set(P.halfCheckedKeys);e.disableStrictly&&(m.disabledKeys=_a(b,f));const F=ki(l,o)===ge.LEAF_ONLY_MERGE_TYPE;m.checkedKeys=I,m.halfCheckedKeys=O,m.resolvedCheckedKeys=new Set(Ct(I,b,F))}else m.checkedKeys=new Set(_);m.prevProps=e}}return m}componentDidMount(){this.foundation.init()}componentWillUnmount(){this.foundation.destroy()}componentDidUpdate(e){const t=!pt(e.treeData,this.props.treeData),n=!pt(e.keyMaps,this.props.keyMaps);if(this.props.multiple){(t||n)&&this.foundation.recalculateFilteredKeys();return}let s=!1;(t||n)&&(s=!0,this.foundation.collectOptions()),e.value!==this.props.value&&!s&&this.foundation.handleValueChange(this.props.value)}renderTagInput(){const{size:e,disabled:t,placeholder:n,maxTagCount:s,showRestTagsPopover:i,restTagsPopoverProps:a,checkRelation:o}=this.props,{inputValue:l,checkedKeys:d,keyEntities:u,resolvedCheckedKeys:h,inputPlaceHolder:f}=this.state,g=T(`${Z}-tagInput-wrapper`),b=this.mergeType===ge.NONE_MERGE_TYPE||o===ge.UN_RELATED?d:h;return p.createElement(os,{className:g,ref:this.inputRef,disabled:t,size:e,value:[...b],showRestTagsPopover:i,restTagsPopoverProps:a,maxTagCount:s,renderTagItem:this.renderTagItem,inputValue:l,onInputChange:this.handleInputChange,onRemove:this.onRemoveInTagInput,placeholder:f,expandRestTagsOnClick:!1})}renderInput(){const{size:e,disabled:t}=this.props,n=T(`${Z}-input`),{inputValue:s,inputPlaceHolder:i,showInput:a}=this.state,o={disabled:t,value:s,className:n,onChange:this.handleInputChange},l=T({[`${Z}-search-wrapper`]:!0,[`${Z}-search-wrapper-${e}`]:e!=="default"}),d=this.renderDisplayText(),u=T({[`${Z}-selection-placeholder`]:!d,[`${Z}-selection-text-hide`]:a&&s,[`${Z}-selection-text-inactive`]:a&&!s});return p.createElement("div",{className:l},p.createElement("span",{className:u},d||i),a&&p.createElement(Qt,Object.assign({ref:this.inputRef,size:e},o)))}close(){this.foundation.close()}open(){this.foundation.open()}focus(){this.foundation.focus()}blur(){this.foundation.blur()}render(){const{zIndex:e,getPopupContainer:t,autoAdjustOverflow:n,stopPropagation:s,mouseLeaveDelay:i,mouseEnterDelay:a,position:o,motion:l,dropdownMargin:d}=this.props,{isOpen:u,rePosKey:h}=this.state,{direction:f}=this.context,g=this.renderContent(),b=this.renderSelection(),m=o??(f==="rtl"?"bottomRight":"bottomLeft");return p.createElement(Cn,{getPopupContainer:t,zIndex:e,motion:l,margin:d,ref:this.optionsRef,content:g,visible:u,trigger:"custom",rePosKey:h,position:m,autoAdjustOverflow:n,stopPropagation:s,mouseLeaveDelay:i,mouseEnterDelay:a,afterClose:()=>this.foundation.updateSearching(!1)},b)}}En.__SemiComponentName__="Cascader";En.contextType=en;En.propTypes={"aria-labelledby":c.string,"aria-invalid":c.bool,"aria-errormessage":c.string,"aria-describedby":c.string,"aria-required":c.bool,"aria-label":c.string,arrowIcon:c.node,borderless:c.bool,clearIcon:c.node,changeOnSelect:c.bool,defaultValue:c.oneOfType([c.string,c.array]),disabled:c.bool,dropdownClassName:c.string,dropdownStyle:c.object,dropdownMargin:c.oneOfType([c.number,c.object]),emptyContent:c.node,motion:c.bool,filterTreeNode:c.oneOfType([c.func,c.bool]),filterLeafOnly:c.bool,placeholder:c.string,searchPlaceholder:c.string,size:c.oneOf(ge.SIZE_SET),style:c.object,className:c.string,treeData:c.arrayOf(c.shape({value:c.oneOfType([c.string,c.number]),label:c.any})),treeNodeFilterProp:c.string,suffix:c.node,prefix:c.node,insetLabel:c.node,insetLabelId:c.string,id:c.string,displayProp:c.string,displayRender:c.func,onChange:c.func,onSearch:c.func,onSelect:c.func,onBlur:c.func,onFocus:c.func,children:c.node,getPopupContainer:c.func,zIndex:c.number,value:c.oneOfType([c.string,c.number,c.array]),validateStatus:c.oneOf(ge.VALIDATE_STATUS),showNext:c.oneOf([ge.SHOW_NEXT_BY_CLICK,ge.SHOW_NEXT_BY_HOVER]),stopPropagation:c.oneOfType([c.bool,c.string]),showClear:c.bool,defaultOpen:c.bool,autoAdjustOverflow:c.bool,onDropdownVisibleChange:c.func,triggerRender:c.func,onListScroll:c.func,onChangeWithObject:c.bool,bottomSlot:c.node,topSlot:c.node,multiple:c.bool,autoMergeValue:c.bool,maxTagCount:c.number,showRestTagsPopover:c.bool,restTagsPopoverProps:c.object,max:c.number,separator:c.string,onExceed:c.func,onClear:c.func,loadData:c.func,onLoad:c.func,loadedKeys:c.array,disableStrictly:c.bool,leafOnly:c.bool,enableLeafClick:c.bool,clickToSelect:c.bool,preventScroll:c.bool,position:c.string,searchPosition:c.string,remote:c.bool,keyMaps:c.object};En.defaultProps=kt(En.__SemiComponentName__,{borderless:!1,leafOnly:!1,arrowIcon:p.createElement(ba,null),stopPropagation:!0,motion:!0,defaultOpen:!1,zIndex:Ls.DEFAULT_Z_INDEX,showClear:!1,autoClearSearchValue:!0,changeOnSelect:!1,disableStrictly:!1,autoMergeValue:!0,multiple:!1,filterTreeNode:!1,filterLeafOnly:!0,showRestTagsPopover:!1,restTagsPopoverProps:{},separator:" / ",size:"default",treeNodeFilterProp:"label",displayProp:"label",treeData:[],showNext:ge.SHOW_NEXT_BY_CLICK,onExceed:M,onClear:M,onDropdownVisibleChange:M,onListScroll:M,enableLeafClick:!1,clickToSelect:!1,"aria-label":"Cascader",searchPosition:ge.SEARCH_POSITION_TRIGGER,checkRelation:ge.RELATED,remote:!1});const ho={PREFIX:`${be}-descriptions`},hi={ALIGN_SET:["left","justify","plain","center"],SIZE_SET:["small","medium","large"],LAYOUT_SET:["horizontal","vertical"]},er=p.createContext(null);var lu=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const Yt=ho.PREFIX,Br=`${Yt}-key`,Ur=`${Yt}-value`;let Zn=class extends C.PureComponent{render(){const e=this.props,{itemKey:t,hidden:n,className:s,span:i,style:a,children:o,keyStyle:l}=e,d=lu(e,["itemKey","hidden","className","span","style","children","keyStyle"]),{align:u,layout:h}=this.context;if(n)return null;const f=p.createElement("td",{className:`${Yt}-item`,colSpan:i||1},p.createElement("span",{className:Br,style:l},t,":"),p.createElement("span",{className:Ur},typeof o=="function"?o():o)),g=p.createElement(p.Fragment,null,p.createElement("th",{className:`${Yt}-item ${Yt}-item-th`},p.createElement("span",{className:Br,style:l},t)),p.createElement("td",{className:`${Yt}-item ${Yt}-item-td`,colSpan:i?i*2-1:1},p.createElement("span",{className:Ur},typeof o=="function"?o():o))),b=u==="plain"?p.createElement("tr",Object.assign({className:s,style:a},_i(d)),f):p.createElement("tr",Object.assign({className:s,style:a},_i(d)),g);return h==="horizontal"?u==="plain"?f:g:b}};Zn.propTypes={itemKey:c.node,hidden:c.bool,className:c.string,style:c.object,keyStyle:c.object};Zn.contextType=er;class cu extends Ye{constructor(e){super(Object.assign({},e))}getHorizontalList(){const{column:e,data:t,children:n}=this.getProps(),i=this._adapter.getColumns().filter(l=>!l.hidden),a=[],o={totalSpan:0,itemList:[]};for(const l of i)o.totalSpan+=l.span||1,o.itemList.push(l),o.totalSpan>=e&&(a.push(o.itemList),o.itemList=[],o.totalSpan=0);if(o.itemList.length!=0){const l=o.itemList[o.itemList.length-1];if(isNaN(l.span)){let d=0;o.itemList.forEach(u=>d+=isNaN(u.span)?1:u.span),d<e&&(l.span=e-d+1)}a.push(o.itemList)}return a}}var du=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const cn=ho.PREFIX;class ls extends Be{constructor(e){super(e),this.renderChildrenList=()=>{const t=this.props,{layout:n,data:s,children:i}=t;return n==="horizontal"?this.foundation.getHorizontalList().map((o,l)=>p.createElement("tr",{key:l},o.map((d,u)=>Pi(d)?p.createElement(Zn,Object.assign({itemKey:d.key},d,{key:l+"-"+u}),d.value):null))):s&&s.length?s.map((a,o)=>Pi(a)?p.createElement(Zn,Object.assign({itemKey:a.key},a,{key:o}),a.value):null):i},this.foundation=new cu(this.adapter)}get adapter(){return Object.assign(Object.assign({},super.adapter),{getColumns:()=>{var e,t;return!((e=this.props.data)===null||e===void 0)&&e.length?this.props.data:this.props.children?(t=p.Children.toArray(this.props.children))===null||t===void 0?void 0:t.map(n=>C.isValidElement(n)?Object.assign({value:n.props.children},n.props):[]):[]}})}render(){const e=this.props,{align:t,row:n,size:s,className:i,style:a,children:o,data:l,layout:d}=e,u=du(e,["align","row","size","className","style","children","data","layout"]),h=T(cn,i,{[`${cn}-${t}`]:!n,[`${cn}-double`]:n,[`${cn}-double-${s}`]:n,[`${cn}-horizontal`]:d==="horizontal",[`${cn}-vertical`]:d==="vertical"});return p.createElement("div",Object.assign({className:h,style:a},_i(u)),p.createElement("table",null,p.createElement("tbody",null,p.createElement(er.Provider,{value:{align:t,layout:d}},this.renderChildrenList()))))}}ls.Item=Zn;ls.contextType=er;ls.propTypes={align:c.oneOf(hi.ALIGN_SET),row:c.bool,size:c.oneOf(hi.SIZE_SET),style:c.object,className:c.string,data:c.arrayOf(c.shape({key:c.node,value:c.oneOfType([c.node,c.func]),hidden:c.bool,className:c.string,style:c.object,span:c.number,keyStyle:c.object})),layout:c.oneOf(hi.LAYOUT_SET),column:c.number};ls.defaultProps={align:"center",row:!1,size:"medium",data:[],layout:"vertical",column:3};const po={PREFIX:`${be}`};var uu=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const zr=["xxl","xl","lg","md","sm","xs"],fo=p.createContext(null),Wr={xs:"(max-width: 575px)",sm:"(min-width: 576px)",md:"(min-width: 768px)",lg:"(min-width: 992px)",xl:"(min-width: 1200px)",xxl:"(min-width: 1600px)"};class Ws extends p.Component{constructor(){super(...arguments),this.state={screens:{xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}},this.unRegisters=[]}componentDidMount(){this.unRegisters=Object.keys(Wr).map(e=>Vo(Wr[e],{match:()=>{typeof this.props.gutter=="object"&&this.setState(t=>({screens:Object.assign(Object.assign({},t.screens),{[e]:!0})}))},unmatch:()=>{typeof this.props.gutter=="object"&&this.setState(t=>({screens:Object.assign(Object.assign({},t.screens),{[e]:!1})}))}}))}componentWillUnmount(){this.unRegisters.forEach(e=>e())}getGutter(){const{gutter:e=0}=this.props,t=[0,0];return(Array.isArray(e)?e.slice(0,2):[e,0]).forEach((s,i)=>{if(typeof s=="object")for(let a=0;a<zr.length;a++){const o=zr[a];if(this.state.screens[o]&&s[o]!==void 0){t[i]=s[o];break}}else t[i]=s||0}),t}render(){const e=this.props,{prefixCls:t,type:n,justify:s,align:i,className:a,style:o,children:l}=e,d=uu(e,["prefixCls","type","justify","align","className","style","children"]),u=this.getGutter(),h=`${t}-row`,f=T({[h]:n!=="flex",[`${h}-${n}`]:n,[`${h}-${n}-${s}`]:n&&s,[`${h}-${n}-${i}`]:n&&i},a),g=Object.assign(Object.assign(Object.assign({},u[0]>0?{marginLeft:u[0]/-2,marginRight:u[0]/-2}:{}),u[1]>0?{marginTop:u[1]/-2,marginBottom:u[1]/-2}:{}),o),b=Object.assign({},d);return delete b.gutter,p.createElement(fo.Provider,{value:{gutters:u}},p.createElement("div",Object.assign({},b,{className:f,style:g,"x-semi-prop":"children"}),l))}}Ws.propTypes={type:c.oneOf(["flex"]),align:c.oneOf(["top","middle","bottom"]),justify:c.oneOf(["start","end","center","space-around","space-between"]),className:c.string,style:c.object,children:c.node,gutter:c.oneOfType([c.object,c.number,c.array]),prefixCls:c.string};Ws.defaultProps={prefixCls:po.PREFIX};Ws.RowContext={gutters:c.any};var hu=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const dn=c.oneOfType([c.object,c.number]);class nt extends p.Component{render(){const{props:e}=this,{prefixCls:t,span:n,order:s,offset:i,push:a,pull:o,className:l,children:d}=e,u=hu(e,["prefixCls","span","order","offset","push","pull","className","children"]);let h={};const f=`${t}-col`;["xs","sm","md","lg","xl","xxl"].forEach(v=>{let y={};typeof e[v]=="number"?y.span=e[v]:typeof e[v]=="object"&&(y=e[v]||{}),delete u[v],h=Object.assign(Object.assign({},h),{[`${f}-${v}-${y.span}`]:y.span!==void 0,[`${f}-${v}-order-${y.order}`]:y.order||y.order===0,[`${f}-${v}-offset-${y.offset}`]:y.offset||y.offset===0,[`${f}-${v}-push-${y.push}`]:y.push||y.push===0,[`${f}-${v}-pull-${y.pull}`]:y.pull||y.pull===0})});const g=T(f,{[`${f}-${n}`]:n!==void 0,[`${f}-order-${s}`]:s,[`${f}-offset-${i}`]:i,[`${f}-push-${a}`]:a,[`${f}-pull-${o}`]:o},l,h);let{style:b}=u,m;try{m=this.context.gutters}catch{throw new Error("please make sure <Col> inside <Row>")}return b=Object.assign(Object.assign(Object.assign({},m[0]>0?{paddingLeft:m[0]/2,paddingRight:m[0]/2}:{}),m[1]>0?{paddingTop:m[1]/2,paddingBottom:m[1]/2}:{}),b),p.createElement("div",Object.assign({},u,{style:b,className:g,"x-semi-prop":"children"}),d)}}nt.contextType=fo;nt.propTypes={span:c.number,order:c.number,offset:c.number,push:c.number,pull:c.number,className:c.string,children:c.node,xs:dn,sm:dn,md:dn,lg:dn,xl:dn,xxl:dn,prefixCls:c.string};nt.defaultProps={prefixCls:po.PREFIX};const St={PREFIX:`${be}-form`},$n={LAYOUT:["horizontal","vertical"],LABEL_POS:["left","top","inset"],LABEL_ALIGN:["left","right"],EXTRA_POS:["middle","bottom"],DEFAULT_TRIGGER:"change"},Dt=St.PREFIX;class It extends C.PureComponent{render(){const{children:e,required:t,text:n,disabled:s,name:i,width:a,align:o,style:l,className:d,extra:u,id:h,optional:f}=this.props,g=T(d,{[`${Dt}-field-label`]:!0,[`${Dt}-field-label-left`]:o==="left",[`${Dt}-field-label-right`]:o==="right",[`${Dt}-field-label-required`]:t,[`${Dt}-field-label-disabled`]:s,[`${Dt}-field-label-with-extra`]:u}),b=l||{};a&&(b.width=a);const m=p.createElement(ut,{componentName:"Form"},w=>p.createElement("span",{className:`${Dt}-field-label-optional-text`},w.optional)),v=p.createElement("div",{className:`${Dt}-field-label-text`,"x-semi-prop":"label"},typeof n<"u"?n:e,f?m:null),y=p.createElement(p.Fragment,null,v,p.createElement("div",{className:`${Dt}-field-label-extra`},u));return p.createElement("label",{className:g,htmlFor:i,style:b,id:h},u?y:v)}}It.defaultProps={required:!1,name:"",align:"left",className:"",optional:!1};It.propTypes={id:c.string,children:c.node,required:c.bool,text:c.node,disabled:c.bool,name:c.string,align:c.string,width:c.oneOfType([c.number,c.string]),style:c.object,className:c.string,extra:c.node,optional:c.bool};var Xr=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const Wt=Ko.PREFIX,pu=Ho.SIZE;class tr extends Be{renderGroupWithLabel(e){const t=this.props,{size:n,className:s,label:i,labelPosition:a}=t;Xr(t,["size","className","label","labelPosition"]);const o=T({[`${Wt}-group-wrapper`]:!0,[`${Wt}-group-wrapper-with-top-label`]:a==="top",[`${Wt}-group-wrapper-with-left-label`]:a==="left"}),l=T(`${Wt}-group`,s,{[`${Wt}-${n}`]:n!=="default"}),d="input-group";return p.createElement("div",{className:o},i&&i.text?p.createElement(It,Object.assign({name:d},i)):null,p.createElement("span",{role:"group","aria-disabled":this.props.disabled,id:i&&i.name||d,className:l,style:this.props.style,onFocus:this.props.onFocus,onBlur:this.props.onBlur},e))}render(){const e=this.props,{size:t,style:n,className:s,children:i,label:a,onBlur:o,onFocus:l,disabled:d}=e,u=Xr(e,["size","style","className","children","label","onBlur","onFocus","disabled"]),h=T(`${Wt}-group`,{[`${Wt}-${t}`]:t!=="default"},s);let f;return i&&(f=(Array.isArray(i)?i:[i]).map((g,b)=>{if(g){const{onBlur:m,onFocus:v,disabled:y}=g.props,w=Le(m)&&se(m,"name")!=="noop"?m:o,E=Le(v)&&se(v,"name")!=="noop"?v:l,S=typeof y=="boolean"?y:d;return p.cloneElement(g,Object.assign(Object.assign({key:b},u),{size:t,onBlur:w,onFocus:E,disabled:S}))}return null})),a&&a.text?this.renderGroupWithLabel(f):p.createElement("span",{role:"group","aria-label":"Input group","aria-disabled":this.props.disabled,className:h,style:n,onFocus:this.props.onFocus,onBlur:this.props.onBlur},f)}}tr.propTypes={className:c.string,children:c.node,size:c.oneOf(pu),style:c.object,onBlur:c.func,onFocus:c.func,label:c.object,labelPosition:c.string};tr.defaultProps={size:"default",className:"",onBlur:ct,onFocus:ct};const Os={PREFIX:`${be}-rating`},go={SIZE_SET:["default","small"]};class nr extends Ye{constructor(e){super(Object.assign(Object.assign({},nr.defaultAdapter),e)),this.handleStarFocusVisible=t=>{const{target:n}=t,{count:s}=this.getProps();try{n.matches(":focus-visible")&&this._adapter.setEmptyStarFocusVisible(!0)}catch{ht(!0,"Warning: [Semi Rating] The current browser does not support the focus-visible")}},this.handleStarBlur=t=>{const{emptyStarFocusVisible:n}=this.getStates();n&&this._adapter.setEmptyStarFocusVisible(!1)}}init(){const{autoFocus:e,disabled:t}=this.getProps();e&&!t&&this._adapter.focus()}_getScroll(e,t){let n=t?e.pageYOffset:e.pageXOffset;const s=t?"scrollTop":"scrollLeft";if(typeof n!="number"){const i=e.document;n=i.documentElement[s],typeof n!="number"&&(n=i.body[s])}return n}_getClientPosition(e){let t,n;const s=e.ownerDocument,{body:i}=s,a=s&&s.documentElement,o=e.getBoundingClientRect();return t=o.left,n=o.top,t-=a.clientLeft||i.clientLeft||0,n-=a.clientTop||i.clientTop||0,{left:t,top:n}}_getOffsetLeft(e){const t=this._getClientPosition(e),n=e.ownerDocument,s=n.defaultView||n.parentWindow;return t.left+=this._getScroll(s),t.left}getStarValue(e,t){const{allowHalf:n}=this.getProps(),i=this._adapter.getContext("direction")==="rtl";let a=e+1;if(n){const o=this._adapter.getStarDOM(e),l=this._getOffsetLeft(o),d=o.clientWidth;(i&&t-l>d/2||!i&&t-l<d/2)&&(a-=.5)}return a}handleHover(e,t){const n=this.getStarValue(t,e.pageX),{clearedValue:s,hoverValue:i}=this.getStates();n!==i&&n!==s&&this._adapter.notifyHoverChange(n,null)}handleMouseLeave(){this._adapter.notifyHoverChange(void 0,null)}handleClick(e,t){const{allowClear:n}=this.getProps(),{value:s}=this.getStates(),i=this.getStarValue(t,e.pageX),a=n?i===s:!1;this._adapter.updateValue(a?0:i),a?this._adapter.notifyHoverChange(void 0,i):this._adapter.clearValue(null)}handleFocus(e){this._adapter.notifyFocus(e)}handleBlur(e){this._adapter.notifyBlur(e)}handleKeyDown(e,t){const{key:n}=e,{count:s,allowHalf:i}=this.getProps(),o=this._adapter.getContext("direction")==="rtl",l=i?.5:1;let d,u;n==="ArrowRight"||n==="ArrowUp"?d=t+(o?-l:l):(n==="ArrowLeft"||n==="ArrowDown")&&(d=t+(o?l:-l)),d>s?u=0:d<0?u=s:u=d,["ArrowRight","ArrowUp","ArrowLeft","ArrowDown"].includes(n)&&(this._adapter.notifyKeyDown(e),this._adapter.updateValue(u),this.changeFocusStar(u,e),e.preventDefault(),this._adapter.notifyHoverChange(void 0,null))}changeFocusStar(e,t){const{count:n,allowHalf:s,preventScroll:i,tooltips:a}=this.getProps(),o=Math.ceil(e)-1,l=[...t.currentTarget.childNodes].map(d=>a?d.childNodes[0].childNodes[0].childNodes:d.childNodes[0].childNodes);o<0?l[n][0].focus({preventScroll:i}):l[o][s?e*10%10===5?0:1:0].focus({preventScroll:i})}}class sr extends Ye{constructor(e){super(Object.assign(Object.assign({},sr.defaultAdapter),e)),this.handleFocusVisible=(t,n)=>{const{target:s}=t;try{s.matches(":focus-visible")&&(n==="first"?this._adapter.setFirstStarFocus(!0):this._adapter.setSecondStarFocus(!0))}catch{ht(!0,"Warning: [Semi Rating] The current browser does not support the focus-visible")}},this.handleBlur=(t,n)=>{const{firstStarFocus:s,secondStarFocus:i}=this.getStates();n==="first"?s&&this._adapter.setFirstStarFocus(!1):i&&this._adapter.setSecondStarFocus(!1)}}}class mo extends Be{constructor(e){super(e),this.getDomNode=()=>this.liRef&&this.liRef.current,this.firstStar=null,this.secondStar=null,this.onHover=t=>{const{onHover:n,index:s}=this.props;n(t,s)},this.onClick=t=>{const{onClick:n,index:s}=this.props;n(t,s)},this.onFocus=(t,n)=>{const{onFocus:s}=this.props;s&&s(t),this.foundation.handleFocusVisible(t,n)},this.onBlur=(t,n)=>{const{onBlur:s}=this.props;s&&s(t),this.foundation.handleBlur(t,n)},this.onKeyDown=t=>{const{onClick:n,index:s}=this.props;t.keyCode===13&&n(t,s)},this.starFocus=()=>{const{value:t,index:n,preventScroll:s}=this.props;t-n===.5?this.firstStar.focus({preventScroll:s}):this.secondStar.focus({preventScroll:s})},this.saveFirstStar=t=>{this.firstStar=t},this.saveSecondStar=t=>{this.secondStar=t},this.liRef=p.createRef(),this.state={firstStarFocus:!1,secondStarFocus:!1},this.foundation=new sr(this.adapter)}get adapter(){return Object.assign(Object.assign({},super.adapter),{setFirstStarFocus:e=>{this.setState({firstStarFocus:e})},setSecondStarFocus:e=>{this.setState({secondStarFocus:e})}})}render(){const{index:e,prefixCls:t,character:n,count:s,value:i,disabled:a,allowHalf:o,focused:l,size:d,ariaLabelPrefix:u}=this.props,{firstStarFocus:h,secondStarFocus:f}=this.state,g=e+1,b=g-i,m=o&&b<1&&b>0,v=1-b,y=g<=i,w=typeof d=="number",E=T(t,{[`${t}-half`]:m,[`${t}-full`]:y,[`${t}-${d}`]:!w}),S=w?{width:d,height:d,fontSize:d}:{},x=w?"inherit":d==="small"?"default":"extra-large",_=n||p.createElement(Rl,{size:x,style:{display:"block"}}),P=e===s,I=T(`${t}-wrapper`,{[`${t}-disabled`]:a,[`${Os.PREFIX}-focus`]:(h||f)&&i!==0}),O={onClick:a?null:this.onClick,onKeyDown:a?null:this.onKeyDown,onMouseMove:a?null:this.onHover,className:I},F=o?s*2+1:s+1,D={ref:this.saveFirstStar,role:"radio","aria-checked":i===e+.5,"aria-posinset":2*e+1,"aria-setsize":F,"aria-disabled":a,"aria-label":`${e+.5} ${u}s`,"aria-labelledby":this.props["aria-describedby"],"aria-describedby":this.props["aria-describedby"],className:T(`${t}-first`,`${Os.PREFIX}-no-focus`),tabIndex:!a&&i===e+.5?0:-1,onFocus:N=>{this.onFocus(N,"first")},onBlur:N=>{this.onBlur(N,"first")}},$=!a&&(i===e+1||P&&i===0)?0:-1,L={ref:this.saveSecondStar,role:"radio","aria-checked":P?i===0:i===e+1,"aria-posinset":o?2*(e+1):e+1,"aria-setsize":F,"aria-disabled":a,"aria-label":`${P?0:e+1} ${u}${e===0?"":"s"}`,"aria-labelledby":this.props["aria-describedby"],"aria-describedby":this.props["aria-describedby"],className:T(`${t}-second`,`${Os.PREFIX}-no-focus`),tabIndex:$,onFocus:N=>{this.onFocus(N,"second")},onBlur:N=>{this.onBlur(N,"second")}};return p.createElement("li",{className:E,style:Object.assign({},S),key:e,ref:this.liRef},p.createElement("div",Object.assign({},O),o&&!P&&p.createElement("div",Object.assign({},D,{style:{width:`${v*100}%`}}),_),p.createElement("div",Object.assign({},L,{"x-semi-prop":"character"}),_)))}}mo.propTypes={value:c.number,index:c.number,prefixCls:c.string,allowHalf:c.bool,onHover:c.func,onClick:c.func,character:c.node,focused:c.bool,disabled:c.bool,count:c.number,ariaLabelPrefix:c.string,size:c.oneOfType([c.oneOf(go.SIZE_SET),c.number]),"aria-describedby":c.string,onFocus:c.func,onBlur:c.func,preventScroll:c.bool};var fu=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};class Xs extends Be{constructor(e){super(e),this.rate=null,this.onHover=(n,s)=>{this.foundation.handleHover(n,s)},this.onMouseLeave=()=>{this.foundation.handleMouseLeave()},this.onClick=(n,s)=>{this.foundation.handleClick(n,s)},this.onFocus=n=>{this.foundation.handleFocus(n)},this.onBlur=n=>{this.foundation.handleBlur(n)},this.onKeyDown=n=>{const{value:s}=this.state;this.foundation.handleKeyDown(n,s)},this.focus=()=>{const{disabled:n,preventScroll:s}=this.props;n||this.rate.focus({preventScroll:s})},this.blur=()=>{const{disabled:n}=this.props;n||this.rate.blur()},this.saveRef=n=>s=>{this.stars[n]=s},this.saveRate=n=>{this.rate=n},this.handleStarFocusVisible=n=>{this.foundation.handleStarFocusVisible(n)},this.handleStarBlur=n=>{this.foundation.handleStarBlur(n)},this.getAriaLabelPrefix=()=>{if(this.props["aria-label"])return this.props["aria-label"];let n="star";const{character:s}=this.props;return typeof s=="string"&&(n=s),n},this.getItemList=n=>{const{count:s,allowHalf:i,prefixCls:a,disabled:o,character:l,size:d,tooltips:u}=this.props,{value:h,hoverValue:f,focused:g}=this.state;return[...Array(s+1).keys()].map(m=>{const v=p.createElement(mo,{ref:this.saveRef(m),index:m,count:s,prefixCls:`${a}-star`,allowHalf:i,value:f===void 0?h:f,onClick:o?ct:this.onClick,onHover:o?ct:this.onHover,key:m,disabled:o,character:l,focused:g,size:m===s?0:d,ariaLabelPrefix:n,onFocus:o||s!==m?ct:this.handleStarFocusVisible,onBlur:o||s!==m?ct:this.handleStarBlur});if(u){const y=u[m]?u[m]:"",w=f-1===m;return p.createElement(Ot,{visible:w,trigger:"custom",content:y,key:`${m}-${w}`},p.createElement("span",{className:`${a}-star-outer`},v))}return v})};const t=e.value===void 0?e.defaultValue:e.value;this.stars={},this.state={value:t,focused:!1,hoverValue:void 0,clearedValue:null,emptyStarFocusVisible:!1},this.foundation=new nr(this.adapter)}static getDerivedStateFromProps(e,t){return"value"in e&&e.value!==void 0?Object.assign(Object.assign({},t),{value:e.value}):t}get adapter(){return Object.assign(Object.assign({},super.adapter),{focus:()=>{const{disabled:e,count:t}=this.props,{value:n}=this.state;if(!e){const s=Math.ceil(n)-1;this.stars[s<0?t:s].starFocus()}},getStarDOM:e=>(this.stars&&this.stars[e]).getDomNode(),notifyHoverChange:(e,t)=>{const{onHoverChange:n}=this.props;this.setState({hoverValue:e,clearedValue:t}),n(e)},updateValue:e=>{const{onChange:t}=this.props;"value"in this.props||this.setState({value:e}),t(e)},clearValue:e=>{this.setState({clearedValue:e})},notifyFocus:e=>{const{onFocus:t}=this.props;this.setState({focused:!0}),t&&t(e)},notifyBlur:e=>{const{onBlur:t}=this.props;this.setState({focused:!1}),t&&t(e)},notifyKeyDown:e=>{const{onKeyDown:t}=this.props;this.setState({focused:!1}),t&&t(e)},setEmptyStarFocusVisible:e=>{this.setState({emptyStarFocusVisible:e})}})}componentDidMount(){this.foundation.init()}componentWillUnmount(){this.foundation.destroy()}render(){const e=this.props,{style:t,prefixCls:n,disabled:s,className:i,id:a,count:o,tabIndex:l}=e,d=fu(e,["style","prefixCls","disabled","className","id","count","tabIndex"]),{value:u,emptyStarFocusVisible:h}=this.state,f=this.getAriaLabelPrefix(),g=`Rating: ${u} of ${o} ${f}${u===1?"":"s"},`,b=this.getItemList(f),m=T(n,{[`${n}-disabled`]:s,[`${n}-focus`]:h},i);return p.createElement("ul",Object.assign({"aria-label":g,"aria-labelledby":this.props["aria-labelledby"],"aria-describedby":this.props["aria-describedby"],className:m,style:t,onMouseLeave:s?ct:this.onMouseLeave,tabIndex:s?-1:l,onFocus:s?ct:this.onFocus,onBlur:s?ct:this.onBlur,onKeyDown:s?ct:this.onKeyDown,ref:this.saveRate,id:a},this.getDataAttr(d)),b)}}Xs.contextType=en;Xs.propTypes={"aria-describedby":c.string,"aria-errormessage":c.string,"aria-invalid":c.bool,"aria-label":c.string,"aria-labelledby":c.string,"aria-required":c.bool,disabled:c.bool,value:c.number,defaultValue:c.number,count:c.number,allowHalf:c.bool,allowClear:c.bool,style:c.object,prefixCls:c.string,onChange:c.func,onHoverChange:c.func,className:c.string,character:c.node,tabIndex:c.number,onFocus:c.func,onBlur:c.func,onKeyDown:c.func,autoFocus:c.bool,size:c.oneOfType([c.oneOf(go.SIZE_SET),c.number]),tooltips:c.arrayOf(c.string),id:c.string,preventScroll:c.bool};Xs.defaultProps={defaultValue:0,count:5,allowHalf:!1,allowClear:!0,style:{},prefixCls:Os.PREFIX,onChange:ct,onHoverChange:ct,tabIndex:-1,size:"default"};const Ve={PREFIX:`${be}-slider`,VERTICAL:`${be}-slider-vertical`,TRACK:`${be}-slider-track`,DOTS:`${be}-slider-dots`,MARKS:`${be}-slider-marks`,HANDLE:`${be}-slider-handle`,HANDLE_DOT:`${be}-slider-handle-dot`},Gr=(r,e)=>(!globalThis.Touch||!(r instanceof Touch)||["stopPropagation","preventDefault"].forEach(n=>{let s=e[n];s&&(typeof s=="function"&&(s=function(){return e[n](...arguments)}),r[n]?ht(!0,`"The key ${n}" exist in Touch.`):r[n]=s)}),r);class ir extends Ye{constructor(e){var t;super(Object.assign(Object.assign({},ir.defaultAdapter),e)),t=this,this.getMinAndMaxPercent=n=>{const{range:s,min:i,max:a}=this._adapter.getProps(),o=s?(n[0]-i)/(a-i):(n-i)/(a-i),l=s?(n[1]-i)/(a-i):1;return{min:this._checkValidity(o),max:this._checkValidity(l)}},this._checkValidity=function(n){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;return n>i?i:n<s?s:n},this.computeHandleVisibleVal=(n,s,i)=>{const{focusPos:a,currentValue:o}=this._adapter.getStates(),l={min:!1,max:!1};let d;return s?d={min:s(i?this.outPutValue(o[0]):this.outPutValue(o)),max:i?s(this.outPutValue(o[1])):null}:d={min:i?this.outPutValue(o[0]):this.outPutValue(o),max:i?this.outPutValue(o[1]):null},n?(l.min=!0,l.max=!0):typeof n>"u"&&s&&(a==="min"?l.min=!0:a==="max"&&(l.max=!0)),{tipVisible:l,tipChildren:d}},this.valueFormatIsCorrect=n=>Array.isArray(n)?typeof n[0]=="number"&&typeof n[0]=="number":typeof n=="number",this.handleMousePos=(n,s)=>{const i=this._adapter.getParentRect(),a=i?i.left:0,o=i?i.top:0;return{x:n-a,y:s-o}},this.getScrollParent=n=>{const s=n,i=/(auto|scroll)/,a=(d,u)=>window.getComputedStyle(d,null).getPropertyValue(u),o=d=>i.test(a(d,"overflow")+a(d,"overflow-y")+a(d,"overflow-x")),l=d=>!d||d===document.body||!(d instanceof Element)?document.body:o(d)?d:l(d.parentNode);return l(s)},this.checkMeetMinMax=n=>{const{vertical:s,verticalReverse:i,range:a}=this._adapter.getProps(),l=this._adapter.getContext("direction")==="rtl"&&!s,d=this._adapter.getState("currentValue");this.transValueToPos(d);const{sliderX:u,sliderY:h,sliderWidth:f,sliderHeight:g}=this._adapter.getSliderLengths(),{chooseMovePos:b,isDrag:m}=this._adapter.getStates(),v=s?g:f;let y;s&&i?y=h+v:l?y=u+v:y=s?h:u;let w;return s&&i?w=h:l?w=u:w=s?h+g:u+f,s&&i||l?n>=y?n=y:n<=w&&(n=w):n<=y?n=y:n>=w&&(n=w),n},this.transPosToValue=(n,s)=>{const i=this.checkMeetMinMax(n),{min:a,max:o,currentValue:l}=this._adapter.getStates(),{range:d,vertical:u,step:h,verticalReverse:f}=this._adapter.getProps(),b=this._adapter.getContext("direction")==="rtl"&&!u,{sliderX:m,sliderY:v,sliderWidth:y,sliderHeight:w}=this._adapter.getSliderLengths(),E=u?v:m,S=u?w:y;let x;u&&f||b?x=(E+S-i)/S*(o-a)+a:x=(i-E)/S*(o-a)+a;let _;return d?_=s?l[0]:l[1]:_=l,h!==1&&(x=Math.round(x/h)*h),d&&x!==_?s?[x,l[1]]:[l[0],x]:!d&&x!==_?x:!1},this.transValueToPos=n=>{const{min:s,max:i}=this._adapter.getStates(),{vertical:a,range:o,verticalReverse:l}=this._adapter.getProps(),u=this._adapter.getContext("direction")==="rtl"&&!a,{sliderX:h,sliderY:f,sliderWidth:g,sliderHeight:b}=this._adapter.getSliderLengths(),m=a?f:h,v=a?b:g,y=w=>{const E=(w-s)/(i-s);return a&&l||u?m+v-E*v:m+E*v};return o?[y(n[0]),y(n[1])]:y(n)},this.isMarkActive=n=>{const{min:s,max:i,range:a,included:o}=this._adapter.getProps(),l=this._adapter.getState("currentValue");return typeof(n/1)=="number"&&n>=s&&n<=i?a?(n>l[1]||n<l[0])&&o?"unActive":"active":n<=l&&o?"active":"unActive":!1},this.outPutValue=n=>{const s=o=>{var l,d;return/^\d+(\.\d+)?$/.test(String(o))&&(d=(l=o.toString().split(".")[1])===null||l===void 0?void 0:l.length)!==null&&d!==void 0?d:0},i=this._adapter.getProp("step"),a=(()=>{const o=s(i),l=Math.pow(10,o);return d=>Math.round(d*l)/l})();if(Array.isArray(n)){const o=a(n[0]),l=a(n[1]);return o>l?this.getState("focusPos")==="min"?[l,l]:[o,o]:[o,l]}else return a(n)},this.handleDisabledChange=n=>{this._adapter.updateDisabled(n)},this.checkAndUpdateIsInRenderTreeState=()=>this._adapter.checkAndUpdateIsInRenderTreeState(),this.calculateOutputValue=(n,s)=>{const i=this.transPosToValue(n,s);if(i!==!1)return this.outPutValue(i)},this.handleValueChange=(n,s)=>{const{min:i,max:a}=this._adapter.getStates();let o=null;const l={};this.valueFormatIsCorrect(s)?(Array.isArray(n)&&Array.isArray(s)&&(s=[s[0]<i?i:s[0],s[1]>a?a:s[1]],o=Object.assign(l,{currentValue:s})),typeof n=="number"&&typeof s=="number"&&(s>a?s=a:s=s<i?i:s,o=Object.assign(l,{currentValue:s}))):o=l,o&&this._adapter.transNewPropsToState(o)},this.onHandleDown=(n,s)=>{this._adapter.onHandleDown(n);const i=this._adapter.getState("disabled"),{vertical:a}=this._adapter.getProps(),{dragging:o}=this._adapter.getOverallVars();if(i)return!1;this._adapter.setStateVal("isDrag",!0),this._adapter.setStateVal("chooseMovePos",s),s==="min"?this._adapter.setDragging([!0,o[1]]):this._adapter.setDragging([o[0],!0]);const l=this.handleMousePos(n.clientX,n.clientY);let d=a?l.y:l.x;if(!this._adapter.isEventFromHandle(n))this._dragOffset=0;else{const u=this._getHandleCenterPosition(a,n.target);this._dragOffset=d-u,d=u}return!0},this.onHandleMove=n=>{this._adapter.setEventDefault(n);const{disabled:s,chooseMovePos:i}=this._adapter.getStates(),{vertical:a}=this._adapter.getProps(),{dragging:o}=this._adapter.getOverallVars();if(s)return!1;this.onHandleEnter(i);const l=this.handleMousePos(n.clientX,n.clientY);let d=a?l.y:l.x;if(d=d-this._dragOffset,i==="min"&&o[0]||i==="max"&&o[1]){const u=this.calculateOutputValue(d,i==="min");if(u===void 0)return!1;this._adapter.notifyChange(u),this._adapter.onHandleMove(d,i==="min",void 0,!1,u)}return!0},this.onHandleTouchStart=(n,s)=>{const i=this._adapter.getMinHandleEl(),a=this._adapter.getMaxHandleEl();if(n.target===i||n.target===a){Js(n);const o=Gr(n.touches[0],n);this.onHandleDown(o,s)}},this.onHandleTouchMove=n=>{const s=this._adapter.getMinHandleEl(),i=this._adapter.getMaxHandleEl();if(n.target===s||n.target===i){const a=Gr(n.touches[0],n);this.onHandleMove(a)}},this.onHandleEnter=n=>{const{disabled:s,focusPos:i}=this._adapter.getStates();s||!i&&n!==i&&this._adapter.onHandleEnter(n)},this.onHandleLeave=()=>{const n=this._adapter.getState("disabled"),s=this._adapter.getState("isDrag");!n&&!s&&this._adapter.onHandleLeave()},this.onHandleUp=n=>{this._adapter.onHandleUpBefore(n);const{disabled:s,chooseMovePos:i}=this._adapter.getStates(),{dragging:a}=this._adapter.getOverallVars();return s?!1:(i==="min"?this._adapter.setDragging([!1,a[1]]):this._adapter.setDragging([a[0],!1]),this._adapter.setStateVal("isDrag",!1),this._adapter.onHandleLeave(),this._adapter.onHandleUpAfter(),!0)},this._handleValueDecreaseWithKeyBoard=(n,s)=>{const{min:i,currentValue:a}=this.getStates(),{range:o}=this.getProps();if(s==="min")if(o){let l=a[0]-n;return l=l<i?i:l,[l,a[1]]}else{let l=a-n;return l=l<i?i:l,l}else{let l=a[1]-n;return l=l<a[0]?a[0]:l,[a[0],l]}},this._handleValueIncreaseWithKeyBoard=(n,s)=>{const{max:i,currentValue:a}=this.getStates(),{range:o}=this.getProps();if(s==="min")if(o){let l=a[0]+n;return l=l>a[1]?a[1]:l,[l,a[1]]}else{let l=a+n;return l=l>i?i:l,l}else{let l=a[1]+n;return l=l>i?i:l,[a[0],l]}},this._handleHomeKey=n=>{const{min:s,currentValue:i}=this.getStates(),{range:a}=this.getProps();return n==="min"?a?[s,i[1]]:s:[i[0],i[0]]},this._handleEndKey=n=>{const{max:s,currentValue:i}=this.getStates(),{range:a}=this.getProps();return n==="min"?a?[i[1],i[1]]:s:[i[0],s]},this.handleKeyDown=(n,s)=>{const{min:i,max:a,currentValue:o}=this.getStates(),{step:l,range:d,vertical:u}=this.getProps(),f=this._adapter.getContext("direction")==="rtl"&&!u;let g;switch(n.key){case"ArrowLeft":case"ArrowDown":g=f?this._handleValueIncreaseWithKeyBoard(l,s):this._handleValueDecreaseWithKeyBoard(l,s);break;case"ArrowRight":case"ArrowUp":g=f?this._handleValueDecreaseWithKeyBoard(l,s):this._handleValueIncreaseWithKeyBoard(l,s);break;case"PageUp":g=f?this._handleValueDecreaseWithKeyBoard(10*l,s):this._handleValueIncreaseWithKeyBoard(10*l,s);break;case"PageDown":g=f?this._handleValueIncreaseWithKeyBoard(10*l,s):this._handleValueDecreaseWithKeyBoard(10*l,s);break;case"Home":g=this._handleHomeKey(s);break;case"End":g=this._handleEndKey(s);break}if(["ArrowLeft","ArrowDown","ArrowRight","ArrowUp","PageUp","PageDown","Home","End"].includes(n.key)){let b=!0;Array.isArray(o)?b=!(o[0]===g[0]&&o[1]===g[1]):b=o!==g,b&&(this._adapter.updateCurrentValue(g),this._adapter.notifyChange(g)),Js(n)}},this._noTooltip=()=>{const{tipFormatter:n,tooltipVisible:s}=this.getProps();return n===null||s===!1},this.onFocus=(n,s)=>{if(this._noTooltip())return;Js(n);const{target:a}=n;try{a.matches(":focus-visible")&&(s==="min"?this._adapter.setStateVal("firstDotFocusVisible",!0):this._adapter.setStateVal("secondDotFocusVisible",!0))}catch{ht(!0,"Warning: [Semi Slider] The current browser does not support the focus-visible")}},this.onBlur=(n,s)=>{if(this._noTooltip())return;const{firstDotFocusVisible:a,secondDotFocusVisible:o}=this.getStates();s==="min"?a&&this._adapter.setStateVal("firstDotFocusVisible",!1):o&&this._adapter.setStateVal("secondDotFocusVisible",!1)},this.handleWrapClick=n=>{const{disabled:s,isDrag:i}=this._adapter.getStates();if(i||s||this._adapter.isEventFromHandle(n))return;const{vertical:a}=this.getProps(),o=this.handleMousePos(n.clientX,n.clientY),l=a?o.y:o.x,d=this.checkWhichHandle(l),u=this.calculateOutputValue(l,d);u!==void 0&&(this._adapter.notifyChange(u),!this._isControlledComponent()&&this.setHandlePos(l,d,!0,u))},this.setHandlePos=function(n,s){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3?arguments[3]:void 0;t._adapter.onHandleMove(n,s,()=>t._adapter.onHandleUpAfter(),i,a)},this.checkWhichHandle=n=>{const{vertical:s,verticalReverse:i}=this.getProps(),{currentValue:a}=this._adapter.getStates(),o=this.transValueToPos(a);let l=!0;if(Array.isArray(o)){const d=Math.abs(n-o[0]),u=Math.abs(n-o[1]);l=d<=u}return s&&i&&(l=!l),l},this.handleWrapperEnter=()=>{this._adapter.setStateVal("showBoundary",!0)},this.handleWrapperLeave=()=>{this._adapter.setStateVal("showBoundary",!1)}}init(){this._checkCurrentValue(),this._dragOffset=0}_checkCurrentValue(){const{currentValue:e,min:t,max:n}=this.getStates();let s;Array.isArray(e)?(s=[],s[0]=this._checkValidity(e[0],t,n),s[1]=this._checkValidity(e[1],t,n)):s=this._checkValidity(e,t,n),this._adapter.updateCurrentValue(s)}destroy(){this._adapter.unSubscribeEventListener()}_getHandleCenterPosition(e,t){const n=t.getBoundingClientRect(),{x:s,y:i}=this.handleMousePos(n.left+n.width*.5,n.top+n.height*.5);return e?i:s}}var gu=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const lt=Ve.PREFIX;function mu(r){return r?!!(r.offsetWidth||r.offsetHeight||r.getClientRects().length):!1}class xn extends Be{constructor(e){super(e),this.renderHandle=()=>{var n,s,i,a,o;const{vertical:l,range:d,tooltipVisible:u,tipFormatter:h,"aria-label":f,"aria-labelledby":g,"aria-valuetext":b,getAriaValueText:m,disabled:v}=this.props,{chooseMovePos:y,isDrag:w,isInRenderTree:E,firstDotFocusVisible:S,secondDotFocusVisible:x}=this.state,P=this.context.direction==="rtl"&&!l,I=l?"top":P?"right":"left",O=this.foundation.getMinAndMaxPercent(this.state.currentValue),F=O.min,D=O.max,{tipVisible:$,tipChildren:L}=this.foundation.computeHandleVisibleVal(u&&E,h,d),N=T(Ve.HANDLE,{[`${Ve.HANDLE}-clicked`]:y==="min"&&w}),J=T(Ve.HANDLE,{[`${Ve.HANDLE}-clicked`]:y==="max"&&w}),{min:z,max:V,currentValue:G}=this.state,H={"aria-label":f??(v?"Disabled Slider":void 0),"aria-labelledby":g,"aria-disabled":v};l&&Object.assign(H,{"aria-orientation":"vertical"});const j=this.props.handleDot;return d?p.createElement(p.Fragment,null,p.createElement(Ot,{content:L.min,position:"top",trigger:"custom",rePosKey:F,visible:E&&($.min||S),className:`${Ve.HANDLE}-tooltip`},p.createElement("span",Object.assign({ref:this.minHanleEl,className:N,style:{[I]:`${F*100}%`,zIndex:y==="min"?2:1},onMouseDown:A=>{this.foundation.onHandleDown(A,"min")},onMouseEnter:()=>{this.foundation.onHandleEnter("min")},onTouchStart:A=>{this.foundation.onHandleTouchStart(A,"min")},onMouseLeave:()=>{this.foundation.onHandleLeave()},onKeyUp:A=>{this.foundation.onHandleUp(A)},onTouchEnd:A=>{this.foundation.onHandleUp(A)},onKeyDown:A=>{this.foundation.handleKeyDown(A,"min")},onFocus:A=>{this.foundation.onFocus(A,"min")},onBlur:A=>{this.foundation.onBlur(A,"min")},role:"slider",tabIndex:v?-1:0},H,{"aria-valuetext":m?m(G[0],0):b,"aria-valuenow":G[0],"aria-valuemax":G[1],"aria-valuemin":z}),(j==null?void 0:j[0])&&p.createElement("div",{className:Ve.HANDLE_DOT,style:Object.assign(Object.assign({},!((n=j[0])===null||n===void 0)&&n.size?{width:j[0].size,height:j[0].size}:{}),!((s=j[0])===null||s===void 0)&&s.color?{backgroundColor:j[0].color}:{})}))),p.createElement(Ot,{content:L.max,position:"top",trigger:"custom",rePosKey:D,visible:E&&($.max||x),className:`${Ve.HANDLE}-tooltip`},p.createElement("span",Object.assign({ref:this.maxHanleEl,className:J,style:{[I]:`${D*100}%`,zIndex:y==="max"?2:1},onMouseDown:A=>{this.foundation.onHandleDown(A,"max")},onMouseEnter:()=>{this.foundation.onHandleEnter("max")},onMouseLeave:()=>{this.foundation.onHandleLeave()},onKeyUp:A=>{this.foundation.onHandleUp(A)},onTouchStart:A=>{this.foundation.onHandleTouchStart(A,"max")},onTouchEnd:A=>{this.foundation.onHandleUp(A)},onKeyDown:A=>{this.foundation.handleKeyDown(A,"max")},onFocus:A=>{this.foundation.onFocus(A,"max")},onBlur:A=>{this.foundation.onBlur(A,"max")},role:"slider",tabIndex:v?-1:0},H,{"aria-valuetext":m?m(G[1],1):b,"aria-valuenow":G[1],"aria-valuemax":V,"aria-valuemin":G[0]}),((i=this.props.handleDot)===null||i===void 0?void 0:i[1])&&p.createElement("div",{className:Ve.HANDLE_DOT,style:Object.assign(Object.assign({},!((a=this.props.handleDot[1])===null||a===void 0)&&a.size?{width:this.props.handleDot[1].size,height:this.props.handleDot[1].size}:{}),!((o=this.props.handleDot[1])===null||o===void 0)&&o.color?{backgroundColor:this.props.handleDot[1].color}:{})})))):p.createElement(Ot,{content:L.min,showArrow:this.props.showArrow,position:"top",trigger:"custom",rePosKey:F,visible:E&&($.min||S),className:`${Ve.HANDLE}-tooltip`},p.createElement("span",Object.assign({onMouseOver:this.foundation.checkAndUpdateIsInRenderTreeState,ref:this.minHanleEl,className:N,style:{[I]:`${F*100}%`,zIndex:y==="min"&&w?2:1},onMouseDown:A=>{this.foundation.onHandleDown(A,"min")},onMouseEnter:()=>{this.foundation.onHandleEnter("min")},onTouchStart:A=>{this.foundation.onHandleTouchStart(A,"min")},onMouseLeave:()=>{this.foundation.onHandleLeave()},onKeyUp:A=>{this.foundation.onHandleUp(A)},onTouchEnd:A=>{this.foundation.onHandleUp(A)},onKeyDown:A=>{this.foundation.handleKeyDown(A,"min")},onFocus:A=>{this.foundation.onFocus(A,"min")},onBlur:A=>{this.foundation.onBlur(A,"min")},role:"slider","aria-valuetext":m?m(G,0):b,tabIndex:v?-1:0},H,{"aria-valuenow":G,"aria-valuemax":V,"aria-valuemin":z}),j&&p.createElement("div",{className:Ve.HANDLE_DOT,style:Object.assign(Object.assign({},j!=null&&j.size?{width:j.size,height:j.size}:{}),j!=null&&j.color?{backgroundColor:j.color}:{})})))},this.renderTrack=()=>{const{range:n,included:s,vertical:i}=this.props,o=this.context.direction==="rtl"&&!i,l=this.foundation.getMinAndMaxPercent(this.state.currentValue),d=l.min,u=l.max;let h;return i?h={height:n?`${Math.abs(u-d)*100}%`:`${d*100}%`,top:n?`${Math.min(d,u)*100}%`:0}:o?h={width:n?`${Math.abs(u-d)*100}%`:`${d*100}%`,right:n?`${Math.min(d,u)*100}%`:0}:h={width:n?`${Math.abs(u-d)*100}%`:`${d*100}%`,left:n?`${Math.min(d,u)*100}%`:0},h=s?h:{},p.createElement("div",{className:Ve.TRACK,style:h,onClick:this.foundation.handleWrapClick})},this.renderStepDot=()=>{const{min:n,max:s,vertical:i,marks:a}=this.props,l=this.context.direction==="rtl"&&!i,d=i?"top":l?"right":"left";return a&&Object.keys(a).length>0?p.createElement("div",{className:Ve.DOTS},Object.keys(a).map(h=>{const f=this.foundation.isMarkActive(Number(h)),g=T(`${lt}-dot`,{[`${lt}-dot-active`]:this.foundation.isMarkActive(Number(h))==="active"}),b=(Number(h)-n)/(s-n),m=p.createElement("span",{key:h,onClick:this.foundation.handleWrapClick,className:g,style:{[d]:`calc(${b*100}% - 2px)`}});return f?this.props.tooltipOnMark?p.createElement(Ot,{content:a[h]},m):m:null})):null},this.renderLabel=()=>{if(!this.props.showMarkLabel)return null;const{min:n,max:s,vertical:i,marks:a,verticalReverse:o}=this.props,d=this.context.direction==="rtl"&&!i,u=i?"top":d?"right":"left";return a&&Object.keys(a).length>0?p.createElement("div",{className:Ve.MARKS+(i&&o?"-reverse":"")},Object.keys(a).map(f=>{const g=this.foundation.isMarkActive(Number(f)),b=(Number(f)-n)/(s-n);return g?p.createElement("span",{key:f,className:T(`${lt}-mark${i&&o?"-reverse":""}`),style:{[u]:`${b*100}%`},onClick:this.foundation.handleWrapClick},a[f]):null})):null},this._getAriaValueText=(n,s)=>{const{getAriaValueText:i}=this.props;return i?i(n,s):n};let{value:t}=this.props;t||(t=this.props.defaultValue),this.state={currentValue:t||(this.props.range?[0,0]:0),min:this.props.min||0,max:this.props.max||0,focusPos:"",onChange:this.props.onChange,disabled:this.props.disabled||!1,chooseMovePos:"",isDrag:!1,clickValue:0,showBoundary:!1,isInRenderTree:!0,firstDotFocusVisible:!1,secondDotFocusVisible:!1},this.sliderEl=p.createRef(),this.minHanleEl=p.createRef(),this.maxHanleEl=p.createRef(),this.dragging=[!1,!1],this.foundation=new ir(this.adapter),this.eventListenerSet=new Set,this.handleDownEventListenerSet=new Set}get adapter(){var e=this;return Object.assign(Object.assign({},super.adapter),{getSliderLengths:()=>{var t;if(this.sliderEl&&this.sliderEl.current){const n=this.sliderEl.current.getBoundingClientRect(),s=(t=this.sliderEl.current.offsetParent)===null||t===void 0?void 0:t.getBoundingClientRect(),i={x:s?n.left-s.left:this.sliderEl.current.offsetLeft,y:s?n.top-s.top:this.sliderEl.current.offsetTop};return{sliderX:i.x,sliderY:i.y,sliderWidth:n.width,sliderHeight:n.height}}return{sliderX:0,sliderY:0,sliderWidth:0,sliderHeight:0}},getParentRect:()=>{const t=this.sliderEl&&this.sliderEl.current&&this.sliderEl.current.offsetParent;if(t)return t.getBoundingClientRect()},getScrollParentVal:()=>{const t=this.foundation.getScrollParent(this.sliderEl.current);return{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}},isEventFromHandle:t=>{const n=[this.minHanleEl,this.maxHanleEl];let s=!1;return n.forEach(i=>{if(!i)return;const a=i&&i.current;a&&a.contains(t.target)&&(s=!0)}),s},getOverallVars:()=>({dragging:this.dragging}),updateDisabled:t=>{this.setState({disabled:t})},transNewPropsToState(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:M;this.setState(t,n)},notifyChange:t=>{this.props.onChange(Array.isArray(t)?[...t].sort((n,s)=>n-s):t)},setDragging:t=>{this.dragging=t},updateCurrentValue:t=>{const{currentValue:n}=this.state;t!==n&&this.setState({currentValue:t})},setOverallVars:(t,n)=>{this[t]=n},getMinHandleEl:()=>this.minHanleEl.current,getMaxHandleEl:()=>this.maxHanleEl.current,onHandleDown:t=>{this.handleDownEventListenerSet.add(this._addEventListener(document.body,"mousemove",this.foundation.onHandleMove,!1)),this.handleDownEventListenerSet.add(this._addEventListener(window,"mouseup",this.foundation.onHandleUp,!1)),this.handleDownEventListenerSet.add(this._addEventListener(document.body,"touchmove",this.foundation.onHandleTouchMove,!1))},onHandleMove:function(t,n){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:M,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a=arguments.length>4?arguments[4]:void 0;if(!e.foundation.checkAndUpdateIsInRenderTreeState())return;const{value:l}=e.props;let d=a;if(d===void 0){const h=e.foundation.transPosToValue(t,n);if(h===!1)return;d=e.foundation.outPutValue(h)}const{currentValue:u}=e.state;if(!pt(e.foundation.outPutValue(u),d)){if(!i&&e.foundation.valueFormatIsCorrect(l))return!1;e.setState({currentValue:d},s)}},setEventDefault:t=>{t.stopPropagation(),t.preventDefault()},setStateVal:(t,n)=>{this.setState({[t]:n})},checkAndUpdateIsInRenderTreeState:()=>{const t=mu(this.sliderEl.current);return t!==this.state.isInRenderTree&&this.setState({isInRenderTree:t}),t},onHandleEnter:t=>{this.setState({focusPos:t})},onHandleLeave:()=>{this.setState({focusPos:""})},onHandleUpBefore:t=>{var n,s;(s=(n=this.props).onMouseUp)===null||s===void 0||s.call(n,t),t.stopPropagation(),t.preventDefault(),Array.from(this.handleDownEventListenerSet).forEach(i=>i()),this.handleDownEventListenerSet.clear()},onHandleUpAfter:()=>{const{currentValue:t}=this.state,n=this.foundation.outPutValue(t);this.props.onAfterChange(n)},unSubscribeEventListener:()=>{Array.from(this.eventListenerSet).forEach(t=>t())}})}componentDidMount(){this.foundation.init()}componentDidUpdate(e,t){const n=!pt(this.props.value,e.value);if(this.props.disabled!==e.disabled&&this.foundation.handleDisabledChange(this.props.disabled),n){const i=this.props.value,a=this.state.currentValue;this.foundation.handleValueChange(a,i),this.props.onAfterChange(this.props.value)}}componentWillUnmount(){this.foundation.destroy()}render(){const{disabled:e,currentValue:t,min:n,max:s}=this.state,i=this.props,{vertical:a,verticalReverse:o,style:l,railStyle:d,range:u,className:h}=i,f=gu(i,["vertical","verticalReverse","style","railStyle","range","className"]),g=T(`${lt}-wrapper`,{[`${lt}-disabled`]:e,[`${Ve.VERTICAL}-wrapper`]:a,[`${lt}-reverse`]:a&&o},h),b=T(`${lt}-boundary`,{[`${lt}-boundary-show`]:this.props.showBoundary&&this.state.showBoundary}),m=T({[`${lt}`]:!a,[Ve.VERTICAL]:a}),v=Array.isArray(t)?[...t].sort():t,y=u?`Range: ${this._getAriaValueText(v[0],0)} to ${this._getAriaValueText(v[1],1)}`:void 0,w=p.createElement("div",Object.assign({className:g,style:l,ref:this.sliderEl,"aria-label":y,onMouseEnter:()=>this.foundation.handleWrapperEnter(),onMouseLeave:()=>this.foundation.handleWrapperLeave()},this.getDataAttr(f)),p.createElement("div",{className:`${lt}-rail`,onClick:this.foundation.handleWrapClick,style:d}),this.renderTrack(),this.renderStepDot(),p.createElement("div",null,this.renderHandle()),this.renderLabel(),p.createElement("div",{className:b},p.createElement("span",{className:`${lt}-boundary-min`},n),p.createElement("span",{className:`${lt}-boundary-max`},s)));return a?w:p.createElement("div",{className:m},w)}_addEventListener(e,t,n){if(e.addEventListener){for(var s=arguments.length,i=new Array(s>3?s-3:0),a=3;a<s;a++)i[a-3]=arguments[a];e.addEventListener(t,n,...i);const o=()=>{e==null||e.removeEventListener(t,n),Promise.resolve().then(()=>{this.eventListenerSet.delete(o)})};return this.eventListenerSet.add(o),o}else return M}}xn.__SemiComponentName__="Slider";xn.contextType=en;xn.propTypes={defaultValue:c.oneOfType([c.number,c.array]),disabled:c.bool,showMarkLabel:c.bool,included:c.bool,marks:c.object,max:c.number,min:c.number,range:c.bool,step:c.number,tipFormatter:c.func,value:c.oneOfType([c.number,c.array]),vertical:c.bool,onAfterChange:c.func,onChange:c.func,onMouseUp:c.func,tooltipOnMark:c.bool,tooltipVisible:c.bool,showArrow:c.bool,style:c.object,className:c.string,showBoundary:c.bool,railStyle:c.object,verticalReverse:c.bool,getAriaValueText:c.func,handleDot:c.oneOfType([c.shape({size:c.string,color:c.string}),c.arrayOf(c.shape({size:c.string,color:c.string}))])};xn.defaultProps=kt(xn.__SemiComponentName__,{disabled:!1,showMarkLabel:!0,tooltipOnMark:!1,included:!0,max:100,min:0,range:!1,showArrow:!0,step:1,tipFormatter:r=>r,vertical:!1,showBoundary:!1,onAfterChange:r=>{},onChange:r=>{},verticalReverse:!1});const vs=function(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:He.DEFAULT_FORMAT,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:va;if(r instanceof Date)return r;if(typeof r=="number")return new Date(Jt(r));if(typeof r=="string"){if(r==="")return;let n=new Date;return n=gl(r,e,n,{locale:t}),n}else if(typeof r>"u")return;return new Date},Cs=function(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:He.DEFAULT_FORMAT,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:va;return Ti(r,e,{locale:t})},yu=(r,e)=>{if(typeof r=="function"){const t=r();if(Array.isArray(t)&&!Ge(e)&&t.some(n=>Jt(n)===Jt(e)))return!0}return!1},bu=(r,e,t)=>{if(typeof r=="function"){const n=r(e);if(Array.isArray(n)&&!Ge(e)&&!Ge(t)&&n.some(s=>Jt(s)===Jt(t)))return!0}return!1},vu=(r,e,t,n)=>{if(typeof r=="function"){const s=r(e,t);if(Array.isArray(s)&&!Ge(e)&&!Ge(t)&&!Ge(n)&&s.some(i=>Jt(i)===Jt(n)))return!0}return!1},pi=r=>Array.isArray(r)?[...r]:[],Cu=(r,e)=>{let t=!0;const n="BDEGHKLMOPQRSTXYabcehimopqstuwxyz",s=new RegExp(`[${n}]`,"g"),i=new RegExp(`[^${n}]`,"g"),a=/[H|m|s]{1,2}/,o=e.split(i),l=e.replace(s,""),d=new RegExp(`[${l}]`,"g"),u=r.split(d);if(o.length!==u.length)t=!1;else for(let h=0,f=u.length;h<f;h++){const g=o[h],b=u[h];if(a.test(g)&&b.length<g.length){t=!1;break}}return t};let Su=class extends Ye{constructor(e){super(Object.assign({},e))}init(){this.initDataFromDefaultValue(),(this._isControlledComponent("open")?this.getProp("open"):this.getProp("defaultOpen"))&&!this._isControlledComponent("open")&&this._adapter.registerClickOutSide()}getPosition(){const e=this.getProp("position"),t=this.getProp("type")||He.DEFAULT_TYPE,s=this.getContext("direction")==="rtl"?"bottomRight":"";return e||s||He.DEFAULT_POSITION[t]}getDisabledTimeFns(e,t){const{disabledHours:n,disabledMinutes:s,disabledSeconds:i,disabledTime:a}=this.getProps();if(typeof a=="function"&&this._adapter.isRangePicker()){const o=a(t,e)||{};return{disabledHours:o.disabledHours||n,disabledMinutes:o.disabledMinutes||s,disabledSeconds:o.disabledSeconds||i}}return{disabledHours:n,disabledMinutes:s,disabledSeconds:i}}isDisabledHMS(e){let{hours:t,minutes:n,seconds:s}=e,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"left",a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];const{disabledHours:o,disabledMinutes:l,disabledSeconds:d}=this.getDisabledTimeFns(i,a),u=!Ge(t)&&yu(o,t),h=!Ge(t)&&!Ge(n)&&bu(l,t,n),f=!Ge(t)&&!Ge(n)&&!Ge(s)&&vu(d,t,n,s);return u||h||f}isValidTimeZone(e){return["string","number"].includes(typeof e)&&e!==""}getDefaultFormatIfNeed(){return this._isInProps("format")?this.getProp("format"):this.getProp("use12Hours")?He.DEFAULT_FORMAT_A:He.DEFAULT_FORMAT}initDataFromDefaultValue(){const e=this.getProp("defaultValue");let t=this.getProp("value");const n=this.getProp("timeZone"),s=this.getValidFormat(),{rangeSeparator:i,dateFnsLocale:a}=this.getProps();t=t||e,Array.isArray(t)||(t=t?[t]:[]);const o=[];let l=!1;t.forEach(h=>{const f=vs(h,s,a);isNaN(f.getTime())||o.push(this.isValidTimeZone(n)?vr(f,n):f)});const d=[!0,!1];o.map((h,f)=>{d[f]=El(h)<12}),o.length===t.length?t=o:(t=[],t.length&&(l=!0));let u="";l||(u=t.map(h=>Cs(h,s,a)).join(i)),this.setState({isAM:d,value:t,inputValue:u,invalid:l})}getValidFormat(e){let t=e;return Ge(t)&&(t=this.getDefaultFormatIfNeed()),typeof t!="string"&&(t=He.DEFAULT_FORMAT),t}handlePanelChange(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const n=this.getValidFormat(),s=this.getProp("dateFnsLocale"),i=this.getState("value");let a=this.getState("isAM");const o=pi(i);if(a=pi(a),e){const l=!!e.isAM,d=vs(e.timeStampValue,n,s);o[t]=d,a[t]=l;const u=this.formatValue(o);if(this.getState("isAM")[t]!==e.isAM&&this.setState({isAM:a}),!this._isControlledComponent("value")){const h=this.validateDates(o);this.setState({isAM:a,value:o,inputValue:u,invalid:h})}this._hasChanged(o,i)&&this._notifyChange(o,u)}}refreshProps(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{value:t,timeZone:n,__prevTimeZone:s}=e;let i=this.parseValue(t),a=i.some(l=>isNaN(Number(l)));if(!a)if(this.isValidTimeZone(n)&&(i=i.map(l=>vr(this.isValidTimeZone(s)?ii(l,s):l,n))),this._adapter.isRangePicker())a=i.some((l,d)=>{const u=d===1?"right":"left";return this.isDisabledHMS({hours:l.getHours(),minutes:l.getMinutes(),seconds:l.getSeconds()},u,i)});else{const l=i[0];a=l?this.isDisabledHMS({hours:l.getHours(),minutes:l.getMinutes(),seconds:l.getSeconds()},"left",i):!1}const o=this.formatValue(i);this.setState({value:i,invalid:a,inputValue:o})}handleFocus(e){this.getState("open")||this.handlePanelOpen(),this._adapter.notifyFocus(e)}setPanel(e){this._adapter.togglePanel(e)}destroy(){this._adapter.unregisterClickOutSide()}handlePanelOpen(){this._isControlledComponent("open")||(this._adapter.registerClickOutSide(),this.setPanel(!0)),this._adapter.notifyOpenChange(!0)}handlePanelClose(e,t){this._isControlledComponent("open")||(this._adapter.unregisterClickOutSide(),this.setPanel(!1)),this._adapter.notifyOpenChange(!1),this._adapter.notifyBlur(t)}handleVisibleChange(e){this._isControlledComponent("open")||this._adapter.togglePanel(e),this._adapter.notifyOpenChange(e)}handleInputChange(e){this._adapter.setInputValue(e);const t=this.getProp("rangeSeparator"),n=Qs(e,t),s=this.getValidFormat();if(e!==""&&n.some(u=>!Cu(u,s)))return;const i=this.parseInput(e),a=this.validateDates(i),o={invalid:a},l=this.getState("value");let d=pi(l);a||(o.value=i,d=[...i]),this._isControlledComponent("value")||this.setState(o),this._hasChanged(d,l)&&this._notifyChange(d,e)}doValidate(e){if(typeof e=="string")return this.validateStr(e);if(Array.isArray(e))return this.validateDates(e)}validateStr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";const t=this.parseInput(e);return this.validateDates(t)}validateDates(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=e.some(n=>isNaN(Number(n)));if(!t)if(this._adapter.isRangePicker())t=e.some((n,s)=>{const i=s===1?"right":"left";return this.isDisabledHMS({hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds()},i,e)});else{const n=e[0];t=n?this.isDisabledHMS({hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds()},"left",e):!1}return t}handleInputBlur(e){const t=this.getState("invalid"),n=this.getState("inputValue"),s=this.getState("value");n?t?this.setState({inputValue:this.formatValue(s),invalid:!1}):this.setState({inputValue:this.formatValue(s)}):this.setState({inputValue:"",value:[],invalid:!1})}formatValue(e){const t=this.getValidFormat(),n=this.getProp("rangeSeparator"),s=this.getProp("dateFnsLocale");let i=e;if(i&&!Array.isArray(i)&&(i=i[i]),i&&Array.isArray(i))return i.map(o=>{let l;return me(o)?l="":l=Cs(o,t,s),l}).join(n)}parseInput(e){const t=this.getValidFormat(),n=this.getProp("rangeSeparator"),s=this.getProp("dateFnsLocale");return e&&typeof e=="string"?Qs(e,n).map(i=>vs(i,t,s)):[]}parseValue(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const t=this.getValidFormat(),n=this.getProp("dateFnsLocale");let s=e;return Array.isArray(s)||(s=s?[s]:[]),Array.isArray(s)?s.map(i=>vs(i,t,n)):[]}_notifyChange(e,t){let n=t,s=e;const i=this.getProp("timeZone");if(this._adapter.isRangePicker()){const o=this.getProp("rangeSeparator");n=Qs(t,o)}else s=Array.isArray(s)?s[0]:s;if(this.isValidTimeZone(i)&&s){const o=this.getValidFormat();Array.isArray(s)?(s=s.map(l=>ii(l,i)),n=s.map(l=>Ti(l,o))):(s=ii(s,i),n=Ti(s,o))}this.getProp("onChangeWithDateFirst")?this._adapter.notifyChange(s,n):this._adapter.notifyChange(n,s)}_hasChanged(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const n=this.getValidFormat(),s=this.getProp("dateFnsLocale");return e.length!==t.length||e.some((i,a)=>{const o=t[a];return!(Cr(i)&&Cr(o)&&Cs(i,n,s)===Cs(o,n,s))})}};class wu extends Ye{constructor(e){super(Object.assign({},e))}init(){}destroy(){}handleFocus(e){this.storeCursor(),this._adapter.notifyFocus(e)}handleChange(e){this.storeCursor(),this._adapter.notifyChange(e)}handleBlur(e){this.clearCursor(),this._adapter.notifyBlur(e)}storeCursor(){const e=this.getCache("inputNode");if(e){const{selectionStart:t}=e;this.setCache("cursorIndex",t)}}restoreCursor(){const e=this.getCache("inputNode"),t=this.getCache("cursorIndex");e&&!Ge(t)&&(e.selectionStart=t,e.selectionEnd=t)}clearCursor(){this.setCache("cursorIndex",null),this.setCache("beforeStr",null),this.setCache("afterStr",null)}}var Eu=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};class rr extends Be{constructor(e){super(e),this.setRef=t=>this.adapter.setCache("inputNode",t),this.handleClick=t=>this.props.onClick(t),this.handleFocus=t=>this.foundation.handleFocus(t),this.handleBlur=t=>this.foundation.handleBlur(t),this.handleChange=t=>this.foundation.handleChange(t),this.foundation=new wu(this.adapter),this.state={}}componentDidMount(){super.componentDidMount();const{focusOnOpen:e,preventScroll:t}=this.props;e&&(window.requestAnimationFrame||window.setTimeout)(()=>{const s=this.adapter.getCache("inputNode");s&&(s.focus({preventScroll:t}),s.select())})}componentDidUpdate(e){const{timeStampValue:t}=this.props;this.isControlled("timeStampValue")&&t!==this.state.timeStampValue&&this.foundation.restoreCursor(),this.props.value!==e.value&&this.foundation.restoreCursor()}get adapter(){var e=this;return Object.assign(Object.assign({},super.adapter),{notifyChange:function(){return e.props.onChange(...arguments)},notifyFocus:function(){return e.props.onFocus(...arguments)},notifyBlur:function(){return e.props.onBlur(...arguments)}})}getInput(){const e=this.props,{prefixCls:t,placeholder:n,inputReadOnly:s,onFocus:i,disabled:a,type:o,locale:l,localeCode:d,insetLabel:u,validateStatus:h,value:f,onChange:g,invalid:b,format:m,clearText:v,disabledHours:y,disabledMinutes:w,disabledSeconds:E,onEsc:S,defaultOpenValue:x,currentSelectPanel:_,focusOnOpen:P,timeStampValue:I,timeZone:O,defaultOpen:F,dateFnsLocale:D}=e,$=Eu(e,["prefixCls","placeholder","inputReadOnly","onFocus","disabled","type","locale","localeCode","insetLabel","validateStatus","value","onChange","invalid","format","clearText","disabledHours","disabledMinutes","disabledSeconds","onEsc","defaultOpenValue","currentSelectPanel","focusOnOpen","timeStampValue","timeZone","defaultOpen","dateFnsLocale"]),L=T(`${t}-input`,{[`${t}-input-invalid`]:b,[`${t}-input-readonly`]:s}),N=b?"error":h;return p.createElement(Qt,Object.assign({},$,{hideSuffix:!0,className:L,ref:this.setRef,value:f,placeholder:n||l.placeholder[o],readonly:!!s,onChange:this.handleChange,onFocus:this.handleFocus,onBlur:this.handleBlur,suffix:p.createElement(ml,{onClick:this.handleClick}),validateStatus:N,disabled:a,insetLabel:u}))}render(){const{prefixCls:e}=this.props;return p.createElement("div",{className:`${e}-input-wrap`},this.getInput())}}rr.propTypes={borderless:c.bool,format:c.string,prefixCls:c.string,placeholder:c.string,clearText:c.string,inputReadOnly:c.bool,hourOptions:c.array,minuteOptions:c.array,secondOptions:c.array,disabledHours:c.func,disabledMinutes:c.func,disabledSeconds:c.func,onChange:c.func,onFocus:c.func,onBlur:c.func,onEsc:c.func,onClick:c.func,defaultOpenValue:c.object,currentSelectPanel:c.string,focusOnOpen:c.bool,timeStampValue:c.any,locale:c.object,localeCode:c.string,insetLabel:c.node,validateStatus:c.string,preventScroll:c.bool};rr.defaultProps={borderless:!1,inputReadOnly:!1,onChange:M,onBlur:M,onFocus:M,onClick:M,disabledHours:M,disabledMinutes:M,disabledSeconds:M,format:He.DEFAULT_FORMAT};const qr={panelHeader:c.oneOfType([c.node,c.string]),panelFooter:c.oneOfType([c.node,c.string])},xu={},_u=[c.string,c.number,c.instanceOf(Date)],Yr=c.oneOfType([..._u,c.arrayOf(c.string),c.arrayOf(c.number),c.arrayOf(c.instanceOf(Date))]);var Pu=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};class Rn extends Be{constructor(e){var t;super(e),t=this,this.onCurrentSelectPanelChange=s=>{this.setState({currentSelectPanel:s})},this.handlePanelChange=(s,i)=>this.foundation.handlePanelChange(s,i),this.handleInput=s=>this.foundation.handleInputChange(s),this.createPanelProps=function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;const{panels:i,panelFooter:a,panelHeader:o,locale:l}=t.props,d={panelHeader:o,panelFooter:a};if(t.adapter.isRangePicker()){const u={0:l.begin,1:l.end};d.panelHeader=se(i,s,Ge(o)?se(u,s,null):Array.isArray(o)?o[s]:o),d.panelFooter=se(i,s,Array.isArray(a)?a[s]:a)}return d},this.handlePanelVisibleChange=s=>this.foundation.handleVisibleChange(s),this.openPanel=()=>{this.foundation.handlePanelOpen()},this.handleFocus=s=>{this.foundation.handleFocus(s)},this.handleBlur=s=>this.foundation.handleInputBlur(s),this.setTimePickerRef=s=>this.timePickerRef.current=s;const{format:n=He.DEFAULT_FORMAT}=e;this.state={open:e.open||e.defaultOpen||!1,value:[],inputValue:"",currentSelectPanel:0,isAM:[!0,!1],showHour:!!n.match(/HH|hh|H|h/g),showMinute:!!n.match(/mm/g),showSecond:!!n.match(/ss/g),invalid:void 0},this.foundation=new Su(this.adapter),this.timePickerRef=p.createRef(),this.savePanelRef=p.createRef(),this.useCustomTrigger=typeof this.props.triggerRender=="function"}get adapter(){var e=this;return Object.assign(Object.assign({},super.adapter),{togglePanel:t=>{this.setState({open:t})},registerClickOutSide:()=>{this.clickOutSideHandler&&this.adapter.unregisterClickOutSide(),this.clickOutSideHandler=t=>{const n=this.savePanelRef&&this.savePanelRef.current,s=this.timePickerRef&&this.timePickerRef.current,i=t.target,a=t.composedPath&&t.composedPath()||[i];!(n&&n.contains(i))&&!(s&&s.contains(i))&&!(a.includes(s)||a.includes(n))&&this.foundation.handlePanelClose(!0,t)},document.addEventListener("mousedown",this.clickOutSideHandler)},setInputValue:(t,n)=>this.setState({inputValue:t},n),unregisterClickOutSide:()=>{this.clickOutSideHandler&&(document.removeEventListener("mousedown",this.clickOutSideHandler),this.clickOutSideHandler=null)},notifyOpenChange:function(){return e.props.onOpenChange(...arguments)},notifyChange:(t,n)=>this.props.onChange&&this.props.onChange(t,n),notifyFocus:function(){return e.props.onFocus&&e.props.onFocus(...arguments)},notifyBlur:function(){return e.props.onBlur&&e.props.onBlur(...arguments)},isRangePicker:()=>this.props.type===He.TYPE_TIME_RANGE_PICKER})}static getDerivedStateFromProps(e,t){return"open"in e&&e.open!==t.open?{open:e.open}:null}componentDidUpdate(e){this.isControlled("value")&&this.props.value!==e.value?this.foundation.refreshProps(Object.assign({},this.props)):this.props.timeZone!==e.timeZone&&this.foundation.refreshProps({timeZone:this.props.timeZone,__prevTimeZone:e.timeZone,value:this.state.value})}getDisabledTimeOptions(e){const{disabledTime:t}=this.props,{value:n}=this.state;if(typeof t=="function"&&this.adapter.isRangePicker())return t(n,e)}getPanelElement(){const{prefixCls:e,type:t,disabledHours:n,disabledMinutes:s,disabledSeconds:i}=this.props,{isAM:a,value:o}=this.state,l=this.foundation.getDefaultFormatIfNeed(),d=this.getDisabledTimeOptions("left")||{},u=this.getDisabledTimeOptions("right")||{},h=[p.createElement(Sr,Object.assign({},this.props,{key:0,format:l,isAM:a[0],timeStampValue:o[0],prefixCls:`${e}-panel`,onChange:g=>this.handlePanelChange(g,0),onCurrentSelectPanelChange:this.onCurrentSelectPanelChange,disabledHours:d.disabledHours||n,disabledMinutes:d.disabledMinutes||s,disabledSeconds:d.disabledSeconds||i},this.createPanelProps(0)))];t===He.TYPE_TIME_RANGE_PICKER&&h.push(p.createElement(Sr,Object.assign({},this.props,{key:1,format:l,isAM:a[1],timeStampValue:o[1],prefixCls:`${e}-panel`,onChange:g=>this.handlePanelChange(g,1),onCurrentSelectPanelChange:this.onCurrentSelectPanelChange,disabledHours:u.disabledHours||n,disabledMinutes:u.disabledMinutes||s,disabledSeconds:u.disabledSeconds||i},this.createPanelProps(1))));const f=T({[Fi.RANGE_PANEL_LISTS]:this.adapter.isRangePicker()});return p.createElement("div",{ref:this.savePanelRef,className:f},h.map(g=>g))}getPopupClassName(){const{use12Hours:e,prefixCls:t,popupClassName:n}=this.props,{showHour:s,showMinute:i,showSecond:a}=this.state;let o=0;return s&&(o+=1),i&&(o+=1),a&&(o+=1),e&&(o+=1),T(`${t}-panel`,n,{[`${t}-panel-narrow`]:(!s||!i||!a)&&!e,[Fi.RANGE_PICKER]:this.adapter.isRangePicker()},`${t}-panel-column-${o}`)}focus(){}blur(){}render(){const e=this.props,{prefixCls:t,placeholder:n,disabled:s,defaultValue:i,dropdownMargin:a,className:o,popupStyle:l,size:d,style:u,locale:h,localeCode:f,zIndex:g,getPopupContainer:b,insetLabel:m,insetLabelId:v,inputStyle:y,showClear:w,panelHeader:E,panelFooter:S,rangeSeparator:x,onOpenChange:_,onChangeWithDateFirst:P,popupClassName:I,hideDisabledOptions:O,use12Hours:F,minuteStep:D,hourStep:$,secondStep:L,scrollItemProps:N,triggerRender:J,motion:z,autoAdjustOverflow:V,stopPropagation:G}=e,H=Pu(e,["prefixCls","placeholder","disabled","defaultValue","dropdownMargin","className","popupStyle","size","style","locale","localeCode","zIndex","getPopupContainer","insetLabel","insetLabelId","inputStyle","showClear","panelHeader","panelFooter","rangeSeparator","onOpenChange","onChangeWithDateFirst","popupClassName","hideDisabledOptions","use12Hours","minuteStep","hourStep","secondStep","scrollItemProps","triggerRender","motion","autoAdjustOverflow","stopPropagation"]),j=this.foundation.getDefaultFormatIfNeed(),q=this.foundation.getPosition(),{open:A,inputValue:K,invalid:oe,value:fe}=this.state,ce=this.getPopupClassName(),ve=T({[`${t}-header`]:!0}),Ce=T({[`${t}-panel`]:!0,[`${t}-panel-${d}`]:d}),de=Object.assign(Object.assign({},H),{disabled:s,prefixCls:t,size:d,showClear:s?!1:w,style:y,value:K,onFocus:this.handleFocus,insetLabel:m,insetLabelId:v,format:j,locale:h,localeCode:f,invalid:oe,placeholder:n,onChange:this.handleInput,onBlur:this.handleBlur}),B={};return this.useCustomTrigger&&(B.onClick=this.openPanel),p.createElement("div",Object.assign({ref:this.setTimePickerRef,className:T({[t]:!0},o),style:u},B),p.createElement(Cn,{getPopupContainer:b,zIndex:g,prefixCls:Ce,contentClassName:ce,style:l,content:this.getPanelElement(),trigger:"custom",position:q,visible:s?!1:!!A,motion:z,margin:a,autoAdjustOverflow:V,stopPropagation:G},this.useCustomTrigger?p.createElement(Ns,{triggerRender:J,disabled:s,value:fe,inputValue:K,onChange:this.handleInput,placeholder:n,componentName:"TimePicker",componentProps:Object.assign({},this.props)}):p.createElement("span",{className:ve},p.createElement(rr,Object.assign({},de)))))}}Rn.contextType=en;Rn.propTypes=Object.assign(Object.assign({"aria-labelledby":c.string,"aria-invalid":c.bool,"aria-errormessage":c.string,"aria-describedby":c.string,"aria-required":c.bool,prefixCls:c.string,borderless:c.bool,clearText:c.string,clearIcon:c.node,value:Yr,inputReadOnly:c.bool,disabled:c.bool,showClear:c.bool,defaultValue:Yr,open:c.bool,defaultOpen:c.bool,onOpenChange:c.func,position:c.any,getPopupContainer:c.func,placeholder:c.string,format:c.string,style:c.object,className:c.string,popupClassName:c.string,popupStyle:c.object,disabledHours:c.func,disabledMinutes:c.func,disabledSeconds:c.func,disabledTime:c.func,dropdownMargin:c.oneOfType([c.number,c.object]),hideDisabledOptions:c.bool,onChange:c.func,use12Hours:c.bool,hourStep:c.number,minuteStep:c.number,secondStep:c.number,focusOnOpen:c.bool,autoFocus:c.bool,size:c.oneOf(He.SIZE),stopPropagation:c.bool,panels:c.arrayOf(c.shape(qr)),onFocus:c.func,onBlur:c.func,locale:c.object,localeCode:c.string,dateFnsLocale:c.object,zIndex:c.oneOfType([c.number,c.string]),insetLabel:c.node,insetLabelId:c.string,validateStatus:c.oneOf(He.STATUS),type:c.oneOf(He.TYPES),rangeSeparator:c.string,triggerRender:c.func,timeZone:c.oneOfType([c.string,c.number]),scrollItemProps:c.object,motion:c.oneOfType([c.bool,c.func,c.object]),autoAdjustOverflow:c.bool},qr),{inputStyle:c.object,preventScroll:c.bool});Rn.defaultProps=Object.assign({autoAdjustOverflow:!0,borderless:!1,getPopupContainer:()=>document.body,showClear:!0,zIndex:Ls.DEFAULT_Z_INDEX,rangeSeparator:He.DEFAULT_RANGE_SEPARATOR,onOpenChange:M,clearText:"clear",prefixCls:Fi.PREFIX,inputReadOnly:!1,style:{},stopPropagation:!0,className:"",popupClassName:"",popupStyle:{left:"0px",top:"0px"},disabledHours:()=>[],disabledMinutes:()=>[],disabledSeconds:()=>[],hideDisabledOptions:!1,onFocus:M,onBlur:M,onChange:M,onChangeWithDateFirst:!0,use12Hours:!1,focusOnOpen:!1,onKeyDown:M,size:"default",type:He.DEFAULT_TYPE,motion:!0},xu);class Jn extends p.PureComponent{render(){const{type:e}=this.props;return p.createElement(en.Consumer,null,t=>{let{timeZone:n}=t;return p.createElement(ut,{componentName:"TimePicker"},(s,i,a)=>p.createElement(Rn,Object.assign({timeZone:n,placeholder:se(s,["placeholder",e])},this.props,{locale:s,localeCode:i,dateFnsLocale:a})))})}}Jn.propTypes=Rn.propTypes;Jn.__SemiComponentName__="TimePicker";Jn.defaultProps=kt(Jn.__SemiComponentName__,Rn.defaultProps);function fi(r){return Bo(r,e=>{if(Pi(e)&&!e._innerDataTag||p.isValidElement(e))return e})}const Ou=Fa.PREFIX;class ar extends C.PureComponent{constructor(e){super(e),this._onResize=t=>{const n=t&&t[1]&&t[1].target;if(n){const s=se(n,"offsetHeight")||0,i=window.getComputedStyle(n)||{},a=parseInt(se(i,"paddingTop"),10)||0,o=parseInt(se(i,"paddingBottom"),10)||0,l=s-a-o;this.state.height!==l&&this.setState({height:s-a-o})}},this.state={height:this.props.defaultHeight||0}}componentDidMount(){const{height:e}=this.state}render(){const{children:e,defaultWidth:t,defaultHeight:n}=this.props,{height:s}=this.state;let i=!1;return(s===0||typeof s!="number")&&(i=!0),p.createElement(Ca,{observeParent:!0,onResize:this._onResize},p.createElement("div",{style:{height:n,overflow:"visible"},className:`${Ou}-auto-wrapper`},!i&&e({height:s,width:t})))}}ar.propTypes={defaultHeight:c.oneOfType([c.number,c.string]),defaultWidth:c.oneOfType([c.number,c.string])};ar.defaultProps={defaultHeight:"100%",defaultWidth:"100%"};const or=p.createContext(null),Iu=r=>{let{prefixcls:e,level:t,isEnd:n,showLine:s}=r;const i=`${e}-indent-unit`,a=[];for(let o=0;o<t;o+=1)a.push(C.createElement("span",{key:o,className:T(i,{[`${i}-end`]:n[o]})}));return C.createElement("span",{"aria-hidden":"true",className:T(`${e}-indent`,{[`${e}-indent-show-line`]:s})},a)},Tu=C.memo(Iu);var Fu=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const re=Fa.PREFIX_OPTION;class yn extends C.PureComponent{constructor(e){super(e),this.onSelect=t=>{const{onNodeSelect:n}=this.context;n(t,this.props)},this.onExpand=t=>{const{onNodeExpand:n}=this.context;t&&t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),n(t,this.props)},this.onCheck=t=>{var n,s;if(this.isDisabled())return;const{onNodeCheck:i}=this.context;t.stopPropagation(),(s=(n=t.nativeEvent)===null||n===void 0?void 0:n.stopImmediatePropagation)===null||s===void 0||s.call(n),i(t,this.props)},this.handleCheckEnterPress=t=>{Ht(t)&&this.onCheck(t)},this.onContextMenu=t=>{const{onNodeRightClick:n}=this.context;n(t,this.props)},this.onClick=t=>{const{expandAction:n}=this.context;if(n==="doubleClick"){this.debounceSelect(t);return}this.onSelect(t),n==="click"&&this.onExpand(t)},this.handleliEnterPress=t=>{Ht(t)&&this.onClick(t)},this.onDoubleClick=t=>{const{expandAction:n,onNodeDoubleClick:s}=this.context;t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),Le(s)&&s(t,this.props),n==="doubleClick"&&this.onExpand(t)},this.onDragStart=t=>{const{onNodeDragStart:n}=this.context;t.stopPropagation(),n(t,Object.assign(Object.assign({},this.props),{nodeInstance:this.refNode}));try{t.dataTransfer.setData("text/plain","")}catch{}},this.onDragEnter=t=>{const{onNodeDragEnter:n}=this.context;t.preventDefault(),t.stopPropagation(),n(t,Object.assign(Object.assign({},this.props),{nodeInstance:this.refNode}))},this.onDragOver=t=>{const{onNodeDragOver:n}=this.context;t.preventDefault(),t.stopPropagation(),n(t,Object.assign(Object.assign({},this.props),{nodeInstance:this.refNode}))},this.onDragLeave=t=>{const{onNodeDragLeave:n}=this.context;t.stopPropagation(),n(t,Object.assign(Object.assign({},this.props),{nodeInstance:this.refNode}))},this.onDragEnd=t=>{const{onNodeDragEnd:n}=this.context;t.stopPropagation(),n(t,Object.assign(Object.assign({},this.props),{nodeInstance:this.refNode}))},this.onDrop=t=>{const{onNodeDrop:n}=this.context;t.preventDefault(),t.stopPropagation(),n(t,Object.assign(Object.assign({},this.props),{nodeInstance:this.refNode}))},this.getNodeChildren=()=>{const{children:t}=this.props;return t||[]},this.isLeaf=()=>{const{isLeaf:t,loaded:n}=this.props,{loadData:s}=this.context,i=this.getNodeChildren().length!==0;return t===!1?!1:t||!s&&!i||s&&n&&!i},this.isDisabled=()=>{const{disabled:t}=this.props,{treeDisabled:n}=this.context;return t===!1?!1:!!(n||t)},this.renderSwitcher=()=>this.isLeaf()?p.createElement("span",{className:T(`${re}-switcher`)},p.createElement("span",{className:`${re}-switcher-leaf-line`})):null,this.renderRealLabel=()=>{const{renderLabel:t}=this.context,{label:n,keyword:s,data:i,filtered:a,treeNodeFilterProp:o}=this.props;return Le(t)?t(n,i,s):_e(n)&&a&&s?p.createElement(pa,{highlightClassName:`${re}-highlight`,component:"span",sourceString:n,searchWords:[s]}):n},this.setRef=t=>{this.refNode=t},this.state={},this.debounceSelect=Uo(this.onSelect,500,{leading:!0,trailing:!1})}renderArrow(){var e,t;const n=!this.isLeaf(),{loading:s,expanded:i,showLine:a,expandIcon:o}=this.props;if(s)return p.createElement(vn,{wrapperClassName:`${re}-spin-icon`});if(n){if(o){if(typeof o=="function")return o({onClick:this.onExpand,className:`${re}-expand-icon`,expanded:i});if(p.isValidElement(o)){const l=T(`${re}-expand-icon`,{[(e=o==null?void 0:o.props)===null||e===void 0?void 0:e.className]:(t=o==null?void 0:o.props)===null||t===void 0?void 0:t.className});return p.cloneElement(o,{onClick:this.onExpand,className:l})}else return o}return p.createElement(il,{role:"button","aria-label":`${i?"Expand":"Collapse"} the tree item`,className:`${re}-expand-icon`,size:"small",onClick:this.onExpand})}return a?this.renderSwitcher():p.createElement("span",{className:`${re}-empty-icon`})}renderCheckbox(){const{checked:e,halfChecked:t,eventKey:n}=this.props,s=this.isDisabled();return p.createElement("div",{role:"none",onClick:this.onCheck,onKeyPress:this.handleCheckEnterPress},p.createElement(Pa,{"aria-label":"Toggle the checked state of checkbox",value:n,indeterminate:t,checked:e,disabled:!!s}))}renderIcon(){const{directory:e,treeIcon:t}=this.context,{expanded:n,icon:s,data:i}=this.props;return s||(t?typeof t=="function"?t(this.props):t:e?this.isLeaf()?p.createElement(Ri,{className:`${re}-item-icon`}):n?p.createElement(Il,{className:`${re}-item-icon`}):p.createElement(Pl,{className:`${re}-item-icon`}):null)}renderEmptyNode(){const{emptyContent:e}=this.props,t=T(re,{[`${re}-empty`]:!0});return p.createElement("ul",{className:t},p.createElement("li",{className:`${re}-label ${re}-label-empty`,"x-semi-prop":"emptyContent"},e))}render(){const e=this.props,{eventKey:t,expanded:n,selected:s,checked:i,halfChecked:a,loading:o,active:l,level:d,empty:u,filtered:h,treeNodeFilterProp:f,display:g,style:b,isEnd:m,showLine:v}=e,y=Fu(e,["eventKey","expanded","selected","checked","halfChecked","loading","active","level","empty","filtered","treeNodeFilterProp","display","style","isEnd","showLine"]);if(u)return this.renderEmptyNode();const{multiple:w,draggable:E,renderFullLabel:S,dragOverNodeKey:x,dropPosition:_,labelEllipsis:P}=this.context,I=m[m.length-1],O=this.isDisabled(),F=x===t&&_===0,D=x===t&&_===-1,$=x===t&&_===1,L=T(re,{[`${re}-level-${d+1}`]:!0,[`${re}-fullLabel-level-${d+1}`]:S,[`${re}-collapsed`]:!n,[`${re}-disabled`]:!!O,[`${re}-selected`]:s,[`${re}-active`]:!w&&l,[`${re}-ellipsis`]:P,[`${re}-drag-over`]:!O&&F,[`${re}-draggable`]:!O&&E&&!S,[`${re}-fullLabel-draggable`]:!O&&E&&S,[`${re}-fullLabel-drag-over-gap-top`]:!O&&D&&S,[`${re}-fullLabel-drag-over-gap-bottom`]:!O&&$&&S,[`${re}-tree-node-last-leaf`]:I}),N={onClick:this.onClick,onContextMenu:this.onContextMenu,onDoubleClick:this.onDoubleClick,className:L,onExpand:this.onExpand,data:y.data,level:d,onCheck:this.onCheck,style:b,expandIcon:this.renderArrow(),checkStatus:{checked:i,halfChecked:a},expandStatus:{expanded:n,loading:o},filtered:h,searchWord:y.keyword},J={onDoubleClick:this.onDoubleClick,onDragStart:E?this.onDragStart:void 0,onDragEnter:E?this.onDragEnter:void 0,onDragOver:E?this.onDragOver:void 0,onDragLeave:E?this.onDragLeave:void 0,onDrop:E?this.onDrop:void 0,onDragEnd:E?this.onDragEnd:void 0,draggable:!O&&E||void 0};if(S){const H=S(Object.assign({},N));return E?p.cloneElement(H,Object.assign({ref:this.setRef},J)):Me(b)?H:p.cloneElement(H,{style:Object.assign(Object.assign({},se(H,["props","style"])),b)})}const z=T(`${re}-label`,{[`${re}-drag-over-gap-top`]:!O&&D,[`${re}-drag-over-gap-bottom`]:!O&&$}),V=se(y,["data","children","length"]),G=_e(y.pos)?Number(y.pos.split("-")[d+1])+1:1;return p.createElement("li",Object.assign({className:L,role:"treeitem","aria-disabled":O,"aria-checked":i,"aria-selected":s,"aria-setsize":V,"aria-posinset":G,"aria-expanded":n,"aria-level":d+1,"data-key":t,onClick:this.onClick,onKeyPress:this.handleliEnterPress,onContextMenu:this.onContextMenu,onDoubleClick:this.onDoubleClick,ref:this.setRef,style:b},J),p.createElement(Tu,{showLine:v,prefixcls:re,level:d,isEnd:m}),this.renderArrow(),p.createElement("span",{className:z},w?this.renderCheckbox():null,this.renderIcon(),p.createElement("span",{className:`${re}-label-text`},this.renderRealLabel())))}}yn.contextType=or;yn.propTypes={expanded:c.bool,selected:c.bool,checked:c.bool,halfChecked:c.bool,active:c.bool,disabled:c.bool,loaded:c.bool,loading:c.bool,isLeaf:c.bool,pos:c.string,children:c.oneOfType([c.array,c.object]),icon:c.node,directory:c.bool,keyword:c.string,treeNodeFilterProp:c.string,selectedKey:c.string,motionKey:c.oneOfType([c.string,c.arrayOf(c.string)]),isEnd:c.arrayOf(c.bool),showLine:c.bool,expandIcon:c.oneOfType([c.node,c.func])};yn.defaultProps={selectedKey:"",motionKey:""};var Du=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};function Ru(r){const{open:e,children:t}=r,n=Du(r,["open","children"]),[s,i]=C.useState(r.open);return C.useEffect(()=>{setTimeout(()=>{i(!r.open)},0)},[]),p.createElement(zo,Object.assign({},n,{isOpen:s}),t)}const Zr=r=>r.key;class yo extends C.PureComponent{constructor(e){super(e),this.onMotionEnd=()=>{typeof this.props.onMotionEnd=="function"&&this.props.onMotionEnd(),this.setState({transitionNodes:[]})},this.state={transitionNodes:[]}}static getDerivedStateFromProps(e,t){const{flattenNodes:n=[],motionKeys:s,motionType:i,flattenList:a=[]}=e,o=!pt(t.cachedMotionKeys,s)||!pt(t.cachedData.map(b=>b.key),n.map(b=>b.key)),l=[...s];if(!o||!l.length)return null;const d=[],u=[];let h=0,f={};return(i==="hide"&&a?a:n).forEach((b,m)=>{const v=Zr(b);s.has(v)?(u.push(b),v===l[0]&&(h=m)):d.push(b)}),d.splice(h,0,u),f={transitionNodes:d,cachedData:n,cachedMotionKeys:s,cachedMotionType:i},f}render(){const{flattenNodes:e,motionType:t,searchTargetIsDeep:n,renderTreeNode:s}=this.props,{transitionNodes:i}=this.state;return(i.length&&!n?i:e).map(l=>{const d=Array.isArray(l);if(d&&!l.length)return null;if(d&&l.length){const u=Zr(l[0]);return p.createElement(Ru,{open:t==="hide",duration:200,motion:!!t,key:`motion-${u}`,onMotionEnd:this.onMotionEnd},l.map(h=>s(h)))}return s(l)})}}yo.contextType=or;const bo={PREFIX:`${be}-tree-select`,PREFIX_TREE:`${be}-tree`},qe={SIZE_SET:["small","large","default"],SEARCH_POSITION_DROPDOWN:"dropdown",SEARCH_POSITION_TRIGGER:"trigger",STATUS:Bi};class ku extends Ye{constructor(e){super(Object.assign({},e)),this.handleKeyDown=t=>{t.key===ga&&this.getState("isOpen")&&this.close(t)},this._registerClickOutsideHandler=()=>{this._adapter.registerClickOutsideHandler(t=>{this.handlerTriggerBlur(t),this.close(t)})},this.clearInputValue=()=>{const{inputValue:t}=this.getStates();t&&this._adapter.updateInputValue("")},this.onClickSingleTriggerSearchItem=t=>{this.focusInput(!0)}}init(){const{searchAutoFocus:e,searchPosition:t,filterTreeNode:n}=this.getProps(),s=t===qe.SEARCH_POSITION_TRIGGER&&n,i=e&&s;this._setDropdownWidth();const a=!this._isDisabled();(this.getProp("defaultOpen")||i)&&a&&(this.open(),this._registerClickOutsideHandler()),i&&a&&this.handleTriggerFocus(null)}destroy(){this._adapter.unregisterClickOutsideHandler()}_setDropdownWidth(){const{style:e,dropdownMatchSelectWidth:t}=this.getProps();let n;t&&(e&&tt(e.width)||e&&_e(e.width)&&!e.width.includes("%")?n=e.width:n=this._adapter.getTriggerWidth(),this._adapter.setOptionWrapperWidth(n))}_isMultiple(){return this.getProp("multiple")}_isAnimated(){return this.getProp("motionExpand")}_isDisabled(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.getProp("disabled")||e.disabled}_isExpandControlled(){return this.getProp("expandedKeys")}_isSelectToClose(){return!this.getProp("expandAction")}_isLoadControlled(){return this.getProp("loadedKeys")}_showFilteredOnly(){const{inputValue:e}=this.getStates(),{showFilteredOnly:t}=this.getProps();return!!e&&t}findDataForValue(e){const{value:t,defaultValue:n,keyMaps:s}=this.getProps(),i=se(s,"value","value"),a=se(s,"key","key");let o=[];return t?o=Array.isArray(t)?t:[t]:n&&(o=Array.isArray(n)?n:[n]),o.find(l=>l[i]===e||l[a]===e)}constructDataForValue(e){const{treeNodeLabelProp:t,keyMaps:n}=this.getProps(),s=se(n,"key","key"),i=se(n,"label",t);return{[s]:e,[i]:e}}getDataForKeyNotInKeyEntities(e){const{onChangeWithObject:t}=this.getProps();return t?this.findDataForValue(e):this.constructDataForValue(e)}getTreeNodeProps(e){const{expandedKeys:t=new Set([]),selectedKeys:n=[],checkedKeys:s=new Set([]),halfCheckedKeys:i=new Set([]),realCheckedKeys:a=new Set([]),keyEntities:o={},filteredKeys:l=new Set([]),inputValue:d="",loadedKeys:u,loadingKeys:h,filteredExpandedKeys:f=new Set([]),disabledKeys:g=new Set([])}=this.getStates(),{treeNodeFilterProp:b,checkRelation:m}=this.getProps(),v=o[e];if(!v)return null;let w=!1,E=!1;m==="related"?(w=s.has(e),E=i.has(e)):m==="unRelated"&&(w=a.has(e),E=!1);const x={eventKey:e,expanded:!!d?f.has(e):t.has(e),selected:n.includes(e),checked:w,halfChecked:E,pos:String(v?v.pos:""),level:v.level,filtered:l.has(e),keyword:d,treeNodeFilterProp:b,loading:h.has(e)&&!u.has(e),loaded:u.has(e)};return this.getProp("disableStrictly")&&g.has(e)&&(x.disabled=!0),x}handleNodeLoad(e,t,n,s){const{loadData:i}=this.getProps(),{key:a}=n;return!i||e.has(a)||t.has(a)?{}:(i(n).then(()=>{const o=new Set(this.getState("loadedKeys")),l=new Set(this.getState("loadingKeys")),d=o.add(a),u=new Set([...l]);u.delete(a),this._adapter.notifyLoad(d,n),this._isLoadControlled()||this._adapter.updateState({loadedKeys:d}),this._adapter.setState({loadingKeys:u}),s()}),{loadingKeys:t.add(a)})}focusInput(e){this._adapter.updateInputFocus(e)}_notifyMultipleChange(e,t){const{keyEntities:n}=this.getStates(),{leafOnly:s,checkRelation:i,keyMaps:a,autoMergeValue:o}=this.getProps();let l=[];i==="related"?l=o?Ct(e,n,s,!0):e:i==="unRelated"&&(l=e);const d=l.map(u=>n[u]&&n[u].key===u?n[u].data:this.getDataForKeyNotInKeyEntities(u));if(this.getProp("onChangeWithObject"))this._adapter.notifyChangeWithObject(d,t);else{const u=Oi(d,a);this._adapter.notifyChange(u,d,t)}}_notifyChange(e,t){const{keyEntities:n}=this.getStates(),{keyMaps:s}=this.getProps();if(this._isMultiple()&&Array.isArray(e))this._notifyMultipleChange(e,t);else{const i=me(e)?e:n[e].data,a=me(e)?e:Oi(i,s);this.getProp("onChangeWithObject")?this._adapter.notifyChangeWithObject(i,t):this._adapter.notifyChange(a,i,t)}}_notifyFocus(e){this._adapter.notifyFocus(e)}handleTriggerFocus(e){this._adapter.updateIsFocus(!0),this._notifyFocus(e),this._registerClickOutsideHandler()}_notifyBlur(e){this._adapter.notifyBlur(e)}handlerTriggerBlur(e){this.getState("isFocus")&&(this._adapter.updateIsFocus(!1),this._notifyBlur(e),this._adapter.unregisterClickOutsideHandler())}toggleHoverState(e){this._adapter.toggleHovering(e)}open(){this._adapter.openMenu(),this._setDropdownWidth()}close(e){this._adapter.closeMenu(),this.getProp("motionExpand")&&this._adapter.updateState({motionKeys:new Set([])})}handleClick(e){const t=this._isDisabled(),{isOpen:n,inputValue:s,isFocus:i}=this.getStates(),{searchPosition:a,clickTriggerToHide:o}=this.getProps();if(!t)if(i||this.handleTriggerFocus(e),n){if(a==="trigger"&&s)return;o&&this.close(e)}else this.open()}handleSelectionEnterPress(e){Ht(e)&&this.handleClick(e)}handleClear(e){const{searchPosition:t,filterTreeNode:n}=this.getProps(),{inputValue:s,selectedKeys:i}=this.getStates(),a=this._isMultiple(),o=this._isControlledComponent(),l=a?[]:void 0;this._notifyChange(l,e),o||(this._adapter.rePositionDropdown(),this._adapter.updateState({selectedKeys:[],checkedKeys:new Set,halfCheckedKeys:new Set,realCheckedKeys:new Set([])})),n&&t===qe.SEARCH_POSITION_TRIGGER&&s!==""&&(Me(i)?this.handleInputChange(""):this.clearInput()),this._adapter.notifyClear(e)}handleClearEnterPress(e){Ht(e)&&this.handleClear(e)}removeTag(e){const{disableStrictly:t,checkRelation:n,keyMaps:s}=this.getProps(),{keyEntities:i,disabledKeys:a,realCheckedKeys:o}=this.getStates(),l=i[e]&&i[e].key===e?i[e].data:this.getDataForKeyNotInKeyEntities(e),d=se(s,"disabled","disabled");if(!(l[d]||t&&a.has(e))){if(n==="unRelated"){const u=new Set(o);u.delete(e),this._notifyChange([...u],null),this._isControlledComponent()||(this._adapter.updateState({realCheckedKeys:u}),this._adapter.rePositionDropdown())}else if(n==="related"){const{checkedKeys:u,halfCheckedKeys:h}=this.calcCheckedKeys(e,!1);this._notifyChange([...u],null),this._isControlledComponent()||(this._adapter.updateState({checkedKeys:u,halfCheckedKeys:h}),this._adapter.rePositionDropdown())}this._adapter.notifySelect(e,!1,l),this._adapter.rePositionDropdown()}}clearInput(){const{flattenNodes:e,expandedKeys:t,selectedKeys:n,keyEntities:s,treeData:i}=this.getStates(),{keyMaps:a}=this.getProps(),o=new Set(t);this._isExpandControlled();const l=_s(n,s,!1);l.forEach(u=>o.add(u));const d=qt(i,o,a);this._adapter.updateState({expandedKeys:o,flattenNodes:d,inputValue:"",motionKeys:new Set([]),filteredKeys:new Set([]),filteredExpandedKeys:new Set(l),filteredShownKeys:new Set([])}),this._adapter.rePositionDropdown()}handleInputChange(e){this._adapter.updateInputValue(e);const{flattenNodes:t,expandedKeys:n,selectedKeys:s,keyEntities:i,treeData:a}=this.getStates(),{showFilteredOnly:o,filterTreeNode:l,treeNodeFilterProp:d,keyMaps:u,remote:h}=this.getProps();if(h){this._adapter.notifySearch(e,[],[]),this._adapter.rePositionDropdown();return}const f=d!=="label"?d:se(u,"label","label"),g=new Set(n);let b=[],m=[],v=[],y=[],w=new Set([]);if(!e)v=_s(s,i,!1),v.forEach(S=>g.add(S)),y=qt(a,g,u);else{const S=Object.values(i).filter(_=>{const{data:P}=_;return rl(e,P,l,f)});b=S.map(_=>_.data),m=S.map(_=>_.key),v=_s(m,i,!1);const x=Vn(m,i,!0);w=new Set([...x,...v]),y=qt(a,new Set(v),u,o&&w)}const E=new Set(v);this._adapter.notifySearch(e,Array.from(E),b),this._adapter.updateState({expandedKeys:g,flattenNodes:y,motionKeys:new Set([]),filteredKeys:new Set(m),filteredExpandedKeys:E,filteredShownKeys:w}),this._adapter.rePositionDropdown()}handleNodeSelect(e,t){this._isDisabled(t)||(this._isMultiple()?this.handleMultipleSelect(e,t):this.handleSingleSelect(e,t))}handleSingleSelect(e,t){let n=[...this.getState("selectedKeys")];const{clickToHide:s}=this.getProps(),{selected:i,eventKey:a,data:o}=t;this._adapter.notifySelect(a,!0,o),!n.includes(a)&&!i&&(n=[a],this._notifyChange(a,e),this._isControlledComponent()||this._adapter.updateState({selectedKeys:n})),s&&(this._isSelectToClose()||!o.children)&&(this.close(e),this.handlerTriggerBlur(e))}calcCheckedKeys(e,t){const{keyEntities:n}=this.getStates(),s=new Set(this.getState("checkedKeys")),i=new Set(this.getState("halfCheckedKeys"));return t?Ea(e,n,s,i):xa(e,n,s,i)}handleMultipleSelect(e,t){const{searchPosition:n,disableStrictly:s,checkRelation:i}=this.getProps(),{inputValue:a,realCheckedKeys:o}=this.getStates(),{checked:l,eventKey:d,data:u}=t;if(i==="related"){const h=s?this.calcCheckedStatus(!l,d):!l,{checkedKeys:f,halfCheckedKeys:g}=s?this.calcNonDisabledCheckedKeys(d,h):this.calcCheckedKeys(d,h);this._adapter.notifySelect(d,h,u),this._notifyChange([...f],e),this._isControlledComponent()||(this._adapter.updateState({checkedKeys:f,halfCheckedKeys:g}),this._adapter.rePositionDropdown())}else if(i==="unRelated"){const h=new Set(o);let f;o.has(d)?(h.delete(d),f=!1):(h.add(d),f=!0),this._adapter.notifySelect(d,f,u),this._notifyChange([...h],e),this._isControlledComponent()||(this._adapter.updateState({realCheckedKeys:h}),this._adapter.rePositionDropdown())}n===qe.SEARCH_POSITION_TRIGGER&&a!==""&&this._adapter.updateState({inputValue:""})}calcNonDisabledCheckedKeys(e,t){const{keyEntities:n,disabledKeys:s}=this.getStates(),i=new Set(this.getState("checkedKeys")),a=Ct(Vn([e],n,!1),n,!0);if(!a.some(u=>s.has(u)))return this.calcCheckedKeys(e,t);const l=a.filter(u=>!s.has(u)),d=t?[...l,...i]:wa(Ct([...i],n,!0,!0),l);return $s(d,n)}calcCheckedStatus(e,t){if(!e)return e;const{checkedKeys:n,keyEntities:s,disabledKeys:i}=this.getStates(),a=Ct(Vn([t],s,!1),s,!0);return a.some(u=>i.has(u))?!a.filter(u=>!i.has(u)).every(u=>n.has(u)):e}handleNodeExpandInSearch(e,t){const{treeData:n,filteredShownKeys:s,keyEntities:i}=this.getStates(),{keyMaps:a}=this.getProps(),o=this._showFilteredOnly(),l=new Set(this.getState("filteredExpandedKeys"));let d="show";const{eventKey:u,expanded:h,data:f}=t;if(h?l.has(u)&&(l.delete(u),d="hide"):l.add(u),this._adapter.cacheFlattenNodes(d==="hide"&&this._isAnimated()),!this._isExpandControlled()){const g=qt(n,l,a,o&&s),b=this._isAnimated()?fr(u,l,i):[],m={filteredExpandedKeys:l,flattenNodes:g,motionKeys:new Set(b),motionType:d};this._adapter.updateState(m)}this._adapter.notifyExpand(l,{expanded:!h,node:f})}handleNodeExpand(e,t){const{loadData:n,keyMaps:s}=this.getProps(),{inputValue:i,keyEntities:a}=this.getStates(),o=!!i;if(!n&&(!t.children||!t.children.length))return;const l=this._isExpandControlled();if(o){this.handleNodeExpandInSearch(e,t);return}const{treeData:d}=this.getStates(),u=new Set(this.getState("expandedKeys"));let h="show";const{eventKey:f,expanded:g,data:b}=t;if(g?u.has(f)&&(u.delete(f),h="hide"):u.add(f),this._adapter.cacheFlattenNodes(h==="hide"&&this._isAnimated()),!l){const m=qt(d,u,s),v=this._isAnimated()?fr(f,u,a):[],y={expandedKeys:u,flattenNodes:m,motionKeys:new Set(v),motionType:h};this._adapter.updateState(y)}this._adapter.notifyExpand(u,{expanded:!g,node:b})}getRenderTextInSingle(){const{renderSelectedItem:e,treeNodeLabelProp:t,keyMaps:n}=this.getProps(),{selectedKeys:s,keyEntities:i}=this.getStates(),a=se(n,"label",t),o=Le(e)?e:u=>se(u,a,null);let l;if(s.length){const u=s[0];l=i[u]&&i[u].key===u?i[u].data:this.getDataForKeyNotInKeyEntities(u)}return l?o(l):null}handleInputTriggerBlur(){this._adapter.updateState({inputTriggerFocus:!1})}handleInputTriggerFocus(){this.clearInput(),this._adapter.updateState({inputTriggerFocus:!0})}setLoadKeys(e,t){this._adapter.updateLoadKeys(e,t)}handlePopoverVisibleChange(e){const{filterTreeNode:t,searchAutoFocus:n,searchPosition:s}=this.getProps();e===!1&&t&&this.clearInputValue(),t&&s===qe.SEARCH_POSITION_DROPDOWN&&e&&n&&this.focusInput(!0)}handleAfterClose(){const{filterTreeNode:e}=this.getProps();e&&this.clearInput()}}var Au=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const Y=bo.PREFIX,Xt=bo.PREFIX_TREE,Lu=0;class _n extends Be{constructor(e){super(e),this.renderSuffix=()=>{const{suffix:t}=this.props,n=T({[`${Y}-suffix`]:!0,[`${Y}-suffix-text`]:t&&_e(t),[`${Y}-suffix-icon`]:Sn(t)});return p.createElement("div",{className:n,"x-semi-prop":"suffix"},t)},this.renderPrefix=()=>{const{prefix:t,insetLabel:n,insetLabelId:s}=this.props,i=t||n,a=T({[`${Y}-prefix`]:!0,[`${Y}-inset-label`]:n,[`${Y}-prefix-text`]:i&&_e(i),[`${Y}-prefix-icon`]:Sn(i)});return p.createElement("div",{className:a,id:s,"x-semi-prop":"prefix,insetLabel"},i)},this.renderContent=()=>{const{dropdownMinWidth:t}=this.state,{dropdownStyle:n,dropdownClassName:s}=this.props,i=Object.assign({minWidth:t},n),a=T(s,`${Y}-popover`);return p.createElement("div",{className:a,style:i,onKeyDown:this.foundation.handleKeyDown,ref:this.optionContainerEl},this.renderTree())},this.removeTag=t=>{this.foundation.removeTag(t)},this.handleClick=t=>{this.foundation.handleClick(t)},this.getDataForKeyNotInKeyEntities=t=>this.foundation.getDataForKeyNotInKeyEntities(t),this.handleSelectionEnterPress=t=>{this.foundation.handleSelectionEnterPress(t)},this.hasValue=()=>{const{multiple:t,checkRelation:n}=this.props,{realCheckedKeys:s,checkedKeys:i,selectedKeys:a}=this.state;let o=!1;return t?n==="related"?o=!!i.size:n==="unRelated"&&(o=!!s.size):o=!!a.length,o},this.showClearBtn=()=>{const{showClear:t,disabled:n,searchPosition:s}=this.props,{inputValue:i,isOpen:a,isHovering:o}=this.state,l=s===qe.SEARCH_POSITION_TRIGGER&&i;return t&&(this.hasValue()||l)&&!n&&(a||o)},this.renderTagList=t=>{const{keyEntities:n,disabledKeys:s}=this.state,{treeNodeLabelProp:i,leafOnly:a,disabled:o,disableStrictly:l,size:d,renderSelectedItem:u,keyMaps:h}=this.props,f=se(h,"label",i),g=Le(u)?u:m=>({isRenderInTag:!0,content:se(m,f,null)}),b=[];return t.forEach((m,v)=>{const y=n[m]&&n[m].key===m?n[m].data:this.getDataForKeyNotInKeyEntities(m),w=(P,I)=>{I&&typeof I.preventDefault=="function"&&I.preventDefault(),this.removeTag(m)},{content:E,isRenderInTag:S}=y?g(y,{index:v,onClose:w}):{};if(Wn(E)||me(E))return;const _={closable:!(o||y.disabled||l&&s.has(y.key)),color:"white",visible:!0,onClose:w,key:`tag-${m}-${v}`,size:d==="small"?"small":"large"};S?b.push(p.createElement(Pt,Object.assign({},_),E)):b.push(E)}),b},this.renderSingleTriggerSearchItem=()=>{const{placeholder:t,disabled:n}=this.props,{inputTriggerFocus:s}=this.state,i=this.foundation.getRenderTextInSingle(),a=T(`${Y}-selection-TriggerSearchItem`,{[`${Y}-selection-TriggerSearchItem-placeholder`]:(s||!i)&&!n,[`${Y}-selection-TriggerSearchItem-disabled`]:n});return p.createElement("span",{className:a,onClick:this.foundation.onClickSingleTriggerSearchItem},i||t)},this.renderSingleTriggerSearch=()=>{const{inputValue:t}=this.state;return p.createElement(p.Fragment,null,this.renderInput(),!t&&this.renderSingleTriggerSearchItem())},this.renderSelectContent=t=>{const{multiple:n,placeholder:s,maxTagCount:i,searchPosition:a,filterTreeNode:o,showRestTagsPopover:l,restTagsPopoverProps:d}=this.props;if(o&&a===qe.SEARCH_POSITION_TRIGGER)return n?this.renderTagInput(t):this.renderSingleTriggerSearch();if(!n||!this.hasValue()){const f=this.foundation.getRenderTextInSingle(),g=T(`${Y}-selection-content`,{[`${Y}-selection-placeholder`]:!f});return p.createElement("span",{className:g},f||s)}const h=this.renderTagList(t);return p.createElement(Wo,{maxTagCount:i,tagList:h,size:"large",mode:"custom",showPopover:l,popoverProps:d})},this.handleClear=t=>{t&&t.stopPropagation(),this.foundation.handleClear(t)},this.handleClearEnterPress=t=>{t&&t.stopPropagation(),this.foundation.handleClearEnterPress(t)},this.handleMouseOver=t=>{this.foundation.toggleHoverState(!0)},this.handleMouseLeave=t=>{this.foundation.toggleHoverState(!1)},this.search=t=>{const{isOpen:n}=this.state;n||this.foundation.open(),this.foundation.handleInputChange(t)},this.close=()=>{this.foundation.close(null)},this.renderArrow=()=>{const t=this.showClearBtn(),{arrowIcon:n}=this.props;return t?null:n?p.createElement("div",{className:T(`${Y}-arrow`),"x-semi-prop":"arrowIcon"},n):null},this.renderClearBtn=()=>{const t=this.showClearBtn(),{clearIcon:n}=this.props,s=T(`${Y}-clearbtn`);return t?p.createElement("div",{role:"button",tabIndex:0,"aria-label":"Clear TreeSelect value",className:s,onClick:this.handleClear,onKeyPress:this.handleClearEnterPress},n||p.createElement(Ms,null)):null},this.renderSelection=()=>{const t=this.props,{disabled:n,multiple:s,filterTreeNode:i,validateStatus:a,prefix:o,suffix:l,style:d,size:u,insetLabel:h,className:f,placeholder:g,showClear:b,leafOnly:m,searchPosition:v,triggerRender:y,borderless:w,autoMergeValue:E,checkRelation:S,triggerTagWrap:x}=t,_=Au(t,["disabled","multiple","filterTreeNode","validateStatus","prefix","suffix","style","size","insetLabel","className","placeholder","showClear","leafOnly","searchPosition","triggerRender","borderless","autoMergeValue","checkRelation","triggerTagWrap"]),{inputValue:P,selectedKeys:I,checkedKeys:O,keyEntities:F,isFocus:D,realCheckedKeys:$}=this.state,L=!!i,N=typeof y=="function",J=b?{onMouseEnter:K=>this.handleMouseOver(K),onMouseLeave:K=>this.handleMouseLeave(K)}:{},z=v===qe.SEARCH_POSITION_TRIGGER&&L,V=z&&Me(O),G=z&&!Me(O),H=N?T(f):T(Y,{[`${Y}-borderless`]:w,[`${Y}-focus`]:D,[`${Y}-disabled`]:n,[`${Y}-single`]:!s,[`${Y}-multiple`]:s,[`${Y}-multiple-tagInput-empty`]:s&&V,[`${Y}-multiple-tagInput-notEmpty`]:s&&G,[`${Y}-filterable`]:L,[`${Y}-error`]:a==="error",[`${Y}-warning`]:a==="warning",[`${Y}-small`]:u==="small",[`${Y}-large`]:u==="large",[`${Y}-with-prefix`]:o||h,[`${Y}-with-suffix`]:l,[`${Y}-with-suffix`]:l,[`${Y}-triggerTagWrap`]:!!x&&s&&z},f);let j,q=[];s?E?S==="related"?q=Ct([...O],F,m,!0):S==="unRelated"&&(q=[...$]):q=[...O]:q=I,N?j=p.createElement(Ns,{inputValue:P,value:q.map(K=>se(F,[K,"data"])),disabled:n,placeholder:g,onClear:this.handleClear,componentName:"TreeSelect",triggerRender:y,componentProps:Object.assign({},this.props),onSearch:this.search,onRemove:this.removeTag}):j=[p.createElement(C.Fragment,{key:"prefix"},o||h?this.renderPrefix():null),p.createElement(C.Fragment,{key:"selection"},p.createElement("div",{className:`${Y}-selection`},this.renderSelectContent(q))),p.createElement(C.Fragment,{key:"suffix"},l?this.renderSuffix():null),p.createElement(C.Fragment,{key:"clearBtn"},b||z&&P?this.renderClearBtn():null),p.createElement(C.Fragment,{key:"arrow"},this.renderArrow())];const A=n?null:0;return p.createElement("div",Object.assign({role:"combobox","aria-disabled":n,"aria-haspopup":"tree",tabIndex:A,className:H,style:d,ref:this.triggerRef,onClick:this.handleClick,onKeyPress:this.handleSelectionEnterPress,onKeyDown:this.foundation.handleKeyDown,"aria-invalid":this.props["aria-invalid"],"aria-errormessage":this.props["aria-errormessage"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-describedby":this.props["aria-describedby"],"aria-required":this.props["aria-required"]},J,this.getDataAttr(_)),j)},this.renderTagItem=(t,n)=>{const{keyEntities:s,disabledKeys:i}=this.state,{size:a,leafOnly:o,disabled:l,disableStrictly:d,renderSelectedItem:u,treeNodeLabelProp:h,keyMaps:f}=this.props,g=se(f,"label",h),m=Ct([t],s,o,!0).map(O=>s[t]&&s[t].key===t?s[t].data:this.getDataForKeyNotInKeyEntities(t)),v=Oi(m,f),y=T(`${Y}-selection-tag`,{[`${Y}-selection-tag-disabled`]:l}),w=!Me(m)&&!Me(m[0]),E=d&&w&&i.has(m[0].key),S=w&&!m[0].disabled&&!l&&!E,x=(O,F)=>{F.preventDefault(),this.removeTag(t)},_={size:a==="small"?"small":"large",key:`tag-${v}-${n}`,color:"white",className:y,closable:S,onClose:x},P=m[0],I=Le(u)?u:O=>({isRenderInTag:!0,content:se(O,g,null)});if(Le(I)){const{content:O,isRenderInTag:F}=P?I(P,{index:n,onClose:x}):{};return F?p.createElement(Pt,Object.assign({},_),O):O}return p.createElement(Pt,Object.assign({},_),v)},this.renderTagInput=t=>{const{disabled:n,size:s,searchAutoFocus:i,placeholder:a,maxTagCount:o,showRestTagsPopover:l,restTagsPopoverProps:d,searchPosition:u,filterTreeNode:h,preventScroll:f}=this.props,{inputValue:g}=this.state,b=h&&u===qe.SEARCH_POSITION_TRIGGER?i:void 0;return p.createElement(os,{maxTagCount:o,disabled:n,onInputChange:m=>this.search(m),ref:this.tagInputRef,placeholder:a,value:t,inputValue:g,size:s,showRestTagsPopover:l,restTagsPopoverProps:d,autoFocus:b,renderTagItem:(m,v)=>this.renderTagItem(m,v),onRemove:m=>this.removeTag(m),expandRestTagsOnClick:!1,preventScroll:f})},this.renderInput=()=>{const{searchPlaceholder:t,searchRender:n,showSearchClear:s,searchPosition:i,searchAutoFocus:a,multiple:o,disabled:l,preventScroll:d}=this.props,{inputValue:u,inputTriggerFocus:h}=this.state,f=i===qe.SEARCH_POSITION_DROPDOWN,g=T({[`${Xt}-input`]:f,[`${Y}-inputTrigger`]:!f}),b={value:u,className:g,preventScroll:d,onChange:S=>this.search(S)},y=f?{showClear:s,prefix:p.createElement(Go,null)}:{autofocus:a,onFocus:S=>this.foundation.handleInputTriggerFocus(),onBlur:S=>this.foundation.handleInputTriggerBlur(),disabled:l},w=T({[`${Xt}-search-wrapper`]:f,[`${Y}-triggerSingleSearch-wrapper`]:!f&&!o,[`${Y}-triggerSingleSearch-upper`]:!f&&h}),E=typeof n=="function"||typeof n=="boolean";return E&&!n?null:p.createElement("div",{className:w},p.createElement(ut,{componentName:"TreeSelect"},S=>{const x=f?t||S.searchPlaceholder:"";return E?n(Object.assign(Object.assign(Object.assign({},y),b),{placeholder:x})):p.createElement(Qt,Object.assign({"aria-label":"Filter TreeSelect item",ref:this.inputRef,placeholder:x},b,y))}))},this.renderEmpty=()=>{const{emptyContent:t}=this.props;return t===null?null:t?p.createElement(yn,{empty:!0,emptyContent:this.props.emptyContent}):p.createElement(ut,{componentName:"Tree"},n=>p.createElement(yn,{empty:!0,emptyContent:n.emptyText}))},this.onNodeLoad=t=>new Promise(n=>this.foundation.setLoadKeys(t,n)),this.onNodeSelect=(t,n)=>{this.foundation.handleNodeSelect(t,n)},this.onNodeCheck=(t,n)=>{this.foundation.handleNodeSelect(t,n)},this.onNodeExpand=(t,n)=>{this.foundation.handleNodeExpand(t,n)},this.getTreeNodeRequiredProps=()=>{const{expandedKeys:t,selectedKeys:n,checkedKeys:s,halfCheckedKeys:i,keyEntities:a,filteredKeys:o}=this.state;return{expandedKeys:t||new Set,selectedKeys:n||[],checkedKeys:s||new Set,halfCheckedKeys:i||new Set,filteredKeys:o||new Set,keyEntities:a}},this.getTreeNodeKey=t=>{const{data:n}=t,{key:s}=n;return s},this.handlePopoverVisibleChange=t=>{this.foundation.handlePopoverVisibleChange(t)},this.afterClose=()=>{this.foundation.handleAfterClose()},this.renderTreeNode=(t,n,s)=>{const{data:i,key:a}=t,o=this.foundation.getTreeNodeProps(a),{showLine:l}=this.props;if(!o)return null;const d=Sa(t,["key","label","disabled","isLeaf","icon","isEnd"]),{keyMaps:u,expandIcon:h}=this.props,f=i[se(u,"children","children")];return!me(f)&&(d.children=f),p.createElement(yn,Object.assign({},o,i,d,{data:i,style:s,showLine:l,expandIcon:h}))},this.itemKey=(t,n)=>{const{visibleOptions:s}=n;return s[t].key},this.renderNodeList=()=>{const{flattenNodes:t,cachedFlattenNodes:n,motionKeys:s,motionType:i,filteredKeys:a}=this.state,{direction:o}=this.context,{virtualize:l,motionExpand:d}=this.props,u="expandedKeys"in this.props;if(!l||Me(l))return p.createElement(yo,{flattenNodes:t,flattenList:n,motionKeys:d?s:new Set([]),motionType:i,searchTargetIsDeep:u&&d&&Me(s)&&!Me(a),onMotionEnd:this.onMotionEnd,renderTreeNode:this.renderTreeNode});const h={visibleOptions:t,renderOption:this.renderTreeNode};return p.createElement(ar,{defaultHeight:l.height,defaultWidth:l.width},f=>{let{height:g,width:b}=f;return p.createElement(ma,{itemCount:t.length,itemSize:l.itemSize,height:g,width:b,itemKey:this.itemKey,itemData:h,className:`${Xt}-virtual-list`,style:{direction:o}},Xo)})},this.renderTree=()=>{const{keyEntities:t,motionKeys:n,motionType:s,inputValue:i,filteredKeys:a,flattenNodes:o,checkedKeys:l,realCheckedKeys:d}=this.state,{loadData:u,filterTreeNode:h,disabled:f,multiple:g,showFilteredOnly:b,motionExpand:m,outerBottomSlot:v,outerTopSlot:y,expandAction:w,labelEllipsis:E,virtualize:S,optionListStyle:x,searchPosition:_,renderLabel:P,renderFullLabel:I,checkRelation:O,emptyContent:F}=this.props,D=T(`${Xt}-wrapper`),$=!!i&&!a.size,L=Me(o)||b&&$,N=_===qe.SEARCH_POSITION_DROPDOWN,J=T(`${Xt}-option-list ${Xt}-option-list-block`,{[`${Xt}-option-list-hidden`]:F===null&&L});return p.createElement(or.Provider,{value:{loadData:u,treeDisabled:f,motion:m,motionKeys:n,motionType:s,expandAction:w,filterTreeNode:h,keyEntities:t,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeRightClick:M,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,renderTreeNode:this.renderTreeNode,multiple:g,showFilteredOnly:b,isSearching:!!i,renderLabel:P,renderFullLabel:I,labelEllipsis:typeof E>"u"?S:E}},p.createElement("div",{className:D},y,!y&&h&&N&&this.renderInput(),p.createElement("div",{className:J,role:"tree","aria-multiselectable":!!g,style:x},L?this.renderEmpty():g?p.createElement(Oa,{value:Array.from(O==="related"?l:d)},this.renderNodeList()):this.renderNodeList()),v))},this.state={inputTriggerFocus:!1,isOpen:!1,isFocus:!1,rePosKey:Lu,dropdownMinWidth:null,inputValue:"",keyEntities:{},treeData:[],flattenNodes:[],cachedFlattenNodes:void 0,selectedKeys:[],checkedKeys:new Set,halfCheckedKeys:new Set,realCheckedKeys:new Set([]),disabledKeys:new Set,motionKeys:new Set([]),motionType:"hide",expandedKeys:new Set(e.expandedKeys),filteredKeys:new Set,filteredExpandedKeys:new Set,filteredShownKeys:new Set,prevProps:null,isHovering:!1,cachedKeyValuePairs:{},loadedKeys:new Set,loadingKeys:new Set},this.inputRef=p.createRef(),this.tagInputRef=p.createRef(),this.triggerRef=p.createRef(),this.optionsRef=p.createRef(),this.optionContainerEl=p.createRef(),this.clickOutsideHandler=null,this.foundation=new ku(this.adapter),this.treeSelectID=Math.random().toString(36).slice(2),this.onMotionEnd=()=>{this.adapter.rePositionDropdown()}}static getDerivedStateFromProps(e,t){const{prevProps:n,rePosKey:s}=t,{keyMaps:i}=e,a=y=>!n&&y in e||n&&!pt(n[y],e[y]);let o;const l=e.onChangeWithObject;let d=t.keyEntities||{},u=t.cachedKeyValuePairs||{};const h={prevProps:e},f=a("treeData"),g=a("expandedKeys"),b=!!(e.filterTreeNode&&!e.remote&&t.inputValue&&t.inputValue.length);if(f){o=e.treeData,h.treeData=o;const y=al(o,i);h.keyEntities=Object.assign({},y.keyEntities),d=h.keyEntities,h.cachedKeyValuePairs=Object.assign({},y.valueEntities),u=h.cachedKeyValuePairs}o&&e.motion&&!pt(Object.keys(h.keyEntities),Object.keys(t.keyEntities))&&n&&e.motion&&(h.motionKeys=new Set([]),h.motionType=null);const m=f&&e.expandAll;if(b){let y;if(o&&(y=ol({treeData:o,inputValue:t.inputValue,filterTreeNode:e.filterTreeNode,filterProps:e.treeNodeFilterProp,showFilteredOnly:e.showFilteredOnly,keyEntities:h.keyEntities,prevExpandedKeys:[...t.filteredExpandedKeys],keyMaps:i}),h.flattenNodes=y.flattenNodes,h.motionKeys=new Set([]),h.filteredKeys=y.filteredKeys,h.filteredShownKeys=y.filteredShownKeys,h.filteredExpandedKeys=y.filteredExpandedKeys),e.expandedKeys){if(h.filteredExpandedKeys=ei(e.expandedKeys,d,e.autoExpandParent||!n),n&&e.motion){const w=t?t.filteredExpandedKeys:new Set([]);if(!o){const E=gr(w,h.filteredExpandedKeys,d);let{motionKeys:S}=E;const{motionType:x}=E;e.showFilteredOnly&&(S=S.filter(_=>t.filteredShownKeys.has(_))),x==="hide"&&(h.cachedFlattenNodes=fi(t.flattenNodes)),h.motionKeys=new Set(S),h.motionType=x}}h.flattenNodes=qt(o||t.treeData,h.filteredExpandedKeys||t.filteredExpandedKeys,i,e.showFilteredOnly&&t.filteredShownKeys)}}else{if(g||n&&a("autoExpandParent")){if(h.expandedKeys=ei(e.expandedKeys,d,e.autoExpandParent||!n),n&&e.motion&&!o){const{motionKeys:y,motionType:w}=gr(t.expandedKeys,h.expandedKeys,d);h.motionKeys=new Set(y),h.motionType=w,w==="hide"&&(h.cachedFlattenNodes=fi(t.flattenNodes))}}else!n&&(e.defaultExpandAll||e.expandAll)||m?h.expandedKeys=new Set(Object.keys(d)):!n&&e.defaultExpandedKeys?h.expandedKeys=ei(e.defaultExpandedKeys,d):!n&&e.defaultValue?h.expandedKeys=mr(Mt(e.defaultValue,l,i),d,e.multiple,u):!n&&e.value&&(h.expandedKeys=mr(Mt(e.value,l,i),d,e.multiple,u));if(h.expandedKeys||delete h.expandedKeys,o||h.expandedKeys){const y=qt(o||t.treeData,h.expandedKeys||t.expandedKeys,i);h.flattenNodes=y}}const v=e.multiple;if(!v)a("value")?h.selectedKeys=ln(Mt(e.value,l,i),u,v):!n&&e.defaultValue?h.selectedKeys=ln(Mt(e.defaultValue,l,i),u,v):o&&(e.value?h.selectedKeys=ln(Mt(e.value,l,i)||"",u,v):h.selectedKeys=yr(t.selectedKeys,d));else{let y;if(a("value")?y=ln(Mt(e.value,l,i),u,v):!n&&e.defaultValue?y=ln(Mt(e.defaultValue,l,i),u,v):o&&(e.value?y=ln(Mt(e.value,l,i)||[],u,v):y=yr(e.checkRelation==="related"?t.checkedKeys:t.realCheckedKeys,d)),y){if(e.checkRelation==="unRelated")h.realCheckedKeys=new Set(y);else if(e.checkRelation==="related"){const{checkedKeys:w,halfCheckedKeys:E}=$s(y,d);h.checkedKeys=w,h.halfCheckedKeys=E}}}return a("loadedKeys")&&(h.loadedKeys=new Set(e.loadedKeys)),(f||a("value"))&&(h.rePosKey=s+1),o&&e.disableStrictly&&e.checkRelation==="related"&&(h.disabledKeys=_a(d,i)),h}get adapter(){var e=this;const t={updateInputValue:i=>{this.setState({inputValue:i})}},n={registerClickOutsideHandler:i=>{this.adapter.unregisterClickOutsideHandler();const a=o=>{const l=this.triggerRef&&this.triggerRef.current,d=this.optionContainerEl&&this.optionContainerEl.current,u=o.target,h=o.composedPath&&o.composedPath()||[u];d&&(!d.contains(u)||!d.contains(u.parentNode))&&l&&!l.contains(u)&&!(h.includes(l)||h.includes(d))&&i(o)};this.clickOutsideHandler=a,document.addEventListener("mousedown",a,!1)},unregisterClickOutsideHandler:()=>{this.clickOutsideHandler&&(document.removeEventListener("mousedown",this.clickOutsideHandler,!1),this.clickOutsideHandler=null)},rePositionDropdown:()=>{let{rePosKey:i}=this.state;i=i+1,this.setState({rePosKey:i})}},s={updateState:i=>{this.setState(Object.assign({},i))},notifySelect:(i,a,o)=>{this.props.onSelect&&this.props.onSelect(i,a,o)},notifySearch:(i,a,o)=>{this.props.onSearch&&this.props.onSearch(i,a,o)},cacheFlattenNodes:i=>{this.setState({cachedFlattenNodes:i?fi(this.state.flattenNodes):void 0})},notifyLoad:(i,a)=>{const{onLoad:o}=this.props;Le(o)&&o(i,a)},notifyClear:i=>{this.props.onClear&&this.props.onClear(i)}};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},super.adapter),t),n),s),{updateLoadKeys:(i,a)=>{this.setState(o=>{let{loadedKeys:l,loadingKeys:d}=o;return this.foundation.handleNodeLoad(l,d,i,a)})},updateState:i=>{this.setState(Object.assign({},i))},openMenu:()=>{this.setState({isOpen:!0},()=>{this.props.onVisibleChange(!0)})},closeMenu:i=>{this.setState({isOpen:!1},()=>{i&&i(),this.props.onVisibleChange(!1)})},getTriggerWidth:()=>{const i=this.triggerRef.current;return i&&i.getBoundingClientRect().width},setOptionWrapperWidth:i=>{this.setState({dropdownMinWidth:i})},notifyChange:(i,a,o)=>{this.props.onChange&&this.props.onChange(i,a,o)},notifyChangeWithObject:(i,a)=>{this.props.onChange&&this.props.onChange(i,a)},notifyExpand:(i,a)=>{let{expanded:o,node:l}=a;this.props.onExpand&&this.props.onExpand([...i],{expanded:o,node:l}),o&&this.props.loadData&&this.onNodeLoad(l)},notifyFocus:function(){e.props.onFocus&&e.props.onFocus(...arguments)},notifyBlur:function(){e.props.onBlur&&e.props.onBlur(...arguments)},toggleHovering:i=>{this.setState({isHovering:i})},updateInputFocus:i=>{if(i){if(this.inputRef&&this.inputRef.current){const{preventScroll:a}=this.props;this.inputRef.current.focus({preventScroll:a})}this.tagInputRef&&this.tagInputRef.current&&this.tagInputRef.current.focus()}else this.inputRef&&this.inputRef.current&&this.inputRef.current.blur(),this.tagInputRef&&this.tagInputRef.current&&this.tagInputRef.current.blur()},updateIsFocus:i=>{this.setState({isFocus:i})}})}componentDidMount(){this.foundation.init()}componentWillUnmount(){this.foundation.destroy()}render(){const e=this.renderContent(),{motion:t,zIndex:n,mouseLeaveDelay:s,mouseEnterDelay:i,autoAdjustOverflow:a,stopPropagation:o,getPopupContainer:l,dropdownMargin:d,position:u}=this.props,{isOpen:h,rePosKey:f}=this.state,g=this.renderSelection(),b=u||"bottomLeft";return p.createElement(Cn,{stopPropagation:o,getPopupContainer:l,zIndex:n,motion:t,margin:d,ref:this.optionsRef,content:e,visible:h,trigger:"custom",rePosKey:f,position:b,autoAdjustOverflow:a,mouseLeaveDelay:s,mouseEnterDelay:i,onVisibleChange:this.handlePopoverVisibleChange,afterClose:this.afterClose},g)}}_n.__SemiComponentName__="TreeSelect";_n.contextType=en;_n.propTypes={"aria-describedby":c.string,"aria-errormessage":c.string,"aria-invalid":c.bool,"aria-labelledby":c.string,"aria-required":c.bool,borderless:c.bool,loadedKeys:c.arrayOf(c.string),loadData:c.func,onLoad:c.func,arrowIcon:c.node,clearIcon:c.node,defaultOpen:c.bool,defaultValue:c.oneOfType([c.string,c.array,c.object]),defaultExpandAll:c.bool,defaultExpandedKeys:c.array,expandAll:c.bool,disabled:c.bool,disableStrictly:c.bool,filterTreeNode:c.oneOfType([c.func,c.bool]),multiple:c.bool,remote:c.bool,searchPlaceholder:c.string,searchAutoFocus:c.bool,virtualize:c.object,treeNodeFilterProp:c.string,onChange:c.func,onClear:c.func,onSearch:c.func,onSelect:c.func,onExpand:c.func,onChangeWithObject:c.bool,onBlur:c.func,onFocus:c.func,value:c.oneOfType([c.string,c.number,c.array,c.object]),expandedKeys:c.array,autoExpandParent:c.bool,showClear:c.bool,showSearchClear:c.bool,autoAdjustOverflow:c.bool,showFilteredOnly:c.bool,showLine:c.bool,motionExpand:c.bool,emptyContent:c.node,keyMaps:c.object,leafOnly:c.bool,treeData:c.arrayOf(c.shape({key:c.string,value:c.oneOfType([c.string,c.number]),label:c.any})),dropdownClassName:c.string,dropdownStyle:c.object,dropdownMargin:c.oneOfType([c.number,c.object]),motion:c.bool,placeholder:c.string,maxTagCount:c.number,size:c.oneOf(qe.SIZE_SET),className:c.string,style:c.object,treeNodeLabelProp:c.string,suffix:c.node,prefix:c.node,insetLabel:c.node,insetLabelId:c.string,zIndex:c.number,getPopupContainer:c.func,dropdownMatchSelectWidth:c.bool,validateStatus:c.oneOf(qe.STATUS),mouseEnterDelay:c.number,mouseLeaveDelay:c.number,triggerRender:c.func,stopPropagation:c.oneOfType([c.bool,c.string]),outerBottomSlot:c.node,outerTopSlot:c.node,onVisibleChange:c.func,expandAction:c.oneOf(["click","doubleClick",!1]),searchPosition:c.oneOf([qe.SEARCH_POSITION_DROPDOWN,qe.SEARCH_POSITION_TRIGGER]),clickToHide:c.bool,renderLabel:c.func,renderFullLabel:c.func,labelEllipsis:c.bool,optionListStyle:c.object,searchRender:c.oneOfType([c.func,c.bool]),renderSelectedItem:c.func,checkRelation:c.string,"aria-label":c.string,showRestTagsPopover:c.bool,restTagsPopoverProps:c.object,preventScroll:c.bool,clickTriggerToHide:c.bool,autoMergeValue:c.bool,triggerTagWrap:c.bool};_n.defaultProps=kt(_n.__SemiComponentName__,{borderless:!1,searchPosition:qe.SEARCH_POSITION_DROPDOWN,arrowIcon:p.createElement(ba,null),autoExpandParent:!1,autoAdjustOverflow:!0,stopPropagation:!0,motion:!0,motionExpand:!0,expandAll:!1,zIndex:Ls.DEFAULT_Z_INDEX,disableStrictly:!1,multiple:!1,remote:!1,filterTreeNode:!1,size:"default",treeNodeFilterProp:"label",onChangeWithObject:!1,treeNodeLabelProp:"label",dropdownMatchSelectWidth:!0,defaultOpen:!1,showSearchClear:!0,showClear:!1,onVisibleChange:M,expandAction:!1,clickToHide:!0,searchAutoFocus:!1,checkRelation:"related","aria-label":"TreeSelect",showRestTagsPopover:!1,restTagsPopoverProps:{},clickTriggerToHide:!0,autoMergeValue:!0,triggerTagWrap:!1});const Nu=`${be}-upload`,Jr="picture",Qr="list",Mu="none",$u=.95,vo={PREFIX:Nu},ea="auto",ju="custom",te={FILE_STATUS_UPLOADING:"uploading",FILE_STATUS_SUCCESS:"success",FILE_STATUS_UPLOAD_FAIL:"uploadFail",FILE_STATUS_VALIDATING:"validating",FILE_STATUS_VALID_FAIL:"validateFail",FILE_STATUS_WAIT_UPLOAD:"wait",FILE_LIST_PIC:Jr,FILE_LIST_DEFAULT:Qr,LIST_TYPE:[Jr,Qr,Mu],DRAG_AREA_DEFAULT:"default",DRAG_AREA_LEGAL:"legal",DRAG_AREA_ILLEGAL:"illegal",TRIGGER_AUTO:ea,UPLOAD_TRIGGER:[ea,ju],VALIDATE_STATUS:Bi,PROMPT_POSITION:["left","right","bottom"]},Vu={PROGRESS_COEFFICIENT:$u};var Mi=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{d(n.next(u))}catch(h){a(h)}}function l(u){try{d(n.throw(u))}catch(h){a(h)}}function d(u){u.done?i(u.value):s(u.value).then(o,l)}d((n=n.apply(r,e||[])).next())})};const gn=1024,gi=1048576;function $i(r){if(r<gn)return`${(r/gn).toFixed(2)}KB`;if(r>=gn&&r<gi)return`${(r/gn).toFixed(1)}KB`;if(r>=gi)return`${(r/gi).toFixed(1)}MB`}function Ku(r,e){return r.indexOf(e,r.length-e.length)!==-1}function Hu(r){return Mi(this,void 0,void 0,function*(){return new Promise((e,t)=>{const n=r.createReader();let s=[];function i(){n.readEntries(a=>{const o=Array.prototype.slice.apply(a);s=s.concat(o),!o.length?e(s):i()},t)}i()})})}function Bu(r){return Mi(this,void 0,void 0,function*(){const e=[],t=(n,s)=>Mi(this,void 0,void 0,function*(){if(s=s||"",n.path=s,n.isFile)e.push(new Promise((i,a)=>{n.file(o=>{n.fullPath&&!o.webkitRelativePath&&(Object.defineProperties(o,{webkitRelativePath:{writable:!0}}),o.webkitRelativePath=n.fullPath.replace(/^\//,""),Object.defineProperties(o,{webkitRelativePath:{writable:!1}})),i(o)},a)}));else if(n.isDirectory){const i=yield Hu(n);for(let a=0;a<i.length;a++){const o=i[a];yield t(o,`${s}${n.name}/`)}}});try{const n=r.map(i=>t(i.webkitGetAsEntry()));return yield Promise.all(n),yield Promise.all(e)}catch(n){return console.warn("Captured error while loop directory."),console.error(n),[]}})}var Uu=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{d(n.next(u))}catch(h){a(h)}}function l(u){try{d(n.throw(u))}catch(h){a(h)}}function d(u){u.done?i(u.value):s(u.value).then(o,l)}d((n=n.apply(r,e||[])).next())})};const{FILE_STATUS_UPLOADING:ta,FILE_STATUS_SUCCESS:zu,FILE_STATUS_UPLOAD_FAIL:Wu,FILE_STATUS_VALID_FAIL:mi,FILE_STATUS_WAIT_UPLOAD:na,DRAG_AREA_DEFAULT:yi,DRAG_AREA_LEGAL:Xu,TRIGGER_AUTO:Ss}=te;class Gu extends Ye{updateFileListInternal(e,t){this._batchFileList&&(this._batchFileList=e),this._latestFileList=e,this._adapter.updateFileList(e,t)}syncLatestFileList(e){this._latestFileList=e.slice()}getLatestFileList(){return this._batchFileList||this._latestFileList||this.getState("fileList")}constructor(e){super(Object.assign({},e)),this.destroyState=!1,this._localUrls={},this._pasteHandled=!1,this._batchFileList=null,this._latestFileList=null}init(){this.destroyState=!1,this.syncLatestFileList(this.getState("fileList")),this._syncLocalUrlsFromFileList();const{disabled:e,addOnPasting:t}=this.getProps();t&&!e&&this.bindPastingHandler()}_syncLocalUrlsFromFileList(){const{fileList:e}=this.getStates(),t={};if(!Array.isArray(e)){this._localUrls={},this._adapter.updateLocalUrls([]);return}e.forEach(n=>{const s=n&&n.uid,i=n&&n.url,a=n&&n.fileInstance,l=typeof File<"u"&&a instanceof File;s&&typeof i=="string"&&i.startsWith("blob:")&&l&&(t[s]=i)}),this._localUrls=t,this._adapter.updateLocalUrls(Object.values(this._localUrls))}destroy(){const{disabled:e,addOnPasting:t}=this.getProps();e||this.unbindPastingHandler(),this._batchFileList=null,this._latestFileList=null,this.destroyState=!0}_releaseFileUrl(e){if(!e)return;const t=this._localUrls&&this._localUrls[e];if(!t)return;this._releaseBlob(t);const n=Object.assign({},this._localUrls||{});delete n[e],this._localUrls=n,this._adapter.updateLocalUrls(Object.values(this._localUrls))}_releaseAllFileUrls(){const e=this._localUrls;!e||typeof e!="object"||(Object.keys(e).forEach(t=>{const n=e[t];n&&this._releaseBlob(n)}),this._localUrls={},this._adapter.updateLocalUrls([]))}getError(e){let{action:t,xhr:n,message:s,fileName:i}=e;const a=n?n.status:0,o=s||`cannot post ${i} to ${t}, xhr status: ${a}'`,l=new Error(o);return l.status=a,l.method="post",l.url=t,l}getBody(e){if(!e)return;const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch{return t}}checkFileSize(e){const{size:t}=e,{maxSize:n,minSize:s}=this.getProps();let i=!1;return(t>n*gn||t<s*gn)&&(i=!0),i}handleChange(e){const t=[],{limit:n,transformFile:s,accept:i}=this.getProps(),{fileList:a}=this.getStates();let o=Array.from(e);if(typeof i<"u"&&(o=o.filter(d=>{const u=this.checkFileFormat(i,d);return u||t.push(d),u}),t.length!==0&&this._adapter.notifyAcceptInvalid(t),o.length===0))return;o=o.map(d=>(s&&(d=s(d)),d.uid||(d.uid=Es()),this.checkFileSize(d)&&(d._sizeInvalid=!0,d.status=mi,this._adapter.notifySizeError(d,a)),d));const l=a.length+o.length;if(typeof n<"u"&&l>n){if(this._adapter.notifyExceed(o),n===1){o=o.slice(-1),this._adapter.notifyFileSelect(o),this._adapter.resetInput(),this.replaceFileList(o);return}const d=n-a.length;o=o.slice(0,d)}this._adapter.notifyFileSelect(o),this._adapter.resetInput(),this.addFilesToList(o)}handleReplaceChange(e){if(e.length===0)return;const{transformFile:t,uploadTrigger:n,accept:s}=this.getProps(),{replaceIdx:i,fileList:a}=this.getStates();let o=Array.from(e).pop();if(typeof s<"u"&&!this.checkFileFormat(s,o)){this._adapter.notifyAcceptInvalid([o]);return}t&&(o=t(o)),o.uid||(o.uid=Es()),this.checkFileSize(o)&&(o._sizeInvalid=!0,o.status=mi,this._adapter.notifySizeError(o,a)),this._adapter.notifyFileSelect([o]);const l=this.buildFileItem(o,n),d=[...a],u=d[i];u&&u.uid&&this._releaseFileUrl(u.uid),d.splice(i,1,l),this._adapter.notifyChange({currentFile:l,fileList:d}),this.updateFileListInternal(d,()=>{this._adapter.resetReplaceInput(),l._sizeInvalid||this.upload(l)})}buildFileItem(e,t){const{_sizeInvalid:n,status:s}=e;try{delete e._sizeInvalid,delete e.status}catch{}const i={status:s||(t===Ss?ta:na),name:e.name,size:$i(e.size),uid:e.uid,percent:0,fileInstance:e,url:this._createURL(e,e.uid)};return n&&(i._sizeInvalid=!0),this.isImage(e)&&(i.preview=!0),i}replaceFileList(e){const{uploadTrigger:t}=this.getProps(),n=e.map(s=>this.buildFileItem(s,t));this._adapter.notifyChange({fileList:n,currentFile:n[0]}),this.updateFileListInternal(n,()=>{t===Ss&&this.startUpload(n)})}addFilesToList(e){const t=this.getState("fileList").slice(),{uploadTrigger:n}=this.getProps(),s=e.map(i=>this.buildFileItem(i,n));s.forEach(i=>{const a=t.findIndex(o=>o.uid===i.uid);a!==-1?t[a]=i:(t.push(i),this._adapter.notifyChange({fileList:t,currentFile:i}))}),this.updateFileListInternal(t,()=>{n===Ss&&this.startUpload(s)})}insertFileToList(e,t){const{limit:n,transformFile:s,accept:i,uploadTrigger:a}=this.getProps(),{fileList:o}=this.getStates(),l=[];let d=Array.from(e);if(typeof i<"u"&&(d=d.filter(g=>{const b=this.checkFileFormat(i,g);return b||l.push(g),b}),l.length!==0&&this._adapter.notifyAcceptInvalid(l),d.length===0))return;d=d.map(g=>(g.uid||(g.uid=Es()),this.checkFileSize(g)&&(g._sizeInvalid=!0,g.status=mi,this._adapter.notifySizeError(g,o)),s&&(g=s(g)),g));const u=o.length+d.length;if(typeof n<"u"&&u>n){if(n===1){d=d.slice(-1),this._adapter.notifyFileSelect(d),this._adapter.resetInput(),this.replaceFileList(d);return}const g=n-o.length;d=d.slice(0,g),this._adapter.notifyExceed(d)}const h=d.map(g=>this.buildFileItem(g,a)),f=o.slice();typeof t<"u"?f.splice(t,0,...h):f.push(...h),this._adapter.notifyFileSelect(d),this._adapter.notifyChange({fileList:f,currentFile:null}),this.updateFileListInternal(f,()=>{a===Ss&&this.startUpload(h)})}manualUpload(){const e=this.getLatestFileList().filter(t=>t.status===na);this.startUpload(e)}startUpload(e){this._batchFileList=this.getLatestFileList().slice();try{e.forEach(t=>{t._sizeInvalid||this.upload(t)})}finally{this._batchFileList=null}}upload(e){const{beforeUpload:t}=this.getProps();if(typeof t>"u"){this.post(e);return}if(typeof t=="function"){const n=this.getLatestFileList(),s=this._adapter.notifyBeforeUpload({file:e,fileList:n});switch(!0){case s===!0:{this.post(e);break}case s===!1:{const i={shouldUpload:!1,status:te.FILE_STATUS_VALID_FAIL};this.handleBeforeUploadResultInObject(i,e);break}case(s&&zi(s)):{Promise.resolve(s).then(i=>{let a={shouldUpload:!0};Object.prototype.toString.call(i).slice(8,-1)==="Object"&&(a=Object.assign(Object.assign({},a),i)),this.handleBeforeUploadResultInObject(a,e)},i=>{let a={shouldUpload:!1,status:te.FILE_STATUS_VALID_FAIL};Object.prototype.toString.call(i).slice(8,-1)==="Object"&&(a=Object.assign(Object.assign({},a),i)),this.handleBeforeUploadResultInObject(a,e)});break}case typeof s=="object":this.handleBeforeUploadResultInObject(s,e);break}}}handleBeforeUploadResultInObject(e,t){const{shouldUpload:n,status:s,autoRemove:i,validateMessage:a,fileInstance:o}=e;let l=this.getLatestFileList().slice();if(i)this._releaseFileUrl(t.uid),l=l.filter(d=>d.uid!==t.uid);else{const d=this._getFileIndex(t,l);if(d<0)return;s&&(l[d].status=s),a&&(l[d].validateMessage=a),o&&(o.uid=t.uid,l[d].fileInstance=o,l[d].size=$i(o.size),l[d].name=o.name,this._releaseFileUrl(t.uid),l[d].url=this._createURL(o,t.uid)),l[d].shouldUpload=n}this.updateFileListInternal(l),this._adapter.notifyChange({fileList:l,currentFile:t}),n&&this.post(t)}post(e){const{fileInstance:t}=e,n=this.getProps();if(typeof XMLHttpRequest>"u")return;const s=new XMLHttpRequest,i=new FormData,{action:a}=n;let{data:o}=n;o&&(typeof o=="function"&&(o=o(t)),Object.keys(o).forEach(u=>{i.append(u,o[u])}));const l=n.name||n.fileName||t.name;if(n.customRequest)return n.customRequest({fileName:l,data:o,file:e,fileInstance:t,onProgress:u=>this.handleProgress({e:u,fileInstance:t}),onError:(u,h)=>this.handleError({e:h,xhr:u,fileInstance:t}),onSuccess:(u,h)=>this.handleSuccess({response:u,fileInstance:t,e:h,isCustomRequest:!0}),withCredentials:n.withCredentials,action:n.action});i.append(l,t),s.open("post",a,!0),n.withCredentials&&"withCredentials"in s&&(s.withCredentials=!0),s.upload&&(s.upload.onprogress=u=>{this.destroyState?s.abort():this.handleProgress({e:u,fileInstance:t})}),s.onload=u=>{this.destroyState||this.handleOnLoad({e:u,xhr:s,fileInstance:t})},s.onerror=u=>{this.destroyState||this.handleError({e:u,xhr:s,fileInstance:t})};let d=n.headers||{};typeof d=="function"&&(d=d(t));for(const u in d)Object.prototype.hasOwnProperty.call(d,u)&&d[u]!==null&&s.setRequestHeader(u,d[u]);s.send(i)}handleProgress(e){let{e:t,fileInstance:n}=e;const s=this.getLatestFileList().slice();let i=0;t.total>0&&(i=Number((t.loaded/t.total*100*Vu.PROGRESS_COEFFICIENT).toFixed(0))||0);const a=this._getFileIndex(n,s);a<0||(s[a].percent=i,s[a].status=ta,this._adapter.notifyProgress(i,n,s),this.updateFileListInternal(s),this._adapter.notifyChange({fileList:s,currentFile:s[a]}))}handleOnLoad(e){let{e:t,xhr:n,fileInstance:s}=e;const i=this.getLatestFileList(),a=this._getFileIndex(s,i);a<0||(n.status<200||n.status>=300?this.handleError({e:t,xhr:n,fileInstance:s}):this.handleSuccess({e:t,xhr:n,fileInstance:s,index:a}))}handleSuccess(e){let{e:t,fileInstance:n,isCustomRequest:s=!1,xhr:i,response:a}=e;const o=this.getLatestFileList();let l=null;const d=this._getFileIndex(n,o);if(d<0)return;s?l=a:l=this.getBody(i);const u=o.slice(),{afterUpload:h}=this.getProps();if(u[d].status=zu,u[d].percent=100,this._adapter.notifyProgress(100,n,u),u[d].response=l,t&&(u[d].event=t),h&&typeof h=="function"){const{autoRemove:f,status:g,validateMessage:b,name:m,url:v}=this._adapter.notifyAfterUpload({response:l,file:u[d],fileList:u})||{};g&&(u[d].status=g),b&&(u[d].validateMessage=b),m&&(u[d].name=m),v&&(this._releaseFileUrl(u[d].uid),u[d].url=v),f&&(this._releaseFileUrl(u[d].uid),u.splice(d,1))}this._adapter.notifySuccess(l,n,u),this._adapter.notifyChange({fileList:u,currentFile:u[d]}),this.updateFileListInternal(u)}_getFileIndex(e,t){return t.findIndex(n=>n.uid===e.uid)}handleRemove(e){const{disabled:t}=this.getProps();if(t)return;const{fileList:n}=this.getStates();Promise.resolve(this._adapter.notifyBeforeRemove(e,n)).then(s=>{if(s===!1)return;const i=n.slice(),a=this._getFileIndex(e,n);a<0||(i.splice(a,1),this._releaseFileUrl(e.uid),this._adapter.notifyRemove(e.fileInstance,i,e),this.updateFileListInternal(i),this._adapter.notifyChange({fileList:i,currentFile:e}))})}handleError(e){let{e:t,xhr:n,fileInstance:s}=e;const i=this.getLatestFileList(),a=this._getFileIndex(s,i);if(a<0)return;const{action:o}=this.getProps(),l=i.slice(),d=this.getError({action:o,xhr:n,fileName:s.name});l[a].status=Wu,l[a].response=d,l[a].event=t,this._adapter.notifyError(d,s,l,n),this.updateFileListInternal(l),this._adapter.notifyChange({currentFile:l[a],fileList:l})}handleClear(){const{disabled:e}=this.getProps(),{fileList:t}=this.getStates();e||Promise.resolve(this._adapter.notifyBeforeClear(t)).then(n=>{n!==!1&&(this._releaseAllFileUrls(),this.updateFileListInternal([]),this._adapter.notifyClear(),this._adapter.notifyChange({fileList:[]}))}).catch(n=>{})}_createURL(e,t){const n=URL.createObjectURL(e),s=Object.assign({},this._localUrls||{});return t&&s[t]&&s[t]!==n&&this._releaseBlob(s[t]),t&&(s[t]=n),this._localUrls=s,this._adapter.updateLocalUrls(Object.values(this._localUrls)),n}releaseMemory(){if(this._localUrls&&Object.keys(this._localUrls).length){this._releaseAllFileUrls();return}const{localUrls:e}=this.getStates();if(e){if(Array.isArray(e)){e.forEach(t=>{this._releaseBlob(t)});return}typeof e=="object"&&Object.keys(e).forEach(t=>{const n=e[t];n&&this._releaseBlob(n)})}}_releaseBlob(e){try{URL.revokeObjectURL(e)}catch(t){console.log(t)}}isImage(e){return/(webp|svg|png|gif|jpg|jpeg|bmp|dpg)$/i.test(e.type)}isMultiple(){return!!this.getProp("multiple")}handleDragEnter(e){e.preventDefault(),e.stopPropagation(),this._dragEnterTarget=e.currentTarget;const{disabled:t}=this.getProps();t||this._adapter.updateDragAreaStatus(Xu)}handleDirectoryDrop(e){return Uu(this,void 0,void 0,function*(){const t=this.getState("fileList").slice(),n=[].slice.call(e.dataTransfer.items),s=yield Bu(n);this.handleChange(s),this._adapter.updateDragAreaStatus(yi),this._adapter.notifyDrop(e,s,t)})}handleDrop(e){e.preventDefault(),e.stopPropagation();const{disabled:t,directory:n}=this.getProps(),s=this.getState("fileList").slice();if(!t){if(n){this.handleDirectoryDrop(e);return}const i=Array.from(e.dataTransfer.files);this.handleChange(i),this._adapter.updateDragAreaStatus(yi),this._adapter.notifyDrop(e,i,s)}}handleDragOver(e){e.preventDefault(),e.stopPropagation()}handleDragLeave(e){e.preventDefault(),e.stopPropagation(),this._dragEnterTarget===e.target&&this._adapter.updateDragAreaStatus(yi)}checkFileFormat(e,t){const n=e.split(",").map(a=>a.trim()).filter(a=>a),s=t.type||"",i=s.replace(/\/.*$/,"");return n.some(a=>{if(a.charAt(0)==="."){const o=t.name||"",l=a.split(".").pop().toLowerCase();return Ku(o.toLowerCase(),l)}if(/\/\*$/.test(a)){const o=a.replace(/\/.*$/,"");return i===o}return/^[^\/]+\/[^\/]+$/.test(a)?s===a:!1})}retry(e){const{onRetry:t}=this.getProps();t&&typeof t=="function"&&t(e),this.post(e)}handlePreviewClick(e){this._adapter.notifyPreviewClick(e)}readFileFromClipboard(e){for(const t of e)for(const n of t.types)n.startsWith("image")&&t.getType(n).then(s=>s.arrayBuffer()).then(s=>{const i=n.split("/")[1],a=new File([s],`upload.${i}`,{type:n});this.handleChange([a])})}handlePasting(e){const{addOnPasting:t}=this.getProps();if(!t)return;if(e.type==="paste"&&e.clipboardData&&e.clipboardData.items){const i=e.clipboardData.items,a=[];for(let o=0;o<i.length;o++){const l=i[o];if(l.kind==="file"){const d=l.getAsFile();d&&a.push(d)}}if(a.length>0){e.preventDefault(),this.handleChange(a),this._pasteHandled=!0,setTimeout(()=>{this._pasteHandled=!1},100);return}}if(this._pasteHandled){this._pasteHandled=!1;return}if((this._adapter.isMac()?e.metaKey:e.ctrlKey)&&e.code==="KeyV"){if(!navigator.clipboard||typeof navigator.clipboard.read!="function")return;navigator.permissions.query({name:"clipboard-read"}).then(a=>{a.state==="granted"||a.state==="prompt"?navigator.clipboard.read().then(o=>{this.readFileFromClipboard(o)}).catch(o=>{this._adapter.notifyPastingError(o)}):this._adapter.notifyPastingError(a)}).catch(a=>{this._adapter.notifyPastingError(a)})}}bindPastingHandler(){this._adapter.registerPastingHandler(e=>this.handlePasting(e)),this._adapter.registerPasteEventHandler(e=>this.handlePasting(e))}unbindPastingHandler(){this._adapter.unRegisterPastingHandler(),this._adapter.unRegisterPasteEventHandler()}}class qu extends Ye{constructor(e){super(Object.assign({},e))}handleImageError(e){this._adapter.updateFallbackPreview(!0)}}const le=vo.PREFIX,Yu=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return p.createElement("svg",Object.assign({focusable:!1,"aria-hidden":!0,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r),p.createElement("circle",{cx:"7.99992",cy:"7.99992",r:"6.66667",fill:"white"}),p.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.3332 8.00008C15.3332 12.0502 12.0499 15.3334 7.99984 15.3334C3.94975 15.3334 0.666504 12.0502 0.666504 8.00008C0.666504 3.94999 3.94975 0.666748 7.99984 0.666748C12.0499 0.666748 15.3332 3.94999 15.3332 8.00008ZM8.99984 11.6667C8.99984 11.1145 8.55212 10.6667 7.99984 10.6667C7.44755 10.6667 6.99984 11.1145 6.99984 11.6667C6.99984 12.219 7.44755 12.6667 7.99984 12.6667C8.55212 12.6667 8.99984 12.219 8.99984 11.6667ZM7.99984 3.33341C7.27573 3.33341 6.7003 3.94171 6.74046 4.66469L6.94437 8.33495C6.97549 8.89513 7.4388 9.33341 7.99984 9.33341C8.56087 9.33341 9.02419 8.89513 9.05531 8.33495L9.25921 4.66469C9.29938 3.94171 8.72394 3.33341 7.99984 3.33341Z",fill:"#F93920"}))},Zu=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return p.createElement("svg",Object.assign({focusable:!1,"aria-hidden":!0,width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r),p.createElement("circle",{cx:"14",cy:"14",r:"14",fill:"#16161A",fillOpacity:"0.6"}),p.createElement("path",{d:"M9 10.25V18.25L10.25 13.25H17.875V11.75C17.875 11.4739 17.6511 11.25 17.375 11.25H14L12.75 9.75H9.5C9.22386 9.75 9 9.97386 9 10.25Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{d:"M18 18.25L19 13.25H10.2031L9 18.25H18Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}))},Ju=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return p.createElement("svg",Object.assign({focusable:!1,"aria-hidden":!0,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r),p.createElement("path",{d:"M6 17V7.58824C6 7.26336 6.26863 7 6.6 7H10.5L12 8.76471H16.05C16.3814 8.76471 16.65 9.02806 16.65 9.35294V11.1176H7.5L6 17ZM6 17L7.44375 11.1176H18L16.8 17L6 17Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))};class Gs extends Be{constructor(e){super(e),this.state={fallbackPreview:!1},this.foundation=new qu(this.adapter)}get adapter(){return Object.assign(Object.assign({},super.adapter),{updateFallbackPreview:e=>this.setState({fallbackPreview:e})})}transSize(e){return typeof e=="number"?$i(e):e}renderValidateMessage(){const{status:e,validateMessage:t}=this.props;let n=null;switch(!0){case(typeof t=="string"&&e===te.FILE_STATUS_VALIDATING):n=p.createElement(p.Fragment,null,p.createElement(vn,{size:"small",wrapperClassName:`${le}-file-card-icon-loading`}),t);break;case typeof t=="string":n=p.createElement(p.Fragment,null,p.createElement(Ii,{className:`${le}-file-card-icon-error`}),t);break;case Di(t):n=t;break}return n}renderPicValidateMsg(){const{status:e,validateMessage:t}=this.props;let n=null;switch(!0){case(t&&e===te.FILE_STATUS_VALIDATING):n=p.createElement("span",{className:`${le}-tooltip-children-wrapper ${le}-picture-file-card-icon-loading`},p.createElement(vn,{size:"small"}));break;case(t&&(e===te.FILE_STATUS_VALID_FAIL||e===te.FILE_STATUS_UPLOAD_FAIL)):n=p.createElement("div",{className:`${le}-picture-file-card-icon-error`},p.createElement(Yu,null));break}return n?p.createElement(Ot,{content:t,trigger:"hover",position:"bottom"},n):null}renderPic(e){const{fallbackPreview:t}=this.state,{url:n,percent:s,status:i,disabled:a,style:o,onPreviewClick:l,showPicInfo:d,renderPicInfo:u,renderPicClose:h,renderPicPreviewIcon:f,renderThumbnail:g,name:b,index:m,picHeight:v,picWidth:y}=this.props,w=i===te.FILE_STATUS_UPLOADING&&s!==100,E=i===te.FILE_STATUS_UPLOAD_FAIL&&this.props.showRetry,S=i===te.FILE_STATUS_SUCCESS&&this.props.showReplace,x=i===te.FILE_STATUS_SUCCESS&&!this.props.showReplace,_=typeof g=="function",P=T({[`${le}-picture-file-card`]:!0,[`${le}-picture-file-card-preview-fallback`]:t,[`${le}-picture-file-card-disabled`]:a,[`${le}-picture-file-card-show-pointer`]:typeof l<"u",[`${le}-picture-file-card-error`]:i===te.FILE_STATUS_UPLOAD_FAIL,[`${le}-picture-file-card-uploading`]:w,[`${le}-picture-file-card-custom-thumbnail`]:_&&v&&y}),I=p.createElement("div",{role:"button",tabIndex:0,className:`${le}-picture-file-card-retry`,onClick:V=>this.onRetry(V)},p.createElement(Cl,{className:`${le}-picture-file-card-icon-retry`})),O=p.createElement(Ot,{trigger:"hover",position:"top",content:e.replace,showArrow:!1,spacing:4},p.createElement("div",{role:"button",tabIndex:0,className:`${le}-picture-file-card-replace`,onClick:V=>this.onReplace(V)},p.createElement(Zu,{className:`${le}-picture-file-card-icon-replace`}))),F=p.createElement("div",{className:`${le}-picture-file-card-preview`},typeof f=="function"?f(this.props):null),D=p.createElement(p.Fragment,null,typeof h=="function"?p.createElement(p.Fragment,null,h({className:`${le}-picture-file-card-close`,remove:V=>this.onRemove(V)})):p.createElement("div",{role:"button",tabIndex:0,className:`${le}-picture-file-card-close`,onClick:V=>this.onRemove(V)},p.createElement(Ms,{className:`${le}-picture-file-card-icon-close`}))),$=typeof u=="function"?u(this.props):p.createElement("div",{className:`${le}-picture-file-card-pic-info`},m+1);let L={},N=o?Object.assign({},o):{};v&&(N.height=v,L.height=v),y&&(N.width=y,L.width=y);const z=_?g(this.props):t?p.createElement(Ri,{size:"large"}):p.createElement("img",{src:n,alt:b,onError:V=>this.foundation.handleImageError(V),style:L});return p.createElement("div",{role:"listitem",className:P,style:N,onClick:l},z,w?p.createElement(wr,{percent:s,type:"circle",size:"small",orbitStroke:"#FFF","aria-label":"uploading file progress"}):null,E?I:null,S&&O,x&&F,d&&$,!a&&D,this.renderPicValidateMsg())}renderFile(e){const{name:t,size:n,percent:s,url:i,showRetry:a,showReplace:o,preview:l,previewFile:d,status:u,style:h,onPreviewClick:f,renderFileOperation:g,showTooltip:b}=this.props,{fallbackPreview:m}=this.state,v=T({[`${le}-file-card`]:!0,[`${le}-file-card-fail`]:u===te.FILE_STATUS_VALID_FAIL||u===te.FILE_STATUS_UPLOAD_FAIL,[`${le}-file-card-show-pointer`]:typeof f<"u"}),y=T({[`${le}-file-card-preview`]:!0,[`${le}-file-card-preview-placeholder`]:!l||d||m}),w=`${le}-file-card-info`,E=`${le}-file-card-close`,S=`${le}-file-card-replace`,x=!(s===100||typeof s>"u")&&u===te.FILE_STATUS_UPLOADING,_=u===te.FILE_STATUS_UPLOAD_FAIL&&a,P=u===te.FILE_STATUS_SUCCESS&&o,I=this.transSize(n);let O=l&&!m?p.createElement("img",{src:i,alt:t,onError:D=>this.foundation.handleImageError(D)}):p.createElement(Ri,{size:"large"});d&&(O=d(this.props));const F=typeof g=="function"?g(this.props):p.createElement(Ie,{onClick:D=>this.onRemove(D),type:"tertiary",icon:p.createElement(qo,null),theme:"borderless",size:"small",className:E});return p.createElement("div",{role:"listitem",className:v,style:h,onClick:f},p.createElement("div",{className:y},O),p.createElement("div",{className:`${w}-main`},p.createElement("div",{className:`${w}-main-text`},p.createElement(xs.Text,{className:`${w}-name`,ellipsis:{showTooltip:b}},t),p.createElement("span",null,p.createElement("span",{className:`${w}-size`},I),P&&p.createElement(Ot,{trigger:"hover",position:"top",showArrow:!1,content:e.replace},p.createElement("span",{className:`${le}-tooltip-children-wrapper ${S}`},p.createElement(Ie,{onClick:D=>this.onReplace(D),type:"tertiary",theme:"borderless",size:"small",icon:p.createElement(Ju,null)}))))),x?p.createElement(wr,{percent:s,style:{width:"100%"},"aria-label":"uploading file progress"}):null,p.createElement("div",{className:`${w}-main-control`},p.createElement("span",{className:`${w}-validate-message`},this.renderValidateMessage()),_?p.createElement("span",{role:"button",tabIndex:0,className:`${w}-retry`,onClick:D=>this.onRetry(D)},e.retry):null)),F)}onRemove(e){e.stopPropagation(),this.props.onRemove()}onReplace(e){e.stopPropagation(),this.props.onReplace()}onRetry(e){e.stopPropagation(),this.props.onRetry()}render(){const{listType:e}=this.props;return e===te.FILE_LIST_PIC?p.createElement(ut,{componentName:"Upload"},t=>this.renderPic(t)):e===te.FILE_LIST_DEFAULT?p.createElement(ut,{componentName:"Upload"},t=>this.renderFile(t)):null}}Gs.propTypes={className:c.string,disabled:c.bool,listType:c.string,name:c.string,onPreviewClick:c.func,onRemove:c.func,onReplace:c.func,onRetry:c.func,percent:c.number,preview:c.bool,previewFile:c.func,picWidth:c.oneOfType([c.number,c.string]),picHeight:c.oneOfType([c.number,c.string]),showReplace:c.bool,showRetry:c.bool,size:c.oneOfType([c.number,c.string]),status:c.string,style:c.object,url:c.string,validateMessage:c.node,index:c.number,showTooltip:c.oneOfType([c.bool,c.object])};Gs.defaultProps={listType:te.FILE_LIST_DEFAULT,name:"",onRemove:()=>{},onRetry:()=>{},preview:!1,size:"",showTooltip:!0};function un(r,e){let[t,n]=e;return Math.min(Math.max(r,t),n)}function jt(r,e,t){return r/e>t?r=e*t:e=r/t,[r,e]}class Qu extends Ye{constructor(e){super(Object.assign({},e)),this.getImgDataWhenResize=t=>{const{imgData:n}=this.getStates(),s={width:n.width*t,height:n.height*t,centerPoint:{x:n.centerPoint.x*t,y:n.centerPoint.y*t}};return this.imgData.scale*=t,s},this.getCropperBoxWhenResize=(t,n)=>{const{cropperBox:s}=this.getStates(),{aspectRatio:i}=this.getProps(),a={width:s.width*t,height:s.height*t,centerPoint:{x:s.centerPoint.x*t,y:s.centerPoint.y*t}};let o=a.centerPoint.x-a.width/2,l=a.centerPoint.x+a.width/2,d=a.centerPoint.y-a.height/2,u=a.centerPoint.y+a.height/2;return i?(l>n.width&&(l=n.width,o=a.width>n.width?0:n.width-a.width,a.width=l-o,a.height=a.width/i,u=d+a.height),u>n.height&&(u=n.height,d=a.height>n.height?0:n.height-a.height,a.height=u-d,a.width=a.height*i,l=o+a.width)):(l>n.width&&(l=n.width,o=a.width>n.width?0:n.width-a.width),u>n.height&&(u=n.height,d=a.height>n.height?0:n.height-a.height)),{width:l-o,height:u-d,centerPoint:{x:(l+o)/2,y:(u+d)/2}}},this.handleResize=()=>{const{loaded:t}=this.getStates();if(!this.initial){this.initial=!0;return}if(!t)return;const n=this._adapter.getContainer(),s={width:n.clientWidth,height:n.clientHeight},i=s.width/this.containerData.width,a=this.getImgDataWhenResize(i),o=this.getCropperBoxWhenResize(i,s);this.containerData=s,this.setState({imgData:a,cropperBox:o})},this.handleImageLoad=t=>{const{naturalWidth:n,naturalHeight:s}=t.target,{width:i,height:a}=this.containerData;this.imgData.originalWidth=n,this.imgData.originalHeight=s;let o=1;const l={};n/i>s/a?(o=i/n,l.width=i,l.height=s*o):(o=a/s,l.width=n*o,l.height=a),this.imgData.scale=o,l.centerPoint={},l.centerPoint.x=i/2,l.centerPoint.y=a/2;const d={},{defaultAspectRatio:u,aspectRatio:h}=this.getProps(),f=h||u;i/a>f?(d.width=a*f,d.height=a):(d.width=i,d.height=i/f),d.centerPoint={},d.centerPoint.x=i/2,d.centerPoint.y=a/2,this.setState({imgData:l,cropperBox:d,loaded:!0}),this.renderPreview()},this.renderPreview=()=>{const{preview:t,src:n}=this.getProps(),s=t==null?void 0:t();if(!s)return;const i=document.createElement("img");this.previewImg=i,this.previewContainer=s,i.src=n,s.appendChild(i),this.previewContainer.style.overflow="hidden";const{width:a,height:o}=s.getBoundingClientRect();this.previewContainerInitSize={width:a,height:o}},this.updatePreview=t=>{if(!this.previewImg)return;const{cropperBox:n}=this.getStates();let s=1;const{width:i,height:a}=this.previewContainerInitSize;let o=i,l=a;if(o<l){s=i/n.width;let b=s*n.height;b>a?(s=a/n.height,o=s*n.width):l=b}else{s=a/n.height;let b=s*n.width;b>i?(s=i/n.width,l=s*n.height):o=b}const{width:d,height:u,translateX:h,translateY:f,rotate:g}=t;this.previewImg.style.width=`${d*s}px`,this.previewImg.style.height=`${u*s}px`,this.previewImg.style.transform=`translate(${h*s}px, ${f*s}px) rotate(${g}deg)`,this.previewImg.style.transformOrigin="center",this.previewContainer.style.width=`${o}px`,this.previewContainer.style.height=`${l}px`},this.removePreview=()=>{this.previewImg&&this.previewContainer&&(this.previewContainer.removeChild(this.previewImg),this.previewImg=null)},this.handleWheel=t=>{t.preventDefault();const{imgData:n,zoom:s}=this.getStates(),{maxZoom:i,minZoom:a,zoomStep:o}=this.getProps();let l;if(t.deltaY<0?s+o<=i&&(l=Number((s+o).toFixed(2))):t.deltaY>0&&s-o>=a&&(l=Number((s-o).toFixed(2))),l===void 0)return;const d=t.currentTarget.getBoundingClientRect(),u=t.clientX-d.left,h=t.clientY-d.top,f={x:u,y:-h},g=Object.assign({},n.centerPoint);g.y=-g.y;const b={x:(g.x-f.x)/s*l+f.x,y:-[(g.y-f.y)/s*l+f.y]},m=n.width/s*l,v=n.height/s*l,y={width:m,height:v,centerPoint:b};this.setState({imgData:y,zoom:l}),this._adapter.notifyZoomChange(l)},this.getRangeForAspectChange=()=>{const{cropperBox:t}=this.getStates(),{aspectRatio:n}=this.getProps(),{width:s,height:i}=this.containerData;let a,o;const l=t.centerPoint.x-t.width/2,d=t.centerPoint.x+t.width/2,u=t.centerPoint.y-t.height/2,h=t.centerPoint.y+t.height/2;switch(this.boxMoveDir){case"tl":a=h,o=d,[o,a]=jt(o,a,n),this.rangeX=[d-o,d],this.rangeY=[h-a,h];break;case"tm":a=h;const f=t.centerPoint.x,g=s-t.centerPoint.x;o=2*(f<g?f:g),[o,a]=jt(o,a,n),this.rangeX=[t.centerPoint.x-o/2,t.centerPoint.x+o/2],this.rangeY=[h-a,h];break;case"tr":a=h,o=s-l,[o,a]=jt(o,a,n),this.rangeX=[l,l+o],this.rangeY=[h-a,h];break;case"ml":o=d;const b=t.centerPoint.y,m=i-t.centerPoint.y;a=2*(b<m?b:m),[o,a]=jt(o,a,n),this.rangeX=[d-o,d],this.rangeY=[t.centerPoint.y-a/2,t.centerPoint.y+a/2];break;case"mr":o=s-l;const v=t.centerPoint.y,y=i-t.centerPoint.y;a=2*(v<y?v:y),[o,a]=jt(o,a,n),this.rangeX=[l,l+o],this.rangeY=[t.centerPoint.y-a/2,t.centerPoint.y+a/2];break;case"bl":a=i-u,o=d,[o,a]=jt(o,a,n),this.rangeX=[d-o,d],this.rangeY=[u,u+a];break;case"bm":a=i-u;const w=t.centerPoint.x,E=s-t.centerPoint.x;o=2*(w<E?w:E),[o,a]=jt(o,a,n),this.rangeX=[t.centerPoint.x-o/2,t.centerPoint.x+o/2],this.rangeY=[u,u+a];break;case"br":a=i-u,o=s-l,[o,a]=jt(o,a,n),this.rangeX=[l,l+o],this.rangeY=[u,u+a];break}},this.handleCornerMouseDown=t=>{const n=t.currentTarget;if(!n)return;t.preventDefault();const s=n.dataset.dir;this.boxMoveDir=s,this.boxMoveParam=this.getMoveParamByDir(s),this.bindResizeEvent();const{aspectRatio:i}=this.getProps();i?this.getRangeForAspectChange():(this.rangeX=[0,this.containerData.width],this.rangeY=[0,this.containerData.height])},this.bindResizeEvent=()=>{const{aspectRatio:t}=this.getProps();document.addEventListener("mousemove",t?this.handleCornerAspectMouseMove:this.handleCornerMouseMove),document.addEventListener("mouseup",this.handleCornerMouseUp)},this.unBindResizeEvent=()=>{const{aspectRatio:t}=this.getProps();document.removeEventListener("mousemove",t?this.handleCornerAspectMouseMove:this.handleCornerMouseMove),document.removeEventListener("mouseup",this.handleCornerMouseUp)},this.viewIMGDragStart=t=>{t.preventDefault()},this.handleCornerAspectMouseMove=t=>{t.preventDefault();const{clientX:n,clientY:s}=t,{cropperBox:i}=this.getStates(),{aspectRatio:a}=this.getProps(),o=this._adapter.getContainer().getBoundingClientRect(),l={width:i.width,height:i.height,centerPoint:Object.assign({},i.centerPoint)};let d,u;switch(["ml","mr"].includes(this.boxMoveDir)?d=un(n-o.left,this.rangeX):u=un(s-o.top,this.rangeY),this.boxMoveDir){case"tl":l.height=this.rangeY[1]-u,l.width=l.height*a,l.centerPoint={x:this.rangeX[1]-l.width/2,y:this.rangeY[1]-l.height/2};break;case"tm":l.height=this.rangeY[1]-u,l.width=l.height*a,l.centerPoint={x:i.centerPoint.x,y:this.rangeY[1]-l.height/2};break;case"tr":l.height=this.rangeY[1]-u,l.width=l.height*a,l.centerPoint={x:this.rangeX[0]+l.width/2,y:this.rangeY[1]-l.height/2};break;case"ml":l.width=this.rangeX[1]-d,l.height=l.width/a,l.centerPoint={x:this.rangeX[1]-l.width/2,y:i.centerPoint.y};break;case"mr":l.width=d-this.rangeX[0],l.height=l.width/a,l.centerPoint={x:this.rangeX[0]+l.width/2,y:i.centerPoint.y};break;case"bl":l.height=u-this.rangeY[0],l.width=l.height*a,l.centerPoint={x:this.rangeX[1]-l.width/2,y:this.rangeY[0]+l.height/2};break;case"bm":l.height=u-this.rangeY[0],l.width=l.height*a,l.centerPoint={x:i.centerPoint.x,y:this.rangeY[0]+l.height/2};break;case"br":l.height=u-this.rangeY[0],l.width=l.height*a,l.centerPoint={x:this.rangeX[0]+l.width/2,y:this.rangeY[0]+l.height/2};break}l.height===0&&l.width===0&&(this.changeDir(),this.getRangeForAspectChange()),this.setState({cropperBox:l})},this.changeDir=()=>{this.boxMoveDir.includes("t")?this.boxMoveDir=this.boxMoveDir.replace("t","b"):this.boxMoveDir.includes("b")&&(this.boxMoveDir=this.boxMoveDir.replace("b","t")),this.boxMoveDir.includes("l")?this.boxMoveDir=this.boxMoveDir.replace("l","r"):this.boxMoveDir.includes("r")&&(this.boxMoveDir=this.boxMoveDir.replace("r","l"))},this.handleCornerMouseMove=t=>{t.preventDefault();const{clientX:n,clientY:s}=t,{cropperBox:i}=this.getStates(),a=this._adapter.getContainer().getBoundingClientRect();let o=un(n-a.left,this.rangeX),l=un(s-a.top,this.rangeY);const d={width:i.width,height:i.height,centerPoint:{x:i.centerPoint.x,y:i.centerPoint.y}},{paramX:u,paramY:h}=this.boxMoveParam;let f,g;u&&(f=i.centerPoint.x+u*i.width/2,d.width=i.width+u*(o-f),d.width<0&&(d.width=-d.width,this.boxMoveParam.paramX=-u),d.centerPoint.x=o-u*d.width/2),h&&(g=i.centerPoint.y+h*i.height/2,d.height=i.height+h*(l-g),d.height<0&&(d.height=-d.height,this.boxMoveParam.paramY=-h),d.centerPoint.y=l-h*d.height/2),this.setState({cropperBox:d})},this.handleCornerMouseUp=t=>{this.boxMoveParam={paramX:0,paramY:0},this.unBindResizeEvent()},this.handleCropperBoxMouseDown=t=>{const n=t.target,{cropperBox:s}=this.getStates(),a=this._adapter.getContainer().getBoundingClientRect();n.dataset.dir||(this.cropperBoxMoveStart={x:t.clientX,y:t.clientY},this.bindMoveEvent(),this.moveRange={xMin:s.width/2,xMax:a.width-s.width/2,yMin:s.height/2,yMax:a.height-s.height/2})},this.bindMoveEvent=()=>{document.addEventListener("mousemove",this.handleCropperBoxMouseMove),document.addEventListener("mouseup",this.handleCropperBoxMouseUp)},this.unBindMoveEvent=()=>{document.removeEventListener("mousemove",this.handleCropperBoxMouseMove),document.removeEventListener("mouseup",this.handleCropperBoxMouseUp)},this.handleCropperBoxMouseMove=t=>{if(!this.cropperBoxMoveStart)return;const{clientX:n,clientY:s}=t,{cropperBox:i}=this.getStates(),a=n-this.cropperBoxMoveStart.x,o=s-this.cropperBoxMoveStart.y,l=un(i.centerPoint.x+a,[this.moveRange.xMin,this.moveRange.xMax]),d=un(i.centerPoint.y+o,[this.moveRange.yMin,this.moveRange.yMax]),u={width:i.width,height:i.height,centerPoint:{x:l,y:d}};this.cropperBoxMoveStart={x:n,y:s},this.setState({cropperBox:u})},this.handleCropperBoxMouseUp=t=>{this.cropperBoxMoveStart&&(this.cropperBoxMoveStart=null,this.unBindMoveEvent())},this.handleMaskMouseDown=t=>{t.currentTarget===t.target&&(this.bindImgMoveEvent(),this.imgMoveStart={x:t.clientX,y:t.clientY})},this.bindImgMoveEvent=()=>{document.addEventListener("mousemove",this.handleImgMove),document.addEventListener("mouseup",this.handleImgMoveUp)},this.unBindImgMoveEvent=()=>{document.removeEventListener("mousemove",this.handleImgMove),document.removeEventListener("mouseup",this.handleImgMoveUp)},this.handleImgMove=t=>{if(!this.imgMoveStart)return;const{clientX:n,clientY:s}=t,{imgData:i}=this.getStates(),a=n-this.imgMoveStart.x,o=s-this.imgMoveStart.y,l=i.centerPoint.x+a,d=i.centerPoint.y+o,u={width:i.width,height:i.height,centerPoint:{x:l,y:d}};this.imgMoveStart={x:n,y:s},this.setState({imgData:u})},this.handleImgMoveUp=t=>{this.imgMoveStart&&(this.imgMoveStart=null,this.unBindImgMoveEvent())},this.getCropperCanvas=()=>{const{cropperBox:t,imgData:n,rotate:s,zoom:i}=this.getStates(),{fill:a}=this.getProps(),o=document.createElement("canvas"),l=o.getContext("2d"),d=this._adapter.getImg(),u=s*Math.PI/180,h=Math.abs(Math.sin(u)),f=Math.abs(Math.cos(u)),g=this.imgData.originalWidth,b=this.imgData.originalHeight,m=g*f+b*h,v=b*f+g*h,y=m*i*this.imgData.scale,w=v*i*this.imgData.scale,E=n.centerPoint.y-w/2,S=n.centerPoint.x-y/2,x=t.centerPoint.x-t.width/2,_=t.centerPoint.y-t.height/2,P=i*this.imgData.scale,I=(x-S)/P,O=(_-E)/P,F=t.width/P,D=t.height/P,$=I+F,L=O+D;if($<0||L<0||I>m||O>v){const fe=document.createElement("canvas"),ce=fe.getContext("2d");return fe.width=F,fe.height=D,ce.fillStyle=a,ce.fillRect(0,0,F,D),fe}o.width=m,o.height=v,l.fillStyle=a,l.fillRect(0,0,m,v);const N=m/2,J=v/2;l.translate(N,J),l.rotate(s*Math.PI/180),l.translate(-N,-J);const z=(m-g)/2,V=(v-b)/2;l.drawImage(d,0,0,g,b,z,V,g,b);const G=document.createElement("canvas"),H=G.getContext("2d");let j=I,q=O,A=F,K=D;I<0&&(j=0),O<0&&(q=0),$>m?A=m-j:I<0&&(A=$),L>v?K=v-q:O<0&&(K=L);const oe=l.getImageData(j,q,A,K);return G.width=F,G.height=D,H.fillStyle=a,H.fillRect(0,0,F,D),H.putImageData(oe,I<0?-I:0,O<0?-O:0),G},this.containerData={},this.imgData={},this.boxMoveDir="",this.boxMoveParam={paramX:0,paramY:0},this.rangeX=null,this.rangeY=null,this.initial=!1,this.previewImg=null,this.previewContainer=null}init(){const e=this._adapter.getContainer();this.containerData.width=e.clientWidth,this.containerData.height=e.clientHeight,this.cropperBoxMoveStart=null}destroy(){this.unBindMoveEvent(),this.unBindResizeEvent(),this.removePreview()}getMoveParamByDir(e){let t=0,n=0;switch(e){case"tl":t=-1,n=-1;break;case"tm":n=-1;break;case"tr":t=1,n=-1;break;case"ml":t=-1;break;case"mr":t=1;break;case"bl":t=-1,n=1;break;case"bm":n=1;break;case"br":t=1,n=1;break}return{paramX:t,paramY:n}}}const Rt=`${be}-cropper`,vt={PREFIX:`${Rt}`,IMG:`${Rt}-img`,IMG_WRAPPER:`${Rt}-img-wrapper`,CROPPER_BOX:`${Rt}-box`,CROPPER_VIEW_BOX:`${Rt}-view-box`,CROPPER_VIEW_BOX_ROUND:`${Rt}-view-box-round`,CROPPER_IMG:`${Rt}-view-img`,MASK:`${Rt}-mask`,CORNER:`${Rt}-box-corner`},sa={corner:["tl","tm","tr","ml","mr","bl","bm","br"],roundCorner:["tm","ml","mr","bm"]},eh=vt.PREFIX;class Qn extends Be{constructor(e){super(e),this.unRegisterImageWrapRef=()=>{this.containerRef&&this.containerRef.removeEventListener("wheel",this.foundation.handleWheel),this.containerRef=null},this.registryImageWrapRef=t=>{this.unRegisterImageWrapRef(),t&&t.addEventListener("wheel",this.foundation.handleWheel,{passive:!1}),this.containerRef=t},this.getCropperCanvas=()=>this.foundation.getCropperCanvas(),this.state={imgData:{width:0,height:0,centerPoint:{x:0,y:0}},cropperBox:{width:0,height:0,centerPoint:{x:0,y:0}},zoom:1,rotate:0,loaded:!1},this.foundation=new Qu(this.adapter),this.imgRef=p.createRef()}get adapter(){return Object.assign(Object.assign({},super.adapter),{getContainer:()=>this.containerRef,notifyZoomChange:e=>{const{onZoomChange:t}=this.props;t==null||t(e)},getImg:()=>this.imgRef.current})}static getDerivedStateFromProps(e,t){const{rotate:n,zoom:s}=e,{rotate:i,zoom:a,imgData:o,cropperBox:l,loaded:d}=t;let u=o.width,h=o.height,f=Object.assign({},o.centerPoint);const g={};if(!d)return null;if(!me(n)&&n!==i&&(g.rotate=n,d)){const b={x:l.centerPoint.x,y:-l.centerPoint.y},m={x:o.centerPoint.x,y:-o.centerPoint.y},v=(n-i)*Math.PI/180;f={x:(m.x-b.x)*Math.cos(v)+(m.y-b.y)*Math.sin(v)+b.x,y:-(-(m.x-b.x)*Math.sin(v)+(m.y-b.y)*Math.cos(v)+b.y)}}if(!me(n)&&s!==a&&(g.zoom=s,d)){const b={x:l.centerPoint.x,y:-l.centerPoint.y},m={x:f.x,y:-f.y};u=o.width/a*s,h=o.height/a*s,f={x:(m.x-b.x)/a*s+b.x,y:-[(m.y-b.y)/a*s+b.y]}}return(n!==i||s!==a)&&(g.imgData={width:u,height:h,centerPoint:f}),Object.keys(g).length?g:null}componentDidMount(){this.foundation.init()}componentWillUnmount(){this.foundation.destroy(),this.unRegisterImageWrapRef()}render(){const{className:e,style:t,src:n,shape:s,showResizeBox:i,cropperBoxStyle:a,cropperBoxCls:o}=this.props,{imgData:l,cropperBox:d,rotate:u,loaded:h}=this.state,f=l.centerPoint.x-l.width/2,g=l.centerPoint.y-l.height/2,b=d.centerPoint.x-d.width/2,m=d.centerPoint.y-d.height/2,v=f-b,y=g-m;return this.foundation.updatePreview({width:l.width,height:l.height,translateX:v,translateY:y,rotate:u}),p.createElement(Ca,{onResize:this.foundation.handleResize,observerProperty:Yo.Width},p.createElement("div",{className:T(eh,e),style:t,ref:this.registryImageWrapRef},p.createElement("div",{className:vt.IMG_WRAPPER},p.createElement("img",{ref:this.imgRef,src:n,onLoad:this.foundation.handleImageLoad,className:vt.IMG,crossOrigin:"anonymous",style:{width:l.width,height:l.height,transformOrigin:"center",transform:`translate(${f}px, ${g}px) rotate(${u}deg)`}})),p.createElement("div",{className:vt.MASK,onMouseDown:this.foundation.handleMaskMouseDown}),p.createElement("div",{className:T(vt.CROPPER_BOX,{[o]:o,[vt.CROPPER_VIEW_BOX_ROUND]:s==="round"}),style:Object.assign(Object.assign({},a),{width:d.width,height:d.height,transform:`translate(${b}px, ${m}px)`}),onMouseDown:this.foundation.handleCropperBoxMouseDown},p.createElement("div",{className:T(vt.CROPPER_VIEW_BOX,{[vt.CROPPER_VIEW_BOX_ROUND]:s.includes("round")})},p.createElement("img",{onDragStart:this.foundation.viewIMGDragStart,className:vt.CROPPER_IMG,src:n,style:{width:l.width,height:l.height,transformOrigin:"center",transform:`translate(${v}px, ${y}px) rotate(${u}deg)`}})),h&&i&&(s==="round"?sa.roundCorner:sa.corner).map(w=>p.createElement("div",{className:T(vt.CORNER,`${vt.CORNER}-${w}`),"data-dir":w,key:w,onMouseDown:this.foundation.handleCornerMouseDown})))))}}Qn.__SemiComponentName__="Cropper";Qn.propTypes={className:c.string,style:c.object};Qn.defaultProps=kt(Qn.__SemiComponentName__,{shape:"rect",defaultAspectRatio:1,showResizeBox:!0,fill:"rgba(0, 0, 0, 0)",maxZoom:3,minZoom:.1,zoomStep:.1});var ws=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{d(n.next(u))}catch(h){a(h)}}function l(u){try{d(n.throw(u))}catch(h){a(h)}}function d(u){u.done?i(u.value):s(u.value).then(o,l)}d((n=n.apply(r,e||[])).next())})},ia=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const ye=vo.PREFIX;class Pn extends Be{constructor(e){var t;super(e),t=this,this.inputRef=null,this.replaceInputRef=null,this.cropperRef=null,this.pastingCb=null,this.pasteEventCb=null,this.onClick=()=>{const{inputRef:n,props:s}=this,{onOpenFileDialog:i}=s;this.props.disabled||!n||!n.current||(n.current.click(),i&&i())},this.onChange=n=>{const{files:s}=n.target,{crop:i}=this.props;if(i&&s&&s.length>0){const a=Array.from(s);if(a.some(o=>this.isImageFile(o))){this.handleCropFiles(a);return}}this.foundation.handleChange(s)},this.isImageFile=n=>n.type.startsWith("image/"),this.handleCropFiles=function(n){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return ws(t,void 0,void 0,function*(){const i=n.filter(h=>this.isImageFile(h)),a=n.filter(h=>!this.isImageFile(h));if(i.length===0){this.dispatchUpload(n,s);return}if(!(yield this.shouldCropFile(i[0],n))){this.dispatchUpload(n,s);return}const l=s?[i[0]]:i,[d,...u]=l;this.setState({cropperVisible:!0,cropperFile:d,cropperSrc:URL.createObjectURL(d),pendingImageFiles:u,nonImageFiles:s?[]:a,croppedFiles:[],isReplaceOperation:s})})},this.shouldCropFile=(n,s)=>ws(this,void 0,void 0,function*(){const{beforeCrop:i,onCropError:a}=this.props;if(!i)return!0;try{return(yield i(n,s))!==!1}catch(o){return a==null||a(o),!1}}),this.dispatchUpload=(n,s)=>{s?this.foundation.handleReplaceChange(n):this.foundation.handleChange(n)},this.handleCropOk=()=>ws(this,void 0,void 0,function*(){var n;const{cropperFile:s,pendingImageFiles:i,nonImageFiles:a,croppedFiles:o,isReplaceOperation:l}=this.state,{crop:d,onCropError:u}=this.props;try{const h=this.cropperRef.current;if(!h||!s)throw new Error("Cropper instance not found");const f=h.getCropperCanvas(),b=(n=(typeof d=="object"?d:{}).quality)!==null&&n!==void 0?n:.92,m=s.type||"image/png",v=yield new Promise((E,S)=>{f.toBlob(x=>x?E(x):S(new Error("Failed to create blob")),m,b)}),y=new File([v],s.name,{type:m,lastModified:s.lastModified}),w=[...o,y];if(i.length>0){const[E,...S]=i;this.state.cropperSrc&&URL.revokeObjectURL(this.state.cropperSrc),this.setState({cropperFile:E,cropperSrc:URL.createObjectURL(E),pendingImageFiles:S,croppedFiles:w});return}this.closeCropperAndReset(),this.dispatchUpload([...w,...a],l)}catch(h){u==null||u(h)}}),this.handleCropCancel=()=>{this.closeCropperAndReset()},this.closeCropperAndReset=()=>{const{cropperSrc:n}=this.state;n&&URL.revokeObjectURL(n),this.setState({cropperVisible:!1,cropperFile:null,cropperSrc:"",pendingImageFiles:[],nonImageFiles:[],croppedFiles:[],isReplaceOperation:!1,inputKey:Math.random(),replaceInputKey:Math.random()})},this.replace=n=>{this.setState({replaceIdx:n},()=>{this.replaceInputRef.current.click()})},this.onReplaceChange=n=>{const{files:s}=n.target,{crop:i}=this.props;if(i&&s&&s.length>0){const a=Array.from(s);if(a.some(o=>this.isImageFile(o))){this.handleCropFiles(a,!0);return}}this.foundation.handleReplaceChange(s)},this.clear=()=>{this.foundation.handleClear()},this.remove=n=>{this.foundation.handleRemove(n)},this.insert=(n,s)=>this.foundation.insertFileToList(n,s),this.upload=()=>{this.foundation.manualUpload()},this.openFileDialog=()=>{this.onClick()},this.renderFile=(n,s,i)=>{const{name:a,status:o,validateMessage:l,_sizeInvalid:d,uid:u}=n,{previewFile:h,listType:f,itemStyle:g,showPicInfo:b,renderPicInfo:m,renderPicClose:v,renderPicPreviewIcon:y,renderFileOperation:w,renderFileItem:E,renderThumbnail:S,disabled:x,onPreviewClick:_,picWidth:P,picHeight:I,showTooltip:O}=this.props,F=()=>this.remove(n),D=()=>{this.foundation.retry(n)},$=()=>{this.replace(s)},L=Object.assign(Object.assign(Object.assign({},Sa(this.props,["showRetry","showReplace",""])),n),{previewFile:h,listType:f,onRemove:F,onRetry:D,index:s,key:u||`${a}${s}`,style:g,disabled:x,showPicInfo:b,renderPicInfo:m,renderPicPreviewIcon:y,renderPicClose:v,renderFileOperation:w,renderThumbnail:S,onReplace:$,onPreviewClick:typeof _<"u"?()=>this.foundation.handlePreviewClick(n):void 0,picWidth:P,picHeight:I,showTooltip:O});return o===te.FILE_STATUS_UPLOAD_FAIL&&!l&&(L.validateMessage=i.fail),d&&!l&&(L.validateMessage=i.illegalSize),typeof E>"u"?p.createElement(Gs,Object.assign({},L)):E(L)},this.renderFileList=()=>{const{listType:n}=this.props;return n===te.FILE_LIST_PIC?this.renderFileListPic():n===te.FILE_LIST_DEFAULT?this.renderFileListDefault():null},this.renderFileListPic=()=>{const{showUploadList:n,limit:s,disabled:i,children:a,draggable:o,hotSpotLocation:l,picHeight:d,picWidth:u}=this.props,{fileList:h,dragAreaStatus:f}=this.state,g=this.props.fileList||h,b=s?s>g.length:!0,m=`${ye}-drag-area`,v=T(`${ye}-add`,{[`${ye}-picture-add`]:!0,[`${ye}-picture-add-disabled`]:i}),y=T(`${ye}-file-list`,{[`${ye}-picture-file-list`]:!0}),w=T({[`${m}-legal`]:f===te.DRAG_AREA_LEGAL,[`${m}-illegal`]:f===te.DRAG_AREA_ILLEGAL}),E=`${ye}-file-list-main`,S={role:"button",className:v,onClick:this.onClick,style:{height:d,width:u}},x={className:y},_={onDrop:this.onDrop,onDragOver:this.onDragOver,onDragLeave:this.onDragLeave,onDragEnter:this.onDragEnter};o&&Object.assign(S,_,{className:T(v,w)});const P=p.createElement("div",Object.assign({},S,{"x-semi-prop":"children"}),a);return!n||!g.length?b?P:null:p.createElement(ut,{componentName:"Upload"},I=>p.createElement("div",Object.assign({},x),p.createElement("div",{className:E,role:"list","aria-label":"picture list"},b&&l==="start"?P:null,g.map((O,F)=>this.renderFile(O,F,I)),b&&l==="end"?P:null)))},this.renderFileListDefault=()=>{const{showUploadList:n,limit:s,disabled:i,fileListTitle:a}=this.props,{fileList:o}=this.state,l=this.props.fileList||o,d=T(`${ye}-file-list`),u=`${ye}-file-list-title`,h=`${ye}-file-list-main`,f=s!==1&&l.length,g=this.props.showClear&&!i,b={className:d};return!n||!l.length?null:p.createElement(ut,{componentName:"Upload"},m=>{let v;return typeof a=="function"?v=a({fileList:l,onClear:this.clear,clearText:m.clear}):v=p.createElement(p.Fragment,null,p.createElement("span",{className:`${u}-choosen`},a||m.selectedFiles),g?p.createElement("span",{role:"button",tabIndex:0,onClick:this.clear,className:`${u}-clear`},m.clear):null),p.createElement("div",Object.assign({},b),f?p.createElement("div",{className:u},v):null,p.createElement("div",{className:h,role:"list","aria-label":"file list"},l.map((y,w)=>this.renderFile(y,w,m))))})},this.onDrop=n=>{const{crop:s,directory:i,disabled:a}=this.props;if(a||i||!s){this.foundation.handleDrop(n);return}const o=n.dataTransfer&&n.dataTransfer.files?Array.from(n.dataTransfer.files):[];if(o.length===0||!o.some(u=>this.isImageFile(u))){this.foundation.handleDrop(n);return}n.preventDefault(),n.stopPropagation();const l=this.state.fileList.slice();this.setState({dragAreaStatus:"default"});const d=n.nativeEvent||n;this.props.onDrop(d,o,l),this.handleCropFiles(o)},this.onDragOver=n=>{this.foundation.handleDragOver(n)},this.onDragLeave=n=>{this.foundation.handleDragLeave(n)},this.onDragEnter=n=>{this.foundation.handleDragEnter(n)},this.renderAddContent=()=>{const{draggable:n,children:s,listType:i,disabled:a}=this.props,o=T(`${ye}-add`);return i===te.FILE_LIST_PIC?null:n?this.renderDragArea():p.createElement("div",{role:"button",tabIndex:0,"aria-disabled":a,className:o,onClick:this.onClick},s)},this.renderDragArea=()=>{const{dragAreaStatus:n}=this.state,{children:s,dragIcon:i,dragMainText:a,dragSubText:o,disabled:l}=this.props,d=`${ye}-drag-area`,u=T(d,{[`${d}-legal`]:n===te.DRAG_AREA_LEGAL,[`${d}-illegal`]:n===te.DRAG_AREA_ILLEGAL,[`${d}-custom`]:s});return p.createElement(ut,{componentName:"Upload"},h=>p.createElement("div",{role:"button",tabIndex:0,"aria-disabled":l,className:u,onDrop:this.onDrop,onDragOver:this.onDragOver,onDragLeave:this.onDragLeave,onDragEnter:this.onDragEnter,onClick:this.onClick},s||p.createElement(p.Fragment,null,p.createElement("div",{className:`${d}-icon`,"x-semi-prop":"dragIcon"},i||p.createElement(Al,{size:"extra-large"})),p.createElement("div",{className:`${d}-text`},p.createElement("div",{className:`${d}-main-text`,"x-semi-prop":"dragMainText"},a||h.mainText),p.createElement("div",{className:`${d}-sub-text`,"x-semi-prop":"dragSubText"},o),p.createElement("div",{className:`${d}-tips`},n===te.DRAG_AREA_LEGAL&&p.createElement("span",{className:`${d}-tips-legal`},h.legalTips),n===te.DRAG_AREA_ILLEGAL&&p.createElement("span",{className:`${d}-tips-illegal`},h.illegalTips))))))},this.renderCropperModal=()=>{const{cropperVisible:n,cropperSrc:s}=this.state,{crop:i,cropModalProps:a}=this.props,o=typeof i=="object"?i:{},l=a||{},{style:d,bodyStyle:u}=l,h=ia(l,["style","bodyStyle"]);return p.createElement(ut,{componentName:"Upload"},f=>{const g=o.modalTitle||f.cropTitle||"裁切图片",b=o.modalOkText||f.cropOk||"确定",m=o.modalCancelText||f.cropCancel||"取消";return p.createElement(Mn,Object.assign({},h,{width:600,title:g,visible:n,onOk:this.handleCropOk,onCancel:this.handleCropCancel,okText:b,cancelText:m,style:Object.assign({height:500},d||{}),bodyStyle:Object.assign({height:400},u||{})}),s&&p.createElement(Qn,{ref:this.cropperRef,src:s,shape:o.shape||"rect",aspectRatio:o.aspectRatio,minZoom:o.minZoom,maxZoom:o.maxZoom,zoomStep:o.zoomStep,fill:o.fill,style:{width:"100%",height:"100%"}}))})},this.state={fileList:e.defaultFileList||[],replaceIdx:-1,inputKey:Math.random(),replaceInputKey:Math.random(),dragAreaStatus:"default",localUrls:[],cropperVisible:!1,cropperFile:null,cropperSrc:"",pendingImageFiles:[],nonImageFiles:[],croppedFiles:[],isReplaceOperation:!1},this.foundation=new Gu(this.adapter),this.inputRef=p.createRef(),this.replaceInputRef=p.createRef(),this.cropperRef=p.createRef()}static getDerivedStateFromProps(e){const{fileList:t}=e;return"fileList"in e?{fileList:t||[]}:null}get adapter(){return Object.assign(Object.assign({},super.adapter),{notifyFileSelect:e=>this.props.onFileChange(e),notifyError:(e,t,n,s)=>this.props.onError(e,t,n,s),notifySuccess:(e,t,n)=>this.props.onSuccess(e,t,n),notifyProgress:(e,t,n)=>this.props.onProgress(e,t,n),notifyRemove:(e,t,n)=>this.props.onRemove(e,t,n),notifySizeError:(e,t)=>this.props.onSizeError(e,t),notifyExceed:e=>this.props.onExceed(e),updateFileList:(e,t)=>{typeof t=="function"?this.setState({fileList:e},t):this.setState({fileList:e})},notifyBeforeUpload:e=>{let{file:t,fileList:n}=e;return this.props.beforeUpload({file:t,fileList:n})},notifyAfterUpload:e=>{let{response:t,file:n,fileList:s}=e;return this.props.afterUpload({response:t,file:n,fileList:s})},resetInput:()=>{this.setState(e=>({inputKey:Math.random()}))},resetReplaceInput:()=>{this.setState(e=>({replaceInputKey:Math.random()}))},isMac:()=>navigator.platform.toUpperCase().indexOf("MAC")>=0,registerPastingHandler:e=>{const t=n=>{const{crop:s}=this.props;if(s&&n.type==="keydown"&&"code"in n&&(navigator.platform.toUpperCase().indexOf("MAC")>=0?n.metaKey:n.ctrlKey)&&n.code==="KeyV"&&navigator.clipboard&&typeof navigator.clipboard.read=="function"){navigator.permissions.query({name:"clipboard-read"}).then(l=>{(l.state==="granted"||l.state==="prompt")&&navigator.clipboard.read().then(d=>{const u=[];ws(this,void 0,void 0,function*(){for(const f of d)for(const g of f.types)if(g.startsWith("image")){const m=yield(yield f.getType(g)).arrayBuffer(),v=g.split("/")[1],y=new File([m],`paste.${v}`,{type:g});u.push(y)}u.length>0&&(u.filter(g=>this.isImageFile(g)).length>0?this.handleCropFiles(u):this.foundation.handleChange(u))})}).catch(d=>{this.props.onPastingError(d)})}).catch(l=>{this.props.onPastingError(l)});return}e==null||e(n)};document.body.addEventListener("keydown",t),this.pastingCb=t},unRegisterPastingHandler:()=>{this.pastingCb&&document.body.removeEventListener("keydown",this.pastingCb)},registerPasteEventHandler:e=>{const t=n=>{const{crop:s}=this.props;if(s&&n.clipboardData&&n.clipboardData.items){const i=[];for(let a=0;a<n.clipboardData.items.length;a++){const o=n.clipboardData.items[a];if(o.kind==="file"){const l=o.getAsFile();l&&i.push(l)}}if(i.length>0&&i.some(a=>this.isImageFile(a))){n.preventDefault(),this.handleCropFiles(i);return}}e==null||e(n)};document.body.addEventListener("paste",t),this.pasteEventCb=t},unRegisterPasteEventHandler:()=>{this.pasteEventCb&&document.body.removeEventListener("paste",this.pasteEventCb)},notifyPastingError:e=>this.props.onPastingError(e),updateDragAreaStatus:e=>this.setState({dragAreaStatus:e}),notifyChange:e=>{let{currentFile:t,fileList:n}=e;return this.props.onChange({currentFile:t,fileList:n})},updateLocalUrls:e=>this.setState({localUrls:e}),notifyClear:()=>this.props.onClear(),notifyPreviewClick:e=>this.props.onPreviewClick(e),notifyDrop:(e,t,n)=>this.props.onDrop(e,t,n),notifyAcceptInvalid:e=>this.props.onAcceptInvalid(e),notifyBeforeRemove:(e,t)=>this.props.beforeRemove(e,t),notifyBeforeClear:e=>this.props.beforeClear(e)})}componentDidMount(){this.foundation.init()}componentDidUpdate(){"fileList"in this.props&&this.foundation.syncLatestFileList(this.props.fileList||[])}componentWillUnmount(){this.foundation.destroy()}render(){const e=this.props,{style:t,className:n,multiple:s,accept:i,disabled:a,children:o,capture:l,listType:d,prompt:u,promptPosition:h,draggable:f,validateMessage:g,validateStatus:b,directory:m}=e,v=ia(e,["style","className","multiple","accept","disabled","children","capture","listType","prompt","promptPosition","draggable","validateMessage","validateStatus","directory"]),y=T(ye,{[`${ye}-picture`]:d===te.FILE_LIST_PIC,[`${ye}-disabled`]:a,[`${ye}-default`]:b==="default",[`${ye}-error`]:b==="error",[`${ye}-warning`]:b==="warning",[`${ye}-success`]:b==="success"},n),w=T(`${ye}-hidden-input`),E=T(`${ye}-hidden-input-replace`),S=T(`${ye}-prompt`),x=T(`${ye}-validate-message`),_=m?{directory:"directory",webkitdirectory:"webkitdirectory"}:{};return p.createElement("div",Object.assign({className:y,style:t,"x-prompt-pos":h},this.getDataAttr(v)),p.createElement("input",Object.assign({key:this.state.inputKey,capture:l,multiple:s,accept:i,onChange:this.onChange,type:"file",autoComplete:"off",tabIndex:-1,className:w,ref:this.inputRef},_)),p.createElement("input",{key:this.state.replaceInputKey,multiple:!1,accept:i,onChange:this.onReplaceChange,type:"file",autoComplete:"off",tabIndex:-1,className:E,ref:this.replaceInputRef}),this.renderAddContent(),u?p.createElement("div",{className:S,"x-semi-prop":"prompt"},u):null,g?p.createElement("div",{className:x,"x-semi-prop":"validateMessage"},g):null,this.renderFileList(),this.renderCropperModal())}}Pn.__SemiComponentName__="Upload";Pn.propTypes={accept:c.string,action:c.string.isRequired,addOnPasting:c.bool,afterUpload:c.func,beforeClear:c.func,beforeRemove:c.func,beforeUpload:c.func,children:c.node,className:c.string,customRequest:c.func,data:c.oneOfType([c.object,c.func]),defaultFileList:c.array,directory:c.bool,disabled:c.bool,dragIcon:c.node,dragMainText:c.node,dragSubText:c.node,draggable:c.bool,fileList:c.array,fileName:c.string,headers:c.oneOfType([c.object,c.func]),hotSpotLocation:c.oneOf(["start","end"]),itemStyle:c.object,limit:c.number,listType:c.oneOf(te.LIST_TYPE),maxSize:c.number,minSize:c.number,multiple:c.bool,name:c.string,onAcceptInvalid:c.func,onChange:c.func,onClear:c.func,onDrop:c.func,onError:c.func,onExceed:c.func,onFileChange:c.func,onOpenFileDialog:c.func,onPreviewClick:c.func,onProgress:c.func,onRemove:c.func,onRetry:c.func,onSizeError:c.func,onSuccess:c.func,onPastingError:c.func,previewFile:c.func,prompt:c.node,promptPosition:c.oneOf(te.PROMPT_POSITION),picWidth:c.oneOfType([c.number,c.string]),picHeight:c.oneOfType([c.number,c.string]),renderFileItem:c.func,renderPicPreviewIcon:c.func,renderFileOperation:c.func,renderPicClose:c.func,renderPicInfo:c.func,renderThumbnail:c.func,fileListTitle:c.oneOfType([c.node,c.func]),showClear:c.bool,showPicInfo:c.bool,showReplace:c.bool,showRetry:c.bool,showUploadList:c.bool,style:c.object,timeout:c.number,transformFile:c.func,uploadTrigger:c.oneOf(te.UPLOAD_TRIGGER),validateMessage:c.node,validateStatus:c.oneOf(te.VALIDATE_STATUS),withCredentials:c.bool,showTooltip:c.oneOfType([c.bool,c.object]),crop:c.oneOfType([c.bool,c.object]),beforeCrop:c.func,onCropError:c.func,cropModalProps:c.object};Pn.defaultProps=kt(Pn.__SemiComponentName__,{defaultFileList:[],disabled:!1,listType:"list",hotSpotLocation:"end",multiple:!1,onAcceptInvalid:M,onChange:M,beforeRemove:()=>!0,beforeClear:()=>!0,onClear:M,onDrop:M,onError:M,onExceed:M,onFileChange:M,onOpenFileDialog:M,onProgress:M,onRemove:M,onRetry:M,onSizeError:M,onSuccess:M,onPastingError:M,promptPosition:"right",showClear:!0,showPicInfo:!1,showReplace:!1,showRetry:!0,showUploadList:!0,uploadTrigger:"auto",withCredentials:!1,showTooltip:!0});Pn.FileCard=Gs;function Zt(){return Zt=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Zt.apply(this,arguments)}function th(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,es(r,e)}function ji(r){return ji=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ji(r)}function es(r,e){return es=Object.setPrototypeOf||function(n,s){return n.__proto__=s,n},es(r,e)}function nh(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Is(r,e,t){return nh()?Is=Reflect.construct:Is=function(s,i,a){var o=[null];o.push.apply(o,i);var l=Function.bind.apply(s,o),d=new l;return a&&es(d,a.prototype),d},Is.apply(null,arguments)}function sh(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function Vi(r){var e=typeof Map=="function"?new Map:void 0;return Vi=function(n){if(n===null||!sh(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,s)}function s(){return Is(n,arguments,ji(this).constructor)}return s.prototype=Object.create(n.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),es(s,n)},Vi(r)}var ih=/%[sdj%]/g,rh=function(){};function Ki(r){if(!r||!r.length)return null;var e={};return r.forEach(function(t){var n=t.field;e[n]=e[n]||[],e[n].push(t)}),e}function rt(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];var n=1,s=e[0],i=e.length;if(typeof s=="function")return s.apply(null,e.slice(1));if(typeof s=="string"){var a=String(s).replace(ih,function(o){if(o==="%%")return"%";if(n>=i)return o;switch(o){case"%s":return String(e[n++]);case"%d":return Number(e[n++]);case"%j":try{return JSON.stringify(e[n++])}catch{return"[Circular]"}break;default:return o}});return a}return s}function ah(r){return r==="string"||r==="url"||r==="hex"||r==="email"||r==="date"||r==="pattern"}function Fe(r,e){return!!(r==null||e==="array"&&Array.isArray(r)&&!r.length||ah(e)&&typeof r=="string"&&!r)}function oh(r,e,t){var n=[],s=0,i=r.length;function a(o){n.push.apply(n,o),s++,s===i&&t(n)}r.forEach(function(o){e(o,a)})}function ra(r,e,t){var n=0,s=r.length;function i(a){if(a&&a.length){t(a);return}var o=n;n=n+1,o<s?e(r[o],i):t([])}i([])}function lh(r){var e=[];return Object.keys(r).forEach(function(t){e.push.apply(e,r[t])}),e}var aa=function(r){th(e,r);function e(t,n){var s;return s=r.call(this,"Async Validation Error")||this,s.errors=t,s.fields=n,s}return e}(Vi(Error));function ch(r,e,t,n){if(e.first){var s=new Promise(function(h,f){var g=function(v){return n(v),v.length?f(new aa(v,Ki(v))):h()},b=lh(r);ra(b,t,g)});return s.catch(function(h){return h}),s}var i=e.firstFields||[];i===!0&&(i=Object.keys(r));var a=Object.keys(r),o=a.length,l=0,d=[],u=new Promise(function(h,f){var g=function(m){if(d.push.apply(d,m),l++,l===o)return n(d),d.length?f(new aa(d,Ki(d))):h()};a.length||(n(d),h()),a.forEach(function(b){var m=r[b];i.indexOf(b)!==-1?ra(m,t,g):oh(m,t,g)})});return u.catch(function(h){return h}),u}function oa(r){return function(e){return e&&e.message?(e.field=e.field||r.fullField,e):{message:typeof e=="function"?e():e,field:e.field||r.fullField}}}function la(r,e){if(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];typeof n=="object"&&typeof r[t]=="object"?r[t]=Zt({},r[t],n):r[t]=n}}return r}function Co(r,e,t,n,s,i){r.required&&(!t.hasOwnProperty(r.field)||Fe(e,i||r.type))&&n.push(rt(s.messages.required,r.fullField))}function dh(r,e,t,n,s){(/^\s+$/.test(e)||e==="")&&n.push(rt(s.messages.whitespace,r.fullField))}var bi={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,url:new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i"),hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},jn={integer:function(e){return jn.number(e)&&parseInt(e,10)===e},float:function(e){return jn.number(e)&&!jn.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch{return!1}},date:function(e){return typeof e.getTime=="function"&&typeof e.getMonth=="function"&&typeof e.getYear=="function"&&!isNaN(e.getTime())},number:function(e){return isNaN(e)?!1:typeof e=="number"},object:function(e){return typeof e=="object"&&!jn.array(e)},method:function(e){return typeof e=="function"},email:function(e){return typeof e=="string"&&!!e.match(bi.email)&&e.length<255},url:function(e){return typeof e=="string"&&!!e.match(bi.url)},hex:function(e){return typeof e=="string"&&!!e.match(bi.hex)}};function uh(r,e,t,n,s){if(r.required&&e===void 0){Co(r,e,t,n,s);return}var i=["integer","float","array","regexp","object","method","email","number","date","url","hex"],a=r.type;i.indexOf(a)>-1?jn[a](e)||n.push(rt(s.messages.types[a],r.fullField,r.type)):a&&typeof e!==r.type&&n.push(rt(s.messages.types[a],r.fullField,r.type))}function hh(r,e,t,n,s){var i=typeof r.len=="number",a=typeof r.min=="number",o=typeof r.max=="number",l=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,d=e,u=null,h=typeof e=="number",f=typeof e=="string",g=Array.isArray(e);if(h?u="number":f?u="string":g&&(u="array"),!u)return!1;g&&(d=e.length),f&&(d=e.replace(l,"_").length),i?d!==r.len&&n.push(rt(s.messages[u].len,r.fullField,r.len)):a&&!o&&d<r.min?n.push(rt(s.messages[u].min,r.fullField,r.min)):o&&!a&&d>r.max?n.push(rt(s.messages[u].max,r.fullField,r.max)):a&&o&&(d<r.min||d>r.max)&&n.push(rt(s.messages[u].range,r.fullField,r.min,r.max))}var hn="enum";function ph(r,e,t,n,s){r[hn]=Array.isArray(r[hn])?r[hn]:[],r[hn].indexOf(e)===-1&&n.push(rt(s.messages[hn],r.fullField,r[hn].join(", ")))}function fh(r,e,t,n,s){if(r.pattern){if(r.pattern instanceof RegExp)r.pattern.lastIndex=0,r.pattern.test(e)||n.push(rt(s.messages.pattern.mismatch,r.fullField,e,r.pattern));else if(typeof r.pattern=="string"){var i=new RegExp(r.pattern);i.test(e)||n.push(rt(s.messages.pattern.mismatch,r.fullField,e,r.pattern))}}}var ee={required:Co,whitespace:dh,type:uh,range:hh,enum:ph,pattern:fh};function gh(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(Fe(e,"string")&&!r.required)return t();ee.required(r,e,n,i,s,"string"),Fe(e,"string")||(ee.type(r,e,n,i,s),ee.range(r,e,n,i,s),ee.pattern(r,e,n,i,s),r.whitespace===!0&&ee.whitespace(r,e,n,i,s))}t(i)}function mh(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(Fe(e)&&!r.required)return t();ee.required(r,e,n,i,s),e!==void 0&&ee.type(r,e,n,i,s)}t(i)}function yh(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(e===""&&(e=void 0),Fe(e)&&!r.required)return t();ee.required(r,e,n,i,s),e!==void 0&&(ee.type(r,e,n,i,s),ee.range(r,e,n,i,s))}t(i)}function bh(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(Fe(e)&&!r.required)return t();ee.required(r,e,n,i,s),e!==void 0&&ee.type(r,e,n,i,s)}t(i)}function vh(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(Fe(e)&&!r.required)return t();ee.required(r,e,n,i,s),Fe(e)||ee.type(r,e,n,i,s)}t(i)}function Ch(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(Fe(e)&&!r.required)return t();ee.required(r,e,n,i,s),e!==void 0&&(ee.type(r,e,n,i,s),ee.range(r,e,n,i,s))}t(i)}function Sh(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(Fe(e)&&!r.required)return t();ee.required(r,e,n,i,s),e!==void 0&&(ee.type(r,e,n,i,s),ee.range(r,e,n,i,s))}t(i)}function wh(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(e==null&&!r.required)return t();ee.required(r,e,n,i,s,"array"),e!=null&&(ee.type(r,e,n,i,s),ee.range(r,e,n,i,s))}t(i)}function Eh(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(Fe(e)&&!r.required)return t();ee.required(r,e,n,i,s),e!==void 0&&ee.type(r,e,n,i,s)}t(i)}var xh="enum";function _h(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(Fe(e)&&!r.required)return t();ee.required(r,e,n,i,s),e!==void 0&&ee[xh](r,e,n,i,s)}t(i)}function Ph(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(Fe(e,"string")&&!r.required)return t();ee.required(r,e,n,i,s),Fe(e,"string")||ee.pattern(r,e,n,i,s)}t(i)}function Oh(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(Fe(e,"date")&&!r.required)return t();if(ee.required(r,e,n,i,s),!Fe(e,"date")){var o;e instanceof Date?o=e:o=new Date(e),ee.type(r,o,n,i,s),o&&ee.range(r,o.getTime(),n,i,s)}}t(i)}function Ih(r,e,t,n,s){var i=[],a=Array.isArray(e)?"array":typeof e;ee.required(r,e,n,i,s,a),t(i)}function vi(r,e,t,n,s){var i=r.type,a=[],o=r.required||!r.required&&n.hasOwnProperty(r.field);if(o){if(Fe(e,i)&&!r.required)return t();ee.required(r,e,n,a,s,i),Fe(e,i)||ee.type(r,e,n,a,s)}t(a)}function Th(r,e,t,n,s){var i=[],a=r.required||!r.required&&n.hasOwnProperty(r.field);if(a){if(Fe(e)&&!r.required)return t();ee.required(r,e,n,i,s)}t(i)}var Un={string:gh,method:mh,number:yh,boolean:bh,regexp:vh,integer:Ch,float:Sh,array:wh,object:Eh,enum:_h,pattern:Ph,date:Oh,url:vi,hex:vi,email:vi,required:Ih,any:Th};function Hi(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var lr=Hi();function Kt(r){this.rules=null,this._messages=lr,this.define(r)}Kt.prototype={messages:function(e){return e&&(this._messages=la(Hi(),e)),this._messages},define:function(e){if(!e)throw new Error("Cannot configure a schema with no rules");if(typeof e!="object"||Array.isArray(e))throw new Error("Rules must be an object");this.rules={};var t,n;for(t in e)e.hasOwnProperty(t)&&(n=e[t],this.rules[t]=Array.isArray(n)?n:[n])},validate:function(e,t,n){var s=this;t===void 0&&(t={}),n===void 0&&(n=function(){});var i=e,a=t,o=n;if(typeof a=="function"&&(o=a,a={}),!this.rules||Object.keys(this.rules).length===0)return o&&o(),Promise.resolve();function l(m){var v,y=[],w={};function E(S){if(Array.isArray(S)){var x;y=(x=y).concat.apply(x,S)}else y.push(S)}for(v=0;v<m.length;v++)E(m[v]);y.length?w=Ki(y):(y=null,w=null),o(y,w)}if(a.messages){var d=this.messages();d===lr&&(d=Hi()),la(d,a.messages),a.messages=d}else a.messages=this.messages();var u,h,f={},g=a.keys||Object.keys(this.rules);g.forEach(function(m){u=s.rules[m],h=i[m],u.forEach(function(v){var y=v;typeof y.transform=="function"&&(i===e&&(i=Zt({},i)),h=i[m]=y.transform(h)),typeof y=="function"?y={validator:y}:y=Zt({},y),y.validator=s.getValidationMethod(y),y.field=m,y.fullField=y.fullField||m,y.type=s.getType(y),y.validator&&(f[m]=f[m]||[],f[m].push({rule:y,value:h,source:i,field:m}))})});var b={};return ch(f,a,function(m,v){var y=m.rule,w=(y.type==="object"||y.type==="array")&&(typeof y.fields=="object"||typeof y.defaultField=="object");w=w&&(y.required||!y.required&&m.value),y.field=m.field;function E(_,P){return Zt({},P,{fullField:y.fullField+"."+_})}function S(_){_===void 0&&(_=[]);var P=_;if(Array.isArray(P)||(P=[P]),!a.suppressWarning&&P.length&&Kt.warning("async-validator:",P),P.length&&y.message!==void 0&&(P=[].concat(y.message)),P=P.map(oa(y)),a.first&&P.length)return b[y.field]=1,v(P);if(!w)v(P);else{if(y.required&&!m.value)return y.message!==void 0?P=[].concat(y.message).map(oa(y)):a.error&&(P=[a.error(y,rt(a.messages.required,y.field))]),v(P);var I={};if(y.defaultField)for(var O in m.value)m.value.hasOwnProperty(O)&&(I[O]=y.defaultField);I=Zt({},I,m.rule.fields);for(var F in I)if(I.hasOwnProperty(F)){var D=Array.isArray(I[F])?I[F]:[I[F]];I[F]=D.map(E.bind(null,F))}var $=new Kt(I);$.messages(a.messages),m.rule.options&&(m.rule.options.messages=a.messages,m.rule.options.error=a.error),$.validate(m.value,m.rule.options||a,function(L){var N=[];P&&P.length&&N.push.apply(N,P),L&&L.length&&N.push.apply(N,L),v(N.length?N:null)})}}var x;y.asyncValidator?x=y.asyncValidator(y,m.value,S,m.source,a):y.validator&&(x=y.validator(y,m.value,S,m.source,a),x===!0?S():x===!1?S(y.message||y.field+" fails"):x instanceof Array?S(x):x instanceof Error&&S(x.message)),x&&x.then&&x.then(function(){return S()},function(_){return S(_)})},function(m){l(m)})},getType:function(e){if(e.type===void 0&&e.pattern instanceof RegExp&&(e.type="pattern"),typeof e.validator!="function"&&e.type&&!Un.hasOwnProperty(e.type))throw new Error(rt("Unknown rule type %s",e.type));return e.type||"string"},getValidationMethod:function(e){if(typeof e.validator=="function")return e.validator;var t=Object.keys(e),n=t.indexOf("message");return n!==-1&&t.splice(n,1),t.length===1&&t[0]==="required"?Un.required:Un[this.getType(e)]||!1}};Kt.register=function(e,t){if(typeof t!="function")throw new Error("Cannot register a validator by type, validator is not a function");Un[e]=t};Kt.warning=rh;Kt.messages=lr;Kt.validators=Un;var Fh=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};function Dh(r){const e=r.displayName||r.name;return e?`SemiField${e}`:"SemiField"}function Rh(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const t={};return t[r]=e,new Kt(t)}function kh(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=!1;return typeof r=="object"&&"required"in r?e=r.required:Array.isArray(r)&&r.length&&r.forEach(t=>{t.required&&(e=!0)}),e}function bn(r){let e=!0;return typeof r=="string"&&r.length?e=!1:Array.isArray(r)&&r.length?e=r.every(t=>bn(t)):typeof r=="boolean"?e=r:r&&typeof r.$$typeof=="symbol"&&r.$$typeof.toString()==="Symbol(react.element)"&&(e=!1),e}function Ah(r,e){let t=[],n=[];return me(r)?me(e)?t=$n.DEFAULT_TRIGGER:t=e:t=r,Array.isArray(t)&&(n=t),typeof t=="string"&&(n[0]=t),n}function Lh(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return me(r)?me(e)?t:e:r}function Nh(r,e){const n=Object.assign(Object.assign({},{valueKey:"value",onKeyChangeFnName:"onChange",valuePath:"",maintainCursor:!1,shouldInject:!0,shouldMemo:!0}),r),s="field"in e?!0:n.shouldInject;return{options:n,shouldInject:s}}function Mh(r){let t=Object.assign(Object.assign({},{allowEmptyString:!1,allowEmpty:!1,emptyValue:"",noLabel:!1,noErrorMessage:!1,isInInputGroup:!1}),r),{field:n,label:s,labelPosition:i,labelWidth:a,labelAlign:o,labelCol:l,wrapperCol:d,initValue:u,validate:h,validator:f,validateStatus:g,trigger:b,allowEmptyString:m,allowEmpty:v,emptyValue:y,rules:w,onChange:E,keepState:S,transform:x,name:_,fieldClassName:P,fieldStyle:I,noLabel:O,noErrorMessage:F,isInInputGroup:D,stopValidateWithError:$,convert:L,showValidateIcon:N,helpText:J,extraText:z,extraTextPosition:V,pure:G,id:H}=t,j=Fh(t,["field","label","labelPosition","labelWidth","labelAlign","labelCol","wrapperCol","initValue","validate","validator","validateStatus","trigger","allowEmptyString","allowEmpty","emptyValue","rules","onChange","keepState","transform","name","fieldClassName","fieldStyle","noLabel","noErrorMessage","isInInputGroup","stopValidateWithError","convert","showValidateIcon","helpText","extraText","extraTextPosition","pure","id"]);delete j.defaultChecked,delete j.defaultValue,delete j.checked,typeof u<"u"&&(u=Zo(u));const q=kh(w);return y=typeof y<"u"?y:"",{field:n,label:s,labelPosition:i,labelWidth:a,labelAlign:o,labelCol:l,wrapperCol:d,noLabel:O,noErrorMessage:F,isInInputGroup:D,initValue:u,validate:f||h,validateStatus:g,trigger:b,allowEmptyString:m,allowEmpty:v,emptyValue:y,rules:w,required:q,keepState:S,transform:x,name:_,fieldClassName:P,fieldStyle:I,convert:L,stopValidateWithError:$,showValidateIcon:N,helpText:J,extraText:z,extraTextPosition:V,pure:G,rest:j,id:H}}class $h extends Ye{constructor(e){super(Object.assign({},e));let{initValues:t}=this._adapter.getProps();t=this._adapter.cloneDeep(t),this.data={values:t||{},errors:{},touched:{}},this.fields=new Map,this.registered={},this.registeredArrayField=new Map,this.register=this.register.bind(this),this.unRegister=this.unRegister.bind(this),this.registerArrayField=this.registerArrayField.bind(this),this.unRegisterArrayField=this.unRegisterArrayField.bind(this),this.getArrayField=this.getArrayField.bind(this),this.updateArrayField=this.updateArrayField.bind(this),this.getField=this.getField.bind(this),this.setValues=this.setValues.bind(this),this.updateStateValue=this.updateStateValue.bind(this),this.updateStateError=this.updateStateError.bind(this),this.updateStateTouched=this.updateStateTouched.bind(this),this.getFormState=this.getFormState.bind(this),this.getValue=this.getValue.bind(this),this.getError=this.getError.bind(this),this.getTouched=this.getTouched.bind(this),this.getInitValues=this.getInitValues.bind(this),this.getInitValue=this.getInitValue.bind(this),this.getFormProps=this.getFormProps.bind(this),this.getFieldExist=this.getFieldExist.bind(this),this.scrollToField=this.scrollToField.bind(this),this.scrollToError=this.scrollToError.bind(this)}init(){this._adapter.initFormId()}getField(e){return this.fields.get(e)}register(e,t,n){const s=this.registered[e];if(this.registered[e]=!0,this.fields.set(e,n),n.keepState&&s){const i=ti(this.data.values,e),a=Ke(this.data.values,e),o=ti(this.data.errors,e),l=Ke(this.data.errors,e),d=ti(this.data.touched,e),u=Ke(this.data.touched,e),h=n.allowEmpty||!1,f={notNotify:!0,notUpdate:!1,fieldAllowEmpty:h};if(i)this.updateStateValue(e,a,f),n.fieldApi.setValue(a,Object.assign(Object.assign({},f),{notUpdate:!0}));else{let g=t.value;!h&&g===""&&(g=void 0),this.updateStateValue(e,g,f)}o&&(this.updateStateError(e,l,f),n.fieldApi.setError(l,Object.assign(Object.assign({},f),{notUpdate:!0}))),d&&(this.updateStateTouched(e,u,f),n.fieldApi.setTouched(u,Object.assign(Object.assign({},f),{notUpdate:!0})))}else{const i=n.allowEmpty||!1,a={notNotify:!0,notUpdate:!1,fieldAllowEmpty:i};let o=t.value;!i&&o===""&&(o=void 0),this.updateStateValue(e,o,a),t.error&&this.updateStateError(e,t.error,a)}}unRegister(e){const t=this.fields.get(e);try{t.keepState||(ni(this.data.values,e),ni(this.data.errors,e),ni(this.data.touched,e))}catch{console.error(`some thing wrong when unregister field:${e}`)}this.fields.delete(e),this._adapter.notifyChange(this.data),this._adapter.forceUpdate()}registerArrayField(e,t){this.updateArrayField(e,{updateKey:new Date().valueOf(),initValue:t})}unRegisterArrayField(e){this.registeredArrayField.delete(e)}getArrayField(e){return this.registeredArrayField.get(e)}updateArrayField(e,t){const n=Object.assign(Object.assign({},this.registeredArrayField.get(e)),t);this.registeredArrayField.set(e,n)}validate(e){const t=this.getProps(),n=t.validator||t.validateFields;let s,i=!1;if(e&&!Array.isArray(e)){const a=e;s=a.fields,i=a.silent||!1}else s=e;return n&&Le(n)?this._formValidate(i):this._fieldsValidate(s,i)}_formValidate(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;const{values:t}=this.data,n=this.getProps(),s=n.validator||n.validateFields;return new Promise((i,a)=>{let o;try{o=s(t)}catch(l){o=l}if(o)zi(o)?o.then(l=>{if(l)e||(this.data.errors=l,this._adapter.notifyChange(this.data),this.injectErrorToField(l),this._adapter.forceUpdate(),this._autoScroll(100)),a(l);else{const d=this._adapter.cloneDeep(t);i(d),e||this.injectErrorToField({})}},l=>{e||this._autoScroll(100),a(l)}):(e||(this.data.errors=o,this.injectErrorToField(o),this._adapter.notifyChange(this.data),this._adapter.forceUpdate(),this._autoScroll(100)),a(o));else{const l=this._adapter.cloneDeep(t);i(l),e||this.injectErrorToField({})}})}_fieldsValidate(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const{values:n}=this.data;return new Promise((s,i)=>{let a=[];const o=this._getOperateFieldMap(e);o.forEach((l,d)=>{const u=this.getValue(d),h={notNotify:!0,notUpdate:!0,silent:t},f=l.fieldApi.validate(u,h);a.push(f),t||l.fieldApi.setTouched(!0,{notNotify:!0,notUpdate:!0})}),Promise.all(a).then(()=>{t||(this._adapter.notifyChange(this.data),this._adapter.forceUpdate());const l=this.getError();if(this._isValid(o)){const d=this._adapter.cloneDeep(n);s(d)}else t||this._autoScroll(),i(l)})})}submit(e){const{values:t}=this.data;this.validate().then(n=>{const s=this._adapter.cloneDeep(n);this._adapter.notifySubmit(s,e)}).catch(n=>{const s=this._adapter.cloneDeep(n),i=this._adapter.cloneDeep(t);this._adapter.notifySubmitFail(s,i,e)})}_getNestedField(e){const t=this.fields,n=[...t].map(i=>i[0]);let s=new Map;return n.forEach(i=>{let a=br(i),o=br(e);if(o.every((l,d)=>o[d]===a[d])){const l=t.get(i);s.set(i,l)}}),s}_getOperateFieldMap(e){let t=new Map;return me(e)?t=this.fields:e.forEach(n=>{const s=this.fields.get(n);if(me(s)){const i=this._getNestedField(n);t=new Map([...t,...i])}else t.set(n,s)}),t}reset(e){this._getOperateFieldMap(e).forEach(n=>{n.fieldApi.reset()}),this.registeredArrayField.size&&this._resetArrayField(),this._adapter.notifyChange(this.data),this._adapter.forceUpdate(),this._adapter.notifyReset()}_resetArrayField(){[...this.registeredArrayField.keys()].forEach(t=>{const s=this.registeredArrayField.get(t).initValue;this.updateStateValue(t,s,{notNotify:!0,notUpdate:!0}),this.updateArrayField(t,{updateKey:new Date().valueOf()})})}injectErrorToField(e){this.fields.forEach(t=>{const n=Ke(e,t.field),s={notNotify:!0,notUpdate:!0};t.fieldApi.setError(n,s)})}getValue(e,t){const n=typeof e>"u",s=t&&t.needClone;let i,a;switch(!0){case(!n&&!s):i=Ke(this.data.values,e);break;case(!n&&s):a=Ke(this.data.values,e),i=this._adapter.cloneDeep(a);break;case(n&&!s):i=Object.assign({},this.data.values);break;case(n&&s):i=this._adapter.cloneDeep(this.data.values);break}return i}setValues(e,t){let{isOverride:n=!1}=t;const s=this._adapter.cloneDeep(e);this.fields.forEach(i=>{const a=Ke(s,i.field),o={notNotify:!0,notUpdate:!0};i.fieldApi.setValue(a,o)}),this.registeredArrayField.size&&[...this.registeredArrayField.keys()].forEach(a=>{this.updateArrayField(a,{updateKey:new Date().valueOf()})}),n&&(this.data.values=s),this._adapter.notifyChange(this.data),this._adapter.notifyValueChange(this.data.values,Object.assign({},e)),this._adapter.forceUpdate()}updateStateValue(e,t,n,s){const i=n&&n.notNotify,a=n&&n.notUpdate,o=n&&n.fieldAllowEmpty,l=this.getProp("allowEmpty"),d=o||l;si(this.data.values,e,t,d),i||(this._adapter.notifyChange(this.data),this._adapter.notifyValueChange(this.data.values,{[e]:t})),a||this._adapter.forceUpdate(s)}getTouched(e){return typeof e>"u"?this.data.touched:Ke(this.data.touched,e)}updateStateTouched(e,t,n,s){const i=n&&n.notNotify,a=n&&n.notUpdate;si(this.data.touched,e,t),i||this._adapter.notifyChange(this.data),a||this._adapter.forceUpdate(s)}getError(e){return typeof e>"u"?this.data.errors:Ke(this.data.errors,e)}updateStateError(e,t,n,s){const i=n&&n.notNotify,a=n&&n.notUpdate;si(this.data.errors,e,t),i||this._adapter.notifyChange(this.data),this._adapter.notifyErrorChange(this.data.errors,{[e]:t}),a||this._adapter.forceUpdate(s)}getFieldSetterApi(){return{setValue:(s,i,a)=>{const o=this.fields.get(s)?this.fields.get(s).fieldApi:void 0,l=this._adapter.cloneDeep(i);o?o.setValue(l,a):(this.updateStateValue(s,l,a,()=>{let d=this._getNestedField(s);d.size&&d.forEach(u=>{let h=u.field,f=Ke(this.data.values,h),g={notNotify:!0,notUpdate:!0};u.fieldApi.setValue(f,g)})}),this.getArrayField(s)&&this.updateArrayField(s,{updateKey:new Date().valueOf()}))},setError:(s,i,a)=>{const o=this.fields.get(s)?this.fields.get(s).fieldApi:void 0,l=this._adapter.cloneDeep(i);o?o.setError(l,a):(this.updateStateError(s,l,a,()=>{let d=this._getNestedField(s);d.size&&d.forEach(u=>{let h=u.field,f=Ke(this.data.errors,h),g={notNotify:!0,notUpdate:!0};u.fieldApi.setError(f,g)})}),this.getArrayField(s)&&this.updateArrayField(s,{updateKey:new Date().valueOf()}))},setTouched:(s,i,a)=>{const o=this.fields.get(s)?this.fields.get(s).fieldApi:void 0;o?o.setTouched(i,a):(this.updateStateTouched(s,i,a,()=>{let l=this._getNestedField(s);l.size&&l.forEach(d=>{let u=d.field,h=Ke(this.data.touched,u),f={notNotify:!0,notUpdate:!0};d.fieldApi.setTouched(h,f)})}),this.getArrayField(s)&&this.updateArrayField(s,{updateKey:new Date().valueOf()}))}}}getModifyFormStateApi(){return{register:this.register,unRegister:this.unRegister,updateStateValue:this.updateStateValue,updateStateError:this.updateStateError,updateStateTouched:this.updateStateTouched,getValue:this.getValue,getError:this.getError,getTouched:this.getTouched,getInitValues:this.getInitValues,getInitValue:this.getInitValue,getFormProps:this.getFormProps,getField:this.getField,registerArrayField:this.registerArrayField,unRegisterArrayField:this.unRegisterArrayField,getArrayField:this.getArrayField,updateArrayField:this.updateArrayField}}getFormApi(){const e=this.getFieldSetterApi();return Object.assign(Object.assign({},e),{reset:t=>this.reset(t),validate:t=>this.validate(t),getValue:t=>this.getValue(t,{needClone:!0}),getValues:()=>this.getValue(void 0,{needClone:!0}),getFormState:()=>this.getFormState(!0),getFormProps:t=>this.getFormProps(t),getInitValue:t=>this.getInitValue(t),getInitValues:()=>this.getInitValues(),getTouched:t=>this.getTouched(t),getError:t=>this.getError(t),setValues:(t,n)=>this.setValues(t,n||{isOverride:!1}),submitForm:()=>this.submit(),getFieldExist:t=>this.getFieldExist(t),scrollToField:(t,n)=>this.scrollToField(t,n),scrollToError:t=>this.scrollToError(t)})}getFormState(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1)?this._adapter.cloneDeep(this.data):Object.assign({},this.data)}_isValid(e){let t=!0;return e?[...e.keys()].forEach(s=>{const i=Ke(this.data.errors,s);bn(i)||(t=!1)}):t=!!cl(this.data.errors),t}getInitValues(){return this._adapter.getInitValues()}getInitValue(e){return typeof e>"u"?this._adapter.getInitValues():Ke(this._adapter.getInitValues(),e)}getFormProps(e){return this._adapter.getFormProps(e)}getFieldExist(e){return!!this.fields.has(e)}_autoScroll(e){const{autoScrollToError:t}=this.getFormProps();if(!t)return;let n={behavior:"smooth",block:"start"};typeof t=="object"&&(n=t),e?setTimeout(()=>this._getErrorFieldAndScroll(n),100):this._getErrorFieldAndScroll(n)}_getErrorFieldAndScroll(e){const t=this._adapter.getAllErrorDOM();if(t&&t.length)try{const n=t[0].parentNode.parentNode;ai(n,e)}catch{}}scrollToField(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{behavior:"smooth",block:"start"};if(this.getFieldExist(e)){const n=this._adapter.getFieldDOM(e);ai(n,t)}}scrollToError(e){let t=e&&e.scrollOpts?e.scrollOpts:{behavior:"smooth",block:"start"},n=e&&e.field,s=e&&e.index,i,a;if(typeof s=="number"){let l=this._adapter.getAllErrorDOM()[s];l&&(i=l.parentNode.parentNode)}else if(n)a=this._adapter.getFieldErrorDOM(n),a&&(i=a.parentNode.parentNode);else if(typeof n>"u"){let o=this._adapter.getAllErrorDOM();o&&o.length&&(i=o[0].parentNode.parentNode)}i&&ai(i,t)}}const cr=p.createContext({});cr.displayName="FormState";const So=p.createContext({});So.displayName="FormApi";const cs=p.createContext({});cs.displayName="FormUpdater";const jh=p.createContext({shouldUseInitValue:!0,inArrayField:!1}),Ci=St.PREFIX;class ds extends C.PureComponent{generatorText(e){const{helpTextId:t,errorMessageId:n}=this.props,s=this.props.error;let i=n;if(s||(i=t),typeof e=="string")return p.createElement("span",{id:i},e);if(Array.isArray(e)){const a=e.filter(o=>o);return a.length?p.createElement("span",{id:i},a.join(", ")):null}else if(p.isValidElement(e))return e;return null}render(){const{error:e,className:t,style:n,validateStatus:s,helpText:i,showValidateIcon:a,isInInputGroup:o}=this.props,l=T({[Ci+"-field-error-message"]:!!e,[Ci+"-field-help-text"]:!!i},t);if(!e&&!i||e===""&&s==="error")return null;const d={warning:p.createElement(dl,null),error:p.createElement(Ii,null)},u=e?this.generatorText(e):this.generatorText(i);if(Array.isArray(e)&&!u&&!i)return null;const h=`${Ci}-field-validate-status-icon`;let f=null;return o?f=p.createElement(Ii,{className:h}):d[s]&&(f=p.cloneElement(d[s],{className:h})),p.createElement("div",{className:l,style:n},a&&u?f:null,u)}}ds.propTypes={error:c.oneOfType([c.bool,c.string,c.array,c.node]),className:c.string,style:c.object,validateStatus:c.string,showValidateIcon:c.bool,helpText:c.node,isInInputGroup:c.bool,errorMessageId:c.string,helpTextId:c.string};var Vh=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const Nn=St.PREFIX,Kh=r=>{let e,t,n,s,i,a="top";try{const S=C.useContext(cs).getFormProps(["labelPosition","labelWidth","labelAlign","labelCol","wrapperCol"]);e=S.labelCol,t=S.wrapperCol,n=S.labelWidth,s=S.labelAlign,a=S.labelPosition?S.labelPosition:a}catch{}r.labelPosition&&(a=r.labelPosition);let{children:o,label:l,className:d,style:u,error:h,noLabel:f}=r;Vh(r,["children","label","className","style","error","noLabel"]);const g=e&&t,b=T({[`${Nn}-field`]:!0,[`${Nn}-slot`]:!0},d),m=T({[`${Nn}-col-${s}`]:!0});switch(!0){case(zn(l)&&!p.isValidElement(l)):break;case(_e(l)||tt(l)):l={text:l};break;case p.isValidElement(l):l={text:l};break}let v=null;if(typeof h!==void 0){let E={};switch(!0){case(zn(h)&&!p.isValidElement(h)):E=h;break;case(_e(h)||tt(h)):E={error:h};break;case p.isValidElement(h):E={error:h};break}v=p.createElement(ds,Object.assign({},E))}let y=Object.assign({align:s,width:n},l),w=T({[`${Nn}-field-main`]:!0,[`${Nn}-slot-main`]:!0});switch(!0){case(!g&&!f):i=p.createElement(p.Fragment,null,p.createElement(It,Object.assign({},y)),p.createElement("div",{className:w},o,v));break;case(!g&&f):i=p.createElement(p.Fragment,null,p.createElement("div",{className:w},o,v));break;case(g&&a==="top"):i=p.createElement(p.Fragment,null,p.createElement("div",{style:{overflow:"hidden"}},p.createElement(nt,Object.assign({},e,{className:m}),p.createElement(It,Object.assign({},y)))),p.createElement(nt,null,o,v));break;case(g&&a!=="top"):i=p.createElement(p.Fragment,null,p.createElement(nt,Object.assign({},e,{className:m}),p.createElement(It,Object.assign({},y))),p.createElement(nt,null,o,v));break}return p.createElement("div",{className:b,"x-label-pos":a,style:u},i)},ca=St.PREFIX;class wo extends C.PureComponent{render(){const{text:e,className:t,style:n,children:s}=this.props,i=T({[ca+"-section"]:!0},t),a=ca+"-section-text";return p.createElement("section",{className:i,style:n},p.createElement("h5",{className:a},e),s)}}wo.propTypes={text:c.node,className:c.string,style:c.object,children:c.node};function Eo(){return C.useContext(cr)}const da={values:{},errors:{},touched:{}};function xo(){const[r,e]=C.useState(da),t=C.useRef(null),n=C.useRef(null),s=C.useCallback(l=>{t.current=l,n.current&&(n.current.__realApi=l),e(l.getFormState())},[]),i=C.useCallback(()=>{t.current=null,n.current&&(n.current.__realApi=null),e(da)},[]),a=C.useCallback(l=>{e(d=>d===l?d:l)},[]);if(n.current)n.current.__bind=s,n.current.__unbind=i,n.current.__updateState=a;else{const l={__realApi:null,__bind:s,__unbind:i,__updateState:a},d=new Proxy(l,{get(u,h){if(h.startsWith("__"))return u[h];const f=u.__realApi;if(!f)return typeof h=="string"?function(){console.warn(`[Semi Form] FormApi.${h}() is called before Form component is mounted. Please ensure the Form component is rendered first.`)}:void 0;const g=f[h];return typeof g=="function"?g.bind(f):g},set(u,h,f){return h.startsWith("__")?(u[h]=f,!0):!1}});n.current=d}const o=r.values;return[n.current,r,o]}function Hh(){return C.useContext(cs)}function Si(r){const e=C.useRef(void 0),[t,n]=C.useState(r);return e.current=t,[t,a=>{e.current=a,n(a)},()=>e.current]}function Bh(){return C.useContext(jh)}var Uh=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const pn=St.PREFIX,zh=r=>{const{fieldSet:e}=r,t=Eo(),n=e.map(s=>Ke(t.errors,s));return bn(n)?null:p.createElement(ds,{error:n,showValidateIcon:r.showValidateIcon,isInInputGroup:r.isInInputGroup})};class dr extends C.Component{renderLabel(e,t){return e?_e(e)?p.createElement(It,{width:t.labelWidth,text:e}):p.createElement(It,Object.assign({width:t.labelWidth},e)):null}render(){const e=this.props,{children:t,label:n,extraText:s,extraTextPosition:i}=e,a=Uh(e,["children","label","extraText","extraTextPosition"]),l=this.context.getFormProps(["labelPosition","labelWidth","labelAlign","showValidateIcon","wrapperCol","labelCol","disabled"]),d=this.props.labelPosition||l.labelPosition,u=[],h=p.Children.map(t,I=>I&&I.props&&I.props.field?(u.push(I.props.field),p.cloneElement(I,{isInInputGroup:!0})):null),f=T({[`${pn}-field-group`]:!0}),g=l.labelCol,b=l.wrapperCol,m=l.labelAlign,v=g&&b,y=g?`${pn}-col-${m}`:"",w=this.renderLabel(n,l),E=p.createElement(tr,Object.assign({disabled:l.disabled},a),h),S=p.createElement(zh,{fieldSet:u,showValidateIcon:l.showValidateIcon,isInInputGroup:!0}),x=T(`${pn}-field-extra`,{[`${pn}-field-extra-string`]:typeof s=="string",[`${pn}-field-extra-middle`]:i==="middle",[`${pn}-field-extra-bottom`]:i==="bottom"}),_=s?p.createElement("div",{className:x,"x-semi-prop":"extraText"},s):null;let P;switch(!0){case!v:P=p.createElement(p.Fragment,null,w,p.createElement("div",null,i==="middle"?_:null,E,i==="bottom"?_:null,S));break;case(v&&d==="top"):P=p.createElement(p.Fragment,null,p.createElement("div",{style:{overflow:"hidden"}},p.createElement(nt,Object.assign({},g,{className:y}),w)),p.createElement(nt,Object.assign({},b),i==="middle"?_:null,E,i==="bottom"?_:null,S));break;case(v&&d!=="top"):P=p.createElement(p.Fragment,null,p.createElement(nt,Object.assign({},g,{className:y}),w),p.createElement(nt,Object.assign({},b),i==="middle"?_:null,E,i==="bottom"?_:null,S));break}return p.createElement("div",{"x-label-pos":d,className:f},P)}}dr.contextType=cs;dr.defaultProps={extraTextPosition:"bottom"};function Wh(r,e){if(r===e)return!0;if(!r||!e||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Object.is(r[t],e[t]))return!1;return!0}function ua(r){const e=C.useRef(r);return Wh(e.current,r)||(e.current=r),e.current}const _t=St.PREFIX,wi=typeof window<"u"?C.useLayoutEffect:C.useEffect;function De(r,e){let t=(n,s)=>{let{field:i,label:a,labelPosition:o,labelWidth:l,labelAlign:d,labelCol:u,wrapperCol:h,noLabel:f,noErrorMessage:g,isInInputGroup:b,initValue:m,validate:v,validateStatus:y,trigger:w,allowEmptyString:E,allowEmpty:S,emptyValue:x,rules:_,required:P,keepState:I,transform:O,name:F,fieldClassName:D,fieldStyle:$,convert:L,stopValidateWithError:N,helpText:J,extraText:z,extraTextPosition:V,pure:G,id:H,rest:j}=Mh(n),{options:q,shouldInject:A}=Nh(e,n);if(ht(typeof i>"u"&&q.shouldInject,"[Semi Form]: 'field' is required, please check your props of Field Component"),!A)return p.createElement(r,Object.assign({},j,{ref:s}));Eo();const K=Hh();if(!K.getFormProps)return ht(!0,"[Semi Form]: Field Component must be use inside the Form, please check your dom declaration"),null;let oe=K.getFormProps(["labelPosition","labelWidth","labelAlign","labelCol","wrapperCol","disabled","showValidateIcon","extraTextPosition","stopValidateWithError","trigger"]),fe=o||oe.labelPosition,ce=l||oe.labelWidth,ve=d||oe.labelAlign,Ce=u||oe.labelCol,de=h||oe.wrapperCol,B=V||oe.extraTextPosition||"bottom",ft=Lh(N,oe.stopValidateWithError,!1),we=Ah(w,oe.trigger),Pe=typeof i<"u"?K.getValue(i):void 0,Se=typeof m<"u"?m:Pe,st,gt=!1;try{st=Bh(),st&&(gt=!!st.inArrayField,typeof m<"u"?st.shouldUseInitValue?Se=m:Se=typeof Pe<"u"?Pe:m:Se=Pe)}catch{}const[k,U,he]=Si(typeof Se!==void 0?Se:null),Ee=we.includes("mount");S=S||K.getFormProps().allowEmpty,I&&gt&&(ht(!0,`[Semi Form]: 'keepState' is not supported on Field "${i}" inside <ArrayField/>. It will be ignored. Use add/remove on the ArrayField to manage array items instead.`),I=!1);const[At,tn,us]=Si(),[nn,hs]=C.useState(),[hr,Lt]=Si(0),[mt,at]=C.useState(y),Tt=C.useRef(!1),ot=C.useRef(_),sn=C.useRef(v),Ut=C.useRef(null),kn=(W,X)=>{hs(W),K.updateStateTouched(i,W,X)},Je=(W,X)=>{if(Tt.current||W===us())return;X&&X.silent||(tn(W),bn(W)?at("success"):at("error")),K.updateStateError(i,W,X)},An=(W,X)=>{U(W);let ie=Object.assign(Object.assign({},X),{allowEmpty:S});K.updateStateValue(i,W,ie)},qs=()=>{let W={notNotify:!0,notUpdate:!0};An(Se!==null?Se:void 0,W),Je(void 0,W),kn(void 0,W),at("default")},ps=(W,X)=>{let ie=ot.current||[];const pe=Rh(i,ie),bt={[i]:W},Oe=new Promise(($e,Ln)=>{pe.validate(bt,{first:ft},(Qe,je)=>{}).then(Qe=>{if(Tt.current||Ut.current!==Oe){console.warn(`[Semi Form]: When FieldComponent (${i}) has an unfinished validation process, you repeatedly trigger a new validation, the old validation will be abandoned, and will neither resolve nor reject. Usually this is an unreasonable practice. Please check your code.`);return}at("success"),Je(void 0,X),$e({})}).catch(Qe=>{if(Tt.current||Ut.current!==Oe){console.warn(`[Semi Form]: When FieldComponent (${i}) has an unfinished validation process, you repeatedly trigger a new validation, the old validation will be abandoned, and will neither resolve nor reject. Usually this is an unreasonable practice. Please check your code.`);return}let{errors:je,fields:fs}=Qe;if(je&&fs){let an=je.map(_o=>_o.message);an.length===1&&(an=an[0]),Array.isArray(je)&&je.length>0&&(X!=null&&X.silent||at("error"),Je(an,X),$e(je))}else throw X!=null&&X.silent||at("error"),Je(Qe.message,X),$e(Qe.message),Qe})});return Ut.current=Oe,Oe},Ys=(W,X,ie)=>{const pe=new Promise(bt=>{let Oe;try{Oe=sn.current(W,X)}catch($e){Oe=$e}Oe===void 0?(bt({}),Je(void 0,ie)):zi(Oe)?Oe.then($e=>{if(Tt.current||Ut.current!==pe){console.warn(`[Semi Form]: When Field: (${i}) has an unfinished validation process, you repeatedly trigger a new validation, the old validation will be abandoned, and will neither resolve nor reject. Usually this is an unreasonable practice. Please check your code.`);return}bn($e)?(Je(void 0,ie),bt(null)):(Je($e,ie),bt($e))}):bn(Oe)?(Je(void 0,ie),bt(null)):(Je(Oe,ie),bt(Oe))});return Ut.current=pe,pe},rn=(W,X)=>{let ie=W,pe=ot.current;return O&&(ie=O(W)),sn.current?Ys(ie,K.getValue(),X):pe?ps(ie,X):null},Zs=function(W,X){let ie;q.valuePath?ie=Ke(W,q.valuePath):ie=W,typeof L=="function"&&(ie=L(ie)),E||S||ie===x&&(ie=void 0);try{X&&X.target&&X.target.selectionStart&&Lt(X.target.selectionStart)}catch{}const pe=he(),bt=K.getValue(i,{needClone:!0}),Oe=q.onKeyChangeFnName;try{if(U(ie),K.updateStateValue(i,ie,{notNotify:!0,notUpdate:!0,allowEmpty:S}),Oe in n&&typeof n[Oe]=="function"){const je=K.getValue();for(var $e=arguments.length,Ln=new Array($e>2?$e-2:0),Qe=2;Qe<$e;Qe++)Ln[Qe-2]=arguments[Qe];n[Oe](W,X,...Ln,je)}hs(!0),K.updateStateTouched(i,!0,{notNotify:!0,notUpdate:!0}),K.updateStateValue(i,ie,{allowEmpty:S}),we.includes("change")&&rn(ie)}catch(je){throw U(pe),K.updateStateValue(i,bt,{notNotify:!0,notUpdate:!0,allowEmpty:S}),je}},Re=function(){if(n.onBlur&&n.onBlur(...arguments),nn||kn(!0),we.includes("blur")){let W=he();rn(W)}},Ue={setValue:An,setTouched:kn,setError:Je,reset:qs,validate:rn},ze={value:k,error:At,touched:nn,status:mt};wi(()=>{ot.current=_,sn.current=v},[_,v]),wi(()=>(Tt.current=!1,Ee&&rn(k),()=>{Tt.current=!0}),[]),wi(()=>{if(typeof i>"u")return()=>{};const W=he();return K.register(i,{value:W,error:At,touched:nn,status:mt},{field:i,fieldApi:Ue,keepState:I,allowEmpty:S||E}),()=>{K.unRegister(i)}},[i]);const We=H||i,Ne=`${We}-label`,ke=`${We}-helpText`,Xe=`${We}-extraText`,Ft=`${We}-errormessage`,xe=()=>{let W=y||mt;const X=T(`${_t}-field-extra`,{[`${_t}-field-extra-string`]:typeof z=="string",[`${_t}-field-extra-middle`]:B==="middle",[`${_t}-field-extra-bottom`]:B==="bottom"}),ie=z?p.createElement("div",{className:X,id:Xe,"x-semi-prop":"extraText"},z):null;let pe=Object.assign(Object.assign({id:We,disabled:oe.disabled},j),{ref:s,onBlur:Re,[q.onKeyChangeFnName]:Zs,[q.valueKey]:k,validateStatus:W,"aria-required":P,"aria-labelledby":Ne});F&&(pe.name=F),J&&(pe["aria-describedby"]=z?`${ke} ${Xe}`:ke),z&&(pe["aria-describedby"]=J?`${ke} ${Xe}`:Xe),mt==="error"&&(pe["aria-errormessage"]=Ft,pe["aria-invalid"]=!0);const bt=T({[`${_t}-field`]:!0,[`${_t}-field-${F}`]:!!F,[D]:!!D}),Oe=T({[`${_t}-field-main`]:!0});fe==="inset"&&!f&&(pe.insetLabel=a||i,pe.insetLabelId=Ne,typeof a=="object"&&!Di(a)&&(pe.insetLabel=a.text,pe.insetLabelId=Ne));const $e=p.createElement(r,Object.assign({},pe));if(b)return $e;if(G){let gs=T(j.className,{[`${_t}-field-pure`]:!0,[`${_t}-field-${F}`]:!!F,[D]:!!D});return pe.className=gs,p.createElement(r,Object.assign({},pe))}let Ln=Ce&&de;const Qe=ve?`${_t}-col-${ve}`:"";let je=null;if(!f&&fe!=="inset"){let gs=typeof a=="object"&&!Di(a)?a:{};je=p.createElement(It,Object.assign({text:a||i,id:Ne,required:P,name:We||F||i,width:ce,align:ve},gs))}const fs=p.createElement("div",{className:Oe},B==="middle"?ie:null,$e,g?null:p.createElement(ds,{error:At,validateStatus:W,helpText:J,helpTextId:ke,errorMessageId:Ft,showValidateIcon:oe.showValidateIcon}),B==="bottom"?ie:null),an=p.createElement(p.Fragment,null,fe==="top"?p.createElement("div",{style:{overflow:"hidden"}},p.createElement(nt,Object.assign({},Ce,{className:Qe}),je)):p.createElement(nt,Object.assign({},Ce,{className:Qe}),je),p.createElement(nt,Object.assign({},de),fs));return p.createElement("div",{className:bt,style:$,"x-label-pos":fe,"x-field-id":i,"x-extra-pos":B},Ln?an:p.createElement(p.Fragment,null,je,fs))},xt=Object.keys(n).sort(),it=ua(xt),yt=ua(it.map(W=>n[W])),zt=[...Object.values(ze),it,yt,i,fe,ve,oe.disabled];return q.shouldMemo?C.useMemo(xe,[...zt]):xe()};return t=C.forwardRef(t),t.displayName=Dh(r),t}var Ei=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{d(n.next(u))}catch(h){a(h)}}function l(u){try{d(n.throw(u))}catch(h){a(h)}}function d(u){u.done?i(u.value):s(u.value).then(o,l)}d((n=n.apply(r,e||[])).next())})};class On extends Ye{constructor(e){var t;super(Object.assign({},e)),t=this,this.handleCurrentActiveIndexChange=(n,s)=>{s==="focus"&&this._adapter.onCurrentActiveIndexChange(n)},this.completeSingleInput=(n,s)=>Ei(this,void 0,void 0,function*(){var i;const a=this._isInProps("value");yield this._adapter.onCurrentActiveIndexChange(n+1);const o=[...this.getState("valueList")];o[n]=s,this._adapter.notifyValueChange(o),a||(yield this.updateValueList(o));const l=this.getProp("count");n+1>l-1?(this._adapter.changeSpecificInputFocusState(n,"blur"),(i=this.getProp("onComplete"))===null||i===void 0||i(o.join(""))):this._adapter.changeSpecificInputFocusState(n+1,"focus")}),this.validateValue=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";const s=t.getProp("format");let i=a=>!0;return typeof s=="string"?s==="number"?i=a=>a.length===0||On.numberReg.test(a):s==="mixed"&&(i=a=>a.length===0||On.mixedReg.test(a)):s instanceof RegExp?i=a=>s.test(a):typeof s=="function"&&(i=s),i(n)},this.updateValueList=n=>Ei(this,void 0,void 0,function*(){this._adapter.updateValueList(n)}),this.handlePaste=(n,s)=>Ei(this,void 0,void 0,function*(){n.preventDefault();const i=n.clipboardData.getData("text"),a=this.getProp("count");for(let o=s,l=0;o<a&&l<i.length;o++,l++){const d=i[l];if(this.validateValue(d))yield this.completeSingleInput(o,d);else break}}),this.handleKeyDownOnSingleInput=(n,s)=>{const i=[...this.getState("valueList")];n.key==="Backspace"?(i[s]="",this.updateValueList(i),this._adapter.notifyValueChange(i),this._adapter.changeSpecificInputFocusState(Math.max(0,s-1),"focus"),n.preventDefault()):n.key==="Delete"?(i[s]="",this.updateValueList(i),this._adapter.notifyValueChange(i),this._adapter.changeSpecificInputFocusState(Math.min(i.length-1,s+1),"focus"),n.preventDefault()):n.key==="ArrowLeft"?(this._adapter.changeSpecificInputFocusState(Math.max(0,s-1),"focus"),n.preventDefault()):n.key==="ArrowRight"&&(this._adapter.changeSpecificInputFocusState(Math.min(i.length-1,s+1),"focus"),n.preventDefault())}}}On.numberReg=/^\d*$/;On.mixedReg=/^[0-9a-zA-Z]$/;const Xh={PREFIX:`${be}-pincode`};var ha=function(r,e,t,n){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(u){try{d(n.next(u))}catch(h){a(h)}}function l(u){try{d(n.throw(u))}catch(h){a(h)}}function d(u){u.done?i(u.value):s(u.value).then(o,l)}d((n=n.apply(r,e||[])).next())})};class ts extends Be{constructor(e){super(e),this.inputDOMList=[],this.focus=t=>{const n=this.inputDOMList[t];n==null||n.focus(),n==null||n.setSelectionRange(1,1)},this.blur=t=>{var n;(n=this.inputDOMList[t])===null||n===void 0||n.blur()},this.renderSingleInput=t=>p.createElement(Qt,{ref:n=>this.inputDOMList[t]=n,key:`input-${t}`,autoFocus:this.props.autoFocus&&t===0,inputMode:this.props.format==="number"?"numeric":"text",value:this.state.valueList[t],size:this.props.size,disabled:this.props.disabled,onBlur:()=>this.foundation.handleCurrentActiveIndexChange(t,"blur"),onFocus:()=>this.foundation.handleCurrentActiveIndexChange(t,"focus"),onPaste:n=>this.foundation.handlePaste(n.nativeEvent,t),onKeyDown:n=>{this.foundation.handleKeyDownOnSingleInput(n.nativeEvent,t)},onChange:(n,s)=>{const i=s.nativeEvent;if(i&&"isComposing"in i&&i.isComposing)return;const a=n[n.length-1];this.foundation.validateValue(a)&&this.foundation.completeSingleInput(t,a)}}),this.foundation=new On(this.adapter),this.state={valueList:(this.props.value||this.props.defaultValue)&&(this.props.value||this.props.defaultValue).split("")||[],currentActiveIndex:0}}componentDidUpdate(e,t,n){e.value!==this.props.value&&this.foundation.updateValueList((this.props.value||"").split(""))}get adapter(){return Object.assign(Object.assign({},super.adapter),{onCurrentActiveIndexChange:e=>ha(this,void 0,void 0,function*(){yield this.setStateAsync({currentActiveIndex:e})}),notifyValueChange:e=>{var t,n;(n=(t=this.props).onChange)===null||n===void 0||n.call(t,e.join(""))},changeSpecificInputFocusState:(e,t)=>{var n,s,i,a;t==="focus"?(s=(n=this.inputDOMList[e])===null||n===void 0?void 0:n.focus)===null||s===void 0||s.call(n):t==="blur"&&((a=(i=this.inputDOMList[e])===null||i===void 0?void 0:i.blur)===null||a===void 0||a.call(i))},updateValueList:e=>ha(this,void 0,void 0,function*(){yield this.setStateAsync({valueList:e})})})}render(){const e=[];for(let t=0;t<this.props.count;t++)e.push(this.renderSingleInput(t));return p.createElement("div",{className:T(`${Xh.PREFIX}-wrapper`,this.props.className),style:this.props.style},e)}}ts.__SemiComponentName__="PinCode";ts.propTypes={value:c.string,format:c.oneOfType([c.string,c.object,c.func]),onChange:c.func,defaultValue:c.string,count:c.number,className:c.string,style:c.object,autoFocus:c.bool,onComplete:c.func};ts.defaultProps=kt(ts.__SemiComponentName__,{count:6,format:"number",autoFocus:!0});const Gh=De(Qt,{maintainCursor:!0}),qh=De(hl,{maintainCursor:!0}),Yh=De(ul,{maintainCursor:!0}),ur=De(Ui);ur.Option=Ui.Option;ur.OptGroup=Ui.OptGroup;const Zh=De(Oa),Jh=De(Pa,{valueKey:"checked",valuePath:"target.checked",shouldInject:!1}),Qh=De(pl,{valuePath:"target.value"}),ep=De(fl,{valueKey:"checked",valuePath:"target.checked",shouldInject:!1}),tp=De(yl),np=De(bl,{valueKey:"checked"}),sp=De(xn),ip=De(Jn),rp=De(_n),ap=De(En),op=De(Xs),lp=De(wn,{valueKey:"value",onKeyChangeFnName:"onChange"}),cp=De(Pn,{valueKey:"fileList",valuePath:"fileList",onKeyChangeFnName:"onChange"}),dp=De(os),up=De(ts);var hp=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(r,n[s])&&(t[n[s]]=r[n[s]]);return t};const xi=St.PREFIX;class ae extends Be{constructor(e){super(e),this.state={formId:""},ht(!!(e.component&&e.render),"[Semi Form] You should not use <Form component> and <Form render> in ths same time; <Form render> will be ignored"),ht(e.component&&e.children&&!Pr(e.children),"[Semi Form] You should not use <Form component> and <Form>{children}</Form> in ths same time; <Form>{children}</Form> will be ignored"),ht(e.render&&e.children&&!Pr(e.children),"[Semi Form] You should not use <Form render> and <Form>{children}</Form> in ths same time; <Form>{children}</Form> will be ignored"),this.submit=this.submit.bind(this),this.reset=this.reset.bind(this),this.foundation=new $h(this.adapter),this.formApi=this.foundation.getFormApi(),this.props.getFormApi&&this.props.getFormApi(this.formApi)}componentDidMount(){this.foundation.init(),this.props.form&&typeof this.props.form.__bind=="function"&&this.props.form.__bind(this.formApi)}componentWillUnmount(){this.foundation.destroy(),this.props.form&&typeof this.props.form.__unbind=="function"&&this.props.form.__unbind()}get adapter(){return Object.assign(Object.assign({},super.adapter),{cloneDeep:Jo,notifySubmit:(e,t)=>{this.props.onSubmit(e,t)},notifySubmitFail:(e,t,n)=>{this.props.onSubmitFail(e,t,n)},forceUpdate:e=>{if(this.forceUpdate(e),this.props.form&&typeof this.props.form.__updateState=="function"){const t=this.foundation.getFormState();this.props.form.__updateState(t)}},notifyChange:e=>{this.props.onChange(e)},notifyValueChange:(e,t)=>{this.props.onValueChange(e,t)},notifyErrorChange:(e,t)=>{this.props.onErrorChange(e,t)},notifyReset:()=>{this.props.onReset()},initFormId:()=>{this.setState({formId:Es()})},getInitValues:()=>this.props.initValues,getFormProps:e=>{if(typeof e>"u")return this.props;if(typeof e=="string")return this.props[e];{const t={};return e.forEach(n=>{t[n]=this.props[n]}),t}},getAllErrorDOM:()=>{const{formId:e}=this.state,{id:t}=this.props,n=t||e;return document.querySelectorAll(`form[x-form-id="${n}"] .${St.PREFIX}-field-error-message`)},getFieldDOM:e=>{const{formId:t}=this.state,{id:n}=this.props,s=n||t;return document.querySelector(`form[x-form-id="${s}"] .${St.PREFIX}-field[x-field-id="${e}"]`)},getFieldErrorDOM:e=>{const{formId:t}=this.state,{id:n}=this.props;let i=`form[x-form-id="${n||t}"] .${St.PREFIX}-field[x-field-id="${e}"] .${St.PREFIX}-field-error-message`;return document.querySelector(i)}})}get content(){const{children:e,component:t,render:n}=this.props,s=this.foundation.getFormState(),i={formState:s,formApi:this.foundation.getFormApi(),values:s.values};return t?p.createElement(t,i):n?n(i):typeof e=="function"?e(i):e}submit(e){e.preventDefault(),this.props.stopPropagation&&this.props.stopPropagation.submit&&e.stopPropagation(),this.foundation.submit(e)}reset(e){e.preventDefault(),this.props.stopPropagation&&this.props.stopPropagation.reset&&e.stopPropagation(),this.foundation.reset()}render(){const t=this.foundation.getFormState(!1),n=this.foundation.getModifyFormStateApi(),{formId:s}=this.state,i=this.props,{children:a,form:o,getFormApi:l,onChange:d,onSubmit:u,onSubmitFail:h,onErrorChange:f,onValueChange:g,component:b,render:m,validateFields:v,validator:y,initValues:w,layout:E,style:S,className:x,labelPosition:_,labelWidth:P,labelAlign:I,labelCol:O,wrapperCol:F,allowEmpty:D,autoScrollToError:$,showValidateIcon:L,stopValidateWithError:N,extraTextPosition:J,id:z,trigger:V}=i,G=hp(i,["children","form","getFormApi","onChange","onSubmit","onSubmitFail","onErrorChange","onValueChange","component","render","validateFields","validator","initValues","layout","style","className","labelPosition","labelWidth","labelAlign","labelCol","wrapperCol","allowEmpty","autoScrollToError","showValidateIcon","stopValidateWithError","extraTextPosition","id","trigger"]),H=T(xi,x,{[xi+"-vertical"]:E==="vertical",[xi+"-horizontal"]:E==="horizontal"}),j=F&&O,q=p.createElement("form",Object.assign({style:S},G,{onReset:this.reset,onSubmit:this.submit,className:H,id:z||s,"x-form-id":z||s}),this.content),A=p.createElement(Ws,null,q);return p.createElement(cs.Provider,{value:n},p.createElement(So.Provider,{value:this.formApi},p.createElement(cr.Provider,{value:t},j?A:q)))}}ae.__SemiComponentName__="Form";ae.propTypes={"aria-label":c.string,onSubmit:c.func,onSubmitFail:c.func,onChange:c.func,onReset:c.func,onValueChange:c.func,autoScrollToError:c.oneOfType([c.bool,c.object]),allowEmpty:c.bool,className:c.string,component:c.oneOfType([c.node,c.func]),disabled:c.bool,extraTextPosition:c.oneOf($n.EXTRA_POS),getFormApi:c.func,initValues:c.object,validateFields:c.func,validator:c.func,layout:c.oneOf($n.LAYOUT),labelPosition:c.oneOf($n.LABEL_POS),labelWidth:c.oneOfType([c.number,c.string]),labelAlign:c.oneOf($n.LABEL_ALIGN),labelCol:c.object,render:c.func,style:c.object,showValidateIcon:c.bool,stopValidateWithError:c.bool,stopPropagation:c.shape({submit:c.bool,reset:c.bool}),id:c.string,wrapperCol:c.object,trigger:c.oneOfType([c.oneOf(["blur","change","custom","mount"]),c.arrayOf(c.oneOf(["blur","change","custom","mount"]))]),form:c.object};ae.defaultProps=kt(ae.__SemiComponentName__,{onChange:M,onSubmitFail:M,onSubmit:M,onReset:M,onValueChange:M,onErrorChange:M,layout:"vertical",labelPosition:"top",allowEmpty:!1,autoScrollToError:!1,showValidateIcon:!0});ae.Input=Gh;ae.TextArea=Yh;ae.InputNumber=qh;ae.Select=ur;ae.Checkbox=Jh;ae.CheckboxGroup=Zh;ae.Radio=ep;ae.RadioGroup=Qh;ae.DatePicker=tp;ae.TimePicker=ip;ae.Switch=np;ae.Slider=sp;ae.TreeSelect=rp;ae.Cascader=ap;ae.Rating=op;ae.AutoComplete=lp;ae.Upload=cp;ae.TagInput=dp;ae.PinCode=up;ae.Slot=Kh;ae.ErrorMessage=ds;ae.InputGroup=dr;ae.Label=It;ae.Section=wo;ae.useForm=xo;ae.useForm=xo;const pp=["Asia/Shanghai","Asia/Chongqing","Asia/Harbin","Asia/Urumqi","Asia/Hong_Kong","Asia/Macau","Asia/Taipei","UTC"],fp='<script async defer src="{host}/sdk/wstat.js" data-site-key="{site_key}" data-host="{host}"><\/script>';function Np(){const{t:r}=Qo(),{refreshSites:e}=el(),t=tl(),[n,s]=C.useState([]),[i,a]=C.useState(!1),[o,l]=C.useState(""),[d,u]=C.useState(!1),[h,f]=C.useState(null),[g,b]=C.useState(!1),[m,v]=C.useState(null),[y,w]=C.useState(null),[E,S]=C.useState(!1),[x,_]=C.useState(""),[P,I]=C.useState(!1),[O,F]=C.useState(null),[D,$]=C.useState(null),[L,N]=C.useState(""),[J,z]=C.useState(""),[V,G]=C.useState(null),H=C.useCallback(async()=>{a(!0);try{const k=await Nt.sites();s(k),l("")}catch(k){l(k.message)}finally{a(!1)}},[]);C.useEffect(()=>{H()},[H]),C.useEffect(()=>{Nt.sdkCode().then(k=>N(k&&k.template||"")).catch(()=>{})},[]);const j=()=>{f(null),u(!0)},q=k=>{if(de(k)){et.warning(r("editLocked"));return}f(k),u(!0)},A=async k=>{b(!0);try{h?(await Nt.updateSite(h.id,k),et.success(r("edit")+" ✓")):(await Nt.createSite(k),et.success(r("addSite")+" ✓")),u(!1),await H(),e()}catch(U){et.error(U.message)}finally{b(!1)}},K=async()=>{if(V)try{const k=await Nt.deleteSite(V.id),U=k&&k.deleted||{};et.success(`${r("delDone")} ✓ · ${r("evtLabel")} ${U.events??0} · ${r("sessLabel")} ${U.sessions??0}`),G(null),await H(),e()}catch(k){et.error(k.message)}},oe=k=>{v(k),w(null),_(""),F(null),k&&(S(!0),Nt.verifyFile(k.id).then(U=>{w(U),_("")}).catch(U=>_(U.message)).finally(()=>S(!1)))},fe=async()=>{if(m){I(!0),F(null);try{const k=await Nt.verifySite(m.id);F(k),await H(),e(),k.verified?(v(U=>U&&{...U,verified_at:Math.floor(Date.now()/1e3)}),et.success(r("verifyOk")+" ✓")):et.error(r("verifyHint"))}catch(k){F({verified:!1,hint:k.message}),et.error(k.message)}finally{I(!1)}}},ce=k=>{k&&((k.verified_at||0)>0?$(k):(et.warning(r("sdkLockedHint")),oe(k)))},ve=()=>{v(null),w(null),F(null)},Ce=async k=>{if(!de(k)){et.warning(r("sdkLockedHint")),oe(k);return}try{const U=await Nt.screenToken(k.id),he=`${B}/screen?site_id=${k.id}&token=${U.token}`;await Pe(he,`screen-${k.id}`),window.open(he,"_blank","noopener"),et.success(r("screenCopied"))}catch(U){et.error(U.message)}},de=k=>((k==null?void 0:k.verified_at)||0)>0,B=typeof location<"u"?location.origin:"https://stats.example.com",we=D?(k=>(L||fp).replace(/\{site_key\}/g,k).replace(/\{(?:host|origin)\}/g,B))(D.site_key):"",Pe=async(k,U)=>{try{await navigator.clipboard.writeText(k)}catch{try{const Ee=document.createElement("textarea");Ee.value=k,document.body.appendChild(Ee),Ee.select(),document.execCommand("copy"),document.body.removeChild(Ee)}catch{}}z(U),setTimeout(()=>z(he=>he===U?"":he),1600)},Se=()=>{if(!(!y||!y.file))try{const k=new Blob([String(y.content??"")],{type:"text/plain;charset=utf-8"}),U=URL.createObjectURL(k),he=document.createElement("a");he.href=U,he.download=y.file,he.rel="noopener",document.body.appendChild(he),he.click(),document.body.removeChild(he),setTimeout(()=>URL.revokeObjectURL(U),1e3)}catch{et.error(r("vfDownloadFail"))}},st=[{title:r("siteName"),dataIndex:"name",width:160,render:(k,U)=>R.jsx(xs.Text,{strong:!0,children:k})},{title:r("domain"),dataIndex:"domain",width:170,render:k=>R.jsx("span",{style:{wordBreak:"break-all"},children:k})},{title:r("siteKey"),dataIndex:"site_key",width:110,render:k=>R.jsx("span",{style:{fontFamily:"monospace"},children:k})},{title:r("statusLabel"),dataIndex:"verified_at",width:100,render:(k,U)=>R.jsx(Pt,{color:de(U)?"green":U.status===0?"grey":"orange",children:de(U)?r("verified"):r("unverified")})},{title:r("sharedRole"),dataIndex:"role",width:96,render:k=>R.jsx(Pt,{size:"small",color:k==="owner"?"green":k==="editor"?"blue":"amber",children:r(k==="owner"?"roleOwner":k==="editor"?"roleEditor":"roleViewer")})},{title:r("time"),dataIndex:"created_at",width:100,render:k=>nl(k)},{title:r("actions"),dataIndex:"id",width:300,render:(k,U)=>{const he=de(U),Ee=U.role==="owner";return R.jsxs(ms,{children:[R.jsx(Ie,{size:"small",theme:he?"solid":"borderless",type:he?"primary":"tertiary",disabled:!he,onClick:()=>ce(U),children:"SDK"}),R.jsx(Ie,{size:"small",theme:"borderless",disabled:!Ee,onClick:()=>oe(U),children:r("verifyNow")}),R.jsx(Ie,{size:"small",theme:"borderless",disabled:!he,onClick:()=>Ce(U),children:r("screen")}),Ee?he?R.jsx(Ot,{content:r("editLocked"),children:R.jsx("span",{children:R.jsx(Ie,{size:"small",theme:"borderless",disabled:!0,children:r("edit")})})}):R.jsx(Ie,{size:"small",theme:"borderless",onClick:()=>q(U),children:r("edit")}):R.jsx(Ot,{content:r("readonlyTip"),children:R.jsx("span",{children:R.jsx(Ie,{size:"small",theme:"borderless",disabled:!0,children:r("edit")})})}),R.jsx(Ie,{size:"small",theme:"borderless",type:"danger",disabled:!Ee,onClick:()=>G(U),children:r("delete")})]})}}],gt=(n||[]).filter(k=>k.role&&k.role!=="owner").length;return R.jsxs("div",{className:"page",children:[R.jsxs("div",{className:"toolbar",children:[R.jsx(xs.Title,{heading:5,style:{margin:0},children:r("sites")}),R.jsxs(ms,{children:[R.jsx(Ie,{theme:"borderless",onClick:()=>t("/members"),children:r("members")}),R.jsx(Ie,{theme:"solid",onClick:j,children:`+ ${r("addSite")}`})]})]}),o&&R.jsx(on,{type:"danger",description:o,style:{marginBottom:12}}),gt>0&&R.jsx(on,{type:"info",description:r("memberIntro"),style:{marginBottom:12}}),R.jsx("div",{className:"card",style:{padding:0,overflow:"hidden"},children:R.jsx(ll,{columns:st,dataSource:n,rowKey:"id",loading:i,pagination:!1,empty:R.jsx(sl,{description:r("noData")}),size:"middle"})}),R.jsx(Mn,{title:h?`${r("editSite")} · ${h.name}`:r("addSite"),visible:d,onCancel:()=>u(!1),footer:null,width:460,children:R.jsxs(ae,{onSubmit:A,initValues:h?{name:h.name,domain:h.domain,timezone:h.timezone}:{timezone:"Asia/Shanghai"},style:{paddingTop:8},children:[R.jsx(ae.Input,{field:"name",label:r("siteName"),rules:[{required:!0,message:r("siteName")}]}),R.jsx(ae.Input,{field:"domain",label:r("domain"),rules:[{required:!0,message:r("domain")}],extraText:"www.example.com / 127.0.0.1 / localhost",placeholder:"www.example.com"}),R.jsx(ae.Select,{field:"timezone",label:r("timezone"),optionList:pp.map(k=>({value:k,label:k}))}),R.jsx("div",{style:{textAlign:"right",marginTop:8},children:R.jsxs(ms,{children:[R.jsx(Ie,{onClick:()=>u(!1),children:r("cancel")}),R.jsx(Ie,{theme:"solid",htmlType:"submit",loading:g,children:r("save")})]})})]},h?"edit-"+h.id:"new")}),R.jsx(Mn,{title:`${r("verifyNow")} · ${(m==null?void 0:m.name)||""}`,visible:!!m,footer:null,onCancel:ve,width:560,children:m&&R.jsxs("div",{className:"modal-desc",children:[R.jsx(ls,{row:!0,data:[{key:r("domain"),value:R.jsx("span",{style:{wordBreak:"break-all"},children:m.domain})},{key:r("siteKey"),value:R.jsx("span",{style:{fontFamily:"monospace"},children:m.site_key})},{key:r("statusLabel"),value:R.jsx(Pt,{color:de(m)||O!=null&&O.verified?"green":"orange",children:de(m)||O!=null&&O.verified?r("verified"):r("unverified")})}]}),R.jsxs("div",{className:"vf-step",children:[R.jsx("span",{style:{color:"#2a5cff"},children:"①"})," ",r("verifyFileGen")]}),E&&R.jsx(vn,{style:{margin:"12px 0"}}),x&&R.jsx(on,{type:"danger",description:x,style:{margin:"8px 0"}}),!E&&!x&&y&&R.jsxs("div",{className:"vf-card",children:[R.jsxs("div",{className:"vf-field",children:[r("vfFileName"),R.jsx(Ie,{size:"small",theme:"borderless",style:{float:"right",height:20},onClick:()=>Pe(y.file,"fn"),children:r(J==="fn"?"copied":"copy")})]}),R.jsx("pre",{className:"code-block",children:y.file}),R.jsxs("div",{className:"vf-field",children:[r("vfContent"),R.jsx(Ie,{size:"small",theme:"borderless",style:{float:"right",height:20},onClick:()=>Pe(y.content,"ct"),children:r(J==="ct"?"copied":"copy")})]}),R.jsx("pre",{className:"code-block",children:y.content}),R.jsx("div",{style:{fontSize:12,color:"#86909c",lineHeight:1.7,marginTop:8},children:r("vfStep")}),R.jsxs(ms,{style:{marginTop:10},children:[R.jsx(Ie,{theme:"solid",size:"small",onClick:Se,children:r("vfDownload")}),R.jsx(xs.Text,{type:"tertiary",size:"small",children:r("vfDownloadHint")})]}),R.jsxs("div",{style:{fontSize:12,color:"#86909c",lineHeight:1.7,marginTop:8,fontFamily:"monospace",wordBreak:"break-all"},children:["https://",m.domain,"/",y.file]})]}),de(m)||O!=null&&O.verified?R.jsxs("div",{style:{marginTop:8},children:[R.jsx(on,{type:"success",description:r("verifyPassGoSdk"),style:{margin:"10px 0"}}),R.jsx(Ie,{theme:"solid",onClick:()=>{$(m),ve()},children:r("seeSdk")})]}):R.jsxs(R.Fragment,{children:[R.jsx(Ie,{theme:"solid",loading:P,disabled:!y,onClick:fe,style:{marginTop:6},children:r("checkBtn")}),O&&!O.verified&&R.jsx(on,{type:"warning",style:{marginTop:12},description:O.hint||r("verifyHint")}),R.jsx("div",{style:{fontSize:12,color:"#86909c",lineHeight:1.7,marginTop:10},children:r("verifyingHost").replace("{domain}",m.domain)})]})]})}),R.jsx(Mn,{title:`SDK · ${(D==null?void 0:D.name)||""}`,visible:!!D,footer:null,onCancel:()=>$(null),width:640,children:D&&R.jsxs("div",{className:"modal-desc",children:[de(D)?R.jsx(Pt,{color:"green",style:{marginBottom:10},children:r("verified")}):R.jsxs(Pt,{color:"orange",style:{marginBottom:10},children:[r("unverified")," · ",r("sdkLocked")]}),R.jsx("div",{style:{fontWeight:600,margin:"4px 0 8px"},children:r("installCode")}),R.jsx("pre",{className:"code-block",style:{background:"#0f172a",color:"#e2e8f0",userSelect:"text"},children:we}),R.jsx(Ie,{size:"small",style:{marginTop:10},onClick:()=>Pe(we,"sdk"),children:r(J==="sdk"?"copied":"copy")}),R.jsx("div",{style:{marginTop:14,fontWeight:600},children:r("installSteps")}),R.jsxs("ol",{style:{color:"#4e5969",paddingLeft:20,fontSize:13,lineHeight:2,margin:0},children:[R.jsx("li",{children:r("s1")}),R.jsx("li",{children:r("s2")}),R.jsx("li",{children:r("s3")})]})]})}),R.jsx(Mn,{title:r("deleteSite"),visible:!!V,onCancel:()=>G(null),onOk:K,okText:r("delete"),cancelText:r("cancel"),type:"warning",children:V&&R.jsxs("div",{children:[R.jsxs("span",{children:[r("delConfirm"),"(",V.name," · ",V.domain,")"]}),R.jsx(on,{type:"danger",style:{marginTop:10},description:r("delCascadeWarn")})]})})]})}export{Np as default};