import{d as A,ar as T,A as r,bn as a,bo as s,bp as c,h as b,a9 as t,bq as y,bu as p,a4 as g,bs as i,br as L,bw as N}from"../../../../common/preload-helper.BAt0wiQU.js";import{g as V,p as q,t as H}from"../../index.DetZ7Cvo.js";/* empty css                                                                                      */import"../../../../common/DnDDataTableControl.vue_vue_type_style_index_0_scoped_0b913e4f_lang.CI1SyTf2.js";/* empty css                                                                                                 */import{_ as M}from"../../../../common/LabelControl.vue_vue_type_script_setup_true_lang.8NM1WLzi.js";/* empty css                                                                                        */import{B as v}from"../../../../common/index.BQlS3R_s.js";import{A as $}from"../../../../common/index.D7cceZEv.js";import"../../../../common/index.Bkgl5HZD.js";import"../../../../common/motion.DDNFslEg.js";import"../../../../common/index.2Llx5d_f.js";import"../../../../common/useState.9-uUdCQD.js";import"../../../../common/warning.Dss1f44C.js";import"../../../../common/compact-item.CKdY6bQm.js";import"../../../../common/createContext.DKLY0CB7.js";import"../../../../common/useMergedState.BxRmC9rL.js";import"../../../../common/KeyCode.D63Tfrq7.js";import"../../../../common/ActionButton.8y06aWcB.js";const R={key:0,class:"wwp-row-handle"},j={class:"wwp-left-content"},z={class:"wwp-right-content"},D=["innerHTML"],E={key:1,class:"wwp-button-control"},I=["id","href","target"],O=["id","type"],it=A({__name:"ButtonControl",props:{params:{type:Object,required:!0}},setup(w){const k=w,{params:h}=T(k),e=h.value,m=r(!!e.link),B=r(e.external?"_blank":"_self"),l=r(!0),n=r(!1);(e.action==="submit"||e.action==="button")&&(l.value=!1),m.value&&(l.value=!1);const x=V("confirmText",wp.i18n.__("Are you sure want to clear the cache?","woocommerce-wholesale-prices")),u=d=>{n.value=!0;try{H({action:d}),setTimeout(()=>{n.value=!1},1e3)}catch(o){console.error(o)}};return(d,o)=>{var f,_;return l.value?(a(),s("div",R,[c("div",j,[b(t(M),{params:t(e)},null,8,["params"])]),c("div",z,[t(e).confirmation?(a(),y(t($),{key:0,title:t(x),onConfirm:o[0]||(o[0]=C=>u(t(e).action))},{default:p(()=>[b(t(v),{class:"wpp-action-btn",type:"primary",loading:n.value},{default:p(()=>[g(i(t(e).button_label),1)]),_:1},8,["loading"])]),_:1},8,["title"])):(a(),y(t(v),{key:1,class:"wpp-action-btn",type:"primary",loading:n.value,onClick:o[1]||(o[1]=C=>u(t(e).action))},{default:p(()=>[g(i(t(e).button_label),1)]),_:1},8,["loading"])),t(e).description!=="undefined"?(a(),s("p",{key:2,innerHTML:t(q)((_=(f=t(e))==null?void 0:f.description)!=null?_:"")},null,8,D)):L("",!0)])])):(a(),s("div",E,[c("div",{class:N(t(e).classes)},[m.value?(a(),s("a",{key:0,id:t(e).id,href:t(e).link,target:B.value},i(t(e).button_label),9,I)):(a(),s("button",{key:1,id:t(e).id,type:t(e).action},i(t(e).button_label),9,O))],2)]))}}});export{it as default};
