import{B as e,I as t,Kt as r,Mt as s,R as n,Y as a,_t as o,ct as i,j as c,jt as u,lt as f,nt as d,t as p,ut as g,zt as l}from"./flowdrop-client.js?v=2.0.0-beta.7";import{C as h,S as w,_ as m,_n as v,b as y,bt as b,c as E,d as P,dn as S,f as j,fn as k,g as T,gn as $,h as C,hn as L,l as _,m as A,mn as x,p as z,pn as D,s as F,u as H,un as J,vn as K,w as N,x as O,y as q,yn as B}from"./flowdrop.es.js?v=2.0.0-beta.7";import"./flowdrop-disclose-version.js?v=2.0.0-beta.7";import{v as G}from"./flowdrop-get-instance.svelte.js?v=2.0.0-beta.7";import{n as I,r as M,t as R}from"./flowdrop-settings-modal.js?v=2.0.0-beta.7";import{t as U}from"./flowdrop-fetch-with-auth.js?v=2.0.0-beta.7";var Y=e('<span class="flowdrop-theme-toggle__label svelte-cqdwrg"> </span>'),Q=e("<!> <!>",1);function V(e,r){s(r,!0);const h=p(r,"size",3,"md"),w=p(r,"showLabel",3,!1),m=p(r,"class",3,""),v=o(()=>function(e){switch(e){case"light":return"mdi:white-balance-sunny";case"dark":return"mdi:moon-waning-crescent";case"auto":return"mdi:desktop-mac"}}(A()));const y=o(()=>function(e){switch(e){case"light":return"Light";case"dark":return"Dark";case"auto":return"Auto"}}(A()));const b=o(()=>{return e=A(),t=P(),"auto"===e?`Theme: Auto (${t}). Click to switch to Light`:`Theme: ${"light"===e?"Light":"Dark"}. Click to switch to ${"light"===e?"Dark":"Auto"}`;var e,t});M(e,{variant:"outline",get size(){return h()},get class(){return m()},get title(){return a(b)},get ariaLabel(){return a(b)},get onclick(){return F},children:(e,r)=>{var s=Q(),o=f(s);G(o,{get icon(){return a(v)}});var u=g(o,2),p=e=>{var r=Y(),s=i(r,!0);l(r),d(()=>t(s,a(y))),n(e,r)};c(u,e=>{w()&&e(p)}),n(e,s)},$$slots:{default:!0}}),u()}var W,X=null;function Z(e,t){X=e,W=t}function ee(){return X}async function te(e,t,r={}){if(!X)throw new Error("Endpoint configuration not set. Call setSettingsEndpointConfig() first.");const s=await U(b(X,t),r,{config:X,endpointKey:e,authProvider:W}),n=s.headers.get("content-type")?.includes("application/json");if(!s.ok){let e=`HTTP ${s.status}: ${s.statusText}`;if(n)try{const t=await s.json();e=t.error??t.message??e}catch{}throw new Error(e)}return await s.json()}var re={async getPreferences(){if(!X)throw new Error("Endpoint configuration not set");const e=await te("users.preferences",X.endpoints.users.preferences,{method:"GET"});if(!e.success||!e.data)throw new Error("string"==typeof e.error?e.error:"Failed to fetch user preferences");return e.data},async savePreferences(e){if(!X)throw new Error("Endpoint configuration not set");const t=await te("users.preferences",X.endpoints.users.preferences,{method:"PUT",body:JSON.stringify(e)});if(!t.success)throw new Error("string"==typeof t.error?t.error:"Failed to save user preferences")},async patchPreferences(e){if(!X)throw new Error("Endpoint configuration not set");const t=await te("users.preferences",X.endpoints.users.preferences,{method:"PATCH",body:JSON.stringify(e)});if(!t.success||!t.data)throw new Error("string"==typeof t.error?t.error:"Failed to update user preferences");return t.data}},se=class{constructor(e,t){r(this,"config",void 0),this.config=e,Z(e,t)}async getPreferences(){return re.getPreferences()}async savePreferences(e){return re.savePreferences(e)}async patchPreferences(e){return re.patchPreferences(e)}};function ne(e,t){return new se(e,t)}export{J as DEFAULT_API_SETTINGS,S as DEFAULT_BEHAVIOR_SETTINGS,k as DEFAULT_EDITOR_SETTINGS,D as DEFAULT_SETTINGS,x as DEFAULT_THEME_SETTINGS,L as DEFAULT_UI_SETTINGS,$ as SETTINGS_CATEGORIES,v as SETTINGS_CATEGORY_ICONS,K as SETTINGS_CATEGORY_LABELS,B as SETTINGS_STORAGE_KEY,R as SettingsModal,I as SettingsPanel,se as SettingsService,V as ThemeToggle,E as apiSettings,_ as behaviorSettings,ne as createSettingsService,H as editorSettings,j as getSettings,j as settingsStore,ee as getSettingsEndpointConfig,m as initializeSettings,q as loadSettingsFromApi,y as onSettingsChange,O as resetSettings,Z as setSettingsEndpointConfig,w as setSettingsService,re as settingsApi,h as syncSettingsToApi,z as syncStatusStore,C as themeSettings,T as uiSettings,N as updateSettings};
//# sourceMappingURL=flowdrop-settings.js.map