import{p as t}from"./input-popover-dropdown.js?ver=3.1.0";import{r as o,a as e,o as s}from"./vendor.js?ver=3.1.0";import{_ as a}from"./fc-bits-ui.js?ver=3.1.0";const d=a({name:"MergeCodes",components:{popover:t},props:["extra_tags","button_text"],data:()=>({editorShortcodes:[]}),methods:{handleCommand(t){this.copyItem(t)},copyItem(t){this.copy_success=!1;let o=!1;if(window.clipboardData&&window.clipboardData.setData)window.clipboardData.clipboardData.setData("Text",t),o=!0;else if(document.queryCommandSupported&&document.queryCommandSupported("copy")){const s=document.createElement("textarea");s.textContent=t,s.style.position="fixed",document.body.appendChild(s),s.select();try{document.execCommand("copy"),o=!0}catch(e){console.warn("Copy to clipboard failed.",e),o=!1}finally{document.body.removeChild(s)}}o?(this.copy_success=!0,this.$notify({message:this.$t("Smartcode has been copied to your clipboard"),position:"bottom-right",customClass:"bottom_right fc_notify_z",type:"success"})):this.$notify({message:this.$t("Your Browser does not support JS copy. Please copy manually"),position:"bottom-right",customClass:"bottom_right",type:"error"})}},mounted(){this.extra_tags&&this.extra_tags.length&&this.editorShortcodes.push(...this.extra_tags),window.fcAdmin.globalSmartCodes&&this.editorShortcodes.push(...window.fcAdmin.globalSmartCodes),window.fcAdmin.extendedSmartCodes&&this.editorShortcodes.push(...window.fcAdmin.extendedSmartCodes)}},[["render",function(t,a,d,r,n,i){const c=o("popover");return s(),e(c,{doc_url:"https://fluentcrm.com/docs/merge-codes-smart-codes-usage/",style:{display:"inline-block"},btnType:"text",buttonText:d.button_text?d.button_text:"{ }",class:"popover-wrapper",data:n.editorShortcodes,onCommand:i.handleCommand},null,8,["buttonText","data","onCommand"])}]]);export{d as M};