import"../../@polymer/polymer/lib/elements/dom-module.js";import{CSSResult as e}from"../../lit-element/index.js";export{css,unsafeCSS}from"../../lit-element/index.js";let t=0;const n={};export const registerStyles=(o,s,l)=>{const m=l&&l.moduleId||"custom-style-module-"+t++;Array.isArray(s)||(s=s?[s]:[]),s.forEach((o=>{if(!(o instanceof e))throw new Error("An item in styles is not of type CSSResult. Use `unsafeCSS` or `css`.");if(!n[o]){const e=document.createElement("dom-module");e.innerHTML=`\n        <template>\n          <style>${o.toString()}</style>\n        </template>\n      `;const s="custom-style-module-"+t++;e.register(s),n[o]=s}}));const r=document.createElement("dom-module");if(o){const e=window.customElements&&window.customElements.get(o);e&&e.hasOwnProperty("__finalized")&&console.warn(`The custom element definition for "${o}"\n      was finalized before a style module was registered.\n      Make sure to add component specific style modules before\n      importing the corresponding custom element.`),r.setAttribute("theme-for",o)}const i=l&&l.include||[];r.innerHTML=`\n    <template>\n      ${i.map((e=>`<style include=${e}></style>`))}\n      ${s.map((e=>`<style include=${n[e]}></style>`))}\n    </template>\n  `,r.register(m)};