var O=Object.defineProperty,x=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var A=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var S=(e,s,t)=>s in e?O(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,V=(e,s)=>{for(var t in s||(s={}))_.call(s,t)&&S(e,t,s[t]);if(A)for(var t of A(s))j.call(s,t)&&S(e,t,s[t]);return e},$=(e,s)=>x(e,P(s));var T=(e,s,t)=>new Promise((u,f)=>{var w=a=>{try{y(t.next(a))}catch(d){f(d)}},g=a=>{try{y(t.throw(a))}catch(d){f(d)}},y=a=>a.done?u(a.value):Promise.resolve(a.value).then(w,g);y((t=t.apply(e,s)).next())});import{u as i,ap as p,b1 as b,a$ as v,b0 as L,aH as q,N as B,ah as E,bG as G,cu as R,ba as U,V as h,ew as N}from"./main-634.js";import{c as k,r as D}from"./bf-400-72.js";function X(){const e=i(b),s=i(v),t=i(L),u=i(k),f=i(q),w=i(B),g=p(v),y=p(L),a=p(b),d=Object.entries(f),I=()=>`custom_${Date.now()}`;return{resetTheme:(c,l)=>T(this,null,function*(){var m;if(window.confirm("This will reset all styles to the theme defaults. Continue?"))try{const{themeColors:o,themeVars:n,styles:r}=E(c,d,w,u);(m=e.lgLightStyles)!=null&&m.confirmations&&r.lgLightStyles&&(r.lgLightStyles.confirmations=[...e.lgLightStyles.confirmations]),g(o),y(n),a(r),G(R("","","Reset Theme",c,{allThemeColors:o,allThemeVars:n,allStyles:r})),U(),h.success("Theme styles reset successfully!"),l&&l()}catch(o){h.error("Failed to reset theme")}}),updateTheme:(c,l)=>T(this,null,function*(){var o;const m=u[c];if(!m){h.error('Only custom themes can be updated. Use "Save as New Theme" instead.');return}if(window.confirm("This will update the current custom theme with your current style changes. Continue?"))try{const n=N(e),r=$(V({},m),{themeColors:s,themeVars:t,styles:n,font:((o=e.lgLightStyles)==null?void 0:o.font)||{}});yield D.saveTheme(r),h.success("Theme updated successfully!"),l&&l()}catch(n){h.error("Failed to update theme")}}),saveAsNewTheme:(c,l)=>T(this,null,function*(){var o;const m=window.prompt("Enter theme name:",`Custom Theme ${Date.now()}`);if(m)try{const n=N(e),r=I(),C=u[c],F=C?C.basedOn:c,H={id:r,slug:r,name:m,type:"custom",basedOn:F,thumbnail:"",is_default:!1,font:((o=e.lgLightStyles)==null?void 0:o.font)||{},themeColors:s,themeVars:t,styles:n};yield D.saveTheme(H),h.success("New theme created successfully!"),l&&l()}catch(n){h.error("Failed to create theme")}})}}export{X as u};
