import{LitElement as t,html as e,css as s}from"lit";import{classMap as c}from"lit/directives/class-map.js";import{unsafeHTML as i}from"lit/directives/unsafe-html.js";import{iconRemixFileTextLine as o}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 p extends t{static get properties(){return{state:{type:Object}}}constructor(){super(),this.state={type:"loading"}}render(){const t=this.state.number,s=null==t,r=s?m.number:t,a=s||"loading"===this.state.type,p="loaded"!==this.state.type||s?m:this.state,d=`${l("cc-invoice.title")} ${r}`;return e`<cc-block .icon=${o} class=${c({"has-errors":"error"===this.state.type})}><div slot=title>${s?e`${l("cc-invoice.title")} <span class=skeleton>${r}</span>`:d}</div>${"error"===this.state.type?e`<cc-notice intent=warning message=${l("cc-invoice.error")}></cc-notice>`:""} ${"error"!==this.state.type?e`<div slot=button>${n(p.downloadUrl,l("cc-invoice.download-pdf"),a)}</div><div class=info><em class=${c({skeleton:a})}>${l("cc-invoice.info",{date:p.emissionDate,amount:p.amount})}</em></div><cc-html-frame class=frame ?loading=${a} iframe-title=${d}>${null!=p.invoiceHtml?i(`<template>${p.invoiceHtml}</template>`):""}</cc-html-frame>`:""}</cc-block>`}static get styles(){return[a,r,s`: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}.frame,.info{justify-self:center}.frame{box-shadow:0 0 .5em rgb(0 0 0 / 40%);height:31cm;max-width:22cm;width:100%}`]}}window.customElements.define("cc-invoice",p);export{p as CcInvoice};
//# sourceMappingURL=cc-invoice.js.map
