/* empty css       *//* empty css            */import{E as U}from"./fp-el-tag.js?ver=1.3.1";import{_ as j,ad as T,z as c,j as y,a5 as V,o as n,c as r,l as D,b as h,n as G,m as L,a as _,F as $,C as q,d as z,R as C,N as M,G as l,t as d,ab as Q,w as S,a2 as I,a4 as H}from"./admin.js?ver=1.3.1";import{P as J}from"./fp-ProUpgrade.js?ver=1.3.1";import{u as W,F}from"./fp-useFeatures.js?ver=1.3.1";import{d as X}from"./fp-HeaderFilters.js?ver=1.3.1";import{_ as Y}from"./fp-IntegrationListSkeleton.js?ver=1.3.1";import"./fp-_Uint8Array.js?ver=1.3.1";/* empty css           *//* empty css            */import"./fp-el-select.js?ver=1.3.1";import"./fp-index6.js?ver=1.3.1";import"./fp-index7.js?ver=1.3.1";import"./fp-castArray.js?ver=1.3.1";import"./fp-debounce.js?ver=1.3.1";import"./fp-_commonjsHelpers.js?ver=1.3.1";import"./fp-refs.js?ver=1.3.1";import"./fp-el-skeleton-item.js?ver=1.3.1";const Z={class:"fplayer-settings-section fplayer-integrations-settings-section"},K={key:1},ee={key:1,class:"fplayer-integrations-list-container"},te=["onClick"],se={class:"fplayer-integrations-row"},ae={class:"fplayer-integrations-brand"},oe=["src","alt"],ne={key:1,class:"fplayer-integrations-brand-placeholder"},re={class:"fplayer-integrations-info"},le={class:"fplayer-integrations-info-header"},ie={class:"fplayer-integrations-info-title"},ce={class:"fplayer-integrations-info-desc"},ue={key:0,class:"fplayer-no-results"},de={__name:"StorageSettings",setup(fe){const E=T(),i=c("all"),u=c(""),m=c({}),f=c({}),g=c(!1),{isProActive:w,getFeatureConfig:x,getUpgradeUrl:P}=W(),N=y(()=>({...x(F.STORAGE),upgradeUrl:P(F.STORAGE)})),A=[{key:"all",label:"All"},{key:"bunny",label:"BunnyCDN"},{key:"mux",label:"Mux"},{key:"gumlet",label:"Gumlet"},{key:"cloudflare",label:"Cloudflare"}],B=y(()=>Object.keys(f.value)),v=y(()=>{let t=B.value.map(s=>({key:s,...f.value[s]}));if(i.value==="bunny"&&(t=t.filter(s=>["bunnycdn_stream","bunnycdn_storage"].includes(s.key))),i.value==="mux"&&(t=t.filter(s=>s.key==="mux")),i.value==="gumlet"&&(t=t.filter(s=>s.key==="gumlet")),i.value==="cloudflare"&&(t=t.filter(s=>["cloudflare_r2","cloudflare_stream"].includes(s.key))),u.value){const s=u.value.toLowerCase();t=t.filter(a=>a.name.toLowerCase().includes(s)||a.description&&a.description.toLowerCase().includes(s))}return t}),b=(o,t)=>{const s=m.value[o];if(!s)return t==="enabled"?!1:"";const a=s[t];return t==="enabled"?typeof a=="boolean"?a:a==="yes":a},O=async()=>{g.value=!0;try{const[o,t]=await Promise.all([C.get("integrations/fields"),C.get("integrations")]),s={},a={};o&&Object.keys(o).forEach(e=>{s[e]={...o[e],source:"standard",category:"others"}}),t&&Object.keys(t).forEach(e=>{a[e]=t[e],a[e]||(a[e]={enabled:"no"})}),f.value=s,Object.keys(s).forEach(e=>{const p=s[e];if(!a[e]){const R=p.source==="standard";a[e]={enabled:R?"no":!1}}}),m.value=a}catch(o){console.error("Failed to load integrations:",o),M.error("Failed to load integrations")}finally{g.value=!1}},k=o=>{E.push({name:"settings.storage.config",params:{key:o}})};return V(async()=>{await O()}),(o,t)=>{const s=U,a=H;return n(),r("div",Z,[D(w)?(n(),r("div",K,[_(X,{"search-query":u.value,"onUpdate:searchQuery":t[0]||(t[0]=e=>u.value=e),"current-filter":i.value,onFilterChange:t[1]||(t[1]=e=>i.value=e),"status-filters":A},null,8,["search-query","current-filter"]),g.value?(n(),h(Y,{key:0,rows:3})):(n(),r("div",ee,[(n(!0),r($,null,q(v.value,e=>(n(),r("div",{key:e.key,class:"fplayer-integrations-item",onClick:p=>k(e.key)},[l("div",se,[l("div",ae,[e.logo||e.icon?(n(),r("img",{key:0,src:e.logo||e.icon,alt:e.name},null,8,oe)):(n(),r("div",ne,d(e.name?e.name[0]:"?"),1))]),l("div",re,[l("div",le,[l("h4",ie,d(e.name),1)]),l("p",ce,d(e.description),1)]),l("div",{class:"fplayer-integrations-actions",onClick:t[2]||(t[2]=Q(()=>{},["stop"]))},[_(s,{type:b(e.key,"enabled")?"success":"info",size:"small",round:"",effect:"plain"},{default:S(()=>[I(d(b(e.key,"enabled")?"Enabled":"Disabled"),1)]),_:2},1032,["type"]),_(a,{class:"fplayer-secondary-btn",type:"primary",plain:"",onClick:p=>k(e.key),title:"Configure Storage"},{default:S(()=>t[3]||(t[3]=[l("span",null,"Configure",-1)])),_:2},1032,["onClick"])])])],8,te))),128)),v.value.length===0?(n(),r("div",ue," No storage providers found. ")):z("",!0)]))])):(n(),h(J,G(L({key:0},N.value)),null,16))])}}},Oe=j(de,[["__scopeId","data-v-355f8009"]]);export{Oe as default};
