1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[55816],{25001:function(e,t,a){a.d(t,{E:function(){return y}});var r=a(57437),s=a(2265),o=a(12381),n=a(69174),l=a(90641),c=a(91032),i=a(82431),d=a(15863),u=a(30401),f=a(95805),m=a(99397),p=a(98335),x=a(96362),h=a(71837),g=a(93448),b=a(73608);let w=[{id:"facebook",name:"Facebook",description:"Connect Facebook Pages for posts, messaging and ads",icon:e=>{let{className:t}=e;return(0,r.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})})},color:"#1877F2",bgColor:"bg-blue-50 dark:bg-blue-950/30",borderColor:"border-blue-200 dark:border-blue-800",iconBg:"bg-[#1877F2]",features:["Pages","Posts","Messenger","Ads"],dbPlatform:"facebook"},{id:"instagram",name:"Instagram",description:"Connect Instagram for posts, DMs and comments",icon:e=>{let{className:t}=e;return(0,r.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z"})})},color:"#E4405F",bgColor:"bg-pink-50 dark:bg-pink-950/30",borderColor:"border-pink-200 dark:border-pink-800",iconBg:"bg-gradient-to-br from-[#F58529] via-[#DD2A7B] to-[#8134AF]",features:["Posts","DMs","Comments","Analytics"],dbPlatform:"instagram"},{id:"whatsapp",name:"WhatsApp Business",description:"Connect WhatsApp Business for messaging",icon:e=>{let{className:t}=e;return(0,r.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"})})},color:"#25D366",bgColor:"bg-green-50 dark:bg-green-950/30",borderColor:"border-green-200 dark:border-green-800",iconBg:"bg-[#25D366]",features:["Messaging","Templates","Broadcasts"],dbPlatform:"whatsapp"},{id:"messenger",name:"Messenger",description:"Connect Messenger for customer conversations",icon:e=>{let{className:t}=e;
1return(0,r.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M12 0C5.373 0 0 4.974 0 11.111c0 3.498 1.744 6.614 4.469 8.654V24l4.088-2.242c1.092.3 2.246.464 3.443.464 6.627 0 12-4.974 12-11.111S18.627 0 12 0zm1.191 14.963l-3.055-3.26-5.963 3.26L10.732 8l3.131 3.259L19.752 8l-6.561 6.963z"})})},color:"#0084FF",bgColor:"bg-blue-50 dark:bg-blue-950/30",borderColor:"border-blue-200 dark:border-blue-800",iconBg:"bg-[#0084FF]",features:["Messaging","Quick Replies","Automation"],dbPlatform:"messenger"},{id:"meta_ads",name:"Meta Ads",description:"Facebook & Instagram ad accounts",icon:e=>{let{className:t}=e;return(0,r.jsx)("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1.41 16.09V20h-2.67v-1.93c-1.71-.36-3.16-1.46-3.27-3.4h1.96c.1 1.05.82 1.87 2.65 1.87 1.96 0 2.4-.98 2.4-1.59 0-.83-.44-1.61-2.67-2.14-2.48-.6-4.18-1.62-4.18-3.67 0-1.72 1.39-2.84 3.11-3.21V4h2.67v1.95c1.86.45 2.79 1.86 2.85 3.39H14.3c-.05-1.11-.64-1.87-2.22-1.87-1.5 0-2.4.68-2.4 1.64 0 .84.65 1.39 2.67 1.94s4.18 1.36 4.18 3.85c0 1.89-1.44 2.98-3.12 3.19z"})})},color:"#F59E0B",bgColor:"bg-amber-50 dark:bg-amber-950/30",borderColor:"border-amber-200 dark:border-amber-800",iconBg:"bg-amber-500",features:["Campaigns","Analytics","ROAS","Audiences"],dbPlatform:"meta_ads"}];function y(e){let{open:t,onOpenChange:a,onChanged:y}=e,[N,v]=(0,s.useState)([]),[j,k]=(0,s.useState)(!0),{connectPlatform:C}=(0,b.J)(),E=()=>{k(!0),h.api.get("/social/connected-assets").then(e=>{var t;v(((null===(t=e.data)||void 0===t?void 0:t.accounts)||[]).filter(e=>e.isActive))}).catch(()=>{}).finally(()=>k(!1))};(0,s.useEffect)(()=>{t&&E()},[t]);let F=e=>e?e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):String(e):"",z=e=>"messenger"===e?N.filter(e=>"facebook"===e.platform&&"page"===e.accountType):"instagram"===e?N.filter(e=>"instagram"===e.platform):N.filter(t=>t.platform===e);return(0,r.jsx)(c.yo,{open:t,onOpenChange:a,children:(0,r.jsxs)(c.ue,{className:"w-[420px] sm:w-[480px] p-0 flex flex-col overflow-visible",children:[(0,r.jsxs)(c.Tu,{className:"px-5 pt-4 pb-3 border-b border-slate-200 dark:border-slate-800",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(c.bC,{className:"text-base font-semibold",children:"Connected Assets"}),(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:E,disabled:j,className:"h-8 w-8",children:(0,r.jsx)(i.Z,{className:(0,g.cn)("w-3.5 h-3.5",j&&"animate-spin")})})]}),(0,r.jsxs)(c.Ei,{className:"text-[11px]",children:[N.length," active accounts connected"]})]}),(0,r.jsxs)(l.x,{className:"flex-1",children:[j?(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)(d.Z,{className:"w-5 h-5 animate-spin text-slate-400"})}):(0,r.jsx)("div",{className:"p-3 space-y-3",children:w.map(e=>{let t=e.icon,a=z(e.dbPlatform),s=a.length>0;return a.length,(0,r.jsxs)("div",{className:(0,g.cn)("rounded-xl border-2 transition-all overflow-hidden",s?e.borderColor:"border-slate-200 dark:border-slate-700"),children:[(0,r.jsxs)("div",{className:(0,g.cn)("px-3.5 py-3 flex items-start gap-3",s?e.bgColor:"bg-white dark:bg-slate-900"),children:[(0,r.jsx)("div",{className:(0,g.cn)("w-10 h-10 rounded-xl flex items-center justify-center shadow-sm flex-shrink-0",e.iconBg),children:(0,r.jsx)(t,{className:"w-5 h-5 fill-white"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-slate-800 dark:text-slate-200",children:e.name}),s?(0,r.jsxs)(n.C,{className:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-400 border-0 text-[10px] h-4 px-1.5",children:[(0,r.jsx)(u.Z,{className:"w-2.5 h-2.5 mr-0.5"})," Connected"]}):(0,r.jsx)(n.C,{variant:"outline",className:"text-[10px] h-4 px-1.5 text-slate-400 border-slate-300",children:"Not Connected"})]}),(0,r.jsx)("p",{className:"text-[11px] text-slate-500 dark:text-slate-400 mt-0.5",children:e.description}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1.5",children:[e.features.slice(0,2).map(e=>(0,r.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-slate-100 dar
1k:bg-slate-800 text-slate-500 dark:text-slate-400 font-medium",children:e},e)),e.features.length>2&&(0,r.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-slate-100 dark:bg-slate-800 text-slate-400 font-medium",children:["+",e.features.length-2]})]})]})]}),s&&(0,r.jsxs)("div",{className:"border-t border-slate-100 dark:border-slate-800",children:[a.map((s,o)=>(0,r.jsxs)("div",{className:(0,g.cn)("flex items-center gap-2.5 px-3.5 py-2",o<a.length-1&&"border-b border-slate-50 dark:border-slate-800/50"),children:[(0,r.jsx)("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{backgroundColor:e.color+"18"},children:(0,r.jsx)(t,{className:"w-3 h-3"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium text-slate-700 dark:text-slate-300 truncate",children:s.name}),s.username&&(0,r.jsxs)("p",{className:"text-[10px] text-slate-400 truncate",children:["@",s.username]})]}),s.followersCount?(0,r.jsxs)("span",{className:"text-[10px] text-slate-400 flex items-center gap-0.5",children:[(0,r.jsx)(f.Z,{className:"w-2.5 h-2.5"}),F(s.followersCount)]}):null,(0,r.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-green-500 flex-shrink-0",title:"Active"})]},s.id)),(0,r.jsx)("div",{className:"px-3.5 py-1.5 bg-slate-50 dark:bg-slate-800/30",children:(0,r.jsxs)("button",{onClick:()=>C(e.id,!0),className:"flex items-center gap-1 text-[10px] text-blue-600 hover:text-blue-700 font-medium",children:[(0,r.jsx)(m.Z,{className:"w-3 h-3"})," Add more accounts"]})})]}),!s&&(0,r.jsx)("div",{className:"px-3.5 py-2.5 border-t border-slate-100 dark:border-slate-800 bg-slate-50/50 dark:bg-slate-800/20",children:(0,r.jsxs)(o.z,{size:"sm",onClick:()=>C(e.id),className:"w-full text-xs h-8",style:{backgroundColor:e.color},children:[(0,r.jsx)(p.Z,{className:"w-3.5 h-3.5 mr-1.5"}),"Connect"]})})]},e.id)})}),(0,r.jsx)("div",{className:"px-4 pb-3 pt-1",children:(0,r.jsxs)("a",{href:"/dashboard/settings?tab=integrations",className:"text-[10px] text-slate-400 hover:text-slate-600 flex items-center gap-1",children:[(0,r.jsx)(x.Z,{className:"w-2.5 h-2.5"})," Advanced settings"]})})]})]})})}},96246:function(e,t,a){a.d(t,{F$:function(){return c},Q5:function(){return i},qE:function(){return l}});var r=a(57437),s=a(2265),o=a(61146),n=a(93448);let l=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.fC,{ref:t,className:(0,n.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",a),...s})});l.displayName=o.fC.displayName;let c=s.forwardRef((e,t)=>{let{className:a,alt:s="Avatar",...l}=e;return(0,r.jsx)(o.Ee,{ref:t,alt:s,className:(0,n.cn)("aspect-square h-full w-full",a),...l})});c.displayName=o.Ee.displayName;let i=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.NY,{ref:t,className:(0,n.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",a),...s})});i.displayName=o.NY.displayName},69174:function(e,t,a){a.d(t,{C:function(){return l}});var r=a(57437);a(2265);var s=a(90535),o=a(93448);let n=(0,s.j)("inline-flex items-center rounded-[4px] border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function l(e){let{className:t,variant:a,...s}=e;return(0,r.jsx)("div",{className:(0,o.cn)(n({variant:a}),t),...s})}},32060:function(e,t,a){a.d(t,{$F:function(){return i},AW:function(){return d},Ju:function(){return m},VD:function(){return p},Xi:function(){return u},bO:function(){return f},h_:function(){return c}});var r=a(57437),s=a(2265),o=a(70085),n=a(93448),l=a(20653);let c=o.fC,i=o.xz;o.ZA,o.Uv,o.Tr,o.Ee,s.forwardRef((e,t)=>{let{className:a,inset:s,children:c,...i}=e;return(0,r.jsxs)(o.fF,{ref:t,className:(0,n.cn)("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",s&&"pl-8",a),...i,children:[c,(0,r.jsx)(l.XCv,{className:"ml-auto"})]})}).displayName=o.fF.displayName,s.forwardRef((e,t)=>
1{let{className:a,...s}=e;return(0,r.jsx)(o.tu,{ref:t,className:(0,n.cn)("z-50 min-w-[8rem] overflow-hidden rounded-[4px] border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",a),...s})}).displayName=o.tu.displayName;let d=s.forwardRef((e,t)=>{let{className:a,sideOffset:s=4,...l}=e;return(0,r.jsx)(o.Uv,{children:(0,r.jsx)(o.VY,{ref:t,sideOffset:s,className:(0,n.cn)("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-[4px] border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",a),...l})})});d.displayName=o.VY.displayName;let u=s.forwardRef((e,t)=>{let{className:a,inset:s,...l}=e;return(0,r.jsx)(o.ck,{ref:t,className:(0,n.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",s&&"pl-8",a),...l})});u.displayName=o.ck.displayName;let f=s.forwardRef((e,t)=>{let{className:a,children:s,checked:c,...i}=e;return(0,r.jsxs)(o.oC,{ref:t,className:(0,n.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:c,...i,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(o.wU,{children:(0,r.jsx)(l.nQG,{className:"h-4 w-4"})})}),s]})});f.displayName=o.oC.displayName,s.forwardRef((e,t)=>{let{className:a,children:s,...c}=e;return(0,r.jsxs)(o.Rk,{ref:t,className:(0,n.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...c,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(o.wU,{children:(0,r.jsx)(l.jXb,{className:"h-2 w-2 fill-current"})})}),s]})}).displayName=o.Rk.displayName;let m=s.forwardRef((e,t)=>{let{className:a,inset:s,...l}=e;return(0,r.jsx)(o.__,{ref:t,className:(0,n.cn)("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",a),...l})});m.displayName=o.__.displayName;let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.Z0,{ref:t,className:(0,n.cn)("-mx-1 my-1 h-px bg-muted",a),...s})});p.displayName=o.Z0.displayName},75060:function(e,t,a){a.d(t,{_:function(){return i}});var r=a(57437),s=a(2265),o=a(6394),n=a(90535),l=a(93448);let c=(0,n.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),i=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.f,{ref:t,className:(0,l.cn)(c(),a),...s})});i.displayName=o.f.displayName},91032:function(e,t,a){a.d(t,{Ei:function(){return b},FF:function(){return h},Tu:function(){return x},aM:function(){return d},bC:function(){return g},ue:function(){return p},yo:function(){return i}});var r=a(57437),s=a(2265),o=a(49027),n=a(90535),l=a(20653),c=a(93448);let i=o.fC,d=o.xz;o.x8;let u=o.h_,f=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.aV,{className:(0,c.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...s,ref:t})});f.displayName=o.aV.displayName;let m=(0,n.j)("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),p=s.forwardRef((e,t)=>
1{let{side:a="right",className:s,children:n,...i}=e;return(0,r.jsxs)(u,{children:[(0,r.jsx)(f,{}),(0,r.jsxs)(o.VY,{ref:t,className:(0,c.cn)(m({side:a}),s),...i,children:[(0,r.jsxs)(o.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,r.jsx)(l.Pxu,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]}),n]})]})});p.displayName=o.VY.displayName;let x=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,c.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...a})};x.displayName="SheetHeader";let h=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,c.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};h.displayName="SheetFooter";let g=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.Dx,{ref:t,className:(0,c.cn)("text-lg font-semibold text-foreground",a),...s})});g.displayName=o.Dx.displayName;let b=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.dk,{ref:t,className:(0,c.cn)("text-sm text-muted-foreground",a),...s})});b.displayName=o.dk.displayName},71488:function(e,t,a){a.d(t,{_v:function(){return d},aJ:function(){return i},pn:function(){return l},u:function(){return c}});var r=a(57437),s=a(2265),o=a(61312),n=a(93448);let l=o.zt,c=o.fC,i=o.xz,d=s.forwardRef((e,t)=>{let{className:a,sideOffset:s=4,...l}=e;return(0,r.jsx)(o.h_,{children:(0,r.jsx)(o.VY,{ref:t,sideOffset:s,className:(0,n.cn)("z-[9999] overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",a),...l})})});d.displayName=o.VY.displayName},73608:function(e,t,a){a.d(t,{J:function(){return s}});var r=a(2265);function s(){let[e,t]=(0,r.useState)([]),[a,s]=(0,r.useState)([]),[o,n]=(0,r.useState)({}),[l,c]=(0,r.useState)({}),[i,d]=(0,r.useState)(!0),[u,f]=(0,r.useState)(!1),[m,p]=(0,r.useState)(!1),[x,h]=(0,r.useState)(null),[g,b]=(0,r.useState)(0),[w,y]=(0,r.useState)(0),N=(0,r.useCallback)(()=>{let e=localStorage.getItem("access_token"),t=localStorage.getItem("workspace_id");return{"Content-Type":"application/json",...e&&{Authorization:"Bearer ".concat(e)},...t&&{"X-Workspace-ID":t}}},[]),v=(0,r.useCallback)(async()=>{f(!0);try{let e=await fetch("".concat("","/api/social/platforms"),{headers:N()});if(!e.ok)throw Error("Failed to fetch platforms");let a=await e.json();t(a.platforms),y(a.configuredCount),h(null)}catch(e){console.error("Error fetching platforms:",e),h("Failed to load platforms")}finally{f(!1)}},[N]),j=(0,r.useCallback)(async()=>{p(!0);try{let e=await fetch("".concat("","/api/social/connected-assets"),{headers:N()});if(!e.ok)throw Error("Failed to fetch connected accounts");let t=await e.json();s(t.accounts),c(t.byPlatform),h(null)}catch(e){console.error("Error fetching accounts:",e),h("Failed to load connected accounts")}finally{p(!1)}},[N]),k=(0,r.useCallback)(async()=>{try{let e=await fetch("".concat("","/api/social/oauth-status"),{headers:N()});if(!e.ok)throw Error("Failed to fetch OAuth status");let t=await e.json();n(t.status),b(t.connectedCount),h(null)}catch(e){console.error("Error fetching OAuth status:",e),h("Failed to load OAuth status")}},[N]),C=(0,r.useCallback)(async()=>{d(!0),await Promise.all([v(),j(),k()]),d(!1)},[v,j,k]),E=(0,r.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,s=localStorage.getItem("workspace_id"),o=new URLSearchParams;s&&o.append("workspace_id",s),t&&o.append("force_reauth","true");let n=a||window.location.href;n&&o.append("redirect_uri",n),r&&r.length>0&&o.append("segments",r.join(","));let l=o.toString(),c="".concat("","/api/social/connect/").concat(e).concat(l?"?".concat(l):"");window.location.href=c},[]),F=(0,r.useCallback)(async(e,t)=>{try{let a=t?"".concat("","/api/social/disconnect/").concat(e,"?account_id=").concat(t):"".concat("","/api/social/disconnect/").concat(e);
1if(!(await fetch(a,{method:"DELETE",headers:N()})).ok)throw Error("Failed to disconnect");return await C(),!0}catch(e){return console.error("Error disconnecting:",e),h("Failed to disconnect account"),!1}},[N,C]),z=(0,r.useCallback)(async e=>{try{if(!(await fetch("".concat("","/api/social/refresh-token/").concat(e),{method:"POST",headers:N()})).ok)throw Error("Failed to refresh token");return await k(),!0}catch(e){return console.error("Error refreshing token:",e),h("Failed to refresh token"),!1}},[N,k]),S=(0,r.useCallback)(async e=>{try{if(!(await fetch("".concat("","/api/social/sync-accounts/").concat(e),{method:"POST",headers:N()})).ok)throw Error("Failed to sync accounts");return await j(),!0}catch(e){return console.error("Error syncing accounts:",e),h("Failed to sync accounts"),!1}},[N,j]),_=(0,r.useCallback)(async e=>{try{if(!(await fetch("".concat("","/api/social/mock/connect/").concat(e),{method:"POST",headers:N()})).ok)throw Error("Failed to mock connect");return await C(),!0}catch(e){return console.error("Error mock connecting:",e),h("Failed to mock connect platform"),!1}},[N,C]),A=(0,r.useCallback)(async e=>{try{if(!(await fetch("".concat("","/api/social/mock/disconnect/").concat(e),{method:"DELETE",headers:N()})).ok)throw Error("Failed to mock disconnect");return await C(),!0}catch(e){return console.error("Error mock disconnecting:",e),h("Failed to mock disconnect platform"),!1}},[N,C]),R=(0,r.useCallback)(async()=>{try{if(!(await fetch("".concat("","/api/social/mock/clear-all"),{method:"DELETE",headers:N()})).ok)throw Error("Failed to clear mock accounts");return await C(),!0}catch(e){return console.error("Error clearing mock accounts:",e),h("Failed to clear mock accounts"),!1}},[N,C]),P=(0,r.useRef)(!1);return(0,r.useEffect)(()=>{P.current||(P.current=!0,(async()=>{d(!0);try{await Promise.all([v(),j(),k()])}finally{d(!1)}})())},[]),{platforms:e,accounts:a,oauthStatus:o,accountsByPlatform:l,loading:i,platformsLoading:u,accountsLoading:m,error:x,connectedCount:g,configuredCount:w,fetchPlatforms:v,fetchAccounts:j,fetchOAuthStatus:k,refreshAll:C,connectPlatform:E,disconnectPlatform:F,refreshToken:z,syncAccounts:S,mockConnectPlatform:_,mockDisconnectPlatform:A,mockClearAll:R}}}}]);
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.