import{proxyCustomElement as t,HTMLElement as e,createEvent as i,h as n,transformTag as l}from"@stencil/core/internal/client";import{n as o}from"./index.esm.js";const r=[{trigger:"rich-text",icon:"font_style_formatting",translationKey:"webclient.composer-toolbar.rich-text"},{trigger:"mention",icon:"email_sign_92447",translationKey:"webclient.composer-toolbar.mention",helperLabel:"@"},{trigger:"text-snippet",icon:"rich_text_converter",translationKey:"webclient.composer-toolbar.text-snippet",helperLabel:"!"},{trigger:"internal-link",icon:"hashtag_large",translationKey:"webclient.composer-toolbar.internal-link",helperLabel:"#"}],s=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.triggerInsert=i(this,"triggerInsert",7),this.filesSelected=i(this,"filesSelected",7),this.mentions=!1,this.textSnippets=!1,this.internalLinks=!1,this.richText=!1,this.handleTriggerSelected=t=>{t.stopPropagation(),this.triggerInsert.emit(t.detail.value)},this.handleFilesSelected=t=>{t.stopPropagation(),this.filesSelected.emit(t.detail)}}render(){return[n("div",{key:"6034b2945edfd9b613f606f8bb4fb0db81c1390f",class:"actions"},n("slot",{key:"82b9bc14d80aedd3320af70bc63d3a908db6a7b2",name:"leading"}),this.renderFileInput(),this.renderTriggerActions(),n("slot",{key:"338fc1b7c7ec3f7dfedb123b7e09dd05f75fc45c",name:"trailing"})),n("slot",{key:"57b277b772cbaf702e619ecbd6ff9032718b87b7",name:"primary-action"})]}get translator(){var t;return null===(t=this.platform)||void 0===t?void 0:t.get(o.Translate)}get triggerActions(){const t={mention:this.mentions,"text-snippet":this.textSnippets,"internal-link":this.internalLinks,"rich-text":this.richText};return r.filter((e=>t[e.trigger])).map((t=>{var e,i;return{text:null!==(i=null===(e=this.translator)||void 0===e?void 0:e.get(t.translationKey))&&void 0!==i?i:t.trigger,commandText:t.helperLabel,icon:t.icon,iconOnly:!0,value:t.trigger}}))}renderTriggerActions(){const t=this.triggerActions;if(0!==t.length)return n("limel-action-bar",{actions:t,onItemSelected:this.handleTriggerSelected})}renderFileInput(){var t,e,i,l,o,r;if(this.fileInput)return n("limel-file-input",{accept:null!==(t=this.fileInput.accept)&&void 0!==t?t:"*",multiple:null!==(e=this.fileInput.multiple)&&void 0!==e&&e,disabled:null!==(i=this.fileInput.disabled)&&void 0!==i&&i,onFilesSelected:this.handleFilesSelected},n("limel-icon-button",{icon:"attach",disabled:null!==(l=this.fileInput.disabled)&&void 0!==l&&l,label:null===(o=this.translator)||void 0===o?void 0:o.get("webclient.attach-files"),helperLabel:null===(r=this.translator)||void 0===r?void 0:r.get("webclient.attach-files-helper")}))}static get style(){return"*{box-sizing:border-box;min-width:0}:host(limebb-composer-toolbar){box-sizing:border-box;display:flex;align-items:center;width:100%;max-width:100%;gap:0.5rem}.actions{display:flex;align-items:center;flex-wrap:nowrap;flex-grow:1}limel-icon-button,::slotted(limel-icon-button){display:inline-block;scale:0.86}limel-file-input{flex-shrink:0}"}},[257,"limebb-composer-toolbar",{platform:[16],mentions:[516],textSnippets:[516,"text-snippets"],internalLinks:[516,"internal-links"],richText:[516,"rich-text"],fileInput:[16]}]),a=s,c=function(){"undefined"!=typeof customElements&&["limebb-composer-toolbar"].forEach((t=>{"limebb-composer-toolbar"===t&&(customElements.get(l(t))||customElements.define(l(t),s))}))};export{a as LimebbComposerToolbar,c as defineCustomElement}