"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[3267],{13094(t,e,n){n.r(e),n.d(e,{AnchoredClass:()=>a,componentName:()=>h});var s=n(88961),o=n(72270),r=n(25964),i=n(63200);const h=(0,r.xE)("anchored");class c extends((0,o.qu)({componentName:h,baseSelector:".anchored-root"})){#t=null;#e=null;#n=null;#s=null;get#o(){return this.defaultSlot.assignedElements({flatten:!0})[0]}get#r(){return this.shadowRoot.querySelector('slot[name="anchored"]')?.assignedElements()[0]}get#i(){return this.getRootNode().host}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n      <div class="anchored-root" part="root">\n        <slot></slot>\n        <div class="anchored-host" part="anchored">\n          <slot name="anchored"></slot>\n        </div>\n      </div>\n    ',this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])")}init(){super.init?.(),(0,r.fz)("\n      :host {\n        display: inline-flex;\n        position: relative;\n        box-sizing: border-box;\n      }\n\n      :host(:not([has-anchor])) {\n        display: none;\n      }\n\n      .anchored-root {\n        position: relative;\n        display: flex;\n        width: 100%;\n        min-width: 0;\n      }\n\n      /* Make anchor fill the flex row and allow it to shrink. */\n      ::slotted(*:not([slot])) {\n        flex-grow: 1;       /* fill the flex row */\n        flex-shrink: 1;     /* compress when constrained */\n        flex-basis: auto;   /* start from the anchor's natural size */\n        min-width: 0;       /* flex items won't shrink below content size without this */\n      }\n\n      /* Anchored container covers the anchor but is invisible to pointer events. */\n      .anchored-host {\n        position: absolute;\n        inset: 0;\n        pointer-events: none;\n      }\n\n      /* Restore interactivity for actual anchored content. */\n      ::slotted([slot=\"anchored\"]) {\n        pointer-events: auto;\n      }\n      ",this),this.#h(),this.defaultSlot.addEventListener("slotchange",()=>this.#c()),this.#c()}#a(){const t=this.#o?.classList?.contains("hidden");this.classList.toggle("hidden",t)}#c(){this.#l(),this.#t=this.#d(this.#t,this.#i,"stretch"),this.#e=this.#d(this.#e,this.#r,"st-host-direction"),this.#u()}#u(){this.#s?.disconnect(),this.#o&&(this.#s=(0,r.mx)(this.#o,()=>this.#a(),{includeAttrs:["class"]}))}connectedCallback(){super.connectedCallback?.(),this.#u(),this.#a()}#h(){const t="\n      descope-anchored {\n        width: 100%;          /* fill the outer host so the anchored element spans the full anchor width */\n      }\n      :host([stretch]) {\n        display: inline-flex; /* switch from inline-block so internal children are flex items */\n        width: 100%;          /* fill non-flex parents */\n        flex-grow: 1;         /* absorb extra space in flex parents */\n        flex-shrink: 0;       /* hold full width — shrink:1 would let siblings squeeze it below 100% */\n        flex-basis: auto;     /* defer to width:100% on the main axis; avoids forcing 100% height in column-flex parents */\n        min-width: 0;         /* prevent overflow when the outer host is itself inside a constrained flex row */\n      }\n    ";this.#n?this.#n.replaceSync(t):this.#i&&(this.#n=(0,r.fz)(t,this.#i))}#d(t,e,n){return t?.disconnect(),e?.removeAttribute(n),this.#o&&e?(0,r.EA)(this.#o,e,{includeAttrs:[n]}):null}disconnectedCallback(){super.disconnectedCallback?.(),this.#t?.disconnect(),this.#e?.disconnect(),this.#s?.disconnect()}#l(){this.toggleAttribute("has-anchor",!!this.#o),this.#a()}}const a=(0,i.Zz)(s.tQ)(c);customElements.define(h,a)}}]);
//# sourceMappingURL=descope-anchored.js.map