import{e,aN as a,k as t,aO as s}from"./vendor-element-plus.js?ver=3.1.8";import{W as o,Y as r,a5 as l,Z as d,X as i,J as n,az as c,a0 as p,aa as u,a8 as h,ab as _,a6 as m,a9 as v,ac as f,aT as y,aU as b}from"./vendor.js?ver=3.1.8";import{_ as k}from"./fc-bits-ui.js?ver=3.1.8";const S={name:"inputPopoverDropdownExtended",emits:["command"],props:{data:{type:Array,default:()=>[]},close_on_insert:{type:Boolean,default:()=>!0},buttonText:{type:String,default:()=>"Add SmartCodes"},btnType:{type:String,default:()=>"success"},doc_url:{type:String,default:()=>""}},data:()=>({activeIndex:0,visible:!1,searchQuery:""}),methods:{selectEmoji(e){this.insertShortcode(e.data)},insertShortcode(e){this.$emit("command",e),this.close_on_insert&&(this.visible=!1)},filteredShortcodes(e={}){if(!this.searchQuery)return e||{};const a=this.searchQuery.toLowerCase(),t={};return Object.entries(e||{}).forEach(([e,s])=>{(e.toLowerCase().includes(a)||s.toLowerCase().includes(a))&&(t[e]=s)}),t}},mounted(){}},x={class:"el_pop_data_group"},g={class:"el_pop_data_headings"},C=["data-item_index","onClick"],L={key:0,class:"pop_doc"},T=["href"],w={class:"el_pop_data_body"},$={class:"el_pop_search"},j=["onClick"];const Q=k(S,[["render",function(k,S,Q,I,M,E){const U=e,V=t,z=a,A=s;return o(),r(A,{placement:"right-end",offset:50,"popper-class":"fcrm-smartcodes-popover el-dropdown-list-wrapper",visible:M.visible,"onUpdate:visible":S[1]||(S[1]=e=>M.visible=e),trigger:"click"},{reference:l(()=>[d("div",y(b(k.$attrs)),[_(z,null,{default:l(()=>[_(V,{class:"editor-add-shortcode",size:"small",type:Q.btnType,innerHTML:Q.buttonText},null,8,["type","innerHTML"])],void 0,!0),_:1})],16)]),default:l(()=>[d("div",x,[d("div",g,[d("ul",null,[(o(!0),i(n,null,c(Q.data,(e,a)=>(o(),i("li",{"data-item_index":a,key:a,class:p(M.activeIndex==a?"active_item_selected":""),onClick:e=>M.activeIndex=a},u(e.title),11,C))),128))]),Q.doc_url?(o(),i("div",L,[d("a",{href:Q.doc_url,target:"_blank",rel:"noopener"},u(k.$t?k.$t("Learn More"):"Learn More"),9,T)])):h("",!0)]),d("div",w,[d("div",$,[_(U,{modelValue:M.searchQuery,"onUpdate:modelValue":S[0]||(S[0]=e=>M.searchQuery=e),placeholder:k.$t?k.$t("Search shortcodes..."):"Search shortcodes...",clearable:""},null,8,["modelValue","placeholder"])]),(o(!0),i(n,null,c(Q.data,(e,a)=>(o(),i("div",{key:a},[m(d("ul",{class:p("el_pop_body_item_"+a)},[(o(!0),i(n,null,c(E.filteredShortcodes(e.shortcodes),(e,a)=>(o(),i("li",{onClick:e=>E.insertShortcode(a),key:a},[v(u(e),1),d("span",null,u(a),1)],8,j))),128))],2),[[f,M.activeIndex==a]])]))),128))])])],void 0),_:1},8,["visible"])}]]);export{Q as p};
