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