import{LitElement as t,html as e,css as c}from"lit";import{linkStyles as i}from"./templates/cc-link/cc-link.js";import{i18n as r}from"./translation.js";import"./cc-badge.js";import"./cc-block.js";import"./cc-notice.js";import"./cc-tcp-redirection.js";const o=[{type:"loading"},{type:"loading"}];class n extends t{static get properties(){return{context:{type:String},state:{type:Object}}}constructor(){super(),this.context="user",this.state={type:"loading"}}render(){const t="admin"===this.context?"close":"off";return e`<cc-block state=${t}><div slot=title>${r("cc-tcp-redirection-form.title")} ${this._renderRedirectionCountBadge()}</div>${"user"===this.context?e`<div class=description>${r("cc-tcp-redirection-form.description")}</div>`:""} ${"error"===this.state.type?e`<cc-notice intent=warning message=${r("cc-tcp-redirection-form.error")}></cc-notice>`:""} ${"loading"===this.state.type?e`${o.map((t=>e`<cc-tcp-redirection .state=${t}></cc-tcp-redirection>`))}`:""} ${"loaded"===this.state.type?e`${this.state.redirections.map((t=>e`<cc-tcp-redirection .state=${t}></cc-tcp-redirection>`))} ${0===this.state.redirections.length?e`<div class=cc-block_empty-msg>${r("cc-tcp-redirection-form.empty")}</div>`:""}`:""}</cc-block>`}_renderRedirectionCountBadge(){if("admin"===this.context&&"loaded"===this.state.type){const t=this.state.redirections.filter((({sourcePort:t})=>null!=t)).length;if(t>=1)return e`<cc-badge circle weight=strong>${t}</cc-badge>`}return""}static get styles(){return[i,c`:host{display:block}cc-badge{font-size:.8em;margin-left:.5em;vertical-align:middle}.description{line-height:1.6}.description p{margin:0 0 1em}.description code{background-color:var(--cc-color-bg-neutral);border-radius:var(--cc-border-radius-default,.25em);font-family:var(--cc-ff-monospace);padding:.15em .3em}`]}}window.customElements.define("cc-tcp-redirection-form",n);export{n as CcTcpRedirectionForm};
//# sourceMappingURL=cc-tcp-redirection-form.js.map
