/** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */const R=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,L=(s,e,t=null)=>{for(;e!==t;){const n=e.nextSibling;s.removeChild(e),e=n}};/** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */const g=`{{lit-${String(Math.random()).slice(2)}}}`,j=``,B=new RegExp(`${g}|${j}`),N="$lit$";class O{constructor(e,t){this.parts=[],this.element=t;const n=[],i=[],o=document.createTreeWalker(t.content,133,null,!1);let l=0,r=-1,d=0;const{strings:c,values:{length:h}}=e;for(;d0;){const m=c[d],x=k.exec(m)[2],v=x.toLowerCase()+N,w=a.getAttribute(v);a.removeAttribute(v);const f=w.split(B);this.parts.push({type:"attribute",index:r,name:x,strings:f}),d+=f.length-1}}a.tagName==="TEMPLATE"&&(i.push(a),o.currentNode=a.content)}else if(a.nodeType===3){const p=a.data;if(p.indexOf(g)>=0){const E=a.parentNode,y=p.split(B),m=y.length-1;for(let x=0;x{const t=s.length-e.length;return t>=0&&s.slice(t)===e},q=s=>s.index!==-1,_=()=>document.createComment(""),k=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;/** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */const M=133;function D(s,e){const{element:{content:t},parts:n}=s,i=document.createTreeWalker(t,M,null,!1);let o=T(n),l=n[o],r=-1,d=0;const c=[];let h=null;for(;i.nextNode();){r++;const a=i.currentNode;for(a.previousSibling===h&&(h=null),e.has(a)&&(c.push(a),h===null&&(h=a)),h!==null&&d++;l!==void 0&&l.index===r;)l.index=h!==null?-1:l.index-d,o=T(n,o),l=n[o]}c.forEach(a=>a.parentNode.removeChild(a))}const X=s=>{let e=s.nodeType===11?0:1;const t=document.createTreeWalker(s,M,null,!1);for(;t.nextNode();)e++;return e},T=(s,e=-1)=>{for(let t=e+1;t0){for(;l!==-1;)i[l].index+=r,l=T(i,l);return}l=T(i,l)}}/** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */const K=new WeakMap,me=s=>(...e)=>{const t=s(...e);return K.set(t,!0),t},b=s=>typeof s=="function"&&K.has(s);/** * @license * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */const u={},$={};/** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */class P{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this.options=n}update(e){let t=0;for(const n of this.__parts)n!==void 0&&n.setValue(e[t]),t++;for(const n of this.__parts)n!==void 0&&n.commit()}_clone(){const e=R?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],n=this.template.parts,i=document.createTreeWalker(e,133,null,!1);let o=0,l=0,r,d=i.nextNode();for(;os}),ee=` ${g} `;class Y{constructor(e,t,n,i){this.strings=e,this.values=t,this.type=n,this.processor=i}getHTML(){const e=this.strings.length-1;let t="",n=!1;for(let i=0;i-1||n)&&o.indexOf("-->",l+1)===-1;const r=k.exec(o);r===null?t+=o+(n?ee:j):t+=o.substr(0,r.index)+r[1]+r[2]+N+r[3]+g}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return H!==void 0&&(t=H.createHTML(t)),e.innerHTML=t,e}}/** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */const F=s=>s===null||!(typeof s=="object"||typeof s=="function"),I=s=>Array.isArray(s)||!!(s&&s[Symbol.iterator]);class z{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let i=0;i{try{const s={get capture(){return J=!0,!1}};window.addEventListener("test",s,s),window.removeEventListener("test",s,s)}catch{}})();class ie{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=i=>this.handleEvent(i)}setValue(e){this.__pendingValue=e}commit(){for(;b(this.__pendingValue);){const o=this.__pendingValue;this.__pendingValue=u,o(this)}if(this.__pendingValue===u)return;const e=this.__pendingValue,t=this.value,n=e==null||t!=null&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),i=e!=null&&(t==null||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=oe(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=u}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const oe=s=>s&&(J?{capture:s.capture,passive:s.passive,once:s.once}:s.capture);/** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */function re(s){let e=C.get(s.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},C.set(s.type,e));let t=e.stringsArray.get(s.strings);if(t!==void 0)return t;const n=s.strings.join(g);return t=e.keyString.get(n),t===void 0&&(t=new O(s,s.getTemplateElement()),e.keyString.set(n,t)),e.stringsArray.set(s.strings,t),t}const C=new Map;/** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */const S=new WeakMap,le=(s,e,t)=>{let n=S.get(e);n===void 0&&(L(e,e.firstChild),S.set(e,n=new V(Object.assign({templateFactory:re},t))),n.appendInto(e)),n.setValue(s),n.commit()};/** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */class ae{handleAttributeExpressions(e,t,n,i){const o=t[0];return o==="."?new ne(e,t.slice(1),n).parts:o==="@"?[new ie(e,t.slice(1),i.eventContext)]:o==="?"?[new te(e,t.slice(1),n)]:new z(e,t,n).parts}handleTextExpression(e){return new V(e)}}const de=new ae;/** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const fe=(s,...e)=>new Y(s,e,"html",de);/** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */const Q=(s,e)=>`${s}--${e}`;let A=!0;typeof window.ShadyCSS>"u"?A=!1:typeof window.ShadyCSS.prepareTemplateDom>"u"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),A=!1);const ce=s=>e=>{const t=Q(e.type,s);let n=C.get(t);n===void 0&&(n={stringsArray:new WeakMap,keyString:new Map},C.set(t,n));let i=n.stringsArray.get(e.strings);if(i!==void 0)return i;const o=e.strings.join(g);if(i=n.keyString.get(o),i===void 0){const l=e.getTemplateElement();A&&window.ShadyCSS.prepareTemplateDom(l,s),i=new O(e,l),n.keyString.set(o,i)}return n.stringsArray.set(e.strings,i),i},he=["html","svg"],ue=s=>{he.forEach(e=>{const t=C.get(Q(e,s));t!==void 0&&t.keyString.forEach(n=>{const{element:{content:i}}=n,o=new Set;Array.from(i.querySelectorAll("style")).forEach(l=>{o.add(l)}),D(n,o)})})},U=new Set,pe=(s,e,t)=>{U.add(s);const n=t?t.element:document.createElement("template"),i=e.querySelectorAll("style"),{length:o}=i;if(o===0){window.ShadyCSS.prepareTemplateStyles(n,s);return}const l=document.createElement("style");for(let c=0;c{if(!t||typeof t!="object"||!t.scopeName)throw new Error("The `scopeName` option is required.");const n=t.scopeName,i=S.has(e),o=A&&e.nodeType===11&&!!e.host,l=o&&!U.has(n),r=l?document.createDocumentFragment():e;if(le(s,r,Object.assign({templateFactory:ce(n)},t)),l){const d=S.get(r);S.delete(r);const c=d.value instanceof P?d.value.template:void 0;pe(n,r,c),L(e,e.firstChild),e.appendChild(r),S.set(e,d)}!i&&o&&window.ShadyCSS.styleElement(e.host)};export{G as A,se as P,me as d,fe as h,ge as r};