1import{j as e}from"./vendor-motion-tKoiFVkZ.js";import{r as t}from"./vendor-react-HEXrdo_B.js";import{c as Y,aF as $,aG as q,aH as D,aI as X,aJ as K,aK as Q,S as U,k as j,x as J,y as W,z as L,E as G,F,aL as Z,B as V,aM as ee,aN as se,aO as te,aP as ae,aQ as oe,aR as ne,u as ie,I as re,_ as ce,J as de,K as le,$ as ue,t as me,a8 as pe,N as he,a0 as xe,a2 as I,a3 as A,aS as be,s as f,aT as fe,aU as _,aV as ye,Q as ge,D as we}from"./index-Dpwv89nd.js";import{D as Ne,b as je,c as Ie,d as Se,e as ve}from"./dialog-C9RkfHKp.js";import{S as P}from"./switch-MSaFbTc6.js";import{R as Ce}from"./refresh-cw-HAGZEKgl.js";import{R as Oe}from"./rss-do1dEC0T.js";import"./vendor-supabase-DjFJ1Hm9.js";import"./vendor-charts-fCKPP8xB.js";import"./vendor-query-rJou0y_H.js";import"./index-Bxu8zmn5.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Ae=Y("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),Ee=[{code:"IL",label:"Israel (Israeli / Jewish)"},{code:"SA",label:"Saudi Arabia (Muslim)"},{code:"AE",label:"United Arab Emirates (Muslim)"},{code:"US",label:"United States (Western / Christian)"},{code:"GB",label:"United Kingdom (Western / Christian)"},{code:"FR",label:"France (Western / Christian)"},{code:"GR",label:"Greece (Orthodox Christian)"},{code:"JP",label:"Japan (Global fallback)"}],ke=({open:y,onOpenChange:E})=>{var n,a;const[x,S]=t.useState(()=>$()),[B,k]=t.useState(()=>q()),[T,z]=t.useState(((n=D[0])==null?void 0:n.id)??""),[d,H]=t.useState(()=>X()),[v,C]=t.useState(()=>K()),o=d?Q(v):"global",m=s=>{S(s),se(s)},R=s=>{k(s),te(s)},g=s=>{H(s),ae(s)},M=s=>
6{const i=s==="auto"?"":s;C(i),oe(i)},O=()=>{const s=D.find(i=>i.id===T);s&&(E(!1),window.setTimeout(()=>ne(s.animation,s.durationMs,s.greeting),260))};return e.jsx(Ne,{open:y,onOpenChange:E,children:e.jsxs(je,{className:"sm:max-w-md",children:[e.jsxs(Ie,{children:[e.jsxs(Se,{className:"flex items-center gap-2",children:[e.jsx(U,{className:"h-4 w-4 text-primary"}),"Holiday Celebrations"]}),e.jsx(ve,{children:"Short celebration animations play automatically on supported holidays. Admin only."})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/30 px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(j,{htmlFor:"holiday-master",className:"text-sm font-medium",children:"Holiday Celebrations"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:x?"ON - automatic celebrations active":"OFF - no automatic celebrations"})]}),e.jsx(P,{id:"holiday-master",checked:x,onCheckedChange:m})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-muted/30 px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(j,{htmlFor:"holiday-geo",className:"text-sm font-medium",children:"Automatic Country-Based Personalization"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Picks holidays relevant to the visitor's country. Global holidays always stay available. Does not affect Test Animation."})]}),e.jsx(P,{id:"holiday-geo",checked:d,onCheckedChange:g})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(j,{className:"text-xs font-medium",children:"Simulate country (Development / Testing)"}),e.jsxs(J,{value:v||"auto",onValueChange:M,children:[e.jsx(W,{className:"w-full justify-between text-left",children:e.jsx(L,{})}),e.jsxs(G,{children:[e.jsx(F,{value:"auto",children:"Auto (detect my country)"}),Ee.map(s=>e.jsx(F,{value:s.code,children:s.label},s.code))]})]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground leading-snug",children:["Current profile: ",(a=Z.find(s=>s.id===o))==null?void 0:a.label]})]})]}),e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-lg border border-dashed border-border bg-muted/20 px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(j,{htmlFor:"holiday-play-btn",className:"text-sm font-medium",children:"Show Play Animation button (Development / Testing)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'Forces the homepage "Play Animation" button to appear even when today is not a holiday. Admin-only; does not affect holiday dates or automatic celebrations.'})]}),e.jsx(P,{id:"holiday-play-btn",checked:B,onCheckedChange:R})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{className:"text-sm font-medium",children:"Test Holiday Animation"}),e.jsxs(J,{value:T,onValueChange:z,children:[e.jsx(W,{className:"w-full justify-between text-left",children:e.jsx(L,{placeholder:"Select holiday"})}),e.jsx(G,{className:"max-h-72",children:D.map(s=>e.jsx(F,{value:s.id,children:s.label},s.id))})]}),e.jsxs(V,{onClick:O,className:"w-full gap-2",children:[e.jsx(ee,{className:"h-4 w-4"}),"Test Animation"]}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug",children:"Testing works on any date and does not change the holiday data or create a real event."})]})]})]})})},Te=[{productId:"horizon",productName:"Omnissa Horizon"},{productId:"dem",productName:"Omnissa DEM"},{productId:"app-volumes",productName:"Omnissa App Volumes"},{productId:"horizon-client-windows",productName:"Omnissa Horizon Client for Windows"},{productId:"horizon-client-mac",productName:"Omnissa Horizon Client for Mac"},{productId:"horizon-client-linux",productName:"Omnissa Horizon Client for Linux"},{productId:"unified-access-gateway",productName:"Omnissa Unified Access Gateway"},{productId:"access-saas",productName:"Omnissa Access Cloud"},{productId:"access-on-premises",productName:"Omnissa Access On-Premises"},{productId:"access-connector",productName:"Omnissa Access Connector"},{productId:"workspace-one-assist-horizon",productName:"Workspace ONE Assist for Horizon"},{productId:"workspace-one-assist-windows",productName:"Workspace ONE Assist for Windows"},{productId:"workspace-one-assist-android",productName:"Workspace ONE Assist for Android"},{productId:"workspace-one-assist-macos",productName:"Workspace ONE Assist for macOS"},{productId:"intelligent-hub-windows",productName:"Intelligent Hub for Windows"},{productId:"intelligent-hub-ios",productName:"Intelligent Hub for iOS"},{productId:"intelligent-hub-android",productName:"Intelligent Hub for Android"},{productId:"intelligent-hub-macos",productName:"Intelligent Hub for macOS"},{productId:"hub-services",productName:"Hub Services"},{productId:"boxer-android",productName:"Boxer for Android"},{productId:"boxer-ios",productName:"Boxer for iOS"},{productId:"workspace-one-uem",productName:"Omnissa Workspace ONE UEM"},{productId:"intelligence",productName:"Omnissa Intelligence"},{productId:"horizon-cloud",productName:"Omnissa Horizon Cloud"},{productId:"horizon-edge-gateway",productName:"Horizon Edge Gateway"},{productId:"omnissa-monitor",productName:"Omnissa Monitor"},{productId:"connect",productName:"Omnissa Connect"},{productId:"tunnel-windows",productName:"Omnissa Workspace ONE Tunnel for Windows"},{productId:"tunnel-android",productName:"Omnissa Workspace ONE Tunnel for Android"},{productId:"tunnel-macos",productName:"Omnissa Workspace ONE Tunnel for macOS"},{productId:"tunnel-ios",productName:"Omnissa Workspace ONE Tunnel for iOS"},{productId:"secure-email-gateway",productName:"Omnissa Workspace ONE Secure Email Gateway"}],Le=({onSynced:y,isAdmin:E})=>{const[x,S]=t.useState(!1);t.useState(!1);const[B,k]=t.useState([]),[T,z]=t.useState(0),[d,H]=t.useState(0),[v,C]=t.useState(!1),{toast:o}=ie(),m=typeof window<"u"?window.location.hostname:"",g=typeof window<"u"&&(m==="localhost"||m.endsWith(".lovableproject.com")||m==="lovableproject.com"||m.startsWith("id-preview--")||m.includes("webcontainer"));t.useEffect(()=>{if(!g)return;const n=async()=>{try{const{data:{session:s}}=await f.auth.getSession();if(!s)return;const{data:i}=await f.rpc("has_role",{_user_id:s.user.id,_role:"admin"});if(!i)return;const{data:r,error:l}=await f.from("release_subscriptions").select("product_id").eq("verified",!0);if(l||!r)return;const u=new Map;for(const c of r)u.set(c.product_id,(u.get(c.product_id)??0)+1);const p=Array.from(u,([c,h])=>({product_id:c,count:h}));k(p),z(r.length)}catch(s){console.error("Failed to fetch subscriber counts:",s)}},a=async()=>{try{const{count:s}=await f.from("version_annotations").select("*",{count:"exact",head:!0}).eq("approved",!1);H(s||0)}catch(s){console.error("Failed to fetch pending annotations:",s)}};n(),a()},[g]);const M=async()=>{S(!0);try{const a=(await Promise.all(Te.map(async b=>({...b,versions:await fe(b.productId)})))).map(b=>({productId:b.productId,productName:b.productName,versions:b.ver
6sions.map(w=>({version:w.version,build:w.build,date:w.date,updatedAt:w.updatedAt??null,changes:w.changes.map(N=>({id:N.id,category:N.category,title:N.title,description:N.description,issueId:N.issueId||null}))}))})),s="https://pzklloqgmmuqttbjhjib.supabase.co",i="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InB6a2xsb3FnbW11cXR0YmpoamliIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjIyMzUxMzMsImV4cCI6MjA3NzgxMTEzM30.QUvEFw86i2b9BFHAGlvgq463q6vL3n6p3PwpBLadGr4",{data:{session:r}}=await f.auth.getSession(),l=r!=null&&r.access_token?`Bearer ${r.access_token}`:"",u=await fetch(`${s}/functions/v1/sync-versions`,{method:"POST",headers:{"Content-Type":"application/json",apikey:i,Authorization:l},body:JSON.stringify({products:a,skipNotifications:!1})}),p=await u.json(),c=u.ok?null:{message:p.error||"Sync failed"};if(c){o({title:"Sync failed",description:c.message,variant:"destructive"});return}const h=p;h.newVersions.length>0||h.updatedVersions.length>0?o({title:"Sync complete & notifications sent",description:`${h.newVersions.length} new, ${h.updatedVersions.length} updated. ${h.notificationsSent} notifications sent.`}):o({title:"Sync complete",description:"No new or updated versions found."}),_(ye),_(ge),_(we),y==null||y()}catch{o({title:"Sync failed",description:"An unexpected error occurred",variant:"destructive"})}finally{S(!1)}},O=async n=>{const a=window.prompt(`Enter email address for test ${n==="subscription"?"subscription":"RSS"} notification:`);if(!a||!a.includes("@")){o({title:"Invalid email",description:"Please enter a valid email address",variant:"destructive"});return}try{const s="https://pzklloqgmmuqttbjhjib.supabase.co",i="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InB6a2xsb3FnbW11cXR0YmpoamliIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjIyMzUxMzMsImV4cCI6MjA3NzgxMTEzM30.QUvEFw86i2b9BFHAGlvgq463q6vL3n6p3PwpBLadGr4",r=n==="subscription"?"send-test-email":"send-test-rss-email",{data:{session:l}}=await f.auth.getSession(),u=l!=null&&l.access_token?`Bearer ${l.access_token}`:"",p=await fetch(`${s}/functions/v1/webhook-notifications`,{method:"POST",headers:{"Content-Type":"application/json",apikey:i,Authorization:u},body:JSON.stringify({action:r,email:a})}),c=await p.json();p.ok&&c.success?o({title:`Test ${n==="subscription"?"subscription":"RSS"} email sent!`,description:`A test email was sent to ${a}.`}):o({title:"Test email failed",description:c.error||"Could not send test email",variant:"destructive"})}catch{o({title:"Test failed",description:"Could not send test email",variant:"destructive"})}};return g?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(re,{children:e.jsxs(ce,{children:[e.jsxs(de,{children:[e.jsx(le,{asChild:!0,children:e.jsx(ue,{asChild:!0,children:e.jsxs(V,{variant:"outline",size:"sm",className:"gap-2 bg-white/10 border-white/20 text-white hover:bg-white/20",children:[e.jsx(me,{className:"h-4 w-4"}),"Admin",d>0&&e.jsxs("span",{className:"flex items-center gap-1 text-xs bg-white/20 px-1.5 py-0.5 rounded-full text-yellow-300",children:["â¢",d]}),e.jsx(pe,{className:"h-3 w-3"})]})})}),e.jsx(he,{children:e.jsxs("p",{children:["Admin tools: ",d," pending annotations"]})})]}),e.jsxs(xe,{align:"end",className:"w-64",children:[e.jsxs(I,{disabled:x,onClick:()=>M(),children:[e.jsx(Ce,{className:`h-4 w-4 mr-2 ${x?"animate-spin":""}`}),x?"Syncing data...":"Sync Data to Database Now"]}),e.jsx(A,{}),e.jsxs(I,{onClick:()=>O("subscription"),children:[e.jsx(be,{className:"h-4 w-4 mr-2"}),"Test Subscription Email"]}),e.jsxs(I,{onClick:()=>O("rss"),children:[e.jsx(Oe,{className:"h-4 w-4 mr-2"}),"Test RSS Email"]}),e.jsx(A,{}),e.jsxs(I,{onClick:()=>C(!0),children:[e.jsx(U,{className:"h-4 w-4 mr-2"}),"Holiday Celebrations"]}),d>0&&e.jsxs(e.Fragment,{children:[e.jsx(A,{}),e.jsxs(I,{onClick:()=>window.location.href="/lifecycle?tab=annotations",children:[e.jsx(Ae,{className:"h-4 w-4 mr-2"}),"Review Annotations (",d,")"]})]}),e.jsx(A,{}),e.jsx("div",{className:"px-2 py-1.5 text-[11px] text-muted-foreground leading-snug",children:'Automatic sync runs once per hour. Use "Sync Data to Database Now" to push new products and versions immediately.'})]})]})}),e.jsx(ke,{open:v,onOpenChange:C})]}):null};export{Le as AdminToolbar};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.