/*! DSFR v1.11.2 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */ const e=window.dsfr,s={SEGMENTED:e.internals.ns.selector("segmented"),SEGMENTED_ELEMENTS:e.internals.ns.selector("segmented__elements"),SEGMENTED_ELEMENT:e.internals.ns.selector("segmented__element input"),SEGMENTED_LEGEND:e.internals.ns.selector("segmented__legend")},t={ADDED:e.internals.ns.emission("segmented","added"),REMOVED:e.internals.ns.emission("segmented","removed")};class n extends e.core.Instance{static get instanceClassName(){return"Segmented"}init(){this.elements=this.node.querySelector(s.SEGMENTED_ELEMENTS),this.legend=this.node.querySelector(s.SEGMENTED_LEGEND),this.addAscent(t.ADDED,this.resize.bind(this)),this.addAscent(t.REMOVED,this.resize.bind(this)),this._isLegendInline=this.legend&&this.legend.classList.contains(`${e.prefix}-segmented__legend--inline`),this.isResizing=!0}resize(){const s=`${e.prefix}-segmented--vertical`,t=`${e.prefix}-segmented__legend--inline`;this.removeClass(s),this._isLegendInline&&(this.legend.classList.add(t),(this.node.offsetWidth>this.node.parentNode.offsetWidth||this.elements.scrollWidth+this.legend.offsetWidth+16>this.node.parentNode.offsetWidth)&&this.legend.classList.remove(t)),this.elements.offsetWidth>this.node.parentNode.offsetWidth||this.elements.scrollWidth>this.node.parentNode.offsetWidth?this.addClass(s):this.removeClass(s)}}class i extends e.core.Instance{static get instanceClassName(){return"SegmentedElement"}init(){this.ascend(t.ADDED)}dispose(){this.ascend(t.REMOVED)}}e.segmented={SegmentedSelector:s,SegmentedEmission:t,SegmentedElement:i,Segmented:n},e.internals.register(e.segmented.SegmentedSelector.SEGMENTED,e.segmented.Segmented),e.internals.register(e.segmented.SegmentedSelector.SEGMENTED_ELEMENT,e.segmented.SegmentedElement); //# sourceMappingURL=segmented.module.min.js.map