-
Notifications
You must be signed in to change notification settings - Fork 1
/
5166-90d97f832798ce9afa5e.js
1 lines (1 loc) · 40.3 KB
/
5166-90d97f832798ce9afa5e.js
1
(self.webpackChunkzent_docs=self.webpackChunkzent_docs||[]).push([[5166,6298],{63919:(e,t,n)=>{"use strict";n.d(t,{I:()=>U});var r=n(59312),o=n(24246),i=n(60042),a=n.n(i),l=n(27378),s=n(33806),c=n(52074),u=n(27036),p=n(68150),d=n(62593),v=n(82049).Z,h=n(20840);function f(e){return(0,o.jsx)("span",(0,r.pi)({className:"zent-cascader-v2__menu-item-label","data-zv":"10.0.10"},{children:e.label}),void 0)}function g(e){return e.label}var m=(0,s.ZP.withPopover)(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.closePopup=function(){var e;return null===(e=t.props.popover)||void 0===e?void 0:e.close()},t}return(0,r.ZT)(t,e),t.prototype.render=function(){return(0,o.jsx)("div",(0,r.pi)({className:"zent-cascader-v2__popup-inner zent-cascader-v2__popup-inner-menu","data-zv":"10.0.10"},{children:this.renderPanels()}),void 0)},t.prototype.getMenuItemIcon=function(e,t,n){var r=this.props.loading;if(e.loadChildrenOnExpand){var i=(0,d.Fd)(e);if(-1!==r.indexOf(i)&&t)return(0,o.jsx)("i",{className:"zent-cascader-v2__menu-item-loading zenticon","data-zv":"10.0.10"},void 0)}var a=e.children&&e.children.length>0;return a||e.loadChildrenOnExpand?(0,o.jsx)(u.Z,{className:"zent-cascader-v2__menu-item-icon",type:"right"},void 0):!a&&t&&n?(0,o.jsx)(u.Z,{className:"zent-cascader-v2__menu-item-icon",type:"check"},void 0):null},t.prototype.handleClickOption=function(e,t,n){var r=this.props,o=r.onOptionClick,i=r.multiple,a=r.multipleType,l=r.onOptionToggle;o(e,t),i&&"normal"===a&&e.children&&0===e.children.length&&l(e,!("on"===n))},t.prototype.renderCascaderItems=function(e,t,n){var i=this,l=this.props.i18n;if(!e||0===(null==e?void 0:e.length))return(0,o.jsx)("div",(0,r.pi)({className:"zent-cascader-v2__menu-empty","data-zv":"10.0.10"},{children:l.empty}),"menu-empty");var s=this.props,c=s.value,u=s.onOptionHover,f=s.expandTrigger,g=s.scrollLoad,m=s.loadChildrenOnScroll,y=s.scrollable,b=s.multiple,C=s.multipleType,x=s.selectionMap,w=s.renderItemContent,z=s.getItemTooltip,P=s.renderList,k=function(e,n){var l;b&&(l=x.get((0,d.Fd)(e)));var s=b?"on"===l||"partial"===l:e.value===c[t-1],v=a()("zent-cascader-v2__menu-item",{"zent-cascader-v2__menu-item--active":s,"zent-cascader-v2__menu-item--disabled":e.disabled,"zent-cascader-v2__menu-item--multiple":b,"zent-cascader-v2__menu-item--multiple--checkbox":b&&"checkbox"===C,"zent-cascader-v2__menu-item--multiple--normal":b&&"normal"===C,"zent-cascader-v2__menu-item--leaf":0===e.children.length&&!e.loadChildrenOnExpand}),h=b&&"checkbox"!==C;return(0,o.jsxs)("div",(0,r.pi)({className:v,title:z(e),onClick:e.disabled?void 0:function(){return i.handleClickOption(e,i.closePopup,l)},onMouseEnter:e.disabled||"hover"!==f?void 0:function(){return u(e)},style:n,"data-zv":"10.0.10"},{children:[b&&"checkbox"===C&&(0,o.jsx)(p.ZP,{value:e.value,onChange:function(t){return i.props.onOptionToggle(e,t.target.checked)},checked:"on"===l,indeterminate:"partial"===l,disabled:e.disabled},void 0),w(e),i.getMenuItemIcon(e,s,h)]}),e.value)},T="menu-"+c.slice(0,t-1).join("-");if("function"==typeof P)return(0,o.jsx)("div",(0,r.pi)({className:"zent-cascader-v2__menu","data-zv":"10.0.10"},{children:P(e,k)}),T);var S=e.map((function(e){return k(e)})),j=null===n?m:n.loadChildrenOnScroll;return(0,o.jsx)("div",(0,r.pi)({className:"zent-cascader-v2__menu","data-zv":"10.0.10"},{children:y&&j?(0,o.jsx)(v,(0,r.pi)({className:"zent-cascader-v2__menu-scroller",hasMore:j,loader:(0,o.jsx)(h.Z,{iconSize:18,loading:!0,colorPreset:"grey",icon:"circle",iconText:l.loading,textPosition:"right",className:"zent-cascader-v2__menu-scroller-loading"},void 0),loadMore:function(){return g(n)},skipLoadOnMount:!0},{children:S}),void 0):S}),T)},t.prototype.renderPanels=function(){var e=[],t=this.props.value,n=this.props.options,r=1;if(e.push(this.renderCascaderItems(n,r,null)),(null==t?void 0:t.length)>0&&(null==n?void 0:n.length)>0)for(var o=function(o){r++;var a=n.find((function(e){return e.value===t[o]}));(n=(0,d.El)(n,t[o])).length>0&&e.push(i.renderCascaderItems(n,r,a))},i=this,a=0;a<t.length;a++)o(a);return e},t.defaultProps={renderItemContent:f,getItemTooltip:g},t}(l.Component)),y=n(74194),b=n(56717),C=n(33938),x=n(50993),w=(0,s.ZP.withPopover)(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.closePopup=function(){var e;return null===(e=t.props.popover)||void 0===e?void 0:e.close()},t}return(0,r.ZT)(t,e),t.prototype.onOptionClick=function(e){(0,this.props.onOptionClick)(e,this.closePopup)},t.prototype.renderSearchingOrEmpty=function(){var e=this.props,t=e.isSearching,n=e.i18n;return(0,o.jsx)("div",(0,r.pi)({className:"zent-cascader-v2--search-empty","data-zv":"10.0.10"},{children:t?(0,o.jsx)(x.Z,{height:32,iconSize:18,loading:!0,colorPreset:"grey",icon:"circle"},void 0):n.searchEmpty}),void 0)},t.prototype.renderPanels=function(){var e=this,t=this.props,n=t.searchList,i=t.multiple,l=t.highlight,s=t.keyword,c=t.selectionMap;return(0,o.jsx)("ul",(0,r.pi)({className:"zent-cascader-v2--search-list","data-zv":"10.0.10"},{children:n.map((function(t){var n,u=t[t.length-1],p=a()("zent-cascader-v2--search-item",{"zent-cascader-v2--search-item--multiple":i});return i&&(n=c.get((0,d.Fd)(u))),(0,o.jsxs)("li",(0,r.pi)({className:p,onClick:u.disabled||i?void 0:function(){return e.onOptionClick(t)},"data-zv":"10.0.10"},{children:[i&&(0,o.jsx)(C.X,{value:u.value,onChange:function(n){return e.props.onOptionToggle(t,n.target.checked)},checked:"on"===n,disabled:u.disabled},void 0),l(s,t)]}),(0,y.aM)(t))}))}),void 0)},t.prototype.render=function(){var e=this.props,t=e.isSearching,n=e.searchList;return(0,o.jsx)("div",(0,r.pi)({className:"zent-cascader-v2__popup-inner zent-cascader-v2__popup-inner-search","data-zv":"10.0.10"},{children:t||!n.length?this.renderSearchingOrEmpty():this.renderPanels()}),void 0)},t}(l.Component)),z=n(49566),P=n(8327).L,k=n(1348),T=Object.prototype.hasOwnProperty;function S(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}var j=n(64073),O=function(e){var t=e.path,n=e.renderValue,i=e.onRemove;return(0,o.jsxs)("div",(0,r.pi)({className:"zent-cascader-v2--tag","data-zv":"10.0.10"},{children:[(0,o.jsx)("span",(0,r.pi)({title:(0,y.kz)(t),className:"zent-cascader-v2--tag-path","data-zv":"10.0.10"},{children:n(t)}),void 0),(0,o.jsx)(u.Z,{type:"close",className:"zent-cascader-v2--tag-close",onClick:i},void 0)]}),void 0)},N=n(85883),Z=n(76187);function _(e,t){var n=new Z.cp([]);return e.forEach((function(e){return n.insertPath(e)})),n.reduceNode((function(e,n){var r=(0,d.Fd)(n);return"on"===t.get(r)&&(n.children=[]),e}),null),n.reducePath((function(e,t){return e.push(t),e}),[])}var V=function(e){var t,n=e.list,i=e.renderValue,a=e.selectionMap,l=e.simplifyPaths,s=e.onRemove,c=e.collapse,u=l?_(n,a):n,p=c?u.slice(0,1):u,d=u.slice(1);return(0,o.jsxs)(o.Fragment,{children:[p.map((function(e){return(0,o.jsx)(O,{path:e,onRemove:function(t){t.stopPropagation(),s(e[e.length-1])},renderValue:i},(0,y.aM)(e))})),c&&d.length>0&&(0,o.jsx)(N.Z,(0,r.pi)({trigger:"hover",position:"auto-top-center",cushion:15,content:(0,o.jsx)("div",(0,r.pi)({className:"zent-cascader-v2-tag-collapsed-content","data-zv":"10.0.10"},{children:(0,o.jsx)("div",(0,r.pi)({"data-zv":"10.0.10"},{children:(0,o.jsx)("span",(0,r.pi)({"data-zv":"10.0.10"},{children:d.map((function(e){return(0,y.kz)(e)})).join("、")}),void 0)}),void 0)}),void 0)},{children:(t=d.length,(0,o.jsxs)("span",(0,r.pi)({className:"zent-cascader-v2-tag-collapsed-trigger","data-zv":"10.0.10"},{children:["+",t]}),void 0))}),void 0)]},void 0)},M=n(35061),L=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.searchInputRef=(0,l.createRef)(),t.onKeywordChange=function(e){t.props.onKeywordChange(e.target.value)},t}return(0,r.ZT)(t,e),t.prototype.focus=function(){var e;null===(e=this.searchInputRef.current)||void 0===e||e.focus()},t.prototype.renderTagsContent=function(){var e=this.props,t=e.selectedPaths,n=e.renderValue,i=e.onRemove,a=e.selectionMap,l=e.simplifyPaths,s=e.maxLine,c=e.lineHeight,u=(0,o.jsx)(V,{list:t,selectionMap:a,simplifyPaths:l,renderValue:n,collapse:1===s,onRemove:i},void 0),p={};return s>1?(p.maxHeight=s*c+"px",p.overflowY="auto",(0,o.jsx)("div",(0,r.pi)({style:p,className:"zent-cascader-v2-tag__list","data-zv":"10.0.10"},{children:u}),void 0)):u},t.prototype.render=function(){var e=this.props,t=e.className,n=e.visible,i=e.clearable,l=e.selectedPaths,s=e.keyword,c=e.disabled,u=e.i18n,p=e.searchable,d=e.placeholder,v=e.onClick,h=e.onClear,f=e.onKeywordChange,g=e.renderValue,m=e.renderTags,y=e.onRemove,b=e.maxLine,C=l.length>0,x=n&&p;return(0,o.jsxs)(M.m,(0,r.pi)({placeholder:d,disabled:c,className:a()(t,"zent-cascader-v2--multiple",{"zent-cascader-v2--multiple--collapsed":1===b}),clearable:i,visible:n,onClear:h,selectedPaths:l,keyword:s,onKeywordChange:f,onClick:v,i18n:u,renderValue:g,searchable:p,showLabels:!C&&!x},{children:[C&&("function"==typeof m?m({list:l,renderValue:g,onRemove:y}):this.renderTagsContent()),x&&(0,o.jsx)(j.M,{placeholder:u.searchPlaceholder,value:s,onChange:this.onKeywordChange,ref:this.searchInputRef},void 0)]}),void 0)},t.defaultProps={selectedPaths:[]},t}(l.Component),E=n(31092),I=n(42690),R=n(41925);function B(e){return e.multiple}function A(e){return!e.multiple}var F=function(e,t){return t.some((function(t){return t.label.toLowerCase().includes(e.toLowerCase())}))},D=function(e,t){return t.map((function(n,i){return(0,o.jsxs)("span",(0,r.pi)({"data-zv":"10.0.10"},{children:[(0,o.jsx)(P,{searchWords:[e],textToHighlight:n.label,highlightClassName:"zent-cascader-v2--highlight",autoEscape:!0},void 0),i!==t.length-1&&" / "]}),(0,y.aM)(t.slice(0,i+1)))}))};function K(e){var t=[];return B(e)&&e.value.length>0&&(t=e.value[0]),A(e)&&(t=e.value),t}function H(e,t){return(B(e)?e.value.map((function(e){return t.getPathByValue(e)})):[t.getPathByValue(e.value)]).filter((function(e){return 0!==e.length}))}function Y(e,t,n){var r=-1!==e.indexOf(t);return n&&!r?e.concat(t):!n&&r?e.filter((function(e){return e!==t})):e}function W(e){return"visible"in e&&"onVisibleChange"in e&&"function"==typeof e.onVisibleChange}function $(e,t){return W(e)?!!e.visible:t.visible}var U=function(e){function t(t){var n=e.call(this,t)||this;n.tagsTriggerRef=(0,l.createRef)(),n.getSelectionMap=(0,R.Z)((function(e){return n.getSelectionMapImpl(e)})),n.getSimplifySelectionMap=(0,R.Z)((function(e,t){return void 0===t&&(t="excludeDisabled"),n.getSelectionMapImpl(e,t)})),n.simplify=function(e,t){return void 0===t&&(t="excludeDisabled"),_(e,n.getSelectionMapImpl(e,t))},n.getSearchResultList=(0,R.Z)((function(e,t){return t.map((function(t){var n=t.map((function(e){return e.value}));return e.getPathByValue(n)}))})),n.onVisibleChange=function(e){var t=n.state.keyword;n.disabled||(n.setVisible(e),n.setState({keyword:!1===e?"":t}))},n.onKeywordChange=function(e){n.setState({keyword:e},n.filterOptions)},n.filterOptions=(0,z.Z)((function(){var e=n.state,t=e.keyword,r=e.options;if(t){var o=n.props,i=o.async,a=o.asyncFilter,l=o.filter,s=o.limit;if(i)n.setState({isSearching:!0}),a(t,s).then((function(e){n.setSearchState(e)})).finally((function(){n.setState({isSearching:!1})}));else{var c=r.reducePath((function(e,t){return e.push(t),e}),[]).filter((function(e){return l(t,e)}));n.setSearchState(c)}}}),200),n.setSearchState=function(e){var t=n.props.limit,r=e.length;n.setState({searchResultList:t<=r?e:e.slice(0,t)})},n.onMenuOptionHover=function(e){n.onMenuOptionSelect(e,I.Z,"hover")},n.onMenuOptionClick=function(e,t){n.onMenuOptionSelect(e,t,"click")},n.onMenuOptionSelect=function(e,t,r){var o=n.props,i=o.loadOptions,a=o.multiple,l=n.state.loading,s=e.loadChildrenOnExpand&&i,c=(0,y.$4)(e),u={activeValue:c.map((function(e){return e.value})),keyword:""},p=e.children&&e.children.length>0,v=!e.loadChildrenOnExpand&&!p&&!a&&"click"===r,h=(0,d.Fd)(e);s&&(u.loading=Y(l,h,!0)),n.setState(u,(function(){if(s&&i(c,{action:b.N.LoadChildren}).finally((function(){n.setState((function(e){return{loading:Y(e.loading,h,!1)}}))})),A(n.props)){var e=n.props.changeOnSelect;(v||void 0!==e&&e&&"click"===r)&&n.props.onChange(c.map((function(e){return e.value})),c,{action:b.f.Change})}v&&t()}))},n.toggleMenuOption=function(e,t){if(B(n.props)){var r=n.props.onChange,o=n.state,i=o.options,a=o.selectedPaths,l=i.getPaths(e,(function(e){return e.every((function(e){return!e.disabled}))})),s=t?(0,y.G0)(a,l):(0,y.e5)(a,l),c=(s=i.sort(s)).map((function(e){return e.map((function(e){return e.value}))}));n.setState({selectedPaths:s},(function(){var e;r(c,s,{action:b.f.Change,simplify:n.simplify}),n.props.searchable&&(null===(e=n.tagsTriggerRef.current)||void 0===e||e.focus())}))}},n.onSearchOptionClick=function(e,t){var r=e.map((function(e){return e.value}));n.setState({activeValue:r},(function(){n.onMenuOptionClick(e[e.length-1],t)}))},n.toggleSearchOption=function(e,t){n.toggleMenuOption(e[e.length-1],t)},n.onClear=function(){n.setVisible(!1),n.setState({activeValue:[],selectedPaths:[]},(function(){A(n.props)?n.props.onChange([],[],{action:b.f.Clear}):n.props.onChange([],[],{action:b.f.Clear,simplify:n.simplify})}))},n.scrollLoad=function(e){var t=n.props.loadOptions;return!1===(e?e.loadChildrenOnScroll:n.props.loadChildrenOnScroll)?Promise.resolve():t((0,y.$4)(e),{action:b.N.Scroll})},n.onRemove=function(e){n.disabled||n.toggleMenuOption(e,!1)},n.renderPopoverContent=function(e){var t=n.props,r=t.expandTrigger,i=t.scrollable,a=t.multiple,l=t.searchable,s=t.highlight,c=t.loadChildrenOnScroll,u=t.renderItemContent,p=t.getItemTooltip,d=t.renderList,v=t.multipleType,h=n.state,f=h.options,g=h.activeValue,y=h.keyword,b=h.isSearching,C=h.searchResultList,x=h.loading,z=h.selectedPaths,P=n.getVisible(),k=n.getSelectionMap(z);return l&&P&&y?(0,o.jsx)(w,{i18n:e,multiple:a,isSearching:b,searchList:n.getSearchResultList(f,C),keyword:y,highlight:s,onOptionToggle:n.toggleSearchOption,onOptionClick:n.onSearchOptionClick,selectionMap:k},void 0):(0,o.jsx)(m,{value:g,options:f.getTrees(),expandTrigger:r,i18n:e,scrollable:i,loadChildrenOnScroll:c,multiple:a,multipleType:v,onOptionClick:n.onMenuOptionClick,onOptionHover:n.onMenuOptionHover,scrollLoad:n.scrollLoad,onOptionToggle:n.toggleMenuOption,loading:x,selectionMap:k,renderItemContent:u,getItemTooltip:p,renderList:d},void 0)};var r=new Z.cp(t.options);return n.state={options:r,activeValue:K(t),visible:!1,prevProps:t,selectedPaths:H(t,r),keyword:"",isSearching:!1,searchResultList:[],loading:[]},n}return(0,r.ZT)(t,e),t.getDerivedStateFromProps=function(e,t){var n=t.prevProps,r={prevProps:e},o=t.options,i=!1;return n.options!==e.options&&(o=new Z.cp(e.options),r.options=o,i=!0),!i&&n.multiple===e.multiple&&function(e,t){if(S(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=0;o<n.length;o++)if(!T.call(t,n[o])||!S(e[n[o]],t[n[o]]))return!1;return!0}(n.value,e.value)||(r.selectedPaths=H(e,o)),$(e,t)||(r.activeValue=K(e)),r},Object.defineProperty(t.prototype,"disabled",{get:function(){var e=this.props.disabled;return void 0===e?this.context.value:e},enumerable:!1,configurable:!0}),t.prototype.isControlled=function(){return W(this.props)},t.prototype.getVisible=function(){return $(this.props,this.state)},t.prototype.setVisible=function(e){this.isControlled()?this.props.onVisibleChange(e):this.setState({visible:e})},t.prototype.getSelectionMapImpl=function(e,t){return void 0===t&&(t="excludeDisabled"),this.state.options.reduceNodeDfs((function(n,r){var o=(0,d.Fd)(r),i=r.value;if(0===r.children.length){var a=e.some((function(e){return e[e.length-1].value===i}));n.set(o,a?"on":"off")}else{var l="excludeDisabled"===t?r.children.filter((function(e){return!e.disabled})):r.children,s=l.reduce((function(e,t){var r=(0,d.Fd)(t),o=n.get(r);return"on"===o?e.on+=1:"off"===o&&(e.off+=1),e}),{on:0,off:0}),c=l.length;s.on===c&&c>0?n.set(o,"on"):s.off===c?n.set(o,"off"):n.set(o,"partial")}return n}),new Map)},t.prototype.render=function(){var e=this,t=this.props,n=t.className,i=t.popupClassName,l=t.placeholder,u=t.searchable,p=t.clearable,d=t.renderValue,v=t.maxLine,h=t.lineHeight,f=this.state,g=f.selectedPaths,m=f.keyword,y=this.getVisible(),b=g.length>0;return(0,o.jsx)(c.Z,(0,r.pi)({componentName:"Cascader"},{children:function(t){var c,f={placeholder:l,disabled:e.disabled,className:n,clearable:p,visible:y,keyword:m,searchable:u,i18n:t,renderValue:d,maxLine:v,lineHeight:h,onClear:e.onClear,onKeywordChange:e.onKeywordChange};return(0,o.jsxs)(s.ZP,(0,r.pi)({className:a()("zent-cascader-v2__popup",i),position:s.ZP.Position.CascaderAutoBottomLeft,visible:y,onVisibleChange:e.onVisibleChange,cushion:4},{children:[(0,o.jsx)(s.ZP.Trigger.Click,(0,r.pi)({toggle:!u},{children:B(e.props)?(0,o.jsx)(L,(0,r.pi)({},f,{simplifyPaths:null!==(c=e.props.simplifySelection)&&void 0!==c&&c,selectedPaths:g,selectionMap:e.getSimplifySelectionMap(g,e.props.simplifySelectionMode),onRemove:e.onRemove,renderTags:e.props.renderTags,ref:e.tagsTriggerRef}),void 0):(0,o.jsx)(E.B,(0,r.pi)({},f,{selectedPath:b?g[0]:[]}),void 0)}),void 0),(0,o.jsx)(s.ZP.Content,{children:e.renderPopoverContent(t)},void 0)]}),void 0)}}),void 0)},t.defaultProps={value:[],options:[],clearable:!1,multiple:!1,multipleType:"checkbox",maxLine:null,lineHeight:22,expandTrigger:"click",scrollable:!1,loadChildrenOnScroll:!1,searchable:!1,async:!1,limit:50,renderValue:y.kz,filter:F,highlight:D,simplifySelectionMode:"excludeDisabled"},t.contextType=k.d,t}(l.Component)},34365:(e,t,n)=>{"use strict";n.d(t,{c:()=>z});var r=n(59312),o=n(24246),i=n(27378),a=n(60042),l=n.n(a),s=n(33806),c=n(52074),u=n(1348),p=n(33420).Z,d=n(62593),v=p.TabPanel;function h(e){return e.label}function f(e){return e.label}var g=(0,s.ZP.withPopover)(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.closePopup=function(){var e;return null===(e=t.props.popover)||void 0===e?void 0:e.close()},t}return(0,r.ZT)(t,e),t.prototype.renderCascaderItems=function(e,t){var n=this,i=this.props.value[t-1],a=function(e,t){var a=e.value,s=l()("zent-cascader-v2__list-link",{"zent-cascader-v2__list-link--active":a===i});return(0,o.jsx)("div",(0,r.pi)({className:"zent-cascader-v2__list-item",style:t,"data-zv":"10.0.10"},{children:(0,o.jsx)("span",(0,r.pi)({className:s,title:n.props.getItemTooltip(e),onClick:function(){return n.props.onClick(e,n.closePopup)},"data-zv":"10.0.10"},{children:n.props.renderItemContent(e)}),void 0)}),a)},s=this.props.renderList;return(0,o.jsx)("div",(0,r.pi)({className:"zent-cascader-v2__list","data-zv":"10.0.10"},{children:"function"==typeof s?s(e,a):e.map((function(e){return a(e)}))}),void 0)},t.prototype.renderTabTitle=function(e,t){return t===this.props.loadingLevel?(0,o.jsxs)("div",(0,r.pi)({className:"zent-cascader-v2__loading","data-zv":"10.0.10"},{children:[(0,o.jsx)("div",(0,r.pi)({className:"zent-cascader-v2__loading-label","data-zv":"10.0.10"},{children:e}),void 0),(0,o.jsx)("div",{className:"zent-cascader-v2__loading-icon","data-zv":"10.0.10"},void 0)]}),void 0):e},t.prototype.renderPanels=function(e){for(var t,n,i=[],a=this.props,l=a.title,s=a.value,c=s.length+1,u=function(a,c){if(c&&c.length>0){var u=s[a],d=c.find((function(e){return e.value===u})),h=null!==(n=null!==(t=null==d?void 0:d.label)&&void 0!==t?t:l[a])&&void 0!==n?n:e.title,f=a+1;i.push((0,o.jsx)(v,(0,r.pi)({tab:p.renderTabTitle(h,f),id:f},{children:p.renderCascaderItems(c,f)}),"tab-"+s.slice(0,a).join("-")))}},p=this,h=0,f=this.props.options;h<c;h++,f=(0,d.El)(f,s[h-1]))u(h,f);return i},t.prototype.render=function(){var e=this.props,t=e.activeId,n=e.i18n,i=e.onTabsChange;return(0,o.jsx)("div",(0,r.pi)({className:"zent-cascader-v2__popup-inner","data-zv":"10.0.10"},{children:(0,o.jsx)(p,(0,r.pi)({activeId:t,onChange:i,type:"card",className:"zent-cascader-v2__tabs"},{children:this.renderPanels(n)}),void 0)}),void 0)},t.defaultProps={renderItemContent:h,getItemTooltip:f},t}(i.Component)),m=n(56717),y=n(74194),b=n(31092),C=n(76187);function x(e){return"visible"in e&&"onVisibleChange"in e&&"function"==typeof e.onVisibleChange}function w(e,t){return x(e)?e.visible:t.visible}var z=function(e){function t(t){var n=e.call(this,t)||this;n.onVisibleChange=function(e){n.disabled||n.setVisible(e)},n.onTabsChange=function(e){n.setState({activeTab:e})},n.onClick=function(e,t){var r=n.props,o=r.loadOptions,i=r.changeOnSelect,a=e.loadChildrenOnExpand&&o,l=(0,y.$4)(e),s={activeValue:l.map((function(e){return e.value}))},c=e.children&&e.children.length>0,u=!e.loadChildrenOnExpand&&!c,p=u||i,v=(0,d.YY)(e),h=v+1;a||u||(s.activeTab=h),n.setState(s,(function(){a&&(n.setState({loadingLevel:v}),o(l).then((function(){n.setState({activeTab:h,loadingLevel:null})}),(function(){n.setState({loadingLevel:null})}))),p&&n.props.onChange(l.map((function(e){return e.value})),l,{action:m.f.Change}),u&&t()}))},n.onClear=function(){n.setVisible(!1),n.setState({activeValue:[]},(function(){n.props.onChange([],[],{action:m.f.Clear})}))};var r=t.value;return n.state={options:new C.cp(t.options),activeValue:r,activeTab:r.length||1,visible:!1,prevProps:t,loadingLevel:null},n}return(0,r.ZT)(t,e),t.getDerivedStateFromProps=function(e,t){var n={prevProps:e},r=t.prevProps;if(!w(e,t)){var o=e.value;n.activeValue=o,n.activeTab=o.length||1}return e.options!==r.options&&(n.options=new C.cp(e.options)),n},Object.defineProperty(t.prototype,"disabled",{get:function(){var e;return null!==(e=this.props.disabled)&&void 0!==e?e:this.context.value},enumerable:!1,configurable:!0}),t.prototype.isControlled=function(){return x(this.props)},t.prototype.getVisible=function(){return w(this.props,this.state)},t.prototype.setVisible=function(e){this.isControlled()?this.props.onVisibleChange(e):this.setState({visible:e})},t.prototype.render=function(){var e=this,t=this.props,n=t.className,i=t.popupClassName,a=t.placeholder,u=t.renderValue,p=t.clearable,d=t.value,v=t.title,h=t.renderItemContent,f=t.getItemTooltip,m=t.renderList,y=this.state,C=y.activeValue,x=y.loadingLevel,w=y.activeTab,z=y.options,P=this.getVisible(),k=z.getPathByValue(d);return(0,o.jsx)(c.Z,(0,r.pi)({componentName:"Cascader"},{children:function(t){return(0,o.jsxs)(s.ZP,(0,r.pi)({className:l()("zent-cascader-v2__popup",i),position:s.ZP.Position.CascaderAutoBottomLeft,visible:P,onVisibleChange:e.onVisibleChange,cushion:4},{children:[(0,o.jsx)(s.ZP.Trigger.Click,(0,r.pi)({toggle:!0},{children:(0,o.jsx)(b.B,{className:n,placeholder:a,renderValue:u,disabled:e.disabled,selectedPath:k,visible:P,clearable:p,i18n:t,onClear:e.onClear},void 0)}),void 0),(0,o.jsx)(s.ZP.Content,{children:(0,o.jsx)(g,{i18n:t,value:C,loadingLevel:x,onClick:e.onClick,activeId:w,onTabsChange:e.onTabsChange,title:v,options:z.getTrees(),renderItemContent:h,getItemTooltip:f,renderList:m},void 0)},void 0)]}),void 0)}}),void 0)},t.defaultProps={value:[],options:[],changeOnSelect:!1,renderValue:y.kz,clearable:!1,title:[]},t.contextType=u.d,t}(i.Component)},76187:(e,t,n)=>{"use strict";n.d(t,{d9:()=>a,fv:()=>l,cp:()=>s});var r=n(59312),o=n(74194),i=n(62593);function a(e,t){for(var n=e.map((function(e){return{node:t(e,null),children:e.children}})),r=n.map((function(e){return e.node})),o=function(){var e=n.pop();if(!e)return"continue";var r=e.node,o=e.children;null==o||o.forEach((function(e){var o=t(e,r);n.push({node:o,children:e.children}),r.children.push(o)}))};n.length>0;)o();return r}function l(e,t,n){for(var r=[{parent:null,children:e,node:(t=t.slice()).shift()}],o=function(){var e=r.pop();if(!e)return"continue";var o=e.children,i=e.node;if(!i)return"break";var a=i.value,l=o.find((function(e){return e.value===a}));l||(l=n(i,e.parent),o.push(l)),r.push({parent:l,children:l.children,node:t.shift()})};r.length>0&&"break"!==o(););return e}var s=function(){function e(e){this.trees=this.build(e)}return e.prototype.build=function(e){return a(e,p)},e.prototype.reducePath=function(e,t){for(var n=c(this.trees),r=[],o=t,a=!1,l=function(){a=!0};n.length>0;){var s=n.pop();if(s){for(var p=(0,i.YY)(s);p<=r.length;)r.pop();if(r.push(s),s.children.length>0)u(n,s.children);else if(o=e(o,r.slice(),l),a)break}}return o},e.prototype.reduceNode=function(e,t){for(var n=c(this.trees),r=t,o=!1,i=function(){o=!0};n.length>0;){var a=n.pop();if(a){if(r=e(r,a,i),o)break;a.children.length>0&&u(n,a.children)}}return r},e.prototype.reduceNodeDfs=function(e,t){for(var n=this.trees.map((function(e){return{node:e,phase:"recurse"}})),r=t,o=!1,i=function(){o=!0};n.length>0;){var a=n.pop();if(a){var l=a.node,s=a.phase;if("recurse"===s)n.push({node:l,phase:"visit"}),l.children.forEach((function(e){n.push({node:e,phase:"recurse"})}));else if("visit"===s&&(r=e(r,l,i),o))break}}return r},e.prototype.sort=function(e){return this.reducePath((function(t,n){return e.some((function(e){return(0,o.h0)(e,n)}))&&t.push(n),t}),[])},e.prototype.clone=function(){return new e(this.trees)},e.prototype.insertPath=function(e){return l(this.trees,e,p),this},e.prototype.getTrees=function(){return this.trees},e.prototype.getPathByValue=function(e){return this.reducePath((function(t,n,r){if(e.length>n.length||0===e.length)return t;var o,i=e.length;for(o=0;o<i;o++)if(n[o].value!==e[o])return t;return r(),o===n.length?n:n.slice(0,i)}),[])},e.prototype.getPaths=function(e,t){var n=(0,i.YY)(e)-1,r=e.value;return this.reducePath((function(e,o){return o.length>n&&o[n].value===r&&(!t||t(o))&&e.push(o),e}),[])},e}();function c(e){var t=e.slice();return t.reverse(),t}function u(e,t){for(var n=t.length-1;n>=0;n--)e.push(t[n]);return e}function p(e,t){return(0,r.pi)((0,r.pi)({},e),{parent:t,children:[]})}},62593:(e,t,n)=>{"use strict";function r(e,t){if(e&&e.length>0){var n=e.find((function(e){return e.value===t}));if(n&&Array.isArray(n.children))return n.children}return null}function o(e){for(var t=e,n=[];t;)n.unshift(t.value),t=t.parent;return n.map((function(e,t){return t+"$"+e})).join("@")}function i(e){for(var t=1,n=e.parent;n;)n=n.parent,t++;return t}n.d(t,{El:()=>r,Fd:()=>o,YY:()=>i})},74194:(e,t,n)=>{"use strict";n.d(t,{h0:()=>o,G0:()=>i,e5:()=>a,$4:()=>l,kz:()=>s,aM:()=>c});var r=n(59312);function o(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n].value!==t[n].value)return!1;return!0}function i(e,t){return t.reduce((function(e,t){return e.some((function(e){return o(e,t)}))||e.push(t),e}),(0,r.ev)([],e))}function a(e,t){return e.filter((function(e){return t.every((function(t){return!o(e,t)}))}))}function l(e){for(var t=e,n=[];t;)n.unshift(t),t=t.parent;return n}var s=function(e){return e.map((function(e){return e.label})).join(" / ")},c=function(e){return e.map((function(e){return e.value})).join("-")}},35061:(e,t,n)=>{"use strict";n.d(t,{m:()=>s});var r=n(59312),o=n(24246),i=n(60042),a=n.n(i),l=n(27036),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={active:!1},t.onClearClick=function(e){e.preventDefault(),e.stopPropagation(),t.props.keyword?t.props.onKeywordChange(""):(t.setState({active:!1}),t.props.onClear())},t.onMouseEnter=function(){t.setState({active:!0})},t.onMouseLeave=function(){t.setState({active:!1})},t}return(0,r.ZT)(t,e),t.prototype.render=function(){var e,t=this.props,n=t.className,i=t.visible,s=t.clearable,c=t.selectedPaths,u=t.keyword,p=t.disabled,d=t.children,v=t.onClick,h=t.renderValue,f=t.searchable,g=t.i18n,m=t.placeholder,y=t.showLabels,b=this.state.active,C=c.length>0,x=a()("zent-cascader-v2",n,{"zent-cascader-v2--disabled":p,"zent-cascader-v2--active":i||b,"zent-cascader-v2--visible":i}),w=a()("zent-cascader-v2--text",{"zent-cascader-v2--placeholder":!C});e=C?h(c[0]):f?m||g.searchPlaceholder:m||g.placeholder;var z=s&&(i||b)&&(C||u)&&!p;return(0,o.jsxs)("div",(0,r.pi)({className:x,onClick:v,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,"data-zv":"10.0.10"},{children:[d,y&&(0,o.jsx)("span",(0,r.pi)({className:w,"data-zv":"10.0.10"},{children:e}),void 0),z?(0,o.jsx)(l.Z,{type:"close-circle",onClick:this.onClearClick},void 0):(0,o.jsx)(l.Z,{type:"down"},void 0)]}),void 0)},t}(n(27378).Component)},64073:(e,t,n)=>{"use strict";n.d(t,{M:()=>l});var r=n(24246),o=n(27378),i=n(79264),a=n(17127),l=(0,o.forwardRef)((function(e,t){var n=(0,o.useRef)(null),l=e.placeholder,s=e.value,c=e.onChange;return(0,o.useImperativeHandle)(t,(function(){return{focus:function(){(0,a.tA)((function(){var e;null===(e=n.current)||void 0===e||e.focus({preventScroll:!0})}))}}}),[n]),(0,i.L)((function(){n.current.focus({preventScroll:!0})}),[]),(0,r.jsx)("input",{ref:n,placeholder:l,className:"zent-cascader-v2--search",value:s,onChange:c,"data-zv":"10.0.10"},void 0)}));l.displayName="SearchInput"},31092:(e,t,n)=>{"use strict";n.d(t,{B:()=>c});var r=n(59312),o=n(24246),i=n(27378),a=n(35061),l=n(74194),s=n(64073),c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onKeywordChange=function(e){t.props.onKeywordChange(e.target.value)},t}return(0,r.ZT)(t,e),t.prototype.render=function(){var e=this.props,t=e.className,n=e.visible,i=e.clearable,c=e.selectedPath,u=e.keyword,p=e.disabled,d=e.i18n,v=e.searchable,h=e.placeholder,f=e.onClick,g=e.onClear,m=e.onKeywordChange,y=e.renderValue,b=n&&v,C=c.length>0,x=C?(0,l.kz)(c):d.searchPlaceholder,w=C?[c]:[];return(0,o.jsx)(a.m,(0,r.pi)({disabled:p,className:t,clearable:i,visible:n,onClear:g,selectedPaths:w,keyword:u,onKeywordChange:m,onClick:f,i18n:d,renderValue:y,showLabels:!b,placeholder:h,searchable:v},{children:b&&(0,o.jsx)(s.M,{placeholder:x,value:u,onChange:this.onKeywordChange},void 0)}),void 0)},t.defaultProps={selectedPath:[]},t}(i.Component)},56717:(e,t,n)=>{"use strict";var r,o;n.d(t,{f:()=>r,N:()=>o}),function(e){e.Clear="clear",e.Change="change"}(r||(r={})),function(e){e.LoadChildren="loadChildren",e.Scroll="scroll"}(o||(o={}))},33938:(e,t,n)=>{"use strict";n.d(t,{X:()=>d});var r=n(59312),o=n(24246),i=n(60042),a=n.n(i),l=n(27378),s=n(1535),c=n(23130),u=n(1348),p=n(4008);function d(e){var t=(0,l.useContext)(u.d),n=(0,l.useContext)(c.Z),i=(0,l.useRef)(e);i.current=e;var p,d=n&&n.onChange,v=(0,l.useCallback)((function(e){var t=i.current,n=t.value,o=t.onChange;if(d)d(n);else if(o){var a=Object.create(e);a.target=(0,r.pi)((0,r.pi)({},i.current),{type:"checkbox",checked:e.target.checked}),o(a)}}),[d]),h=(e.checked,e.className),f=e.style,g=(e.disabled,e.readOnly,e.children),m=e.indeterminate,y=e.width,b=(e.value,e.labelStyle),C=e.onMouseEnter,x=e.onMouseLeave,w=(0,r._T)(e,["checked","className","style","disabled","readOnly","children","indeterminate","width","value","labelStyle","onMouseEnter","onMouseLeave"]),z=function(e,t){return"boolean"==typeof t.readOnly?t.readOnly:!!e&&e.readOnly}(n,e),P=function(e,t,n){return"boolean"==typeof n.disabled?n.disabled:t?t.disabled:e.value}(t,n,e);if(n){var k=n.value,T=n.isValueEqual;p=-1!==k.findIndex((function(t){return T(t,e.value)}))}else p=!!e.checked;return(0,o.jsxs)("label",(0,r.pi)({className:a()("zent-checkbox-wrap",h,{"zent-checkbox-checked":!!p,"zent-checkbox-disabled":P||z,"zent-checkbox-indeterminate":m}),style:(0,r.pi)((0,r.pi)({},f),(0,s.Z)(y)),onMouseEnter:C,onMouseLeave:x,"data-zv":"10.0.10"},{children:[(0,o.jsxs)("span",(0,r.pi)({className:"zent-checkbox","data-zv":"10.0.10"},{children:[(0,o.jsx)("span",{className:"zent-checkbox-inner","data-zv":"10.0.10"},void 0),(0,o.jsx)("input",(0,r.pi)({},w,{type:"checkbox",checked:p&&!m,disabled:P,readOnly:z,onChange:v,"data-zv":"10.0.10"}),void 0)]}),void 0),null!=g&&!0!==g&&!1!==g?(0,o.jsx)("div",(0,r.pi)({className:"zent-checkbox-label",style:b,"data-zv":"10.0.10"},{children:g}),void 0):null]}),void 0)}d.Group=p.Z,t.Z=d},4008:(e,t,n)=>{"use strict";n.d(t,{c:()=>d});var r=n(59312),o=n(24246),i=n(27378),a=n(60042),l=n.n(a),s=n(41925),c=n(23130),u=n(1348),p=c.Z.Provider,d=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.getGroupContext=(0,s.Z)((function(e,n,r,o){return{value:Array.isArray(e)?e:[],disabled:n,readOnly:r,isValueEqual:o,onChange:t.onCheckboxChange}})),t.onCheckboxChange=function(e){var n=t.props,r=n.isValueEqual,o=n.onChange,i=n.value;if(o){var a=i?i.slice():[],l=a.findIndex((function(t){return r(t,e)}));-1!==l?a.splice(l,1):a.push(e),o(a)}},t}return(0,r.ZT)(t,e),t.prototype.render=function(){var e=this.props,t=e.className,n=e.style,i=e.children,a=e.value,s=e.disabled,c=void 0===s?this.context.value:s,u=e.readOnly,d=void 0!==u&&u,v=e.isValueEqual,h=l()("zent-checkbox-group",t);return(0,o.jsx)(p,(0,r.pi)({value:this.getGroupContext(a,c,d,v)},{children:(0,o.jsx)("div",(0,r.pi)({className:h,style:n,"data-zv":"10.0.10"},{children:i}),void 0)}),void 0)},t.defaultProps={isValueEqual:Object.is,value:[]},t.contextType=u.d,t}(i.Component);t.Z=d},23130:(e,t,n)=>{"use strict";var r=n(27378);t.Z=(0,r.createContext)(null)},68150:(e,t,n)=>{"use strict";var r=n(33938);t.ZP=r.Z},82049:(e,t,n)=>{"use strict";n.d(t,{S:()=>v});var r=n(59312),o=n(24246),i=n(60042),a=n.n(i),l=n(27378),s=n(50993),c=n(86446),u=n(79352),p=n(43239),d=(0,o.jsx)(s.Z,{height:60,loading:!0,icon:"circle"},void 0),v=(0,l.forwardRef)((function(e,t){var n,i=e.hasMore,s=void 0!==i&&i,v=e.loadMore,h=e.skipLoadOnMount,f=void 0!==h&&h,g=e.useWindow,m=void 0!==g&&g,y=e.loader,b=void 0===y?d:y,C=e.threshold,x=void 0===C?1:C,w=e.className,z=e.children,P=(0,l.useState)(!1),k=P[0],T=P[1],S=(0,p.s)(),j=(0,l.useCallback)((function(){S.current&&T(!1)}),[S]),O=(0,l.useCallback)((function(){"function"==typeof v&&(T(!0),v.length>0?v(j):v().then(j,j))}),[v,j]),N=(0,l.useCallback)((function(e){k||2===e.previousPosition&&O()}),[O,k]);return(0,l.useEffect)((function(){f||O()}),[]),(0,o.jsxs)("div",(0,r.pi)({className:a()("zent-infinite-scroller",w,(n={},n["zent-infinite-scroller-y"]=!m,n)),ref:t,"data-zv":"10.0.10"},{children:[z,s&&u.Z&&(0,o.jsx)(c.h,{scrollableAncestor:m?window:void 0,onEnter:N,bottomOffset:-x},void 0),k&&b]}),void 0)}));v.displayName="InfiniteScroller",t.Z=v},50993:(e,t,n)=>{"use strict";n.d(t,{c:()=>u});var r=n(59312),o=n(24246),i=n(60042),a=n.n(i),l=n(40695),s=n(73326),c=n(72551);function u(e){var t=function(e){var t=(0,c.n)(e,"height"),n=e.children;return n||t?n&&!t?"initial":e.height:160}(e),n=e.loading,i=void 0!==n&&n,u=e.delay,p=void 0===u?0:u,d=e.className,v=e.children,h=e.icon,f=void 0===h?"circle":h,g=e.iconSize,m=e.iconText,y=e.textPosition,b=void 0===y?"bottom":y,C=e.colorPreset,x=void 0===C?"primary":C,w=!!v,z=!(0,s.Z)({loading:i,delay:p})&&i;return z||w?(0,o.jsxs)("div",(0,r.pi)({className:a()("zent-loading","zent-loading--block",d,{"zent-loading--has-children":w}),style:{height:t},"data-zv":"10.0.10"},{children:[v,z&&(0,o.jsx)(l.Z,{icon:f,size:g,text:m,textPosition:b,colorPreset:x},void 0)]}),void 0):null}t.Z=u},40695:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(59312),o=n(24246),i=n(56975);function a(e){return(0,o.jsx)("div",(0,r.pi)({className:"zent-loading-mask","data-zv":"10.0.10"},{children:(0,o.jsx)(i.Z,(0,r.pi)({},e),void 0)}),void 0)}},14322:(e,t,n)=>{"use strict";n.d(t,{w:()=>c});var r=n(24246),o=n(27378),i=n(27468),a=n(80186),l=n(17127),s={passive:!0},c=function(e){var t=e.disableThrottle,n=void 0!==t&&t,c=e.onResize,u=(0,o.useRef)(null),p=(0,o.useRef)(c);p.current=c;var d=(0,o.useCallback)((function(e){var t=(0,i.ZP)();u.current||(u.current=t);var n=u.current,r={deltaX:t.width-n.width,deltaY:t.height-n.height};0===r.deltaX&&0===r.deltaY||(p.current(e,r),u.current=t)}),[]),v=(0,l.BN)(d,n);return(0,o.useEffect)((function(){return u.current=(0,i.ZP)(),v.cancel}),[v]),(0,r.jsx)(a.ZP,{eventName:"resize",listener:v,options:s},void 0)}},55978:(e,t,n)=>{"use strict";function r(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=setTimeout((function(){return e.apply(void 0,t)}),1);return{cancel:function(){clearTimeout(r)}}}n.d(t,{Z:()=>r})},1535:(e,t,n)=>{"use strict";function r(e){return"string"==typeof e||"number"==typeof e?{width:e}:{}}n.d(t,{Z:()=>r})},86446:(e,t,n)=>{"use strict";n.d(t,{h:()=>m});var r=n(59312),o=n(24246),i=n(27378),a=n(49744),l=n(19185);function s(e){return(0,l.isElement)(e)&&"string"==typeof e.type}function c(e){return e.viewportBottom-e.viewportTop==0?3:e.viewportTop<=e.waypointTop&&e.waypointTop<=e.viewportBottom||e.viewportTop<=e.waypointBottom&&e.waypointBottom<=e.viewportBottom||e.waypointTop<=e.viewportTop&&e.viewportBottom<=e.waypointBottom?1:e.viewportBottom<e.waypointTop?2:e.waypointTop<e.viewportTop?0:3}var u=n(79352),p=n(55978);function d(e){return f(e.toLowerCase())}function v(e,t,n){var r=f(e=e.toLowerCase());return null!==r?r:function(e,t,n){var r=g.exec(e);if(r){var o=parseFloat(r[1]);switch(r[2]){case"em":return null!==(i=t())?i*o:null;case"rem":var i;return null!==(i=n())?i*o:null;default:return null}}return null}(e,t,n)}var h=/(^-?\d*\.?\d+)(cm|mm|in|px|pt|pc)$/;function f(e){var t=h.exec(e);if(t){var n=parseFloat(t[1]);switch(t[2]){case"cm":return 9600*n/254;case"mm":return 960*n/254;case"in":return 96*n;case"pt":return 4*n/3;case"pc":return 16*n;case"px":return n;default:return null}}return null}var g=/(^-?\d*\.?\d+)(em|rem)$/,m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.refElement=(0,i.createRef)(),t.previousPosition=4,t.handleScroll=function(e){if(t.refElement.current){var n=t.getBounds(),r=c(n),o=t.previousPosition,i=t.props,a=i.onPositionChange,l=i.onEnter,s=i.onLeave,u=i.fireOnRapidScroll;if(t.previousPosition=r,o!==r){var p={currentPosition:r,previousPosition:o,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom};null==a||a(p),1===r?null==l||l(p):1!==o&&4!==o||null==s||s(p),u&&(2===o&&0===r||0===o&&2===r)&&(null==l||l({currentPosition:1,previousPosition:o,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom}),null==s||s({currentPosition:r,previousPosition:1,event:e,waypointTop:n.waypointTop,waypointBottom:n.waypointBottom,viewportTop:n.viewportTop,viewportBottom:n.viewportBottom}))}}},t}return(0,r.ZT)(t,e),t.prototype.componentDidMount=function(){var e=this;u.Z&&(this.cancelOnNextTick=(0,p.Z)((function(){e.cancelOnNextTick=null,function(e,t){if(e&&!s(e)&&!t)throw new Error("<Waypoint> needs a DOM element to compute boundaries. The child you passed is neither a DOM element (e.g. <div>) nor does it use the innerRef prop.\n")}(e.props.children,e.refElement.current),e.scrollableAncestor=e.findScrollableAncestor(),e.scrollEventListenerUnsubscribe=(0,a.Oo)(e.scrollableAncestor,"scroll",e.handleScroll,{passive:!0}),e.resizeEventListenerUnsubscribe=(0,a.Oo)(window,"resize",e.handleScroll,{passive:!0}),e.handleScroll(null)})))},t.prototype.componentDidUpdate=function(){var e=this;u.Z&&this.scrollableAncestor&&(this.cancelOnNextTick||(this.cancelOnNextTick=(0,p.Z)((function(){e.cancelOnNextTick=null,e.handleScroll(null)}))))},t.prototype.componentWillUnmount=function(){var e,t,n;u.Z&&(null===(e=this.scrollEventListenerUnsubscribe)||void 0===e||e.call(this),null===(t=this.resizeEventListenerUnsubscribe)||void 0===t||t.call(this),null===(n=this.cancelOnNextTick)||void 0===n||n.cancel())},t.prototype.findScrollableAncestor=function(){var e=this.props,t=e.horizontal,n=e.scrollableAncestor;if(n)return n;for(var r=this.refElement.current;r.parentNode;){if((r=r.parentNode)===document.body)return window;var o=getComputedStyle(r),i=(t?o.getPropertyValue("overflow-x"):o.getPropertyValue("overflow-y"))||o.getPropertyValue("overflow");if("auto"===i||"scroll"===i)return r}return window},t.prototype.getBounds=function(){var e,t,n=this.props.horizontal,r=this.refElement.current.getBoundingClientRect(),o=r.left,i=r.top,a=r.right,l=r.bottom,s=n?o:i,c=n?a:l;if(this.scrollableAncestor===window)e=n?window.innerWidth:window.innerHeight,t=0;else{var u=this.scrollableAncestor.getBoundingClientRect();e=n?u.width:u.height,t=n?u.left:u.top}return{waypointTop:s,waypointBottom:c,viewportTop:t+this.getOffset("top",e),viewportBottom:t+e-this.getOffset("bottom",e)}},t.prototype.getOffset=function(e,t){var n,r,o=this.props.horizontal,i=e+"Offset",a="top"===e?"border"+(o?"Left":"Top")+"Width":"border"+(o?"Right":"Bottom")+"Width",l=this.props[i];if("auto"!==l)return function(e,t){var n=function(e){var t;if(t="number"==typeof e?e:parseFloat(e),!Number.isNaN(t)&&Number.isFinite(t))return t}(e);if("number"==typeof n)return n;if("string"==typeof e){var r=function(e){if("%"===e.slice(-1))return parseFloat(e.slice(0,-1))/100}(e);if("number"==typeof r)return r*t}}(l,t);if(this.scrollableAncestor===window){var s=getComputedStyle(document.documentElement),c=function(){return d(s.fontSize)};return null!==(n=v(s[a],c,c))&&void 0!==n?n:0}var u=getComputedStyle(this.scrollableAncestor);return c=function(){return d(u.fontSize)},null!==(r=v(u[a],c,(function(){return d(getComputedStyle(document.documentElement).fontSize)})))&&void 0!==r?r:0},t.prototype.render=function(){var e=this,t=this.props.children;if(!t)return(0,o.jsx)("span",{ref:this.refElement,style:{fontSize:0},className:"zent-waypoint-marker","data-zv":"10.0.10"},void 0);var n=i.Children.only(t);return s(n)||(0,l.isForwardRef)(n)?(0,i.cloneElement)(n,{ref:function(t){e.refElement.current=t;var r=n.ref;r&&("function"==typeof r?r(t):r.current=t)}}):(0,i.cloneElement)(n,{innerRef:this.refElement})},t.defaultProps={topOffset:0,bottomOffset:0,horizontal:!1,fireOnRapidScroll:!0},t}(i.PureComponent)}}]);