import{s as g,f as c,a5 as w,ad as b,y as h,b2 as N,ae as M,z as o,P as d,Q as a,D as x}from"./index-BPRWoLf4.js";var I=function(r){g(t,r);function t(s){var e=r.call(this,s)||this;return e.state={activeIndex:-1},e}return t.prototype.componentDidUpdate=function(s){var e=this.props.items||[];this.state.activeIndex>0&&!e[this.state.activeIndex]&&this.setState({activeIndex:0})},t.prototype.handleClick=function(s){var e=this.props,n=e.dispatchEvent,i=e.data;n(s,i)},t.prototype.handleMouseEnter=function(s){var e=this.props,n=e.dispatchEvent,i=e.data;n(s,i)},t.prototype.handleMouseLeave=function(s){var e=this.props,n=e.dispatchEvent,i=e.data;n(s,i)},t.prototype.renderBody=function(s){var e=this.props,n=e.children,i=e.render,p=e.disabled,l=s==null?void 0:s.body,u=n?typeof n=="function"?n(this.props):n:l?i("body",l,{disabled:p}):null;return c.createElement("div",{style:{display:"inline"}},u)},t.prototype.switchTo=function(s){var e=this.props.items||[];s>=0&&s<e.length&&this.setState({activeIndex:s})},t.prototype.render=function(){var s,e=this.props,n=e.className,i=e.items,p=i===void 0?[]:i,l=e.classnames,u=e.style,v=e.data,y=e.id,m=e.wrapperCustomStyle,_=e.env,C=e.themeCss,f=(s=p[this.state.activeIndex])!==null&&s!==void 0?s:p.find(function(S){return w(S,v)}),E=c.createElement("div",{className:l("SwitchContainer",n,b(h(h({},this.props),{name:"baseControlClassName",id:y,themeCss:C})),b(h(h({},this.props),{name:"wrapperCustomStyle",id:y,themeCss:m}))),onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,style:N(u,v)},f&&this.renderBody(f),c.createElement(M,{config:{wrapperCustomStyle:m,id:y,themeCss:C,classNames:[{key:"baseControlClassName"}]},env:_}));return E},t.propsList=["body","className"],t.defaultProps={className:""},o([d,a("design:type",Function),a("design:paramtypes",[Object]),a("design:returntype",void 0)],t.prototype,"handleClick",null),o([d,a("design:type",Function),a("design:paramtypes",[Object]),a("design:returntype",void 0)],t.prototype,"handleMouseEnter",null),o([d,a("design:type",Function),a("design:paramtypes",[Object]),a("design:returntype",void 0)],t.prototype,"handleMouseLeave",null),o([d,a("design:type",Function),a("design:paramtypes",[Object]),a("design:returntype",Object)],t.prototype,"renderBody",null),o([d,a("design:type",Function),a("design:paramtypes",[Number]),a("design:returntype",void 0)],t.prototype,"switchTo",null),t}(c.Component),k=function(r){g(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t=o([x({type:"switch-container"})],t),t}(I);export{k as SwitchContainerRenderer,I as default};
