"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 r=e.map(s=>s.replace(/\*/g,"\\*")),i=new RegExp(`(${r.join("|")})`,"g");return t.split(i).filter(s=>s.trim()!=="").map(s=>e.includes(s)?n.h(a.default,{code:s,size:this.size}):n.h("span",{class:"d-emoji-text-wrapper__text"},s))},searchVNodes(e){var r;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((r=e.props)!=null&&r.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(e){},searchCodes(e){const t=o.findShortCodes(e),r=o.findEmojis(e),i=[...t,...r];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
