apollo-elements/apollo-elements

View on GitHub
docs/_assets/_static/sandbox.js.map

Summary

Maintainability
Test Coverage
{
  "version": 3,
  "sources": ["../../../node_modules/@power-elements/codesandbox-button/node_modules/tslib/tslib.js", "../../../node_modules/@power-elements/codesandbox-button/node_modules/tslib/modules/index.js", "../../../node_modules/lit-html/src/lib/dom.ts", "../../../node_modules/lit-html/src/lib/template.ts", "../../../node_modules/lit-html/src/lib/modify-template.ts", "../../../node_modules/lit-html/src/lib/directive.ts", "../../../node_modules/lit-html/src/lib/part.ts", "../../../node_modules/lit-html/src/lib/template-instance.ts", "../../../node_modules/lit-html/src/lib/template-result.ts", "../../../node_modules/lit-html/src/lib/parts.ts", "../../../node_modules/lit-html/src/lib/template-factory.ts", "../../../node_modules/lit-html/src/lib/render.ts", "../../../node_modules/lit-html/src/lib/default-template-processor.ts", "../../../node_modules/lit-html/src/lit-html.ts", "../../../node_modules/lit-html/src/lib/shady-render.ts", "../../../node_modules/@power-elements/codesandbox-button/node_modules/lit-element/src/lib/updating-element.ts", "../../../node_modules/@power-elements/codesandbox-button/node_modules/lit-element/src/lib/decorators.ts", "../../../node_modules/@power-elements/codesandbox-button/node_modules/lit-element/src/lib/css-tag.ts", "../../../node_modules/@power-elements/codesandbox-button/node_modules/lit-element/src/lit-element.ts", "../../../node_modules/lit-html/src/directives/if-defined.ts", "../../../node_modules/@power-elements/codesandbox-button/codesandbox-button.js"],
  "sourcesContent": ["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global global, define, System, Reflect, Promise */\r\nvar __extends;\r\nvar __assign;\r\nvar __rest;\r\nvar __decorate;\r\nvar __param;\r\nvar __metadata;\r\nvar __awaiter;\r\nvar __generator;\r\nvar __exportStar;\r\nvar __values;\r\nvar __read;\r\nvar __spread;\r\nvar __spreadArrays;\r\nvar __spreadArray;\r\nvar __await;\r\nvar __asyncGenerator;\r\nvar __asyncDelegator;\r\nvar __asyncValues;\r\nvar __makeTemplateObject;\r\nvar __importStar;\r\nvar __importDefault;\r\nvar __classPrivateFieldGet;\r\nvar __classPrivateFieldSet;\r\nvar __createBinding;\r\n(function (factory) {\r\n    var root = typeof global === \"object\" ? global : typeof self === \"object\" ? self : typeof this === \"object\" ? this : {};\r\n    if (typeof define === \"function\" && define.amd) {\r\n        define(\"tslib\", [\"exports\"], function (exports) { factory(createExporter(root, createExporter(exports))); });\r\n    }\r\n    else if (typeof module === \"object\" && typeof module.exports === \"object\") {\r\n        factory(createExporter(root, createExporter(module.exports)));\r\n    }\r\n    else {\r\n        factory(createExporter(root));\r\n    }\r\n    function createExporter(exports, previous) {\r\n        if (exports !== root) {\r\n            if (typeof Object.create === \"function\") {\r\n                Object.defineProperty(exports, \"__esModule\", { value: true });\r\n            }\r\n            else {\r\n                exports.__esModule = true;\r\n            }\r\n        }\r\n        return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };\r\n    }\r\n})\r\n(function (exporter) {\r\n    var extendStatics = Object.setPrototypeOf ||\r\n        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n        function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n\r\n    __extends = function (d, b) {\r\n        if (typeof b !== \"function\" && b !== null)\r\n            throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n        extendStatics(d, b);\r\n        function __() { this.constructor = d; }\r\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n    };\r\n\r\n    __assign = Object.assign || function (t) {\r\n        for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n            s = arguments[i];\r\n            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n        }\r\n        return t;\r\n    };\r\n\r\n    __rest = function (s, e) {\r\n        var t = {};\r\n        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n            t[p] = s[p];\r\n        if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n            for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n                if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n                    t[p[i]] = s[p[i]];\r\n            }\r\n        return t;\r\n    };\r\n\r\n    __decorate = function (decorators, target, key, desc) {\r\n        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n        if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n        return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n    };\r\n\r\n    __param = function (paramIndex, decorator) {\r\n        return function (target, key) { decorator(target, key, paramIndex); }\r\n    };\r\n\r\n    __metadata = function (metadataKey, metadataValue) {\r\n        if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n    };\r\n\r\n    __awaiter = function (thisArg, _arguments, P, generator) {\r\n        function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n        return new (P || (P = Promise))(function (resolve, reject) {\r\n            function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n            function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n            function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n            step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n        });\r\n    };\r\n\r\n    __generator = function (thisArg, body) {\r\n        var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n        return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n        function verb(n) { return function (v) { return step([n, v]); }; }\r\n        function step(op) {\r\n            if (f) throw new TypeError(\"Generator is already executing.\");\r\n            while (_) try {\r\n                if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n                if (y = 0, t) op = [op[0] & 2, t.value];\r\n                switch (op[0]) {\r\n                    case 0: case 1: t = op; break;\r\n                    case 4: _.label++; return { value: op[1], done: false };\r\n                    case 5: _.label++; y = op[1]; op = [0]; continue;\r\n                    case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n                    default:\r\n                        if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n                        if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n                        if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n                        if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n                        if (t[2]) _.ops.pop();\r\n                        _.trys.pop(); continue;\r\n                }\r\n                op = body.call(thisArg, _);\r\n            } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n            if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n        }\r\n    };\r\n\r\n    __exportStar = function(m, o) {\r\n        for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n    };\r\n\r\n    __createBinding = Object.create ? (function(o, m, k, k2) {\r\n        if (k2 === undefined) k2 = k;\r\n        Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n    }) : (function(o, m, k, k2) {\r\n        if (k2 === undefined) k2 = k;\r\n        o[k2] = m[k];\r\n    });\r\n\r\n    __values = function (o) {\r\n        var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n        if (m) return m.call(o);\r\n        if (o && typeof o.length === \"number\") return {\r\n            next: function () {\r\n                if (o && i >= o.length) o = void 0;\r\n                return { value: o && o[i++], done: !o };\r\n            }\r\n        };\r\n        throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n    };\r\n\r\n    __read = function (o, n) {\r\n        var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n        if (!m) return o;\r\n        var i = m.call(o), r, ar = [], e;\r\n        try {\r\n            while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n        }\r\n        catch (error) { e = { error: error }; }\r\n        finally {\r\n            try {\r\n                if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n            }\r\n            finally { if (e) throw e.error; }\r\n        }\r\n        return ar;\r\n    };\r\n\r\n    /** @deprecated */\r\n    __spread = function () {\r\n        for (var ar = [], i = 0; i < arguments.length; i++)\r\n            ar = ar.concat(__read(arguments[i]));\r\n        return ar;\r\n    };\r\n\r\n    /** @deprecated */\r\n    __spreadArrays = function () {\r\n        for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n        for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n            for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n                r[k] = a[j];\r\n        return r;\r\n    };\r\n\r\n    __spreadArray = function (to, from) {\r\n        for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\r\n            to[j] = from[i];\r\n        return to;\r\n    };\r\n\r\n    __await = function (v) {\r\n        return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n    };\r\n\r\n    __asyncGenerator = function (thisArg, _arguments, generator) {\r\n        if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n        var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n        return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n        function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n        function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n        function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);  }\r\n        function fulfill(value) { resume(\"next\", value); }\r\n        function reject(value) { resume(\"throw\", value); }\r\n        function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n    };\r\n\r\n    __asyncDelegator = function (o) {\r\n        var i, p;\r\n        return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n        function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n    };\r\n\r\n    __asyncValues = function (o) {\r\n        if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n        var m = o[Symbol.asyncIterator], i;\r\n        return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n        function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n        function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n    };\r\n\r\n    __makeTemplateObject = function (cooked, raw) {\r\n        if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n        return cooked;\r\n    };\r\n\r\n    var __setModuleDefault = Object.create ? (function(o, v) {\r\n        Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n    }) : function(o, v) {\r\n        o[\"default\"] = v;\r\n    };\r\n\r\n    __importStar = function (mod) {\r\n        if (mod && mod.__esModule) return mod;\r\n        var result = {};\r\n        if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n        __setModuleDefault(result, mod);\r\n        return result;\r\n    };\r\n\r\n    __importDefault = function (mod) {\r\n        return (mod && mod.__esModule) ? mod : { \"default\": mod };\r\n    };\r\n\r\n    __classPrivateFieldGet = function (receiver, state, kind, f) {\r\n        if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n        if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n        return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n    };\r\n\r\n    __classPrivateFieldSet = function (receiver, state, value, kind, f) {\r\n        if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n        if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n        if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n        return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n    };\r\n\r\n    exporter(\"__extends\", __extends);\r\n    exporter(\"__assign\", __assign);\r\n    exporter(\"__rest\", __rest);\r\n    exporter(\"__decorate\", __decorate);\r\n    exporter(\"__param\", __param);\r\n    exporter(\"__metadata\", __metadata);\r\n    exporter(\"__awaiter\", __awaiter);\r\n    exporter(\"__generator\", __generator);\r\n    exporter(\"__exportStar\", __exportStar);\r\n    exporter(\"__createBinding\", __createBinding);\r\n    exporter(\"__values\", __values);\r\n    exporter(\"__read\", __read);\r\n    exporter(\"__spread\", __spread);\r\n    exporter(\"__spreadArrays\", __spreadArrays);\r\n    exporter(\"__spreadArray\", __spreadArray);\r\n    exporter(\"__await\", __await);\r\n    exporter(\"__asyncGenerator\", __asyncGenerator);\r\n    exporter(\"__asyncDelegator\", __asyncDelegator);\r\n    exporter(\"__asyncValues\", __asyncValues);\r\n    exporter(\"__makeTemplateObject\", __makeTemplateObject);\r\n    exporter(\"__importStar\", __importStar);\r\n    exporter(\"__importDefault\", __importDefault);\r\n    exporter(\"__classPrivateFieldGet\", __classPrivateFieldGet);\r\n    exporter(\"__classPrivateFieldSet\", __classPrivateFieldSet);\r\n});\r\n", "import tslib from '../tslib.js';\r\nconst {\r\n    __extends,\r\n    __assign,\r\n    __rest,\r\n    __decorate,\r\n    __param,\r\n    __metadata,\r\n    __awaiter,\r\n    __generator,\r\n    __exportStar,\r\n    __createBinding,\r\n    __values,\r\n    __read,\r\n    __spread,\r\n    __spreadArrays,\r\n    __spreadArray,\r\n    __await,\r\n    __asyncGenerator,\r\n    __asyncDelegator,\r\n    __asyncValues,\r\n    __makeTemplateObject,\r\n    __importStar,\r\n    __importDefault,\r\n    __classPrivateFieldGet,\r\n    __classPrivateFieldSet,\r\n} = tslib;\r\nexport {\r\n    __extends,\r\n    __assign,\r\n    __rest,\r\n    __decorate,\r\n    __param,\r\n    __metadata,\r\n    __awaiter,\r\n    __generator,\r\n    __exportStar,\r\n    __createBinding,\r\n    __values,\r\n    __read,\r\n    __spread,\r\n    __spreadArrays,\r\n    __spreadArray,\r\n    __await,\r\n    __asyncGenerator,\r\n    __asyncDelegator,\r\n    __asyncValues,\r\n    __makeTemplateObject,\r\n    __importStar,\r\n    __importDefault,\r\n    __classPrivateFieldGet,\r\n    __classPrivateFieldSet,\r\n};\r\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\ninterface MaybePolyfilledCe extends CustomElementRegistry {\n  readonly polyfillWrapFlushCallback?: object;\n}\n\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n    window.customElements != null &&\n    (window.customElements as MaybePolyfilledCe).polyfillWrapFlushCallback !==\n        undefined;\n\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes =\n    (container: Node,\n     start: Node|null,\n     end: Node|null = null,\n     before: Node|null = null): void => {\n      while (start !== end) {\n        const n = start!.nextSibling;\n        container.insertBefore(start!, before);\n        start = n;\n      }\n    };\n\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes =\n    (container: Node, start: Node|null, end: Node|null = null): void => {\n      while (start !== end) {\n        const n = start!.nextSibling;\n        container.removeChild(start!);\n        start = n;\n      }\n    };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\n\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = `<!--${marker}-->`;\n\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n  readonly parts: TemplatePart[] = [];\n  readonly element: HTMLTemplateElement;\n\n  constructor(result: TemplateResult, element: HTMLTemplateElement) {\n    this.element = element;\n\n    const nodesToRemove: Node[] = [];\n    const stack: Node[] = [];\n    // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n    const walker = document.createTreeWalker(\n        element.content,\n        133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n        null,\n        false);\n    // Keeps track of the last index associated with a part. We try to delete\n    // unnecessary nodes, but we never want to associate two different parts\n    // to the same index. They must have a constant node between.\n    let lastPartIndex = 0;\n    let index = -1;\n    let partIndex = 0;\n    const {strings, values: {length}} = result;\n    while (partIndex < length) {\n      const node = walker.nextNode() as Element | Comment | Text | null;\n      if (node === null) {\n        // We've exhausted the content inside a nested template element.\n        // Because we still have parts (the outer for-loop), we know:\n        // - There is a template in the stack\n        // - The walker will find a nextNode outside the template\n        walker.currentNode = stack.pop()!;\n        continue;\n      }\n      index++;\n\n      if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n        if ((node as Element).hasAttributes()) {\n          const attributes = (node as Element).attributes;\n          const {length} = attributes;\n          // Per\n          // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n          // attributes are not guaranteed to be returned in document order.\n          // In particular, Edge/IE can return them out of order, so we cannot\n          // assume a correspondence between part index and attribute index.\n          let count = 0;\n          for (let i = 0; i < length; i++) {\n            if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n              count++;\n            }\n          }\n          while (count-- > 0) {\n            // Get the template literal section leading up to the first\n            // expression in this attribute\n            const stringForPart = strings[partIndex];\n            // Find the attribute name\n            const name = lastAttributeNameRegex.exec(stringForPart)![2];\n            // Find the corresponding attribute\n            // All bound attributes have had a suffix added in\n            // TemplateResult#getHTML to opt out of special attribute\n            // handling. To look up the attribute value we also need to add\n            // the suffix.\n            const attributeLookupName =\n                name.toLowerCase() + boundAttributeSuffix;\n            const attributeValue =\n                (node as Element).getAttribute(attributeLookupName)!;\n            (node as Element).removeAttribute(attributeLookupName);\n            const statics = attributeValue.split(markerRegex);\n            this.parts.push({type: 'attribute', index, name, strings: statics});\n            partIndex += statics.length - 1;\n          }\n        }\n        if ((node as Element).tagName === 'TEMPLATE') {\n          stack.push(node);\n          walker.currentNode = (node as HTMLTemplateElement).content;\n        }\n      } else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n        const data = (node as Text).data;\n        if (data.indexOf(marker) >= 0) {\n          const parent = node.parentNode!;\n          const strings = data.split(markerRegex);\n          const lastIndex = strings.length - 1;\n          // Generate a new text node for each literal section\n          // These nodes are also used as the markers for node parts\n          for (let i = 0; i < lastIndex; i++) {\n            let insert: Node;\n            let s = strings[i];\n            if (s === '') {\n              insert = createMarker();\n            } else {\n              const match = lastAttributeNameRegex.exec(s);\n              if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n                s = s.slice(0, match.index) + match[1] +\n                    match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n              }\n              insert = document.createTextNode(s);\n            }\n            parent.insertBefore(insert, node);\n            this.parts.push({type: 'node', index: ++index});\n          }\n          // If there's no text, we must insert a comment to mark our place.\n          // Else, we can trust it will stick around after cloning.\n          if (strings[lastIndex] === '') {\n            parent.insertBefore(createMarker(), node);\n            nodesToRemove.push(node);\n          } else {\n            (node as Text).data = strings[lastIndex];\n          }\n          // We have a part for each match found\n          partIndex += lastIndex;\n        }\n      } else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n        if ((node as Comment).data === marker) {\n          const parent = node.parentNode!;\n          // Add a new marker node to be the startNode of the Part if any of\n          // the following are true:\n          //  * We don't have a previousSibling\n          //  * The previousSibling is already the start of a previous part\n          if (node.previousSibling === null || index === lastPartIndex) {\n            index++;\n            parent.insertBefore(createMarker(), node);\n          }\n          lastPartIndex = index;\n          this.parts.push({type: 'node', index});\n          // If we don't have a nextSibling, keep this node so we have an end.\n          // Else, we can remove it to save future costs.\n          if (node.nextSibling === null) {\n            (node as Comment).data = '';\n          } else {\n            nodesToRemove.push(node);\n            index--;\n          }\n          partIndex++;\n        } else {\n          let i = -1;\n          while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n            // Comment node has a binding marker inside, make an inactive part\n            // The binding won't work, but subsequent bindings will\n            // TODO (justinfagnani): consider whether it's even worth it to\n            // make bindings in comments work\n            this.parts.push({type: 'node', index: -1});\n            partIndex++;\n          }\n        }\n      }\n    }\n\n    // Remove text binding nodes after the walk to not disturb the TreeWalker\n    for (const n of nodesToRemove) {\n      n.parentNode!.removeChild(n);\n    }\n  }\n}\n\nconst endsWith = (str: string, suffix: string): boolean => {\n  const index = str.length - suffix.length;\n  return index >= 0 && str.slice(index) === suffix;\n};\n\n/**\n * A placeholder for a dynamic expression in an HTML template.\n *\n * There are two built-in part types: AttributePart and NodePart. NodeParts\n * always represent a single dynamic expression, while AttributeParts may\n * represent as many expressions are contained in the attribute.\n *\n * A Template's parts are mutable, so parts can be replaced or modified\n * (possibly to implement different template semantics). The contract is that\n * parts can only be replaced, not removed, added or reordered, and parts must\n * always consume the correct number of values in their `update()` method.\n *\n * TODO(justinfagnani): That requirement is a little fragile. A\n * TemplateInstance could instead be more careful about which values it gives\n * to Part.update().\n */\nexport type TemplatePart = {\n  readonly type: 'node'; index: number;\n}|{\n  readonly type: 'attribute';\n  index: number;\n  readonly name: string;\n  readonly strings: ReadonlyArray<string>;\n};\n\nexport const isTemplatePartActive = (part: TemplatePart) => part.index !== -1;\n\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n *  * The name: any character except a control character, space character, ('),\n *    (\"), \">\", \"=\", or \"/\"\n *  * Followed by zero or more space characters\n *  * Followed by \"=\"\n *  * Followed by zero or more space characters\n *  * Followed by:\n *    * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n *    * (\") then any non-(\"), or\n *    * (') then any non-(')\n */\nexport const lastAttributeNameRegex =\n    // eslint-disable-next-line no-control-regex\n    /([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\nconst walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */;\n\n/**\n * Removes the list of nodes from a Template safely. In addition to removing\n * nodes from the Template, the Template part indices are updated to match\n * the mutated Template DOM.\n *\n * As the template is walked the removal state is tracked and\n * part indices are adjusted as needed.\n *\n * div\n *   div#1 (remove) <-- start removing (removing node is div#1)\n *     div\n *       div#2 (remove)  <-- continue removing (removing node is still div#1)\n *         div\n * div <-- stop removing since previous sibling is the removing node (div#1,\n * removed 4 nodes)\n */\nexport function removeNodesFromTemplate(\n    template: Template, nodesToRemove: Set<Node>) {\n  const {element: {content}, parts} = template;\n  const walker =\n      document.createTreeWalker(content, walkerNodeFilter, null, false);\n  let partIndex = nextActiveIndexInTemplateParts(parts);\n  let part = parts[partIndex];\n  let nodeIndex = -1;\n  let removeCount = 0;\n  const nodesToRemoveInTemplate = [];\n  let currentRemovingNode: Node|null = null;\n  while (walker.nextNode()) {\n    nodeIndex++;\n    const node = walker.currentNode as Element;\n    // End removal if stepped past the removing node\n    if (node.previousSibling === currentRemovingNode) {\n      currentRemovingNode = null;\n    }\n    // A node to remove was found in the template\n    if (nodesToRemove.has(node)) {\n      nodesToRemoveInTemplate.push(node);\n      // Track node we're removing\n      if (currentRemovingNode === null) {\n        currentRemovingNode = node;\n      }\n    }\n    // When removing, increment count by which to adjust subsequent part indices\n    if (currentRemovingNode !== null) {\n      removeCount++;\n    }\n    while (part !== undefined && part.index === nodeIndex) {\n      // If part is in a removed node deactivate it by setting index to -1 or\n      // adjust the index as needed.\n      part.index = currentRemovingNode !== null ? -1 : part.index - removeCount;\n      // go to the next active part.\n      partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n      part = parts[partIndex];\n    }\n  }\n  nodesToRemoveInTemplate.forEach((n) => n.parentNode!.removeChild(n));\n}\n\nconst countNodes = (node: Node) => {\n  let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1;\n  const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);\n  while (walker.nextNode()) {\n    count++;\n  }\n  return count;\n};\n\nconst nextActiveIndexInTemplateParts =\n    (parts: TemplatePart[], startIndex = -1) => {\n      for (let i = startIndex + 1; i < parts.length; i++) {\n        const part = parts[i];\n        if (isTemplatePartActive(part)) {\n          return i;\n        }\n      }\n      return -1;\n    };\n\n/**\n * Inserts the given node into the Template, optionally before the given\n * refNode. In addition to inserting the node into the Template, the Template\n * part indices are updated to match the mutated Template DOM.\n */\nexport function insertNodeIntoTemplate(\n    template: Template, node: Node, refNode: Node|null = null) {\n  const {element: {content}, parts} = template;\n  // If there's no refNode, then put node at end of template.\n  // No part indices need to be shifted in this case.\n  if (refNode === null || refNode === undefined) {\n    content.appendChild(node);\n    return;\n  }\n  const walker =\n      document.createTreeWalker(content, walkerNodeFilter, null, false);\n  let partIndex = nextActiveIndexInTemplateParts(parts);\n  let insertCount = 0;\n  let walkerIndex = -1;\n  while (walker.nextNode()) {\n    walkerIndex++;\n    const walkerNode = walker.currentNode as Element;\n    if (walkerNode === refNode) {\n      insertCount = countNodes(node);\n      refNode.parentNode!.insertBefore(node, refNode);\n    }\n    while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {\n      // If we've inserted the node, simply adjust all subsequent parts\n      if (insertCount > 0) {\n        while (partIndex !== -1) {\n          parts[partIndex].index += insertCount;\n          partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n        }\n        return;\n      }\n      partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n    }\n  }\n}\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\n\nconst directives = new WeakMap<object, true>();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DirectiveFactory = (...args: any[]) => object;\n\nexport type DirectiveFn = (part: Part) => void;\n\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n *   if (part.value !== v) {\n *     part.setValue(v)\n *   }\n * });\n */\nexport const directive = <F extends DirectiveFactory>(f: F): F =>\n    ((...args: unknown[]) => {\n      const d = f(...args);\n      directives.set(d, true);\n      return d;\n    }) as F;\n\nexport const isDirective = (o: unknown): o is DirectiveFn => {\n  return typeof o === 'function' && directives.has(o);\n};\n", "/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The Part interface represents a dynamic part of a template instance rendered\n * by lit-html.\n */\nexport interface Part {\n  readonly value: unknown;\n\n  /**\n   * Sets the current part value, but does not write it to the DOM.\n   * @param value The value that will be committed.\n   */\n  setValue(value: unknown): void;\n\n  /**\n   * Commits the current part value, causing it to actually be written to the\n   * DOM.\n   *\n   * Directives are run at the start of `commit`, so that if they call\n   * `part.setValue(...)` synchronously that value will be used in the current\n   * commit, and there's no need to call `part.commit()` within the directive.\n   * If directives set a part value asynchronously, then they must call\n   * `part.commit()` manually.\n   */\n  commit(): void;\n}\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isCEPolyfill} from './dom.js';\nimport {Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n  private readonly __parts: Array<Part|undefined> = [];\n  readonly processor: TemplateProcessor;\n  readonly options: RenderOptions;\n  readonly template: Template;\n\n  constructor(\n      template: Template, processor: TemplateProcessor,\n      options: RenderOptions) {\n    this.template = template;\n    this.processor = processor;\n    this.options = options;\n  }\n\n  update(values: readonly unknown[]) {\n    let i = 0;\n    for (const part of this.__parts) {\n      if (part !== undefined) {\n        part.setValue(values[i]);\n      }\n      i++;\n    }\n    for (const part of this.__parts) {\n      if (part !== undefined) {\n        part.commit();\n      }\n    }\n  }\n\n  _clone(): DocumentFragment {\n    // There are a number of steps in the lifecycle of a template instance's\n    // DOM fragment:\n    //  1. Clone - create the instance fragment\n    //  2. Adopt - adopt into the main document\n    //  3. Process - find part markers and create parts\n    //  4. Upgrade - upgrade custom elements\n    //  5. Update - set node, attribute, property, etc., values\n    //  6. Connect - connect to the document. Optional and outside of this\n    //     method.\n    //\n    // We have a few constraints on the ordering of these steps:\n    //  * We need to upgrade before updating, so that property values will pass\n    //    through any property setters.\n    //  * We would like to process before upgrading so that we're sure that the\n    //    cloned fragment is inert and not disturbed by self-modifying DOM.\n    //  * We want custom elements to upgrade even in disconnected fragments.\n    //\n    // Given these constraints, with full custom elements support we would\n    // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n    //\n    // But Safari does not implement CustomElementRegistry#upgrade, so we\n    // can not implement that order and still have upgrade-before-update and\n    // upgrade disconnected fragments. So we instead sacrifice the\n    // process-before-upgrade constraint, since in Custom Elements v1 elements\n    // must not modify their light DOM in the constructor. We still have issues\n    // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n    // that don't strictly adhere to the no-modification rule because shadow\n    // DOM, which may be created in the constructor, is emulated by being placed\n    // in the light DOM.\n    //\n    // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n    // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n    // in one step.\n    //\n    // The Custom Elements v1 polyfill supports upgrade(), so the order when\n    // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n    // Connect.\n\n    const fragment = isCEPolyfill ?\n        this.template.element.content.cloneNode(true) as DocumentFragment :\n        document.importNode(this.template.element.content, true);\n\n    const stack: Node[] = [];\n    const parts = this.template.parts;\n    // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n    const walker = document.createTreeWalker(\n        fragment,\n        133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n        null,\n        false);\n    let partIndex = 0;\n    let nodeIndex = 0;\n    let part: TemplatePart;\n    let node = walker.nextNode();\n    // Loop through all the nodes and parts of a template\n    while (partIndex < parts.length) {\n      part = parts[partIndex];\n      if (!isTemplatePartActive(part)) {\n        this.__parts.push(undefined);\n        partIndex++;\n        continue;\n      }\n\n      // Progress the tree walker until we find our next part's node.\n      // Note that multiple parts may share the same node (attribute parts\n      // on a single element), so this loop may not run at all.\n      while (nodeIndex < part.index) {\n        nodeIndex++;\n        if (node!.nodeName === 'TEMPLATE') {\n          stack.push(node!);\n          walker.currentNode = (node as HTMLTemplateElement).content;\n        }\n        if ((node = walker.nextNode()) === null) {\n          // We've exhausted the content inside a nested template element.\n          // Because we still have parts (the outer for-loop), we know:\n          // - There is a template in the stack\n          // - The walker will find a nextNode outside the template\n          walker.currentNode = stack.pop()!;\n          node = walker.nextNode();\n        }\n      }\n\n      // We've arrived at our part's node.\n      if (part.type === 'node') {\n        const part = this.processor.handleTextExpression(this.options);\n        part.insertAfterNode(node!.previousSibling!);\n        this.__parts.push(part);\n      } else {\n        this.__parts.push(...this.processor.handleAttributeExpressions(\n            node as Element, part.name, part.strings, this.options));\n      }\n      partIndex++;\n    }\n\n    if (isCEPolyfill) {\n      document.adoptNode(fragment);\n      customElements.upgrade(fragment);\n    }\n    return fragment;\n  }\n}\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {reparentNodes} from './dom.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker} from './template.js';\n\ndeclare const trustedTypes: typeof window.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n    trustedTypes!.createPolicy('lit-html', {createHTML: (s) => s});\n\nconst commentMarker = ` ${marker} `;\n\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n  readonly strings: TemplateStringsArray;\n  readonly values: readonly unknown[];\n  readonly type: string;\n  readonly processor: TemplateProcessor;\n\n  constructor(\n      strings: TemplateStringsArray, values: readonly unknown[], type: string,\n      processor: TemplateProcessor) {\n    this.strings = strings;\n    this.values = values;\n    this.type = type;\n    this.processor = processor;\n  }\n\n  /**\n   * Returns a string of HTML used to create a `<template>` element.\n   */\n  getHTML(): string {\n    const l = this.strings.length - 1;\n    let html = '';\n    let isCommentBinding = false;\n\n    for (let i = 0; i < l; i++) {\n      const s = this.strings[i];\n      // For each binding we want to determine the kind of marker to insert\n      // into the template source before it's parsed by the browser's HTML\n      // parser. The marker type is based on whether the expression is in an\n      // attribute, text, or comment position.\n      //   * For node-position bindings we insert a comment with the marker\n      //     sentinel as its text content, like <!--{{lit-guid}}-->.\n      //   * For attribute bindings we insert just the marker sentinel for the\n      //     first binding, so that we support unquoted attribute bindings.\n      //     Subsequent bindings can use a comment marker because multi-binding\n      //     attributes must be quoted.\n      //   * For comment bindings we insert just the marker sentinel so we don't\n      //     close the comment.\n      //\n      // The following code scans the template source, but is *not* an HTML\n      // parser. We don't need to track the tree structure of the HTML, only\n      // whether a binding is inside a comment, and if not, if it appears to be\n      // the first binding in an attribute.\n      const commentOpen = s.lastIndexOf('<!--');\n      // We're in comment position if we have a comment open with no following\n      // comment close. Because <-- can appear in an attribute value there can\n      // be false positives.\n      isCommentBinding = (commentOpen > -1 || isCommentBinding) &&\n          s.indexOf('-->', commentOpen + 1) === -1;\n      // Check to see if we have an attribute-like sequence preceding the\n      // expression. This can match \"name=value\" like structures in text,\n      // comments, and attribute values, so there can be false-positives.\n      const attributeMatch = lastAttributeNameRegex.exec(s);\n      if (attributeMatch === null) {\n        // We're only in this branch if we don't have a attribute-like\n        // preceding sequence. For comments, this guards against unusual\n        // attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n        // <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n        // below.\n        html += s + (isCommentBinding ? commentMarker : nodeMarker);\n      } else {\n        // For attributes we use just a marker sentinel, and also append a\n        // $lit$ suffix to the name to opt-out of attribute-specific parsing\n        // that IE and Edge do for style and certain SVG attributes.\n        html += s.substr(0, attributeMatch.index) + attributeMatch[1] +\n            attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] +\n            marker;\n      }\n    }\n    html += this.strings[l];\n    return html;\n  }\n\n  getTemplateElement(): HTMLTemplateElement {\n    const template = document.createElement('template');\n    let value = this.getHTML();\n    if (policy !== undefined) {\n      // this is secure because `this.strings` is a TemplateStringsArray.\n      // TODO: validate this when\n      // https://github.com/tc39/proposal-array-is-template-object is\n      // implemented.\n      value = policy.createHTML(value) as unknown as string;\n    }\n    template.innerHTML = value;\n    return template;\n  }\n}\n\n/**\n * A TemplateResult for SVG fragments.\n *\n * This class wraps HTML in an `<svg>` tag in order to parse its contents in the\n * SVG namespace, then modifies the template to remove the `<svg>` tag so that\n * clones only container the original fragment.\n */\nexport class SVGTemplateResult extends TemplateResult {\n  getHTML(): string {\n    return `<svg>${super.getHTML()}</svg>`;\n  }\n\n  getTemplateElement(): HTMLTemplateElement {\n    const template = super.getTemplateElement();\n    const content = template.content;\n    const svgElement = content.firstChild!;\n    content.removeChild(svgElement);\n    reparentNodes(content, svgElement.firstChild);\n    return template;\n  }\n}\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isDirective} from './directive.js';\nimport {removeNodes} from './dom.js';\nimport {noChange, nothing, Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {createMarker} from './template.js';\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\nexport type Primitive = null|undefined|boolean|number|string|symbol|bigint;\nexport const isPrimitive = (value: unknown): value is Primitive => {\n  return (\n      value === null ||\n      !(typeof value === 'object' || typeof value === 'function'));\n};\nexport const isIterable = (value: unknown): value is Iterable<unknown> => {\n  return Array.isArray(value) ||\n      // eslint-disable-next-line @typescript-eslint/no-explicit-any\n      !!(value && (value as any)[Symbol.iterator]);\n};\n\n/**\n * Writes attribute values to the DOM for a group of AttributeParts bound to a\n * single attribute. The value is only set once even if there are multiple parts\n * for an attribute.\n */\nexport class AttributeCommitter {\n  readonly element: Element;\n  readonly name: string;\n  readonly strings: ReadonlyArray<string>;\n  readonly parts: ReadonlyArray<AttributePart>;\n  dirty = true;\n\n  constructor(element: Element, name: string, strings: ReadonlyArray<string>) {\n    this.element = element;\n    this.name = name;\n    this.strings = strings;\n    this.parts = [];\n    for (let i = 0; i < strings.length - 1; i++) {\n      (this.parts as AttributePart[])[i] = this._createPart();\n    }\n  }\n\n  /**\n   * Creates a single part. Override this to create a differnt type of part.\n   */\n  protected _createPart(): AttributePart {\n    return new AttributePart(this);\n  }\n\n  protected _getValue(): unknown {\n    const strings = this.strings;\n    const l = strings.length - 1;\n    const parts = this.parts;\n\n    // If we're assigning an attribute via syntax like:\n    //    attr=\"${foo}\"  or  attr=${foo}\n    // but not\n    //    attr=\"${foo} ${bar}\" or attr=\"${foo} baz\"\n    // then we don't want to coerce the attribute value into one long\n    // string. Instead we want to just return the value itself directly,\n    // so that sanitizeDOMValue can get the actual value rather than\n    // String(value)\n    // The exception is if v is an array, in which case we do want to smash\n    // it together into a string without calling String() on the array.\n    //\n    // This also allows trusted values (when using TrustedTypes) being\n    // assigned to DOM sinks without being stringified in the process.\n    if (l === 1 && strings[0] === '' && strings[1] === '') {\n      const v = parts[0].value;\n      if (typeof v === 'symbol') {\n        return String(v);\n      }\n      if (typeof v === 'string' || !isIterable(v)) {\n        return v;\n      }\n    }\n    let text = '';\n\n    for (let i = 0; i < l; i++) {\n      text += strings[i];\n      const part = parts[i];\n      if (part !== undefined) {\n        const v = part.value;\n        if (isPrimitive(v) || !isIterable(v)) {\n          text += typeof v === 'string' ? v : String(v);\n        } else {\n          for (const t of v) {\n            text += typeof t === 'string' ? t : String(t);\n          }\n        }\n      }\n    }\n\n    text += strings[l];\n    return text;\n  }\n\n  commit(): void {\n    if (this.dirty) {\n      this.dirty = false;\n      this.element.setAttribute(this.name, this._getValue() as string);\n    }\n  }\n}\n\n/**\n * A Part that controls all or part of an attribute value.\n */\nexport class AttributePart implements Part {\n  readonly committer: AttributeCommitter;\n  value: unknown = undefined;\n\n  constructor(committer: AttributeCommitter) {\n    this.committer = committer;\n  }\n\n  setValue(value: unknown): void {\n    if (value !== noChange && (!isPrimitive(value) || value !== this.value)) {\n      this.value = value;\n      // If the value is a not a directive, dirty the committer so that it'll\n      // call setAttribute. If the value is a directive, it'll dirty the\n      // committer if it calls setValue().\n      if (!isDirective(value)) {\n        this.committer.dirty = true;\n      }\n    }\n  }\n\n  commit() {\n    while (isDirective(this.value)) {\n      const directive = this.value;\n      this.value = noChange;\n      directive(this);\n    }\n    if (this.value === noChange) {\n      return;\n    }\n    this.committer.commit();\n  }\n}\n\n/**\n * A Part that controls a location within a Node tree. Like a Range, NodePart\n * has start and end locations and can set and update the Nodes between those\n * locations.\n *\n * NodeParts support several value types: primitives, Nodes, TemplateResults,\n * as well as arrays and iterables of those types.\n */\nexport class NodePart implements Part {\n  readonly options: RenderOptions;\n  startNode!: Node;\n  endNode!: Node;\n  value: unknown = undefined;\n  private __pendingValue: unknown = undefined;\n\n  constructor(options: RenderOptions) {\n    this.options = options;\n  }\n\n  /**\n   * Appends this part into a container.\n   *\n   * This part must be empty, as its contents are not automatically moved.\n   */\n  appendInto(container: Node) {\n    this.startNode = container.appendChild(createMarker());\n    this.endNode = container.appendChild(createMarker());\n  }\n\n  /**\n   * Inserts this part after the `ref` node (between `ref` and `ref`'s next\n   * sibling). Both `ref` and its next sibling must be static, unchanging nodes\n   * such as those that appear in a literal section of a template.\n   *\n   * This part must be empty, as its contents are not automatically moved.\n   */\n  insertAfterNode(ref: Node) {\n    this.startNode = ref;\n    this.endNode = ref.nextSibling!;\n  }\n\n  /**\n   * Appends this part into a parent part.\n   *\n   * This part must be empty, as its contents are not automatically moved.\n   */\n  appendIntoPart(part: NodePart) {\n    part.__insert(this.startNode = createMarker());\n    part.__insert(this.endNode = createMarker());\n  }\n\n  /**\n   * Inserts this part after the `ref` part.\n   *\n   * This part must be empty, as its contents are not automatically moved.\n   */\n  insertAfterPart(ref: NodePart) {\n    ref.__insert(this.startNode = createMarker());\n    this.endNode = ref.endNode;\n    ref.endNode = this.startNode;\n  }\n\n  setValue(value: unknown): void {\n    this.__pendingValue = value;\n  }\n\n  commit() {\n    if (this.startNode.parentNode === null) {\n      return;\n    }\n    while (isDirective(this.__pendingValue)) {\n      const directive = this.__pendingValue;\n      this.__pendingValue = noChange;\n      directive(this);\n    }\n    const value = this.__pendingValue;\n    if (value === noChange) {\n      return;\n    }\n    if (isPrimitive(value)) {\n      if (value !== this.value) {\n        this.__commitText(value);\n      }\n    } else if (value instanceof TemplateResult) {\n      this.__commitTemplateResult(value);\n    } else if (value instanceof Node) {\n      this.__commitNode(value);\n    } else if (isIterable(value)) {\n      this.__commitIterable(value);\n    } else if (value === nothing) {\n      this.value = nothing;\n      this.clear();\n    } else {\n      // Fallback, will render the string representation\n      this.__commitText(value);\n    }\n  }\n\n  private __insert(node: Node) {\n    this.endNode.parentNode!.insertBefore(node, this.endNode);\n  }\n\n  private __commitNode(value: Node): void {\n    if (this.value === value) {\n      return;\n    }\n    this.clear();\n    this.__insert(value);\n    this.value = value;\n  }\n\n  private __commitText(value: unknown): void {\n    const node = this.startNode.nextSibling!;\n    value = value == null ? '' : value;\n    // If `value` isn't already a string, we explicitly convert it here in case\n    // it can't be implicitly converted - i.e. it's a symbol.\n    const valueAsString: string =\n        typeof value === 'string' ? value : String(value);\n    if (node === this.endNode.previousSibling &&\n        node.nodeType === 3 /* Node.TEXT_NODE */) {\n      // If we only have a single text node between the markers, we can just\n      // set its value, rather than replacing it.\n      // TODO(justinfagnani): Can we just check if this.value is primitive?\n      (node as Text).data = valueAsString;\n    } else {\n      this.__commitNode(document.createTextNode(valueAsString));\n    }\n    this.value = value;\n  }\n\n  private __commitTemplateResult(value: TemplateResult): void {\n    const template = this.options.templateFactory(value);\n    if (this.value instanceof TemplateInstance &&\n        this.value.template === template) {\n      this.value.update(value.values);\n    } else {\n      // Make sure we propagate the template processor from the TemplateResult\n      // so that we use its syntax extension, etc. The template factory comes\n      // from the render function options so that it can control template\n      // caching and preprocessing.\n      const instance =\n          new TemplateInstance(template, value.processor, this.options);\n      const fragment = instance._clone();\n      instance.update(value.values);\n      this.__commitNode(fragment);\n      this.value = instance;\n    }\n  }\n\n  private __commitIterable(value: Iterable<unknown>): void {\n    // For an Iterable, we create a new InstancePart per item, then set its\n    // value to the item. This is a little bit of overhead for every item in\n    // an Iterable, but it lets us recurse easily and efficiently update Arrays\n    // of TemplateResults that will be commonly returned from expressions like:\n    // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n\n    // If _value is an array, then the previous render was of an\n    // iterable and _value will contain the NodeParts from the previous\n    // render. If _value is not an array, clear this part and make a new\n    // array for NodeParts.\n    if (!Array.isArray(this.value)) {\n      this.value = [];\n      this.clear();\n    }\n\n    // Lets us keep track of how many items we stamped so we can clear leftover\n    // items from a previous render\n    const itemParts = this.value as NodePart[];\n    let partIndex = 0;\n    let itemPart: NodePart|undefined;\n\n    for (const item of value) {\n      // Try to reuse an existing part\n      itemPart = itemParts[partIndex];\n\n      // If no existing part, create a new one\n      if (itemPart === undefined) {\n        itemPart = new NodePart(this.options);\n        itemParts.push(itemPart);\n        if (partIndex === 0) {\n          itemPart.appendIntoPart(this);\n        } else {\n          itemPart.insertAfterPart(itemParts[partIndex - 1]);\n        }\n      }\n      itemPart.setValue(item);\n      itemPart.commit();\n      partIndex++;\n    }\n\n    if (partIndex < itemParts.length) {\n      // Truncate the parts array so _value reflects the current state\n      itemParts.length = partIndex;\n      this.clear(itemPart && itemPart.endNode);\n    }\n  }\n\n  clear(startNode: Node = this.startNode) {\n    removeNodes(\n        this.startNode.parentNode!, startNode.nextSibling!, this.endNode);\n  }\n}\n\n/**\n * Implements a boolean attribute, roughly as defined in the HTML\n * specification.\n *\n * If the value is truthy, then the attribute is present with a value of\n * ''. If the value is falsey, the attribute is removed.\n */\nexport class BooleanAttributePart implements Part {\n  readonly element: Element;\n  readonly name: string;\n  readonly strings: readonly string[];\n  value: unknown = undefined;\n  private __pendingValue: unknown = undefined;\n\n  constructor(element: Element, name: string, strings: readonly string[]) {\n    if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') {\n      throw new Error(\n          'Boolean attributes can only contain a single expression');\n    }\n    this.element = element;\n    this.name = name;\n    this.strings = strings;\n  }\n\n  setValue(value: unknown): void {\n    this.__pendingValue = value;\n  }\n\n  commit() {\n    while (isDirective(this.__pendingValue)) {\n      const directive = this.__pendingValue;\n      this.__pendingValue = noChange;\n      directive(this);\n    }\n    if (this.__pendingValue === noChange) {\n      return;\n    }\n    const value = !!this.__pendingValue;\n    if (this.value !== value) {\n      if (value) {\n        this.element.setAttribute(this.name, '');\n      } else {\n        this.element.removeAttribute(this.name);\n      }\n      this.value = value;\n    }\n    this.__pendingValue = noChange;\n  }\n}\n\n/**\n * Sets attribute values for PropertyParts, so that the value is only set once\n * even if there are multiple parts for a property.\n *\n * If an expression controls the whole property value, then the value is simply\n * assigned to the property under control. If there are string literals or\n * multiple expressions, then the strings are expressions are interpolated into\n * a string first.\n */\nexport class PropertyCommitter extends AttributeCommitter {\n  readonly single: boolean;\n\n  constructor(element: Element, name: string, strings: ReadonlyArray<string>) {\n    super(element, name, strings);\n    this.single =\n        (strings.length === 2 && strings[0] === '' && strings[1] === '');\n  }\n\n  protected _createPart(): PropertyPart {\n    return new PropertyPart(this);\n  }\n\n  protected _getValue() {\n    if (this.single) {\n      return this.parts[0].value;\n    }\n    return super._getValue();\n  }\n\n  commit(): void {\n    if (this.dirty) {\n      this.dirty = false;\n      // eslint-disable-next-line @typescript-eslint/no-explicit-any\n      (this.element as any)[this.name] = this._getValue();\n    }\n  }\n}\n\nexport class PropertyPart extends AttributePart {}\n\n// Detect event listener options support. If the `capture` property is read\n// from the options object, then options are supported. If not, then the third\n// argument to add/removeEventListener is interpreted as the boolean capture\n// value so we should only pass the `capture` property.\nlet eventOptionsSupported = false;\n\n// Wrap into an IIFE because MS Edge <= v41 does not support having try/catch\n// blocks right into the body of a module\n(() => {\n  try {\n    const options = {\n      get capture() {\n        eventOptionsSupported = true;\n        return false;\n      }\n    };\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    window.addEventListener('test', options as any, options);\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    window.removeEventListener('test', options as any, options);\n  } catch (_e) {\n    // event options not supported\n  }\n})();\n\ntype EventHandlerWithOptions =\n    EventListenerOrEventListenerObject&Partial<AddEventListenerOptions>;\nexport class EventPart implements Part {\n  readonly element: Element;\n  readonly eventName: string;\n  readonly eventContext?: EventTarget;\n  value: undefined|EventHandlerWithOptions = undefined;\n  private __options?: AddEventListenerOptions;\n  private __pendingValue: undefined|EventHandlerWithOptions = undefined;\n  private readonly __boundHandleEvent: (event: Event) => void;\n\n  constructor(element: Element, eventName: string, eventContext?: EventTarget) {\n    this.element = element;\n    this.eventName = eventName;\n    this.eventContext = eventContext;\n    this.__boundHandleEvent = (e) => this.handleEvent(e);\n  }\n\n  setValue(value: undefined|EventHandlerWithOptions): void {\n    this.__pendingValue = value;\n  }\n\n  commit() {\n    while (isDirective(this.__pendingValue)) {\n      const directive = this.__pendingValue;\n      this.__pendingValue = noChange as EventHandlerWithOptions;\n      directive(this);\n    }\n    if (this.__pendingValue === noChange) {\n      return;\n    }\n\n    const newListener = this.__pendingValue;\n    const oldListener = this.value;\n    const shouldRemoveListener = newListener == null ||\n        oldListener != null &&\n            (newListener.capture !== oldListener.capture ||\n             newListener.once !== oldListener.once ||\n             newListener.passive !== oldListener.passive);\n    const shouldAddListener =\n        newListener != null && (oldListener == null || shouldRemoveListener);\n\n    if (shouldRemoveListener) {\n      this.element.removeEventListener(\n          this.eventName, this.__boundHandleEvent, this.__options);\n    }\n    if (shouldAddListener) {\n      this.__options = getOptions(newListener);\n      this.element.addEventListener(\n          this.eventName, this.__boundHandleEvent, this.__options);\n    }\n    this.value = newListener;\n    this.__pendingValue = noChange as EventHandlerWithOptions;\n  }\n\n  handleEvent(event: Event) {\n    if (typeof this.value === 'function') {\n      this.value.call(this.eventContext || this.element, event);\n    } else {\n      (this.value as EventListenerObject).handleEvent(event);\n    }\n  }\n}\n\n// We copy options because of the inconsistent behavior of browsers when reading\n// the third argument of add/removeEventListener. IE11 doesn't support options\n// at all. Chrome 41 only reads `capture` if the argument is an object.\nconst getOptions = (o: AddEventListenerOptions|undefined) => o &&\n    (eventOptionsSupported ?\n         {capture: o.capture, passive: o.passive, once: o.once} :\n         o.capture as AddEventListenerOptions);\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\n/**\n * A function type that creates a Template from a TemplateResult.\n *\n * This is a hook into the template-creation process for rendering that\n * requires some modification of templates before they're used, like ShadyCSS,\n * which must add classes to elements and remove styles.\n *\n * Templates should be cached as aggressively as possible, so that many\n * TemplateResults produced from the same expression only do the work of\n * creating the Template the first time.\n *\n * Templates are usually cached by TemplateResult.strings and\n * TemplateResult.type, but may be cached by other keys if this function\n * modifies the template.\n *\n * Note that currently TemplateFactories must not add, remove, or reorder\n * expressions, because there is no way to describe such a modification\n * to render() so that values are interpolated to the correct place in the\n * template instances.\n */\nexport type TemplateFactory = (result: TemplateResult) => Template;\n\n/**\n * The default TemplateFactory which caches Templates keyed on\n * result.type and result.strings.\n */\nexport function templateFactory(result: TemplateResult) {\n  let templateCache = templateCaches.get(result.type);\n  if (templateCache === undefined) {\n    templateCache = {\n      stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n      keyString: new Map<string, Template>()\n    };\n    templateCaches.set(result.type, templateCache);\n  }\n\n  let template = templateCache.stringsArray.get(result.strings);\n  if (template !== undefined) {\n    return template;\n  }\n\n  // If the TemplateStringsArray is new, generate a key from the strings\n  // This key is shared between all templates with identical content\n  const key = result.strings.join(marker);\n\n  // Check if we already have a Template for this key\n  template = templateCache.keyString.get(key);\n  if (template === undefined) {\n    // If we have not seen this key before, create a new Template\n    template = new Template(result, result.getTemplateElement());\n    // Cache the Template for this key\n    templateCache.keyString.set(key, template);\n  }\n\n  // Cache all future queries for this TemplateStringsArray\n  templateCache.stringsArray.set(result.strings, template);\n  return template;\n}\n\n/**\n * The first argument to JS template tags retain identity across multiple\n * calls to a tag for the same literal, so we can cache work done per literal\n * in a Map.\n *\n * Safari currently has a bug which occasionally breaks this behavior, so we\n * need to cache the Template at two levels. We first cache the\n * TemplateStringsArray, and if that fails, we cache a key constructed by\n * joining the strings array.\n */\nexport interface TemplateCache {\n  readonly stringsArray: WeakMap<TemplateStringsArray, Template>;\n  readonly keyString: Map<string, Template>;\n}\n\nexport const templateCaches = new Map<string, TemplateCache>();\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {removeNodes} from './dom.js';\nimport {NodePart} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {templateFactory} from './template-factory.js';\n\nexport const parts = new WeakMap<Node, NodePart>();\n\n/**\n * Renders a template result or other value to a container.\n *\n * To update a container with new values, reevaluate the template literal and\n * call `render` with the new result.\n *\n * @param result Any value renderable by NodePart - typically a TemplateResult\n *     created by evaluating a template tag like `html` or `svg`.\n * @param container A DOM parent to render to. The entire contents are either\n *     replaced, or efficiently updated if the same result type was previous\n *     rendered there.\n * @param options RenderOptions for the entire render tree rendered to this\n *     container. Render options must *not* change between renders to the same\n *     container, as those changes will not effect previously rendered DOM.\n */\nexport const render =\n    (result: unknown,\n     container: Element|DocumentFragment,\n     options?: Partial<RenderOptions>) => {\n      let part = parts.get(container);\n      if (part === undefined) {\n        removeNodes(container, container.firstChild);\n        parts.set(container, part = new NodePart({\n                               templateFactory,\n                               ...options,\n                             }));\n        part.appendInto(container);\n      }\n      part.setValue(result);\n      part.commit();\n    };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\nimport {AttributeCommitter, BooleanAttributePart, EventPart, NodePart, PropertyCommitter} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\n\n/**\n * Creates Parts when a template is instantiated.\n */\nexport class DefaultTemplateProcessor implements TemplateProcessor {\n  /**\n   * Create parts for an attribute-position binding, given the event, attribute\n   * name, and string literals.\n   *\n   * @param element The element containing the binding\n   * @param name  The attribute name\n   * @param strings The string literals. There are always at least two strings,\n   *   event for fully-controlled bindings with a single expression.\n   */\n  handleAttributeExpressions(\n      element: Element, name: string, strings: string[],\n      options: RenderOptions): ReadonlyArray<Part> {\n    const prefix = name[0];\n    if (prefix === '.') {\n      const committer = new PropertyCommitter(element, name.slice(1), strings);\n      return committer.parts;\n    }\n    if (prefix === '@') {\n      return [new EventPart(element, name.slice(1), options.eventContext)];\n    }\n    if (prefix === '?') {\n      return [new BooleanAttributePart(element, name.slice(1), strings)];\n    }\n    const committer = new AttributeCommitter(element, name, strings);\n    return committer.parts;\n  }\n  /**\n   * Create parts for a text-position binding.\n   * @param templateFactory\n   */\n  handleTextExpression(options: RenderOptions) {\n    return new NodePart(options);\n  }\n}\n\nexport const defaultTemplateProcessor = new DefaultTemplateProcessor();\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n *\n * Main lit-html module.\n *\n * Main exports:\n *\n * -  [[html]]\n * -  [[svg]]\n * -  [[render]]\n *\n * @packageDocumentation\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {defaultTemplateProcessor} from './lib/default-template-processor.js';\nimport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\n\nexport {DefaultTemplateProcessor, defaultTemplateProcessor} from './lib/default-template-processor.js';\nexport {directive, DirectiveFn, isDirective} from './lib/directive.js';\n// TODO(justinfagnani): remove line when we get NodePart moving methods\nexport {removeNodes, reparentNodes} from './lib/dom.js';\nexport {noChange, nothing, Part} from './lib/part.js';\nexport {AttributeCommitter, AttributePart, BooleanAttributePart, EventPart, isIterable, isPrimitive, NodePart, PropertyCommitter, PropertyPart} from './lib/parts.js';\nexport {RenderOptions} from './lib/render-options.js';\nexport {parts, render} from './lib/render.js';\nexport {templateCaches, templateFactory} from './lib/template-factory.js';\nexport {TemplateInstance} from './lib/template-instance.js';\nexport {TemplateProcessor} from './lib/template-processor.js';\nexport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\nexport {createMarker, isTemplatePartActive, Template} from './lib/template.js';\n\ndeclare global {\n  interface Window {\n    litHtmlVersions: string[];\n  }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n// TODO(justinfagnani): inject version number at build time\nif (typeof window !== 'undefined') {\n  (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.4.1');\n}\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n */\nexport const html = (strings: TemplateStringsArray, ...values: unknown[]) =>\n    new TemplateResult(strings, values, 'html', defaultTemplateProcessor);\n\n/**\n * Interprets a template literal as an SVG template that can efficiently\n * render to and update a container.\n */\nexport const svg = (strings: TemplateStringsArray, ...values: unknown[]) =>\n    new SVGTemplateResult(strings, values, 'svg', defaultTemplateProcessor);\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Module to add shady DOM/shady CSS polyfill support to lit-html template\n * rendering. See the [[render]] method for details.\n *\n * @packageDocumentation\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {removeNodes} from './dom.js';\nimport {insertNodeIntoTemplate, removeNodesFromTemplate} from './modify-template.js';\nimport {RenderOptions} from './render-options.js';\nimport {parts, render as litRender} from './render.js';\nimport {templateCaches} from './template-factory.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\nexport {html, svg, TemplateResult} from '../lit-html.js';\n\n// Get a key to lookup in `templateCaches`.\nconst getTemplateCacheKey = (type: string, scopeName: string) =>\n    `${type}--${scopeName}`;\n\nlet compatibleShadyCSSVersion = true;\n\nif (typeof window.ShadyCSS === 'undefined') {\n  compatibleShadyCSSVersion = false;\n} else if (typeof window.ShadyCSS.prepareTemplateDom === 'undefined') {\n  console.warn(\n      `Incompatible ShadyCSS version detected. ` +\n      `Please update to at least @webcomponents/webcomponentsjs@2.0.2 and ` +\n      `@webcomponents/shadycss@1.3.1.`);\n  compatibleShadyCSSVersion = false;\n}\n\n/**\n * Template factory which scopes template DOM using ShadyCSS.\n * @param scopeName {string}\n */\nexport const shadyTemplateFactory = (scopeName: string) =>\n    (result: TemplateResult) => {\n      const cacheKey = getTemplateCacheKey(result.type, scopeName);\n      let templateCache = templateCaches.get(cacheKey);\n      if (templateCache === undefined) {\n        templateCache = {\n          stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n          keyString: new Map<string, Template>()\n        };\n        templateCaches.set(cacheKey, templateCache);\n      }\n\n      let template = templateCache.stringsArray.get(result.strings);\n      if (template !== undefined) {\n        return template;\n      }\n\n      const key = result.strings.join(marker);\n      template = templateCache.keyString.get(key);\n      if (template === undefined) {\n        const element = result.getTemplateElement();\n        if (compatibleShadyCSSVersion) {\n          window.ShadyCSS!.prepareTemplateDom(element, scopeName);\n        }\n        template = new Template(result, element);\n        templateCache.keyString.set(key, template);\n      }\n      templateCache.stringsArray.set(result.strings, template);\n      return template;\n    };\n\nconst TEMPLATE_TYPES = ['html', 'svg'];\n\n/**\n * Removes all style elements from Templates for the given scopeName.\n */\nconst removeStylesFromLitTemplates = (scopeName: string) => {\n  TEMPLATE_TYPES.forEach((type) => {\n    const templates = templateCaches.get(getTemplateCacheKey(type, scopeName));\n    if (templates !== undefined) {\n      templates.keyString.forEach((template) => {\n        const {element: {content}} = template;\n        // IE 11 doesn't support the iterable param Set constructor\n        const styles = new Set<Element>();\n        Array.from(content.querySelectorAll('style')).forEach((s: Element) => {\n          styles.add(s);\n        });\n        removeNodesFromTemplate(template, styles);\n      });\n    }\n  });\n};\n\nconst shadyRenderSet = new Set<string>();\n\n/**\n * For the given scope name, ensures that ShadyCSS style scoping is performed.\n * This is done just once per scope name so the fragment and template cannot\n * be modified.\n * (1) extracts styles from the rendered fragment and hands them to ShadyCSS\n * to be scoped and appended to the document\n * (2) removes style elements from all lit-html Templates for this scope name.\n *\n * Note, <style> elements can only be placed into templates for the\n * initial rendering of the scope. If <style> elements are included in templates\n * dynamically rendered to the scope (after the first scope render), they will\n * not be scoped and the <style> will be left in the template and rendered\n * output.\n */\nconst prepareTemplateStyles =\n    (scopeName: string, renderedDOM: DocumentFragment, template?: Template) => {\n      shadyRenderSet.add(scopeName);\n      // If `renderedDOM` is stamped from a Template, then we need to edit that\n      // Template's underlying template element. Otherwise, we create one here\n      // to give to ShadyCSS, which still requires one while scoping.\n      const templateElement =\n          !!template ? template.element : document.createElement('template');\n      // Move styles out of rendered DOM and store.\n      const styles = renderedDOM.querySelectorAll('style');\n      const {length} = styles;\n      // If there are no styles, skip unnecessary work\n      if (length === 0) {\n        // Ensure prepareTemplateStyles is called to support adding\n        // styles via `prepareAdoptedCssText` since that requires that\n        // `prepareTemplateStyles` is called.\n        //\n        // ShadyCSS will only update styles containing @apply in the template\n        // given to `prepareTemplateStyles`. If no lit Template was given,\n        // ShadyCSS will not be able to update uses of @apply in any relevant\n        // template. However, this is not a problem because we only create the\n        // template for the purpose of supporting `prepareAdoptedCssText`,\n        // which doesn't support @apply at all.\n        window.ShadyCSS!.prepareTemplateStyles(templateElement, scopeName);\n        return;\n      }\n      const condensedStyle = document.createElement('style');\n      // Collect styles into a single style. This helps us make sure ShadyCSS\n      // manipulations will not prevent us from being able to fix up template\n      // part indices.\n      // NOTE: collecting styles is inefficient for browsers but ShadyCSS\n      // currently does this anyway. When it does not, this should be changed.\n      for (let i = 0; i < length; i++) {\n        const style = styles[i];\n        style.parentNode!.removeChild(style);\n        condensedStyle.textContent! += style.textContent;\n      }\n      // Remove styles from nested templates in this scope.\n      removeStylesFromLitTemplates(scopeName);\n      // And then put the condensed style into the \"root\" template passed in as\n      // `template`.\n      const content = templateElement.content;\n      if (!!template) {\n        insertNodeIntoTemplate(template, condensedStyle, content.firstChild);\n      } else {\n        content.insertBefore(condensedStyle, content.firstChild);\n      }\n      // Note, it's important that ShadyCSS gets the template that `lit-html`\n      // will actually render so that it can update the style inside when\n      // needed (e.g. @apply native Shadow DOM case).\n      window.ShadyCSS!.prepareTemplateStyles(templateElement, scopeName);\n      const style = content.querySelector('style');\n      if (window.ShadyCSS!.nativeShadow && style !== null) {\n        // When in native Shadow DOM, ensure the style created by ShadyCSS is\n        // included in initially rendered output (`renderedDOM`).\n        renderedDOM.insertBefore(style.cloneNode(true), renderedDOM.firstChild);\n      } else if (!!template) {\n        // When no style is left in the template, parts will be broken as a\n        // result. To fix this, we put back the style node ShadyCSS removed\n        // and then tell lit to remove that node from the template.\n        // There can be no style in the template in 2 cases (1) when Shady DOM\n        // is in use, ShadyCSS removes all styles, (2) when native Shadow DOM\n        // is in use ShadyCSS removes the style if it contains no content.\n        // NOTE, ShadyCSS creates its own style so we can safely add/remove\n        // `condensedStyle` here.\n        content.insertBefore(condensedStyle, content.firstChild);\n        const removes = new Set<Node>();\n        removes.add(condensedStyle);\n        removeNodesFromTemplate(template, removes);\n      }\n    };\n\nexport interface ShadyRenderOptions extends Partial<RenderOptions> {\n  scopeName: string;\n}\n\n/**\n * Extension to the standard `render` method which supports rendering\n * to ShadowRoots when the ShadyDOM (https://github.com/webcomponents/shadydom)\n * and ShadyCSS (https://github.com/webcomponents/shadycss) polyfills are used\n * or when the webcomponentsjs\n * (https://github.com/webcomponents/webcomponentsjs) polyfill is used.\n *\n * Adds a `scopeName` option which is used to scope element DOM and stylesheets\n * when native ShadowDOM is unavailable. The `scopeName` will be added to\n * the class attribute of all rendered DOM. In addition, any style elements will\n * be automatically re-written with this `scopeName` selector and moved out\n * of the rendered DOM and into the document `<head>`.\n *\n * It is common to use this render method in conjunction with a custom element\n * which renders a shadowRoot. When this is done, typically the element's\n * `localName` should be used as the `scopeName`.\n *\n * In addition to DOM scoping, ShadyCSS also supports a basic shim for css\n * custom properties (needed only on older browsers like IE11) and a shim for\n * a deprecated feature called `@apply` that supports applying a set of css\n * custom properties to a given location.\n *\n * Usage considerations:\n *\n * * Part values in `<style>` elements are only applied the first time a given\n * `scopeName` renders. Subsequent changes to parts in style elements will have\n * no effect. Because of this, parts in style elements should only be used for\n * values that will never change, for example parts that set scope-wide theme\n * values or parts which render shared style elements.\n *\n * * Note, due to a limitation of the ShadyDOM polyfill, rendering in a\n * custom element's `constructor` is not supported. Instead rendering should\n * either done asynchronously, for example at microtask timing (for example\n * `Promise.resolve()`), or be deferred until the first time the element's\n * `connectedCallback` runs.\n *\n * Usage considerations when using shimmed custom properties or `@apply`:\n *\n * * Whenever any dynamic changes are made which affect\n * css custom properties, `ShadyCSS.styleElement(element)` must be called\n * to update the element. There are two cases when this is needed:\n * (1) the element is connected to a new parent, (2) a class is added to the\n * element that causes it to match different custom properties.\n * To address the first case when rendering a custom element, `styleElement`\n * should be called in the element's `connectedCallback`.\n *\n * * Shimmed custom properties may only be defined either for an entire\n * shadowRoot (for example, in a `:host` rule) or via a rule that directly\n * matches an element with a shadowRoot. In other words, instead of flowing from\n * parent to child as do native css custom properties, shimmed custom properties\n * flow only from shadowRoots to nested shadowRoots.\n *\n * * When using `@apply` mixing css shorthand property names with\n * non-shorthand names (for example `border` and `border-width`) is not\n * supported.\n */\nexport const render =\n    (result: unknown,\n     container: Element|DocumentFragment|ShadowRoot,\n     options: ShadyRenderOptions) => {\n      if (!options || typeof options !== 'object' || !options.scopeName) {\n        throw new Error('The `scopeName` option is required.');\n      }\n      const scopeName = options.scopeName;\n      const hasRendered = parts.has(container);\n      const needsScoping = compatibleShadyCSSVersion &&\n          container.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */ &&\n          !!(container as ShadowRoot).host;\n      // Handle first render to a scope specially...\n      const firstScopeRender = needsScoping && !shadyRenderSet.has(scopeName);\n      // On first scope render, render into a fragment; this cannot be a single\n      // fragment that is reused since nested renders can occur synchronously.\n      const renderContainer =\n          firstScopeRender ? document.createDocumentFragment() : container;\n      litRender(\n          result,\n          renderContainer,\n          {templateFactory: shadyTemplateFactory(scopeName), ...options} as\n              RenderOptions);\n      // When performing first scope render,\n      // (1) We've rendered into a fragment so that there's a chance to\n      // `prepareTemplateStyles` before sub-elements hit the DOM\n      // (which might cause them to render based on a common pattern of\n      // rendering in a custom element's `connectedCallback`);\n      // (2) Scope the template with ShadyCSS one time only for this scope.\n      // (3) Render the fragment into the container and make sure the\n      // container knows its `part` is the one we just rendered. This ensures\n      // DOM will be re-used on subsequent renders.\n      if (firstScopeRender) {\n        const part = parts.get(renderContainer)!;\n        parts.delete(renderContainer);\n        // ShadyCSS might have style sheets (e.g. from `prepareAdoptedCssText`)\n        // that should apply to `renderContainer` even if the rendered value is\n        // not a TemplateInstance. However, it will only insert scoped styles\n        // into the document if `prepareTemplateStyles` has already been called\n        // for the given scope name.\n        const template = part.value instanceof TemplateInstance ?\n            part.value.template :\n            undefined;\n        prepareTemplateStyles(\n            scopeName, renderContainer as DocumentFragment, template);\n        removeNodes(container, container.firstChild);\n        container.appendChild(renderContainer);\n        parts.set(container, part);\n      }\n      // After elements have hit the DOM, update styling if this is the\n      // initial render to this container.\n      // This is needed whenever dynamic changes are made so it would be\n      // safest to do every render; however, this would regress performance\n      // so we leave it up to the user to call `ShadyCSS.styleElement`\n      // for dynamic changes.\n      if (!hasRendered && needsScoping) {\n        window.ShadyCSS!.styleElement((container as ShadowRoot).host);\n      }\n    };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Use this module if you want to create your own base class extending\n * [[UpdatingElement]].\n * @packageDocumentation\n */\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\nwindow.JSCompiler_renameProperty =\n    <P extends PropertyKey>(prop: P, _obj: unknown): P => prop;\n\ndeclare global {\n  var JSCompiler_renameProperty: <P extends PropertyKey>(\n      prop: P, _obj: unknown) => P;\n\n  interface Window {\n    JSCompiler_renameProperty: typeof JSCompiler_renameProperty;\n  }\n}\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n  /**\n   * Function called to convert an attribute value to a property\n   * value.\n   */\n  fromAttribute?(value: string|null, type?: TypeHint): Type;\n\n  /**\n   * Function called to convert a property value to an attribute\n   * value.\n   *\n   * It returns unknown instead of string, to be compatible with\n   * https://github.com/WICG/trusted-types (and similar efforts).\n   */\n  toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n    ComplexAttributeConverter<Type>|\n    ((value: string|null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n  /**\n   * Indicates how and whether the property becomes an observed attribute.\n   * If the value is `false`, the property is not added to `observedAttributes`.\n   * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n   * becomes `foobar`). If a string, the string value is observed (e.g\n   * `attribute: 'foo-bar'`).\n   */\n  readonly attribute?: boolean|string;\n\n  /**\n   * Indicates the type of the property. This is used only as a hint for the\n   * `converter` to determine how to convert the attribute\n   * to/from a property.\n   */\n  readonly type?: TypeHint;\n\n  /**\n   * Indicates how to convert the attribute to/from a property. If this value\n   * is a function, it is used to convert the attribute value a the property\n   * value. If it's an object, it can have keys for `fromAttribute` and\n   * `toAttribute`. If no `toAttribute` function is provided and\n   * `reflect` is set to `true`, the property value is set directly to the\n   * attribute. A default `converter` is used if none is provided; it supports\n   * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n   * when a property changes and the converter is used to update the attribute,\n   * the property is never updated again as a result of the attribute changing,\n   * and vice versa.\n   */\n  readonly converter?: AttributeConverter<Type, TypeHint>;\n\n  /**\n   * Indicates if the property should reflect to an attribute.\n   * If `true`, when the property is set, the attribute is set using the\n   * attribute name determined according to the rules for the `attribute`\n   * property option and the value of the property converted using the rules\n   * from the `converter` property option.\n   */\n  readonly reflect?: boolean;\n\n  /**\n   * A function that indicates if a property should be considered changed when\n   * it is set. The function should take the `newValue` and `oldValue` and\n   * return `true` if an update should be requested.\n   */\n  hasChanged?(value: Type, oldValue: Type): boolean;\n\n  /**\n   * Indicates whether an accessor will be created for this property. By\n   * default, an accessor will be generated for this property that requests an\n   * update when set. If this flag is `true`, no accessor will be created, and\n   * it will be the user's responsibility to call\n   * `this.requestUpdate(propertyName, oldValue)` to request an update when\n   * the property changes.\n   */\n  readonly noAccessor?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n  readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * Map of changed properties with old values. Takes an optional generic\n * interface corresponding to the declared element properties.\n */\n// tslint:disable-next-line:no-any\nexport type PropertyValues<T = any> =\n    keyof T extends PropertyKey ? Map<keyof T, unknown>: never;\n\nexport const defaultConverter: ComplexAttributeConverter = {\n\n  toAttribute(value: unknown, type?: unknown): unknown {\n    switch (type) {\n      case Boolean:\n        return value ? '' : null;\n      case Object:\n      case Array:\n        // if the value is `null` or `undefined` pass this through\n        // to allow removing/no change behavior.\n        return value == null ? value : JSON.stringify(value);\n    }\n    return value;\n  },\n\n  fromAttribute(value: string|null, type?: unknown) {\n    switch (type) {\n      case Boolean:\n        return value !== null;\n      case Number:\n        return value === null ? null : Number(value);\n      case Object:\n      case Array:\n        // Type assert to adhere to Bazel's \"must type assert JSON parse\" rule.\n        return JSON.parse(value!) as unknown;\n    }\n    return value;\n  }\n\n};\n\nexport interface HasChanged {\n  (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean => {\n  // This ensures (old==NaN, value==NaN) always returns false\n  return old !== value && (old === old || value === value);\n};\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n  attribute: true,\n  type: String,\n  converter: defaultConverter,\n  reflect: false,\n  hasChanged: notEqual\n};\n\nconst STATE_HAS_UPDATED = 1;\nconst STATE_UPDATE_REQUESTED = 1 << 2;\nconst STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3;\nconst STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4;\ntype UpdateState = typeof STATE_HAS_UPDATED|typeof STATE_UPDATE_REQUESTED|\n    typeof STATE_IS_REFLECTING_TO_ATTRIBUTE|\n    typeof STATE_IS_REFLECTING_TO_PROPERTY;\n\n/**\n * The Closure JS Compiler doesn't currently have good support for static\n * property semantics where \"this\" is dynamic (e.g.\n * https://github.com/google/closure-compiler/issues/3177 and others) so we use\n * this hack to bypass any rewriting by the compiler.\n */\nconst finalized = 'finalized';\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclassers to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class UpdatingElement extends HTMLElement {\n  /*\n   * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n   * all static methods and properties with initializers.  Reference:\n   * - https://github.com/google/closure-compiler/issues/1776\n   */\n\n  /**\n   * Maps attribute names to properties; for example `foobar` attribute to\n   * `fooBar` property. Created lazily on user subclasses when finalizing the\n   * class.\n   */\n  private static _attributeToPropertyMap: AttributeMap;\n\n  /**\n   * Marks class as having finished creating properties.\n   */\n  protected static[finalized] = true;\n\n  /**\n   * Memoized list of all class properties, including any superclass properties.\n   * Created lazily on user subclasses when finalizing the class.\n   */\n  private static _classProperties?: PropertyDeclarationMap;\n\n  /**\n   * User-supplied object that maps property names to `PropertyDeclaration`\n   * objects containing options for configuring the property.\n   */\n  static properties: PropertyDeclarations;\n\n  /**\n   * Returns a list of attributes corresponding to the registered properties.\n   * @nocollapse\n   */\n  static get observedAttributes() {\n    // note: piggy backing on this to ensure we're finalized.\n    this.finalize();\n    const attributes: string[] = [];\n    // Use forEach so this works even if for/of loops are compiled to for loops\n    // expecting arrays\n    this._classProperties!.forEach((v, p) => {\n      const attr = this._attributeNameForProperty(p, v);\n      if (attr !== undefined) {\n        this._attributeToPropertyMap.set(attr, p);\n        attributes.push(attr);\n      }\n    });\n    return attributes;\n  }\n\n  /**\n   * Ensures the private `_classProperties` property metadata is created.\n   * In addition to `finalize` this is also called in `createProperty` to\n   * ensure the `@property` decorator can add property metadata.\n   */\n  /** @nocollapse */\n  private static _ensureClassProperties() {\n    // ensure private storage for property declarations.\n    if (!this.hasOwnProperty(\n            JSCompiler_renameProperty('_classProperties', this))) {\n      this._classProperties = new Map();\n      // NOTE: Workaround IE11 not supporting Map constructor argument.\n      const superProperties: PropertyDeclarationMap =\n          Object.getPrototypeOf(this)._classProperties;\n      if (superProperties !== undefined) {\n        superProperties.forEach(\n            (v: PropertyDeclaration, k: PropertyKey) =>\n                this._classProperties!.set(k, v));\n      }\n    }\n  }\n\n  /**\n   * Creates a property accessor on the element prototype if one does not exist\n   * and stores a PropertyDeclaration for the property with the given options.\n   * The property setter calls the property's `hasChanged` property option\n   * or uses a strict identity check to determine whether or not to request\n   * an update.\n   *\n   * This method may be overridden to customize properties; however,\n   * when doing so, it's important to call `super.createProperty` to ensure\n   * the property is setup correctly. This method calls\n   * `getPropertyDescriptor` internally to get a descriptor to install.\n   * To customize what properties do when they are get or set, override\n   * `getPropertyDescriptor`. To customize the options for a property,\n   * implement `createProperty` like this:\n   *\n   * static createProperty(name, options) {\n   *   options = Object.assign(options, {myOption: true});\n   *   super.createProperty(name, options);\n   * }\n   *\n   * @nocollapse\n   */\n  static createProperty(\n      name: PropertyKey,\n      options: PropertyDeclaration = defaultPropertyDeclaration) {\n    // Note, since this can be called by the `@property` decorator which\n    // is called before `finalize`, we ensure storage exists for property\n    // metadata.\n    this._ensureClassProperties();\n    this._classProperties!.set(name, options);\n    // Do not generate an accessor if the prototype already has one, since\n    // it would be lost otherwise and that would never be the user's intention;\n    // Instead, we expect users to call `requestUpdate` themselves from\n    // user-defined accessors. Note that if the super has an accessor we will\n    // still overwrite it\n    if (options.noAccessor || this.prototype.hasOwnProperty(name)) {\n      return;\n    }\n    const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n    const descriptor = this.getPropertyDescriptor(name, key, options);\n    if (descriptor !== undefined) {\n      Object.defineProperty(this.prototype, name, descriptor);\n    }\n  }\n\n  /**\n   * Returns a property descriptor to be defined on the given named property.\n   * If no descriptor is returned, the property will not become an accessor.\n   * For example,\n   *\n   *   class MyElement extends LitElement {\n   *     static getPropertyDescriptor(name, key, options) {\n   *       const defaultDescriptor =\n   *           super.getPropertyDescriptor(name, key, options);\n   *       const setter = defaultDescriptor.set;\n   *       return {\n   *         get: defaultDescriptor.get,\n   *         set(value) {\n   *           setter.call(this, value);\n   *           // custom action.\n   *         },\n   *         configurable: true,\n   *         enumerable: true\n   *       }\n   *     }\n   *   }\n   *\n   * @nocollapse\n   */\n  protected static getPropertyDescriptor(\n      name: PropertyKey, key: string|symbol, options: PropertyDeclaration) {\n    return {\n      // tslint:disable-next-line:no-any no symbol in index\n      get(): any {\n        return (this as {[key: string]: unknown})[key as string];\n      },\n      set(this: UpdatingElement, value: unknown) {\n        const oldValue =\n            (this as {} as {[key: string]: unknown})[name as string];\n        (this as {} as {[key: string]: unknown})[key as string] = value;\n        (this as unknown as UpdatingElement)\n            .requestUpdateInternal(name, oldValue, options);\n      },\n      configurable: true,\n      enumerable: true\n    };\n  }\n\n  /**\n   * Returns the property options associated with the given property.\n   * These options are defined with a PropertyDeclaration via the `properties`\n   * object or the `@property` decorator and are registered in\n   * `createProperty(...)`.\n   *\n   * Note, this method should be considered \"final\" and not overridden. To\n   * customize the options for a given property, override `createProperty`.\n   *\n   * @nocollapse\n   * @final\n   */\n  protected static getPropertyOptions(name: PropertyKey) {\n    return this._classProperties && this._classProperties.get(name) ||\n        defaultPropertyDeclaration;\n  }\n\n  /**\n   * Creates property accessors for registered properties and ensures\n   * any superclasses are also finalized.\n   * @nocollapse\n   */\n  protected static finalize() {\n    // finalize any superclasses\n    const superCtor = Object.getPrototypeOf(this);\n    if (!superCtor.hasOwnProperty(finalized)) {\n      superCtor.finalize();\n    }\n    this[finalized] = true;\n    this._ensureClassProperties();\n    // initialize Map populated in observedAttributes\n    this._attributeToPropertyMap = new Map();\n    // make any properties\n    // Note, only process \"own\" properties since this element will inherit\n    // any properties defined on the superClass, and finalization ensures\n    // the entire prototype chain is finalized.\n    if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n      const props = this.properties;\n      // support symbols in properties (IE11 does not support this)\n      const propKeys = [\n        ...Object.getOwnPropertyNames(props),\n        ...(typeof Object.getOwnPropertySymbols === 'function') ?\n            Object.getOwnPropertySymbols(props) :\n            []\n      ];\n      // This for/of is ok because propKeys is an array\n      for (const p of propKeys) {\n        // note, use of `any` is due to TypeSript lack of support for symbol in\n        // index types\n        // tslint:disable-next-line:no-any no symbol in index\n        this.createProperty(p, (props as any)[p]);\n      }\n    }\n  }\n\n  /**\n   * Returns the property name for the given attribute `name`.\n   * @nocollapse\n   */\n  private static _attributeNameForProperty(\n      name: PropertyKey, options: PropertyDeclaration) {\n    const attribute = options.attribute;\n    return attribute === false ?\n        undefined :\n        (typeof attribute === 'string' ?\n             attribute :\n             (typeof name === 'string' ? name.toLowerCase() : undefined));\n  }\n\n  /**\n   * Returns true if a property should request an update.\n   * Called when a property value is set and uses the `hasChanged`\n   * option for the property if present or a strict identity check.\n   * @nocollapse\n   */\n  private static _valueHasChanged(\n      value: unknown, old: unknown, hasChanged: HasChanged = notEqual) {\n    return hasChanged(value, old);\n  }\n\n  /**\n   * Returns the property value for the given attribute value.\n   * Called via the `attributeChangedCallback` and uses the property's\n   * `converter` or `converter.fromAttribute` property option.\n   * @nocollapse\n   */\n  private static _propertyValueFromAttribute(\n      value: string|null, options: PropertyDeclaration) {\n    const type = options.type;\n    const converter = options.converter || defaultConverter;\n    const fromAttribute =\n        (typeof converter === 'function' ? converter : converter.fromAttribute);\n    return fromAttribute ? fromAttribute(value, type) : value;\n  }\n\n  /**\n   * Returns the attribute value for the given property value. If this\n   * returns undefined, the property will *not* be reflected to an attribute.\n   * If this returns null, the attribute will be removed, otherwise the\n   * attribute will be set to the value.\n   * This uses the property's `reflect` and `type.toAttribute` property options.\n   * @nocollapse\n   */\n  private static _propertyValueToAttribute(\n      value: unknown, options: PropertyDeclaration) {\n    if (options.reflect === undefined) {\n      return;\n    }\n    const type = options.type;\n    const converter = options.converter;\n    const toAttribute =\n        converter && (converter as ComplexAttributeConverter).toAttribute ||\n        defaultConverter.toAttribute;\n    return toAttribute!(value, type);\n  }\n\n  private _updateState!: UpdateState;\n  private _instanceProperties?: PropertyValues;\n  // Initialize to an unresolved Promise so we can make sure the element has\n  // connected before first update.\n  private _updatePromise!: Promise<unknown>;\n  private _enableUpdatingResolver: ((r?: unknown) => void)|undefined;\n\n  /**\n   * Map with keys for any properties that have changed since the last\n   * update cycle with previous values.\n   */\n  private _changedProperties!: PropertyValues;\n\n  /**\n   * Map with keys of properties that should be reflected when updated.\n   */\n  private _reflectingProperties?: Map<PropertyKey, PropertyDeclaration>;\n\n  constructor() {\n    super();\n    this.initialize();\n  }\n\n  /**\n   * Performs element initialization. By default captures any pre-set values for\n   * registered properties.\n   */\n  protected initialize() {\n    this._updateState = 0;\n    this._updatePromise =\n        new Promise((res) => this._enableUpdatingResolver = res);\n    this._changedProperties = new Map();\n    this._saveInstanceProperties();\n    // ensures first update will be caught by an early access of\n    // `updateComplete`\n    this.requestUpdateInternal();\n  }\n\n  /**\n   * Fixes any properties set on the instance before upgrade time.\n   * Otherwise these would shadow the accessor and break these properties.\n   * The properties are stored in a Map which is played back after the\n   * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n   * (<=41), properties created for native platform properties like (`id` or\n   * `name`) may not have default values set in the element constructor. On\n   * these browsers native properties appear on instances and therefore their\n   * default value will overwrite any element default (e.g. if the element sets\n   * this.id = 'id' in the constructor, the 'id' will become '' since this is\n   * the native platform default).\n   */\n  private _saveInstanceProperties() {\n    // Use forEach so this works even if for/of loops are compiled to for loops\n    // expecting arrays\n    (this.constructor as typeof UpdatingElement)\n        ._classProperties!.forEach((_v, p) => {\n          if (this.hasOwnProperty(p)) {\n            const value = this[p as keyof this];\n            delete this[p as keyof this];\n            if (!this._instanceProperties) {\n              this._instanceProperties = new Map();\n            }\n            this._instanceProperties.set(p, value);\n          }\n        });\n  }\n\n  /**\n   * Applies previously saved instance properties.\n   */\n  private _applyInstanceProperties() {\n    // Use forEach so this works even if for/of loops are compiled to for loops\n    // expecting arrays\n    // tslint:disable-next-line:no-any\n    this._instanceProperties!.forEach((v, p) => (this as any)[p] = v);\n    this._instanceProperties = undefined;\n  }\n\n  connectedCallback() {\n    // Ensure first connection completes an update. Updates cannot complete\n    // before connection.\n    this.enableUpdating();\n  }\n\n  protected enableUpdating() {\n    if (this._enableUpdatingResolver !== undefined) {\n      this._enableUpdatingResolver();\n      this._enableUpdatingResolver = undefined;\n    }\n  }\n\n  /**\n   * Allows for `super.disconnectedCallback()` in extensions while\n   * reserving the possibility of making non-breaking feature additions\n   * when disconnecting at some point in the future.\n   */\n  disconnectedCallback() {\n  }\n\n  /**\n   * Synchronizes property values when attributes change.\n   */\n  attributeChangedCallback(name: string, old: string|null, value: string|null) {\n    if (old !== value) {\n      this._attributeToProperty(name, value);\n    }\n  }\n\n  private _propertyToAttribute(\n      name: PropertyKey, value: unknown,\n      options: PropertyDeclaration = defaultPropertyDeclaration) {\n    const ctor = (this.constructor as typeof UpdatingElement);\n    const attr = ctor._attributeNameForProperty(name, options);\n    if (attr !== undefined) {\n      const attrValue = ctor._propertyValueToAttribute(value, options);\n      // an undefined value does not change the attribute.\n      if (attrValue === undefined) {\n        return;\n      }\n      // Track if the property is being reflected to avoid\n      // setting the property again via `attributeChangedCallback`. Note:\n      // 1. this takes advantage of the fact that the callback is synchronous.\n      // 2. will behave incorrectly if multiple attributes are in the reaction\n      // stack at time of calling. However, since we process attributes\n      // in `update` this should not be possible (or an extreme corner case\n      // that we'd like to discover).\n      // mark state reflecting\n      this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE;\n      if (attrValue == null) {\n        this.removeAttribute(attr);\n      } else {\n        this.setAttribute(attr, attrValue as string);\n      }\n      // mark state not reflecting\n      this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE;\n    }\n  }\n\n  private _attributeToProperty(name: string, value: string|null) {\n    // Use tracking info to avoid deserializing attribute value if it was\n    // just set from a property setter.\n    if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) {\n      return;\n    }\n    const ctor = (this.constructor as typeof UpdatingElement);\n    // Note, hint this as an `AttributeMap` so closure clearly understands\n    // the type; it has issues with tracking types through statics\n    // tslint:disable-next-line:no-unnecessary-type-assertion\n    const propName = (ctor._attributeToPropertyMap as AttributeMap).get(name);\n    if (propName !== undefined) {\n      const options = ctor.getPropertyOptions(propName);\n      // mark state reflecting\n      this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY;\n      this[propName as keyof this] =\n          // tslint:disable-next-line:no-any\n          ctor._propertyValueFromAttribute(value, options) as any;\n      // mark state not reflecting\n      this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY;\n    }\n  }\n\n  /**\n   * This protected version of `requestUpdate` does not access or return the\n   * `updateComplete` promise. This promise can be overridden and is therefore\n   * not free to access.\n   */\n  protected requestUpdateInternal(\n      name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration) {\n    let shouldRequestUpdate = true;\n    // If we have a property key, perform property update steps.\n    if (name !== undefined) {\n      const ctor = this.constructor as typeof UpdatingElement;\n      options = options || ctor.getPropertyOptions(name);\n      if (ctor._valueHasChanged(\n              this[name as keyof this], oldValue, options.hasChanged)) {\n        if (!this._changedProperties.has(name)) {\n          this._changedProperties.set(name, oldValue);\n        }\n        // Add to reflecting properties set.\n        // Note, it's important that every change has a chance to add the\n        // property to `_reflectingProperties`. This ensures setting\n        // attribute + property reflects correctly.\n        if (options.reflect === true &&\n            !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) {\n          if (this._reflectingProperties === undefined) {\n            this._reflectingProperties = new Map();\n          }\n          this._reflectingProperties.set(name, options);\n        }\n      } else {\n        // Abort the request if the property should not be considered changed.\n        shouldRequestUpdate = false;\n      }\n    }\n    if (!this._hasRequestedUpdate && shouldRequestUpdate) {\n      this._updatePromise = this._enqueueUpdate();\n    }\n  }\n\n  /**\n   * Requests an update which is processed asynchronously. This should\n   * be called when an element should update based on some state not triggered\n   * by setting a property. In this case, pass no arguments. It should also be\n   * called when manually implementing a property setter. In this case, pass the\n   * property `name` and `oldValue` to ensure that any configured property\n   * options are honored. Returns the `updateComplete` Promise which is resolved\n   * when the update completes.\n   *\n   * @param name {PropertyKey} (optional) name of requesting property\n   * @param oldValue {any} (optional) old value of requesting property\n   * @returns {Promise} A Promise that is resolved when the update completes.\n   */\n  requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n    this.requestUpdateInternal(name, oldValue);\n    return this.updateComplete;\n  }\n\n  /**\n   * Sets up the element to asynchronously update.\n   */\n  private async _enqueueUpdate() {\n    this._updateState = this._updateState | STATE_UPDATE_REQUESTED;\n    try {\n      // Ensure any previous update has resolved before updating.\n      // This `await` also ensures that property changes are batched.\n      await this._updatePromise;\n    } catch (e) {\n      // Ignore any previous errors. We only care that the previous cycle is\n      // done. Any error should have been handled in the previous update.\n    }\n    const result = this.performUpdate();\n    // If `performUpdate` returns a Promise, we await it. This is done to\n    // enable coordinating updates with a scheduler. Note, the result is\n    // checked to avoid delaying an additional microtask unless we need to.\n    if (result != null) {\n      await result;\n    }\n    return !this._hasRequestedUpdate;\n  }\n\n  private get _hasRequestedUpdate() {\n    return (this._updateState & STATE_UPDATE_REQUESTED);\n  }\n\n  protected get hasUpdated() {\n    return (this._updateState & STATE_HAS_UPDATED);\n  }\n\n  /**\n   * Performs an element update. Note, if an exception is thrown during the\n   * update, `firstUpdated` and `updated` will not be called.\n   *\n   * You can override this method to change the timing of updates. If this\n   * method is overridden, `super.performUpdate()` must be called.\n   *\n   * For instance, to schedule updates to occur just before the next frame:\n   *\n   * ```\n   * protected async performUpdate(): Promise<unknown> {\n   *   await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n   *   super.performUpdate();\n   * }\n   * ```\n   */\n  protected performUpdate(): void|Promise<unknown> {\n    // Abort any update if one is not pending when this is called.\n    // This can happen if `performUpdate` is called early to \"flush\"\n    // the update.\n    if (!this._hasRequestedUpdate) {\n      return;\n    }\n    // Mixin instance properties once, if they exist.\n    if (this._instanceProperties) {\n      this._applyInstanceProperties();\n    }\n    let shouldUpdate = false;\n    const changedProperties = this._changedProperties;\n    try {\n      shouldUpdate = this.shouldUpdate(changedProperties);\n      if (shouldUpdate) {\n        this.update(changedProperties);\n      } else {\n        this._markUpdated();\n      }\n    } catch (e) {\n      // Prevent `firstUpdated` and `updated` from running when there's an\n      // update exception.\n      shouldUpdate = false;\n      // Ensure element can accept additional updates after an exception.\n      this._markUpdated();\n      throw e;\n    }\n    if (shouldUpdate) {\n      if (!(this._updateState & STATE_HAS_UPDATED)) {\n        this._updateState = this._updateState | STATE_HAS_UPDATED;\n        this.firstUpdated(changedProperties);\n      }\n      this.updated(changedProperties);\n    }\n  }\n\n  private _markUpdated() {\n    this._changedProperties = new Map();\n    this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED;\n  }\n\n  /**\n   * Returns a Promise that resolves when the element has completed updating.\n   * The Promise value is a boolean that is `true` if the element completed the\n   * update without triggering another update. The Promise result is `false` if\n   * a property was set inside `updated()`. If the Promise is rejected, an\n   * exception was thrown during the update.\n   *\n   * To await additional asynchronous work, override the `_getUpdateComplete`\n   * method. For example, it is sometimes useful to await a rendered element\n   * before fulfilling this Promise. To do this, first await\n   * `super._getUpdateComplete()`, then any subsequent state.\n   *\n   * @returns {Promise} The Promise returns a boolean that indicates if the\n   * update resolved without triggering another update.\n   */\n  get updateComplete() {\n    return this._getUpdateComplete();\n  }\n\n  /**\n   * Override point for the `updateComplete` promise.\n   *\n   * It is not safe to override the `updateComplete` getter directly due to a\n   * limitation in TypeScript which means it is not possible to call a\n   * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n   * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n   * This method should be overridden instead. For example:\n   *\n   *   class MyElement extends LitElement {\n   *     async _getUpdateComplete() {\n   *       await super._getUpdateComplete();\n   *       await this._myChild.updateComplete;\n   *     }\n   *   }\n   * @deprecated Override `getUpdateComplete()` instead for forward\n   *     compatibility with `lit-element` 3.0 / `@lit/reactive-element`.\n   */\n  protected _getUpdateComplete() {\n    return this.getUpdateComplete();\n  }\n\n  /**\n   * Override point for the `updateComplete` promise.\n   *\n   * It is not safe to override the `updateComplete` getter directly due to a\n   * limitation in TypeScript which means it is not possible to call a\n   * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n   * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n   * This method should be overridden instead. For example:\n   *\n   *   class MyElement extends LitElement {\n   *     async getUpdateComplete() {\n   *       await super.getUpdateComplete();\n   *       await this._myChild.updateComplete;\n   *     }\n   *   }\n   */\n  protected getUpdateComplete() {\n    return this._updatePromise;\n  }\n\n  /**\n   * Controls whether or not `update` should be called when the element requests\n   * an update. By default, this method always returns `true`, but this can be\n   * customized to control when to update.\n   *\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n    return true;\n  }\n\n  /**\n   * Updates the element. This method reflects property values to attributes.\n   * It can be overridden to render and keep updated element DOM.\n   * Setting properties inside this method will *not* trigger\n   * another update.\n   *\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected update(_changedProperties: PropertyValues) {\n    if (this._reflectingProperties !== undefined &&\n        this._reflectingProperties.size > 0) {\n      // Use forEach so this works even if for/of loops are compiled to for\n      // loops expecting arrays\n      this._reflectingProperties.forEach(\n          (v, k) => this._propertyToAttribute(k, this[k as keyof this], v));\n      this._reflectingProperties = undefined;\n    }\n    this._markUpdated();\n  }\n\n  /**\n   * Invoked whenever the element is updated. Implement to perform\n   * post-updating tasks via DOM APIs, for example, focusing an element.\n   *\n   * Setting properties inside this method will trigger the element to update\n   * again after this update cycle completes.\n   *\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected updated(_changedProperties: PropertyValues) {\n  }\n\n  /**\n   * Invoked when the element is first updated. Implement to perform one time\n   * work on the element after update.\n   *\n   * Setting properties inside this method will trigger the element to update\n   * again after this update cycle completes.\n   *\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected firstUpdated(_changedProperties: PropertyValues) {\n  }\n}\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure Compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {LitElement} from '../lit-element.js';\n\nimport {PropertyDeclaration, UpdatingElement} from './updating-element.js';\n\nexport type Constructor<T> = {\n  // tslint:disable-next-line:no-any\n  new (...args: any[]): T\n};\n\n// From the TC39 Decorators proposal\ninterface ClassDescriptor {\n  kind: 'class';\n  elements: ClassElement[];\n  finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n}\n\n// From the TC39 Decorators proposal\ninterface ClassElement {\n  kind: 'field'|'method';\n  key: PropertyKey;\n  placement: 'static'|'prototype'|'own';\n  initializer?: Function;\n  extras?: ClassElement[];\n  finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n  descriptor?: PropertyDescriptor;\n}\n\nconst legacyCustomElement =\n    (tagName: string, clazz: Constructor<HTMLElement>) => {\n      window.customElements.define(tagName, clazz);\n      // Cast as any because TS doesn't recognize the return type as being a\n      // subtype of the decorated class when clazz is typed as\n      // `Constructor<HTMLElement>` for some reason.\n      // `Constructor<HTMLElement>` is helpful to make sure the decorator is\n      // applied to elements however.\n      // tslint:disable-next-line:no-any\n      return clazz as any;\n    };\n\nconst standardCustomElement =\n    (tagName: string, descriptor: ClassDescriptor) => {\n      const {kind, elements} = descriptor;\n      return {\n        kind,\n        elements,\n        // This callback is called once the class is otherwise fully defined\n        finisher(clazz: Constructor<HTMLElement>) {\n          window.customElements.define(tagName, clazz);\n        }\n      };\n    };\n\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * ```\n * @customElement('my-element')\n * class MyElement {\n *   render() {\n *     return html``;\n *   }\n * }\n * ```\n * @category Decorator\n * @param tagName The name of the custom element to define.\n */\nexport const customElement = (tagName: string) =>\n    (classOrDescriptor: Constructor<HTMLElement>|ClassDescriptor) =>\n        (typeof classOrDescriptor === 'function') ?\n    legacyCustomElement(tagName, classOrDescriptor) :\n    standardCustomElement(tagName, classOrDescriptor);\n\nconst standardProperty =\n    (options: PropertyDeclaration, element: ClassElement) => {\n      // When decorating an accessor, pass it through and add property metadata.\n      // Note, the `hasOwnProperty` check in `createProperty` ensures we don't\n      // stomp over the user's accessor.\n      if (element.kind === 'method' && element.descriptor &&\n          !('value' in element.descriptor)) {\n        return {\n          ...element,\n          finisher(clazz: typeof UpdatingElement) {\n            clazz.createProperty(element.key, options);\n          }\n        };\n      } else {\n        // createProperty() takes care of defining the property, but we still\n        // must return some kind of descriptor, so return a descriptor for an\n        // unused prototype field. The finisher calls createProperty().\n        return {\n          kind: 'field',\n          key: Symbol(),\n          placement: 'own',\n          descriptor: {},\n          // When @babel/plugin-proposal-decorators implements initializers,\n          // do this instead of the initializer below. See:\n          // https://github.com/babel/babel/issues/9260 extras: [\n          //   {\n          //     kind: 'initializer',\n          //     placement: 'own',\n          //     initializer: descriptor.initializer,\n          //   }\n          // ],\n          initializer(this: {[key: string]: unknown}) {\n            if (typeof element.initializer === 'function') {\n              this[element.key as string] = element.initializer.call(this);\n            }\n          },\n          finisher(clazz: typeof UpdatingElement) {\n            clazz.createProperty(element.key, options);\n          }\n        };\n      }\n    };\n\nconst legacyProperty =\n    (options: PropertyDeclaration, proto: Object, name: PropertyKey) => {\n      (proto.constructor as typeof UpdatingElement)\n          .createProperty(name, options);\n    };\n\n/**\n * A property decorator which creates a LitElement property which reflects a\n * corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be\n * supplied to configure property features.\n *\n * This decorator should only be used for public fields. Private or protected\n * fields should use the [[`internalProperty`]] decorator.\n *\n * @example\n * ```ts\n * class MyElement {\n *   @property({ type: Boolean })\n *   clicked = false;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function property(options?: PropertyDeclaration) {\n  // tslint:disable-next-line:no-any decorator\n  return (protoOrDescriptor: Object|ClassElement, name?: PropertyKey): any =>\n             (name !== undefined) ?\n      legacyProperty(options!, protoOrDescriptor as Object, name) :\n      standardProperty(options!, protoOrDescriptor as ClassElement);\n}\n\nexport interface InternalPropertyDeclaration<Type = unknown> {\n  /**\n   * A function that indicates if a property should be considered changed when\n   * it is set. The function should take the `newValue` and `oldValue` and\n   * return `true` if an update should be requested.\n   */\n  hasChanged?(value: Type, oldValue: Type): boolean;\n}\n\n/**\n * Declares a private or protected property that still triggers updates to the\n * element when it changes.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like the Closure Compiler.\n * @category Decorator\n * @deprecated `internalProperty` has been renamed to `state` in lit-element\n *     3.0. Please update to `state` now to be compatible with 3.0.\n */\nexport function internalProperty(options?: InternalPropertyDeclaration) {\n  return property({attribute: false, hasChanged: options?.hasChanged});\n}\n\n/**\n * Declares a private or protected property that still triggers updates to the\n * element when it changes.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like the Closure Compiler.\n * @category Decorator\n */\nexport const state = (options?: InternalPropertyDeclaration) =>\n    internalProperty(options);\n\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @param cache An optional boolean which when true performs the DOM query only\n * once and caches the result.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * @example\n *\n * ```ts\n * class MyElement {\n *   @query('#first')\n *   first;\n *\n *   render() {\n *     return html`\n *       <div id=\"first\"></div>\n *       <div id=\"second\"></div>\n *     `;\n *   }\n * }\n * ```\n * @category Decorator\n */\nexport function query(selector: string, cache?: boolean) {\n  return (protoOrDescriptor: Object|ClassElement,\n          // tslint:disable-next-line:no-any decorator\n          name?: PropertyKey): any => {\n    const descriptor = {\n      get(this: LitElement) {\n        return this.renderRoot.querySelector(selector);\n      },\n      enumerable: true,\n      configurable: true,\n    };\n    if (cache) {\n      const prop =\n          name !== undefined ? name : (protoOrDescriptor as ClassElement).key;\n      const key = typeof prop === 'symbol' ? Symbol() : `__${prop}`;\n      descriptor.get = function(this: LitElement) {\n        if ((this as unknown as\n             {[key: string]: Element | null})[key as string] === undefined) {\n          ((this as unknown as {[key: string]: Element | null})[key as string] =\n               this.renderRoot.querySelector(selector));\n        }\n        return (\n            this as unknown as {[key: string]: Element | null})[key as string];\n      };\n    }\n    return (name !== undefined) ?\n        legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n        standardQuery(descriptor, protoOrDescriptor as ClassElement);\n  };\n}\n\n// Note, in the future, we may extend this decorator to support the use case\n// where the queried element may need to do work to become ready to interact\n// with (e.g. load some implementation code). If so, we might elect to\n// add a second argument defining a function that can be run to make the\n// queried element loaded/updated/ready.\n/**\n * A property decorator that converts a class property into a getter that\n * returns a promise that resolves to the result of a querySelector on the\n * element's renderRoot done after the element's `updateComplete` promise\n * resolves. When the queried property may change with element state, this\n * decorator can be used instead of requiring users to await the\n * `updateComplete` before accessing the property.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * @example\n * ```ts\n * class MyElement {\n *   @queryAsync('#first')\n *   first;\n *\n *   render() {\n *     return html`\n *       <div id=\"first\"></div>\n *       <div id=\"second\"></div>\n *     `;\n *   }\n * }\n *\n * // external usage\n * async doSomethingWithFirst() {\n *  (await aMyElement.first).doSomething();\n * }\n * ```\n * @category Decorator\n */\nexport function queryAsync(selector: string) {\n  return (protoOrDescriptor: Object|ClassElement,\n          // tslint:disable-next-line:no-any decorator\n          name?: PropertyKey): any => {\n    const descriptor = {\n      async get(this: LitElement) {\n        await this.updateComplete;\n        return this.renderRoot.querySelector(selector);\n      },\n      enumerable: true,\n      configurable: true,\n    };\n    return (name !== undefined) ?\n        legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n        standardQuery(descriptor, protoOrDescriptor as ClassElement);\n  };\n}\n\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll\n *\n * @example\n * ```ts\n * class MyElement {\n *   @queryAll('div')\n *   divs;\n *\n *   render() {\n *     return html`\n *       <div id=\"first\"></div>\n *       <div id=\"second\"></div>\n *     `;\n *   }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAll(selector: string) {\n  return (protoOrDescriptor: Object|ClassElement,\n          // tslint:disable-next-line:no-any decorator\n          name?: PropertyKey): any => {\n    const descriptor = {\n      get(this: LitElement) {\n        return this.renderRoot.querySelectorAll(selector);\n      },\n      enumerable: true,\n      configurable: true,\n    };\n    return (name !== undefined) ?\n        legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n        standardQuery(descriptor, protoOrDescriptor as ClassElement);\n  };\n}\n\nconst legacyQuery =\n    (descriptor: PropertyDescriptor, proto: Object, name: PropertyKey) => {\n      Object.defineProperty(proto, name, descriptor);\n    };\n\nconst standardQuery = (descriptor: PropertyDescriptor, element: ClassElement) =>\n    ({\n      kind: 'method',\n      placement: 'prototype',\n      key: element.key,\n      descriptor,\n    });\n\nconst standardEventOptions =\n    (options: AddEventListenerOptions, element: ClassElement) => {\n      return {\n        ...element,\n        finisher(clazz: typeof UpdatingElement) {\n          Object.assign(\n              clazz.prototype[element.key as keyof UpdatingElement], options);\n        }\n      };\n    };\n\nconst legacyEventOptions =\n    // tslint:disable-next-line:no-any legacy decorator\n    (options: AddEventListenerOptions, proto: any, name: PropertyKey) => {\n      Object.assign(proto[name], options);\n    };\n\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifies event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n *\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n *\n * @example\n * ```ts\n * class MyElement {\n *   clicked = false;\n *\n *   render() {\n *     return html`\n *       <div @click=${this._onClick}`>\n *         <button></button>\n *       </div>\n *     `;\n *   }\n *\n *   @eventOptions({capture: true})\n *   _onClick(e) {\n *     this.clicked = true;\n *   }\n * }\n * ```\n * @category Decorator\n */\nexport function eventOptions(options: AddEventListenerOptions) {\n  // Return value typed as any to prevent TypeScript from complaining that\n  // standard decorator function signature does not match TypeScript decorator\n  // signature\n  // TODO(kschaaf): unclear why it was only failing on this decorator and not\n  // the others\n  return ((protoOrDescriptor: Object|ClassElement, name?: string) =>\n              (name !== undefined) ?\n              legacyEventOptions(options, protoOrDescriptor as Object, name) :\n              standardEventOptions(\n                  options, protoOrDescriptor as ClassElement)) as\n             // tslint:disable-next-line:no-any decorator\n             any;\n}\n\n// x-browser support for matches\n// tslint:disable-next-line:no-any\nconst ElementProto = Element.prototype as any;\nconst legacyMatches =\n    ElementProto.msMatchesSelector || ElementProto.webkitMatchesSelector;\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedNodes` of the given named `slot`. Note, the type of\n * this property should be annotated as `NodeListOf<HTMLElement>`.\n *\n * @param slotName A string name of the slot.\n * @param flatten A boolean which when true flattens the assigned nodes,\n * meaning any assigned nodes that are slot elements are replaced with their\n * assigned nodes.\n * @param selector A string which filters the results to elements that match\n * the given css selector.\n *\n * * @example\n * ```ts\n * class MyElement {\n *   @queryAssignedNodes('list', true, '.item')\n *   listItems;\n *\n *   render() {\n *     return html`\n *       <slot name=\"list\"></slot>\n *     `;\n *   }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAssignedNodes(\n    slotName = '', flatten = false, selector = '') {\n  return (protoOrDescriptor: Object|ClassElement,\n          // tslint:disable-next-line:no-any decorator\n          name?: PropertyKey): any => {\n    const descriptor = {\n      get(this: LitElement) {\n        const slotSelector =\n            `slot${slotName ? `[name=${slotName}]` : ':not([name])'}`;\n        const slot = this.renderRoot.querySelector(slotSelector);\n        let nodes = slot && (slot as HTMLSlotElement).assignedNodes({flatten});\n        if (nodes && selector) {\n          nodes = nodes.filter(\n              (node) => node.nodeType === Node.ELEMENT_NODE &&\n                  // tslint:disable-next-line:no-any testing existence on older browsers\n                  ((node as any).matches ?\n                       (node as Element).matches(selector) :\n                       legacyMatches.call(node as Element, selector)));\n        }\n        return nodes;\n      },\n      enumerable: true,\n      configurable: true,\n    };\n    return (name !== undefined) ?\n        legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n        standardQuery(descriptor, protoOrDescriptor as ClassElement);\n  };\n}\n", "/**\n@license\nCopyright (c) 2019 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at\nhttp://polymer.github.io/LICENSE.txt The complete set of authors may be found at\nhttp://polymer.github.io/AUTHORS.txt The complete set of contributors may be\nfound at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as\npart of the polymer project is also subject to an additional IP rights grant\nfound at http://polymer.github.io/PATENTS.txt\n*/\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets = (window.ShadowRoot) &&\n    (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) &&\n    ('adoptedStyleSheets' in Document.prototype) &&\n    ('replace' in CSSStyleSheet.prototype);\n\nconst constructionToken = Symbol();\n\nexport class CSSResult {\n  _styleSheet?: CSSStyleSheet|null;\n\n  readonly cssText: string;\n\n  constructor(cssText: string, safeToken: symbol) {\n    if (safeToken !== constructionToken) {\n      throw new Error(\n          'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');\n    }\n\n    this.cssText = cssText;\n  }\n\n  // Note, this is a getter so that it's lazy. In practice, this means\n  // stylesheets are not created until the first element instance is made.\n  get styleSheet(): CSSStyleSheet|null {\n    if (this._styleSheet === undefined) {\n      // Note, if `supportsAdoptingStyleSheets` is true then we assume\n      // CSSStyleSheet is constructable.\n      if (supportsAdoptingStyleSheets) {\n        this._styleSheet = new CSSStyleSheet();\n        this._styleSheet.replaceSync(this.cssText);\n      } else {\n        this._styleSheet = null;\n      }\n    }\n    return this._styleSheet;\n  }\n\n  toString(): string {\n    return this.cssText;\n  }\n}\n\n/**\n * Wrap a value for interpolation in a [[`css`]] tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) => {\n  return new CSSResult(String(value), constructionToken);\n};\n\nconst textFromCSSResult = (value: CSSResult|number) => {\n  if (value instanceof CSSResult) {\n    return value.cssText;\n  } else if (typeof value === 'number') {\n    return value;\n  } else {\n    throw new Error(\n        `Value passed to 'css' function must be a 'css' function result: ${\n            value}. Use 'unsafeCSS' to pass non-literal values, but\n            take care to ensure page security.`);\n  }\n};\n\n/**\n * Template tag which which can be used with LitElement's [[LitElement.styles |\n * `styles`]] property to set element styles. For security reasons, only literal\n * string values may be used. To incorporate non-literal values [[`unsafeCSS`]]\n * may be used inside a template string part.\n */\nexport const css =\n    (strings: TemplateStringsArray, ...values: (CSSResult|number)[]) => {\n      const cssText = values.reduce(\n          (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n          strings[0]);\n      return new CSSResult(cssText, constructionToken);\n    };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The main LitElement module, which defines the [[`LitElement`]] base class and\n * related APIs.\n *\n *  LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n *  Import [[`LitElement`]] and [[`html`]] from this module to create a\n * component:\n *\n *  ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n *   // Declare observed properties\n *   static get properties() {\n *     return {\n *       adjective: {}\n *     }\n *   }\n *\n *   constructor() {\n *     this.adjective = 'awesome';\n *   }\n *\n *   // Define the element's template\n *   render() {\n *     return html`<p>your ${adjective} template here</p>`;\n *   }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends [[`UpdatingElement`]] and adds lit-html templating.\n * The `UpdatingElement` class is provided for users that want to build\n * their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {render, ShadyRenderOptions} from 'lit-html/lib/shady-render.js';\n\nimport {PropertyValues, UpdatingElement} from './lib/updating-element.js';\n\nexport * from './lib/updating-element.js';\nexport {UpdatingElement as ReactiveElement} from './lib/updating-element.js';\nexport * from './lib/decorators.js';\nexport {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html.js';\nimport {supportsAdoptingStyleSheets, CSSResult, unsafeCSS} from './lib/css-tag.js';\nexport * from './lib/css-tag.js';\n\ndeclare global {\n  interface Window {\n    litElementVersions: string[];\n  }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n// TODO(justinfagnani): inject version number at build time\n(window['litElementVersions'] || (window['litElementVersions'] = []))\n    .push('2.5.1');\n\nexport type CSSResultOrNative = CSSResult|CSSStyleSheet;\n\nexport interface CSSResultArray extends\n    Array<CSSResultOrNative|CSSResultArray> {}\n\nexport type CSSResultGroup = CSSResultOrNative|CSSResultArray;\n\n/**\n * Sentinal value used to avoid calling lit-html's render function when\n * subclasses do not implement `render`\n */\nconst renderNotImplemented = {};\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the [[`properties`]] property or the [[`property`]] decorator.\n */\nexport class LitElement extends UpdatingElement {\n  /**\n   * Ensure this class is marked as `finalized` as an optimization ensuring\n   * it will not needlessly try to `finalize`.\n   *\n   * Note this property name is a string to prevent breaking Closure JS Compiler\n   * optimizations. See updating-element.ts for more information.\n   */\n  protected static['finalized'] = true;\n\n  /**\n   * Reference to the underlying library method used to render the element's\n   * DOM. By default, points to the `render` method from lit-html's shady-render\n   * module.\n   *\n   * **Most users will never need to touch this property.**\n   *\n   * This  property should not be confused with the `render` instance method,\n   * which should be overridden to define a template for the element.\n   *\n   * Advanced users creating a new base class based on LitElement can override\n   * this property to point to a custom render method with a signature that\n   * matches [shady-render's `render`\n   * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render).\n   *\n   * @nocollapse\n   */\n  static render:\n      (result: unknown, container: Element|DocumentFragment,\n       options: ShadyRenderOptions) => void = render;\n\n  /**\n   * Array of styles to apply to the element. The styles should be defined\n   * using the [[`css`]] tag function or via constructible stylesheets.\n   */\n  static styles?: CSSResultGroup;\n\n  /** @nocollapse */\n  static shadowRootOptions: ShadowRootInit = {mode: 'open'};\n\n  private static _styles: Array<CSSResultOrNative|CSSResult>|undefined;\n\n  /**\n   * Return the array of styles to apply to the element.\n   * Override this method to integrate into a style management system.\n   *\n   * @nocollapse\n   */\n  static getStyles(): CSSResultGroup|undefined {\n    return this.styles;\n  }\n\n  /** @nocollapse */\n  private static _getUniqueStyles() {\n    // Only gather styles once per class\n    if (this.hasOwnProperty(JSCompiler_renameProperty('_styles', this))) {\n      return;\n    }\n    // Take care not to call `this.getStyles()` multiple times since this\n    // generates new CSSResults each time.\n    // TODO(sorvell): Since we do not cache CSSResults by input, any\n    // shared styles will generate new stylesheet objects, which is wasteful.\n    // This should be addressed when a browser ships constructable\n    // stylesheets.\n    const userStyles = this.getStyles();\n\n    if (Array.isArray(userStyles)) {\n      // De-duplicate styles preserving the _last_ instance in the set.\n      // This is a performance optimization to avoid duplicated styles that can\n      // occur especially when composing via subclassing.\n      // The last item is kept to try to preserve the cascade order with the\n      // assumption that it's most important that last added styles override\n      // previous styles.\n      const addStyles = (styles: CSSResultArray, set: Set<CSSResultOrNative>):\n          Set<CSSResultOrNative> => styles.reduceRight(\n              (set: Set<CSSResultOrNative>, s) =>\n                  // Note: On IE set.add() does not return the set\n              Array.isArray(s) ? addStyles(s, set) : (set.add(s), set),\n              set);\n      // Array.from does not work on Set in IE, otherwise return\n      // Array.from(addStyles(userStyles, new Set<CSSResult>())).reverse()\n      const set = addStyles(userStyles, new Set<CSSResultOrNative>());\n      const styles: CSSResultOrNative[] = [];\n      set.forEach((v) => styles.unshift(v));\n      this._styles = styles;\n    } else {\n      this._styles = userStyles === undefined ? [] : [userStyles];\n    }\n\n    // Ensure that there are no invalid CSSStyleSheet instances here. They are\n    // invalid in two conditions.\n    // (1) the sheet is non-constructible (`sheet` of a HTMLStyleElement), but\n    //     this is impossible to check except via .replaceSync or use\n    // (2) the ShadyCSS polyfill is enabled (:. supportsAdoptingStyleSheets is\n    //     false)\n    this._styles = this._styles.map((s) => {\n      if (s instanceof CSSStyleSheet && !supportsAdoptingStyleSheets) {\n        // Flatten the cssText from the passed constructible stylesheet (or\n        // undetectable non-constructible stylesheet). The user might have\n        // expected to update their stylesheets over time, but the alternative\n        // is a crash.\n        const cssText = Array.prototype.slice.call(s.cssRules)\n                            .reduce((css, rule) => css + rule.cssText, '');\n        return unsafeCSS(cssText);\n      }\n      return s;\n    });\n  }\n\n  private _needsShimAdoptedStyleSheets?: boolean;\n\n  /**\n   * Node or ShadowRoot into which element DOM should be rendered. Defaults\n   * to an open shadowRoot.\n   */\n  readonly renderRoot!: Element|DocumentFragment;\n\n  /**\n   * Performs element initialization. By default this calls\n   * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and\n   * captures any pre-set values for registered properties.\n   */\n  protected initialize() {\n    super.initialize();\n    (this.constructor as typeof LitElement)._getUniqueStyles();\n    (this as {\n      renderRoot: Element|DocumentFragment;\n    }).renderRoot = this.createRenderRoot();\n    // Note, if renderRoot is not a shadowRoot, styles would/could apply to the\n    // element's getRootNode(). While this could be done, we're choosing not to\n    // support this now since it would require different logic around de-duping.\n    if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) {\n      this.adoptStyles();\n    }\n  }\n\n  /**\n   * Returns the node into which the element should render and by default\n   * creates and returns an open shadowRoot. Implement to customize where the\n   * element's DOM is rendered. For example, to render into the element's\n   * childNodes, return `this`.\n   * @returns {Element|DocumentFragment} Returns a node into which to render.\n   */\n  protected createRenderRoot(): Element|ShadowRoot {\n    return this.attachShadow(\n        (this.constructor as typeof LitElement).shadowRootOptions);\n  }\n\n  /**\n   * Applies styling to the element shadowRoot using the [[`styles`]]\n   * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where\n   * available and will fallback otherwise. When Shadow DOM is polyfilled,\n   * ShadyCSS scopes styles and adds them to the document. When Shadow DOM\n   * is available but `adoptedStyleSheets` is not, styles are appended to the\n   * end of the `shadowRoot` to [mimic spec\n   * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n   */\n  protected adoptStyles() {\n    const styles = (this.constructor as typeof LitElement)._styles!;\n    if (styles.length === 0) {\n      return;\n    }\n    // There are three separate cases here based on Shadow DOM support.\n    // (1) shadowRoot polyfilled: use ShadyCSS\n    // (2) shadowRoot.adoptedStyleSheets available: use it\n    // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n    // rendering\n    if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n      window.ShadyCSS.ScopingShim!.prepareAdoptedCssText(\n          styles.map((s) => (s as CSSResult).cssText), this.localName);\n    } else if (supportsAdoptingStyleSheets) {\n      (this.renderRoot as ShadowRoot).adoptedStyleSheets =\n          styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet!);\n    } else {\n      // This must be done after rendering so the actual style insertion is done\n      // in `update`.\n      this._needsShimAdoptedStyleSheets = true;\n    }\n  }\n\n  connectedCallback() {\n    super.connectedCallback();\n    // Note, first update/render handles styleElement so we only call this if\n    // connected after first update.\n    if (this.hasUpdated && window.ShadyCSS !== undefined) {\n      window.ShadyCSS.styleElement(this);\n    }\n  }\n\n  /**\n   * Updates the element. This method reflects property values to attributes\n   * and calls `render` to render DOM via lit-html. Setting properties inside\n   * this method will *not* trigger another update.\n   * @param _changedProperties Map of changed properties with old values\n   */\n  protected update(changedProperties: PropertyValues) {\n    // Setting properties in `render` should not trigger an update. Since\n    // updates are allowed after super.update, it's important to call `render`\n    // before that.\n    const templateResult = this.render();\n    super.update(changedProperties);\n    // If render is not implemented by the component, don't call lit-html render\n    if (templateResult !== renderNotImplemented) {\n      (this.constructor as typeof LitElement)\n          .render(\n              templateResult,\n              this.renderRoot,\n              {scopeName: this.localName, eventContext: this});\n    }\n    // When native Shadow DOM is used but adoptedStyles are not supported,\n    // insert styling after rendering to ensure adoptedStyles have highest\n    // priority.\n    if (this._needsShimAdoptedStyleSheets) {\n      this._needsShimAdoptedStyleSheets = false;\n      (this.constructor as typeof LitElement)._styles!.forEach((s) => {\n        const style = document.createElement('style');\n        style.textContent = (s as CSSResult).cssText;\n        this.renderRoot.appendChild(style);\n      });\n    }\n  }\n\n  /**\n   * Invoked on each update to perform rendering tasks. This method may return\n   * any value renderable by lit-html's `NodePart` - typically a\n   * `TemplateResult`. Setting properties inside this method will *not* trigger\n   * the element to update.\n   */\n  protected render(): unknown {\n    return renderNotImplemented;\n  }\n}\n", "/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {AttributePart, directive, Part} from '../lit-html.js';\n\nconst previousValues = new WeakMap<Part, unknown>();\n\n/**\n * For AttributeParts, sets the attribute if the value is defined and removes\n * the attribute if the value is undefined.\n *\n * For other part types, this directive is a no-op.\n */\nexport const ifDefined = directive((value: unknown) => (part: Part) => {\n  const previousValue = previousValues.get(part);\n\n  if (value === undefined && part instanceof AttributePart) {\n    // If the value is undefined, remove the attribute, but only if the value\n    // was previously defined.\n    if (previousValue !== undefined || !previousValues.has(part)) {\n      const name = part.committer.name;\n      part.committer.element.removeAttribute(name);\n    }\n  } else if (value !== previousValue) {\n    part.setValue(value);\n  }\n\n  previousValues.set(part, value);\n});\n", "import { __decorate } from \"tslib\";\nimport { LitElement, css, customElement, html, property } from 'lit-element';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n/**\n * Custom Element that Shows a CodeSandbox demo when you click on it.\n * @element\n * @example\n * ```html\n * <codesandbox-button sandbox-id=\"78bip\" hide-navigation module=\"/src/main-component.js\"></codesandbox-button>\n * ```\n */\nlet CodesandboxButton = class CodesandboxButton extends LitElement {\n    constructor() {\n        super(...arguments);\n        /** font size */\n        this.fontSize = 14;\n        /** when true, hides navigation in the iframe */\n        this.hideNavigation = false;\n        /** when true, shows the CodeSandbox instead of the button */\n        this.showDemo = false;\n        this.theme = 'dark';\n    }\n    static get styles() {\n        return css `\n      :host { display: block; }\n\n      button {\n        background: none;\n        border: none;\n        transition: filter 0.2s ease-in-out;\n      }\n\n      button:hover,\n      button:focus {\n        filter:\n          brightness(1.1)\n          drop-shadow(2px 2px 2px grey);\n      }\n    `;\n    }\n    render() {\n        return this.showDemo ? html `\n      <iframe\n         src=\"${ifDefined(this.getIframeSrc())}\"\n         style=\"width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;\"\n         allow=\"geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb\"\n         sandbox=\"allow-modals allow-forms allow-popups allow-scripts allow-same-origin\"\n       ></iframe>\n    ` : html `\n      <button @click=\"${this.onClick}\">\n        <slot name=\"button\">\n          <img alt=\"Edit on CodeSandbox\" src=\"https://codesandbox.io/static/img/play-codesandbox.svg\" />\n        </slot>\n      </button>\n    `;\n    }\n    getIframeSrc() {\n        var _a;\n        const { hideNavigation, module, theme, view } = this;\n        const fontSize = this.fontSize.toString();\n        const hidenavigation = (hideNavigation ? 1 : 0).toString();\n        const params = new URLSearchParams(Object.entries(Object.assign({ fontSize,\n            hidenavigation,\n            module,\n            theme }, view && { view })));\n        if (!this.sandboxId)\n            return;\n        const id = (_a = this.sandboxId) === null || _a === void 0 ? void 0 : _a.split('-').pop();\n        const url = new URL(`/embed/${id}`, 'https://codesandbox.io/');\n        url.search = params.toString();\n        return url.toString();\n    }\n    onClick() {\n        this.showDemo = true;\n    }\n};\n__decorate([\n    property({ type: Number, attribute: 'font-size' })\n], CodesandboxButton.prototype, \"fontSize\", void 0);\n__decorate([\n    property({ type: Boolean, attribute: 'hide-navigation' })\n], CodesandboxButton.prototype, \"hideNavigation\", void 0);\n__decorate([\n    property({ type: String, attribute: 'sandbox-id' })\n], CodesandboxButton.prototype, \"sandboxId\", void 0);\n__decorate([\n    property({ type: Boolean, attribute: 'show-demo', reflect: true })\n], CodesandboxButton.prototype, \"showDemo\", void 0);\n__decorate([\n    property({ type: String })\n], CodesandboxButton.prototype, \"module\", void 0);\n__decorate([\n    property({ type: String })\n], CodesandboxButton.prototype, \"theme\", void 0);\n__decorate([\n    property({ type: String })\n], CodesandboxButton.prototype, \"view\", void 0);\nCodesandboxButton = __decorate([\n    customElement('codesandbox-button')\n], CodesandboxButton);\nexport { CodesandboxButton };\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAeA,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ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