/**
 * Copyright 2019 The Pennsylvania State University
 * @license Apache-2.0, see License.md for full text.
 */
import{LitElement as t,html as i,css as e}from"../../lit/index.js";import"./lib/absolute-position-state-manager.js";const AbsolutePositionBehaviorClass=function(t){return class extends t{static get styles(){let t=[];return super.styles&&(t=super.styles),[t,e`
          :host {
            display: inline-block;
            z-index: 99999999999;
            position: absolute;
          }

          :host([hidden]) {
            display: none;
          }
        `]}render(){return i` <slot></slot>`}static get properties(){return{...super.properties,allowOverlap:{type:Boolean,attribute:"allow-overlap"},auto:{type:Boolean,attribute:"auto"},fitToVisibleBounds:{type:Boolean,attribute:"fit-to-visible-bounds"},hidden:{type:Boolean,reflect:!0,attribute:"hidden"},for:{type:String,attribute:"for",reflect:!0},offset:{type:Number,attribute:"offset"},sticky:{type:Boolean,attribute:"sticky",reflect:!0},position:{type:String,attribute:"position",reflect:!0},positionAlign:{type:String,attribute:"position-align",reflect:!0},justify:{type:Boolean,reflect:!0,attribute:"justify"},target:{type:Object},__positions:{type:Object}}}static get tag(){return"absolute-position-behavior"}constructor(){super(),this._ticking=!1,this.scrollTarget=globalThis,this.auto=!1,this.fitToVisibleBounds=!1,this.for=null,this.offset=0,this.position="bottom",this.target=null,this.sticky=!1,this.hidden=!1,this.__positions={},this.__observe=!1}updated(t){super.updated&&super.updated(t);let i=!1;this.shadowRoot&&!this.hidden&&(t.forEach(((t,e)=>{"auto"===e&&this.auto&&this.setPosition(),"auto"!==e||this.auto||this.unsetPosition(),["allowOverlap","fitToVisibleBounds","for","offset","position","justify","positionAlign","target","hidden","sticky"].includes(e)&&this[e]!==t&&(i=!0)})),i&&this.updatePosition())}setPosition(){this.__observe=!0,globalThis.AbsolutePositionStateManager.requestAvailability().loadElement(this)}unsetPosition(){this.__observe=!1,globalThis.AbsolutePositionStateManager.requestAvailability().unloadElement(this)}updatePosition(){!this.hidden&&this.auto&&0==this.__observe&&globalThis.AbsolutePositionStateManager.requestAvailability().loadElement(this),this.auto&&!0!==this.__observe||globalThis.AbsolutePositionStateManager.requestAvailability().positionElement(this)}disconnectedCallback(){this.unsetPosition(),super.disconnectedCallback()}}};class AbsolutePositionBehavior extends(AbsolutePositionBehaviorClass(t)){}customElements.define(AbsolutePositionBehavior.tag,AbsolutePositionBehavior);export{AbsolutePositionBehaviorClass,AbsolutePositionBehavior};