import{eb as _e,d3 as he,r as ue,b9 as xe,j as _,p as me}from"./index-BbiZcFRx.js";import{c as be}from"./index-DTKT5ssy.js";var D={},P={exports:{}},T={exports:{}},w={exports:{}},$;function U(){return $||($=1,function(t){function n(s){"@babel/helpers - typeof";return t.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(s)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(w)),w.exports}var I={exports:{}},z;function ge(){return z||(z=1,function(t){var n=U().default;function s(e,o){if(n(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,o||"default");if(n(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(e)}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}(I)),I.exports}var B;function le(){return B||(B=1,function(t){var n=U().default,s=ge();function e(o){var r=s(o,"string");return n(r)=="symbol"?r:r+""}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(T)),T.exports}var W;function Se(){return W||(W=1,function(t){var n=le();function s(e,o,r){return(o=n(o))in e?Object.defineProperty(e,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[o]=r,e}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}(P)),P.exports}var q={exports:{}},C={exports:{}},A={exports:{}},F;function pe(){return F||(F=1,function(t){function n(s,e){(e==null||e>s.length)&&(e=s.length);for(var o=0,r=Array(e);o<e;o++)r[o]=s[o];return r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(A)),A.exports}var K;function Pe(){return K||(K=1,function(t){var n=pe();function s(e){if(Array.isArray(e))return n(e)}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}(C)),C.exports}var E={exports:{}},G;function Te(){return G||(G=1,function(t){function n(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(E)),E.exports}var k={exports:{}},J;function we(){return J||(J=1,function(t){var n=pe();function s(e,o){if(e){if(typeof e=="string")return n(e,o);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,o):void 0}}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}(k)),k.exports}var R={exports:{}},Q;function Ie(){return Q||(Q=1,function(t){function n(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(R)),R.exports}var X;function qe(){return X||(X=1,function(t){var n=Pe(),s=Te(),e=we(),o=Ie();function r(a){return n(a)||s(a)||e(a)||o()}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}(q)),q.exports}var O={exports:{}},Y;function Ce(){return Y||(Y=1,function(t){function n(s,e){if(!(s instanceof e))throw new TypeError("Cannot call a class as a function")}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(O)),O.exports}var N={exports:{}},j={exports:{}},Z;function ce(){return Z||(Z=1,function(t){function n(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(j)),j.exports}var ee;function Ae(){return ee||(ee=1,function(t){var n=U().default,s=ce();function e(o,r){if(r&&(n(r)=="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return s(o)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(N)),N.exports}var M={exports:{}},te;function Ee(){return te||(te=1,function(t){function n(s){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},t.exports.__esModule=!0,t.exports.default=t.exports,n(s)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(M)),M.exports}var L={exports:{}},re;function ke(){return re||(re=1,function(t){var n=le();function s(o,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(o,n(i.key),i)}}function e(o,r,a){return r&&s(o.prototype,r),a&&s(o,a),Object.defineProperty(o,"prototype",{writable:!1}),o}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(L)),L.exports}var H={exports:{}},V={exports:{}},oe;function Re(){return oe||(oe=1,function(t){function n(s,e){return t.exports=n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},t.exports.__esModule=!0,t.exports.default=t.exports,n(s,e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(V)),V.exports}var se;function Oe(){return se||(se=1,function(t){var n=Re();function s(e,o){if(typeof o!="function"&&o!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(o&&o.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),o&&n(e,o)}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}(H)),H.exports}var b={},ne;function Ne(){if(ne)return b;ne=1,Object.defineProperty(b,"__esModule",{value:!0}),b.default=void 0;var t=function(e){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:100,r,a;return function(){var i=+new Date,u=!!r&&i<r+o;u?(clearTimeout(a),a=setTimeout(function(){r=i,e()},o)):(r=i,e())}},n=t;return b.default=n,b}var l=xe;Object.defineProperty(D,"__esModule",{value:!0});var fe=D.default=void 0,je=l(_e()),g=l(Se()),Me=l(qe()),Le=l(Ce()),He=l(Ae()),Ve=l(Ee()),De=l(ce()),ae=l(ke()),Ue=l(Oe()),d=l(he),S=l(ue),ie=l(be),$e=l(Ne());function ze(t,n){return t.length===n.length&&t.every(function(s,e){return s===n[e]})}var Be=function(t){(0,Ue.default)(n,t),(0,ae.default)(n,null,[{key:"propTypes",get:function(){return{items:d.default.arrayOf(d.default.string).isRequired,currentClassName:d.default.string.isRequired,scrolledPastClassName:d.default.string,style:d.default.object,componentTag:d.default.oneOfType([d.default.string,d.default.elementType]),offset:d.default.number,rootEl:d.default.string,onUpdate:d.default.func}}},{key:"defaultProps",get:function(){return{items:[],currentClassName:"",style:{},componentTag:"ul",offset:0,onUpdate:function(){}}}}]);function n(s){var e;return(0,Le.default)(this,n),e=(0,He.default)(this,(0,Ve.default)(n).call(this,s)),e.state={targetItems:[],inViewState:[],isScrolledPast:[]},e._handleSpy=e._handleSpy.bind((0,De.default)(e)),e}return(0,ae.default)(n,[{key:"_initSpyTarget",value:function(e){var o=e.map(function(r){return document.getElementById(r)});return o}},{key:"_fillArray",value:function(e,o){for(var r=[],a=0,i=e.length;a<i;a++)r[a]=o;return r}},{key:"_isScrolled",value:function(){return this._getScrollDimension().scrollTop>0}},{key:"_getScrollDimension",value:function(){var e=document,o=this.props.rootEl,r=o?e.querySelector(o).scrollTop:e.documentElement.scrollTop||e.body.parentNode.scrollTop||e.body.scrollTop,a=o?e.querySelector(o).scrollHeight:e.documentElement.scrollHeight||e.body.parentNode.scrollHeight||e.body.scrollHeight;return{scrollTop:r,scrollHeight:a}}},{key:"_getElemsViewState",value:function(e){for(var o=[],r=[],a=[],i=e||this.state.targetItems,u=!1,c=0,h=i.length;c<h;c++){var p=i[c],y=u?!1:this._isInView(p);y?(u=!0,o.push(p)):r.push(p);var f=c===h-1,x=this._isScrolled(),v=this._isAtBottom()&&this._isInView(p)&&!y&&f&&x;v&&(r.pop(),r.push.apply(r,(0,Me.default)(o)),o=[p],a=this._fillArray(a,!1),y=!0),a.push(y)}return{inView:o,outView:r,viewStatusList:a,scrolledPast:this.props.scrolledPastClassName&&this._getScrolledPast(a)}}},{key:"_isInView",value:function(e){if(!e)return!1;var o=this.props,r=o.rootEl,a=o.offset,i;r&&(i=document.querySelector(r).getBoundingClientRect());var u=e.getBoundingClientRect(),c=r?i.height:window.innerHeight,h=this._getScrollDimension(),p=h.scrollTop,y=p+c,f=r?u.top+p-i.top+a:u.top+p+a,x=f+e.offsetHeight;return f<y&&x>p}},{key:"_isAtBottom",value:function(){var e=this.props.rootEl,o=this._getScrollDimension(),r=o.scrollTop,a=o.scrollHeight,i=e?document.querySelector(e).getBoundingClientRect().height:window.innerHeight,u=r+i>=a;return u}},{key:"_getScrolledPast",value:function(e){if(!e.some(function(a){return a}))return e;var o=!1,r=e.map(function(a){return a&&!o?(o=!0,!1):!o});return r}},{key:"_spy",value:function(e){var o=this,r=this._getElemsViewState(e),a=this.state.inViewState;this.setState({inViewState:r.viewStatusList,isScrolledPast:r.scrolledPast},function(){o._update(a)})}},{key:"_update",value:function(e){ze(this.state.inViewState,e)||this.props.onUpdate(this.state.targetItems[this.state.inViewState.indexOf(!0)])}},{key:"_handleSpy",value:function(){(0,$e.default)(this._spy(),100)}},{key:"_initFromProps",value:function(){var e=this._initSpyTarget(this.props.items);this.setState({targetItems:e}),this._spy(e)}},{key:"offEvent",value:function(){var e=this.props.rootEl?document.querySelector(this.props.rootEl):window;e.removeEventListener("scroll",this._handleSpy)}},{key:"onEvent",value:function(){var e=this.props.rootEl?document.querySelector(this.props.rootEl):window;e.addEventListener("scroll",this._handleSpy)}},{key:"componentDidMount",value:function(){this._initFromProps(),this.onEvent()}},{key:"componentWillUnmount",value:function(){this.offEvent()}},{key:"UNSAFE_componentWillReceiveProps",value:function(){this._initFromProps()}},{key:"render",value:function(){var e=this,o=this.props.componentTag,r=this.props,a=r.children,i=r.className,u=r.scrolledPastClassName,c=r.style,h=0,p=S.default.Children.map(a,function(f,x){var v;if(!f)return null;var de=f.type,ye=u&&e.state.isScrolledPast[x],ve=(0,ie.default)((v={},(0,g.default)(v,"".concat(f.props.className),f.props.className),(0,g.default)(v,"".concat(e.props.currentClassName),e.state.inViewState[x]),(0,g.default)(v,"".concat(e.props.scrolledPastClassName),ye),v));return S.default.createElement(de,(0,je.default)({},f.props,{className:ve,key:h++}),f.props.children)}),y=(0,ie.default)((0,g.default)({},"".concat(i),i));return S.default.createElement(o,{className:y,style:c},p)}}]),n}(S.default.Component);fe=D.default=Be;const We="_sidebarListItem_199bd_88",Fe={sidebarListItem:We},Ke=({children:t,className:n="",dataGtm:s=""})=>_.jsx("li",{className:`${n} ${Fe.sidebarListItem}`,"data-gtm":s,children:t}),Ge="_inactive_zagyi_88",Je="_listItem_zagyi_88",Qe="_active_zagyi_100",Xe="_heading4_zagyi_115",Ye="_sidebarListItems_zagyi_123",m={inactive:Ge,listItem:Je,active:Qe,heading4:Xe,sidebarListItems:Ye},tt=({className:t="",dataGtm:n="",items:s=[]})=>{const e=s.reduce((i,u)=>i.push(u.id)&&i,[]),[o,r]=ue.useState(!1),a=()=>{const i=window.matchMedia("(max-width: 1700px)"),u=window.location.href.substring(window.location.href.lastIndexOf("#")+1);if(o&&i.matches){const c=document.getElementById(u);window==null||window.scrollTo({top:c.offsetTop-156,behavior:"smooth"}),r(!1)}};return _.jsx(_.Fragment,{children:_.jsx(fe,{className:`${t} ${m.sidebarListItems}`,currentClassName:m.active,items:e,onUpdate:a,scrolledPastClassName:m.inactive,children:s.map(({id:i,text:u},c)=>_.jsx(Ke,{className:m.sidebarListItem,dataGtm:n,children:i!=="plan-details"?_.jsx("a",{className:m.listItem,href:`#${i}`,onClick:()=>r(!0),children:u}):_.jsx(me,{className:m.heading4,text:u})},i))})})};export{tt as S};
//# sourceMappingURL=index-CDUHuj5j.js.map