import{r as s,e as O,f as P}from"./companyConfig-cIpizedw.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const t of e)if(t.type==="childList")for(const a of t.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?t.credentials="include":e.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function i(e){if(e.ep)return;e.ep=!0;const t=n(e);fetch(e.href,t)}})();function M(l,o){const[n,i]=s.useState([]),[e,t]=s.useState(null),[a,w]=s.useState({theme:"light",emailNotifications:!1,compactView:!1}),[I,p]=s.useState(!1),[h,y]=s.useState(!1),[L,g]=s.useState(null),[b,c]=s.useState(null),f=s.useCallback(async()=>{if(l)try{p(!0),g(null),c(null);const r=await O(o);t(r.configId),i(r.whitelistItems),w(r.generalSettings)}catch{g("Failed to load whitelist configuration")}finally{p(!1)}},[l,o]);s.useEffect(()=>{l?f():(t(null),i([]),g(null),c(null))},[l,f]);const m=s.useCallback(async(r,u)=>{if(!l){c("Please log in to save");return}try{y(!0),c(null),await P(o,u,r,a),c("Saved successfully"),await f()}catch{c("Failed to save")}finally{y(!1)}},[l,o,a,f]),x=s.useCallback((r,u)=>{const d=u.trim();if(!d||n.some(C=>C.type===r&&C.url.trim().toLowerCase()===d.toLowerCase()))return;const S=[...n,{type:r,url:d}];i(S),m(S,e)},[n,e,m]),E=s.useCallback(r=>{const u=n.filter((d,v)=>v!==r);i(u),m(u,e)},[n,e,m]);return{whitelistItems:n,configId:e,generalSettings:a,loading:I,saving:h,error:L,saveMessage:b,addEntry:x,removeEntry:E,reload:f,setSaveMessage:c}}const W="1.1.40";export{M as u,W as v};
