import{LitElement as t,html as e,css as c}from"lit";import{classMap as i}from"lit/directives/class-map.js";import{unsafeHTML as o}from"lit/directives/unsafe-html.js";import{iconRemixFileTextLine as s}from"./assets/cc-remix.icons.js";import{skeletonStyles as r}from"./styles/skeleton.js";import{ccLink as n,linkStyles as a}from"./templates/cc-link/cc-link.js";import{i18n as l}from"./translation.js";import"./cc-block.js";import"./cc-html-frame.js";import"./cc-icon.js";import"./cc-notice.js";const m={emissionDate:"2020-01-01",number:"????????????",amount:10};class d extends t{static get properties(){return{state:{type:Object}}}constructor(){super(),this.state={type:"loading"}}render(){const t=this.state.number,c=null==t,r=c?m.number:t,a=c||"loading"===this.state.type,d="loaded"!==this.state.type||c?m:this.state,p=`${l("cc-invoice.title")} ${r}`;return e`<cc-block .icon=${s} class=${i({"has-errors":"error"===this.state.type})}><div slot=header-title>${c?e`${l("cc-invoice.title")} <span class=skeleton>${r}</span>`:p}</div>${"error"===this.state.type?e`<cc-notice slot=content intent=warning message=${l("cc-invoice.error")}></cc-notice>`:""} ${"error"!==this.state.type?e`<div slot=header-right>${n(d.downloadUrl,l("cc-invoice.download-pdf"),a)}</div><div slot=content><div class=info><em class=${i({skeleton:a})}>${l("cc-invoice.info",{date:d.emissionDate,amount:d.amount,currency:d.currency})}</em></div><cc-html-frame class=frame ?loading=${a} iframe-title=${p}>${null!=d.invoiceHtml?o(`<template>${d.invoiceHtml}</template>`):""}</cc-html-frame></div>`:""}</cc-block>`}static get styles(){return[a,r,c`:host{display:block}[slot=button]{align-self:start;margin-left:1em}cc-block{--cc-icon-color:var(--cc-color-text-primary)}.has-errors{--cc-skeleton-state:paused}.skeleton{background-color:#bbb}.info{display:flex;justify-content:center;margin-bottom:1em}.frame{box-shadow:0 0 .5em rgb(0 0 0 / 40%);height:31cm;margin-inline:auto;max-width:22cm;width:100%}`]}}window.customElements.define("cc-invoice",d);export{d as CcInvoice};
//# sourceMappingURL=cc-invoice.js.map
