/**
 * @fileoverview
 * @suppress {checkPrototypalTypes}
 * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt The complete set of authors may be found
 * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may
 * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by
 * Google as part of the polymer project is also subject to an additional IP
 * rights grant found at http://polymer.github.io/PATENTS.txt
 */
import{ElementMixin as e}from"./element-mixin.js";import{dedupingMixin as t}from"../utils/mixin.js";import{wrap as r}from"../utils/wrap.js";const s="disable-upgrade";export const findObservedAttributesGetter=e=>{for(;e;){const t=Object.getOwnPropertyDescriptor(e,"observedAttributes");if(t)return t.get;e=Object.getPrototypeOf(e.prototype).constructor}return()=>[]};export const DisableUpgradeMixin=t((t=>{const i=e(t);let a=findObservedAttributesGetter(i);return class DisableUpgradeClass extends i{constructor(){super(),this.__isUpgradeDisabled}static get observedAttributes(){return a.call(this).concat(s)}_initializeProperties(){this.hasAttribute(s)?this.__isUpgradeDisabled=!0:super._initializeProperties()}_enableProperties(){this.__isUpgradeDisabled||super._enableProperties()}_canApplyPropertyDefault(e){return super._canApplyPropertyDefault(e)&&!(this.__isUpgradeDisabled&&this._isPropertyPending(e))}attributeChangedCallback(e,t,i,a){e==s?this.__isUpgradeDisabled&&null==i&&(super._initializeProperties(),this.__isUpgradeDisabled=!1,r(this).isConnected&&super.connectedCallback()):super.attributeChangedCallback(e,t,i,a)}connectedCallback(){this.__isUpgradeDisabled||super.connectedCallback()}disconnectedCallback(){this.__isUpgradeDisabled||super.disconnectedCallback()}}}));