import{proxyCustomElement as e,HTMLElement as t,getElement as o,h as r,transformTag as i}from"@stencil/core/internal/client";import{f as n}from"./dom.js";import{b as s}from"./index.esm.js";const a=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}connectedCallback(){const e=n(o(this),this.hasPlatform);e&&this.loadLimeObject(e.platform)}hasPlatform(e){return"platform"in e&&!!e.platform&&"object"==typeof e.platform}async loadLimeObject(e){const t=e.get(s.LimeObjectRepository);if(this.limeobject=t.getObject(this.limetype,this.objectid),!this.limeobject){try{await t.loadObject(this.limetype,this.objectid)}catch(e){console.error("Could not load mentioned object")}this.limeobject=t.getObject(this.limetype,this.objectid)}}render(){return this.limeobject?this.renderLimeObject(this.limeobject):this.renderSlot()}renderLimeObject(e){return r("a",{href:`object/${this.limetype}/${this.objectid}`},e.descriptive,this.renderSlot({hidden:!0}))}renderSlot(e={}){return r("span",Object.assign({},e),r("slot",null))}static get style(){return':host(limebb-mention){display:inline}a{transition:background-color 0.2s ease;white-space:normal;overflow-wrap:break-word;word-break:break-word;padding:0 0.125rem;border-radius:0.25rem;text-decoration:none;color:rgb(var(--color-blue-default));background-color:rgb(var(--color-blue-default), 0.06)}a:hover{background-color:rgb(var(--color-blue-default), 0.16)}a:before,span:before{content:"@";opacity:0.7}'}},[257,"limebb-mention",{limetype:[1],objectid:[2],limeobject:[32]}]),c=a,l=function(){"undefined"!=typeof customElements&&["limebb-mention"].forEach((e=>{"limebb-mention"===e&&(customElements.get(i(e))||customElements.define(i(e),a))}))};export{c as LimebbMention,l as defineCustomElement}