"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../../common/emoji/index.cjs"),n=require("vue"),c=require("../icon/icon-constants.cjs"),a=require("../emoji/emoji.cjs"),l=n.h(n.resolveDynamicComponent(null)).type,p={compatConfig:{MODE:3},name:"DtEmojiTextWrapper",components:{DtEmoji:a.default},props:{elementType:{type:String,default:"div"},size:{type:String,default:"500",validator:e=>Object.keys(c.ICON_SIZE_MODIFIERS).includes(e)}},data(){return{loadingEmojiJson:!0}},async created(){this.loadingEmojiJson=!1},methods:{replaceDtEmojis(e,t){if(!e.length)return t;const s=e.map(r=>r.replace(/\*/g,"\\*")),i=new RegExp(`(${s.join("|")})`,"g");return t.split(i).filter(r=>r.trim()!=="").map(r=>e.includes(r)?n.h(a.default,{code:r,size:this.size}):n.h("span",{class:"d-emoji-text-wrapper__text"},r))},searchVNodes(e){var s;if(!e)return;if(typeof e=="string")return this.searchCodes(e);if(e.type===l)return e;if(typeof e.type=="symbol")return this.searchCodes(e.children);if((s=e.props)!=null&&s.innerHTML)return this.searchVNodes(e.props.innerHTML);const t=Array.isArray(e.children)?e.children:[e.children];return n.h(e.type,e.props,t.map(i=>this.searchVNodes(i)))},replaceVueComponentVNodeContent(){},searchCodes(e){const t=o.findShortCodes(e),s=o.findEmojis(e),i=[...t,...s];return i.length===0?e:this.replaceDtEmojis(i,e)}},render(){const e=this.$slots.default?this.$slots.default():[];return n.h(this.elementType,{"data-qa":"emoji-text-wrapper",class:"d-emoji-text-wrapper"},this.loadingEmojiJson?e:e.map(t=>this.searchVNodes(t)))}};exports.default=p;
//# sourceMappingURL=emoji-text-wrapper.cjs.map
