/* empty css       *//* empty css            */import"./fp-el-form-item.js?ver=1.3.1";import{b as v,a as g}from"./fp-el-radio-group.js?ver=1.3.1";import{z as w,ag as y,o as E,c as b,G as m,a,w as r,R as V,N as u,a4 as R,a2 as p}from"./admin.js?ver=1.3.1";import{a as B}from"./fp-index8.js?ver=1.3.1";import"./fp-castArray.js?ver=1.3.1";import"./fp-_Uint8Array.js?ver=1.3.1";import"./fp-_initCloneObject.js?ver=1.3.1";const N={class:"fplayer-settings-section fplayer-email-capture-settings-page"},P={class:"settings-section fplayer-export-control"},S={class:"export-format-options",dir:"ltr"},O={__name:"ExportSettings",setup(U){const n=w("csv"),d=y({settings:!1,export:!1}),c=()=>{var l,i;const e=window.fluentFrameworkAdmin||{},t=(((l=e.rest)==null?void 0:l.url)||"").replace(/\/+$/,""),s=((i=e.rest)==null?void 0:i.nonce)||"";if(!t||!s)throw new Error("Export URL is unavailable");const o=new URL(`${t}/email-providers/export-emails`);return o.searchParams.set("format",n.value),o.searchParams.set("download","1"),o.searchParams.set("_wpnonce",s),o.searchParams.set("query_timestamp",Date.now()),o.toString()},f=e=>{const t=document.createElement("iframe");t.style.display="none",t.src=e,document.body.appendChild(t),window.setTimeout(()=>{t.remove()},6e4)},_=async()=>{d.export=!0;try{const e=await V.get("email-providers/export-emails",{format:n.value});if(e){const t=e.data||e;f(c()),u.success(`Email export started for ${t.count} submission${t.count===1?"":"s"}`)}}catch(e){console.error("Export error:",e),u.error(e.message||"Failed to export email list")}finally{d.export=!1}};return(e,t)=>{const s=v,o=g,l=B,i=R;return E(),b("div",N,[m("div",P,[t[5]||(t[5]=m("h3",null,"Email Export",-1)),t[6]||(t[6]=m("p",null,"All email submissions are stored in your WordPress database and can be exported anytime.",-1)),a(l,null,{default:r(()=>[m("div",S,[a(o,{modelValue:n.value,"onUpdate:modelValue":t[0]||(t[0]=x=>n.value=x),size:"small"},{default:r(()=>[a(s,{value:"csv"},{default:r(()=>t[1]||(t[1]=[p("CSV")])),_:1}),a(s,{value:"json"},{default:r(()=>t[2]||(t[2]=[p("JSON")])),_:1}),a(s,{value:"ods"},{default:r(()=>t[3]||(t[3]=[p("ODS")])),_:1})]),_:1},8,["modelValue"])])]),_:1}),a(i,{class:"fplayer-secondary-btn",onClick:_,loading:d.export},{default:r(()=>t[4]||(t[4]=[p(" Export Email List ")])),_:1},8,["loading"])])])}}};export{O as default};
