/**
@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 t from"./template-map.js";import{StyleNode as e}from"./css-parse.js";const i="_applyShimCurrentVersion",a="_applyShimNextVersion",n="_applyShimValidatingVersion",l=Promise.resolve();export function invalidate(e){let i=t[e];i&&invalidateTemplate(i)}export function invalidateTemplate(t){t[i]=t[i]||0,t[n]=t[n]||0,t[a]=(t[a]||0)+1}export function isValid(e){let i=t[e];return!i||templateIsValid(i)}export function templateIsValid(t){return t[i]===t[a]}export function isValidating(e){let i=t[e];return!!i&&templateIsValidating(i)}export function templateIsValidating(t){return!templateIsValid(t)&&t[n]===t[a]}export function startValidating(e){startValidatingTemplate(t[e])}export function startValidatingTemplate(t){t[n]=t[a],t._validating||(t._validating=!0,l.then((function(){t[i]=t[a],t._validating=!1})))}export function elementsAreInvalid(){for(let e in t){if(!templateIsValid(t[e]))return!0}return!1}